Update apps

This commit is contained in:
Willy-JL
2023-08-30 18:59:32 +02:00
parent 160ab755a2
commit ee37769ee2
308 changed files with 2314 additions and 801 deletions

View File

@@ -10,12 +10,11 @@ App(
"dialogs",
],
stack_size=6 * 1024,
order=64, # keep it at the bottom of the list while still WIP
fap_icon="icons/mag_10px.png",
fap_category="GPIO",
fap_icon_assets="icons",
fap_version=(0, 5), # major, minor
fap_description="WIP MagSpoof port using the RFID subsystem",
fap_author="Zachary Weiss",
fap_weburl="https://github.com/hummusec/magspoof_flipper", # Original by zacharyweiss
fap_weburl="https://github.com/zacharyweiss/magspoof_flipper",
)

View File

@@ -153,7 +153,6 @@ void tx_deinit_rfid() {
furi_hal_gpio_write(RFID_PIN_OUT, 0);
furi_hal_rfid_pins_reset();
furi_hal_power_disable_otg();
}
void tx_init_rf(int hz) {
@@ -187,7 +186,6 @@ bool tx_init(MagSetting* setting) {
tx_init_rfid();
break;
case MagTxStateGPIO:
furi_hal_power_enable_otg();
// gpio_item_configure_all_pins(GpioModeOutputPushPull);
furi_hal_gpio_init(GPIO_PIN_A, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
furi_hal_gpio_init(GPIO_PIN_B, GpioModeOutputPushPull, GpioPullNo, GpioSpeedLow);
@@ -238,7 +236,6 @@ bool tx_deinit(MagSetting* setting) {
furi_hal_gpio_init(GPIO_PIN_ENABLE, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
//gpio_item_configure_all_pins(GpioModeAnalog);
furi_hal_power_disable_otg();
break;
case MagTxStatePiezo:
tx_deinit_piezo();

View File

@@ -168,16 +168,39 @@ int32_t mag_app(void* p) {
Mag* mag = mag_alloc();
UNUSED(p);
mag_make_app_folder(mag);
// Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
uint8_t attempts = 0;
bool otg_was_enabled = furi_hal_power_is_otg_enabled();
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
view_dispatcher_attach_to_gui(mag->view_dispatcher, mag->gui, ViewDispatcherTypeFullscreen);
scene_manager_next_scene(mag->scene_manager, MagSceneStart);
view_dispatcher_run(mag->view_dispatcher);
// Disable 5v power
if(furi_hal_power_is_otg_enabled() && !otg_was_enabled) {
furi_hal_power_disable_otg();
}
mag_free(mag);
return 0;
}
void mag_make_app_folder(Mag* mag) {
furi_assert(mag);
if(!storage_simply_mkdir(mag->storage, MAG_APP_FOLDER)) {
dialog_message_show_storage_error(mag->dialogs, "Cannot create\napp folder");
}
}
void mag_text_store_set(Mag* mag, const char* text, ...) {
furi_assert(mag);
va_list args;

View File

@@ -76,6 +76,8 @@ static bool mag_device_save_file(
// Make path to file to be saved
furi_string_cat_printf(temp_str, "/%s%s", dev_name, extension);
} else {
// Create mag directory if necessary
if(!storage_simply_mkdir((mag_dev->storage), MAG_APP_FOLDER)) break;
// First remove mag device file if it was saved
furi_string_printf(temp_str, "%s/%s%s", folder, dev_name, extension);
}

View File

@@ -92,6 +92,8 @@ void mag_text_store_clear(Mag* mag);
void mag_show_loading_popup(void* context, bool show);
void mag_make_app_folder(Mag* mag);
void mag_popup_timeout_callback(void* context);
void mag_widget_callback(GuiButtonType result, InputType type, void* context);