Skip to content

Commit 9ab8760

Browse files
author
David Lee
committed
Refactors from xMasterX & WillyJL
1 parent 5dcdf94 commit 9ab8760

10 files changed

+36
-19
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Appart from that, most pagers support 8191 Stations. Triggering ~30 Pagers per s
5252
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.
5353

5454
## Does this even work
55-
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.
55+
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.
5656

5757
Then run the command:
5858
```
@@ -63,4 +63,5 @@ The application will be compiled and copied onto your device.
6363
## Thank you notes
6464
- [Moeker](https://github.com/moeker) and his awesome [pagger tool](https://github.com/meoker/pagger), couldn't have done this without
6565
- [xb8](https://github.com/xb8/t119bruteforcer) for the useful data collected
66-
- [Xenobyte, ShotokanZH](https://twitter.com/xenobyte_/status/1558123251276070912) for their super interesting research
66+
- [Xenobyte, ShotokanZH](https://twitter.com/xenobyte_/status/1558123251276070912) for their super interesting research
67+
- [WillyJL](https://github.com/Willy-JL) and [xMasterX](https://github.com/xMasterX) for code contributions/corrections

application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ App(
77
fap_icon="icons/meal_pager_10px.png",
88
fap_icon_assets="icons",
99
fap_category="Sub-Ghz",
10-
fap_version="1.6",
10+
fap_version="1.7",
1111
fap_author="leedave",
1212
fap_weburl="https://github.com/leedave/flipper-zero-meal-pager",
1313
fap_description="This app triggers restaurant pagers in a brute force manner, useful to test if devices are still functional.",

docs/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.7
2+
- Added code refactors from xMasterX and WillyJL
3+
- Minor update of Readme
4+
15
## v1.6
26
- Fix crashes on exit on fw 0.100.3
37

helpers/meal_pager_storage.c

+9-6
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,23 @@ void meal_pager_read_settings(void* context) {
163163
FURI_LOG_E(TAG, "Cannot open file %s", MEAL_PAGER_SETTINGS_SAVE_PATH);
164164
meal_pager_close_config_file(fff_file);
165165
meal_pager_close_storage();
166+
furi_string_free(temp_str);
166167
return;
167168
}
168169

169170
if(!flipper_format_read_header(fff_file, temp_str, &file_version)) {
170171
FURI_LOG_E(TAG, "Missing Header Data");
171172
meal_pager_close_config_file(fff_file);
172173
meal_pager_close_storage();
174+
furi_string_free(temp_str);
173175
return;
174176
}
175177

176178
if(file_version < MEAL_PAGER_SETTINGS_FILE_VERSION) {
177179
FURI_LOG_I(TAG, "old config version, will be removed.");
178180
meal_pager_close_config_file(fff_file);
179181
meal_pager_close_storage();
182+
furi_string_free(temp_str);
180183
return;
181184
}
182185

@@ -223,26 +226,26 @@ void meal_pager_set_max_values(void* context) {
223226
}
224227
if(app->first_station > app->max_station) {
225228
app->first_station = app->max_station;
226-
snprintf(app->text_store[0], 20, "%lu", app->first_station);
229+
snprintf(app->text_store[0], sizeof(app->text_store[0]), "%lu", app->first_station);
227230
}
228231
if(app->last_station > app->max_station) {
229232
app->last_station = app->max_station;
230-
snprintf(app->text_store[1], 20, "%lu", app->last_station);
233+
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
231234
}
232235
if(app->last_station < app->first_station) {
233236
app->last_station = app->first_station;
234-
snprintf(app->text_store[1], 20, "%lu", app->last_station);
237+
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
235238
}
236239
if(app->first_pager > app->max_pager) {
237240
app->first_pager = app->max_pager;
238-
snprintf(app->text_store[2], 20, "%lu", app->first_pager);
241+
snprintf(app->text_store[2], sizeof(app->text_store[2]), "%lu", app->first_pager);
239242
}
240243
if(app->last_pager > app->max_pager) {
241244
app->last_pager = app->max_pager;
242-
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
245+
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
243246
}
244247
if(app->last_pager < app->first_pager) {
245248
app->last_pager = app->first_pager;
246-
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
249+
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
247250
}
248251
}

meal_pager_i.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#define SUBGHZ_APP_EXTENSION ".sub"
2727
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
28-
#define MEAL_PAGER_VERSION "1.6"
28+
#define MEAL_PAGER_VERSION "1.7"
2929

3030
typedef struct Meal_PagerTransmit Meal_PagerTransmit;
3131
typedef struct SubGhz SubGhz;

scenes/meal_pager_scene_set_first_pager.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool meal_pager_scene_set_first_pager_on_event(void* context, SceneManagerEvent
4343
app->first_pager = atoi(app->text_store[2]);
4444
if(app->first_pager > app->max_pager) {
4545
app->first_pager = app->max_pager;
46-
snprintf(app->text_store[2], 20, "%lu", app->first_pager);
46+
snprintf(app->text_store[2], sizeof(app->text_store[2]), "%lu", app->first_pager);
4747
}
4848
app->first_pager_char = app->text_store[2];
4949
scene_manager_previous_scene(app->scene_manager);

scenes/meal_pager_scene_set_first_station.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool meal_pager_scene_set_first_station_on_event(void* context, SceneManagerEven
4343
app->first_station = atoi(app->text_store[0]);
4444
if(app->first_station > app->max_station) {
4545
app->first_station = app->max_station;
46-
snprintf(app->text_store[0], 20, "%lu", app->first_station);
46+
snprintf(app->text_store[0], sizeof(app->text_store[0]), "%lu", app->first_station);
4747
}
4848
app->first_station_char = app->text_store[0];
4949
scene_manager_previous_scene(app->scene_manager);

scenes/meal_pager_scene_set_last_pager.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ bool meal_pager_scene_set_last_pager_on_event(void* context, SceneManagerEvent e
4343
app->last_pager = atoi(app->text_store[3]);
4444
if(app->last_pager > app->max_pager) {
4545
app->last_pager = app->max_pager;
46-
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
46+
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
4747
}
4848
if(app->last_pager < app->first_pager) {
4949
app->last_pager = app->first_pager;
50-
snprintf(app->text_store[3], 20, "%lu", app->last_pager);
50+
snprintf(app->text_store[3], sizeof(app->text_store[3]), "%lu", app->last_pager);
5151
}
5252
app->last_pager_char = app->text_store[3];
5353
scene_manager_previous_scene(app->scene_manager);

scenes/meal_pager_scene_set_last_station.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ bool meal_pager_scene_set_last_station_on_event(void* context, SceneManagerEvent
4343
app->last_station = atoi(app->text_store[1]);
4444
if(app->last_station > app->max_station) {
4545
app->last_station = app->max_station;
46-
snprintf(app->text_store[1], 20, "%lu", app->last_station);
46+
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
4747
}
4848
if(app->last_station < app->first_station) {
4949
app->last_station = app->first_station;
50-
snprintf(app->text_store[1], 20, "%lu", app->last_station);
50+
snprintf(app->text_store[1], sizeof(app->text_store[1]), "%lu", app->last_station);
5151
}
5252
app->last_station_char = app->text_store[1];
5353
scene_manager_previous_scene(app->scene_manager);

views/meal_pager_transmit.c

+12-3
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ bool meal_pager_transmit_input(InputEvent* event, void* context) {
109109
instance->view,
110110
Meal_PagerTransmitModel * model,
111111
{
112-
UNUSED(model);
113-
instance->callback(Meal_PagerCustomEventTransmitBack, instance->context);
112+
if(model->sending != 0) {
113+
//instance->callback(Meal_PagerCustomEventTransmitBack, instance->context);
114+
}
114115
},
115116
true);
116117
break;
@@ -171,7 +172,15 @@ void meal_pager_transmit_free(Meal_PagerTransmit* instance) {
171172
furi_assert(instance);
172173

173174
with_view_model(
174-
instance->view, Meal_PagerTransmitModel * model, { UNUSED(model); }, true);
175+
instance->view,
176+
Meal_PagerTransmitModel * model,
177+
{
178+
model->pager_type = 0;
179+
model->station = 0;
180+
model->pager = 0;
181+
model->sending = 0;
182+
},
183+
true);
175184
view_free(instance->view);
176185
free(instance);
177186
}

0 commit comments

Comments
 (0)