Version 1.0.4
Added sensor reading error message. Updated components.
This commit is contained in:
parent
6e27f40bf1
commit
31b7789873
@ -1 +1 @@
|
|||||||
Subproject commit c568d84e56eca3b2d74c56dddafb97c9449a8adc
|
Subproject commit db717bf6eec149759082c00ecf2fca81faf94adf
|
@ -1 +1 @@
|
|||||||
Subproject commit 18afcab1d9d77a54a6f0a3dc72932eec6bbf2d6f
|
Subproject commit cbf2c69e4452378681d77e7f273b0489a8ffaa56
|
@ -1 +1 @@
|
|||||||
Subproject commit 742c807c416d9f80c0571f8daea85d275e8d4c93
|
Subproject commit 39fdb2eb4968172ce16269d6b24ff1672c6f5351
|
@ -1 +1 @@
|
|||||||
Subproject commit 783b44fbca0ed467a868b4420f191c6d9f6caea5
|
Subproject commit 10fefb2912a2489d4be23ba41eedae47290b0fc0
|
@ -1 +1 @@
|
|||||||
Subproject commit 4d1286cfb2c5693368b7b5802b6cc6231259d972
|
Subproject commit d006e1e40c44ac847c373f8458983031123bca90
|
@ -471,57 +471,39 @@ void zh_send_sensor_status_message_task(void *pvParameter)
|
|||||||
data.payload_data.status_message.sensor_status_message.sensor_type = switch_config->hardware_config.sensor_type;
|
data.payload_data.status_message.sensor_status_message.sensor_type = switch_config->hardware_config.sensor_type;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
esp_err_t err = ESP_OK;
|
||||||
switch (switch_config->hardware_config.sensor_type)
|
switch (switch_config->hardware_config.sensor_type)
|
||||||
{
|
{
|
||||||
case HAST_DS18B20:
|
case HAST_DS18B20:
|
||||||
ZH_DS18B20_READ:
|
err = zh_ds18b20_read(NULL, &temperature);
|
||||||
switch (zh_ds18b20_read(NULL, &temperature))
|
if (err == ESP_OK)
|
||||||
{
|
{
|
||||||
case ESP_OK:
|
|
||||||
data.payload_data.status_message.sensor_status_message.temperature = temperature;
|
data.payload_data.status_message.sensor_status_message.temperature = temperature;
|
||||||
data.payload_data.status_message.sensor_status_message.voltage = 3.3; // For compatibility with zh_espnow_sensor.
|
data.payload_data.status_message.sensor_status_message.voltage = 3.3; // For future development.
|
||||||
break;
|
|
||||||
case ESP_FAIL:
|
|
||||||
vTaskDelay(10000 / portTICK_PERIOD_MS);
|
|
||||||
goto ZH_DS18B20_READ;
|
|
||||||
break;
|
|
||||||
case ESP_ERR_INVALID_CRC:
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
goto ZH_DS18B20_READ;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HAST_DHT:
|
case HAST_DHT:
|
||||||
ZH_DHT_READ:
|
err = zh_dht_read(&humidity, &temperature);
|
||||||
switch (zh_dht_read(&humidity, &temperature))
|
if (err == ESP_OK)
|
||||||
{
|
{
|
||||||
case ESP_OK:
|
|
||||||
data.payload_data.status_message.sensor_status_message.humidity = humidity;
|
data.payload_data.status_message.sensor_status_message.humidity = humidity;
|
||||||
data.payload_data.status_message.sensor_status_message.temperature = temperature;
|
data.payload_data.status_message.sensor_status_message.temperature = temperature;
|
||||||
data.payload_data.status_message.sensor_status_message.voltage = 3.3; // For compatibility with zh_espnow_sensor.
|
data.payload_data.status_message.sensor_status_message.voltage = 3.3; // For future development.
|
||||||
break;
|
|
||||||
case ESP_ERR_INVALID_RESPONSE:
|
|
||||||
vTaskDelay(10000 / portTICK_PERIOD_MS);
|
|
||||||
goto ZH_DHT_READ;
|
|
||||||
break;
|
|
||||||
case ESP_ERR_TIMEOUT:
|
|
||||||
vTaskDelay(10000 / portTICK_PERIOD_MS);
|
|
||||||
goto ZH_DHT_READ;
|
|
||||||
break;
|
|
||||||
case ESP_ERR_INVALID_CRC:
|
|
||||||
vTaskDelay(3000 / portTICK_PERIOD_MS);
|
|
||||||
goto ZH_DHT_READ;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (err == ESP_OK)
|
||||||
|
{
|
||||||
zh_send_message(switch_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
zh_send_message(switch_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data.payload_type = ZHPT_ERROR;
|
||||||
|
strcpy(data.payload_data.status_message.error_message.message, "Sensor reading error.");
|
||||||
|
zh_send_message(switch_config->gateway_mac, (uint8_t *)&data, sizeof(zh_espnow_data_t));
|
||||||
|
}
|
||||||
vTaskDelay(ZH_SENSOR_STATUS_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
vTaskDelay(ZH_SENSOR_STATUS_MESSAGE_FREQUENCY * 1000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
vTaskDelete(NULL);
|
vTaskDelete(NULL);
|
||||||
|
@ -159,14 +159,14 @@ void zh_send_switch_attributes_message_task(void *pvParameter);
|
|||||||
void zh_send_switch_config_message(const switch_config_t *switch_config);
|
void zh_send_switch_config_message(const switch_config_t *switch_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Function for prepare the sensor hardware configuration message and sending it to the gateway.
|
* @brief Function for prepare the switch hardware configuration message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
* @param[in] switch_config Pointer to the structure of data exchange between tasks, functions and event handlers.
|
* @param[in] switch_config Pointer to the structure of data exchange between tasks, functions and event handlers.
|
||||||
*/
|
*/
|
||||||
void zh_send_switch_hardware_config_message(const switch_config_t *switch_config);
|
void zh_send_switch_hardware_config_message(const switch_config_t *switch_config);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Task for prepare the sensor keep alive message and sending it to the gateway.
|
* @brief Task for prepare the switch keep alive message and sending it to the gateway.
|
||||||
*
|
*
|
||||||
* @param[in] pvParameter Pointer to the structure of data exchange between tasks, functions and event handlers.
|
* @param[in] pvParameter Pointer to the structure of data exchange between tasks, functions and event handlers.
|
||||||
*/
|
*/
|
||||||
|
@ -1 +1 @@
|
|||||||
1.0.3
|
1.0.4
|
Loading…
x
Reference in New Issue
Block a user