From 330490f76806bf3ae2906581af354de14f2cbbbf Mon Sep 17 00:00:00 2001 From: Rennan Cockles Date: Mon, 22 Jul 2024 14:32:26 -0300 Subject: [PATCH] sync with pr3y/main --- deauth_setup.bat | 10 -- deauth_setup.sh | 11 -- platformio.ini | 8 +- src/core/display.cpp | 56 ++++---- src/core/globals.h | 10 ++ src/core/settings.cpp | 195 +++++++++++++++++++++++++--- src/core/settings.h | 4 + src/core/wg.cpp | 20 +-- src/core/wifi_common.cpp | 58 +++++++-- src/main.cpp | 14 +- src/modules/ble/ble_spam.cpp | 3 +- src/modules/others/TV-B-Gone.cpp | 30 +++-- src/modules/others/WORLD_IR_CODES.h | 2 +- src/modules/others/webInterface.h | 50 +++---- src/modules/rf/rf.cpp | 83 ++++++------ src/modules/wifi/wifi_atks.h | 12 +- 16 files changed, 392 insertions(+), 174 deletions(-) diff --git a/deauth_setup.bat b/deauth_setup.bat index f4a755edb..0fb11fa61 100644 --- a/deauth_setup.bat +++ b/deauth_setup.bat @@ -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\framework-arduinoespressif32@3.20014.231204\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\framework-arduinoespressif32@3.20014.231204\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%" @@ -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 diff --git a/deauth_setup.sh b/deauth_setup.sh index 346152f3c..8504357aa 100755 --- a/deauth_setup.sh +++ b/deauth_setup.sh @@ -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/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_temp2="$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" @@ -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." diff --git a/platformio.ini b/platformio.ini index 0fcd0029e..b5d444f32 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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 @@ -31,6 +33,7 @@ lib_deps = NTPClient Timezone ESP32Time + bblanchon/ArduinoJson [env:m5stack-cplus2] @@ -164,7 +167,6 @@ lib_deps = [env:m5stack-cardputer] platform = espressif32 -platform_packages=framework-arduinoespressif32@3.20014 board = m5stack-stamps3 framework = arduino board_build.partitions = custom_8Mb.csv diff --git a/src/core/display.cpp b/src/core/display.cpp index c0050eee7..93acfb102 100644 --- a/src/core/display.cpp +++ b/src/core/display.cpp @@ -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); } @@ -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>>& 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){ @@ -87,11 +87,11 @@ void loopOptions(const std::vector> #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; @@ -100,14 +100,14 @@ void loopOptions(const std::vector> #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; } @@ -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); @@ -156,7 +156,7 @@ void drawOptions(int index,const std::vectorMAX_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); @@ -227,6 +227,7 @@ void drawSubmenu(int index,const std::vector(FGCOLOR), - static_cast(FGCOLOR), - static_cast(FGCOLOR), - static_cast(sdcardMounted ? FGCOLOR : TFT_DARKGREY), - static_cast(FGCOLOR), + const uint16_t colors[6] = { + static_cast(FGCOLOR), + static_cast(FGCOLOR), + static_cast(FGCOLOR), + static_cast(sdcardMounted ? FGCOLOR : TFT_DARKGREY), + static_cast(FGCOLOR), static_cast(FGCOLOR) }; @@ -276,7 +277,7 @@ void drawMainMenu(int index) { case 3: drawRfid(80,27); break; - case 4: + case 4: drawOther(80,27); break; case 5: @@ -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); - + } @@ -302,9 +303,9 @@ 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; @@ -312,13 +313,13 @@ int getBattery() { 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); @@ -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); @@ -385,7 +387,7 @@ void listFiles(int index, String fileList[][3]) { start=index-MAX_ITEMS+1; if(start<0) start=0; } - + while(i=start && fileList[i][2]!="") { tft.setCursor(10,tft.getCursorY()); @@ -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; diff --git a/src/core/globals.h b/src/core/globals.h index e0b913f50..b76cc951a 100644 --- a/src/core/globals.h +++ b/src/core/globals.h @@ -15,6 +15,7 @@ extern char16_t FGCOLOR; #include #include #include +#include #if defined (STICK_C_PLUS) || defined (STICK_C) #include @@ -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; \ No newline at end of file diff --git a/src/core/settings.cpp b/src/core/settings.cpp index a29c2f8e7..8eab7f196 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -3,27 +3,55 @@ #include "display.h" // calling loopOptions(options, true); #include "wifi_common.h" #include "mykeyboard.h" +#include "sd_functions.h" #include +/* +EEPROM ADDRESSES MAP +0 Rotation 16 32 Pass 48 Pass 64 Pass 80 Pass 96 112 +1 Dim(N/L) 17 33 Pass 49 Pass 65 Pass 81 Pass 97 113 +2 Bright 18 34 Pass 50 Pass 66 Pass 82 Pass 98 114 +3 - 19 35 Pass 51 Pass 67 Pass 83 Pass 99 115 +4 - 20 Pass 36 Pass 52 Pass 68 Pass 84 Pass 100 116 +5 - 21 Pass 37 Pass 53 Pass 69 Pass 85 101 117 +6 IrTX 22 Pass 38 Pass 54 Pass 70 Pass 86 102 118 (L-odd) +7 IrRx 23 Pass 39 Pass 55 Pass 71 Pass 87 103 119 (L-odd) +8 RfTX 24 Pass 40 Pass 56 Pass 72 Pass 88 104 120 (L-even) +9 RfRx 25 Pass 41 Pass 57 Pass 73 Pass 89 105 121 (L-even) +10 TimeZone 26 Pass 42 Pass 58 Pass 74 Pass 90 106 122 (L-BGCOLOR) +11 FGCOLOR 27 Pass 43 Pass 59 Pass 75 Pass 91 107 123 (L-BGCOLOR) +12 FGCOLOR 28 Pass 44 Pass 60 Pass 76 Pass 92 108 124 (L-FGCOLOR) +13 29 Pass 45 Pass 61 Pass 77 Pass 93 109 125 (L-FGCOLOR) +14 30 Pass 46 Pass 62 Pass 78 Pass 94 110 126 (L-AskSpiffs) +15 31 Pass 47 Pass 63 Pass 79 Pass 95 111 127 (L-OnlyBins) + +From 1 to 5: Nemo shared addresses +(L -*) stands for Launcher addresses + + + +*/ + /********************************************************************* ** Function: setBrightness ** save brightness value into EEPROM **********************************************************************/ -void setBrightness(int bright, bool save) { +void setBrightness(int brightval, bool save) { if(bright>100) bright=100; #if !defined(STICK_C_PLUS) - int bl = MINBRIGHT + round(((255 - MINBRIGHT) * bright/100 )); + int bl = MINBRIGHT + round(((255 - MINBRIGHT) * brightval/100 )); analogWrite(BACKLIGHT, bl); #else - axp192.ScreenBreath(bright); + axp192.ScreenBreath(brightval); #endif + bright=brightval; EEPROM.begin(EEPROMSIZE); // open eeprom - EEPROM.write(2, bright); //set the byte + EEPROM.write(2, brightval); //set the byte EEPROM.commit(); // Store data to EEPROM EEPROM.end(); // Free EEPROM memory } @@ -34,7 +62,7 @@ void setBrightness(int bright, bool save) { **********************************************************************/ void getBrightness() { EEPROM.begin(EEPROMSIZE); - int bright = EEPROM.read(2); + bright = EEPROM.read(2); EEPROM.end(); // Free EEPROM memory if(bright>100) { bright = 100; @@ -142,18 +170,23 @@ void setUIColor(){ //int color = EEPROM.read(5); options = { - {"Default", [&]() { FGCOLOR=TFT_PURPLE+0x3000;EEPROM.write(5,0);EEPROM.commit(); }}, - {"White", [&]() { FGCOLOR=TFT_WHITE; EEPROM.write(5,1);EEPROM.commit(); }}, - {"Red", [&]() { FGCOLOR=TFT_RED; EEPROM.write(5,2);EEPROM.commit(); }}, - {"Green", [&]() { FGCOLOR=TFT_DARKGREEN; EEPROM.write(5,3);EEPROM.commit(); }}, - {"Blue", [&]() { FGCOLOR=TFT_BLUE; EEPROM.write(5,4);EEPROM.commit(); }}, - {"Yellow", [&]() { FGCOLOR=TFT_YELLOW; EEPROM.write(5,5);EEPROM.commit(); }}, - {"Magenta", [&]() { FGCOLOR=TFT_MAGENTA; EEPROM.write(5,6);EEPROM.commit(); }}, - {"Orange", [&]() { FGCOLOR=TFT_ORANGE; EEPROM.write(5,7);EEPROM.commit(); }}, + {"Default", [&]() { FGCOLOR=0xA80F; }}, + {"White", [&]() { FGCOLOR=TFT_WHITE; }}, + {"Red", [&]() { FGCOLOR=TFT_RED; }}, + {"Green", [&]() { FGCOLOR=TFT_DARKGREEN; }}, + {"Blue", [&]() { FGCOLOR=TFT_BLUE; }}, + {"Yellow", [&]() { FGCOLOR=TFT_YELLOW; }}, + {"Magenta", [&]() { FGCOLOR=TFT_MAGENTA; }}, + {"Orange", [&]() { FGCOLOR=TFT_ORANGE; }}, }; delay(200); loopOptions(options); tft.setTextColor(TFT_BLACK, FGCOLOR); + + EEPROM.begin(EEPROMSIZE); + EEPROM.write(11, int((FGCOLOR >> 8) & 0x00FF)); + EEPROM.write(12, int(FGCOLOR & 0x00FF)); + EEPROM.commit(); EEPROM.end(); } @@ -171,7 +204,7 @@ void setClock() { if (auto_mode) { if(!wifiConnected) wifiConnectMenu(); - int tmz; + loopOptions(options); options = { {"Brasilia", [&]() { timeClient.setTimeOffset(-3 * 3600); tmz=0; }}, @@ -187,7 +220,7 @@ void setClock() { delay(200); loopOptions(options); EEPROM.begin(EEPROMSIZE); // open eeprom - EEPROM.write(8, tmz); // set the byte + EEPROM.write(10, tmz); // set the byte EEPROM.commit(); // Store data to EEPROM EEPROM.end(); // Free EEPROM memory @@ -371,7 +404,7 @@ int gsetIrTxPin(bool set){ **********************************************************************/ int gsetIrRxPin(bool set){ EEPROM.begin(EEPROMSIZE); - int result = EEPROM.read(63); + int result = EEPROM.read(7); if(result>36) result = GROVE_SCL; if(set) { options = { @@ -388,7 +421,7 @@ int gsetIrRxPin(bool set){ delay(200); loopOptions(options); delay(200); - EEPROM.write(63, result); + EEPROM.write(7, result); EEPROM.commit(); } EEPROM.end(); @@ -403,7 +436,7 @@ int gsetIrRxPin(bool set){ **********************************************************************/ int gsetRfTxPin(bool set){ EEPROM.begin(EEPROMSIZE); - int result = EEPROM.read(7); + int result = EEPROM.read(8); if(result>36) result = GROVE_SDA; if(set) { options = { @@ -417,7 +450,7 @@ int gsetRfTxPin(bool set){ delay(200); loopOptions(options); delay(200); - EEPROM.write(7, result); // Left rotation + EEPROM.write(8, result); EEPROM.commit(); } EEPROM.end(); @@ -431,7 +464,7 @@ int gsetRfTxPin(bool set){ **********************************************************************/ int gsetRfRxPin(bool set){ EEPROM.begin(EEPROMSIZE); - int result = EEPROM.read(7); + int result = EEPROM.read(9); if(result>36) result = GROVE_SCL; if(set) { options = { @@ -445,7 +478,7 @@ int gsetRfRxPin(bool set){ delay(200); loopOptions(options); delay(200); - EEPROM.write(7, result); // Left rotation + EEPROM.write(9, result); // Left rotation EEPROM.commit(); } EEPROM.end(); @@ -453,3 +486,123 @@ int gsetRfRxPin(bool set){ RfRx = result; return result; } + +void getConfigs() { + + if(setupSdCard()) { + if(!SD.exists(CONFIG_FILE)) { + File conf = SD.open(CONFIG_FILE, FILE_WRITE); + if(conf) { + #if ROTATION >1 + conf.print("[{\"rot\":3,\"dimmerSet\":10,\"bright\":100,\"wui_usr\":\"admin\",\"wui_pwd\":\"bruce\",\"Bruce_FGCOLOR\":43023,\"IrTx\":"+String(LED)+",\"IrRx\":"+String(GROVE_SCL)+",\"RfTx\":"+String(GROVE_SDA)+",\"RfRx\":"+String(GROVE_SCL)+",\"tmz\":3,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]"); + #else + conf.print("[{\"rot\":1,\"dimmerSet\":10,\"bright\":100,\"wui_usr\":\"admin\",\"wui_pwd\":\"bruce\",\"Bruce_FGCOLOR\":43023,\"IrTx\":"+String(LED)+",\"IrRx\":"+String(GROVE_SCL)+",\"RfTx\":"+String(GROVE_SDA)+",\"RfRx\":"+String(GROVE_SCL)+",\"tmz\":3,\"wifi\":[{\"ssid\":\"myNetSSID\",\"pwd\":\"myNetPassword\"}]}]"); + #endif + } + conf.close(); + delay(50); + } else log_i("getConfigs: config.conf exists"); + File file = SD.open(CONFIG_FILE, FILE_READ); + if(file) { + // Deserialize the JSON document + DeserializationError error = deserializeJson(settings, file); + if (error) { + log_i("Failed to read file, using default configuration"); + goto Default; + } else log_i("getConfigs: deserialized correctly"); + + int count=0; + JsonObject setting = settings[0]; + if(setting.containsKey("bright")) { bright = setting["bright"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("dimmerSet")) { dimmerSet = setting["dimmerSet"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("rot")) { rotation = setting["rot"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("Bruce_FGCOLOR")) { FGCOLOR = setting["Bruce_FGCOLOR"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("wui_usr")) { wui_usr = setting["wui_usr"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("wui_pwd")) { wui_pwd = setting["wui_pwd"].as(); } else { count++; log_i("Fail"); } + + if(setting.containsKey("IrTx")) { IrTx = setting["IrTx"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("IrRx")) { IrRx = setting["IrRx"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("RfTx")) { RfTx = setting["RfTx"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("RfRx")) { RfRx = setting["RfRx"].as(); } else { count++; log_i("Fail"); } + if(setting.containsKey("tmz")) { tmz = setting["tmz"].as(); } else { count++; log_i("Fail"); } + + if(!setting.containsKey("wifi")) { count++; log_i("Fail"); } + if(count>0) saveConfigs(); + + log_i("Brightness: %d", bright); + setBrightness(bright); + if(dimmerSet<10) dimmerSet=10; + file.close(); + + EEPROM.begin(EEPROMSIZE); // open eeprom + EEPROM.write(0, rotation); + EEPROM.write(1, dimmerSet); + EEPROM.write(2, bright); + + EEPROM.write(6, IrTx); + EEPROM.write(7, IrRx); + EEPROM.write(8, RfTx); + EEPROM.write(9, RfRx); + EEPROM.write(10, tmz); + EEPROM.write(11, int((FGCOLOR >> 8) & 0x00FF)); + EEPROM.write(12, int(FGCOLOR & 0x00FF)); + + if(!EEPROM.commit()) log_i("fail to write EEPROM"); // Store data to EEPROM + EEPROM.end(); + log_i("Using config.conf setup file"); + } else { +Default: + saveConfigs(); + + log_i("Using settings stored on EEPROM"); + } + } + else { + Serial.println("Sd Unmounted. Using settings stored on EEPROM"); + } +Serial.println("Enf o Config"); +} +/********************************************************************* +** Function: saveConfigs +** save configs into JSON config.conf file +**********************************************************************/ +void saveConfigs() { + // Delete existing file, otherwise the configuration is appended to the file + if(setupSdCard()) { + JsonObject setting = settings[0]; + setting["bright"] = bright; + setting["dimmerSet"] = dimmerSet; + setting["rot"] = rotation; + setting["Bruce_FGCOLOR"] = FGCOLOR; + setting["wui_usr"] = wui_usr; + setting["wui_pwd"] = wui_pwd; + setting["IrTx"] = IrTx; + setting["IrRx"] = IrRx; + setting["RfTx"] = RfTx; + setting["RfRx"] = RfRx; + setting["tmz"] = tmz; + if(!setting.containsKey("wifi")) { + JsonArray WifiList = setting["wifi"].to(); + if(WifiList.size()<1) { + JsonObject WifiObj = WifiList.add(); + WifiObj["ssid"] = "myNetSSID"; + WifiObj["pwd"] = "myNetPassword"; + } + } + // Open file for writing + File file = SD.open(CONFIG_FILE, FILE_WRITE); + if (!file) { + log_i("Failed to create file"); + file.close(); + return; + } else log_i("config.conf created"); + // Serialize JSON to file + serializeJsonPretty(settings,Serial); + if (serializeJsonPretty(settings, file) < 5) { + log_i("Failed to write to file"); + } else log_i("config.conf written successfully"); + + // Close the file + file.close(); + } +} \ No newline at end of file diff --git a/src/core/settings.h b/src/core/settings.h index d2f26b6ae..11b098fd7 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -25,3 +25,7 @@ int gsetIrRxPin(bool set = false); int gsetRfTxPin(bool set = false); int gsetRfRxPin(bool set = false); + +void getConfigs(); + +void saveConfigs(); \ No newline at end of file diff --git a/src/core/wg.cpp b/src/core/wg.cpp index 7b0ef2160..9c7bd2718 100644 --- a/src/core/wg.cpp +++ b/src/core/wg.cpp @@ -9,8 +9,8 @@ char private_key[45]; IPAddress local_ip; char public_key[45]; char endpoint_address[16]; -int endpoint_port = 31337; -bool isConnectedWireguard = false; +int endpoint_port = 31337; +bool isConnectedWireguard = false; static constexpr const uint32_t UPDATE_INTERVAL_MS = 5000; @@ -18,8 +18,8 @@ static WireGuard wg; /********************************************************************* -** Function: parse_config_file -** parses wireguard config file wg.conf +** Function: parse_config_file +** parses wireguard config file wg.conf **********************************************************************/ void parse_config_file(File configFile) { String line; @@ -44,7 +44,7 @@ void parse_config_file(File configFile) { line.trim(); Serial.println("Local IP: " + line); int slashIndex = line.indexOf('/'); - + if (slashIndex != -1) { Serial.println("~~~~~~~~~~~~"); Serial.println(line.substring(0, slashIndex)); @@ -82,8 +82,8 @@ void parse_config_file(File configFile) { /********************************************************************* -** Function: read_and_parse_file -** tries to open file wg.conf on local SD +** Function: read_and_parse_file +** tries to open file wg.conf on local SD **********************************************************************/ void read_and_parse_file() { sdcardSPI.begin(SDCARD_SCK, SDCARD_MISO, SDCARD_MOSI, SDCARD_CS); @@ -119,15 +119,15 @@ void read_and_parse_file() { /********************************************************************* -** Function: wg_setup -** connect to wireguard tunnel +** Function: wg_setup +** connect to wireguard tunnel **********************************************************************/ void wg_setup() { if(!wifiConnected) wifiConnectMenu(); read_and_parse_file(); - + Serial.println("Adjusting system time..."); diff --git a/src/core/wifi_common.cpp b/src/core/wifi_common.cpp index 36864e40e..d68ceffdd 100644 --- a/src/core/wifi_common.cpp +++ b/src/core/wifi_common.cpp @@ -2,6 +2,7 @@ #include "wifi_common.h" #include "mykeyboard.h" // usinf keyboard when calling rename #include "display.h" // using displayRedStripe and loop options +#include "settings.h" /*************************************************************************************** @@ -12,18 +13,59 @@ bool wifiConnect(String ssid, int encryptation, bool isAP) { if(!isAP) { int tmz; EEPROM.begin(EEPROMSIZE); - tmz = EEPROM.read(8); // read timezone + tmz = EEPROM.read(10); // read timezone if(tmz>8) tmz=0; + bool found = false; + bool wrongPass = false; + getConfigs(); + JsonObject setting = settings[0]; + JsonArray WifiList = setting["wifi"].as(); + + pwd = EEPROM.readString(20); //password + + if (sdcardMounted) { + for (JsonObject wifiEntry : WifiList) { + String name = wifiEntry["ssid"].as(); + String pass = wifiEntry["pwd"].as(); + log_i("SSID: %s, Pass: %s", name, pass); + if (name == ssid) { + pwd = pass; + found = true; + log_i("Found SSID: %s", name); + break; + } + } + } - pwd = EEPROM.readString(10); //password - - delay(200); - if(encryptation>0) pwd = keyboard(pwd,63, "Network Password:"); + Retry: + if (!found || wrongPass) { + delay(200); + if (encryptation > 0) pwd = keyboard(pwd, 63, "Network Password:"); - if (pwd!=EEPROM.readString(10)) { //43 - EEPROM.writeString(10, pwd); //43 - EEPROM.commit(); // Store data to EEPROM + EEPROM.begin(EEPROMSIZE); + if (pwd != EEPROM.readString(20)) { + EEPROM.writeString(20, pwd); + EEPROM.commit(); // Store data to EEPROM + } EEPROM.end(); // Free EEPROM memory + if (sdcardMounted && !found) { + // Cria um novo objeto JSON para adicionar ao array "wifi" + JsonObject newWifi = WifiList.add(); + newWifi["ssid"] = ssid; + newWifi["pwd"] = pwd; + found=true; + saveConfigs(); + } else if (sdcardMounted && found && wrongPass) { + for (JsonObject wifiEntry : WifiList) { + if (wifiEntry["ssid"].as() == ssid) { + wifiEntry["pwd"] = pwd; + log_i("Mudou pwd de SSID: %s", ssid); + break; + } + } + saveConfigs(); + } + } drawMainBorder(); diff --git a/src/main.cpp b/src/main.cpp index 4f9d17c31..a9f03ef3a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,9 @@ int IrTx; int IrRx; int RfTx; int RfRx; +int dimmerSet=10; +int bright=100; +int tmz=3; bool sdcardMounted; bool wifiConnected; bool BLEConnected; @@ -23,7 +26,10 @@ time_t localTime; struct tm* timeInfo; ESP32Time rtc; bool clock_set = false; +JsonDocument settings; +String wui_usr="admin"; +String wui_pwd="bruce"; String ssid; String pwd; std::vector>> options; @@ -127,8 +133,9 @@ void setup() { gsetRfTxPin(); gsetRfRxPin(); readFGCOLORFromEEPROM(); + //Start Bootscreen timer - int i = millis(); + bool change=false; tft.setTextColor(FGCOLOR, TFT_BLACK); tft.setTextSize(FM); @@ -138,7 +145,10 @@ void setup() { tft.setTextSize(FM); if(!LittleFS.begin(true)) { LittleFS.format(), LittleFS.begin();} - + getConfigs(); + Serial.println("Enf o Config2"); + int i = millis(); + Serial.println("Enf o Config3"); while(millis()2000) && (millis()-i)<2200) tft.fillScreen(TFT_BLACK); if((millis()-i>2200) && (millis()-i)<2700) tft.drawRect(160,50,2,2,FGCOLOR); diff --git a/src/modules/ble/ble_spam.cpp b/src/modules/ble/ble_spam.cpp index 8851a3aa5..087898524 100644 --- a/src/modules/ble/ble_spam.cpp +++ b/src/modules/ble/ble_spam.cpp @@ -1,8 +1,7 @@ - -#include "ble_spam.h" #include "core/display.h" #include "core/mykeyboard.h" #include "core/globals.h" +#include "ble_spam.h" /* extern "C" { uint8_t esp_base_mac_addr[6]; diff --git a/src/modules/others/TV-B-Gone.cpp b/src/modules/others/TV-B-Gone.cpp index f7f1875b8..a325aede6 100644 --- a/src/modules/others/TV-B-Gone.cpp +++ b/src/modules/others/TV-B-Gone.cpp @@ -411,53 +411,66 @@ void sendNECCommand(String address, String command) { IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); - uint32_t addressValue = strtoul(address.c_str(), nullptr, 16); - uint32_t commandValue = strtoul(command.c_str(), nullptr, 16); - irsend.sendNEC(addressValue, commandValue, 32); + //uint32_t addressValue = strtoul(address.c_str(), nullptr, 16); + //uint32_t commandValue = strtoul(command.c_str(), nullptr, 16); + //irsend.sendNEC(addressValue, commandValue, 32); + uint8_t first_zero_byte_pos = address.indexOf("00", 2); + if(first_zero_byte_pos!=-1) address = address.substring(0, first_zero_byte_pos); + first_zero_byte_pos = command.indexOf("00", 2); + if(first_zero_byte_pos!=-1) command = command.substring(0, first_zero_byte_pos); + uint16_t addressValue = strtoul(address.c_str(), nullptr, 16); + uint16_t commandValue = strtoul(command.c_str(), nullptr, 16); + uint64_t data = irsend.encodeNEC(addressValue, commandValue); + irsend.sendNEC(data, 32, 10); Serial.println("Sent1"); + digitalWrite(IrTx, LED_OFF); } void sendNECextCommand(String address, String command) { - IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. + IRsend irsend(IrTx); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); uint32_t addressValue = strtoul(address.c_str(), nullptr, 16); uint32_t commandValue = strtoul(command.c_str(), nullptr, 16); irsend.sendNEC(addressValue, commandValue, 32); Serial.println("Sent2"); + digitalWrite(IrTx, LED_OFF); } void sendRC5Command(String address, String command) { - IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. + IRsend irsend(IrTx); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); uint32_t addressValue = strtoul(address.c_str(), nullptr, 16); uint32_t commandValue = strtoul(command.c_str(), nullptr, 16); irsend.sendRC5(addressValue, commandValue, 12); Serial.println("Sent3"); + digitalWrite(IrTx, LED_OFF); } void sendSamsungCommand(String address, String command) { - IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. + IRsend irsend(IrTx); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); uint64_t data = ((uint64_t)strtoul(address.c_str(), nullptr, 16) << 32) | strtoul(command.c_str(), nullptr, 16); irsend.sendSamsung36(data, 36); Serial.println("Sent4"); + digitalWrite(IrTx, LED_OFF); } void sendSonyCommand(String address, String command) { - IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. + IRsend irsend(IrTx); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); uint16_t data = (uint16_t)strtoul(command.c_str(), nullptr, 16); uint16_t addressValue = (uint16_t)strtoul(address.c_str(), nullptr, 16); irsend.sendSony(addressValue, data); Serial.println("Sent5"); + digitalWrite(IrTx, LED_OFF); } void sendRawCommand(int frequency, String rawData) { - IRsend irsend(IrTx,true); // Set the GPIO to be used to sending the message. + IRsend irsend(IrTx); // Set the GPIO to be used to sending the message. irsend.begin(); displayRedStripe("Sending..",TFT_WHITE,FGCOLOR); uint16_t dataBuffer[IR_DATA_BUFFER_SIZE]; @@ -480,4 +493,5 @@ void sendRawCommand(int frequency, String rawData) { irsend.sendRaw(dataBuffer, count, frequency); Serial.println("Sent6"); + digitalWrite(IrTx, LED_OFF); } diff --git a/src/modules/others/WORLD_IR_CODES.h b/src/modules/others/WORLD_IR_CODES.h index 689fc2e79..b2f7ffa9d 100644 --- a/src/modules/others/WORLD_IR_CODES.h +++ b/src/modules/others/WORLD_IR_CODES.h @@ -8557,7 +8557,7 @@ const struct IrCode code_eu140Code = { //const array (called "NApowerCodes") of const pointers to IrCode structs //-otherwise stated: "declare NApowerCodes as array of const pointers to const IrCode structs" -//-to confirm this, go to http://cdecl.org/ and paste "const int* const NApowerCodes[]", and you'll +//-to confirm this, go to http://cdecl.org/ and paste "const int* const NApowerCodes[]", and you'll // see it means "declare NApowerCodes as array of const pointer to const int" const IrCode* const NApowerCodes[] = { &code_na000Code, diff --git a/src/modules/others/webInterface.h b/src/modules/others/webInterface.h index c48c367b2..481b111d1 100644 --- a/src/modules/others/webInterface.h +++ b/src/modules/others/webInterface.h @@ -64,7 +64,7 @@ const char index_html[] PROGMEM = R"rawliteral( border-top-right-radius: 3px; border-bottom-right-radius: 3px; right: 0 - } + } .gg-folder { cursor: pointer; transform: scale(var(--ggs,1)) @@ -186,31 +186,31 @@ const char index_html[] PROGMEM = R"rawliteral( padding: 10px 0; border-bottom: 1px solid #7b007b; } - + table { width: 100%; border-collapse: collapse; border-bottom: 1px solid #7b007b; } - + th, td { padding: 5px; border-bottom: 1px solid #7b007b; } - + th { text-align: left; } - + a { color: #ffbee0; text-decoration: none; } - + a:hover { text-decoration: underline; } - + button { background-color: #303134; color: #ff3ec8; @@ -221,29 +221,29 @@ const char index_html[] PROGMEM = R"rawliteral( cursor: pointer; margin: 5px; } - + button:hover { background-color: #ffabd7; } - + #detailsheader, #updetailsheader { display: flex; justify-content: space-between; } - + @media (max-width: 768px) { body { font-size: 14px; } - + table { font-size: 12px; } - + th, td { padding: 5px; } - + button { font-size: 12px; padding: 6px 12px; @@ -301,7 +301,7 @@ const char index_html[] PROGMEM = R"rawliteral(

Drag and drop files here

-
+

@@ -356,7 +356,7 @@ function listFilesButton(folders, fs = 'SD', userRequest = false) { }; xmlhttp.open("GET", "/listfiles?fs=" + fs + "&folder=" + folders, true); - xmlhttp.send(); + xmlhttp.send(); //must first select sd card or littlefs to get access to upload and create if (!buttonsInitialized) { @@ -366,7 +366,7 @@ function listFilesButton(folders, fs = 'SD', userRequest = false) { } else if (fs == 'LittleFS') { document.getElementById("detailsheader").innerHTML = "

LittleFS Files

"; } - + document.getElementById("updetailsheader").innerHTML = "

Folder Actions:

" document.getElementById("updetails").innerHTML = ""; _("drop-area").style.display = "block"; @@ -382,8 +382,8 @@ function listFilesButton(folders, fs = 'SD', userRequest = false) { } } } - - + + } function renameFile(filePath, oldName) { @@ -401,7 +401,7 @@ function renameFile(filePath, oldName) { ajax5.open("POST", "/rename", false); ajax5.send(formdata5); document.getElementById("status").innerHTML = ajax5.responseText; - + var fs = document.getElementById("actualFS").value; listFilesButton(actualFolder, fs, true); } @@ -438,7 +438,7 @@ function showCreateFolder(folders) { uploadform = "

Creating folder at: " + folders + ""+ "

" + - "" + + "" + "" + "" + "

"; @@ -446,7 +446,7 @@ function showCreateFolder(folders) { } function CreateFolder() { - var folderName = ""; + var folderName = ""; folderName = document.getElementById("folder").value + "/" + document.getElementById("foldername").value; downloadDeleteButton(folderName, 'create'); } @@ -457,7 +457,7 @@ function showUploadButtonFancy(folders) { var uploadform = "

Send file to " + folders + "

"+ "
" + - "" + + "" + "
" + "" + "

" + @@ -537,7 +537,7 @@ var currentFileIndex = 0; "

" + "

" + "
"; - document.getElementById("updetails").innerHTML = uploadform; + document.getElementById("updetails").innerHTML = uploadform; if (fileQueue.length > 0) { uploadNextFile(folder, fs); @@ -633,7 +633,7 @@ const char logout_html[] PROGMEM = R"rawliteral( color: #ad007b; background-color: #202124; } - + h3 { margin: 0; padding: 10px 0; @@ -655,4 +655,4 @@ document.write(unescape('%3C%68%74%6D%6C%3E%0A%3C%68%65%61%64%3E%0A%3C%74%69%74% //--> -)rawliteral"; +)rawliteral"; diff --git a/src/modules/rf/rf.cpp b/src/modules/rf/rf.cpp index 122c8d84a..914a9dd68 100644 --- a/src/modules/rf/rf.cpp +++ b/src/modules/rf/rf.cpp @@ -24,20 +24,26 @@ #define DISPLAY_HEIGHT 130 // Height of the display area for the waveform #define DISPLAY_WIDTH 240 // Width of the display area #define LINE_WIDTH 2 // Adjust line width as needed +// Global to magane rmt installation.. if it is installed twice, it breakes +bool RxRF = false; void initRMT() { rmt_config_t rxconfig; rxconfig.rmt_mode = RMT_MODE_RX; rxconfig.channel = RMT_RX_CHANNEL; rxconfig.gpio_num = gpio_num_t(RfRx); - //rxconfig.mem_block_num = RMT_BLOCK_NUM; - rxconfig.clk_div = RMT_CLK_DIV; - rxconfig.rx_config.filter_en = true; + rxconfig.clk_div = RMT_CLK_DIV; // RMT_DEFAULT_CLK_DIV=32 + rxconfig.mem_block_num = 1; + rxconfig.flags = 0; + rxconfig.rx_config.idle_threshold = 3 * RMT_1MS_TICKS, rxconfig.rx_config.filter_ticks_thresh = 200 * RMT_1US_TICKS; - rxconfig.rx_config.idle_threshold = 3 * RMT_1MS_TICKS; + rxconfig.rx_config.filter_en = true; + if(!RxRF) { //If spectrum had beed started before, it won't reinstall the driver to prevent mem alloc fail and restart. + ESP_ERROR_CHECK(rmt_config(&rxconfig)); + ESP_ERROR_CHECK(rmt_driver_install(rxconfig.channel, 2048, 0)); + RxRF=true; + } - ESP_ERROR_CHECK(rmt_config(&rxconfig)); - ESP_ERROR_CHECK(rmt_driver_install(rxconfig.channel, 2048, 0)); } bool sendRF = false; @@ -51,44 +57,38 @@ void rf_spectrum() { //@IncursioHack - https://github.com/IncursioHack ----thank pinMode(RfRx, INPUT); initRMT(); - RingbufHandle_t rb = nullptr; - rmt_get_ringbuf_handle(RMT_RX_CHANNEL, &rb); - rmt_rx_start(RMT_RX_CHANNEL, true); - while (rb) { - size_t rx_size = 0; - rmt_item32_t* item = (rmt_item32_t*)xRingbufferReceive(rb, &rx_size, 500); - if (item != nullptr) { - if (rx_size != 0) { - // Clear the display area - tft.fillRect(0, 20, DISPLAY_WIDTH, DISPLAY_HEIGHT, TFT_BLACK); - // Draw waveform based on signal strength - for (size_t i = 0; i < rx_size; i++) { - int lineHeight = map(item[i].duration0 + item[i].duration1, 0, SIGNAL_STRENGTH_THRESHOLD, 0, DISPLAY_HEIGHT/2); - int lineX = map(i, 0, rx_size - 1, 0, DISPLAY_WIDTH - 1); // Map i to within the display width - // Ensure drawing coordinates stay within the box bounds - int startY = constrain(20 + DISPLAY_HEIGHT / 2 - lineHeight / 2, 20, 20 + DISPLAY_HEIGHT); - int endY = constrain(20 + DISPLAY_HEIGHT / 2 + lineHeight / 2, 20, 20 + DISPLAY_HEIGHT); - tft.drawLine(lineX, startY, lineX, endY, TFT_PURPLE); - } + RingbufHandle_t rb = nullptr; + rmt_get_ringbuf_handle(RMT_RX_CHANNEL, &rb); + rmt_rx_start(RMT_RX_CHANNEL, true); + while (rb) { + size_t rx_size = 0; + rmt_item32_t* item = (rmt_item32_t*)xRingbufferReceive(rb, &rx_size, 500); + if (item != nullptr) { + if (rx_size != 0) { + // Clear the display area + tft.fillRect(0, 20, WIDTH, HEIGHT, TFT_BLACK); + // Draw waveform based on signal strength + for (size_t i = 0; i < rx_size; i++) { + int lineHeight = map(item[i].duration0 + item[i].duration1, 0, SIGNAL_STRENGTH_THRESHOLD, 0, HEIGHT/2); + int lineX = map(i, 0, rx_size - 1, 0, WIDTH - 1); // Map i to within the display width + // Ensure drawing coordinates stay within the box bounds + int startY = constrain(20 + HEIGHT / 2 - lineHeight / 2, 20, 20 + HEIGHT); + int endY = constrain(20 + HEIGHT / 2 + lineHeight / 2, 20, 20 + HEIGHT); + tft.drawLine(lineX, startY, lineX, endY, TFT_PURPLE); } - vRingbufferReturnItem(rb, (void*)item); } - if (checkEscPress()) { - rmt_rx_stop(RMT_RX_CHANNEL); - returnToMenu=true; - break; - } + vRingbufferReturnItem(rb, (void*)item); } - // Checks para sair do while - + // Checks to leave while + if (checkEscPress()) { + break; + } + } + returnToMenu=true; rmt_rx_stop(RMT_RX_CHANNEL); delay(10); - - - } - void rf_jammerFull() { //@IncursioHack - https://github.com/IncursioHack - thanks @EversonPereira - rfcardputer pinMode(RfTx, OUTPUT); tft.fillScreen(TFT_BLACK); @@ -133,13 +133,13 @@ void rf_jammerIntermittent() { //@IncursioHack - https://github.com/IncursioHack break; } digitalWrite(RfTx, HIGH); // Ativa o pino - // Mantém o pino ativo por um período que aumenta com cada sequência + // keeps the pin active for a while and increase increase for (int widthsize = 1; widthsize <= (1 + sequence); widthsize++) { delayMicroseconds(50); } digitalWrite(RfTx, LOW); // Desativa o pino - // Mantém o pino inativo pelo mesmo período + // keeps the pin inactive for the same time as before for (int widthsize = 1; widthsize <= (1 + sequence); widthsize++) { delayMicroseconds(50); } @@ -147,5 +147,8 @@ void rf_jammerIntermittent() { //@IncursioHack - https://github.com/IncursioHack } } - digitalWrite(RfTx, LOW); // Desativa o pino + digitalWrite(RfTx, LOW); // Deactivate pin } + + + diff --git a/src/modules/wifi/wifi_atks.h b/src/modules/wifi/wifi_atks.h index cd1d55a12..9d7cd98c9 100644 --- a/src/modules/wifi/wifi_atks.h +++ b/src/modules/wifi/wifi_atks.h @@ -1,6 +1,6 @@ #include -extern wifi_ap_record_t ap_record; +extern wifi_ap_record_t ap_record; // Default Drauth Frame const uint8_t deauth_frame_default[] = { @@ -15,19 +15,19 @@ extern uint8_t deauth_frame[]; // 26 = [sizeof(deauth_frame_default[])] /** * @brief Sends frame in frame_buffer using esp_wifi_80211_tx but bypasses blocking mechanism - * - * @param frame_buffer + * + * @param frame_buffer * @param size size of frame buffer */ void wsl_bypasser_send_raw_frame(const uint8_t *frame_buffer, int size); /** * @brief Sends deauthentication frame with forged source AP from given ap_record - * + * * This will send deauthentication frame acting as frame from given AP, and destination will be broadcast * MAC address - \c ff:ff:ff:ff:ff:ff - * - * @param ap_record AP record with valid AP information + * + * @param ap_record AP record with valid AP information * @param chan Channel of the targetted AP */ void wsl_bypasser_send_raw_frame(const wifi_ap_record_t *ap_record, uint8_t chan);