Skip to content

Commit

Permalink
Merge pull request #240 from bmorcelli/main
Browse files Browse the repository at this point in the history
New Framework and BLE Spam limit devices
  • Loading branch information
bmorcelli authored Sep 3, 2024
2 parents ec83edc + 7a7a6c9 commit 06a383b
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 284 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/buil_parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,43 +99,43 @@
sed -i "s/-DGIT_COMMIT_HASH='\"Homebrew\"'/\!echo '-DGIT_COMMIT_HASH=\\\\\\\\\"'\$\(git describe --always --dirty)'\\\\\\\\\"'/g" ./platformio.ini
- name: Setup PlatformIO for Deauth
run: |
pio pkg install -p espressif32 -t toolchain-xtensa32
# 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"
# 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"
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"
# 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"
# Definir caminhos para as ferramentas objcopy
toolchain_esp32="$HOME/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/bin/objcopy"
toolchain_esp32s3="$HOME/.platformio/packages/toolchain-xtensa-esp32s3/xtensa-esp32s3-elf/bin/objcopy"
# toolchain_esp32="$HOME/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/bin/objcopy"
# toolchain_esp32s3="$HOME/.platformio/packages/toolchain-xtensa-esp32s3/xtensa-esp32s3-elf/bin/objcopy"
# Verificar se os arquivos existem antes de executar os comandos
if [[ -f "$esp32_file" && -f "$esp32s3_file" ]]; then
# Execute objcopy commands for ESP32
$toolchain_esp32 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32_file" "$esp32_file_temp"
# if [[ -f "$esp32_file" && -f "$esp32s3_file" ]]; then
# # Execute objcopy commands for ESP32
# $toolchain_esp32 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32_file" "$esp32_file_temp"
# Rename the original file to .old
mv "$esp32_file" "${esp32_file}.old"
# # Rename the original file to .old
# mv "$esp32_file" "${esp32_file}.old"
# Rename the _temp to original
mv "$esp32_file_temp" "$esp32_file"
# # Rename the _temp to original
# mv "$esp32_file_temp" "$esp32_file"
# Execute objcopy commands for ESP32-S3
$toolchain_esp32s3 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32s3_file" "$esp32s3_file_temp"
# # Execute objcopy commands for ESP32-S3
# $toolchain_esp32s3 --weaken-symbol=ieee80211_raw_frame_sanity_check "$esp32s3_file" "$esp32s3_file_temp"
# Rename the original file to .old
mv "$esp32s3_file" "${esp32s3_file}.old"
# # Rename the original file to .old
# mv "$esp32s3_file" "${esp32s3_file}.old"
# Rename the _temp to original
mv "$esp32s3_file_temp" "$esp32s3_file"
# # Rename the _temp to original
# mv "$esp32s3_file_temp" "$esp32s3_file"
echo "Done."
else
echo "One or more specified files were not found."
exit 1
fi
# echo "Done."
# else
# echo "One or more specified files were not found."
# exit 1
# fi
- name: Run Compile
Expand Down
18 changes: 9 additions & 9 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ lib_deps =
;https://github.com/eadmaster/rtl_433_ESP

[env:m5stack-cplus2]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stick-c
framework = arduino
board_build.partitions = custom_8Mb.csv
Expand Down Expand Up @@ -187,7 +187,7 @@ lib_deps =
${common.lib_deps}

[env:m5stack-cplus1_1]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stick-c
framework = arduino
board_build.partitions = custom_4Mb.csv
Expand Down Expand Up @@ -299,7 +299,7 @@ lib_deps =


[env:m5stack-cardputer]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stack-stamps3
framework = arduino
board_build.partitions = custom_8Mb.csv
Expand Down Expand Up @@ -418,7 +418,7 @@ lib_deps =
xylopyrographer/LiteLED@^1.2.0

[env:m5stack-core2]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stick-c
framework = arduino
monitor_speed = 115200
Expand Down Expand Up @@ -541,7 +541,7 @@ lib_deps =
${common.lib_deps}

[env:m5stack-core16mb]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stack-core-esp32
framework = arduino
monitor_speed = 115200
Expand Down Expand Up @@ -664,7 +664,7 @@ lib_deps =
${common.lib_deps}

[env:m5stack-core4mb]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stack-core-esp32
framework = arduino
monitor_speed = 115200
Expand Down Expand Up @@ -784,7 +784,7 @@ lib_deps =


[env:esp32-s3-devkitc-1]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino
;board_build.partitions = custom_16Mb.csv
Expand Down Expand Up @@ -884,7 +884,7 @@ lib_deps =
${common.lib_deps}

