Merge branch 'fz-dev' into dev

This commit is contained in:
MX 2023-02-27 21:34:30 +03:00
commit 04250632d7
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
9 changed files with 32 additions and 15 deletions

View File

@ -142,10 +142,6 @@ void bad_usb_app_free(BadUsbApp* app) {
app->bad_usb_script = NULL; app->bad_usb_script = NULL;
} }
if(app->usb_if_prev) {
furi_check(furi_hal_usb_set_config(app->usb_if_prev, NULL));
}
// Views // Views
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork); view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork);
bad_usb_free(app->bad_usb_view); bad_usb_free(app->bad_usb_view);
@ -172,6 +168,10 @@ void bad_usb_app_free(BadUsbApp* app) {
furi_string_free(app->file_path); furi_string_free(app->file_path);
furi_string_free(app->keyboard_layout); furi_string_free(app->keyboard_layout);
if(app->usb_if_prev) {
furi_check(furi_hal_usb_set_config(app->usb_if_prev, NULL));
}
free(app); free(app);
} }

View File

@ -16,7 +16,9 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == InputKeyLeft) { if(event.event == InputKeyLeft) {
if(bad_usb_is_idle_state(app->bad_usb_view)) {
scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig); scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig);
}
consumed = true; consumed = true;
} else if(event.event == InputKeyOk) { } else if(event.event == InputKeyOk) {
bad_usb_script_toggle(app->bad_usb_script); bad_usb_script_toggle(app->bad_usb_script);

View File

@ -48,17 +48,13 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
if((model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone) || if((model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone) ||
(model->state.state == BadUsbStateNotConnected)) { (model->state.state == BadUsbStateNotConnected)) {
elements_button_center(canvas, "Run"); elements_button_center(canvas, "Run");
elements_button_left(canvas, "Config");
} else if((model->state.state == BadUsbStateRunning) || (model->state.state == BadUsbStateDelay)) { } else if((model->state.state == BadUsbStateRunning) || (model->state.state == BadUsbStateDelay)) {
elements_button_center(canvas, "Stop"); elements_button_center(canvas, "Stop");
} else if(model->state.state == BadUsbStateWillRun) { } else if(model->state.state == BadUsbStateWillRun) {
elements_button_center(canvas, "Cancel"); elements_button_center(canvas, "Cancel");
} }
if((model->state.state == BadUsbStateNotConnected) ||
(model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone)) {
elements_button_left(canvas, "Config");
}
if(model->state.state == BadUsbStateNotConnected) { if(model->state.state == BadUsbStateNotConnected) {
canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18);
canvas_set_font(canvas, FontPrimary); canvas_set_font(canvas, FontPrimary);
@ -203,6 +199,7 @@ void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) {
{ strlcpy(model->layout, layout, MAX_NAME_LEN); }, { strlcpy(model->layout, layout, MAX_NAME_LEN); },
true); true);
} }
void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) { void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) {
furi_assert(st); furi_assert(st);
with_view_model( with_view_model(
@ -214,3 +211,19 @@ void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) {
}, },
true); true);
} }
bool bad_usb_is_idle_state(BadUsb* bad_usb) {
bool is_idle = false;
with_view_model(
bad_usb->view,
BadUsbModel * model,
{
if((model->state.state == BadUsbStateIdle) ||
(model->state.state == BadUsbStateDone) ||
(model->state.state == BadUsbStateNotConnected)) {
is_idle = true;
}
},
false);
return is_idle;
}

View File

@ -19,3 +19,5 @@ void bad_usb_set_file_name(BadUsb* bad_usb, const char* name);
void bad_usb_set_layout(BadUsb* bad_usb, const char* layout); void bad_usb_set_layout(BadUsb* bad_usb, const char* layout);
void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st); void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st);
bool bad_usb_is_idle_state(BadUsb* bad_usb);

View File

@ -10,7 +10,7 @@ App(
stack_size=4 * 1024, stack_size=4 * 1024,
order=20, order=20,
fap_icon="dap_link.png", fap_icon="dap_link.png",
fap_category="Tools", fap_category="GPIO",
fap_private_libs=[ fap_private_libs=[
Lib( Lib(
name="free-dap", name="free-dap",

View File

@ -11,7 +11,7 @@ App(
stack_size=4 * 1024, stack_size=4 * 1024,
order=30, order=30,
fap_icon="../../../assets/icons/Archive/Nfc_10px.png", fap_icon="../../../assets/icons/Archive/Nfc_10px.png",
fap_category="Tools", fap_category="NFC",
fap_private_libs=[ fap_private_libs=[
Lib( Lib(
name="magic", name="magic",

View File

@ -8,6 +8,6 @@ App(
stack_size=1 * 1024, stack_size=1 * 1024,
order=50, order=50,
fap_icon="signal_gen_10px.png", fap_icon="signal_gen_10px.png",
fap_category="Tools", fap_category="GPIO",
fap_icon_assets="icons", fap_icon_assets="icons",
) )

View File

@ -7,7 +7,7 @@ App(
stack_size=1 * 2048, stack_size=1 * 2048,
order=30, order=30,
fap_icon="images/Dip8_10px.png", fap_icon="images/Dip8_10px.png",
fap_category="Tools", fap_category="GPIO",
fap_icon_assets="images", fap_icon_assets="images",
fap_private_libs=[ fap_private_libs=[
Lib( Lib(

View File

@ -9,6 +9,6 @@ App(
stack_size=4 * 1024, stack_size=4 * 1024,
order=50, order=50,
fap_icon="weather_station_10px.png", fap_icon="weather_station_10px.png",
fap_category="Tools", fap_category="Sub-GHz",
fap_icon_assets="images", fap_icon_assets="images",
) )