From 14fb3fb118e14148a074dbd4e91f3683536f6925 Mon Sep 17 00:00:00 2001 From: Ray Lee Date: Thu, 12 Aug 2021 13:46:46 +0800 Subject: [PATCH] only one loop --- armsrc/Standalone/hf_mfcsim.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/armsrc/Standalone/hf_mfcsim.c b/armsrc/Standalone/hf_mfcsim.c index 403793b71..cc5379b93 100644 --- a/armsrc/Standalone/hf_mfcsim.c +++ b/armsrc/Standalone/hf_mfcsim.c @@ -88,14 +88,9 @@ void RunMod(void) { Dbprintf(_YELLOW_("Standalone mode MFCSIM started!")); bool flag_has_dumpfile = false; - for (int i = 1;; i++) { - if (i > 15) { - if (flag_has_dumpfile) i = 1; //Next loop! - else break;//No dump,Exit! - } - LED(i, 1000); + for (int i = 1; i < 16; i++) { + LED(i, 100); emlClearMem(); - sprintf(cur_dump_file, HF_MFCSIM_DUMPFILE_SIM, i); Dbprintf(_YELLOW_("[Slot: %d] Try to load dump file: %s"), i, cur_dump_file); if (!ecfill_from_file(cur_dump_file)) { @@ -103,13 +98,16 @@ void RunMod(void) { continue; } flag_has_dumpfile = true; + LED(i, 1000); Dbprintf(_YELLOW_("[Slot: %d] Simulation start, Press button to change next card."), i); uint16_t simflags = FLAG_UID_IN_EMUL | FLAG_MF_1K; Mifare1ksim(simflags, 0, NULL, 0, 0); Dbprintf(_YELLOW_("[Slot: %d] Simulation end, Change to next card!"), i); } - Dbprintf("No dump file found, Exit!"); + if(!flag_has_dumpfile) Dbprintf("No dump file found, Exit!"); + Dbprintf("Loop end, Exit!"); + SpinErr(15, 200, 3); return; }