-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Issue: I2C operations are blocking and can take time (e.g., the write_pcf8574 has a pdMS_TO_TICKS(50)` timeout).
If these operations occur within the MQTT event callback context, they will block the MQTT client's internal task. This can make the MQTT client unresponsive to other incoming messages, affect keep-alive processing, or delay other MQTT operations.
The RelayController might also introduce deliberate delays (COOLDOWN_PERIOD_MS).
Decouple long-running or blocking operations from the MQTT callback:
• The frequency_callback_ or cat_parser_set_frequency should do minimal, non-blocking work.
• If a frequency change requires antenna switching (which involves I2C), this action should be offloaded. I think this is a good case for using the FreeRTOS message queue.
A separate task would then wait on this queue, receive the frequency, and perform the full antenna switching logic, including any I2C calls and delays.