[RF] Fix CC1101 initialization on boot with saved RF config (#2269)

When a saved RF configuration exists in NVS, loadFromStorage() was loading
the config but not calling iRFReceiver.enable(), which meant initCC1101()
was never invoked during boot. This caused the CC1101 to not receive signals
until the user manually toggled the RF receiver via the WebUI.

This fix adds a reinitReceiver parameter to loadFromStorage() that controls
whether to disable/enable the receiver after loading config. By default it's
true (for boot-time initialization), but loadFromMessage() passes false to
avoid double initialization when loading config from MQTT messages.

Fixes #2264

Co-authored-by: Florian <1technophile@users.noreply.github.com>
Co-authored-by: Odyno <odyno@users.noreply.github.com>

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-01-06 05:47:49 -06:00
1 parent 0c2884c392
commit e01b22695a
2 files changed
+15 -7

No files matched your search

+4 -1
View File
@@ -49,11 +49,14 @@ public:
/**
* Loads the RF configuration from persistent storage and applies it.
*
* @param reinitReceiver If true (default), disables and re-enables the receiver.
* If false, only loads the configuration without reinitialization.
*
* @note This function has specific behavior for ESP32 platforms. On ESP32,
* it uses the Preferences library to access stored configuration data.
* For other platforms, it directly enables the active receiver.
*/
void loadFromStorage();
void loadFromStorage(bool reinitReceiver = true);
/**
* Loads the RF configuration from a JSON object and applies it.