[env:m5stack-cores3]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stack-cores3
framework = arduino
monitor_speed = 115200
Expand Down Expand Up @@ -1010,7 +1010,7 @@ lib_deps =

#New device model
[env:NewDeviceModel]
platform = espressif32
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
board = m5stack-stamps3
framework = arduino
board_build.partitions = custom_8Mb.csv
Expand Down
2 changes: 1 addition & 1 deletion src/core/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extern String fileToCopy;

extern int rotation;

extern uint8_t buff[4096];
extern uint8_t buff[1024];

extern const int bufSize;

Expand Down
30 changes: 13 additions & 17 deletions src/core/sd_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ bool renameFile(FS fs, String path, String filename) {
** Description: copy file from SD or LittleFS to LittleFS or SD
***************************************************************************************/
bool copyToFs(FS from, FS to, String path) {
// Tamanho do buffer para leitura/escrita
const size_t bufferSize = 1024; // Ajuste conforme necessário para otimizar a performance
uint8_t buffer[bufferSize];
// Using Global Buffer
bool result;

if (!SD.begin()) { result = false; Serial.println("Error 1"); }
Expand Down Expand Up @@ -168,8 +166,8 @@ bool copyToFs(FS from, FS to, String path) {
return false;
}
//tft.drawRect(5,HEIGHT-12, (WIDTH-10), 9, FGCOLOR);
while ((bytesRead = source.read(buffer, bufferSize)) > 0) {
if (dest.write(buffer, bytesRead) != bytesRead) {
while ((bytesRead = source.read(buff, bufSize)) > 0) {
if (dest.write(buff, bytesRead) != bytesRead) {
//Serial.println("Falha ao escrever no arquivo de destino");
source.close();
dest.close();
Expand Down Expand Up @@ -212,9 +210,7 @@ bool copyFile(FS fs, String path) {
** Description: paste file to new folder
***************************************************************************************/
bool pasteFile(FS fs, String path) {
// Tamanho do buffer para leitura/escrita
const size_t bufferSize = 1024; // Ajuste conforme necessário para otimizar a performance
uint8_t buffer[bufferSize];
//Using Global Buffer

// Abrir o arquivo original
File sourceFile = fs.open(fileToCopy, FILE_READ);
Expand All @@ -236,8 +232,8 @@ bool pasteFile(FS fs, String path) {
int tot=sourceFile.size();
int prog=0;
//tft.drawRect(5,HEIGHT-12, (WIDTH-10), 9, FGCOLOR);
while ((bytesRead = sourceFile.read(buffer, bufferSize)) > 0) {
if (destFile.write(buffer, bytesRead) != bytesRead) {
while ((bytesRead = sourceFile.read(buff, bufSize)) > 0) {
if (destFile.write(buff, bytesRead) != bytesRead) {
//Serial.println("Falha ao escrever no arquivo de destino");
sourceFile.close();
destFile.close();
Expand Down Expand Up @@ -359,18 +355,18 @@ String readDecryptedAesFile(FS &fs, String filepath) {
return "";
}

char buffer[fileSize];
size_t bytesRead = file.readBytes(buffer, fileSize);
char buff[fileSize];
size_t bytesRead = file.readBytes(buff, fileSize);
//Serial.print("fileSize:");
//Serial.println(fileSize);
//Serial.println(bytesRead);

/*
// read the whole file with a single call
char buffer[fileSize + 1];
size_t bytesRead = file.readBytes(buffer, fileSize);
buffer[bytesRead] = '\0'; // Null-terminate the string
return String(buffer);
char buff[fileSize + 1];
size_t bytesRead = file.readBytes(buff, fileSize);
buff[bytesRead] = '\0'; // Null-terminate the string
return String(buff);
*/

if (bytesRead==0) {
Expand All @@ -385,7 +381,7 @@ String readDecryptedAesFile(FS &fs, String filepath) {
}

// else try to decrypt
String plaintext = aes_decrypt((uint8_t*)buffer, bytesRead, cachedPassword);
String plaintext = aes_decrypt((uint8_t*)buff, bytesRead, cachedPassword);

// check if really plaintext
if(!is_valid_ascii(plaintext)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ String wui_pwd="bruce";
String ssid;
String pwd;
std::vector<Option> options;
const int bufSize = 4096;
uint8_t buff[4096] = {0};
const int bufSize = 1024;
uint8_t buff[1024] = {0};
// Protected global variables
#if defined(HAS_SCREEN)
#if defined(M5STACK) && !defined(CORE2) && !defined(CORE)
Expand Down
Loading

0 comments on commit 06a383b

Please sign in to comment.