Просмотр исходного кода

UI improvements, precompute bug found

Zachary Weiss 3 лет назад
Родитель
Сommit
7f0b477ce4
6 измененных файлов с 15 добавлено и 9 удалено
  1. 6 1
      README.md
  2. 1 1
      application.fam
  3. 2 2
      helpers/mag_helpers.c
  4. 0 2
      mag_device.h
  5. 2 1
      scenes/mag_scene_emulate.c
  6. 4 2
      scenes/mag_scene_saved_info.c

+ 6 - 1
README.md

@@ -5,8 +5,11 @@ Disclaimer: use responsibly, and at your own risk. While in my testing, I've see
 
 ## TODO
 Emulation:
+- ***Fix signal truncation issue!***
 - General code cleanup
 - Reverse track precompute & replay
+- Prefix/between/suffix addition to config menu
+- Parameter tuning, find best defaults, troubleshoot improperly parsed TX
 - Implement/integrate better bitmap than hacky first pass? Boilerplate from [antirez](https://github.com/antirez)'s better approach (from [ProtoView](https://github.com/antirez/protoview)) included at the bottom of `helpers/mag_helpers.c`
 - Should the main timing-sensitive section be branchless? (Remove `if` and `switch` statements from the `FURI_CRITICAL...` section of `mag_spoof()`?)
 - Pursue skunkworks TX improvement ideas listed below
@@ -14,6 +17,7 @@ Emulation:
 Scenes:
 - Finish emulation config scene (reverse track functionality; possibly expand settings list to include prefix/between/suffix options)
 - "Edit" scene (generalize "Add manually")
+- "Rename" scene (generalize input_name)
 
 File management:
 - Validation of card track data?
@@ -21,9 +25,10 @@ File management:
 - Update Add Manually flow to reflect new file format (currently only sets Track 2)
 
 Known bugs:
+- ***From debug logging output, seems precomputed signal is getting truncated somehow! This is priority \#1 to fix***
 - Custom text input scene with expanded characterset (Add Manually) has odd behavior when navigating the keys near the numpad
 - Track 1 data typically starts with a `%` sign. Unless escaped, it won't be displayed when printed, as C considers it a special character. To confirm: how does this impact the emulation when iterating through the chars? Does it get played correctly?
-- Possible file format issues when Track 2 data exists but Track 1 is left empty; doesn't seem to load happily.
+- Possible file format issues when Track 2 data exists but Track 1 is left empty; doesn't seem to be setting the Track 2 field with anything (doesn't overwrite existing data). However, `flipper_format_read_string()` doesn't seem to return `false`. Is the bug in my code, or with `flipper_format`?
 - Attempting to play a track that doesn't have data results in a crash (as one might expect). Need to lock out users from selecting empty tracks in the config menu or do better error handling
 
 ## Skunkworks ideas

+ 1 - 1
application.fam

@@ -12,7 +12,7 @@ App(
     ],
     provides=[],
     stack_size=2 * 1024,
-    order=20,
+    order=64,  # keep it at the bottom of the list while still WIP
     fap_icon="icons/mag_10px.png",
     fap_category="Tools",
     fap_icon_assets="icons",

+ 2 - 2
helpers/mag_helpers.c

@@ -105,9 +105,9 @@ void tx_init_gpio() {
     furi_hal_gpio_init(GPIO_PIN_B, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
     furi_hal_gpio_init(GPIO_PIN_ENABLE, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
 
-    furi_delay_ms(300);
-
     furi_hal_gpio_write(GPIO_PIN_ENABLE, 1);
+
+    furi_delay_ms(500);
 }
 
 void tx_reset_gpio() {

+ 0 - 2
mag_device.h

@@ -15,8 +15,6 @@
 
 typedef void (*MagLoadingCallback)(void* context, bool state);
 
-//typedef struct MagDevice MagDevice;
-
 typedef struct {
     FuriString* str;
 } MagTrack;

+ 2 - 1
scenes/mag_scene_emulate.c

@@ -28,8 +28,9 @@ void mag_scene_emulate_on_enter(void* context) {
         if(is_active_one | is_active_two | is_active_both) {
             furi_string_cat_printf(
                 tmp_str,
-                "Track %d:\n%s\n\n",
+                "Track %d:%s%s\n\n",
                 (i + 1),
+                furi_string_empty(trackstr) ? "  " : "\n",
                 furi_string_empty(trackstr) ? "< empty >" : furi_string_get_cstr(trackstr));
         }
     }

+ 4 - 2
scenes/mag_scene_saved_info.c

@@ -20,9 +20,11 @@ void mag_scene_saved_info_on_enter(void* context) {
 
         furi_string_cat_printf(
             tmp_str,
-            "Track %d:\n%s\n\n",
+            "Track %d:%s%s%s",
             (i + 1),
-            furi_string_empty(trackstr) ? "< empty >" : furi_string_get_cstr(trackstr));
+            furi_string_empty(trackstr) ? "  " : "\n",
+            furi_string_empty(trackstr) ? "< empty >" : furi_string_get_cstr(trackstr),
+            (i + 1 == MAG_DEV_TRACKS) ? "" : "\n\n");
     }
 
     widget_add_text_scroll_element(widget, 0, 15, 128, 49, furi_string_get_cstr(tmp_str));