This commit is contained in:
philippe44
2019-08-11 13:52:35 -07:00
parent 6566e06bdf
commit cf6d9c0911
3 changed files with 14 additions and 7 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);