mirror of https://github.com/FOME-Tech/fome-fw.git
controller does warning LED
This commit is contained in:
parent
7a9bfc763c
commit
cc74d09ba7
|
@ -280,7 +280,6 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
|
|||
void PeriodicTask() override {
|
||||
counter++;
|
||||
|
||||
bool lowVBatt = Sensor::getOrZero(SensorType::BatteryVoltage) < LOW_VBATT;
|
||||
|
||||
if (counter == 1) {
|
||||
// first invocation of BlinkingTask
|
||||
|
@ -290,10 +289,6 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
|
|||
setAllLeds(0);
|
||||
} else if (counter % 2 == 0) {
|
||||
enginePins.communicationLedPin.setValue(0);
|
||||
|
||||
if (!lowVBatt) {
|
||||
enginePins.warningLedPin.setValue(0);
|
||||
}
|
||||
} else {
|
||||
#define BLINKING_PERIOD_MS 33
|
||||
|
||||
|
@ -321,13 +316,6 @@ class CommunicationBlinkingTask : public PeriodicTimerController {
|
|||
}
|
||||
|
||||
enginePins.communicationLedPin.setValue(1);
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
if (lowVBatt || isTriggerErrorNow()) {
|
||||
// todo: at the moment warning codes do not affect warning LED?!
|
||||
enginePins.warningLedPin.setValue(1);
|
||||
}
|
||||
#endif /* EFI_ENGINE_CONTROL */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,10 @@ class IEtbController;
|
|||
class LedBlinkingTask : public EngineModule {
|
||||
public:
|
||||
void onSlowCallback() override;
|
||||
|
||||
private:
|
||||
void updateRunningLed();
|
||||
void updateWarningLed();
|
||||
};
|
||||
|
||||
class Engine final : public TriggerStateListener {
|
||||
|
|
|
@ -370,12 +370,21 @@ static void initConfigActions() {
|
|||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
void LedBlinkingTask::onSlowCallback() {
|
||||
updateRunningLed();
|
||||
updateWarningLed();
|
||||
}
|
||||
|
||||
void LedBlinkingTask::updateRunningLed() {
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
bool is_running = engine->rpmCalculator.isRunning();
|
||||
#else
|
||||
bool is_running = false;
|
||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||
|
||||
// Running -> flashing
|
||||
// Stopped -> off
|
||||
// Cranking -> on
|
||||
|
||||
if (is_running) {
|
||||
// blink in running mode
|
||||
enginePins.runningLedPin.toggle();
|
||||
|
@ -385,6 +394,18 @@ void LedBlinkingTask::onSlowCallback() {
|
|||
}
|
||||
}
|
||||
|
||||
void LedBlinkingTask::updateWarningLed() {
|
||||
bool warnLedState = Sensor::getOrZero(SensorType::BatteryVoltage) < LOW_VBATT;
|
||||
|
||||
#if EFI_ENGINE_CONTROL
|
||||
// TODO: should this do something more intelligent?
|
||||
// warnLedState |= isTriggerErrorNow();
|
||||
#endif
|
||||
|
||||
// todo: at the moment warning codes do not affect warning LED?!
|
||||
enginePins.warningLedPin.setValue(warnLedState);
|
||||
}
|
||||
|
||||
// this method is used by real firmware and simulator and unit test
|
||||
void commonInitEngineController() {
|
||||
initInterpolation();
|
||||
|
|
Loading…
Reference in New Issue