Skip to content

Commit 9665ac2

Browse files
committed
pbio/sys/light: Hack for EV3 status light.
The sys/light system was always a bit complicated and probably needs a thorough rework. For now, add a minor workaround to make the EV3 light always green, as in the original firmware.
1 parent a96b358 commit 9665ac2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

lib/pbio/sys/light.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <pbsys/status.h>
1717

1818
#include "../src/light/color_light.h"
19+
#include "light.h"
1920

2021
#if PBSYS_CONFIG_STATUS_LIGHT
2122

@@ -193,6 +194,8 @@ void pbsys_status_light_init(void) {
193194
pbdrv_led_get_dev(2, &pbsys_status_light_instance_usb_ble.led);
194195
pbio_color_light_init(&pbsys_status_light_instance_usb_ble.color_light, &pbsys_status_light_funcs);
195196
#endif
197+
198+
pbsys_status_light_handle_status_change();
196199
}
197200

198201
void pbsys_status_light_handle_status_change(void) {
@@ -227,6 +230,12 @@ void pbsys_status_light_handle_status_change(void) {
227230
usb_ble_indication = PBSYS_STATUS_LIGHT_INDICATION_BLE_CONNECTED;
228231
}
229232

233+
// REVISIT: Generalize setting of non-pattern colors. This workaround
234+
// is currently needed because simply turning a light on is impossible.
235+
#if PBSYS_CONFIG_HMI_EV3
236+
usb_ble_indication = PBSYS_STATUS_LIGHT_INDICATION_USB_CONNECTED;
237+
#endif
238+
230239
#if !PBSYS_CONFIG_STATUS_LIGHT_BLUETOOTH
231240
// Hubs without Bluetooth light don't show connectivity state if program is running.
232241
if (pbsys_status_test(PBIO_PYBRICKS_STATUS_USER_PROGRAM_RUNNING)) {

0 commit comments

Comments
 (0)