mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-08 05:39:09 -07:00
Merge branch 'ofw_dev' into dev
This commit is contained in:
@@ -24,6 +24,9 @@ static void gpio_app_tick_event_callback(void* context) {
|
||||
GpioApp* gpio_app_alloc() {
|
||||
GpioApp* app = malloc(sizeof(GpioApp));
|
||||
|
||||
app->expansion = furi_record_open(RECORD_EXPANSION);
|
||||
expansion_disable(app->expansion);
|
||||
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->gpio_items = gpio_items_alloc();
|
||||
|
||||
@@ -70,12 +73,7 @@ GpioApp* gpio_app_alloc() {
|
||||
GpioAppViewUsbUartCfg,
|
||||
variable_item_list_get_view(app->var_item_list));
|
||||
|
||||
if(furi_hal_serial_control_is_busy(FuriHalSerialIdUsart) ||
|
||||
furi_hal_serial_control_is_busy(FuriHalSerialIdLpuart)) {
|
||||
scene_manager_next_scene(app->scene_manager, GpioSceneErrorExpansion);
|
||||
} else {
|
||||
scene_manager_next_scene(app->scene_manager, GpioSceneStart);
|
||||
}
|
||||
scene_manager_next_scene(app->scene_manager, GpioSceneStart);
|
||||
|
||||
return app;
|
||||
}
|
||||
@@ -104,6 +102,9 @@ void gpio_app_free(GpioApp* app) {
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
expansion_enable(app->expansion);
|
||||
furi_record_close(RECORD_EXPANSION);
|
||||
|
||||
gpio_items_free(app->gpio_items);
|
||||
free(app);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,10 @@
|
||||
#include "views/gpio_test.h"
|
||||
#include "views/gpio_usb_uart.h"
|
||||
#include <assets_icons.h>
|
||||
#include <expansion/expansion.h>
|
||||
|
||||
struct GpioApp {
|
||||
Expansion* expansion;
|
||||
Gui* gui;
|
||||
NotificationApp* notifications;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
|
||||
@@ -3,5 +3,4 @@ ADD_SCENE(gpio, test, Test)
|
||||
ADD_SCENE(gpio, usb_uart, UsbUart)
|
||||
ADD_SCENE(gpio, usb_uart_cfg, UsbUartCfg)
|
||||
ADD_SCENE(gpio, usb_uart_close_rpc, UsbUartCloseRpc)
|
||||
ADD_SCENE(gpio, error_expansion, ErrorExpansion)
|
||||
ADD_SCENE(gpio, exit_confirm, ExitConfirm)
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
#include "../gpio_app_i.h"
|
||||
#include "../gpio_custom_event.h"
|
||||
|
||||
void gpio_scene_error_expansion_on_enter(void* context) {
|
||||
GpioApp* app = context;
|
||||
|
||||
widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64);
|
||||
widget_add_string_multiline_element(
|
||||
app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Ext. Module\nis connected!");
|
||||
widget_add_string_multiline_element(
|
||||
app->widget,
|
||||
3,
|
||||
30,
|
||||
AlignLeft,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
"Disconnect External\n"
|
||||
"Module\n"
|
||||
"to use this function.");
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, GpioAppViewUsbUartCloseRpc);
|
||||
}
|
||||
|
||||
bool gpio_scene_error_expansion_on_event(void* context, SceneManagerEvent event) {
|
||||
GpioApp* app = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == GpioCustomEventErrorBack) {
|
||||
if(!scene_manager_previous_scene(app->scene_manager)) {
|
||||
scene_manager_stop(app->scene_manager);
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
}
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void gpio_scene_error_expansion_on_exit(void* context) {
|
||||
GpioApp* app = context;
|
||||
widget_reset(app->widget);
|
||||
}
|
||||
Reference in New Issue
Block a user