Skip to content

Commit

Permalink
Merge pull request #320 from bmorcelli/main
Browse files Browse the repository at this point in the history
RawSniffer upgrade and WebUI changes
  • Loading branch information
pr3y authored Oct 7, 2024
2 parents 0a4b36a + 6c6add6 commit 02d5d8a
Show file tree
Hide file tree
Showing 8 changed files with 753 additions and 398 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/buil_parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
type: choice
required: true
default: 'M5Cardputer'
options: ['M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'Core2', 'Core16mb', 'Core4mb', 'CoreS3', 'ESP32-S3']
options: ['M5Cardputer', 'M5StickCPlus2', 'M5StickCPlus', 'Core2', 'Core16mb', 'Core4mb', 'CoreS3', 'ESP32-S3','M5StickCPlus_Full']

jobs:
compile_sketch:
Expand Down Expand Up @@ -48,6 +48,13 @@
bootloader_addr: "0x1000",
},
}
- {
name: "M5StickCPlus_Full",
env: "m5stack-cplus1_1-full",
partitions: {
bootloader_addr: "0x1000",
},
}
- {
name: "Core2",
env: "m5stack-core2",
Expand Down
4 changes: 2 additions & 2 deletions custom_4Mb_full.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
app0, app, ota_0, 0x10000, 0x2F0000,
spiffs, data, spiffs, 0x300000,0x100000,
app0, app, ota_0, 0x10000, 0x370000,
spiffs, data, spiffs, 0x380000,0x80000,
124 changes: 124 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,130 @@ build_flags =
lib_deps =
${common.lib_deps}

[env:m5stack-cplus1_1-full]
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_full.csv
build_flags =
${common.build_flags}
-Os
-DSTICK_C_PLUS=1

;Features Enabled
;-DLITE_VERSION=1 ;limits some features to save space for M5Launcher Compatibility
;FM Radio
-DFM_SI4713=1 ;Uncomment to activate FM Radio using Adafruit Si4713
-DFM_RSTPIN=0
;Microphone
-DMIC_SPM1423=1 ;Applicable for SPM1423 device
-DPIN_CLK=0
-DI2S_SCLK_PIN=0
-DI2S_DATA_PIN=34
-DPIN_DATA=34

;Have RTC Chip
-DHAS_RTC=1

;Have buzzer
-DBUZZ_PIN=2

;Can run USB as HID
;-DUSB_as_HID=1 ;uncomment to enable
;-DBAD_TX=25 ; Using pin header
;-DBAD_RX=26 ; Using pin header
-DBAD_TX=32 ; Using Grove
-DBAD_RX=33 ; Using Grove

;Buttons Setup
-DHAS_BTN=1
-DSEL_BTN=37
-DUP_BTN=0
-DDW_BTN=39
-DBTN_ACT=LOW
-DBTN_ALIAS='"M5"'

;-DALLOW_ALL_GPIO_FOR_IR_RF=1 ; Set this option to make use of all GPIOs, from 1 to 44 to be chosen, except TFT and SD pins

;Infrared Led default pin and state
-DIR_TX_PINS='{ {"Default", LED}, {"M5 IR Mod", GROVE_SDA}, {"G26",26}, {"G25",25}, {"G0",0}, {"Groove W", GROVE_SCL}, {"GROVE Y", GROVE_SDA}}'
-DIR_RX_PINS='{ {"M5 IR Mod", GROVE_SCL}, {"G26",26}, {"G25",25}, {"G0",0}, {"Groove W", GROVE_SCL}, {"GROVE Y", GROVE_SDA}}'
-DLED=9
-DLED_ON=LOW
-DLED_OFF=HIGH

;Radio Frequency (one pin modules) pin setting
-DRF_TX_PINS='{ {"M5 RF433T", GROVE_SDA}, {"G26",26}, {"G25",25}, {"G0",0}, {"Groove W", GROVE_SCL}, {"GROVE Y", GROVE_SDA}}'
-DRF_RX_PINS='{ {"M5 RF433R", GROVE_SCL}, {"G26",26}, {"G25",25}, {"G0",0}, {"Groove W", GROVE_SCL}, {"GROVE Y", GROVE_SDA}}'

; connection pins for CC1101 https://github.com/bmorcelli/io433/blob/master/platformio.ini
-DUSE_CC1101_VIA_SPI
-DCC1101_GDO0_PIN=25
-DCC1101_SS_PIN=SPI_SS_PIN
-DCC1101_MOSI_PIN=SPI_MOSI_PIN
-DCC1101_SCK_PIN=SPI_SCK_PIN
-DCC1101_MISO_PIN=SPI_MISO_PIN
;-DCC1101_GDO2_PIN=-1

; connections are the same as CC1101
-DUSE_NRF24_VIA_SPI
-DNRF24_CE_PIN=25
-DNRF24_SS_PIN=SPI_SS_PIN
-DNRF24_MOSI_PIN=SPI_MOSI_PIN
-DNRF24_SCK_PIN=SPI_SCK_PIN
-DNRF24_MISO_PIN=SPI_MISO_PIN

;Battery ADC read pin
-DBAT_PIN=10

;Font sizes, depending on device
-DFP=1
-DFM=2
-DFG=3

;Screen Setup
-DHAS_SCREEN=1
-DROTATION=3
-DWIDTH=240
-DHEIGHT=135

;TFT_eSPI Setup
-DUSER_SETUP_LOADED=1
-DST7789_2_DRIVER=1
-DTFT_RGB_ORDER=1
-DTFT_WIDTH=135
-DTFT_HEIGHT=240
-DTFT_BACKLIGHT_ON=0
-DTFT_CS=5
-DTFT_DC=23
-DTFT_RST=18
-DTOUCH_CS=-1
-DTFT_MOSI=15
-DTFT_SCLK=13
-DTFT_BL=-1
-DSMOOTH_FONT=1
-DSPI_FREQUENCY=20000000
-DSPI_READ_FREQUENCY=20000000
-DSPI_TOUCH_FREQUENCY=2500000

;SD Card Setup pins
-DSDCARD_CS=14
-DSDCARD_SCK=0
-DSDCARD_MISO=36
-DSDCARD_MOSI=26

;Default I2C port
-DGROVE_SDA=32
-DGROVE_SCL=33

-DSPI_SCK_PIN=0
-DSPI_MOSI_PIN=GROVE_SDA
-DSPI_MISO_PIN=GROVE_SCL
-DSPI_SS_PIN=26

lib_deps =
${common.lib_deps}


[env:m5stack-cardputer]
platform = https://github.com/bmorcelli/platform-espressif32/releases/download/0.0.4/platform-espressif32.zip
Expand Down
2 changes: 1 addition & 1 deletion src/core/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int loopOptions(std::vector<Option>& options, bool bright, bool submenu, String

/* Select and run function */
if(checkSelPress()) {
Serial.println("Selecionado " + String(options[index].label.c_str()));
Serial.println("Selected: " + String(options[index].label.c_str()));
options[index].operation();
break;
}
Expand Down
80 changes: 51 additions & 29 deletions src/modules/others/webInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,40 @@ void handleFileUpload(FS fs) {
server->send(303);
}
}
/**********************************************************************
** Function: drawWebUiScreen
** Draw information on screen of WebUI.
**********************************************************************/
void drawWebUiScreen(bool mode_ap) {
tft.fillScreen(BGCOLOR);
tft.fillScreen(BGCOLOR);
tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,ALCOLOR);
setTftDisplay(0,0,ALCOLOR,FM);
tft.drawCentreString("BRUCE WebUI",WIDTH/2,27,1);
String txt;
if(!mode_ap) txt = WiFi.localIP().toString();
else txt = WiFi.softAPIP().toString();
tft.setTextColor(FGCOLOR);

tft.drawCentreString("http://bruce.local", WIDTH/2,45,1);
setTftDisplay(7,67);

tft.setTextSize(FM);
tft.print("IP: "); tft.println(txt);
tft.setCursor(7,tft.getCursorY());
tft.println("Usr: " + String(wui_usr));
tft.setCursor(7,tft.getCursorY());
tft.println("Pwd: " + String(wui_pwd));
tft.setCursor(7,tft.getCursorY());
tft.setTextColor(TFT_RED);
tft.setTextSize(FP);

#ifdef CARDPUTER
tft.drawCentreString("press Esc to stop", WIDTH/2,HEIGHT-15,1);
#else
tft.drawCentreString("press Pwr to stop", WIDTH/2,HEIGHT-15,1);
#endif
}

