Diagnose battery-only startup failure on Waveshare ESP32-S3-RLCD-4.2#8
Merged
Diagnose battery-only startup failure on Waveshare ESP32-S3-RLCD-4.2#8
Conversation
- Run wifi_manager_connect() in a background FreeRTOS task to avoid blocking the LVGL render loop (UI stayed on "WiFi: connecting...") - Register WiFi state callback to update the status bar on connect/error/disconnect events with proper LVGL locking - Register Git sync callback to show sync progress, success, and error messages on the status bar with proper LVGL locking - Free HTTP response buffer after git sync task completes to prevent memory leak that could cause crash on repeated push attempts - Increase git_sync task stack from 16KB to 32KB to prevent stack overflow during HTTP operations with large payloads Agent-Logs-Url: https://github.com/clackups/draftling/sessions/0c16c29a-785c-4840-8cbb-dca903024eef Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/0c16c29a-785c-4840-8cbb-dca903024eef Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/c795c8e1-9853-486d-a701-c7bae0b96f45 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
- Check xTaskCreatePinnedToCore return value in git_sync_start and report error via callback if task creation fails - Set s_state to GIT_SYNC_IN_PROGRESS before creating the task to prevent re-entrant calls and ensure proper state tracking - Reset s_state to GIT_SYNC_ERROR in sync_task when the operation fails, so the state is not stuck at IN_PROGRESS - Check git_sync_start return value in both the menu and Ctrl+G handlers, showing an error status when it fails instead of the misleading 'syncing...' message Agent-Logs-Url: https://github.com/clackups/draftling/sessions/f6e3b3ec-a4d8-4c0d-a3be-d6f1f4ac1620 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/f6e3b3ec-a4d8-4c0d-a3be-d6f1f4ac1620 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/fbc58ba5-ae26-4ae6-81cf-ea20f9c23afb Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…rruption on power loss Agent-Logs-Url: https://github.com/clackups/draftling/sessions/22b8dd44-ad17-478e-baca-7993d9b4013d Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/caddc1b3-d3ff-4d1f-87a0-75ae9f3d4a9c Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…message Agent-Logs-Url: https://github.com/clackups/draftling/sessions/caddc1b3-d3ff-4d1f-87a0-75ae9f3d4a9c Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…RAM heap, reduce task stack to 8KB Agent-Logs-Url: https://github.com/clackups/draftling/sessions/d15e1fb5-d920-4ce3-affc-9ea2da19da72 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
xTaskCreatePinnedToCore allocates its stack from internal DRAM, but with BLE + WiFi active there is not enough contiguous internal DRAM available even for 8KB. Switch to xTaskCreateStaticPinnedToCore with a stack buffer allocated from SPIRAM via heap_caps_malloc(MALLOC_CAP_SPIRAM). Also enable CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y which is required by FreeRTOS to allow task stacks in external memory. Agent-Logs-Url: https://github.com/clackups/draftling/sessions/f361a606-4170-4f73-a1cc-d33df52b73ce Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/7e6c184d-af31-4925-b9b5-1b7ed3a2bd7a Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…y path handling - Strip trailing .git and slashes from repo_url (GitHub API rejects .git) - do_push() now returns ESP_FAIL when all files fail to push - sync_task tracks pull/push results separately; no false "sync complete" - For GIT_SYNC_BOTH, pull 404 is non-fatal (remote dir may not exist yet) - Pull URL avoids trailing slash when remote_path is empty Agent-Logs-Url: https://github.com/clackups/draftling/sessions/7e6c184d-af31-4925-b9b5-1b7ed3a2bd7a Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…a file exists before creating it Agent-Logs-Url: https://github.com/clackups/draftling/sessions/c4f21365-ecaf-4ba3-8869-b451f921eac5 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…tor before sync Agent-Logs-Url: https://github.com/clackups/draftling/sessions/604997b3-6c8c-49f4-a999-54393b049a38 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
…nges Agent-Logs-Url: https://github.com/clackups/draftling/sessions/37a5d8e2-8925-48f2-a26a-4bb535ee1802 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Store per-file blob SHAs in .git_state after each sync. On subsequent syncs, compare saved vs local vs remote to determine: - Push: skip files not modified locally (local SHA == saved SHA) - Pull: skip files not changed on remote (remote SHA == saved SHA) - Conflict: if both local and remote changed, keep local edits Agent-Logs-Url: https://github.com/clackups/draftling/sessions/d6e00c03-e0e2-4d39-a15a-c3dfe88f5a43 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
After a successful git sync, if a file is open in the editor, reload it from disk so the user sees any changes pulled from the remote. Change Ctrl+W from connect-only to a toggle: disconnect WiFi if already connected, connect if disconnected. Agent-Logs-Url: https://github.com/clackups/draftling/sessions/aa9d8592-3198-4aed-91cd-0f042fe54940 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Agent-Logs-Url: https://github.com/clackups/draftling/sessions/aa9d8592-3198-4aed-91cd-0f042fe54940 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Physical comma -> б/Б, physical dot -> ю/Ю, physical slash -> ./, matching the standard Ukrainian keyboard layout. Agent-Logs-Url: https://github.com/clackups/draftling/sessions/3368a6f9-1656-4253-983a-be987081ad37 Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Shifted number row fixes (standard Ukrainian JCUKEN layout): - Shift+3: # -> numero sign (U+2116) - Shift+4: $ -> ; - Shift+6: ^ -> : - Shift+7: & -> ? Grave key fix: - Normal: duplicate ghe-with-upturn -> apostrophe (essential for Ukrainian) - Shifted: ghe-with-upturn -> hryvnia sign (U+20B4) Note: numero sign and hryvnia sign require font range extension to display on screen (currently outside 0x20-7F,A0-FF,400-4FF). Agent-Logs-Url: https://github.com/clackups/draftling/sessions/efbda6a8-3203-4fc6-806a-863181f8c44e Co-authored-by: clackups <179045798+clackups@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
clackups
April 17, 2026 13:36
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Device does not power up when an 18650 battery is inserted without USB. Connecting USB first allows normal PWR button operation afterward. Reported in waveshareteam/ESP32-S3-RLCD-4.2#2.
Analysis
No code changes — this is a hardware-level issue on the Waveshare board, not a firmware bug.
Findings from Waveshare factory firmware review
10_FactoryProgram) contains zero power management or deep-sleep code — on/off is handled entirely by a hardware power latch tied to the PWR buttonstandby_enter_sleep()correctly uses EXT0 wakeup on GPIO18, but this is irrelevant to the cold-start problemRoot cause
The board's power management IC (or discrete latch circuit) likely enters shipping mode on first battery insertion. In this state:
Recommended next steps
01_Factory_V1.bin) to rule out any firmware-specific timing differences