Skip to content

Commit 2b20fc9

Browse files
committed
upd mfkey
fixes by Willy-JL
1 parent 80af529 commit 2b20fc9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

base_pack/mfkey/mfkey.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -685,12 +685,12 @@ static void render_callback(Canvas* const canvas, void* ctx) {
685685
float eta_round = (float)1 - ((float)program_state->eta_round / (float)eta_round_time);
686686
float eta_total = (float)1 - ((float)program_state->eta_total / (float)eta_total_time);
687687
float progress = (float)program_state->num_completed / (float)program_state->total;
688-
if(eta_round < 0) {
688+
if(eta_round < 0 || eta_round > 1) {
689689
// Round ETA miscalculated
690690
eta_round = 1;
691691
program_state->eta_round = 0;
692692
}
693-
if(eta_total < 0) {
693+
if(eta_total < 0 || eta_total > 1) {
694694
// Total ETA miscalculated
695695
eta_total = 1;
696696
program_state->eta_total = 0;
@@ -825,21 +825,18 @@ int32_t mfkey_main() {
825825
case InputKeyRight:
826826
if(program_state->mfkey_state == Ready) {
827827
program_state->mfkey_state = Help;
828-
view_port_update(view_port);
829828
}
830829
break;
831830
case InputKeyLeft:
832831
break;
833832
case InputKeyOk:
834833
if(program_state->mfkey_state == Ready) {
835834
furi_thread_start(program_state->mfkeythread);
836-
view_port_update(view_port);
837835
}
838836
break;
839837
case InputKeyBack:
840838
if(program_state->mfkey_state == Help) {
841839
program_state->mfkey_state = Ready;
842-
view_port_update(view_port);
843840
} else {
844841
program_state->close_thread_please = true;
845842
// Wait until thread is finished
@@ -854,8 +851,8 @@ int32_t mfkey_main() {
854851
}
855852
}
856853

857-
view_port_update(view_port);
858854
furi_mutex_release(program_state->mutex);
855+
view_port_update(view_port);
859856
}
860857

861858
// Thread joined in back event handler

0 commit comments

Comments
 (0)