Improvements for ws2812b_tester app

This commit is contained in:
Derek Jamison 2023-12-06 18:30:15 -06:00
parent 216c15dd77
commit cafdbcc001
3 changed files with 17 additions and 5 deletions

View File

@ -23,6 +23,9 @@ This application has three submenu items:
The "About" menu item contains information about the application.
# Updates
- Version 1.8
- Renamed app to fit on Flipper Zero main menu screen
- Improved initialization to only happen when configuring the LEDs
- Version 1.7
- Added blanking TRESET (LOW) signal before sending data to LEDs.
- Increased timer_buffer to uint16 to support blanking signal duration. Maybe there is a better way to do the initial low & save memory?

View File

@ -249,6 +249,11 @@ static bool led_tester_custom_event_callback(void* context, uint32_t event) {
LedTesterApp* app = (LedTesterApp*)context;
const GpioPin* pin = setting_led_pin_values[app->model->led_pin_index];
if(!app->led_driver) {
FURI_LOG_E(TAG, "led_driver is NULL. Custom event %lu ignored.", event);
return false;
}
if(event == LedTesterEventTimer) {
app->model->timer_counter++;
}
@ -344,6 +349,11 @@ static bool led_tester_custom_event_callback(void* context, uint32_t event) {
led_driver_transmit(app->led_driver, false);
if(event == LedTesterEventDeinit) {
led_driver_free(app->led_driver);
app->led_driver = NULL;
}
return true;
}
@ -362,6 +372,8 @@ void led_tester_enter_leds_callback(void* _context) {
app->timer = furi_timer_alloc(led_tester_timer_callback, FuriTimerTypePeriodic, app);
furi_timer_start(app->timer, 250);
view_dispatcher_send_custom_event(app->view_dispatcher, LedTesterEventInitialized);
app->led_driver =
led_driver_alloc(MAX_LED_COUNT, setting_led_pin_values[app->model->led_pin_index]);
}
/**
@ -432,8 +444,6 @@ static LedTesterApp* led_tester_app_alloc() {
variable_item_set_current_value_index(item, setting_led_pin_index);
variable_item_set_current_value_text(item, setting_led_pin_names[setting_led_pin_index]);
app->model->led_pin_index = setting_led_pin_index;
app->led_driver =
led_driver_alloc(MAX_LED_COUNT, setting_led_pin_values[setting_led_pin_index]);
// Count
item = variable_item_list_add(
@ -530,7 +540,6 @@ static LedTesterApp* led_tester_app_alloc() {
* @param app The led tester application object.
*/
static void led_tester_app_free(LedTesterApp* app) {
led_driver_free(app->led_driver);
view_dispatcher_remove_view(app->view_dispatcher, LedTesterViewAbout);
widget_free(app->widget_about);
view_dispatcher_remove_view(app->view_dispatcher, LedTesterViewLeds);

View File

@ -1,9 +1,9 @@
App(
appid="ws2812b_tester_app",
name="WS2812B LED Tester App",
name="WS2812B LED Tester",
apptype=FlipperAppType.EXTERNAL,
entry_point="ws2812b_led_tester_app",
fap_version=(1, 7),
fap_version=(1, 8),
stack_size=4 * 1024,
requires=[
"gui",