@@ -466,6 +466,8 @@ static void sampling_begin_common(struct main_state *state_object)
466466
467467 return ;
468468 }
469+
470+ LOG_ERR ("LED pattern published" );
469471#endif /* CONFIG_APP_LED */
470472
471473 state_object -> sample_start_time = k_uptime_seconds ();
@@ -497,23 +499,21 @@ static void waiting_entry_common(const struct main_state *state_object)
497499 timer_sample_start (time_remaining );
498500
499501#if defined(CONFIG_APP_LED )
500- {
501- int err ;
502- struct led_msg led_msg = {
503- .type = LED_RGB_SET ,
504- .red = 0 ,
505- .green = 0 ,
506- .blue = 55 ,
507- .duration_on_msec = 250 ,
508- .duration_off_msec = 2000 ,
509- .repetitions = 10 ,
510- };
502+ int err ;
503+ struct led_msg led_msg = {
504+ .type = LED_RGB_SET ,
505+ .red = 0 ,
506+ .green = 0 ,
507+ .blue = 55 ,
508+ .duration_on_msec = 250 ,
509+ .duration_off_msec = 2000 ,
510+ .repetitions = 10 ,
511+ };
511512
512- err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
513- if (err ) {
514- LOG_ERR ("Failed to publish LED wait pattern, error: %d" , err );
515- SEND_FATAL_ERROR ();
516- }
513+ err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
514+ if (err ) {
515+ LOG_ERR ("Failed to publish LED wait pattern, error: %d" , err );
516+ SEND_FATAL_ERROR ();
517517 }
518518#endif /* CONFIG_APP_LED */
519519}
@@ -848,6 +848,25 @@ static void buffer_disconnected_entry(void *o)
848848 LOG_DBG ("%s" , __func__ );
849849
850850 state_object -> running_history = STATE_BUFFER_DISCONNECTED ;
851+
852+ #if defined(CONFIG_APP_LED )
853+ int err ;
854+ struct led_msg led_msg = {
855+ .type = LED_RGB_SET ,
856+ .red = 150 ,
857+ .green = 150 ,
858+ .blue = 0 ,
859+ .duration_on_msec = 250 ,
860+ .duration_off_msec = 2000 ,
861+ .repetitions = 10 ,
862+ };
863+
864+ err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
865+ if (err ) {
866+ LOG_ERR ("Failed to publish LED disconnected pattern, error: %d" , err );
867+ SEND_FATAL_ERROR ();
868+ }
869+ #endif /* CONFIG_APP_LED */
851870}
852871
853872static void buffer_disconnected_run (void * o )
@@ -1193,6 +1212,25 @@ static void passthrough_disconnected_entry(void *o)
11931212 LOG_DBG ("%s" , __func__ );
11941213
11951214 state_object -> running_history = STATE_PASSTHROUGH_DISCONNECTED ;
1215+
1216+ #if defined(CONFIG_APP_LED )
1217+ int err ;
1218+ struct led_msg led_msg = {
1219+ .type = LED_RGB_SET ,
1220+ .red = 150 ,
1221+ .green = 150 ,
1222+ .blue = 0 ,
1223+ .duration_on_msec = 250 ,
1224+ .duration_off_msec = 2000 ,
1225+ .repetitions = 10 ,
1226+ };
1227+
1228+ err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
1229+ if (err ) {
1230+ LOG_ERR ("Failed to publish LED disconnected pattern, error: %d" , err );
1231+ SEND_FATAL_ERROR ();
1232+ }
1233+ #endif /* CONFIG_APP_LED */
11961234}
11971235
11981236static void passthrough_disconnected_run (void * o )
@@ -1227,6 +1265,26 @@ static void passthrough_connected_sampling_entry(void *o)
12271265 state_object -> running_history = STATE_PASSTHROUGH_CONNECTED_SAMPLING ;
12281266 state_object -> sample_start_time = k_uptime_seconds ();
12291267
1268+ #if defined(CONFIG_APP_LED )
1269+ struct led_msg led_msg = {
1270+ .type = LED_RGB_SET ,
1271+ .red = 0 ,
1272+ .green = 55 ,
1273+ .blue = 0 ,
1274+ .duration_on_msec = 250 ,
1275+ .duration_off_msec = 2000 ,
1276+ .repetitions = 10 ,
1277+ };
1278+
1279+ err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
1280+ if (err ) {
1281+ LOG_ERR ("Failed to publish LED pattern message, error: %d" , err );
1282+ SEND_FATAL_ERROR ();
1283+
1284+ return ;
1285+ }
1286+ #endif /* CONFIG_APP_LED */
1287+
12301288 err = zbus_chan_pub (& LOCATION_CHAN , & location_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
12311289 if (err ) {
12321290 LOG_ERR ("Failed to publish location search trigger, error: %d" , err );
@@ -1278,6 +1336,27 @@ static void passthrough_connected_waiting_entry(void *o)
12781336
12791337 LOG_DBG ("Passthrough mode: next trigger in %d seconds" , time_remaining );
12801338 timer_sample_start (time_remaining );
1339+
1340+ #if defined(CONFIG_APP_LED )
1341+ int err ;
1342+ struct led_msg led_msg = {
1343+ .type = LED_RGB_SET ,
1344+ .red = 0 ,
1345+ .green = 55 ,
1346+ .blue = 0 ,
1347+ .duration_on_msec = 250 ,
1348+ .duration_off_msec = 2000 ,
1349+ .repetitions = 10 ,
1350+ };
1351+
1352+ err = zbus_chan_pub (& LED_CHAN , & led_msg , K_MSEC (ZBUS_PUBLISH_TIMEOUT_MS ));
1353+ if (err ) {
1354+ LOG_ERR ("Failed to publish LED pattern message, error: %d" , err );
1355+ SEND_FATAL_ERROR ();
1356+
1357+ return ;
1358+ }
1359+ #endif /* CONFIG_APP_LED */
12811360}
12821361
12831362static void passthrough_connected_waiting_run (void * o )
@@ -1404,7 +1483,6 @@ static void fota_downloading_entry(void *o)
14041483
14051484#if defined(CONFIG_APP_LED )
14061485 int err ;
1407-
14081486 /* Purple pattern during download - indefinite for ongoing process */
14091487 struct led_msg led_msg = {
14101488 .type = LED_RGB_SET ,
0 commit comments