mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 12:07:09 +03:00
Fixes #50 - Green led flash state reset on wifi connect - release
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -84,8 +83,8 @@ static void vCallbackFunction( TimerHandle_t xTimer ) {
|
||||
*/
|
||||
bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
|
||||
if (!leds[idx].gpio || leds[idx].gpio < 0 ) return false;
|
||||
|
||||
ESP_LOGD(TAG,"led_blink_core");
|
||||
|
||||
ESP_LOGD(TAG,"led_blink_core led idx %d, ontime %d, offtime %d, pushing %s. Led state: pushedon %d, pushedoff %d, timer %s, pushed %s", idx,ontime,offtime,pushed?"TRUE":"FALSE", leds[idx].pushedon,leds[idx].pushedoff,leds[idx].timer?"TRUE":"FALSE", leds[idx].pushed?"TRUE":"FALSE");
|
||||
if (leds[idx].timer) {
|
||||
// normal requests waits if a pop is pending
|
||||
if (!pushed && leds[idx].pushed) {
|
||||
@@ -98,15 +97,18 @@ bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
|
||||
|
||||
// save current state if not already pushed
|
||||
if (!leds[idx].pushed) {
|
||||
ESP_LOGD(TAG,"Pushing state. Ontime %d->%d. Offtime %d->%d",leds[idx].pushedon,leds[idx].ontime, leds[idx].pushedoff,leds[idx].offtime);
|
||||
leds[idx].pushedon = leds[idx].ontime;
|
||||
leds[idx].pushedoff = leds[idx].offtime;
|
||||
leds[idx].pushed = pushed;
|
||||
|
||||
}
|
||||
|
||||
// then set new one
|
||||
leds[idx].ontime = ontime;
|
||||
leds[idx].offtime = offtime;
|
||||
|
||||
|
||||
|
||||
if (ontime == 0) {
|
||||
ESP_LOGD(TAG,"led %d, setting reverse level", idx);
|
||||
set_level(leds + idx, false);
|
||||
@@ -124,7 +126,8 @@ bool led_blink_core(int idx, int ontime, int offtime, bool pushed) {
|
||||
ESP_LOGD(TAG,"led %d, Setting gpio %d and starting timer", idx, leds[idx].gpio);
|
||||
if (xTimerStart(leds[idx].timer, BLOCKTIME) == pdFAIL) return false;
|
||||
}
|
||||
|
||||
ESP_LOGD(TAG,"led_blink_core END led idx %d, ontime %d, offtime %d, pushing %s. Led state: pushedon %d, pushedoff %d, timer %s, pushed %s", idx,ontime,offtime,pushed?"TRUE":"FALSE", leds[idx].pushedon,leds[idx].pushedoff,leds[idx].timer?"TRUE":"FALSE", leds[idx].pushed?"TRUE":"FALSE");
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user