Skip to content

Commit

Permalink
Merge branch 'stealth_merge' into merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JahazielLem committed Aug 21, 2024
2 parents 8d57540 + 8e2c1e9 commit 87c4e05
Show file tree
Hide file tree
Showing 24 changed files with 214 additions and 227 deletions.
3 changes: 1 addition & 2 deletions firmware/main/apps/wifi/deauth/deauth_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,7 @@ static void deauth_module_cb_event(uint8_t button_name, uint8_t button_event) {
case BUTTON_LEFT:
wifi_scanner_clear_ap_records();
printf("Exit deauth: %d\n", current_item);
menus_module_set_app_state(false, NULL);
menu_screens_exit_submenu();
menus_module_exit_app();
// led_control_stop();
break;
default:
Expand Down
3 changes: 1 addition & 2 deletions firmware/main/modules/cat_dos/catdos_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,7 @@ static void catdos_module_state_machine(uint8_t button_name,
case CATDOS_STATE_CONFIG_WIFI: {
switch (button_name) {
case BUTTON_LEFT:
menus_module_set_app_state(false, NULL);
menu_screens_exit_submenu();
menus_module_exit_app();
break;
case BUTTON_RIGHT:
ESP_LOGI(CATDOS_TAG, "Selected item: %d", selected_item);
Expand Down
3 changes: 1 addition & 2 deletions firmware/main/modules/file_manager/file_manager_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ static file_manager_context_t* file_manager_context_alloc() {
static void file_manager_module_exit() {
clear_items();
free(fm_ctx);
menu_screens_exit_submenu();
menus_module_set_app_state(false, NULL);
menus_module_exit_app();
}

static void navigation_up() {
Expand Down
19 changes: 0 additions & 19 deletions firmware/main/modules/keyboard/keyboard_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ static bool lock_input = false;

static void button_event_cb(void* arg, void* data);

void timer_callback() {
menu_idx_t menu = menus_module_get_current_menu();
if (menu == MENU_WIFI_ANALYZER_RUN_2 ||
menu == MENU_WIFI_ANALYZER_SUMMARY_2 || menu == MENU_GPS_DATE_TIME_2 ||
menu == MENU_GPS_LOCATION_2 || menu == MENU_GPS_SPEED_2) {
return;
}
if (menus_module_get_app_state()) {
return;
}

is_idle = true;
menus_module_screen_saver_run();
}
void keyboard_module_reset_idle_timer() {
esp_timer_stop(idle_timer);
esp_timer_start_once(idle_timer, IDLE_TIMEOUT_S * 1000 * 1000);
Expand Down Expand Up @@ -129,9 +115,4 @@ void keyboard_module_begin() {
button_init(RIGHT_BUTTON_PIN, RIGHT_BUTTON_MASK);
button_init(UP_BUTTON_PIN, UP_BUTTON_MASK);
button_init(DOWN_BUTTON_PIN, DOWN_BUTTON_MASK);
esp_timer_create_args_t timer_args = {.callback = timer_callback,
.arg = NULL,

.name = "one_shot_timer"};
esp_err_t err = esp_timer_create(&timer_args, &idle_timer);
}
2 changes: 0 additions & 2 deletions firmware/main/modules/menu_screens/menu_screens_modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,4 @@ void menu_screens_update_options(char* options[], uint8_t selected_option);
* @return void
*/
void screen_module_set_screen(int current_menu);

static void screen_saver_run();
void stop_screen_saver();
45 changes: 27 additions & 18 deletions firmware/main/modules/menus_module/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@
#include "apps/zigbee/z_switch/z_switch_module.h"
#include "modules/about/about_module.h"

#include "catdos_module.h"
#include "deauth_module.h"
#include "display_settings.h"
#include "file_manager_module.h"
#include "open_thread_module.h"
#include "ota_module.h"
#include "stealth_mode.h"
#include "web_file_browser_module.h"
#include "wifi_module.h"
#include "zigbee_module.h"

typedef enum {
MENU_MAIN_2 = 0,
Expand Down Expand Up @@ -170,15 +179,15 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_WIFI_ANALIZER_2,
.parent_idx = MENU_WIFI_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_exit_cb = NULL,
.on_enter_cb = wifi_module_analizer_begin,
.on_exit_cb = wifi_module_analizer_exit,
.is_visible = true},
{.display_name = "Start",
.menu_idx = MENU_WIFI_ANALYZER_RUN_2,
.parent_idx = MENU_WIFI_ANALIZER_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_exit_cb = NULL,
.on_enter_cb = wifi_module_init_sniffer,
.on_exit_cb = wifi_module_analyzer_run_exit,
.is_visible = true},
{.display_name = "Settings",
.menu_idx = MENU_WIFI_ANALYZER_SETTINGS_2,
Expand All @@ -199,7 +208,7 @@ menu_t menus[] = { //////////////////////////////////
.parent_idx = MENU_WIFI_ANALYZER_SETTINGS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_exit_cb = NULL,
.on_exit_cb = wifi_module_analyzer_destination_exit,
.is_visible = true},
{.display_name = "Help",
.menu_idx = MENU_WIFI_ANALYZER_HELP_2,
Expand All @@ -214,7 +223,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_WIFI_DEAUTH_2,
.parent_idx = MENU_WIFI_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = deauth_module_begin,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand All @@ -223,7 +232,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_WIFI_DOS_2,
.parent_idx = MENU_WIFI_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = catdos_module_begin,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand Down Expand Up @@ -284,7 +293,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_ZIGBEE_SWITCH_2,
.parent_idx = MENU_ZIGBEE_SPOOFING_2,
.last_selected_submenu = 0,
.on_enter_cb = z_switch_module_begin,
.on_enter_cb = zigbee_module_switch_enter,
.on_exit_cb = NULL,
.is_visible = true},
{.display_name = "Light",
Expand All @@ -300,7 +309,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_ZIGBEE_SNIFFER_2,
.parent_idx = MENU_ZIGBEE_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = zigbee_module_sniffer_enter,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand All @@ -318,23 +327,23 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_THREAD_BROADCAST_2,
.parent_idx = MENU_THREAD_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_exit_cb = NULL,
.on_enter_cb = open_thread_module_broadcast_enter,
.on_exit_cb = open_thread_module_exit,
.is_visible = true},
#endif
#ifdef CONFIG_THREAD_APP_SNIFFER
{.display_name = "Sniffer",
.menu_idx = MENU_THREAD_SNIFFER_2,
.parent_idx = MENU_THREAD_APPS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_exit_cb = NULL,
.on_enter_cb = open_thread_module_sniffer_enter,
.on_exit_cb = open_thread_module_exit,
.is_visible = true},
{.display_name = "Run",
.menu_idx = MENU_THREAD_SNIFFER_RUN_2,
.parent_idx = MENU_THREAD_SNIFFER_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = open_thread_module_sniffer_run,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand Down Expand Up @@ -419,7 +428,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_SETTINGS_DISPLAY_2,
.parent_idx = MENU_SETTINGS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = display_config_module_begin,
.on_exit_cb = NULL,
.is_visible = true},
{.display_name = "System",
Expand Down Expand Up @@ -470,7 +479,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_FILE_MANAGER_LOCAL_2,
.parent_idx = MENU_FILE_MANAGER_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = file_manager_module_init,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand All @@ -479,7 +488,7 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_FILE_MANAGER_WEB_2,
.parent_idx = MENU_FILE_MANAGER_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = web_file_browser_module_begin,
.on_exit_cb = NULL,
.is_visible = true},
#endif
Expand All @@ -488,6 +497,6 @@ menu_t menus[] = { //////////////////////////////////
.menu_idx = MENU_STEALTH_MODE_2,
.parent_idx = MENU_SETTINGS_2,
.last_selected_submenu = 0,
.on_enter_cb = NULL,
.on_enter_cb = stealth_mode_open_menu,
.on_exit_cb = NULL,
.is_visible = true}};
18 changes: 7 additions & 11 deletions firmware/main/modules/menus_module/menus_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <string.h>
#include "bitmaps_general.h"
#include "leds.h"
#include "led_events.h"
#include "menu_screens_modules.h"
#include "menus_screens.h"
#include "modals_module.h"
Expand Down Expand Up @@ -148,6 +148,7 @@ static void navigation_enter() {

static void navigation_exit() {
if (menus_ctx->current_menu == MENU_MAIN_2) {
screen_saver_run();
return;
}
menus[get_menu_idx(menus_ctx->current_menu)].last_selected_submenu =
Expand Down Expand Up @@ -204,26 +205,21 @@ static void menus_input_cb(uint8_t button_name, uint8_t button_event) {

static void show_logo() {
oled_screen_clear();
leds_on();
buzzer_play();
led_control_run_effect(led_control_pulse_leds);
buzzer_play_for(100);
screen_saver_run();
vTaskDelay(500 / portTICK_PERIOD_MS);
buzzer_stop();
}

void screen_module_set_reset_screen(menu_idx_t menu) {
void menus_module_set_reset_screen(menu_idx_t menu) {
preferences_put_int("MENUNUMBER", menu);
modals_module_show_banner("Exiting...");
}

static void get_reset_menu() {
menus_ctx->current_menu = preferences_get_int("MENUNUMBER", MENU_MAIN_2);

if ((int) menus_ctx->current_menu == MENU_MAIN) {
preferences_put_int("logo_show", 1);
if ((int) menus_ctx->current_menu == MENU_MAIN_2) {
show_logo();
} else {
preferences_put_int("logo_show", 0);
preferences_put_int("MENUNUMBER", MENU_MAIN_2);
screen_saver_get_idle_state();
refresh_menus();
Expand Down Expand Up @@ -251,7 +247,7 @@ void menus_module_set_app_state_last() {
void menus_module_exit_app() {
app_state2.in_app = false;
app_state2.input_callback = NULL;
screen_module_set_reset_screen(menus_ctx->parent_menu_idx);
menus_module_set_reset_screen(menus_ctx->parent_menu_idx);
esp_restart();
}

Expand Down
3 changes: 2 additions & 1 deletion firmware/main/modules/menus_module/menus_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ void menus_module_set_app_state_last();
bool menus_module_get_app_state();
void menus_module_exit_app();
void menus_module_exit_app_information();
void menus_module_screen_saver_run();
void menus_module_screen_saver_run();
void menus_module_set_reset_screen(menu_idx_t menu);
3 changes: 1 addition & 2 deletions firmware/main/modules/menus_module/menus_screens.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ void menus_screens_display_menus_f(menus_manager_t* ctx) {
.display_name;
char* str = (char*) malloc(strlen(display_name) + 3);
sprintf(str, "%s%s", i == 1 ? prefix : " ", display_name);
oled_screen_display_text(str, 0, i * page_increment + 1,
OLED_DISPLAY_NORMAL);
oled_screen_display_text(str, 0, i * page_increment, OLED_DISPLAY_NORMAL);
}

#ifdef CONFIG_RESOLUTION_128X64
Expand Down
Loading

0 comments on commit 87c4e05

Please sign in to comment.