From 5dcbf5891fdff693a2bbb319756ea44b28cbe0af Mon Sep 17 00:00:00 2001 From: gullradriel Date: Tue, 10 Feb 2026 01:28:12 +0100 Subject: [PATCH] =?UTF-8?q?keep=20an=20internal=20animation=5Fframe=20valu?= =?UTF-8?q?e=20so=20we=20are=20not=20messing=20with=20the=20model.=20In=20?= =?UTF-8?q?many=20Flipper=20view=20patterns,=20the=20model=20passed=20to?= =?UTF-8?q?=20draw=20is=20intended=20to=20be=20read-only=20(it=E2=80=99s?= =?UTF-8?q?=20typically=20provided=20under=20a=20lock=20owned=20by=20the?= =?UTF-8?q?=20view=20system).=20Mutating=20it=20in=20draw=20can=20cause=20?= =?UTF-8?q?hard-to-debug=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/protopirate_receiver.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/views/protopirate_receiver.c b/views/protopirate_receiver.c index 71a880c..a0c9433 100644 --- a/views/protopirate_receiver.c +++ b/views/protopirate_receiver.c @@ -186,7 +186,8 @@ void protopirate_view_receiver_draw(Canvas* canvas, ProtoPirateReceiverModel* mo canvas_set_font(canvas, FontSecondary); // Increment animation frame - model->animation_frame = (model->animation_frame + 1) % 96; + static uint8_t animation_frame = 0; + animation_frame = (animation_frame + 1) % 96; size_t item_count = ProtoPirateReceiverMenuItemArray_size(model->history_item_arr); bool scrollbar = item_count > MENU_ITEMS; @@ -269,7 +270,7 @@ void protopirate_view_receiver_draw(Canvas* canvas, ProtoPirateReceiverModel* mo // Three waves of expanding circles with different speeds for(int wave = 0; wave < 3; wave++) { // Calculate radius for this wave with offset - int base_radius = ((model->animation_frame + wave * 32) % 96) / 3; + int base_radius = ((animation_frame + wave * 32) % 96) / 3; if(base_radius < 28) { // Calculate fade based on distance from center @@ -313,7 +314,7 @@ void protopirate_view_receiver_draw(Canvas* canvas, ProtoPirateReceiverModel* mo } // Rotating sweep line with glow effect - float sweep_angle = (model->animation_frame * 3.75f) * 3.14159f / 180.0f; + float sweep_angle = (animation_frame * 3.75f) * 3.14159f / 180.0f; // Main sweep line int sweep_x = center_x + 22 * cosf(sweep_angle); @@ -351,7 +352,7 @@ void protopirate_view_receiver_draw(Canvas* canvas, ProtoPirateReceiverModel* mo } // Pulsing center - int pulse = (model->animation_frame % 32); + int pulse = (animation_frame % 32); if(pulse < 16) { canvas_draw_disc(canvas, center_x, center_y, 2); } else {