forked from RocketGod-git/ProtoPirate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprotopirate_app.c
More file actions
657 lines (549 loc) · 22.4 KB
/
Copy pathprotopirate_app.c
File metadata and controls
657 lines (549 loc) · 22.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
// protopirate_app.c
#include "protopirate_app_i.h"
#include <furi.h>
#include <furi_hal.h>
#include "protocols/protocol_items.h"
#include "helpers/protopirate_settings.h"
#include "helpers/protopirate_storage.h"
#include "protocols/keys.h"
#include <string.h>
#define TAG "ProtoPirateApp"
#define LOG_HEAP(msg) FURI_LOG_I(TAG, "%s - Free heap: %zu", msg, memmgr_get_free_heap())
static bool protopirate_app_custom_event_callback(void* context, uint32_t event) {
furi_check(context);
ProtoPirateApp* app = context;
return scene_manager_handle_custom_event(app->scene_manager, event);
}
static bool protopirate_app_back_event_callback(void* context) {
furi_check(context);
ProtoPirateApp* app = context;
return scene_manager_handle_back_event(app->scene_manager);
}
static void protopirate_app_tick_event_callback(void* context) {
furi_check(context);
ProtoPirateApp* app = context;
scene_manager_handle_tick_event(app->scene_manager);
}
ProtoPirateApp* protopirate_app_alloc() {
LOG_HEAP("Pre alloc");
protopirate_storage_purge_temp_history_at_startup();
ProtoPirateApp* app = malloc(sizeof(ProtoPirateApp));
if(!app) {
FURI_LOG_E(TAG, "Failed to allocate ProtoPirateApp app !");
return NULL;
}
LOG_HEAP("Start alloc");
FURI_LOG_I(TAG, "Allocating ProtoPirate Decoder App");
// GUI
app->gui = furi_record_open(RECORD_GUI);
LOG_HEAP("After GUI");
// View Dispatcher
app->view_dispatcher = view_dispatcher_alloc();
#if defined(FW_ORIGIN_RM)
view_dispatcher_enable_queue(app->view_dispatcher);
#endif
app->scene_manager = scene_manager_alloc(&protopirate_scene_handlers, app);
view_dispatcher_set_event_callback_context(app->view_dispatcher, app);
view_dispatcher_set_custom_event_callback(
app->view_dispatcher, protopirate_app_custom_event_callback);
view_dispatcher_set_navigation_event_callback(
app->view_dispatcher, protopirate_app_back_event_callback);
view_dispatcher_set_tick_event_callback(
app->view_dispatcher, protopirate_app_tick_event_callback, 100);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
LOG_HEAP("After ViewDispatcher");
// Open Notification record
app->notifications = furi_record_open(RECORD_NOTIFICATION);
// Open Dialogs record
//app->dialogs = furi_record_open(RECORD_DIALOGS);
//Initialise Car Model varables
#ifdef BUILD_RECEIVER_APP
app->car_models_count = 65536;
app->selected_model = NULL;
app->model_menu = NULL;
app->freq_menu = NULL;
app->hop_menu = NULL;
app->preset_menu = NULL;
#endif
// Text Input
app->text_input = text_input_alloc();
view_dispatcher_add_view(
app->view_dispatcher, ProtoPirateViewTextInput, text_input_get_view(app->text_input));
app->save_from_saved_info = false;
memset(app->save_filename, 0, sizeof(app->save_filename));
// Variable Item List
//app->variable_item_list = variable_item_list_alloc();
// view_dispatcher_add_view(
// app->view_dispatcher,
// ProtoPirateViewVariableItemList,
// variable_item_list_get_view(app->variable_item_list));
// SubMenu
app->submenu = submenu_alloc();
view_dispatcher_add_view(
app->view_dispatcher, ProtoPirateViewSubmenu, submenu_get_view(app->submenu));
// Widget
app->widget = widget_alloc();
view_dispatcher_add_view(
app->view_dispatcher, ProtoPirateViewWidget, widget_get_view(app->widget));
// File Browser path
app->file_path = furi_string_alloc();
furi_string_set(app->file_path, "/ext/apps_data/proto_pirate/");
// About View
//app->view_about = view_alloc();
//view_dispatcher_add_view(app->view_dispatcher, ProtoPirateViewAbout, app->view_about);
LOG_HEAP("After basic views");
// Load saved settings
ProtoPirateSettings settings;
protopirate_settings_load(&settings);
// Apply auto-save setting
app->option_flags = settings.option_flags;
app->tx_power = settings.tx_power;
// Receiver Views
app->protopirate_receiver =
protopirate_view_receiver_alloc(((app->option_flags & FLAG_AUTO_SAVE) == FLAG_AUTO_SAVE));
view_dispatcher_add_view(
app->view_dispatcher,
ProtoPirateViewReceiver,
protopirate_view_receiver_get_view(app->protopirate_receiver));
app->protopirate_receiver_info = protopirate_view_receiver_info_alloc();
view_dispatcher_add_view(
app->view_dispatcher,
ProtoPirateViewReceiverInfo,
protopirate_view_receiver_info_get_view(app->protopirate_receiver_info));
LOG_HEAP("After receiver views");
// Init setting - KEEP THIS, it's small
app->setting = subghz_setting_alloc();
app->loaded_file_path = NULL;
app->start_tx_time = 0;
app->psa_bf_state = NULL;
app->psa_bf_thread = NULL;
subghz_setting_load(app->setting, EXT_PATH("subghz/assets/setting_user"));
LOG_HEAP("After subghz_setting");
// Apply loaded frequency and preset, with validation
uint32_t frequency = settings.frequency;
uint8_t preset_index = settings.preset_index;
// Validate frequency
bool frequency_valid = false;
for(size_t i = 0; i < subghz_setting_get_frequency_count(app->setting); i++) {
if(subghz_setting_get_frequency(app->setting, i) == frequency) {
frequency_valid = true;
break;
}
}
if(!frequency_valid) {
frequency = subghz_setting_get_default_frequency(app->setting);
FURI_LOG_W(TAG, "Saved frequency invalid, using default: %lu", frequency);
}
// Validate preset index
if(preset_index >= subghz_setting_get_preset_count(app->setting)) {
preset_index = 0;
FURI_LOG_W(TAG, "Saved preset index invalid, using default");
}
// Initialize TxRx structure with minimal setup
app->lock = ProtoPirateLockOff;
app->txrx = malloc(sizeof(ProtoPirateTxRx));
memset(app->txrx, 0, sizeof(ProtoPirateTxRx));
app->txrx->preset = malloc(sizeof(SubGhzRadioPreset));
app->txrx->preset->name = furi_string_alloc();
app->txrx->txrx_state = ProtoPirateTxRxStateIDLE;
app->txrx->rx_key_state = ProtoPirateRxKeyStateIDLE;
// Get preset name and data
const char* preset_name = subghz_setting_get_preset_name(app->setting, preset_index);
uint8_t* preset_data = subghz_setting_get_preset_data(app->setting, preset_index);
size_t preset_data_size = subghz_setting_get_preset_data_size(app->setting, preset_index);
FURI_LOG_I(
TAG,
"Settings: freq=%lu, preset=%s, auto_save=%d, hopping=%d",
frequency,
preset_name,
((settings.option_flags & FLAG_AUTO_SAVE) == FLAG_AUTO_SAVE),
settings.hopping_enabled);
#ifdef BUILD_RECEIVER_APP
//Grab selected car model.
if(settings.car_model_index) {
protopirate_model_get_by_index(app, &app->selected_model, settings.car_model_index);
app->selected_model->last_preset_index = settings.preset_index;
protopirate_preset_init(
app,
furi_string_get_cstr(app->selected_model->preset->name),
app->selected_model->preset->frequency,
app->selected_model->preset->data,
app->selected_model->preset->data_size);
} else {
protopirate_preset_init(app, preset_name, frequency, preset_data, preset_data_size);
}
#else
protopirate_preset_init(app, preset_name, frequency, preset_data, preset_data_size);
#endif
// Apply hopping state from settings
app->txrx->hopper_state = settings.hopping_enabled ? ProtoPirateHopperStateRunning :
ProtoPirateHopperStateOFF;
app->txrx->hopper_idx_frequency = 0;
app->txrx->hopper_timeout = 0;
app->txrx->idx_menu_chosen = 0;
LOG_HEAP("After txrx basic setup");
// Mark as not initialized
app->radio_initialized = false;
if(!protopirate_radio_init(app)) {
FURI_LOG_E(TAG, "Failed to initialize radio!");
notification_message(app->notifications, &sequence_error);
protopirate_app_free(app);
return NULL;
}
FURI_LOG_D(TAG, "Initial state: radio_initialized=%d", app->radio_initialized);
LOG_HEAP("App alloc complete (radio deferred)");
return app;
}
// Initialize radio subsystem - call from receiver scene
bool protopirate_radio_init(ProtoPirateApp* app) {
FURI_LOG_I(TAG, "=== protopirate_radio_init called ===");
FURI_LOG_D(TAG, "State: radio_initialized=%d", app->radio_initialized);
if(app->radio_initialized) {
FURI_LOG_D(TAG, "Radio already initialized, returning true");
return true;
}
// Fresh radio init - nothing was initialized before
FURI_LOG_I(TAG, "Fresh radio init - allocating all components");
LOG_HEAP("Radio init start");
// Create environment with our custom protocols
app->txrx->environment = subghz_environment_alloc();
if(!app->txrx->environment) {
FURI_LOG_E(TAG, "Failed to allocate environment!");
return false;
}
LOG_HEAP("After environment alloc");
FURI_LOG_I(TAG, "Registering %zu ProtoPirate protocols", protopirate_protocol_registry.size);
subghz_environment_set_protocol_registry(
app->txrx->environment, (void*)&protopirate_protocol_registry);
// Load keystores
subghz_environment_load_keystore(app->txrx->environment, PROTOPIRATE_KEYSTORE_DIR_NAME);
LOG_HEAP("After keystore load");
// Load ProtoPirate specific keys
protopirate_keys_load(app->txrx->environment);
FURI_LOG_I(TAG, "Loaded ProtoPirate secure keys");
LOG_HEAP("After keys load");
// Create receiver
app->txrx->receiver = subghz_receiver_alloc_init(app->txrx->environment);
if(!app->txrx->receiver) {
FURI_LOG_E(TAG, "Failed to allocate receiver!");
subghz_environment_free(app->txrx->environment);
app->txrx->environment = NULL;
return false;
}
LOG_HEAP("After receiver alloc");
// Initialize SubGhz devices
subghz_devices_init();
FURI_LOG_D(TAG, "SubGhz devices initialized");
// Try external CC1101 first
app->txrx->radio_device = radio_device_loader_set(NULL, SubGhzRadioDeviceTypeExternalCC1101);
// if not loading, fallback to internal
if(!app->txrx->radio_device) {
FURI_LOG_W(TAG, "External CC1101 not found, trying internal radio");
app->txrx->radio_device = radio_device_loader_set(NULL, SubGhzRadioDeviceTypeInternal);
}
if(!app->txrx->radio_device) {
FURI_LOG_E(TAG, "Failed to initialize any radio device!");
subghz_receiver_free(app->txrx->receiver);
app->txrx->receiver = NULL;
subghz_environment_free(app->txrx->environment);
app->txrx->environment = NULL;
subghz_devices_deinit();
return false;
}
#ifndef REMOVE_LOGS
const char* device_name = subghz_devices_get_name(app->txrx->radio_device);
bool is_external = device_name && strstr(device_name, "ext");
FURI_LOG_I(
TAG,
"Radio device initialized: %s (%s)",
device_name ? device_name : "unknown",
is_external ? "external" : "internal");
#endif
subghz_devices_reset(app->txrx->radio_device);
subghz_devices_idle(app->txrx->radio_device);
// Set filter to accept decodable protocols
subghz_receiver_set_filter(app->txrx->receiver, SubGhzProtocolFlag_Decodable);
app->radio_initialized = true;
FURI_LOG_D(TAG, "Final state: radio_initialized=%d", app->radio_initialized);
LOG_HEAP("Radio init complete");
return true;
}
// Deinitialize radio subsystem
void protopirate_radio_deinit(ProtoPirateApp* app) {
FURI_LOG_I(TAG, "=== protopirate_radio_deinit called ===");
FURI_LOG_D(TAG, "State: radio_initialized=%d", app->radio_initialized);
FURI_LOG_D(
TAG,
"Pointers: worker=%p, environment=%p, receiver=%p, history=%p, radio_device=%p",
app->txrx->worker,
app->txrx->environment,
app->txrx->receiver,
app->txrx->history,
app->txrx->radio_device);
if(!app->radio_initialized) {
FURI_LOG_D(TAG, "Radio was not initialized, returning");
return;
}
LOG_HEAP("Radio deinit start");
// Make sure we're not receiving
if(app->txrx->worker && app->txrx->txrx_state == ProtoPirateTxRxStateRx) {
FURI_LOG_D(TAG, "Stopping active RX, state=%d", app->txrx->txrx_state);
subghz_worker_stop(app->txrx->worker);
if(app->txrx->radio_device) {
subghz_devices_stop_async_rx(app->txrx->radio_device);
}
}
if(app->txrx->radio_device) {
FURI_LOG_D(TAG, "Putting radio device to sleep and ending: %p", app->txrx->radio_device);
subghz_devices_sleep(app->txrx->radio_device);
radio_device_loader_end(app->txrx->radio_device);
app->txrx->radio_device = NULL;
} else {
FURI_LOG_D(TAG, "Radio device was NULL, skipping sleep/end");
}
FURI_LOG_D(TAG, "Calling subghz_devices_deinit");
subghz_devices_deinit();
if(app->txrx->receiver) {
FURI_LOG_D(TAG, "Freeing receiver %p", app->txrx->receiver);
subghz_receiver_free(app->txrx->receiver);
app->txrx->receiver = NULL;
} else {
FURI_LOG_D(TAG, "Receiver was NULL, skipping free");
}
if(app->txrx->environment) {
FURI_LOG_D(TAG, "Freeing environment %p", app->txrx->environment);
subghz_environment_free(app->txrx->environment);
app->txrx->environment = NULL;
} else {
FURI_LOG_D(TAG, "Environment was NULL, skipping free");
}
if(app->txrx->history) {
FURI_LOG_D(TAG, "Freeing history %p", app->txrx->history);
protopirate_history_free(app->txrx->history);
app->txrx->history = NULL;
} else {
FURI_LOG_D(TAG, "History was NULL, skipping free");
}
if(app->txrx->worker) {
FURI_LOG_D(TAG, "Freeing worker %p", app->txrx->worker);
subghz_worker_free(app->txrx->worker);
app->txrx->worker = NULL;
} else {
FURI_LOG_D(TAG, "Worker was NULL, skipping free");
}
app->radio_initialized = false;
FURI_LOG_D(TAG, "Final state: radio_initialized=%d", app->radio_initialized);
LOG_HEAP("Radio deinit complete");
}
#ifdef BUILD_RECEIVER_APP
void protopirate_car_model_free(ProtoPirateCarModel** selected_model) {
if(selected_model && *selected_model) {
ProtoPirateCarModel* model = *selected_model;
FURI_LOG_D(TAG, "Freeing selected_model");
if(model->name) {
furi_string_free(model->name);
model->name = NULL;
}
if(model->preset) {
if(model->preset->data) {
free(model->preset->data);
model->preset->data = NULL;
}
if(model->preset->name) {
furi_string_free(model->preset->name);
model->preset->name = NULL;
}
free(model->preset);
model->preset = NULL;
}
free(model);
*selected_model = NULL;
}
}
#endif
void protopirate_app_free(ProtoPirateApp* app) {
furi_check(app);
FURI_LOG_I(TAG, "=== protopirate_app_free called ===");
FURI_LOG_D(TAG, "State: radio_initialized=%d", app->radio_initialized);
// Save settings before exiting
ProtoPirateSettings settings;
settings.frequency = app->txrx->preset->frequency;
settings.option_flags = app->option_flags;
settings.tx_power = app->tx_power;
settings.hopping_enabled = (app->txrx->hopper_state != ProtoPirateHopperStateOFF);
#ifdef BUILD_RECEIVER_APP
settings.car_model_index = (app->selected_model) ? app->selected_model->index : 0;
// Find current preset index
if(app->selected_model && app->selected_model->last_preset_index) {
settings.preset_index = app->selected_model->last_preset_index;
} else
#endif
{
settings.preset_index = 0;
const char* current_preset = furi_string_get_cstr(app->txrx->preset->name);
for(uint8_t i = 0; i < subghz_setting_get_preset_count(app->setting); i++) {
if(strcmp(subghz_setting_get_preset_name(app->setting, i), current_preset) == 0) {
settings.preset_index = i;
break;
}
}
}
FURI_LOG_I(
TAG,
"Saving settings: freq=%lu, preset=%u, auto_save=%d, hopping=%d",
settings.frequency,
settings.preset_index,
((settings.option_flags & FLAG_AUTO_SAVE) == FLAG_AUTO_SAVE),
settings.hopping_enabled);
//Free the selected model, we wont save that.
#ifdef BUILD_RECEIVER_APP
protopirate_car_model_free(&app->selected_model);
#endif
//Save app settings
protopirate_settings_save(&settings);
// Deinitialize whichever is active - NULL checks inside handle all cases
FURI_LOG_D(TAG, "Calling radio_deinit");
protopirate_radio_deinit(app);
if(app->loaded_file_path) {
FURI_LOG_D(TAG, "Freeing loaded_file_path");
furi_string_free(app->loaded_file_path);
app->loaded_file_path = NULL;
}
// Submenu
FURI_LOG_D(TAG, "Removing submenu view");
view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewSubmenu);
submenu_free(app->submenu);
// Variable Item List
//FURI_LOG_D(TAG, "Removing variable_item_list view");
//view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewVariableItemList);
//variable_item_list_free(app->variable_item_list);
// About View
//if(app->view_about) {
// FURI_LOG_D(TAG, "Removing about view");
// view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewAbout);
// view_free(app->view_about);
//}
// File path
if(app->file_path) {
FURI_LOG_D(TAG, "Freeing file_path");
furi_string_free(app->file_path);
}
// Widget
FURI_LOG_D(TAG, "Removing widget view");
view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewWidget);
widget_free(app->widget);
// Text Input
FURI_LOG_D(TAG, "Removing text_input view");
view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewTextInput);
text_input_free(app->text_input);
// Receiver
FURI_LOG_D(TAG, "Removing receiver view");
view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewReceiver);
protopirate_view_receiver_free(app->protopirate_receiver);
if(app->psa_bf_thread) {
if(app->psa_bf_state) app->psa_bf_state->cancel = 1;
furi_thread_join(app->psa_bf_thread);
furi_thread_free(app->psa_bf_thread);
app->psa_bf_thread = NULL;
}
if(app->psa_bf_state) {
free(app->psa_bf_state);
app->psa_bf_state = NULL;
}
// Receiver Info
FURI_LOG_D(TAG, "Removing receiver_info view");
view_dispatcher_remove_view(app->view_dispatcher, ProtoPirateViewReceiverInfo);
protopirate_view_receiver_info_free(app->protopirate_receiver_info);
// Setting
FURI_LOG_D(TAG, "Freeing subghz_setting");
subghz_setting_free(app->setting);
// Free preset
FURI_LOG_D(TAG, "Freeing preset");
furi_string_free(app->txrx->preset->name);
free(app->txrx->preset);
free(app->txrx);
// View dispatcher
FURI_LOG_D(TAG, "Freeing view_dispatcher and scene_manager");
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
// Close Dialogs
//FURI_LOG_D(TAG, "Closing dialogs record");
//furi_record_close(RECORD_DIALOGS);
//app->dialogs = NULL;
// Notifications
FURI_LOG_D(TAG, "Closing notifications record");
furi_record_close(RECORD_NOTIFICATION);
app->notifications = NULL;
// Close records
FURI_LOG_D(TAG, "Closing GUI record");
furi_record_close(RECORD_GUI);
FURI_LOG_I(TAG, "App free complete");
free(app);
}
int32_t protopirate_app(char* p) {
//Allocate the APP now.
ProtoPirateApp* protopirate_app = protopirate_app_alloc();
if(!protopirate_app) {
// logging is already done in protopirate_app_alloc()
//furi_hal_power_suppress_charge_exit();
return -1;
}
uint8_t using_external_features = 0;
#if defined(ENABLE_SUB_DECODE_SCENE) || defined(ENABLE_TIMING_TUNER_SCENE)
if(p && strlen(p)) {
if(strstr(p, "SubDecode")) {
//Allocate the About View.
protopirate_app->view_about = view_alloc();
view_dispatcher_add_view(
protopirate_app->view_dispatcher,
ProtoPirateViewAbout,
protopirate_app->view_about);
scene_manager_next_scene(protopirate_app->scene_manager, ProtoPirateSceneSubDecode);
using_external_features = 1;
} else if(strstr(p, "TimingTuner")) {
//Allocate the About View.
protopirate_app->view_about = view_alloc();
view_dispatcher_add_view(
protopirate_app->view_dispatcher,
ProtoPirateViewAbout,
protopirate_app->view_about);
scene_manager_next_scene(protopirate_app->scene_manager, ProtoPirateSceneTimingTuner);
using_external_features = 1;
}
}
#endif
if(!using_external_features) {
#if defined(ENABLE_SAVED_SCENE)
// Handle Command line PSF that may have been passed to us
bool load_saved = (p && strlen(p));
if(load_saved) protopirate_app->loaded_file_path = furi_string_alloc_set(p);
scene_manager_next_scene(
protopirate_app->scene_manager,
(load_saved) ? ProtoPirateSceneSavedInfo : ProtoPirateSceneStart);
#else
UNUSED(p);
scene_manager_next_scene(protopirate_app->scene_manager, ProtoPirateSceneStart);
#endif
//We now jump straight to emulate scene from Browser. If the user wanted the key to look at, just click back.
//Makes it faster in my use case
#ifdef ENABLE_SAVED_SCENE
if(load_saved) {
view_dispatcher_send_custom_event(
protopirate_app->view_dispatcher, ProtoPirateCustomEventSavedInfoEmulate);
notification_message(protopirate_app->notifications, &sequence_success);
}
#else
//We now jump straight to emulate scene from Browser. If the user wanted the key to look at, just click back.
//Makes it faster in my use case
#ifdef ENABLE_SAVED_SCENE
if(load_saved) {
view_dispatcher_send_custom_event(
protopirate_app->view_dispatcher, ProtoPirateCustomEventReceiverInfoSave);
}
#endif
#endif
}
view_dispatcher_run(protopirate_app->view_dispatcher);
protopirate_app_free(protopirate_app);
return 0;
}