Save to NVS on suspend and wake-up

This commit is contained in:
fruchti 2020-09-20 17:40:13 +02:00
parent 10a5973361
commit a3799b02a0

View file

@ -26,12 +26,14 @@ int main(void)
if(LightSensor_RelativeBrightness == 0 && !powered_down) if(LightSensor_RelativeBrightness == 0 && !powered_down)
{ {
LED_Suspend(); LED_Suspend();
NVS_Save();
powered_down = true; powered_down = true;
} }
if(powered_down && LightSensor_RelativeBrightness > 0) if(powered_down && LightSensor_RelativeBrightness > 0)
{ {
LED_WakeUp();
powered_down = false; powered_down = false;
NVS_Save();
LED_WakeUp();
} }
} }