Skip to content

Commit

Permalink
sync with pr3y/main
Browse files Browse the repository at this point in the history
  • Loading branch information
rennancockles committed Jul 22, 2024
1 parent 92980b3 commit 330490f
Show file tree
Hide file tree
Showing 16 changed files with 392 additions and 174 deletions.
10 changes: 0 additions & 10 deletions deauth_setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ setlocal enabledelayedexpansion
rem Define file paths
set "esp32_file=%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libnet80211.a"
set "esp32s3_file=%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32s3\lib\libnet80211.a"
set "esp32s3_file3=%userprofile%\.platformio\packages\[email protected]\tools\sdk\esp32s3\lib\libnet80211.a"

set "esp32_file2=%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\lib\libnet80211_temp.a"
set "esp32s3_file2=%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32s3\lib\libnet80211_temp.a"
set "esp32s3_file4=%userprofile%\.platformio\packages\[email protected]\tools\sdk\esp32s3\lib\libnet80211_temp.a"

rem Now execute objcopy commands (only if backups were created)
"%userprofile%"\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\bin\objcopy --weaken-symbol=ieee80211_raw_frame_sanity_check "%esp32_file%" "%esp32_file2%"
Expand All @@ -28,14 +26,6 @@ ren "%esp32s3_file%" "libnet80211.a.old"
rem Rename the _temp to original
ren "%esp32s3_file2%" "libnet80211.a"

rem Now execute objcopy commands (only if backups were created)
"%userprofile%"\.platformio\packages\toolchain-xtensa-esp32s3\xtensa-esp32s3-elf\bin\objcopy --weaken-symbol=ieee80211_raw_frame_sanity_check "%esp32s3_file3%" "%esp32s3_file4%"

rem Rename the original file to .old
ren "%esp32s3_file3%" "libnet80211.a.old"

rem Rename the _temp to original
ren "%esp32s3_file4%" "libnet80211.a"

PAUSE

11 changes: 0 additions & 11 deletions deauth_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ 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_file2="$HOME/.platformio/packages/[email protected]/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_temp2="$HOME/.platformio/packages/[email protected]/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"
Expand All @@ -36,15 +34,6 @@ if [[ -f "$esp32_file" && -f "$esp32s3_file" ]]; then
# Rename the _temp to original
mv "$esp32s3_file_temp" "$esp32s3_file"

# Execute objcopy commands for ESP32-S3
$toolchain_esp32s3 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32s3_file2" "$esp32s3_file_temp2"

# Rename the original file to .old
mv "$esp32s3_file2" "${esp32s3_file2}.old"

# Rename the _temp to original
mv "$esp32s3_file_temp2" "$esp32s3_file2"

echo "Done."
else
echo "One or more specified files were not found."
Expand Down
8 changes: 5 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ default_envs =

[common]
build_flags =
-DBRUCE_VERSION='"1.1.1"'
-DBRUCE_VERSION='"1.1.2"'
-DMAXFILES=256
-DEEPROMSIZE=64
-DEEPROMSIZE=128
-DLH=8
-DLW=6
-DCONFIG_FILE='"/config.conf"'

lib_deps =
WireGuard-ESP32
IRremoteESP8266
Expand All @@ -31,6 +33,7 @@ lib_deps =
NTPClient
Timezone
ESP32Time
bblanchon/ArduinoJson


[env:m5stack-cplus2]
Expand Down Expand Up @@ -164,7 +167,6 @@ lib_deps =

[env:m5stack-cardputer]
platform = espressif32
platform_packages[email protected]
board = m5stack-stamps3
framework = arduino
board_build.partitions = custom_8Mb.csv
Expand Down
56 changes: 29 additions & 27 deletions src/core/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ void displayRedStripe(String text, uint16_t fgcolor, uint16_t bgcolor) {
else size = FP;
tft.fillSmoothRoundRect(10,HEIGHT/2-13,WIDTH-20,26,7,bgcolor);
tft.setTextColor(fgcolor,bgcolor);
if(size==FM) {
tft.setTextSize(FM);
if(size==FM) {
tft.setTextSize(FM);
tft.setCursor(WIDTH/2 - FM*3*text.length(), HEIGHT/2-8);
}
else {
tft.setTextSize(FP);
tft.setCursor(WIDTH/2 - FP*3*text.length(), HEIGHT/2-8);
}
}
tft.println(text);
}

Expand All @@ -68,14 +68,14 @@ void displayInfo(String txt) { displayRedStripe(txt, TFT_WHITE, TFT_BLUE); }
void displaySuccess(String txt) { displayRedStripe(txt, TFT_WHITE, TFT_DARKGREEN); }

