Skip to content

Commit

Permalink
Add notifications (blue LED during flash and vibrate at end)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xchocolate committed Jul 22, 2023
1 parent 8068506 commit 2edae07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions esp_flasher_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ EspFlasherApp* esp_flasher_app_alloc() {
app->gui = furi_record_open(RECORD_GUI);
app->dialogs = furi_record_open(RECORD_DIALOGS);
app->storage = furi_record_open(RECORD_STORAGE);
app->notification = furi_record_open(RECORD_NOTIFICATION);

app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&esp_flasher_scene_handlers, app);
Expand Down Expand Up @@ -106,6 +107,7 @@ void esp_flasher_app_free(EspFlasherApp* app) {
furi_record_close(RECORD_GUI);
furi_record_close(RECORD_STORAGE);
furi_record_close(RECORD_DIALOGS);
furi_record_close(RECORD_NOTIFICATION);

free(app);
}
Expand Down
2 changes: 2 additions & 0 deletions esp_flasher_app_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <storage/storage.h>
#include <lib/toolbox/path.h>
#include <dialogs/dialogs.h>
#include <notification/notification_messages.h>

#define ESP_FLASHER_TEXT_BOX_STORE_SIZE (4096)

Expand Down Expand Up @@ -47,6 +48,7 @@ struct EspFlasherApp {
TextBox* text_box;
Storage* storage;
DialogsApp* dialogs;
NotificationApp* notification;

VariableItemList* var_item_list;
Widget* widget;
Expand Down
15 changes: 14 additions & 1 deletion esp_flasher_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ static int32_t esp_flasher_flash_bin(void* context) {
flash_rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE, 1);
timer = furi_timer_alloc(_timer_callback, FuriTimerTypePeriodic, app);

// turn on flipper blue LED for duration of flash
notification_message(app->notification, &sequence_set_only_blue_255);

loader_port_debug_print("Connecting\n");
esp_loader_connect_args_t connect_config = ESP_LOADER_CONNECT_DEFAULT();
err = esp_loader_connect(&connect_config);
Expand Down Expand Up @@ -169,10 +172,20 @@ static int32_t esp_flasher_flash_bin(void* context) {
loader_port_debug_print("Restoring transmission rate\n");
furi_hal_uart_set_br(FuriHalUartIdUSART1, 115200);
#endif
loader_port_debug_print("Done flashing. Please reset the board manually.\n");
loader_port_debug_print("Done flashing. Please reset the board manually if it doesn't auto-reset.\n");

// auto-reset for supported boards
loader_port_reset_target();

// short buzz to alert user
notification_message(app->notification, &sequence_set_vibro_on);
loader_port_delay_ms(50);
notification_message(app->notification, &sequence_reset_vibro);
}

// turn off flipper blue LED
notification_message(app->notification, &sequence_reset_blue);

// done
app->flash_worker_busy = false;

Expand Down

0 comments on commit 2edae07

Please sign in to comment.