Skip to content

Commit e2db89b

Browse files
authored
Merge pull request #3 from zinongli/popup
success screen added
2 parents c1ea848 + e0f9031 commit e2db89b

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

assets/RFID_dolphinsuccess_108x57.png

1.89 KB
Loading

t5577_writer.c

+18-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424

2525
#define TAG "T5577 Writer"
26-
#define MAX_REPEAT_WRITING_TIMES 15
26+
#define MAX_REPEAT_WRITING_FRAMES 15
27+
#define ENDING_WRITING_ICON_FRAMES 5
2728

2829
// Change this to BACKLIGHT_AUTO if you don't want the backlight to be continuously on.
2930
#define BACKLIGHT_AUTO 1
@@ -569,23 +570,32 @@ static void t5577_writer_actual_writing(void* model) {
569570
* @param model The model - MyModel object.
570571
*/
571572
static void t5577_writer_view_write_callback(Canvas* canvas, void* model) {
572-
t5577_writer_actual_writing(model);
573-
canvas_set_bitmap_mode(canvas, true);
574-
canvas_draw_icon(canvas, 0, 8, &I_NFC_manual_60x50);
575-
canvas_draw_str_aligned(canvas, 97, 15, AlignCenter, AlignTop, "Writing");
576-
canvas_draw_str_aligned(canvas, 94, 27, AlignCenter, AlignTop, "Hold card next");
577-
canvas_draw_str_aligned(canvas, 93, 39, AlignCenter, AlignTop, "to Flipper's back");
573+
T5577WriterModel* my_model = (T5577WriterModel*) model;
574+
if (my_model->writing_repeat_times < MAX_REPEAT_WRITING_FRAMES) {
575+
t5577_writer_actual_writing(model);
576+
canvas_set_bitmap_mode(canvas, true);
577+
canvas_draw_icon(canvas, 0, 8, &I_NFC_manual_60x50);
578+
canvas_draw_str_aligned(canvas, 97, 15, AlignCenter, AlignTop, "Writing");
579+
canvas_draw_str_aligned(canvas, 94, 27, AlignCenter, AlignTop, "Hold card next");
580+
canvas_draw_str_aligned(canvas, 93, 39, AlignCenter, AlignTop, "to Flipper's back");
581+
} else {
582+
canvas_set_bitmap_mode(canvas, true);
583+
canvas_draw_icon(canvas, 0, 7, &I_RFID_dolphinsuccess_108x57);
584+
canvas_set_font(canvas, FontPrimary);
585+
canvas_draw_str(canvas, 72, 20, "Finished!");
586+
}
578587
}
579588

580589
/**
581590
* @brief Callback for timer elapsed.
582591
* @details This function is called when the timer is elapsed. We use this to queue a redraw event.
583592
* @param context The context - T5577WriterApp object.
584593
*/
594+
585595
static void t5577_writer_view_write_timer_callback(void* context) {
586596
T5577WriterApp* app = (T5577WriterApp*)context;
587597
T5577WriterModel* model = view_get_model(app->view_write);
588-
if (model->writing_repeat_times < MAX_REPEAT_WRITING_TIMES){
598+
if (model->writing_repeat_times < MAX_REPEAT_WRITING_FRAMES + ENDING_WRITING_ICON_FRAMES){
589599
model->writing_repeat_times += 1;
590600
view_dispatcher_send_custom_event(app->view_dispatcher, T5577WriterEventIdRepeatWriting);
591601
} else {

0 commit comments

Comments
 (0)