Spotify: end the session for OTA; app volume starts at the player's
- OTA: the player now ends the Spotify session (spotify_suspend: stop flag, waits until the session's tasks are gone, refuses new ones) instead of pausing it, and suspends HLS. Pausing was not enough (an upload still failed once with a paused session). Verified twice with a session running for minutes: "Disconnecting mercury session / session ended / suspended", installed in ~26 s, clean reboot. - Volume: createFromBlob() starts cspot at volume 0, which the app showed while we played at 100 %. The session now starts with the player's volume (spotify_set_volume); volumes coming from the app are stored exactly, without echo. Verified: slider starts at 100 %. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+8
-9
@@ -160,21 +160,20 @@ static void spotify_event(spotify_event_t ev, int value)
|
||||
}
|
||||
}
|
||||
|
||||
// Firmware upload: flash writes stall everything running from PSRAM; a Spotify session
|
||||
// streaming at the same time made uploads crawl and end in a reset. Quiet the sources meanwhile.
|
||||
// Firmware upload: flash writes stall tasks for > 20 ms at a time; with a Spotify session running,
|
||||
// uploads crawled and sometimes ended in a reset (pausing was not enough). End the session (its
|
||||
// tasks and connections are gone before the first write) and stop HLS fetching meanwhile. The
|
||||
// device reboots after a good upload anyway; after a failed one the sources come back (Spotify
|
||||
// waits for the app to reconnect).
|
||||
static void on_ota(bool starting)
|
||||
{
|
||||
static bool paused_spotify;
|
||||
if (starting) {
|
||||
paused_spotify = s_src == PLAYER_SRC_SPOTIFY && !s_paused;
|
||||
spotify_pause(true);
|
||||
spotify_suspend(true);
|
||||
hls_suspend(true);
|
||||
ESP_LOGI(TAG, "firmware update: sources paused");
|
||||
ESP_LOGI(TAG, "firmware update: Spotify session ended, HLS suspended");
|
||||
} else {
|
||||
hls_suspend(false);
|
||||
if (paused_spotify) {
|
||||
spotify_pause(false);
|
||||
}
|
||||
spotify_suspend(false);
|
||||
ESP_LOGI(TAG, "firmware update failed: sources resumed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user