Skip to content

Commit

Permalink
fix compiling with partially disabled clusters
Browse files Browse the repository at this point in the history
  • Loading branch information
devbis committed Nov 7, 2023
1 parent 50d97b2 commit c67a6c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ void read_sensor_and_save() {
read_sensor(&temp,&humi);
// printf("Temp: %d.%d, humid: %d\r\n", temp/10, temp % 10, humi);
g_zcl_temperatureAttrs.measuredValue = temp;
#ifdef ZCL_RELATIVE_HUMIDITY
g_zcl_relHumidityAttrs.measuredValue = humi;
#endif

voltage = drv_get_adc_data();
converted_voltage = (u8)(voltage / 100);
Expand Down Expand Up @@ -220,11 +222,15 @@ void read_sensor_and_save() {
// update lcd
show_temp_symbol(tempSymbol);
show_big_number(displayTemperature, hasPoint);
#ifdef ZCL_RELATIVE_HUMIDITY_MEASUREMENT
#ifdef ZCL_TEMPERATURE_MEASUREMENT
show_small_number(g_zcl_relHumidityAttrs.measuredValue / 100, 1);
#if defined(SHOW_SMILEY)
show_smiley(
is_comfort(g_zcl_temperatureAttrs.measuredValue, g_zcl_relHumidityAttrs.measuredValue) ? 1 : 2
);
#endif
#endif
#endif
update_lcd();
}
Expand Down
2 changes: 2 additions & 0 deletions src/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ extern zcl_identifyAttr_t g_zcl_identifyAttrs;
extern zcl_powerAttr_t g_zcl_powerAttrs;
extern zcl_thermostatUICfgAttr_t g_zcl_thermostatUICfgAttrs;
extern zcl_temperatureAttr_t g_zcl_temperatureAttrs;
#ifdef ZCL_RELATIVE_HUMIDITY_MEASUREMENT
extern zcl_relHumidityAttr_t g_zcl_relHumidityAttrs;
#endif
// extern zcl_iasZoneAttr_t g_zcl_iasZoneAttrs;
extern zcl_pollCtrlAttr_t g_zcl_pollCtrlAttrs;

Expand Down
2 changes: 2 additions & 0 deletions src/sensorEpCfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ const zcl_specClusterInfo_t g_sensorDeviceClusterList[] =
{
{ZCL_CLUSTER_GEN_BASIC, MANUFACTURER_CODE_NONE, ZCL_BASIC_ATTR_NUM, basic_attrTbl, zcl_basic_register, sensorDevice_basicCb},
{ZCL_CLUSTER_GEN_IDENTIFY, MANUFACTURER_CODE_NONE, ZCL_IDENTIFY_ATTR_NUM, identify_attrTbl, zcl_identify_register, sensorDevice_identifyCb},
#ifdef ZCL_POWER_CFG
{ZCL_CLUSTER_GEN_POWER_CFG, MANUFACTURER_CODE_NONE, ZCL_POWER_CFG_ATTR_NUM, powerCfg_attrTbl, zcl_powerCfg_register, sensorDevice_powerCfgCb},
#endif
#ifdef ZCL_IAS_ZONE
{ZCL_CLUSTER_SS_IAS_ZONE, MANUFACTURER_CODE_NONE, ZCL_IASZONE_ATTR_NUM, iasZone_attrTbl, zcl_iasZone_register, sensorDevice_iasZoneCb},
#endif
Expand Down

0 comments on commit c67a6c3

Please sign in to comment.