mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 04:28:36 -07:00
Merge branch 'dev' of https://github.com/Flipper-XFW/Xtreme-Firmware into dev
This commit is contained in:
@@ -27,6 +27,7 @@ Evil_PortalApp* evil_portal_app_alloc() {
|
|||||||
|
|
||||||
app->sent_reset = false;
|
app->sent_reset = false;
|
||||||
app->portal_logs = furi_string_alloc();
|
app->portal_logs = furi_string_alloc();
|
||||||
|
app->portal_logs_mutex = furi_mutex_alloc(FuriMutexTypeRecursive);
|
||||||
|
|
||||||
app->capture_line = false;
|
app->capture_line = false;
|
||||||
app->captured_line = furi_string_alloc();
|
app->captured_line = furi_string_alloc();
|
||||||
@@ -81,14 +82,6 @@ Evil_PortalApp* evil_portal_app_alloc() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void evil_portal_app_free(Evil_PortalApp* app) {
|
void evil_portal_app_free(Evil_PortalApp* app) {
|
||||||
// save latest logs
|
|
||||||
if(furi_string_utf8_length(app->portal_logs) > 0) {
|
|
||||||
write_logs(app->portal_logs);
|
|
||||||
furi_string_free(app->portal_logs);
|
|
||||||
}
|
|
||||||
|
|
||||||
furi_string_free(app->captured_line);
|
|
||||||
|
|
||||||
// Send reset event to dev board
|
// Send reset event to dev board
|
||||||
evil_portal_uart_tx((uint8_t*)(RESET_CMD), strlen(RESET_CMD));
|
evil_portal_uart_tx((uint8_t*)(RESET_CMD), strlen(RESET_CMD));
|
||||||
evil_portal_uart_tx((uint8_t*)("\n"), 1);
|
evil_portal_uart_tx((uint8_t*)("\n"), 1);
|
||||||
@@ -112,6 +105,17 @@ void evil_portal_app_free(Evil_PortalApp* app) {
|
|||||||
|
|
||||||
evil_portal_uart_free(app->uart);
|
evil_portal_uart_free(app->uart);
|
||||||
|
|
||||||
|
// save latest logs
|
||||||
|
furi_mutex_acquire(app->portal_logs_mutex, FuriWaitForever);
|
||||||
|
if(furi_string_size(app->portal_logs) > 0) {
|
||||||
|
write_logs(app->portal_logs);
|
||||||
|
furi_string_free(app->portal_logs);
|
||||||
|
}
|
||||||
|
furi_mutex_release(app->portal_logs_mutex);
|
||||||
|
furi_mutex_free(app->portal_logs_mutex);
|
||||||
|
|
||||||
|
furi_string_free(app->captured_line);
|
||||||
|
|
||||||
// Close records
|
// Close records
|
||||||
furi_record_close(RECORD_GUI);
|
furi_record_close(RECORD_GUI);
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ struct Evil_PortalApp {
|
|||||||
SceneManager* scene_manager;
|
SceneManager* scene_manager;
|
||||||
|
|
||||||
FuriString* portal_logs;
|
FuriString* portal_logs;
|
||||||
|
FuriMutex* portal_logs_mutex;
|
||||||
|
|
||||||
FuriString* text_box_store;
|
FuriString* text_box_store;
|
||||||
size_t text_box_store_strlen;
|
size_t text_box_store_strlen;
|
||||||
|
|||||||
@@ -48,24 +48,28 @@ static int32_t uart_worker(void* context) {
|
|||||||
if(uart->handle_rx_data_cb) {
|
if(uart->handle_rx_data_cb) {
|
||||||
uart->handle_rx_data_cb(uart->rx_buf, len, uart->app);
|
uart->handle_rx_data_cb(uart->rx_buf, len, uart->app);
|
||||||
|
|
||||||
|
furi_mutex_acquire(uart->app->portal_logs_mutex, FuriWaitForever);
|
||||||
if(uart->app->sent_reset == false) {
|
if(uart->app->sent_reset == false) {
|
||||||
furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf);
|
furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(furi_string_utf8_length(uart->app->portal_logs) > 4000) {
|
if(furi_string_size(uart->app->portal_logs) > 4000) {
|
||||||
write_logs(uart->app->portal_logs);
|
write_logs(uart->app->portal_logs);
|
||||||
furi_string_reset(uart->app->portal_logs);
|
furi_string_reset(uart->app->portal_logs);
|
||||||
}
|
}
|
||||||
|
furi_mutex_release(uart->app->portal_logs_mutex);
|
||||||
} else {
|
} else {
|
||||||
uart->rx_buf[len] = '\0';
|
uart->rx_buf[len] = '\0';
|
||||||
|
furi_mutex_acquire(uart->app->portal_logs_mutex, FuriWaitForever);
|
||||||
if(uart->app->sent_reset == false) {
|
if(uart->app->sent_reset == false) {
|
||||||
furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf);
|
furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(furi_string_utf8_length(uart->app->portal_logs) > 4000) {
|
if(furi_string_size(uart->app->portal_logs) > 4000) {
|
||||||
write_logs(uart->app->portal_logs);
|
write_logs(uart->app->portal_logs);
|
||||||
furi_string_reset(uart->app->portal_logs);
|
furi_string_reset(uart->app->portal_logs);
|
||||||
}
|
}
|
||||||
|
furi_mutex_release(uart->app->portal_logs_mutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,7 +104,6 @@ Evil_PortalUart* evil_portal_uart_init(Evil_PortalApp* app) {
|
|||||||
furi_hal_uart_init(UART_CH, app->BAUDRATE);
|
furi_hal_uart_init(UART_CH, app->BAUDRATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
furi_hal_console_disable();
|
|
||||||
if(app->BAUDRATE == 0) {
|
if(app->BAUDRATE == 0) {
|
||||||
app->BAUDRATE = 115200;
|
app->BAUDRATE = 115200;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -156,8 +156,7 @@ void write_logs(FuriString* portal_logs) {
|
|||||||
File* file = storage_file_alloc(storage);
|
File* file = storage_file_alloc(storage);
|
||||||
|
|
||||||
if(storage_file_open(file, seq_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
if(storage_file_open(file, seq_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
|
||||||
storage_file_write(
|
storage_file_write(file, furi_string_get_cstr(portal_logs), furi_string_size(portal_logs));
|
||||||
file, furi_string_get_cstr(portal_logs), furi_string_utf8_length(portal_logs));
|
|
||||||
}
|
}
|
||||||
storage_file_close(file);
|
storage_file_close(file);
|
||||||
storage_file_free(file);
|
storage_file_free(file);
|
||||||
|
|||||||
@@ -62,8 +62,10 @@ void evil_portal_scene_console_output_on_enter(void* context) {
|
|||||||
const char* help_msg = "Logs saved.\n\n";
|
const char* help_msg = "Logs saved.\n\n";
|
||||||
furi_string_cat_str(app->text_box_store, help_msg);
|
furi_string_cat_str(app->text_box_store, help_msg);
|
||||||
app->text_box_store_strlen += strlen(help_msg);
|
app->text_box_store_strlen += strlen(help_msg);
|
||||||
|
furi_mutex_acquire(app->portal_logs_mutex, FuriWaitForever);
|
||||||
write_logs(app->portal_logs);
|
write_logs(app->portal_logs);
|
||||||
furi_string_reset(app->portal_logs);
|
furi_string_reset(app->portal_logs);
|
||||||
|
furi_mutex_release(app->portal_logs_mutex);
|
||||||
if(app->show_stopscan_tip) {
|
if(app->show_stopscan_tip) {
|
||||||
const char* msg = "Press BACK to return\n";
|
const char* msg = "Press BACK to return\n";
|
||||||
furi_string_cat_str(app->text_box_store, msg);
|
furi_string_cat_str(app->text_box_store, msg);
|
||||||
@@ -151,6 +153,7 @@ void evil_portal_scene_console_output_on_enter(void* context) {
|
|||||||
evil_portal_uart_tx((uint8_t*)("\n"), 1);
|
evil_portal_uart_tx((uint8_t*)("\n"), 1);
|
||||||
for(uint8_t t = 0; t < 15 && !captured(app, "html set"); t++)
|
for(uint8_t t = 0; t < 15 && !captured(app, "html set"); t++)
|
||||||
furi_delay_ms(100);
|
furi_delay_ms(100);
|
||||||
|
furi_delay_ms(100);
|
||||||
evil_portal_uart_tx(
|
evil_portal_uart_tx(
|
||||||
(uint8_t*)("evilportal -c start\n"), strlen("evilportal -c start\n"));
|
(uint8_t*)("evilportal -c start\n"), strlen("evilportal -c start\n"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user