Improve SOC and load LED behavior at low SOC
This commit prevents that the SOC bar shows 2 LEDs already even though the load is still switched of because of low voltage.
This commit is contained in:
+3
-3
@@ -228,7 +228,7 @@ void leds_toggle_error()
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void leds_update_soc(int soc)
|
||||
void leds_update_soc(int soc, bool load_off_low_soc)
|
||||
{
|
||||
#ifndef LED_DCDC
|
||||
// if there is no dedicated LED for the DC/DC converter status, blink SOC
|
||||
@@ -246,12 +246,12 @@ void leds_update_soc(int soc)
|
||||
trigger_timeout[LED_SOC_1] = -1;
|
||||
trigger_timeout[LED_SOC_2] = -1;
|
||||
trigger_timeout[LED_SOC_3] = -1;
|
||||
if (soc > 80) {
|
||||
if (soc > 80 && !load_off_low_soc) {
|
||||
led_states[LED_SOC_1] = blink_chg;
|
||||
led_states[LED_SOC_2] = LED_STATE_ON;
|
||||
led_states[LED_SOC_3] = LED_STATE_ON;
|
||||
}
|
||||
else if (soc > 20) {
|
||||
else if (soc > 20 && !load_off_low_soc) {
|
||||
led_states[LED_SOC_1] = LED_STATE_OFF;
|
||||
led_states[LED_SOC_2] = blink_chg;
|
||||
led_states[LED_SOC_3] = LED_STATE_ON;
|
||||
|
||||
+4
-1
@@ -81,8 +81,11 @@ void leds_flicker(int led, int timeout = -1);
|
||||
void leds_update_1s();
|
||||
|
||||
/** Updates SOC LED bar (if existing)
|
||||
*
|
||||
* @param soc SOC in percent
|
||||
* @param load_off_low_soc Prevents showing two SOC LEDs if load is switched off because of low SOC
|
||||
*/
|
||||
void leds_update_soc(int soc);
|
||||
void leds_update_soc(int soc, bool load_off_low_soc = false);
|
||||
|
||||
/** Toggles between even and uneven LEDs switched on/off to create
|
||||
* annoying flashing in case of an error.
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ int main()
|
||||
eeprom_update();
|
||||
|
||||
leds_update_1s();
|
||||
leds_update_soc(charger.soc);
|
||||
leds_update_soc(charger.soc, load.switch_state == LOAD_STATE_OFF_LOW_SOC);
|
||||
|
||||
uext_process_1s();
|
||||
thingset_serial_process_1s();
|
||||
|
||||
Reference in New Issue
Block a user