ZB bug reproduction

This commit is contained in:
rbaron 2023-07-15 11:15:23 +02:00
parent 95ec660cb6
commit 4c761db001
2 changed files with 11 additions and 1 deletions

View file

@ -61,8 +61,10 @@ CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y CONFIG_FILE_SYSTEM_LITTLEFS=y
# Uncomment for debug log level. # Uncomment for debug log level.
# CONFIG_LOG_DEFAULT_LEVEL=4 CONFIG_LOG_DEFAULT_LEVEL=4
# Factory reset method selection. Only hardware revision 2.0.0+ has button SW1. Earlier # Factory reset method selection. Only hardware revision 2.0.0+ has button SW1. Earlier
# revisions must select a different method. See Kconfig for options. # revisions must select a different method. See Kconfig for options.
# CONFIG_PRST_ZB_FACTORY_RESET_VIA_SW1=y # CONFIG_PRST_ZB_FACTORY_RESET_VIA_SW1=y
CONFIG_PRST_ZB_SLEEP_DURATION_SEC=1

View file

@ -143,6 +143,14 @@ void update_sensors_cb(zb_uint8_t arg) {
} }
prst_debug_counters_increment("sensors_read_after"); prst_debug_counters_increment("sensors_read_after");
// Bug reproduction - simulates an error in the i2c reading in shtc3.c that would create an infinite loop.
// - Since we have a k_msleep() there, the loop would still be energy efficient, so it wouldn't drain the battery.
// - Other ZB functionality still works
// - Even though we called ZB_SCHEDULE_APP_ALARM earlier, the scheduled callback is never called. Maybe because the same callback is still running?
while (true) {
k_msleep(10);
}
// Battery voltage in units of 100 mV. // Battery voltage in units of 100 mV.
uint8_t batt_voltage = sensors.batt.adc_read.millivolts / 100; uint8_t batt_voltage = sensors.batt.adc_read.millivolts / 100;
prst_zb_set_attr_value(ZB_ZCL_CLUSTER_ID_POWER_CONFIG, prst_zb_set_attr_value(ZB_ZCL_CLUSTER_ID_POWER_CONFIG,