mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-05 20:40:25 -08:00
Consolidate display init method
This commit is contained in:
@@ -312,7 +312,7 @@ void CommandLine::runCommand(String input) {
|
||||
|
||||
// If we don't do this, the text and button coordinates will be off
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
menu_function_obj.changeMenu(menu_function_obj.current_menu);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -109,6 +109,14 @@ bool Display::isTouchHeld(uint16_t threshold) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Display::init() {
|
||||
tft.init();
|
||||
|
||||
#ifdef HAS_DUAL_BAND
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Display::setCalData(bool landscape) {
|
||||
#ifndef HAS_CYD_TOUCH
|
||||
if (!landscape) {
|
||||
@@ -117,7 +125,7 @@ void Display::setCalData(bool landscape) {
|
||||
#elif defined(MARAUDER_CYD_3_5_INCH)
|
||||
uint16_t calData[5] = { 239, 3560, 262, 3643, 4 };
|
||||
#elif defined(MARAUDER_V8)
|
||||
uint16_t calData[5] = { 298, 3451, 377, 3509, 4 };
|
||||
uint16_t calData[5] = { 351, 3279, 214, 3394, 2 };
|
||||
#elif defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
||||
#endif
|
||||
@@ -131,7 +139,7 @@ void Display::setCalData(bool landscape) {
|
||||
#elif defined(MARAUDER_CYD_3_5_INCH)
|
||||
uint16_t calData[5] = { 272, 3648, 234, 3565, 7 };
|
||||
#elif defined(MARAUDER_V8)
|
||||
uint16_t calData[5] = { 382, 3492, 293, 3502, 7 };
|
||||
uint16_t calData[5] = { 213, 3396, 350, 3275, 1 };
|
||||
#else if defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 213, 3469, 320, 3446, 1 }; // Landscape TFT DIY
|
||||
#endif
|
||||
|
||||
@@ -140,6 +140,7 @@ class Display
|
||||
//void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void init();
|
||||
void main(uint8_t scan_mode);
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
|
||||
@@ -904,7 +904,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_SLEEP) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_SLEEP_TARGETED) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_MIMIC) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_FUNNY_BEACON) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_FUNNY_BEACON) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_RICK_ROLL) ||
|
||||
(wifi_scan_obj.currentScanMode == WIFI_ATTACK_BEACON_LIST) ||
|
||||
(wifi_scan_obj.currentScanMode == BT_SCAN_ALL) ||
|
||||
@@ -925,10 +925,10 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
|
||||
// If we don't do this, the text and button coordinates will be off
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
|
||||
// Take us back to the menu
|
||||
changeMenu(current_menu);
|
||||
changeMenu(current_menu, true);
|
||||
}
|
||||
|
||||
x = -1;
|
||||
@@ -1025,7 +1025,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
|
||||
// If we don't do this, the text and button coordinates will be off
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
|
||||
// Take us back to the menu
|
||||
changeMenu(current_menu);
|
||||
@@ -1850,7 +1850,7 @@ void MenuFunctions::drawStatusBar()
|
||||
|
||||
void MenuFunctions::orientDisplay()
|
||||
{
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
|
||||
display_obj.tft.setRotation(SCREEN_ORIENTATION); // Portrait
|
||||
|
||||
@@ -4214,7 +4214,7 @@ void MenuFunctions::changeMenu(Menu* menu, bool simple_change) {
|
||||
if (!simple_change) {
|
||||
display_obj.initScrollValues();
|
||||
display_obj.setupScrollArea(TOP_FIXED_AREA, BOT_FIXED_AREA);
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
}
|
||||
current_menu = menu;
|
||||
|
||||
@@ -4223,6 +4223,10 @@ void MenuFunctions::changeMenu(Menu* menu, bool simple_change) {
|
||||
buildButtons(menu);
|
||||
|
||||
displayCurrentMenu();
|
||||
|
||||
//#ifdef MARAUDER_V8
|
||||
// digitalWrite(TFT_BL, HIGH);
|
||||
//#endif
|
||||
}
|
||||
|
||||
void MenuFunctions::buildButtons(Menu *menu, int starting_index, String button_name) {
|
||||
|
||||
@@ -2209,7 +2209,7 @@ void WiFiScan::RunAPScan(uint8_t scan_mode, uint16_t color)
|
||||
void WiFiScan::RunLvJoinWiFi(uint8_t scan_mode, uint16_t color) {
|
||||
|
||||
#ifdef HAS_TOUCH
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
display_obj.tft.setRotation(1);
|
||||
#endif
|
||||
|
||||
@@ -2810,7 +2810,7 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
||||
if ((scan_mode != WIFI_SCAN_PACKET_RATE) &&
|
||||
(scan_mode != WIFI_SCAN_CHAN_ANALYZER)) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
display_obj.tft.setRotation(1);
|
||||
display_obj.tft.fillScreen(TFT_BLACK);
|
||||
#endif
|
||||
@@ -2927,7 +2927,7 @@ void WiFiScan::RunEapolScan(uint8_t scan_mode, uint16_t color)
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.init();
|
||||
display_obj.init();
|
||||
display_obj.tft.setRotation(1);
|
||||
display_obj.tft.fillScreen(TFT_BLACK);
|
||||
#endif
|
||||
@@ -7575,7 +7575,7 @@ bool WiFiScan::filterActive() {
|
||||
else if (b == 6) {
|
||||
Serial.println("Exiting packet monitor...");
|
||||
this->StartScan(WIFI_SCAN_OFF);
|
||||
//display_obj.tft.init();
|
||||
//display_obj.init();
|
||||
this->orient_display = true;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user