Skip to content

Commit

Permalink
Refactors from xMasterX & WillyJL
Browse files Browse the repository at this point in the history
  • Loading branch information
David Lee committed May 29, 2024
1 parent 5dcdf94 commit 9ab8760
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 19 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Appart from that, most pagers support 8191 Stations. Triggering ~30 Pagers per s
Also your Flipper Zero will crash in that time, as the generated signals use RAM which is limited in the device. There may be ways to work around this, but I think its better to have such a limitation.

## Does this even work
I don't know. It's based on intel collected from other people. The Flipper sends data, I checked that with a second flipper. But if the data actually triggers something is not sure.
I don't know. It's based on intel collected from other people. The Flipper sends data, I checked that with a second flipper. I've also heard rumors that it works in Australia. I'm sure it doesn't work in the US, as they use different frequencies.

Then run the command:
```
Expand All @@ -63,4 +63,5 @@ The application will be compiled and copied onto your device.
## Thank you notes
- [Moeker](https://github.com/moeker) and his awesome [pagger tool](https://github.com/meoker/pagger), couldn't have done this without
- [xb8](https://github.com/xb8/t119bruteforcer) for the useful data collected
- [Xenobyte, ShotokanZH](https://twitter.com/xenobyte_/status/1558123251276070912) for their super interesting research
- [Xenobyte, ShotokanZH](https://twitter.com/xenobyte_/status/1558123251276070912) for their super interesting research
- [WillyJL](https://github.com/Willy-JL) and [xMasterX](https://github.com/xMasterX) for code contributions/corrections
2 changes: 1 addition & 1 deletion application.fam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ App(
fap_icon="icons/meal_pager_10px.png",
fap_icon_assets="icons",
fap_category="Sub-Ghz",
fap_version="1.6",
fap_version="1.7",
fap_author="leedave",
fap_weburl="https://github.com/leedave/flipper-zero-meal-pager",
fap_description="This app triggers restaurant pagers in a brute force manner, useful to test if devices are still functional.",
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v1.7
- Added code refactors from xMasterX and WillyJL
- Minor update of Readme

## v1.6
- Fix crashes on exit on fw 0.100.3

Expand Down
15 changes: 9 additions & 6 deletions helpers/meal_pager_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,23 @@ void meal_pager_read_settings(void* context) {
FURI_LOG_E(TAG, "Cannot open file %s", MEAL_PAGER_SETTINGS_SAVE_PATH);
meal_pager_close_config_file(fff_file);
meal_pager_close_storage();
furi_string_free(temp_str);
return;
}

if(!flipper_format_read_header(fff_file, temp_str, &file_version)) {
FURI_LOG_E(TAG, "Missing Header Data");
meal_pager_close_config_file(fff_file);
meal_pager_close_storage();
furi_string_free(temp_str);
return;
}

if(file_version < MEAL_PAGER_SETTINGS_FILE_VERSION) {
FURI_LOG_I(TAG, "old config version, will be removed.");
meal_pager_close_config_file(fff_file);
meal_pager_close_storage();
furi_string_free(temp_str);
return;
}

Expand Down Expand Up @@ -223,26 +226,26 @@ void meal_pager_set_max_values(void* context) {
}
if(app->first_station > app->max_station) {
app->first_station = app->max_station;
snprintf(app->text_store[0], 20, "%lu", app->first_station);
snprintf(app->text_store[0], sizeof(app->text_store[0]), "%lu", app->first_station);
}
if(app->last_station > app->max_station) {
app->last_station = app->max_station;
snprintf(app->text_store[1], 20, "%lu", app->last_station);
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
}
if(app->last_station < app->first_station) {
app->last_station = app->first_station;
snprintf(app->text_store[1], 20, "%lu", app->last_station);
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
}
if(app->first_pager > app->max_pager) {
app->first_pager = app->max_pager;
snprintf(app->text_store[2], 20, "%lu", app->first_pager);
snprintf(app->text_store[2], sizeof(app->text_store[2]), "%lu", app->first_pager);
}
if(app->last_pager > app->max_pager) {
app->last_pager = app->max_pager;
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
}
if(app->last_pager < app->first_pager) {
app->last_pager = app->first_pager;
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
}
}
2 changes: 1 addition & 1 deletion meal_pager_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
#define MEAL_PAGER_VERSION "1.6"
#define MEAL_PAGER_VERSION "1.7"

typedef struct Meal_PagerTransmit Meal_PagerTransmit;
typedef struct SubGhz SubGhz;
Expand Down
2 changes: 1 addition & 1 deletion scenes/meal_pager_scene_set_first_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool meal_pager_scene_set_first_pager_on_event(void* context, SceneManagerEvent
app->first_pager = atoi(app->text_store[2]);
if(app->first_pager > app->max_pager) {
app->first_pager = app->max_pager;
snprintf(app->text_store[2], 20, "%lu", app->first_pager);
snprintf(app->text_store[2], sizeof(app->text_store[2]), "%lu", app->first_pager);
}
app->first_pager_char = app->text_store[2];
scene_manager_previous_scene(app->scene_manager);
Expand Down
2 changes: 1 addition & 1 deletion scenes/meal_pager_scene_set_first_station.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bool meal_pager_scene_set_first_station_on_event(void* context, SceneManagerEven
app->first_station = atoi(app->text_store[0]);
if(app->first_station > app->max_station) {
app->first_station = app->max_station;
snprintf(app->text_store[0], 20, "%lu", app->first_station);
snprintf(app->text_store[0], sizeof(app->text_store[0]), "%lu", app->first_station);
}
app->first_station_char = app->text_store[0];
scene_manager_previous_scene(app->scene_manager);
Expand Down
4 changes: 2 additions & 2 deletions scenes/meal_pager_scene_set_last_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ bool meal_pager_scene_set_last_pager_on_event(void* context, SceneManagerEvent e
app->last_pager = atoi(app->text_store[3]);
if(app->last_pager > app->max_pager) {
app->last_pager = app->max_pager;
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
}
if(app->last_pager < app->first_pager) {
app->last_pager = app->first_pager;
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
}
app->last_pager_char = app->text_store[3];
scene_manager_previous_scene(app->scene_manager);
Expand Down
4 changes: 2 additions & 2 deletions scenes/meal_pager_scene_set_last_station.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ bool meal_pager_scene_set_last_station_on_event(void* context, SceneManagerEvent
app->last_station = atoi(app->text_store[1]);
if(app->last_station > app->max_station) {
app->last_station = app->max_station;
snprintf(app->text_store[1], 20, "%lu", app->last_station);
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
}
if(app->last_station < app->first_station) {
app->last_station = app->first_station;
snprintf(app->text_store[1], 20, "%lu", app->last_station);
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
}
app->last_station_char = app->text_store[1];
scene_manager_previous_scene(app->scene_manager);
Expand Down
15 changes: 12 additions & 3 deletions views/meal_pager_transmit.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ bool meal_pager_transmit_input(InputEvent* event, void* context) {
instance->view,
Meal_PagerTransmitModel * model,
{
UNUSED(model);
instance->callback(Meal_PagerCustomEventTransmitBack, instance->context);
if(model->sending != 0) {
//instance->callback(Meal_PagerCustomEventTransmitBack, instance->context);
}
},
true);
break;
Expand Down Expand Up @@ -171,7 +172,15 @@ void meal_pager_transmit_free(Meal_PagerTransmit* instance) {
furi_assert(instance);

with_view_model(
instance->view, Meal_PagerTransmitModel * model, { UNUSED(model); }, true);
instance->view,
Meal_PagerTransmitModel * model,
{
model->pager_type = 0;
model->station = 0;
model->pager = 0;
model->sending = 0;
},
true);
view_free(instance->view);
free(instance);
}
Expand Down

0 comments on commit 9ab8760

Please sign in to comment.