Skip to content

Commit 0c8b1d2

Browse files
committed
feat(zigbee): Use cfloat FLT_MAX
1 parent 91bf6c7 commit 0c8b1d2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

libraries/Zigbee/src/ep/ZigbeeAnalog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "ZigbeeAnalog.h"
22
#if CONFIG_ZB_ENABLED
3+
#include <cfloat>
34

45
ZigbeeAnalog::ZigbeeAnalog(uint8_t endpoint) : ZigbeeEP(endpoint) {
56
_device_id = ESP_ZB_HA_SIMPLE_SENSOR_DEVICE_ID;
@@ -20,8 +21,8 @@ bool ZigbeeAnalog::addAnalogInput() {
2021
"Analog Input";
2122
uint32_t application_type = 0x00000000 | (ESP_ZB_ZCL_AI_GROUP_ID << 24);
2223
float resolution = 0.1; // Default resolution of 0.1
23-
float min = -3.402823e+38; // Default min value for float
24-
float max = 3.402823e+38; // Default max value for float
24+
float min = -FLT_MAX; // Default min value for float
25+
float max = FLT_MAX; // Default max value for float
2526

2627
esp_err_t ret = esp_zb_analog_input_cluster_add_attr(esp_zb_analog_input_cluster, ESP_ZB_ZCL_ATTR_ANALOG_INPUT_DESCRIPTION_ID, (void *)default_description);
2728
if (ret != ESP_OK) {
@@ -91,8 +92,8 @@ bool ZigbeeAnalog::addAnalogOutput() {
9192
"Analog Output";
9293
uint32_t application_type = 0x00000000 | (ESP_ZB_ZCL_AO_GROUP_ID << 24);
9394
float resolution = 1; // Default resolution of 1
94-
float min = -3.402823e+38; // Default min value for float
95-
float max = 3.402823e+38; // Default max value for float
95+
float min = -FLT_MAX; // Default min value for float
96+
float max = FLT_MAX; // Default max value for float
9697

9798
esp_err_t ret =
9899
esp_zb_analog_output_cluster_add_attr(esp_zb_analog_output_cluster, ESP_ZB_ZCL_ATTR_ANALOG_OUTPUT_DESCRIPTION_ID, (void *)default_description);

0 commit comments

Comments
 (0)