mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-12 01:24:04 +00:00
improved statusled handling in background tasks
This commit is contained in:
+3
-1
@@ -843,7 +843,7 @@ void run50TimesPerSecond()
|
||||
timer20ms = millis() + 20;
|
||||
PluginCall(PLUGIN_FIFTY_PER_SECOND, 0, dummyString);
|
||||
|
||||
statusLED(false);
|
||||
// statusLED(false);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
@@ -1179,4 +1179,6 @@ void backgroundtasks()
|
||||
#endif
|
||||
|
||||
yield();
|
||||
|
||||
statusLED(false);
|
||||
}
|
||||
|
||||
+8
-2
@@ -354,6 +354,7 @@ boolean timeOut(unsigned long timer)
|
||||
void statusLED(boolean traffic)
|
||||
{
|
||||
static int gnStatusValueCurrent = -1;
|
||||
static long int gnLastUpdate = millis();
|
||||
|
||||
if (Settings.Pin_status_led == -1)
|
||||
return;
|
||||
@@ -379,8 +380,13 @@ void statusLED(boolean traffic)
|
||||
}
|
||||
else //connected
|
||||
{
|
||||
nStatusValue -= STATUS_PWM_NORMALFADE; //ramp down slowly
|
||||
nStatusValue = std::max(nStatusValue, STATUS_PWM_NORMALVALUE);
|
||||
long int delta=millis()-gnLastUpdate;
|
||||
if (delta>0 || delta<0 )
|
||||
{
|
||||
nStatusValue -= STATUS_PWM_NORMALFADE; //ramp down slowly
|
||||
nStatusValue = std::max(nStatusValue, STATUS_PWM_NORMALVALUE);
|
||||
gnLastUpdate=millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user