Repository navigation
Fix RS485Utils examples and platformio projects for ESP32 - #4
Merged
aphelps-claude-bot merged 4 commits intoJul 27, 2026
Merged
Conversation
- Guard #include <SoftwareSerial.h> with #ifdef __AVR__ in both SocketTestMaster and SocketTestSlave (SoftwareSerial is AVR-only) - Replace #if 1 / #else hardcoded pin blocks with #ifndef guards so -DPIN_RS485_RECV etc. passed via build flags take precedence cleanly without redefinition warnings With -DRS485_HARDWARE_SERIAL=2 both sketches now build cleanly for ESP32. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- RS485SocketTool/platformio.ini: fix broken src_dir (was "."), add [env:esp32] with Serial2/GPIO16-18, [env:nano], monitor_speed=115200 - SocketTestMaster/platformio.ini: add [env:esp32], update src_dir to point at examples (src symlink already pointed there), monitor_speed - SocketTestSlave/platformio.ini: same - Track RS485Utils/examples/RS485SocketTool/RS485SocketTool.ino (was previously untracked; required by the fixed RS485SocketTool src_dir) All 6 environments (3 sketches × esp32 + nano) build clean. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Timer comparison was inverted: `now - SEND_PERIOD >= last_send_ms` wraps on uint32 and sends every 10ms instead of every 1s; fix to `now - last_send_ms >= SEND_PERIOD` - Socket address was `(DEBUG_LEVEL != 0)` (= 1) instead of ADDRESS (128), so targeted replies to addr 128 would be dropped Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
aphelps-claude-bot
left a comment
Collaborator
Author
There was a problem hiding this comment.
Follow-up self-review after fixing two bugs found in the previous review pass.
Previous findings addressed:
- ✅ Timer comparison corrected to
now - last_send_ms >= SEND_PERIOD(was uint32 underflow, sent every 10ms) - ✅ Socket address corrected to
ADDRESS(was(DEBUG_LEVEL != 0)= 1, not 128)
Remaining known limitation: lib_dir is an absolute path in all three platformio.ini files — consistent with the rest of the ArduinoLibs ecosystem; install.sh handles symlinks on new machines.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
aphelps
approved these changes
Jul 27, 2026
aphelps-claude-bot
deleted the
get-rs485utils-example-code-working-on-an-esp32
branch
July 27, 2026 01:17
This was referenced Jul 27, 2026
aphelps-claude-bot
added a commit
that referenced
this pull request
Aug 20, 2026
* add RS485SocketTool ESP32 hardware testing guide Self-serve TESTING.md for bringing up the RS485SocketTool example on an ESP32: parts list, ESP32<->transceiver<->bus wiring (pins/flags matching the esp32 platformio env), build/flash steps, single-node smoke test and two-node send/receive test with the exact serial strings the sketch emits, plus a troubleshooting table. Carries the deferred hardware Testing Required from the RS485-on-ESP32 example work (ArduinoLibs #4). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * fix RS485 guide: received payload hex is hidden at DEBUG_LEVEL=1 Self-review finding: the guide showed '* Received data 2: 54 01', but print_hex_buffer emits the bytes via DEBUG4_HEXVAL, which compiles out below DEBUG_LEVEL=4; both envs build at level 1, so the real line is '* Received data 2:' with no hex. Correct the expected output (a tester would otherwise think reception failed), note how to see the hex (-DDEBUG_LEVEL=4) and the count-lag, and spell out the nano env's default AVR pins (7/4/2). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * rs485 guide: drop the fabricated debug-level-4 hex example Re-review nit: the illustrative '* Received data 2: 54 02' didn't match Arduino HEX formatting (no zero-pad, per-byte leading space). Describe the DEBUG_LEVEL=4 payload as space-separated hex ('T'=54 then the counter) and note the no-zero-pad quirk, rather than showing a wrong literal. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> --------- Co-authored-by: aphelps-claude-bot <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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.
Summary
Sketch fixes (RS485Utils/examples/):
PlatformIO projects (platformio/):
All 6 environments (3 sketches × esp32 + nano) build with zero warnings.
Test plan
🤖 Generated with Claude Code