[SERIAL] Make SERIAL gateway frame format (data/parity/stop bits) configurable (#2342)

Serial.begin() was hardcoded to SERIAL_8N1 across all four UART init paths
(UART0/1/2/3), with no way to override it via a build flag -- unlike SERIALBaud,
which already is. Devices using non-8N1 framing (e.g. even-parity RS232 sources)
currently can't be read correctly at all, not just unreliably: a parity mismatch
misaligns the frame, not just adds occasional noise.

Adds SERIAL_CONFIG following the existing #ifndef/#define override pattern used
throughout this codebase, defaulting to SERIAL_8N1 so existing environments are
unaffected byte-for-byte. Verified: default (SERIAL_8N1) and an override
(SERIAL_CONFIG=SERIAL_8E1) both build successfully on ESP32.

Co-authored-by: simowilso <simowilso@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
authored and GitHub committed 2026-07-28 19:05:18 -05:00
1 parent 3c33431fe5
commit f76d04b613
2 files changed
+11 -7

No files matched your search

+4
View File
@@ -81,6 +81,10 @@ extern bool XtoSERIAL(const char* topicOri, JsonObject& SERIALdata);
# define SERIALBaud 9600 // The serial connection Baud
#endif
#ifndef SERIAL_CONFIG
# define SERIAL_CONFIG SERIAL_8N1 // The serial frame format (data/parity/stop bits), e.g. SERIAL_8E1 for 8 data bits/even parity/1 stop bit
#endif
/*-------------------PIN DEFINITIONS----------------------*/
#ifndef SERIAL_UART
// set hardware serial UART to be used for device communication or