-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add bluetooth animation in ble download mode #17
Conversation
f398591
to
e4379fd
Compare
@sourcery-ai review |
Reviewer's Guide by SourceryThis pull request introduces a Bluetooth animation to indicate when the badge is in download mode. It also adds functions to handle mode transitions and power off the device. The Makefile has been updated to include new source files required for these features. File-Level Changes
Tips
|
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.
Hey @kienvo - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
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.
Hey @kienvo - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
src/ble/peripheral.c
Outdated
@@ -198,16 +198,26 @@ static uint16 peripheral_task(uint8 task_id, uint16 events) | |||
return 0; | |||
} | |||
|
|||
void ble_enable_advertise() |
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.
suggestion: Consider adding power management for BLE advertising
The new functions to enable and disable BLE advertising are a good addition. Consider implementing a power management strategy that balances advertising frequency with power consumption, especially for battery-operated devices.
void ble_enable_advertise() | |
void ble_enable_advertise() | |
{ | |
uint8 e = TRUE; | |
// Set advertising interval to balance power consumption | |
uint16_t advertising_interval = 1000; // Adjust this value as needed | |
set_advertising_interval(advertising_interval); | |
} |
src/animation.c
Outdated
return ++i; | ||
} | ||
|
||
void ani_scroll_x(bm_t *bm, uint16_t *fb, int dir) |
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.
suggestion (performance): Optimize animation functions for performance
The animation functions, particularly those involving shifts and rotations, could potentially be optimized. Consider using bit manipulation techniques or lookup tables where appropriate to improve performance, especially for resource-constrained devices.
void ani_scroll_x(bm_t *bm, uint16_t *fb, int dir) | |
void ani_scroll_x(bm_t *bm, uint16_t *fb, int dir) | |
{ | |
int x = (bm->anim_step & (bm->width + LED_COLS - 1)) - LED_COLS; | |
} |
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.
????
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.
It looks like there was some confusion regarding the suggestion. The suggestion was aimed at optimizing the animation functions for better performance, particularly on resource-constrained devices. The idea is to explore using bit manipulation techniques or lookup tables to potentially speed up operations like shifts and rotations within the animation functions.
However, the specific code snippet provided in the suggestion might not have been clear or directly applicable. If you have specific areas in the animation code where performance is a concern, we can focus on those and discuss potential optimizations. Let me know if there's a particular part of the code you'd like to explore further or if you have any questions about the suggestion!
This is an animation indicating the badge is in download mode.
Summary by Sourcery
This pull request adds a Bluetooth animation to indicate the badge is in download mode. It replaces the framebuffer (fb) with a bitmap (bm) for handling display data and animations, introduces various animation functions, and implements task management for handling different animation steps and Bluetooth download mode. Additionally, it updates the documentation to correct animation mode descriptions and modifies the build system to include new source files.