diff --git a/components/io/led.c b/components/io/led.c index c00b3c08..702db2cb 100644 --- a/components/io/led.c +++ b/components/io/led.c @@ -59,10 +59,12 @@ bool led_blink_core(int idx, int ontime, int offtime, bool pushed) { xTimerStop(leds[idx].timer, BLOCKTIME); } - // save current state - leds[idx].pushedon = leds[idx].ontime; - leds[idx].pushedoff = leds[idx].offtime; - leds[idx].pushed = pushed; + // save current state if not already pushed + if (!leds[idx].pushed) { + leds[idx].pushedon = leds[idx].ontime; + leds[idx].pushedoff = leds[idx].offtime; + leds[idx].pushed = pushed; + } // then set new one leds[idx].ontime = ontime; diff --git a/components/squeezelite/output_i2s.c b/components/squeezelite/output_i2s.c index 36e60007..649e5ef4 100644 --- a/components/squeezelite/output_i2s.c +++ b/components/squeezelite/output_i2s.c @@ -414,6 +414,7 @@ static void *output_thread_i2s() { // manage led display if (state != output.state) { + LOG_INFO("Output state is %u", output.state); if (output.state == OUTPUT_OFF) led_blink(LED_GREEN, 100, 2500); else if (output.state == OUTPUT_STOPPED) led_blink(LED_GREEN, 200, 1000); else if (output.state == OUTPUT_RUNNING) led_on(LED_GREEN); @@ -422,7 +423,6 @@ static void *output_thread_i2s() { if (output.state == OUTPUT_OFF) { UNLOCK; - LOG_INFO("Output state is off."); if (isI2SStarted) { isI2SStarted = false; i2s_stop(CONFIG_I2S_NUM); @@ -580,6 +580,10 @@ void dac_cmd(dac_cmd_e cmd, ...) { va_end(args); } +/**************************************************************************************** + * SPDIF support + */ + #define PREAMBLE_B (0xE8) //11101000 #define PREAMBLE_M (0xE2) //11100010 #define PREAMBLE_W (0xE4) //11100100 @@ -595,7 +599,8 @@ extern const u16_t spdif_bmclookup[256]; after BMC encoding, each bits becomes 2 hence this becomes a 64 bits word. The the trick is to start not with a PPPP sequence but with an VUCP sequence to that the 16 bits samples are aligned with a BMC word boundary. Note that the LSB of the - audio is transmitted first (not the MSB) + audio is transmitted first (not the MSB) and that ESP32 libray sends R then L, + contrary to what seems to be usually done, so (dst) order had to be changed */ void spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst, size_t *count) { u16_t hi, lo, aux; diff --git a/main/cmd_wifi.c b/main/cmd_wifi.c index f140d35e..40a6f52d 100644 --- a/main/cmd_wifi.c +++ b/main/cmd_wifi.c @@ -46,8 +46,8 @@ static void event_handler(void* arg, esp_event_base_t event_base, int32_t event_id, void* event_data) { if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) { - esp_wifi_connect(); led_blink_pushed(LED_GREEN, 250, 250); + esp_wifi_connect(); xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { led_unpush(LED_GREEN);