/*********************************************************************
** Function: loopOptions
** Function: loopOptions
** Where you choose among the options in menu
**********************************************************************/
void loopOptions(const std::vector<std::pair<std::string, std::function<void()>>>& options, bool bright, bool submenu, String subText){
bool redraw = true;
int index = 0;
while(1){
if (redraw) {
if (redraw) {
if(submenu) drawSubmenu(index, options, subText);
else drawOptions(index, options, FGCOLOR, BGCOLOR);
if(bright){
Expand All @@ -87,11 +87,11 @@ void loopOptions(const std::vector<std::pair<std::string, std::function<void()>>
#endif
}
redraw=false;
delay(200);
delay(200);
}

if(checkPrevPress()) {
#ifdef CARDPUTER
#ifdef CARDPUTER
if(index==0) index = options.size() - 1;
else if(index>0) index--;
redraw = true;
Expand All @@ -100,14 +100,14 @@ void loopOptions(const std::vector<std::pair<std::string, std::function<void()>>
#endif
}
/* DW Btn to next item */
if(checkNextPress()) {
if(checkNextPress()) {
index++;
if((index+1)>options.size()) index = 0;
redraw = true;
}

/* Select and run function */
if(checkSelPress()) {
if(checkSelPress()) {
options[index].second();
break;
}
Expand All @@ -134,7 +134,7 @@ void progressHandler(int progress, size_t total) {
}
tft.fillRect(20, HEIGHT - 45, barWidth, 13, FGCOLOR);
#else

int barWidth = map(progress, 0, total, 0, 100);
if(barWidth <2) {
tft.fillRect(6, 6, WIDTH-12, HEIGHT-12, BGCOLOR);
Expand All @@ -156,7 +156,7 @@ void drawOptions(int index,const std::vector<std::pair<std::string, std::functio
if(options.size()>MAX_MENU_SIZE) menuSize = MAX_MENU_SIZE;

tft.fillRoundRect(WIDTH*0.15,HEIGHT/2-menuSize*(FM*8+4)/2 -5,WIDTH*0.7,(FM*8+4)*menuSize+10,5,bgcolor);

tft.setTextColor(fgcolor,bgcolor);
tft.setTextSize(FM);
tft.setCursor(WIDTH*0.15+5,HEIGHT/2-menuSize*(FM*8+4)/2);
Expand Down Expand Up @@ -227,6 +227,7 @@ void drawSubmenu(int index,const std::vector<std::pair<std::string, std::functio
}

void drawMainBorder() {
tft.fillScreen(BGCOLOR);
tft.fillScreen(BGCOLOR);
setTftDisplay(12, 12, FGCOLOR, 1, BGCOLOR);

Expand All @@ -236,7 +237,7 @@ void drawMainBorder() {
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);
Expand All @@ -249,12 +250,12 @@ void drawMainBorder() {
***************************************************************************************/
void drawMainMenu(int index) {
const int border = 10;
const uint16_t colors[6] = {
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(sdcardMounted ? FGCOLOR : TFT_DARKGREY),
static_cast<uint16_t>(FGCOLOR),
const uint16_t colors[6] = {
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(sdcardMounted ? FGCOLOR : TFT_DARKGREY),
static_cast<uint16_t>(FGCOLOR),
static_cast<uint16_t>(FGCOLOR)
};

Expand All @@ -276,7 +277,7 @@ void drawMainMenu(int index) {
case 3:
drawRfid(80,27);
break;
case 4:
case 4:
drawOther(80,27);
break;
case 5:
Expand All @@ -289,7 +290,7 @@ void drawMainMenu(int index) {
tft.drawChar('<',10,tft.height()/2+10);
tft.drawChar('>',tft.width()-(LW*FG+10),tft.height()/2+10);


}


Expand All @@ -302,23 +303,23 @@ int getBattery() {
#if defined(STICK_C_PLUS)
float b = axp192.GetBatVoltage();
percent = ((b - 3.0) / 1.2) * 100;

#else

#if defined(CARDPUTER)
uint8_t _batAdcCh = ADC1_GPIO10_CHANNEL;
uint8_t _batAdcUnit = 1;
#elif defined(STICK_C_PLUS2)
uint8_t _batAdcCh = ADC1_GPIO38_CHANNEL;
uint8_t _batAdcUnit = 1;
#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);
Expand Down Expand Up @@ -373,6 +374,7 @@ void drawWireguardStatus(int x, int y) {
***************************************************************************************/
#define MAX_ITEMS 7
void listFiles(int index, String fileList[][3]) {
tft.fillScreen(BGCOLOR);
tft.fillScreen(BGCOLOR);
tft.drawRoundRect(5, 5, WIDTH - 10, HEIGHT - 10, 5, FGCOLOR);
tft.setCursor(10,10);
Expand All @@ -385,7 +387,7 @@ void listFiles(int index, String fileList[][3]) {
start=index-MAX_ITEMS+1;
if(start<0) start=0;
}

while(i<arraySize) {
if(i>=start && fileList[i][2]!="") {
tft.setCursor(10,tft.getCursorY());
Expand All @@ -396,7 +398,7 @@ void listFiles(int index, String fileList[][3]) {
if (index==i) tft.print(">");
else tft.print(" ");
tft.println(fileList[i][0].substring(0,17));

}
i++;
if (i==(start+MAX_ITEMS) || fileList[i][2]=="") break;
Expand Down
10 changes: 10 additions & 0 deletions src/core/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern char16_t FGCOLOR;
#include <Timezone.h>
#include <ESP32Time.h>
#include <EEPROM.h>
#include <ArduinoJson.h>

#if defined (STICK_C_PLUS) || defined (STICK_C)
#include <AXP192.h>
Expand Down Expand Up @@ -78,3 +79,12 @@ void readFGCOLORFromEEPROM();
void backToMenu();

void updateTimeStr(struct tm timeInfo);

extern JsonDocument settings;
extern unsigned long dimmerTemp;
extern int dimmerSet;
extern int bright;
extern bool dimmer;
extern String wui_usr;
extern String wui_pwd;
extern int tmz;
Loading

0 comments on commit 330490f

Please sign in to comment.