- Updated pressure window and threshold constants to differentiate between critical and moderate memory pressure scenarios.
- Enhanced recovery logic to trigger based on specific pressure conditions, improving responsiveness to memory fragmentation.
- Added explicit calls to recreate analyzer client objects during recovery, ensuring proper setup after memory management actions.
These changes aim to optimize memory handling and recovery processes in the MQTTBridge, enhancing overall stability.
- Improved NTP sync logic by implementing retry attempts for NTP updates, enhancing reliability on various hardware.
- Added a fallback mechanism to use ESP32's built-in SNTP if NTPClient fails, ensuring time synchronization continuity.
- Updated the handling of epoch time validation to ensure it meets a minimum threshold before proceeding with time updates.
- Streamlined the process of setting the system timezone and updating the RTC clock, improving overall time management efficiency.
- Updated the logic for JWT token timestamp validation to allow reconnection if the system clock is set, even when NTP sync is not confirmed. This change prevents unnecessary connection blocks after a successful NTP sync at boot.
- Introduced a check to determine if the system clock is clearly set, improving the robustness of the connection maintenance process.
- Introduced a new method `runCriticalMemoryCheckAndRecovery()` to streamline memory checks and recovery processes.
- Added member variables to track fragmentation pressure and the last critical check run time.
- Removed redundant critical memory check logic from `mqttTaskLoop()` and `loop()`, enhancing code clarity and maintainability.
- Improved logging and pressure tracking for better diagnostics during memory management.
Resolve conflict in variants/heltec_v4/platformio.ini by taking
origin/dev version for PA pin comments and SX126X_RX_BOOSTED_GAIN.
Co-authored-by: Cursor <cursoragent@cursor.com>
- Added new member variables to track WiFi connection state and implement exponential backoff for reconnection attempts.
- Refactored WiFi monitoring logic into a dedicated function to streamline the mqttTaskLoop.
- Introduced fragmentation recovery logic to handle memory pressure more effectively, ensuring MQTT clients are recreated when necessary.
- Reset reconnect backoff attempts upon successful connection to the main broker.
These changes aim to improve the stability and performance of the MQTTBridge under varying network conditions.
- Introduced PSRAM-aware memory allocation functions (`psram_malloc` and `psram_free`) to optimize memory usage on ESP32 boards with external RAM.
- Updated MQTTBridge initialization to allocate JWT token buffers and raw data storage in PSRAM when available.
- Enhanced FreeRTOS queue creation to utilize PSRAM for storage, improving memory efficiency.
- Implemented dynamic allocation for JSON buffers in PSRAM during status publishing and packet handling, reducing stack usage.
- Ensured proper memory cleanup for PSRAM allocations in the `end` method to prevent memory leaks.
This update aims to enhance performance and stability in memory-constrained environments by leveraging available PSRAM resources.
- Implemented PSRAM availability checks and logging to assist in debugging memory fragmentation on boards with external RAM.
- Enhanced logging to provide detailed information about PSRAM size, free memory, and initialization status.
- Updated platformio.ini files across multiple variants to remove obsolete mbedTLS configuration flags, streamlining the build process.
- Added new build flags for mbedTLS: CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN, CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN, and CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN.
- These changes improve the handling of SSL content lengths, optimizing performance for various hardware variants.
- Updated source filters to include MQTTBridge and MQTTMessageBuilder in relevant configurations.
- Added memory debugging features to log heap usage and fragmentation recovery for MQTT clients.
- Introduced `recreateMqttClientsForFragmentationRecovery()` to manage MQTT client lifecycles and reduce memory fragmentation.
- Updated critical memory checks to log detailed heap statistics and active MQTT client counts.
- Included new debug logging for memory status every 60 seconds when memory debugging is enabled.
This update aims to improve stability and performance in memory-constrained environments.
- Trigger noise floor calibration every 2s and AGC reset every 30s in main loop.
- Reorder loop to match Dispatcher: calibrate + radio.loop() before AGC reset
and recvRaw() so RSSI is never sampled right after startReceive().
- Update protocol doc with calibration intervals and typical noise floor range.
- Variant platformio.ini updates (heltec_v3, rak4631).