@@ -277,9 +277,9 @@ void zboss_signal_handler(zb_bufid_t bufid)
277277 // Meanwhile fast LED blinking
278278 while (dk_get_buttons () & DK_BTN3_MSK ) {
279279 dk_set_led (ZIGBEE_NETWORK_STATE_LED , 0 );
280- k_msleep (100 );
280+ k_msleep (50 );
281281 dk_set_led (ZIGBEE_NETWORK_STATE_LED , 1 );
282- k_msleep (100 );
282+ k_msleep (50 );
283283 }
284284 sys_reboot (SYS_REBOOT_COLD );
285285 break ;
@@ -355,12 +355,11 @@ void do_humidity_measurement(zb_uint8_t param) {
355355#define MIN_MV 450
356356#define MAX_MV 1825
357357#else
358- // These comes from Capacitive Soil Moisture Sensor v1.2 powered by 3.3V
358+ // These come from Capacitive Soil Moisture Sensor v1.2 powered by 3.3V
359359#define MIN_MV 910
360360#define MAX_MV 2160
361361#endif
362362
363- #define NB_SAMPLES 10
364363#define PROBE_POWERUP_TIME_MS 1000
365364#define COUNTDOWN_INIT (4*3600*1000/PROBE_INTERVAL_MS)
366365
@@ -369,8 +368,9 @@ void do_humidity_measurement(zb_uint8_t param) {
369368 static uint16_t humidity_last = 0xffff ;
370369 static uint32_t force_report_countdown = COUNTDOWN_INIT ; // When falling to 0, 4 hours, force reporting
371370
372- // Power on the probe
373371 dk_set_led (ZIGBEE_NETWORK_STATE_LED , 1 );
372+
373+ // Power on the probe
374374 gpio_pin_set_dt (& probe_vdd ,1 );
375375 k_msleep (PROBE_POWERUP_TIME_MS ); // Wait for output to stabilize
376376
@@ -389,14 +389,6 @@ void do_humidity_measurement(zb_uint8_t param) {
389389
390390 dk_set_led (ZIGBEE_NETWORK_STATE_LED , 0 );
391391
392- // Check minimum valid measurement
393- if (val_mv < 100 ) {
394- // Don't power off the probe, this might happen at startup
395- LOG_WRN ("Probe certainly unplugged. Retesting in 2 seconds." );
396- ZB_SCHEDULE_APP_ALARM (do_humidity_measurement , 0 , ZB_MILLISECONDS_TO_BEACON_INTERVAL (2000 )); // Come back to check in 2 secs
397- return ;
398- }
399-
400392 // Power off the probe
401393 gpio_pin_set_dt (& probe_vdd ,0 );
402394
@@ -440,7 +432,7 @@ void do_humidity_measurement(zb_uint8_t param) {
440432 humidity_last = humidity ;
441433
442434 if (first_start ) {
443- ZB_SCHEDULE_APP_ALARM (do_humidity_measurement , 0 , ZB_MILLISECONDS_TO_BEACON_INTERVAL (15000 )); // Shorten dealy of next measurement
435+ ZB_SCHEDULE_APP_ALARM (do_humidity_measurement , 0 , ZB_MILLISECONDS_TO_BEACON_INTERVAL (15000 )); // Shorten delay of next measurement
444436 first_start = false;
445437 force_report_countdown = 0 ; // Ugly, but this will force report on next call
446438 } else {
@@ -462,7 +454,7 @@ void check_join_status(zb_uint8_t param) {
462454
463455 led_state ^= 1 ;
464456
465- dk_set_led (ZIGBEE_NETWORK_STATE_LED , led_state ^ 1 );
457+ dk_set_led (ZIGBEE_NETWORK_STATE_LED , led_state );
466458
467459 ZB_SCHEDULE_APP_ALARM (check_join_status , 0 , ZB_MILLISECONDS_TO_BEACON_INTERVAL (NETWORK_LED_PERIOD_MS ));
468460}
0 commit comments