Repository navigation
Port GarageDoor production improvements: startup watchdog and bounded API parsing - #38
Merged
Merged
Conversation
… API parsing - Add TcpBridge::armStartupWatchdog() / disarmStartupWatchdog() using esp_timer (30s timeout) - Add CONNECTION_TIMEOUT_MS, SESSION_TIMEOUT_MS, KEEP_ALIVE_INTERVAL_MS constants - Replace unbounded scanAPI with bounded packet-buffer version from GarageDoor - Add connection management: checkReset, resetConnection, checkConnection, connectionCheck - Add session timeout tracking and unconnected timer with restart on timeout - Replace heap-allocated APIReturn with inline apiReturn member - Replace Serial.print/println with WEB3E_PRINT/WEB3E_PRINTLN macros throughout - Update sendRefreshRequest with retry logic and flush/clear for arduino-esp32 3.x - Maintain KEEP_ALIVE_INTERVAL_MS instead of hardcoded 60s - Update e2e test and Wallet Bridge examples to call armStartupWatchdog() in setup() All changes ported from Rob's production GarageDoor firmware (v1.44 + local patches). Keeps existing opcode 0x09/0x0A, setProxy, and percolate.one:8083 defaults from PR #37. Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
…me declaration - Fixed sed search-replace error: WEB3E_PRINTln -> WEB3E_PRINTLN in: - src/UdpBridge.cpp - src/Util.cpp - src/uint256/uint128_t.cpp - src/uint256/uint256_t.cpp - Restored long getLastCommsTime() declaration in TcpBridge.h (still in use) - ecdsa.c RFC6979 functions: already in rfc6979.c, no duplicate code in master Verified clean build with PlatformIO: - test/hardware/proxy_e2e (esp32dev): SUCCESS - examples/Wallet Bridge 1 (esp32dev): SUCCESS Co-authored-by: James Brown <JamesSmartCell@users.noreply.github.com>
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.
Overview
This PR ports battle-tested production improvements from Rob's GarageDoor firmware (local patches on top of Web3E v1.44) into master. These changes improve reliability and robustness on real ESP32 hardware.
Key Changes
1. Startup Watchdog (30s timeout)
TcpBridge::armStartupWatchdog()anddisarmStartupWatchdog()usingesp_timerarmStartupWatchdog()at start ofsetup()2. Connection Timeout Management
CONNECTION_TIMEOUT_MS(60s),SESSION_TIMEOUT_MS(15min),KEEP_ALIVE_INTERVAL_MS(5min)unconnectedTimerandsessionStartcheckReset(),resetConnection(),checkConnection(),connectionCheck()methods3. Bounded API Parsing
scanAPI(apiReturn, available)with boundedscanAPI(packet, apiReturn, payloadLength)getArg(index)that read from WiFiClient with boundedgetArg(packet, index, payloadLength)that reads from bufferpacketBuffer[TCP_PACKET_BUFFER_SIZE]at once4. Web3E Logging Macros
Serial.print()/Serial.println()withWEB3E_PRINT()/WEB3E_PRINTLN()macros-DWEB3E_RELEASETcpBridge,UdpBridge,KeyID,Crypto,Web3,Util,uint2565. sendRefreshRequest Improvements
clear()(arduino-esp32 3.x) /flush()(older versions) after writeresetConnection()on timeout instead of hanging6. maintainComms Session Timeout
SESSION_TIMEOUT_MS(15 minutes)checkConnection()instead of inline connection checkKEEP_ALIVE_INTERVAL_MSinstead of hardcoded 60 secondsCompatibility
setProxy()andpercolate.one:8083defaultsclear()/flush())Testing
armStartupWatchdog()callarmStartupWatchdog()callFiles Changed
Core Library
src/TcpBridge.{h,cpp}- Watchdog, bounded parsing, connection timeoutssrc/UdpBridge.cpp- Web3Log macrossrc/KeyID.cpp- Web3Log macrossrc/Crypto.cpp- Web3Log macrossrc/Web3.cpp- Web3Log macrossrc/Util.cpp- Web3Log macrossrc/uint256/uint{128,256}_t.cpp- Web3Log macrosExamples & Tests
test/hardware/proxy_e2e/src/main.cpp- AddedarmStartupWatchdog()callexamples/Wallet Bridge {1,2,3}/src/main.cpp- AddedarmStartupWatchdog()call