Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
UI improvements, precompute bug found
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyweiss committed Jan 26, 2023
1 parent f5f09f6 commit 7f0b477
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ 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

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?
- Parsing loaded files into human-readable fields (would we need to specify card type to decode correctly?)
- 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
Expand Down
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions helpers/mag_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 0 additions & 2 deletions mag_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

typedef void (*MagLoadingCallback)(void* context, bool state);

//typedef struct MagDevice MagDevice;

typedef struct {
FuriString* str;
} MagTrack;
Expand Down
3 changes: 2 additions & 1 deletion scenes/mag_scene_emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
Expand Down
6 changes: 4 additions & 2 deletions scenes/mag_scene_saved_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 7f0b477

Please sign in to comment.