Skip to content

Commit

Permalink
Only add break in the starting state, and let running state switch to…
Browse files Browse the repository at this point in the history
… running instead of fault
  • Loading branch information
perrrre committed Feb 12, 2025
1 parent 5a28e64 commit c43a32b
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void InternalCombustionEngineControl::Run()
case State::Stopped: {
controlEngineStop();

if (user_request == UserOnOffRequest::On && !maximumRetriesReached() && isPermittedToStart(now)) {
if (user_request == UserOnOffRequest::On && !maximumRetriesReached()) {

_state = State::Starting;
_state_start_time = now;
Expand All @@ -160,17 +160,18 @@ void InternalCombustionEngineControl::Run()
_starting_retry_cycle = 0;
PX4_INFO("ICE: Abort");

} else if (isEngineRunning(now)) {
_state = State::Running;
PX4_INFO("ICE: Starting finished");

} else if (maximumRetriesReached()) {
_state = State::Fault;
PX4_WARN("ICE: Fault");

} else if (!isPermittedToStart(now)) {
_state = State::Stopped;
PX4_INFO("ICE: Pause Before Restart");
controlEngineStop();
_state_start_time = now;

} else if (isEngineRunning(now)) {
_state = State::Running;
PX4_INFO("ICE: Starting finished");

}

}
Expand All @@ -187,8 +188,7 @@ void InternalCombustionEngineControl::Run()
} else if (!isEngineRunning(now) && _param_ice_running_fault_detection.get()) {
// without RPM feedback we assume the engine is running after the
// starting procedure but only switch state if fault detection is enabled
_state = State::Fault;
_start_rest_time = now;
_state = State::Starting;
PX4_WARN("ICE: Running Fault detected");
}
}
Expand All @@ -203,10 +203,6 @@ void InternalCombustionEngineControl::Run()
_starting_retry_cycle = 0;
PX4_INFO("ICE: Abort");

} else if (!maximumRetriesReached()) {
_state = State::Stopped;
PX4_INFO("ICE: Pause Before Restart");

} else {
controlEngineFault();
}
Expand Down

0 comments on commit c43a32b

Please sign in to comment.