10 Commits

Author SHA1 Message Date
614594a035 Merge fix/improve-error-logging: Human-readable MQTT errors 2026-02-05 10:14:40 -07:00
dd881f79f3 Merge fix/memory-leaks: Add destructor, init pointers to nullptr 2026-02-05 10:14:02 -07:00
980a42f98b Merge fix/mqtt-exponential-backoff: Backoff 1s→60s on retry 2026-02-05 10:13:58 -07:00
2506e3ce3e fix: improve error logging for MQTT connection failures
- Add TLS security warning when certificate verification is disabled
- Add getMQTTErrorString() to translate PubSubClient error codes
- Show broker/user info on connection failure for debugging
- Standardize log prefix to [MQTT] (was inconsistent [MQTTS])
- Use transport-agnostic "Network" instead of "WiFi" in messages
- Fix WiFiState/NetworkState enum mismatch in getWiFiStatus()

Error codes now show meaningful messages like:
  "Bad credentials (check username/password)" instead of "rc=4"
2026-02-05 10:02:15 -07:00
669ef89a66 fix: memory leaks and uninitialized pointers
- Initialize _mqtt_bridge and _web_config to nullptr in declarations
- Add destructor to clean up dynamically allocated objects
- Initialize _last_mqtt_stats to 0 in declaration
- Fix WiFiState/NetworkState enum mismatch in getWiFiStatus()

While embedded firmware typically runs forever (making these not
critical leaks), proper cleanup enables testing and prevents
static analyzer warnings.
2026-02-05 09:59:49 -07:00
0905aa4bf8 Add exponential backoff to MQTT reconnection
Instead of fixed 5s/30s retry intervals, implement exponential backoff:
- Initial delay: 1 second
- Max delay: 60 seconds
- Doubles on each failed attempt
- Resets to minimum on successful connection

This prevents hammering a down broker while still reconnecting
quickly when the issue is transient.

Also includes fix for WiFiState/NetworkState enum mismatch in
getWiFiStatus() which was already on main.
2026-02-05 09:48:49 -07:00
91d144901a Fix dangling pointer bug in WiFiManager getSSID/getConnectionName
WiFi.SSID() returns a temporary String object. Calling .c_str() on it
returns a pointer to the internal buffer, but the String is destroyed
at the end of the statement - leaving a dangling pointer.

Fix by caching the SSID in a member variable when connection state
changes, and returning a pointer to that stable storage.

Also fix getWiFiStatus() in MyMesh.cpp which was using WiFiState enum
values instead of NetworkState (the interface return type).
2026-02-05 09:47:01 -07:00
7516c808a7 Add ENC28J60 Ethernet support with INetworkManager abstraction
- Create INetworkManager interface for network abstraction
- Add EthernetManager for ENC28J60 module using EthernetENC library
- Update WiFiManager to implement INetworkManager interface
- Update MQTTBridge to use INetworkManager* instead of WiFiManager&
- Add heltec_v3_ethernet PlatformIO environment
- Uses HSPI bus (GPIO 19/20/47/48) separate from LoRa SPI
2026-02-05 09:45:16 -07:00
04667f5161 Add optional MQTT gateway with web configuration UI
Feature-flagged WiFi/MQTT capability (WITH_MQTT) that bridges
LoRa mesh packets to MQTT topics over TLS (port 443). Includes:

- WiFiManager: connection handling with AP fallback mode
- MQTTBridge: TLS-secured pub/sub with FNV-1a deduplication
- WebConfig: REST API for WiFi/MQTT settings
- Embedded web UI dashboard for configuration

Default broker: meshqt.l.supported.systems:443 (MQTTS)
Build with: pio run -e heltec_v3_mqtt
2026-01-25 22:44:16 -07:00
dbed318124 Initial commit: Heltec V3 MeshCore repeater
Standalone PlatformIO project using MeshCore as a library.

Features:
- Heltec LoRa32 V3 support (ESP32-S3 + SX1262)
- OLED display integration
- OTA firmware updates via WiFi
- Serial CLI for configuration

Uses symlinked MeshCore library from ../MeshCore
2026-01-25 12:15:15 -07:00