-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] redefine hub light status indications #1716
Comments
Thanks for opening this issue. As noted in the issue about disabling Bluetooth, the entire hub UI probably needs to be revisited at some point. This is why that feature hasn't been released yet. Having multi-program support, a port view program, USB support, and the UI on other hubs might all be part of that consideration. |
Here's an alternate idea for the time being that might help us get the Bluetooth toggle in a release state in a reasonable time frame:
So instead of having lights around the Bluetooth button as we added recently, how about just turning off the blue center button light if Bluetooth is disabled? Since this only affects the Prime/Inventor Hub, you can still tell that a program is or isn't running using the matrix display. It seems like this might address the concerns for the time being, without having to introduce an all-new UI just yet. I'll try making a PR for this later this week to see how it looks. What do you think? |
Looking at the code, it looks like the solid blue is not an indication pattern but a default when there isn't anything else to indicate. So perhaps the right way to implement this is to introduce dedicated patterns for
|
@afarago , pybricks/pybricks-micropython#261 implements the above suggestion. How does this look when you try it? |
Thanks for the progress.
|
I like Attila's suggestion of using the Bluetooth light (if there is one) for all things Bluetooth. Except for the part where light off means both connected and disabled. So I would suggest solid blue on for connected. In other words, if the hub has a Bluetooth button/light, just move the current Bluetooth aspects of the light UI from the status button light to the Bluetooth button light. That is, make this change and add a new similar function for the Bluetooth status light. diff --git a/lib/pbio/sys/light.c b/lib/pbio/sys/light.c
index 6bc15d7b4..06a34bdab 100644
--- a/lib/pbio/sys/light.c
+++ b/lib/pbio/sys/light.c
@@ -191,16 +191,20 @@ static void pbsys_status_light_handle_status_change(void) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_SHUTDOWN;
} else if (shutdown_requested) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_SHUTDOWN_REQUESTED;
+#if !PBSYS_CONFIG_STATUS_LIGHT_BLUETOOTH
} else if (ble_advertising && low_voltage) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_BLE_ADVERTISING_AND_LOW_VOLTAGE;
} else if (ble_advertising) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_BLE_ADVERTISING;
+#endif
} else if (high_current) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_HIGH_CURRENT;
+#if !PBSYS_CONFIG_STATUS_LIGHT_BLUETOOTH
} else if (ble_low_signal && low_voltage) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_BLE_LOW_SIGNAL_AND_LOW_VOLTAGE;
} else if (ble_low_signal) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_BLE_LOW_SIGNAL;
+#endif
} else if (low_voltage) {
new_indication = PBSYS_STATUS_LIGHT_INDICATION_LOW_VOLTAGE;
} |
For now the point isn't to come up with the final UI, but something that lets us release it in beta at all. Otherwise, I think we should just disable the feature altogether for the foreseeable future. This feature is needed for a very small number of users (and for the wrong reasons, since Bluetooth doesn't have to be disabled) but impacts everyone. I'm happy to include something passable for now, but I would rather not change too much right now. The final light UI has to include things like USB handling, multi programs, and port view, and consistency across all hubs, so I'd like to keep the options open. |
I fear that the simple implementation pybricks/pybricks-micropython#261 might cause more confusion than solving issues, but honestly cannot judge. Might be a good call to invite the community to express their opinion. Let me know if I can contribute and help by implementing or defining any of the above to speed things up. Most teams today do without disabling the BT fine, so there should be no direct rush with it. I am pretty sure that disabling bluetooth is just a workaround to resolve a privacy/protection topic. Should I raise a separate feature request or a discussion for this? (keeping UUID stable & closed-BT & UX for one-time-open-connection)? |
I had a feeling a few teams wanted it for this seasons already, so that's why I thought it would be nice to have something in place. Then people may not feel like they have to use custom builds from outdated pull requests (we had a question about that just yesterday), which can sometimes be a recipe for trouble. Perhaps as a reasonable alternative, we can keep the build flag disabled by default, but add an article to the site with a link to the correct custom build with that feature enabled.
I'm afraid to say that this particular change probably wouldn't happen any time soon due to lack of time. But turning Bluetooth off (assuming we figure out a good UI), and potentially adding USB support in the future, seems to be a fairly reasonable path forward that covers most scenarios? |
In case we are going to move half of the light indications to the bluetooth button, what are your preferences for the main hub status light? Should it still glow/fade blue when a program is running, given that we already have an animation on the hub display? We'll also want to keep the familiarity aspect in mind. So far, white = SPIKE V2, green = SPIKE V3, blue = Pybricks. This wouldn't apply anymore. Or we do let it remain blue, even when Bluetooth is off, since the button light hopefully makes it clear then. |
My 2 cents: I would like the indication on the power button to be kept. If the display matrix is used for something else, the status would be lost. |
Idle = Blue |
How about adding a small detail for combining both. Bluetooth long press = generate new UUID otherwise keep using the current one. Normally GATT sevice set is unchanged anyhow, and for any protocol change or other this would add an easy troubleshooting. If this sounds reasonable enough next week I can play around with the code and come up with a discussion-ready-quality PR. I assume currenty the UUID is not persisted yet. |
Just for context, the intended security aspect probably does deserve a dedicated issue even if we might not get to it soon. Keeping all the ideas together is always nice.
If we finish pybricks/pybricks-micropython#264, reach consensus on #139 and implement this UI, and implement multi program storage (there are some relatively simple approaches to get started), then maybe a combined UI isn't all that far off, and we could potentially do it all at once 😄 And then the solution for someone in a hurry will be to use the latest master build. |
I think I am going to refactor the light patterns from typedef enum {
PBSYS_STATUS_LIGHT_INDICATION_NONE,
PBSYS_STATUS_LIGHT_INDICATION_HIGH_CURRENT,
PBSYS_STATUS_LIGHT_INDICATION_LOW_VOLTAGE,
PBSYS_STATUS_LIGHT_INDICATION_BLE_ADVERTISING,
PBSYS_STATUS_LIGHT_INDICATION_BLE_ADVERTISING_AND_LOW_VOLTAGE,
PBSYS_STATUS_LIGHT_INDICATION_BLE_LOW_SIGNAL,
PBSYS_STATUS_LIGHT_INDICATION_BLE_LOW_SIGNAL_AND_LOW_VOLTAGE,
PBSYS_STATUS_LIGHT_INDICATION_BLE_CONNECTED_IDLE,
PBSYS_STATUS_LIGHT_INDICATION_BLE_CONNECTED_IDLE_AND_LOW_VOLTAGE,
PBSYS_STATUS_LIGHT_INDICATION_SHUTDOWN_REQUESTED,
PBSYS_STATUS_LIGHT_INDICATION_SHUTDOWN,
} pbsys_status_light_indication_t; to: typedef enum {
PBSYS_STATUS_LIGHT_INDICATION_BLUETOOTH_BLE_OFF,
PBSYS_STATUS_LIGHT_INDICATION_BLUETOOTH_BLE_ADVERTISING,
// Skipping low signal since this wasn't actually used anywhere. But could be added back here.
PBSYS_STATUS_LIGHT_INDICATION_BLUETOOTH_BLE_CONNECTED_IDLE,
} pbsys_status_light_indication_bluetooth_t;
typedef enum {
PBSYS_STATUS_LIGHT_INDICATION_WARNING_NONE,
PBSYS_STATUS_LIGHT_INDICATION_WARNING_HIGH_CURRENT,
PBSYS_STATUS_LIGHT_INDICATION_WARNING_LOW_VOLTAGE,
PBSYS_STATUS_LIGHT_INDICATION_WARNING_SHUTDOWN_REQUESTED,
PBSYS_STATUS_LIGHT_INDICATION_WARNING_SHUTDOWN,
} pbsys_status_light_indication_warning_t; On the hubs with one light, warnings will take priority and overlay/override appropriately. On hubs with a separate Bluetooth light, they'll be displayed separately. I would also like to propose to use a single orange pattern for low battery, instead of two differently timed orange patterns we have now. |
If we are going to be doing a major status light overhaul, there is one thing that I have always missed and I think could also help with support requests. I would like to have an indication when the user program ends that lets the user know why it ended:
This is especially helpful when running a program while not connected to a computer. And we frequently get support requests where we have to ask to see the whole program and try to understand the program to see what might be happening. But with some sort of status light indication, we could probably help most people without actually having to dig into the program. Not sure what indications would be intuitive to people though. At least one version of the official LEGO SPIKE Prime firmware blinked red a few times on unhandled exception, which seemed nice to me. |
Yes, I think we can do that. It seems like we could do that with one or more additional status flags (`did_error_x), and a non-repeating light pattern to indicate it. This way, we shouldn't have to worry about waiting for the light signal to complete, since starting a new program will take care of clearing that status and light pattern. I suppose any normal exit including the stop button do not need indications, but unhandled exceptions could certainly have one. If we want to distinguish further, I think we could have one indication for Also to be complete, here is something from 4 years ago, which is the slightly more elaborate version of #139. I'm not as much of a fan of this iteration anymore though. |
Quite a bit has been done in pybricks/pybricks-micropython#261. A few ideas came up in conversation the other day, and then later in posts above:
|
Maybe. One of the cases I was thinking about was the frequent support requests that, "I ran my program and it didn't do anything". If there was a light pattern on successful completion, then we would know that someone either wrote functions and didn't call them or didn't call any blocking functions. Then we could write a self-help section in the docs that "if you see this light pattern and your program didn't do anything then you probably made one of these common mistakes..." Having the stop button not have any light pattern makes sense to me though - it neither ran to the end of the program nor had an unhandled exception |
Agreed. Another way to catch those might be to have a program start indication, which may also cover #139 (comment). |
|
I might be too out of box here, yet how about an audio notification? Normal end - none For example.... |
Yes, especially on hubs with a broken screen (I've been making progress on the NXT last night 🤫). Short sound patterns might be easier than tones, and not too many different ones. It would be nice to hear slot switches too. To get started, I would suggest to take the python program that emulates the spike menu from the issue about the spike UI. Add some sounds there to see what sounds right before doing it in the firmware. Feel free to discuss in a new issue :) |
Is your feature request related to a problem? Please describe.
The current system of indicating the hub state is not as clear as it could be.
I bumped into this especially with the bluetooth off indications.
Describe the solution you'd like
I would like to see a more concise way of handling lights for indicating non-user-program mode statuses.
NOTE: when BT or battery light is not available (Move hub, City hub?) the status light should keep the BT/BATTERY status as well - per or even extending the current implementation.
currently not available in firmware
Describe alternatives you've considered
The current coloring is problematic especially when using in WRO or FLL competitions.
It is always OK to set it to disabled, yet if that does not happen the BT=BLUE suggests that the hub is connected over BT to a computer. This is to be avoided.
Additional context
Add any other context or screenshots about the feature request here.
I have played around a bit and this is a preliminary implementation for demo purposes.
https://github.com/afarago/pybricks-micropython/tree/feature/lights-redefined
The text was updated successfully, but these errors were encountered: