Branch data Line data Source code
1 : : #include "engine.h" 2 : : #include "calibration.h" 3 : : 4 : 10 : StateEngine getEngineState(Engine engine) { 5 : 10 : StateEngine stateEngine = ENGINE_OFF; 6 : : 7 [ + + ]: 10 : if (engine.rpm == 0) { 8 : 4 : stateEngine = ENGINE_OFF; 9 : : } else { 10 [ + + ]: 6 : if (engine.rpm >= EngineRPMMaximum) { 11 : 1 : stateEngine = ENGINE_RPM_MAXIMUM; 12 : : } else { 13 : 5 : stateEngine = ENGINE_WORKING; 14 : : } 15 : : } 16 : 10 : return stateEngine; 17 : : }