/**********************************************************************
** Function: configureWebServer
Expand Down Expand Up @@ -292,7 +325,20 @@ void configureWebServer() {
server->requestAuthentication();
}
});

server->on("/style.css", HTTP_GET, []() {
if (checkUserWebAuth()) {
server->send_P(200, "text/css", index_css);
} else {
server->requestAuthentication();
}
});
server->on("/script.js", HTTP_GET, []() {
if (checkUserWebAuth()) {
server->send_P(200, "application/javascript", index_js);
} else {
server->requestAuthentication();
}
});
// Index page
server->on("/Oc34N", HTTP_GET, []() {
server->send(200, "text/html", page_404);
Expand Down Expand Up @@ -323,6 +369,7 @@ void configureWebServer() {
String cmnd = server->arg("cmnd");
if( processSerialCommand( cmnd ) ) {
setup_gpio(); // temp fix for menu inf. loop
drawWebUiScreen(WiFi.getMode() == WIFI_MODE_AP ? true:false);
server->send(200, "text/plain", "command " + cmnd + " success");
} else {
server->send(400, "text/plain", "command failed, check the serial log for details");
Expand Down Expand Up @@ -459,38 +506,13 @@ void startWebUi(bool mode_ap) {

configureWebServer();

tft.fillScreen(BGCOLOR);
tft.fillScreen(BGCOLOR);
tft.drawRoundRect(5,5,WIDTH-10,HEIGHT-10,5,ALCOLOR);
setTftDisplay(0,0,ALCOLOR,FM);
tft.drawCentreString("BRUCE WebUI",WIDTH/2,27,1);
String txt;
if(!mode_ap) txt = WiFi.localIP().toString();
else txt = WiFi.softAPIP().toString();
tft.setTextColor(FGCOLOR);

tft.drawCentreString("http://bruce.local", WIDTH/2,45,1);
setTftDisplay(7,67);

tft.setTextSize(FM);
tft.print("IP: "); tft.println(txt);
tft.setCursor(7,tft.getCursorY());
tft.println("Usr: " + String(wui_usr));
tft.setCursor(7,tft.getCursorY());
tft.println("Pwd: " + String(wui_pwd));
tft.setCursor(7,tft.getCursorY());
tft.setTextColor(TFT_RED);
tft.setTextSize(FP);

#ifdef CARDPUTER
tft.drawCentreString("press Esc to stop", WIDTH/2,HEIGHT-15,1);
#else
tft.drawCentreString("press Pwr to stop", WIDTH/2,HEIGHT-15,1);
#endif
drawWebUiScreen(mode_ap);

disableCore0WDT();
disableCore1WDT();
disableLoopWDT();
options.clear(); // Clear this vector to free stack memory

while (!checkEscPress()) {
server->handleClient();
// nothing here, just to hold the screen until the server is on.
Expand Down
Loading

0 comments on commit 02d5d8a

Please sign in to comment.