@@ -853,6 +853,12 @@ publish_led_off(void *d)
853
853
}
854
854
/*---------------------------------------------------------------------------*/
855
855
static void
856
+ callback_led_off (void * data ){
857
+ unsigned int color = * ((unsigned int * )data );
858
+ leds_off (color );
859
+ }
860
+ /*---------------------------------------------------------------------------*/
861
+ static void
856
862
pub_handler (const char * topic , uint16_t topic_len , const uint8_t * chunk ,
857
863
uint16_t chunk_len )
858
864
{
@@ -1438,6 +1444,7 @@ PROCESS_THREAD(apc_sensor_node_en_sensors_process, ev, data)
1438
1444
{
1439
1445
//initialization
1440
1446
uint8_t i ;
1447
+ static uint32_t color ;
1441
1448
PROCESS_EXITHANDLER ();
1442
1449
PROCESS_BEGIN ();
1443
1450
PRINTF ("APC Sensor Node (Sensor Initialization) begins...\n" );
@@ -1446,8 +1453,15 @@ PROCESS_THREAD(apc_sensor_node_en_sensors_process, ev, data)
1446
1453
for (i = 0 ; i < SENSOR_COUNT ; i ++ ) {
1447
1454
sensor_infos [i ].sensor_type = SENSOR_TYPES [i ];
1448
1455
sensor_infos [i ].is_calibrated = 0 ;
1456
+ int res = activate_sensor (sensor_infos [i ].sensor_type ) == APC_SENSOR_OPFAILURE ;
1449
1457
PRINTF ("apc_sensor_node_en_sensors_process: Sensor(0x%01x): %s\n" , sensor_infos [i ].sensor_type ,
1450
- activate_sensor (sensor_infos [i ].sensor_type ) == APC_SENSOR_OPFAILURE ? "ERROR\0" : "OK\0" );
1458
+ res ? "ERROR\0" : "OK\0" );
1459
+ if (res )
1460
+ color = LEDS_GREEN ;
1461
+ else
1462
+ color = LEDS_RED ;
1463
+ leds_on (color );
1464
+ ctimer_set (& ct_led , PUBLISH_LED_ON_DURATION , callback_led_off , & color );
1451
1465
}
1452
1466
#if !ADC_SENSORS_CONF_USE_EXTERNAL_ADC
1453
1467
//configure the analog multiplexer
0 commit comments