uppercase functions

This commit is contained in:
Matthew Kennedy 2021-11-03 23:02:11 -07:00
parent 1ce6981b53
commit 0a117089b8
4 changed files with 13 additions and 11 deletions

View File

@ -2,17 +2,17 @@
static Fault currentFault = Fault::None; static Fault currentFault = Fault::None;
void setFault(Fault fault) void SetFault(Fault fault)
{ {
currentFault = fault; currentFault = fault;
} }
bool hasFault() bool HasFault()
{ {
return currentFault != Fault::None; return currentFault != Fault::None;
} }
Fault getCurrentFault() Fault GetCurrentFault()
{ {
return currentFault; return currentFault;
} }

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
enum class Fault #include <cstdint>
enum class Fault : uint8_t
{ {
None = 0, None = 0,
@ -10,6 +12,6 @@ enum class Fault
SensorUnderheat = 5, SensorUnderheat = 5,
}; };
void setFault(Fault fault); void SetFault(Fault fault);
bool hasFault(); bool HasFault();
Fault getCurrentFault(); Fault GetCurrentFault();

View File

@ -61,7 +61,7 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
} }
else if (timeCounter == 0) else if (timeCounter == 0)
{ {
setFault(Fault::SensorDidntHeat); SetFault(Fault::SensorDidntHeat);
return HeaterState::Stopped; return HeaterState::Stopped;
} }
@ -71,12 +71,12 @@ static HeaterState GetNextState(HeaterState state, float sensorEsr)
case HeaterState::ClosedLoop: case HeaterState::ClosedLoop:
if (sensorEsr < HEATER_OVERHEAT_ESR) if (sensorEsr < HEATER_OVERHEAT_ESR)
{ {
setFault(Fault::SensorOverheat); SetFault(Fault::SensorOverheat);
return HeaterState::Stopped; return HeaterState::Stopped;
} }
else if (sensorEsr > HEATER_UNDERHEAT_ESR) else if (sensorEsr > HEATER_UNDERHEAT_ESR)
{ {
setFault(Fault::SensorUnderheat); SetFault(Fault::SensorUnderheat);
return HeaterState::Stopped; return HeaterState::Stopped;
} }

View File

@ -28,7 +28,7 @@ int main() {
while(true) while(true)
{ {
auto fault = getCurrentFault(); auto fault = GetCurrentFault();
if (fault == Fault::None) if (fault == Fault::None)
{ {