-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Refactor Bluetooth light UI. Use SPIKE Prime Bluetooth Light. #261
Conversation
While we are touching this code, I've also fixed the standard light animation so that it always starts from the beginning when the user program starts. |
7c43ea5
to
28d921c
Compare
28d921c
to
44c734a
Compare
This refactors the status light patterns: It split the single Overall, the behavior on Move/City/Technic/Essential Hub is mostly the same as before. While we are doing this, the patterns are slightly tweaked for better visibility across hubs. On Prime Hub, this moves all Bluetooth state information to the Bluetooth light. This also disables the blue fading animation and the blue blinking shutdown animation on the main button, which now look out of place. This information is also conveyed by the 5x5 light matrix. Not sure I am entirely happy with this implementation, but it should be a step in the right direction. Could potentially be refactored further with pybricks/support#1798. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The connected idle state (blue) was a special case that acted as a default. The default is now to have no light at all, so we can distinguish BLE connected from disconnected, and potentially distinguish from USB connected if we choose different patterns.
The main status light not blinking is enough of an indicator for now that Bluetooth is off. This way we don't have to introduce new UIs yet that get locked in the upcoming release. When we do create a new UI, we can now use the status flags instead of poking at the lights directly from the sys/bluetooth driver.
This ensures that the animation looks consistent when you start a program, rather than picking up where it stopped last time. This makes it easier to see that a program was started when you run it while connected, since the light always switches from solid to off and then fades.
These are never used, implemented, or documented, so they can be removed.
This separates the combined status light patterns into Bluetooth patterns with warning pattern overlays. On hubs with a separate Bluetooth light, these can be displayed separately. This also simplifies the warning light. Instead of having three orange patterns with different meanings, this introduces a single orange pattern for low battery and a red patterm for high current.
The Prime Hub Bluetooth LED is not very bright, so the short blink is hardly visible. This makes it longer. Also change other warning patterns to match. Also stop advertising on shutdown request instead of shutdown, so that the Bluetooth light does not keep blinking during shutdown. This also gives a more intuitive response when connected, since Pybricks Code now becomes disconnected relatively sooner, matching hun shutdown.
44c734a
to
71af9a4
Compare
This completes the initial refactoring and the main light changes. Further light changes are being discussed in pybricks/support#1716 |
tl;dr: Use a subset of original light UI when Bluetooth is off (instead of inventing something new) so we don't lock ourselves into something when we release the upcoming beta.#247 introduced the ability to toggle Bluetooth on and off. The main light UI was kept unchanged, and a blue (on) and red (off) Bluetooth light was added. As already stated in that issue and pull request, this UI was not ideal since there are too many lights, which can be confusing for users and competition judges. So we'd have to come up with something else before we can release the firmware in beta.Instead of adding new lights, this PR makes it a subset of the existing UI. When Bluetooth is off, the hub status light is off when it would otherwise be on or blink (when connected or advertising). There is no light indication around the Bluetooth light. This seems fairly intuitive. We could potentially still have the red light around the Bluetooth button when off, or save this for when we redo the whole light UI.See updated below.