Added new major version of zh_config. Changed main code to support the new version of zh_config

This commit is contained in:
2024-05-29 14:10:21 +03:00
parent 187226cf6d
commit cb30d73628
4 changed files with 353 additions and 317 deletions

View File

@ -54,16 +54,24 @@
typedef struct // Structure of data exchange between tasks, functions and event handlers.
{
zh_sensor_hardware_config_message_t hardware_config; // Storage structure of sensor hardware configuration data.
volatile bool gateway_is_available; // Gateway availability status flag. @note Used to control the tasks when the gateway connection is established / lost. Used only when external powered.
uint8_t gateway_mac[6]; // Gateway MAC address. @note Used only when external powered.
uint8_t sent_message_quantity; // System counter for the number of sended messages. @note Used only when powered by battery.
zh_dht_handle_t dht_handle; // Unique DTH11/22 sensor handle.
TaskHandle_t attributes_message_task; // Unique task handle for zh_send_sensor_attributes_message_task(). @note Used only when external powered.
TaskHandle_t status_message_task; // Unique task handle for zh_send_sensor_status_message_task(). @note Used only when external powered.
const esp_partition_t *update_partition; // Unique handle for next OTA update partition. @note Used only when external powered.
esp_ota_handle_t update_handle; // Unique handle for OTA functions. @note Used only when external powered.
uint16_t ota_message_part_number; // System counter for the number of received OTA messages. @note Used only when external powered.
struct
{
ha_sensor_type_t sensor_type; // Sensor types.
uint8_t sensor_pin_1; // Sensor GPIO number 1. @note Main pin for 1-wire sensors, SDA pin for I2C sensors.
uint8_t sensor_pin_2; // Sensor GPIO number 2. @note SCL pin for I2C sensors.
uint8_t power_pin; // Power GPIO number (if used sensor power control).
uint16_t measurement_frequency; // Measurement frequency (sleep time on battery powering).
bool battery_power; // Battery powered. @note Battery powering (true) / external powering (false).
} hardware_config; // Storage structure of sensor hardware configuration data.
volatile bool gateway_is_available; // Gateway availability status flag. @note Used to control the tasks when the gateway connection is established / lost. Used only when external powered.
uint8_t gateway_mac[6]; // Gateway MAC address. @note Used only when external powered.
uint8_t sent_message_quantity; // System counter for the number of sended messages. @note Used only when powered by battery.
zh_dht_handle_t dht_handle; // Unique DTH11/22 sensor handle.
TaskHandle_t attributes_message_task; // Unique task handle for zh_send_sensor_attributes_message_task(). @note Used only when external powered.
TaskHandle_t status_message_task; // Unique task handle for zh_send_sensor_status_message_task(). @note Used only when external powered.
const esp_partition_t *update_partition; // Unique handle for next OTA update partition. @note Used only when external powered.
esp_ota_handle_t update_handle; // Unique handle for OTA functions. @note Used only when external powered.
uint16_t ota_message_part_number; // System counter for the number of received OTA messages. @note Used only when external powered.
} sensor_config_t;
/**