Explorar el Código

removed files

bigbrodude6119 hace 2 años
padre
commit
feccb92021

+ 6 - 7
evil_portal_app.c

@@ -1,4 +1,5 @@
 #include "evil_portal_app_i.h"
 #include "evil_portal_app_i.h"
+#include "helpers/evil_portal_speaker.h"
 #include "helpers/evil_portal_storage.h"
 #include "helpers/evil_portal_storage.h"
 
 
 #include <furi.h>
 #include <furi.h>
@@ -69,7 +70,8 @@ Evil_PortalApp *evil_portal_app_alloc() {
   return app;
   return app;
 }
 }
 
 
-void evil_portal_app_free(Evil_PortalApp *app) {
+void evil_portal_app_free(Evil_PortalApp *app) {  
+
   // save latest logs
   // save latest logs
   if (strlen(app->portal_logs) > 0) {
   if (strlen(app->portal_logs) > 0) {
     write_logs(app->portal_logs);
     write_logs(app->portal_logs);
@@ -86,10 +88,6 @@ void evil_portal_app_free(Evil_PortalApp *app) {
                               Evil_PortalAppViewVarItemList);
                               Evil_PortalAppViewVarItemList);
   view_dispatcher_remove_view(app->view_dispatcher,
   view_dispatcher_remove_view(app->view_dispatcher,
                               Evil_PortalAppViewConsoleOutput);
                               Evil_PortalAppViewConsoleOutput);
-  view_dispatcher_remove_view(app->view_dispatcher,
-                              Evil_PortalAppViewTextInput);
-  view_dispatcher_remove_view(app->view_dispatcher,
-                              Evil_PortalAppViewStartPortal);
 
 
   text_box_free(app->text_box);
   text_box_free(app->text_box);
   furi_string_free(app->text_box_store);
   furi_string_free(app->text_box_store);
@@ -106,14 +104,15 @@ void evil_portal_app_free(Evil_PortalApp *app) {
   free(app);
   free(app);
 }
 }
 
 
-int32_t evil_portal_app(void *p) {
+int32_t evil_portal_app(void *p) {  
   UNUSED(p);
   UNUSED(p);
   Evil_PortalApp *evil_portal_app = evil_portal_app_alloc();
   Evil_PortalApp *evil_portal_app = evil_portal_app_alloc();
 
 
   evil_portal_app->uart = evil_portal_uart_init(evil_portal_app);
   evil_portal_app->uart = evil_portal_uart_init(evil_portal_app);
 
 
-  view_dispatcher_run(evil_portal_app->view_dispatcher);
+  view_dispatcher_run(evil_portal_app->view_dispatcher);  
 
 
+  // crashing here
   evil_portal_app_free(evil_portal_app);
   evil_portal_app_free(evil_portal_app);
 
 
   return 0;
   return 0;

+ 0 - 4
evil_portal_app_i.h

@@ -4,7 +4,6 @@
 #include "evil_portal_custom_event.h"
 #include "evil_portal_custom_event.h"
 #include "evil_portal_uart.h"
 #include "evil_portal_uart.h"
 #include "scenes/evil_portal_scene.h"
 #include "scenes/evil_portal_scene.h"
-// #include "uart_text_input.h"
 
 
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <gui/modules/text_box.h>
 #include <gui/modules/text_box.h>
@@ -15,7 +14,6 @@
 #define NUM_MENU_ITEMS (4)
 #define NUM_MENU_ITEMS (4)
 
 
 #define EVIL_PORTAL_TEXT_BOX_STORE_SIZE (4096)
 #define EVIL_PORTAL_TEXT_BOX_STORE_SIZE (4096)
-#define EVIL_PORTAL_TEXT_INPUT_STORE_SIZE (512)
 #define UART_CH (FuriHalUartIdUSART1)
 #define UART_CH (FuriHalUartIdUSART1)
 
 
 struct Evil_PortalApp {
 struct Evil_PortalApp {
@@ -25,7 +23,6 @@ struct Evil_PortalApp {
 
 
   char* portal_logs;
   char* portal_logs;
 
 
-  char text_input_store[EVIL_PORTAL_TEXT_INPUT_STORE_SIZE + 1];
   FuriString *text_box_store;
   FuriString *text_box_store;
   size_t text_box_store_strlen;
   size_t text_box_store_strlen;
   TextBox *text_box;
   TextBox *text_box;
@@ -55,6 +52,5 @@ struct Evil_PortalApp {
 typedef enum {
 typedef enum {
   Evil_PortalAppViewVarItemList,
   Evil_PortalAppViewVarItemList,
   Evil_PortalAppViewConsoleOutput,
   Evil_PortalAppViewConsoleOutput,
-  Evil_PortalAppViewTextInput,
   Evil_PortalAppViewStartPortal,
   Evil_PortalAppViewStartPortal,
 } Evil_PortalAppView;
 } Evil_PortalAppView;

+ 1 - 9
evil_portal_uart.c

@@ -39,30 +39,22 @@ void evil_portal_uart_on_irq_cb(UartIrqEvent ev, uint8_t data, void *context) {
 static int32_t uart_worker(void *context) {
 static int32_t uart_worker(void *context) {
   Evil_PortalUart *uart = (void *)context;
   Evil_PortalUart *uart = (void *)context;
 
 
-
-  // FURI_LOG_I("EP", "in worker");
   while (1) {
   while (1) {
 
 
     uint32_t events = furi_thread_flags_wait(WORKER_ALL_RX_EVENTS,
     uint32_t events = furi_thread_flags_wait(WORKER_ALL_RX_EVENTS,
                                              FuriFlagWaitAny, FuriWaitForever);
                                              FuriFlagWaitAny, FuriWaitForever);
     furi_check((events & FuriFlagError) == 0);
     furi_check((events & FuriFlagError) == 0);
     if (events & WorkerEvtStop)
     if (events & WorkerEvtStop)
-    // FURI_LOG_I("EP", "event 1");
       break;
       break;
     if (events & WorkerEvtRxDone) {
     if (events & WorkerEvtRxDone) {
-      // FURI_LOG_I("EP", "event 2");
       size_t len = furi_stream_buffer_receive(uart->rx_stream, uart->rx_buf,
       size_t len = furi_stream_buffer_receive(uart->rx_stream, uart->rx_buf,
                                               RX_BUF_SIZE, 0);
                                               RX_BUF_SIZE, 0);
 
 
-      // FURI_LOG_I("EP", "comp len");
       if (len > 0) {
       if (len > 0) {
-        // FURI_LOG_I("EP", "check cb");
         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);
 
 
-          if (uart->app->has_command_queue) {
-            // FURI_LOG_I("EP", "Has command queue");
-            // FURI_LOG_I("EP", (char *)uart->rx_buf);            
+          if (uart->app->has_command_queue) {         
             if (uart->app->command_index < 1) {
             if (uart->app->command_index < 1) {
               
               
               // check the current command
               // check the current command

+ 19 - 0
helpers/evil_portal_speaker.c

@@ -0,0 +1,19 @@
+#include "evil_portal_speaker.h"
+#include "../evil_portal_app_i.h"
+
+#define NOTE_INPUT 587.33f
+
+void evil_portal_play_input_sound() {
+    float volume = 1.0f;
+    if(furi_hal_speaker_is_mine() || furi_hal_speaker_acquire(30)) {
+        furi_hal_speaker_start(NOTE_INPUT, volume);
+    }
+    
+}
+
+void evil_portal_stop_all_sound() {
+    if(furi_hal_speaker_is_mine()) {
+        furi_hal_speaker_stop();
+        furi_hal_speaker_release();
+    }
+}

+ 4 - 0
helpers/evil_portal_speaker.h

@@ -0,0 +1,4 @@
+#define NOTE_INPUT 587.33f
+
+void evil_portal_play_input_sound();
+void evil_portal_stop_all_sound();

+ 9 - 9
scenes/evil_portal_scene_start.c

@@ -1,4 +1,5 @@
 #include "../evil_portal_app_i.h"
 #include "../evil_portal_app_i.h"
+#include "../helpers/evil_portal_speaker.h"
 
 
 // For each command, define whether additional arguments are needed
 // For each command, define whether additional arguments are needed
 // (enabling text input to fill them out), and whether the console
 // (enabling text input to fill them out), and whether the console
@@ -72,17 +73,17 @@ static void evil_portal_scene_start_var_list_enter_callback(void *context,
                                  : item->focus_console;
                                  : item->focus_console;
   app->show_stopscan_tip = item->show_stopscan_tip;
   app->show_stopscan_tip = item->show_stopscan_tip;
 
 
-  bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS)
-                            ? (selected_option_index != 0)
-                            : item->needs_keyboard;
+  // bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS)
+  //                           ? (selected_option_index != 0)
+  //                           : item->needs_keyboard;
                             
                             
-  if (needs_keyboard) {
-    view_dispatcher_send_custom_event(app->view_dispatcher,
-                                      Evil_PortalEventStartKeyboard);
-  } else {
+  // if (needs_keyboard) {
+  //   view_dispatcher_send_custom_event(app->view_dispatcher,
+  //                                     Evil_PortalEventStartKeyboard);
+  // } else {
     view_dispatcher_send_custom_event(app->view_dispatcher,
     view_dispatcher_send_custom_event(app->view_dispatcher,
                                       Evil_PortalEventStartConsole);
                                       Evil_PortalEventStartConsole);
-  }
+  // }
 }
 }
 
 
 static void
 static void
@@ -138,7 +139,6 @@ bool evil_portal_scene_start_on_event(void *context, SceneManagerEvent event) {
     } else if (event.event == Evil_PortalEventStartKeyboard) {
     } else if (event.event == Evil_PortalEventStartKeyboard) {
       scene_manager_set_scene_state(app->scene_manager, Evil_PortalSceneStart,
       scene_manager_set_scene_state(app->scene_manager, Evil_PortalSceneStart,
                                     app->selected_menu_index);
                                     app->selected_menu_index);
-      scene_manager_next_scene(app->scene_manager, Evil_PortalAppViewTextInput);
     } else if (event.event == Evil_PortalEventStartConsole) {
     } else if (event.event == Evil_PortalEventStartConsole) {
       scene_manager_set_scene_state(app->scene_manager, Evil_PortalSceneStart,
       scene_manager_set_scene_state(app->scene_manager, Evil_PortalSceneStart,
                                     app->selected_menu_index);
                                     app->selected_menu_index);