OTA: quiet the audio sources during a firmware upload
An upload during an active Spotify session crawled (~10 kB/s, 197 s) and ended in a reset (seen twice). Workaround: - aes67_ota_on_update(cb): cb(true) right before an accepted upload writes flash, cb(false) if it then fails. - The player pauses Spotify (spotify_pause -> SpircHandler::setPause, the app follows) and suspends HLS fetching (hls_suspend); resumed if the upload fails. AES67 TX keeps running (silence). - Verified: upload during Spotify playback paused the session and installed in 25.8 s (normal for 2 MB), clean reboot and self-test. Root cause still open (noted in CLAUDE.md with the other cspot items). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// Spotify Connect (cspot). Project code; GPL-3.0 through cspot.
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -24,6 +25,8 @@ typedef void (*spotify_event_cb_t)(spotify_event_t ev, int value);
|
||||
// Registers the zeroconf endpoints (/spotify_info) and, when source.mode is spotify/auto and the
|
||||
// client credentials are set, advertises the device and starts the session task.
|
||||
esp_err_t spotify_init(spotify_pcm_cb_t pcm, spotify_event_cb_t event);
|
||||
// Pause/resume the running session (the Spotify app follows). No-op without a session.
|
||||
void spotify_pause(bool pause);
|
||||
// Current state for status.spotify_state.
|
||||
const char *spotify_state(void);
|
||||
|
||||
|
||||
@@ -30,9 +30,19 @@ static std::shared_ptr<cspot::LoginBlob> s_blob;
|
||||
static std::atomic<bool> s_got_blob{false};
|
||||
static std::atomic<const char *> s_state{"disabled"};
|
||||
static std::atomic<uint64_t> s_pcm_bytes{0};
|
||||
static std::shared_ptr<cspot::SpircHandler> s_handler; // running session, else null
|
||||
static spotify_pcm_cb_t s_pcm_cb;
|
||||
static spotify_event_cb_t s_event_cb;
|
||||
|
||||
extern "C" void spotify_pause(bool pause)
|
||||
{
|
||||
auto h = s_handler;
|
||||
if (h) {
|
||||
h->setPause(pause);
|
||||
ESP_LOGI(TAG, "%s", pause ? "paused" : "resumed");
|
||||
}
|
||||
}
|
||||
|
||||
const char *spotify_state(void)
|
||||
{
|
||||
return s_state.load();
|
||||
@@ -225,6 +235,7 @@ static void session(void)
|
||||
}
|
||||
ESP_LOGI(TAG, "event %s", event_name(ev->eventType));
|
||||
});
|
||||
s_handler = handler;
|
||||
s_state = "connected";
|
||||
ESP_LOGI(TAG, "connected as %s", ctx->config.username.c_str());
|
||||
while (true) {
|
||||
@@ -246,6 +257,7 @@ static void spotify_task(void *arg)
|
||||
s_state = "error";
|
||||
ESP_LOGE(TAG, "session ended: %s", e.what());
|
||||
}
|
||||
s_handler.reset();
|
||||
vTaskDelay(pdMS_TO_TICKS(2000));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user