mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 23:26:45 -08:00
Add headless mode
This commit is contained in:
@@ -25,7 +25,7 @@ void Display::RunSetup()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MARAUDER_M5STICKC
|
#ifdef MARAUDER_M5STICKC
|
||||||
tft.setRotation(3);
|
tft.setRotation(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft.setCursor(0, 0);
|
tft.setCursor(0, 0);
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ class Display
|
|||||||
bool tteBar = false;
|
bool tteBar = false;
|
||||||
bool draw_tft = false;
|
bool draw_tft = false;
|
||||||
bool exit_draw = false;
|
bool exit_draw = false;
|
||||||
|
bool headless_mode = false;
|
||||||
|
|
||||||
uint8_t TOP_FIXED_AREA_2 = 48;
|
uint8_t TOP_FIXED_AREA_2 = 48;
|
||||||
uint8_t print_delay_1, print_delay_2 = 10;
|
uint8_t print_delay_1, print_delay_2 = 10;
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ MenuFunctions::MenuFunctions()
|
|||||||
/* Interrupt driven periodic handler */
|
/* Interrupt driven periodic handler */
|
||||||
|
|
||||||
#ifdef HAS_ILI9341
|
#ifdef HAS_ILI9341
|
||||||
|
uint8_t MenuFunctions::updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold) {
|
||||||
|
if (!display_obj.headless_mode)
|
||||||
|
return display_obj.tft.getTouch(x, y, threshold);
|
||||||
|
else
|
||||||
|
return !display_obj.headless_mode;
|
||||||
|
}
|
||||||
|
|
||||||
void MenuFunctions::lv_tick_handler()
|
void MenuFunctions::lv_tick_handler()
|
||||||
{
|
{
|
||||||
lv_tick_inc(LVGL_TICK_PERIOD);
|
lv_tick_inc(LVGL_TICK_PERIOD);
|
||||||
@@ -456,7 +463,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
|||||||
|
|
||||||
// getTouch causes a 10ms delay which makes beacon spam less effective
|
// getTouch causes a 10ms delay which makes beacon spam less effective
|
||||||
#ifdef HAS_ILI9341
|
#ifdef HAS_ILI9341
|
||||||
pressed = display_obj.tft.getTouch(&t_x, &t_y);
|
pressed = this->updateTouch(&t_x, &t_y);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -643,6 +650,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAS_BUTTONS
|
#ifdef HAS_BUTTONS
|
||||||
|
#if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
|
||||||
#ifndef MARAUDER_M5STICKC
|
#ifndef MARAUDER_M5STICKC
|
||||||
if (u_btn.justPressed()){
|
if (u_btn.justPressed()){
|
||||||
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
|
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
|
||||||
@@ -686,7 +694,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
|||||||
if(c_btn_press){
|
if(c_btn_press){
|
||||||
current_menu->list->get(current_menu->selected).callable();
|
current_menu->list->get(current_menu->selected).callable();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,8 @@ class MenuFunctions
|
|||||||
void buttonSelected(uint8_t b);
|
void buttonSelected(uint8_t b);
|
||||||
void buttonNotSelected(uint8_t b);
|
void buttonNotSelected(uint8_t b);
|
||||||
|
|
||||||
|
uint8_t updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuFunctions();
|
MenuFunctions();
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,8 @@
|
|||||||
//#define FLIPPER_ZERO_HAT
|
//#define FLIPPER_ZERO_HAT
|
||||||
#define HAS_BATTERY
|
#define HAS_BATTERY
|
||||||
#define HAS_BT
|
#define HAS_BT
|
||||||
//#define HAS_BUTTONS
|
#define HAS_BT_REMOTE
|
||||||
|
#define HAS_BUTTONS
|
||||||
#define HAS_NEOPIXEL_LED
|
#define HAS_NEOPIXEL_LED
|
||||||
//#define HAS_PWR_MGMT
|
//#define HAS_PWR_MGMT
|
||||||
#define HAS_SCREEN
|
#define HAS_SCREEN
|
||||||
@@ -85,7 +86,7 @@
|
|||||||
//#define FLIPPER_ZERO_HAT
|
//#define FLIPPER_ZERO_HAT
|
||||||
#define HAS_BATTERY
|
#define HAS_BATTERY
|
||||||
#define HAS_BT
|
#define HAS_BT
|
||||||
//#define HAS_BUTTONS
|
#define HAS_BUTTONS
|
||||||
#define HAS_NEOPIXEL_LED
|
#define HAS_NEOPIXEL_LED
|
||||||
//#define HAS_PWR_MGMT
|
//#define HAS_PWR_MGMT
|
||||||
#define HAS_SCREEN
|
#define HAS_SCREEN
|
||||||
@@ -207,6 +208,22 @@
|
|||||||
#define D_BTN 39
|
#define D_BTN 39
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MARAUDER_V6
|
||||||
|
#define L_BTN -1
|
||||||
|
#define C_BTN 0
|
||||||
|
#define U_BTN -1
|
||||||
|
#define R_BTN -1
|
||||||
|
#define D_BTN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MARAUDER_V6_1
|
||||||
|
#define L_BTN -1
|
||||||
|
#define C_BTN 0
|
||||||
|
#define U_BTN -1
|
||||||
|
#define R_BTN -1
|
||||||
|
#define D_BTN -1
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
//// END BUTTON DEFINITIONS
|
//// END BUTTON DEFINITIONS
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ void setup()
|
|||||||
axp192_obj.begin();
|
axp192_obj.begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pinMode(FLASH_BUTTON, INPUT);
|
//pinMode(FLASH_BUTTON, INPUT);
|
||||||
|
|
||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
pinMode(TFT_BL, OUTPUT);
|
pinMode(TFT_BL, OUTPUT);
|
||||||
@@ -247,6 +247,17 @@ void setup()
|
|||||||
#ifdef HAS_SCREEN
|
#ifdef HAS_SCREEN
|
||||||
delay(2000);
|
delay(2000);
|
||||||
|
|
||||||
|
// Do some stealth mode stuff
|
||||||
|
#ifdef HAS_BUTTONS
|
||||||
|
if (c_btn.justPressed()) {
|
||||||
|
display_obj.headless_mode = true;
|
||||||
|
|
||||||
|
backlightOff();
|
||||||
|
|
||||||
|
Serial.println("Headless Mode enabled");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
display_obj.clearScreen();
|
display_obj.clearScreen();
|
||||||
|
|
||||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||||
|
|||||||
Reference in New Issue
Block a user