Commit Graph

5 Commits

Author SHA1 Message Date
Adolfo be9229b80d refactor(DiscoveryMountain): split monolithic main.c into modular files
- Extracted app_context (global AppCtx G definition)
- storage: path helpers, LRU, sort, fmt_time, per-episode resume map, state persistence
- network: resolve_host, normalize URL, http_get_raw with growing PSRAM buffer, fetch_data
- download: dl_ep_raw with progress tracking, cancel, overlay UI (show/hide/update)
- player: audio device, stream, play_task with resume seek, start/select/next/prev with position save/restore
- ui: build_ui, timers, season picker, button callbacks, periodic save
- main: minimal glue, fetch_task, onShow/onHide, app registration
- Preserves all previous fixes: download progress overlay, per-episode resume, robust download handling
- Build verified: 111 undef, all exported
2026-07-22 17:11:59 -04:00
Adolfo 6bfe514ff1 feat(DiscoveryMountain): add download progress overlay and per-episode resume tracking
- Show full-screen downloading modal with progress bar, percent and KB detail, cancel button
- Track dl_total/dl_expected without LVGL locks, update via ui_timer (200ms)
- Normalize audio URLs (relative /api/files/ -> PB prefix), grow PSRAM fetch buffer 64K->600K, handle timeouts and require 95% of Content-Length
- Persist per-episode playback position in state.json positions map, restore on select_ep/go_next/go_prev
- Save position periodically (5s), on pause, on hide, and on natural finish (clears completed)
- Fix seek on resume using byte estimate and total_decoded_samples correction
- Verified symbols: 111 undefined, all exported
2026-07-22 16:54:40 -04:00
Adolfo be07675d00 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
2026-07-21 22:24:45 -04:00
Adolfo 343da892bc fix(DiscoveryMountain): playback progress and stack overflow
- fix pos_sec integer division bug: samples/hz always 0 -> use total_decoded_samples/hz
- increase dm_play stack 12288->16384, dm_fetch 16384 to avoid overflow on 91KB JSON
- allocate mp3dec_t from PSRAM not stack
- add ID3v2 skip for mp3 files with XMP metadata
- reset last_pct on select/start to show progress bar
- remove auto-play for stability, user presses Play manually
- download now uses PSRAM 8192/4096 buffers, simple HTTP/1.0 non-chunked streaming

Tested on 192.168.68.132: fetch 37/232, download 4.3MB ok, playback opens stream sr=16000 ch=1 ok, no immediate crash.

Fixes #autoplay progress issue
2026-07-21 22:24:24 -04:00
Adolfo 80ab2880d9 fix(DiscoveryMountain): resolve crash after install – missing symbols, PSRAM, fetch non-blocking
- manifest V1 -> V2, vendor cJSON, replace roller with dropdown, qsort -> bubble, font -> lvgl_get_text_font
- fix memset(&G,0,0) -> sizeof(G)
- move network I/O off LVGL thread to fetch_task (16384 stack) with PSRAM buffers, raw lwIP sockets HTTP/1.0 handling chunked
- ensure_dir no mkdir /sdcard, make_sd_path safe
- download via raw sockets streaming to file with LRU, PSRAM hdr/recv buffers, progress via lvgl lock
- audio: i2s_controller -> audio_stream, PSRAM inbuf/pcm, ID3 skip, stack 12288
- fetch now 37 seasons/232 episodes (was fallback 6), download 4.3MB OK
- add CRASH_ANALYSIS.md

Co-authored with debugging on 192.168.68.132
2026-07-21 22:16:26 -04:00