Skip to content

feat(flash): multi-stage ETA, real-time speed display, download robus… - #24

Open
Zhang-zu-hao wants to merge 1 commit into
Seeed-Projects:mainfrom
Zhang-zu-hao:feat/multi-stage-eta-download-enhancement
Open

feat(flash): multi-stage ETA, real-time speed display, download robus…#24
Zhang-zu-hao wants to merge 1 commit into
Seeed-Projects:mainfrom
Zhang-zu-hao:feat/multi-stage-eta-download-enhancement

Conversation

@Zhang-zu-hao

@Zhang-zu-hao Zhang-zu-hao commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds multi-stage ETA and real-time speed display to the flash center, and enhances download robustness for SharePoint/OneDrive CDN.

Changes

1. Multi-stage ETA & Speed Display

  • Sliding-window algorithm (30s window, 0.5s sampling) for download and extract stages
  • 4-stage progress mapping: download 0-50%, verify 50-60%, extract 60-80%, flash 80-100%
  • Status label updates every 0.5s (real-time speed/ETA)
  • Log updates every 5% (avoid spam)
  • Disconnect/resume detection: clears stale samples on cur backwards or >10s gap

2. Download Robustness

  • Range request 206 status validation
  • Part file short-read detection (got < expected)
  • Merged file size verification (actual != declared)
  • Retry count 3→5
  • SharePoint URL reordering (download=1 first, skip HTML failure)
  • print()_emit_log() (UI-visible messages)
  • HEAD request status logging + initial progress emission

3. Bug Fixes

  • Fix verify stage progress not showing (shared _last_log_pct variable)
  • Fix progress bar regression (flash stage 0% conflicting with extract 80%)
  • Fix download scene animation only reaching 50%
  • Optimize verify progress_val emission (3M→100 calls)

4. i18n

  • New keys: connecting, head_ok, head_failed, eta_calculating, verifying, extracting_with_eta
  • Updated: download/extract progress text with {speed} and {eta} placeholders

Files Changed

File +Add -Del
flash.py +52 -17
modules/flash/thread.py +151 -13
modules/flash/page.py +96 -18
locales/en/flash.json +13 -4
locales/zh-CN/flash.json +13 -4
Total +325 -56

Test Plan

  • Download stage: verify speed/ETA updates every 0.5s, scene animation 0-100%
  • Verify stage: verify progress text updates every 10%, no UI lag
  • Extract stage: verify speed/ETA display, WSL indeterminate mode
  • Flash stage: verify progress 80-100%, no regression
  • Disconnect/resume: verify speed/ETA recalculates from new data
  • SharePoint: verify download=1 URL tried first, no HTML failure

…tness

- Add sliding-window speed/ETA calculation for download and extract stages
- Map 4 stages to progress bar ranges (download 0-50%, verify 50-60%, extract 60-80%, flash 80-100%)
- Separate status label (0.5s update) from log (5% threshold) frequencies
- Fix verify stage progress not showing (shared _last_log_pct variable bug)
- Optimize verify progress_val emission (3M calls -> ~100)
- Add download integrity checks (206 status, short read, merge size mismatch)
- Reorder SharePoint URLs (download=1 first, skip HTML failure)
- Replace print() with _emit_log() for UI-visible messages
- Add HEAD request status logging and initial progress emission
- Detect disconnect/resume: clear stale samples on cur backwards or >10s gap
- Add i18n keys for connecting/head_ok/head_failed/eta_calculating/verifying/extracting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant