mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-06-07 19:01:54 -07:00
Upd+fix cli app (thanks @xMasterX) bydlo kod FTW!
This commit is contained in:
+1
-6
@@ -72,12 +72,7 @@ void latch_tx_handler() {
|
||||
session.is_connected = &session_connected;
|
||||
cli_session_close(global_cli);
|
||||
cli_session_open(global_cli, &session);
|
||||
// Unlock loader-lock
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
Loader_internal* loader_i = (Loader_internal*)loader;
|
||||
loader_i->lock_count = 0;
|
||||
furi_record_close(RECORD_CLI);
|
||||
furi_record_close(RECORD_LOADER);
|
||||
}
|
||||
void unlatch_tx_handler(bool persist) {
|
||||
Cli* global_cli = furi_record_open(RECORD_CLI);
|
||||
@@ -106,4 +101,4 @@ void unlatch_tx_handler(bool persist) {
|
||||
// At this point, all cli_vcp functions should be back.
|
||||
furi_stream_buffer_free(rx_stream);
|
||||
furi_stream_buffer_free(tx_stream);
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -65,7 +65,13 @@ static void input_callback_wrapper(InputEvent* event, void* context) {
|
||||
|
||||
int32_t cligui_main(void* p) {
|
||||
UNUSED(p);
|
||||
loader_unlock(furi_record_open(RECORD_LOADER));
|
||||
|
||||
// Unlock loader-lock and save app thread
|
||||
FuriThread* temp_save_appthr;
|
||||
Loader* loader = furi_record_open(RECORD_LOADER);
|
||||
Loader_internal* loader_i = (Loader_internal*)loader;
|
||||
temp_save_appthr = loader_i->app.thread;
|
||||
loader_unlock(loader);
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
CliguiApp* cligui = malloc(sizeof(CliguiApp));
|
||||
@@ -132,5 +138,12 @@ int32_t cligui_main(void* p) {
|
||||
free(cligui->data);
|
||||
free(cligui);
|
||||
|
||||
// Don't touch system loader!!! We restoring previous app thread here, we love kostily and velosipedy, bydlo kod forever!
|
||||
|
||||
Loader* loader1 = furi_record_open(RECORD_LOADER);
|
||||
Loader_internal* loader_ii = (Loader_internal*)loader1;
|
||||
loader_ii->app.thread = temp_save_appthr;
|
||||
furi_record_close(RECORD_LOADER);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+25
-13
@@ -5,6 +5,10 @@
|
||||
#include <m-bptree.h>
|
||||
#include <m-array.h>
|
||||
#include <cli/cli.h>
|
||||
#include <gui/gui.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/menu.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
|
||||
typedef struct {
|
||||
FuriThreadStdoutWriteCallback write_callback;
|
||||
@@ -68,24 +72,32 @@ typedef struct {
|
||||
} ViewPort_internal;
|
||||
|
||||
typedef struct {
|
||||
FuriThreadId loader_thread;
|
||||
Gui* gui;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
Menu* primary_menu;
|
||||
Submenu* settings_menu;
|
||||
|
||||
const void* application;
|
||||
FuriThread* application_thread;
|
||||
char* application_arguments;
|
||||
void (*closed_callback)(void*);
|
||||
void* closed_callback_context;
|
||||
|
||||
void* cli;
|
||||
void* gui;
|
||||
void (*click_callback)(const char*, void*);
|
||||
void* click_callback_context;
|
||||
|
||||
void* view_dispatcher;
|
||||
void* primary_menu;
|
||||
// void* plugins_menu;
|
||||
// void* debug_menu;
|
||||
void* settings_menu;
|
||||
FuriThread* thread;
|
||||
} LoaderMenu_internal;
|
||||
|
||||
volatile uint8_t lock_count;
|
||||
typedef struct {
|
||||
char* args;
|
||||
char* name;
|
||||
FuriThread* thread;
|
||||
bool insomniac;
|
||||
} LoaderAppData_internal;
|
||||
|
||||
void* pubsub;
|
||||
typedef struct {
|
||||
FuriPubSub* pubsub;
|
||||
FuriMessageQueue* queue;
|
||||
LoaderMenu_internal* loader_menu;
|
||||
LoaderAppData_internal app;
|
||||
} Loader_internal;
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user