Skip to content

Commit

Permalink
Merge pull request #25 from bmorcelli/main
Browse files Browse the repository at this point in the history
Comments
  • Loading branch information
pr3y authored Jun 1, 2024
2 parents aa20ef0 + b92b5a8 commit 7d21487
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 160 deletions.
47 changes: 46 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,51 @@
"idf.portWin": "COM4",
"files.associations": {
"iosfwd": "cpp",
"iostream": "cpp"
"iostream": "cpp",
"array": "cpp",
"atomic": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"set": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"istream": "cpp",
"limits": "cpp",
"new": "cpp",
"ostream": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp"
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ For more information on each function supported by Bruce, [read our wiki here](h

## RFID
- [x] Read and Write
- [ ] Replay ?

## Others
- [x] TV-B-Gone
Expand Down
106 changes: 2 additions & 104 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ default_envs =
m5stack-cplus1_1
m5stack-cplus2
m5stack-cardputer
;m5stack-c

[common]
build_flags =
-DBRUCE_VERSION='"1.0b"'
-DBRUCE_VERSION='"1.0"'
-DMAXFILES=256
-DEEPROMSIZE=64
-DLH=8
Expand All @@ -31,6 +30,7 @@ lib_deps =
https://github.com/bmorcelli/ESPping/
NTPClient
Timezone
ESP32Time


[env:m5stack-cplus2]
Expand Down Expand Up @@ -225,105 +225,3 @@ build_flags =
lib_deps =
${common.lib_deps}
xylopyrographer/LiteLED@^1.2.0

[env:m5stack-c]
platform = espressif32
board = m5stick-c
framework = arduino
board_build.partitions = custom_4Mb.csv
build_flags =
${common.build_flags}
-DSTICK_C=1
-DSTICK_C_PLUS=1

-DROTATION=3
-DHAS_BTN=1
-DSEL_BTN=37
-DUP_BTN=0
-DDW_BTN=39
-DBTN_ALIAS='"M5"'

-DWIDTH=160
-DHEIGHT=80
-DMAX_MENU_SIZE=5
-DTFT_WIDTH=80
-DTFT_HEIGHT=160

-DLED=10
-DLED_ON=LOW
-DLED_OFF=HIGH


-DFP=1
-DFM=1
-DFG=2

-DSDCARD_SPI_BUS=HSPI
-DSDCARD_CS=14
-DSDCARD_SCK=0
-DSDCARD_MISO=36
-DSDCARD_MOSI=26

-DGROVE_SDA=32
-DGROVE_SCL=33
lib_deps =
${common.lib_deps}

[env:m5stack-c-test]
platform = espressif32
board = m5stack-stamps3
framework = arduino
board_build.partitions = custom_8Mb.csv
build_flags =
${common.build_flags}
-DSTICK_C=1
-DCARDPUTER=1
-DROTATION=1
-DHAS_BTN=1
-DMAX_SPIFFS=0x100000
-DMAX_APP=0x4F0000
-DBTN_ALIAS='"G0"'
-DBTN_PIN=0
-DHAS_SCREEN=1

-DWIDTH=160
-DHEIGHT=80
-DFP=1
-DFM=1
-DFG=3
-DBAT_PIN=10
-DLED=21
-DLED_ON=HIGH
-DLED_OFF=LOW
-DBACKLIGHT=38
-DMINBRIGHT=160
-DMAX_MENU_SIZE=5
-DUSER_SETUP_LOADED=1
-DST7789_2_DRIVER=1
-DTFT_RGB_ORDER=1
-DTFT_WIDTH=135
-DTFT_HEIGHT=240
-DTFT_BACKLIGHT_ON=1
-DTFT_BL=38
-DTFT_RST=33
-DTFT_DC=34
-DTFT_MOSI=35
-DTFT_SCLK=36
-DTFT_CS=37
-DTOUCH_CS=-1
-DLOAD_GFXFF=1
-DSMOOTH_FONT=1
-DSPI_FREQUENCY=20000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

-DSDCARD_SPI_BUS=FSPI
-DSDCARD_CS=12
-DSDCARD_SCK=40
-DSDCARD_MISO=39
-DSDCARD_MOSI=14

-DGROVE_SDA=32
-DGROVE_SCL=33
lib_deps =
${common.lib_deps}
2 changes: 1 addition & 1 deletion src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void drawMainBorder() {
tft.fillScreen(BGCOLOR);
setTftDisplay(12, 12, FGCOLOR, 1, BGCOLOR);

if(wifiConnected) {tft.print("timeStr");} else {tft.print("BRUCE 1.0b");}
// if(wifiConnected) {tft.print(timeStr);} else {tft.print("BRUCE 1.0b");}

int i=0;
if(wifiConnected) { drawWifiSmall(WIDTH - 90, 7); i++;} //Draw Wifi Symbol beside battery
Expand Down
5 changes: 5 additions & 0 deletions src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ while(1) {
void backToMenu() {
returnToMenu=true;
}

void updateTimeStr(struct tm timeInfo) {
// Atualiza timeStr com a hora e minuto
snprintf(timeStr, sizeof(timeStr), "%02d:%02d", timeInfo.tm_hour, timeInfo.tm_min);
}
12 changes: 11 additions & 1 deletion src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#include <vector>
//#include <SPIFFS.h>
#include <LittleFS.h>

#include <NTPClient.h>
#include <Timezone.h>
#include <ESP32Time.h>

#if defined (STICK_C_PLUS) || defined (STICK_C)
#include <AXP192.h>
Expand All @@ -29,6 +31,13 @@ extern TFT_eSprite draw;

extern char timeStr[10];

extern bool clock_set;
extern time_t localTime;
extern struct tm* timeInfo;
extern ESP32Time rtc;
extern NTPClient timeClient;
extern Timezone myTZ;

extern int prog_handler; // 0 - Flash, 1 - LittleFS, 2 - Download

extern bool sdcardMounted; // informa se o cartão está montado ou não, sem precisar chamar a função setupSdCard
Expand All @@ -55,3 +64,4 @@ extern bool returnToMenu; // variável para verificação e quebrar os loops

void backToMenu();

void updateTimeStr(struct tm timeInfo);
35 changes: 24 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ bool wifiConnected;
bool BLEConnected;
bool returnToMenu;
char timeStr[10];
time_t localTime;
struct tm* timeInfo;
ESP32Time rtc;
bool clock_set = false;

String ssid;
String pwd;
Expand Down Expand Up @@ -202,10 +206,10 @@ void loop() {
options.push_back({"TelNET", [=]() { telnet_setup(); }});
options.push_back({"SSH", [=]() { ssh_setup(); }});
options.push_back({"Raw Sniffer", [=]() { sniffer_setup(); }});
options.push_back({"DPWO-ESP32", [=]() { dpwo_setup(); }});
options.push_back({"DPWO", [=]() { dpwo_setup(); }});
options.push_back({"Evil Portal", [=]() { startEvilPortal(); }});
options.push_back({"Scan Hosts", [=]() { local_scan_setup(); }});
options.push_back({"Wireguard", [=]() { wg_setup(); }});
options.push_back({"Scan Hosts", [=]() { local_scan_setup(); }});
options.push_back({"Wireguard", [=]() { wg_setup(); }});
options.push_back({"Main Menu", [=]() { backToMenu(); }});
delay(200);
loopOptions(options,false,true,"WiFi");
Expand All @@ -225,8 +229,8 @@ void loop() {
break;
case 2: // RF
options = {
{"Scan/copy", [=]() { displayRedStripe("Scan/Copy"); }},
{"Replay", [=]() { displayRedStripe("Replay"); }},
//{"Scan/copy", [=]() { displayRedStripe("Scan/Copy"); }},
//{"Replay", [=]() { displayRedStripe("Replay"); }},
{"Spectrum", [=]() { rf_spectrum(); }}, //@IncursioHack
{"Main Menu", [=]() { backToMenu(); }},
};
Expand All @@ -236,28 +240,28 @@ void loop() {
break;
case 3: // RFID
options = {
{"Scan/copy", [=]() { rfid_setup(); }}, //@IncursioHack
{"Copy/Write", [=]() { rfid_setup(); }}, //@IncursioHack
//{"Replay", [=]() { displayRedStripe("Replay"); }},
{"Main Menu", [=]() { backToMenu(); }},
{"Main Menu", [=]() { backToMenu(); }},
};
delay(200);
loopOptions(options,false,true,"RFID");
break;
case 4: //Other
options = {
{"TV-B-Gone", [=]() { StartTvBGone(); }},
{"Custom IR", [=]() { otherIRcodes(); }},
{"Custom IR", [=]() { otherIRcodes(); }},
{"SD Card", [=]() { loopSD(SD); }},
{"LittleFS", [=]() { loopSD(LittleFS); }},
{"LittleFS", [=]() { loopSD(LittleFS); }},
{"WebUI", [=]() { loopOptionsWebUi(); }},
{"Megalodon", [=]() { shark_setup(); }},
};
#ifdef CARDPUTER
options.push_back({"BadUSB", [=]() { usb_setup(); }});
options.push_back({"LED Control", [=]() { ledrgb_setup(); }}); //IncursioHack
options.push_back({"LED FLash", [=]() { ledrgb_flash(); }}); // IncursioHack
#endif
options.push_back({"Openhaystack", [=]() { openhaystack_setup(); }});
#endif
options.push_back({"Main Menu", [=]() { backToMenu(); }});
delay(200);
loopOptions(options,false,true,"Others");
Expand All @@ -267,8 +271,8 @@ void loop() {
{"Brightness", [=]() { setBrightnessMenu(); }}, //settings.h
{"Clock", [=]() { setClock(); }},
{"Orientation", [=]() { gsetRotation(true); }}, //settings.h
{"Main Menu", [=]() { backToMenu(); }},
{"Restart", [=]() { ESP.restart(); }},
{"Main Menu", [=]() { backToMenu(); }},
};
delay(200);
loopOptions(options,false,true,"Config");
Expand All @@ -277,6 +281,15 @@ void loop() {
}
redraw=true;
}
if(clock_set) {
updateTimeStr(rtc.getTimeStruct());
setTftDisplay(12, 12, FGCOLOR, 1, BGCOLOR);
tft.print(timeStr);
}
else{
setTftDisplay(12, 12, FGCOLOR, 1, BGCOLOR);
tft.print("BRUCE " + String(BRUCE_VERSION));
}
}
}

Loading

0 comments on commit 7d21487

Please sign in to comment.