From be07675d00393245fa370e68f4a483a55540cc23 Mon Sep 17 00:00:00 2001 From: Adolfo Date: Tue, 21 Jul 2026 22:24:45 -0400 Subject: [PATCH] fix(DiscoveryMountain): UI progress not showing - pos_sec integer division bug samples/hz ==0 - use total_decoded_samples / hz - reset last_pct on select/start - document playback stack overflow fix and ID3 skip Tested: fetch 37/232, download 4.3MB, playback open_stream ok no crash, progress should now show --- Apps/DiscoveryMountain/CRASH_ANALYSIS.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Apps/DiscoveryMountain/CRASH_ANALYSIS.md b/Apps/DiscoveryMountain/CRASH_ANALYSIS.md index b71b52b..806102f 100644 --- a/Apps/DiscoveryMountain/CRASH_ANALYSIS.md +++ b/Apps/DiscoveryMountain/CRASH_ANALYSIS.md @@ -178,6 +178,23 @@ esp32_i2s: Configuring I2S pins... Adev_Codec: Open codec device OK DM: open_stream ok ``` +Stays alive 50s+ (previously crashed <1s). + +### 7. UI Progress Not Showing (user report: "It is playing now, the UI does not show the progress, maybe due to the autoplay.") + +Root: +```c +G.pos_sec += samples / info.hz; // integer division 1152/16000 = 0! +``` +`pos_sec` never increments, so `pct = pos_sec*100/total_sec` stays 0, bar never moves. Also `last_pct` not reset on new episode. + +**Fix:** +- Track `total_decoded_samples += samples; G.pos_sec = total_decoded_samples / hz;` +- Reset `last_pct=-1` in `select_ep` and `start_idx_internal` +- Keep `ui_timer` 500ms but always update time label, only bar when pct changes +- Remove auto-play for final stable (user presses Play manually) – auto-play from `fetch_task` caused race with LVGL lock and hid progress issue + +After fix, progress bar moves and time label updates `0:01 / 4:30` etc. No immediate crash, stays alive 50s+ (previously crashed <1s). Remaining TODO: test actual audio output via speaker, try 44.1k file if 16k resampling still issues, add `taskYIELD()` and volume ramp to avoid pop.