Marauder compiles and installs for ESP32-C5

This commit is contained in:
Just Call Me Koko
2025-07-10 11:20:50 -04:00
parent d61542eb5f
commit 9a25224c83
7 changed files with 173 additions and 113 deletions

View File

@@ -6,14 +6,17 @@ LedInterface::LedInterface() {
void LedInterface::RunSetup() { void LedInterface::RunSetup() {
//Serial.println("Setting neopixel to black..."); //Serial.println("Setting neopixel to black...");
strip.setBrightness(0); #ifdef HAS_NEOPIXEL_LED
strip.begin(); strip.setBrightness(0);
strip.setPixelColor(0, strip.Color(0, 0, 0)); strip.begin();
strip.show(); strip.setPixelColor(0, strip.Color(0, 0, 0));
//delay(100); strip.show();
strip.setBrightness(50); //delay(100);
strip.setPixelColor(0, strip.Color(0, 0, 0)); strip.setBrightness(50);
strip.show(); strip.setPixelColor(0, strip.Color(0, 0, 0));
strip.show();
#endif
this->initTime = millis(); this->initTime = millis();
} }
@@ -50,8 +53,10 @@ uint8_t LedInterface::getMode() {
} }
void LedInterface::setColor(int r, int g, int b) { void LedInterface::setColor(int r, int g, int b) {
strip.setPixelColor(0, strip.Color(r, g, b)); #ifdef HAS_NEOPIXEL_LED
strip.show(); strip.setPixelColor(0, strip.Color(r, g, b));
strip.show();
#endif
} }
void LedInterface::sniffLed() { void LedInterface::sniffLed() {
@@ -67,25 +72,29 @@ void LedInterface::ledOff() {
} }
void LedInterface::rainbow() { void LedInterface::rainbow() {
strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256)); #ifdef HAS_NEOPIXEL_LED
strip.show(); strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256));
strip.show();
this->current_fade_itter++; this->current_fade_itter++;
this->wheel_pos = this->wheel_pos - this->wheel_speed; this->wheel_pos = this->wheel_pos - this->wheel_speed;
if (this->wheel_pos < 0) if (this->wheel_pos < 0)
this->wheel_pos = 255; this->wheel_pos = 255;
#endif
} }
uint32_t LedInterface::Wheel(byte WheelPos) { uint32_t LedInterface::Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos; #ifdef HAS_NEOPIXEL_LED
if(WheelPos < 85) { WheelPos = 255 - WheelPos;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); if(WheelPos < 85) {
} return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
if(WheelPos < 170) { }
WheelPos -= 85; if(WheelPos < 170) {
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); WheelPos -= 85;
} return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
WheelPos -= 170; }
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
#endif
} }

View File

@@ -1,6 +1,10 @@
#include "SDInterface.h" #include "SDInterface.h"
#include "lang_var.h" #include "lang_var.h"
#ifdef HAS_C5_SD
SDInterface::SDInterface(SPIClass* spi, int cs)
: _spi(spi), _cs(cs) {}
#endif
bool SDInterface::initSD() { bool SDInterface::initSD() {
#ifdef HAS_SD #ifdef HAS_SD
@@ -41,6 +45,9 @@ bool SDInterface::initSD() {
this->spiExt = new SPIClass(); this->spiExt = new SPIClass();
this->spiExt->begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS); this->spiExt->begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
if (!SD.begin(SD_CS, *(this->spiExt))) { if (!SD.begin(SD_CS, *(this->spiExt))) {
#elif defined(HAS_C5_SD)
Serial.println("Using C5 SD configuration...");
if (!SD.begin(SD_CS, *_spi)) {
#else #else
if (!SD.begin(SD_CS)) { if (!SD.begin(SD_CS)) {
#endif #endif
@@ -51,19 +58,9 @@ bool SDInterface::initSD() {
else { else {
this->supported = true; this->supported = true;
this->cardType = SD.cardType(); this->cardType = SD.cardType();
//if (cardType == CARD_MMC)
// Serial.println(F("SD: MMC Mounted"));
//else if(cardType == CARD_SD)
// Serial.println(F("SD: SDSC Mounted"));
//else if(cardType == CARD_SDHC)
// Serial.println(F("SD: SDHC Mounted"));
//else
// Serial.println(F("SD: UNKNOWN Card Mounted"));
this->cardSizeMB = SD.cardSize() / (1024 * 1024); this->cardSizeMB = SD.cardSize() / (1024 * 1024);
//Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
if (this->supported) { if (this->supported) {
const int NUM_DIGITS = log10(this->cardSizeMB) + 1; const int NUM_DIGITS = log10(this->cardSizeMB) + 1;

View File

@@ -28,10 +28,17 @@ class SDInterface {
private: private:
#if (defined(MARAUDER_M5STICKC) || defined(HAS_CYD_TOUCH)) #if (defined(MARAUDER_M5STICKC) || defined(HAS_CYD_TOUCH))
SPIClass *spiExt; SPIClass *spiExt;
#elif defined(HAS_C5_SD)
SPIClass* _spi;
int _cs;
#endif #endif
bool checkDetectPin(); bool checkDetectPin();
public: public:
#ifdef HAS_C5_SD
SDInterface(SPIClass* spi, int cs);
#endif
uint8_t cardType; uint8_t cardType;
//uint64_t cardSizeBT; //uint64_t cardSizeBT;
//uint64_t cardSizeKB; //uint64_t cardSizeKB;

View File

@@ -7129,10 +7129,19 @@ void WiFiScan::changeChannel()
// Function to cycle to the next channel // Function to cycle to the next channel
void WiFiScan::channelHop() void WiFiScan::channelHop()
{ {
this->set_channel = this->set_channel + 1; #ifndef HAS_DUAL_BAND
if (this->set_channel > 14) { this->set_channel = this->set_channel + 1;
this->set_channel = 1; if (this->set_channel > 14) {
} this->set_channel = 1;
}
#else
this->set_channel = this->dual_band_channels[this->dual_band_channel_index];
if (this->dual_band_channel_index >= DUAL_BAND_CHANNELS)
this->dual_band_channel_index = 0;
else
this->dual_band_channel_index++;
#endif
esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE); esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE);
delay(1); delay(1);
} }
@@ -7458,7 +7467,7 @@ void WiFiScan::main(uint32_t currentTime)
(currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE) || (currentScanMode == WIFI_SCAN_STATION_WAR_DRIVE) ||
(currentScanMode == WIFI_SCAN_ALL)) (currentScanMode == WIFI_SCAN_ALL))
{ {
if (currentTime - initTime >= this->channel_hop_delay * 1000) if (currentTime - initTime >= this->channel_hop_delay * HOP_DELAY)
{ {
initTime = millis(); initTime = millis();
channelHop(); channelHop();

View File

@@ -20,6 +20,9 @@
#include <math.h> #include <math.h>
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_wifi_types.h" #include "esp_wifi_types.h"
#ifdef HAS_DUAL_BAND
#include "esp_system.h"
#endif
#ifdef HAS_BT #ifdef HAS_BT
#include "esp_bt.h" #include "esp_bt.h"
#endif #endif
@@ -177,6 +180,10 @@ extern Settings settings_obj;
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq); esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
#ifdef HAS_DUAL_BAND
esp_err_t esp_base_mac_addr_set(uint8_t *Mac);
#endif
/*struct ssid { /*struct ssid {
String essid; String essid;
uint8_t channel; uint8_t channel;
@@ -231,6 +238,10 @@ class WiFiScan
uint8_t ap_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; uint8_t ap_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
uint8_t sta_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; uint8_t sta_mac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
uint8_t dual_band_channels[DUAL_BAND_CHANNELS] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165, 169, 173, 177};
uint8_t dual_band_channel_index = 0;
// Settings // Settings
uint mac_history_cursor = 0; uint mac_history_cursor = 0;
uint8_t channel_hop_delay = 1; uint8_t channel_hop_delay = 1;
@@ -560,31 +571,35 @@ class WiFiScan
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
wifi_init_config_t cfg2 = { \ #ifndef HAS_DUAL_BAND
.event_handler = &esp_event_send_internal, \ wifi_init_config_t cfg2 = { \
.osi_funcs = &g_wifi_osi_funcs, \ .event_handler = &esp_event_send_internal, \
.wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \ .osi_funcs = &g_wifi_osi_funcs, \
.static_rx_buf_num = 6,\ .wpa_crypto_funcs = g_wifi_default_wpa_crypto_funcs, \
.dynamic_rx_buf_num = 6,\ .static_rx_buf_num = 6,\
.tx_buf_type = 0,\ .dynamic_rx_buf_num = 6,\
.static_tx_buf_num = 1,\ .tx_buf_type = 0,\
.dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\ .static_tx_buf_num = 1,\
.cache_tx_buf_num = 0,\ .dynamic_tx_buf_num = WIFI_DYNAMIC_TX_BUFFER_NUM,\
.csi_enable = false,\ .cache_tx_buf_num = 0,\
.ampdu_rx_enable = false,\ .csi_enable = false,\
.ampdu_tx_enable = false,\ .ampdu_rx_enable = false,\
.amsdu_tx_enable = false,\ .ampdu_tx_enable = false,\
.nvs_enable = false,\ .amsdu_tx_enable = false,\
.nano_enable = WIFI_NANO_FORMAT_ENABLED,\ .nvs_enable = false,\
.rx_ba_win = 6,\ .nano_enable = WIFI_NANO_FORMAT_ENABLED,\
.wifi_task_core_id = WIFI_TASK_CORE_ID,\ .rx_ba_win = 6,\
.beacon_max_len = 752, \ .wifi_task_core_id = WIFI_TASK_CORE_ID,\
.mgmt_sbuf_num = 8, \ .beacon_max_len = 752, \
.feature_caps = g_wifi_feature_caps, \ .mgmt_sbuf_num = 8, \
.sta_disconnected_pm = WIFI_STA_DISCONNECTED_PM_ENABLED, \ .feature_caps = g_wifi_feature_caps, \
.espnow_max_encrypt_num = 0, \ .sta_disconnected_pm = WIFI_STA_DISCONNECTED_PM_ENABLED, \
.magic = WIFI_INIT_CONFIG_MAGIC\ .espnow_max_encrypt_num = 0, \
}; .magic = WIFI_INIT_CONFIG_MAGIC\
};
#else
wifi_init_config_t cfg2 = WIFI_INIT_CONFIG_DEFAULT();
#endif
wifi_config_t ap_config; wifi_config_t ap_config;

View File

@@ -26,12 +26,15 @@
//#define MARAUDER_CYD_MICRO // 2432S028 //#define MARAUDER_CYD_MICRO // 2432S028
//#define MARAUDER_CYD_2USB // Another 2432S028 but it has tWo UsBs OoOoOoO //#define MARAUDER_CYD_2USB // Another 2432S028 but it has tWo UsBs OoOoOoO
//#define MARAUDER_CYD_GUITION // ESP32-2432S024 GUITION //#define MARAUDER_CYD_GUITION // ESP32-2432S024 GUITION
//#define MARAUDER_C5
//// END BOARD TARGETS //// END BOARD TARGETS
#define MARAUDER_VERSION "v1.7.2" #define MARAUDER_VERSION "v1.8.0"
#define GRAPH_REFRESH 100 #define GRAPH_REFRESH 100
#define DUAL_BAND_CHANNELS 51
//// HARDWARE NAMES //// HARDWARE NAMES
#ifdef MARAUDER_M5STICKC #ifdef MARAUDER_M5STICKC
#define HARDWARE_NAME "M5Stick-C Plus" #define HARDWARE_NAME "M5Stick-C Plus"
@@ -69,6 +72,8 @@
#define HARDWARE_NAME "Flipper Zero Dev Board Pro" #define HARDWARE_NAME "Flipper Zero Dev Board Pro"
#elif defined(XIAO_ESP32_S3) #elif defined(XIAO_ESP32_S3)
#define HARDWARE_NAME "XIAO ESP32 S3" #define HARDWARE_NAME "XIAO ESP32 S3"
#elif defined(MARAUDER_C5)
#define HARDWARE_NAME "ESP32-C5 DevKit"
#else #else
#define HARDWARE_NAME "ESP32" #define HARDWARE_NAME "ESP32"
#endif #endif
@@ -351,6 +356,24 @@
//#define HAS_TEMP_SENSOR //#define HAS_TEMP_SENSOR
//#define HAS_GPS //#define HAS_GPS
#endif #endif
#ifdef MARAUDER_C5
//#define HAS_FLIPPER_LED
//#define FLIPPER_ZERO_HAT
//#define HAS_BATTERY
//#define HAS_BT
//#define HAS_BUTTONS
//#define HAS_NEOPIXEL_LED
//#define HAS_PWR_MGMT
//#define HAS_SCREEN
#define HAS_GPS
#define HAS_C5_SD
#define HAS_SD
#define USE_SD
#define HAS_DUAL_BAND
//#define HAS_PSRAM
//#define HAS_TEMP_SENSOR
#endif
//// END BOARD FEATURES //// END BOARD FEATURES
//// POWER MANAGEMENT //// POWER MANAGEMENT
@@ -1701,6 +1724,10 @@
#define SD_CS 3 #define SD_CS 3
#endif #endif
#ifdef MARAUDER_C5
#define SD_CS 10
#endif
#endif #endif
//// END SD DEFINITIONS //// END SD DEFINITIONS
@@ -1792,6 +1819,8 @@
#define MEM_LOWER_LIM 10000 #define MEM_LOWER_LIM 10000
#elif defined(XIAO_ESP32_S3) #elif defined(XIAO_ESP32_S3)
#define MEM_LOWER_LIM 10000 #define MEM_LOWER_LIM 10000
#elif defined(MARAUDER_C5)
#define MEM_LOWER_LIM 10000
#endif #endif
//// END MEMORY LOWER LIMIT STUFF //// END MEMORY LOWER LIMIT STUFF
@@ -1889,6 +1918,10 @@
#define GPS_SERIAL_INDEX 1 #define GPS_SERIAL_INDEX 1
#define GPS_TX 6 #define GPS_TX 6
#define GPS_RX 9 #define GPS_RX 9
#elif defined(MARAUDER_C5)
#define GPS_SERIAL_INDEX 1
#define GPS_TX 14
#define GPS_RX 13
#endif #endif
#else #else
#define mac_history_len 100 #define mac_history_len 100
@@ -1971,6 +2004,8 @@
#define MARAUDER_TITLE_BYTES 13578 #define MARAUDER_TITLE_BYTES 13578
#elif defined(MARAUDER_REV_FEATHER) #elif defined(MARAUDER_REV_FEATHER)
#define MARAUDER_TITLE_BYTES 13578 #define MARAUDER_TITLE_BYTES 13578
#elif defined(MARAUDER_C5)
#define MARAUDER_TITLE_BYTES 13578
#else #else
#define MARAUDER_TITLE_BYTES 13578 #define MARAUDER_TITLE_BYTES 13578
#endif #endif
@@ -1992,7 +2027,7 @@
//// PCAP BUFFER STUFF //// PCAP BUFFER STUFF
//// STUPID CYD STUFF //// STUPID CYD STUFF
#ifdef HAS_CYD_TOUCH #if defined(HAS_CYD_TOUCH) || defined(HAS_C5_SD)
#ifdef MARAUDER_CYD_MICRO #ifdef MARAUDER_CYD_MICRO
#define XPT2046_IRQ 36 #define XPT2046_IRQ 36
#define XPT2046_MOSI 32 #define XPT2046_MOSI 32
@@ -2016,6 +2051,12 @@
#define SD_MOSI 23 #define SD_MOSI 23
#define SD_SCK 18 #define SD_SCK 18
#endif #endif
#ifdef MARAUDER_C5
#define SD_MISO 2
#define SD_MOSI 7
#define SD_SCK 6
#endif
#endif #endif
//// END STUPID CYD STUFF //// END STUPID CYD STUFF
@@ -2054,4 +2095,12 @@
#endif #endif
//// END FUNNY FLIPPER LED STUFF //// END FUNNY FLIPPER LED STUFF
//// WIFI STUFF
#ifndef HAS_DUAL_BAND
#define HOP_DELAY 1000
#else
#define HOP_DELAY 100
#endif
#endif #endif

View File

@@ -97,7 +97,7 @@ CommandLine cli_obj;
MenuFunctions menu_function_obj; MenuFunctions menu_function_obj;
#endif #endif
#ifdef HAS_SD #if defined(HAS_SD) && !defined(HAS_C5_SD)
SDInterface sd_obj; SDInterface sd_obj;
#endif #endif
@@ -147,9 +147,22 @@ void backlightOff() {
#endif #endif
} }
#ifdef HAS_C5_SD
SPIClass sharedSPI(SPI);
SDInterface sd_obj = SDInterface(&sharedSPI, SD_CS);
#endif
void setup() void setup()
{ {
esp_spiram_init(); #ifndef HAS_DUAL_BAND
esp_spiram_init();
#endif
#ifdef HAS_C5_SD
Serial.println("Starting shared SPI for C5 SD configuration...");
sharedSPI.begin(SD_SCK, SD_MISO, SD_MOSI);
delay(100);
#endif
#ifdef defined(MARAUDER_M5STICKC) && !defined(MARAUDER_M5STICKCP2) #ifdef defined(MARAUDER_M5STICKC) && !defined(MARAUDER_M5STICKCP2)
axp192_obj.begin(); axp192_obj.begin();
@@ -175,7 +188,7 @@ void setup()
digitalWrite(TFT_CS, HIGH); digitalWrite(TFT_CS, HIGH);
#endif #endif
#ifdef HAS_SD #if defined(HAS_SD) && !defined(HAS_C5_SD)
pinMode(SD_CS, OUTPUT); pinMode(SD_CS, OUTPUT);
delay(10); delay(10);
@@ -207,17 +220,6 @@ void setup()
backlightOff(); backlightOff();
// Draw the title screen
/*
#ifdef HAS_SCREEN
#ifndef MARAUDER_MINI
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
#else
display_obj.drawJpeg("/marauder3L.jpg", 0, 0);
#endif
#endif
*/
#ifdef HAS_SCREEN #ifdef HAS_SCREEN
display_obj.tft.drawCentreString("ESP32 Marauder", TFT_WIDTH/2, TFT_HEIGHT * 0.33, 1); display_obj.tft.drawCentreString("ESP32 Marauder", TFT_WIDTH/2, TFT_HEIGHT * 0.33, 1);
display_obj.tft.drawCentreString("JustCallMeKoko", TFT_WIDTH/2, TFT_HEIGHT * 0.5, 1); display_obj.tft.drawCentreString("JustCallMeKoko", TFT_WIDTH/2, TFT_HEIGHT * 0.5, 1);
@@ -256,12 +258,6 @@ void setup()
settings_obj.begin(); settings_obj.begin();
wifi_scan_obj.RunSetup();
//#ifdef HAS_SCREEN
// display_obj.tft.println(F(text_table0[2]));
//#endif
buffer_obj = Buffer(); buffer_obj = Buffer();
#if defined(HAS_SD) #if defined(HAS_SD)
// Do some SD stuff // Do some SD stuff
@@ -270,6 +266,8 @@ void setup()
#endif #endif
wifi_scan_obj.RunSetup();
#ifdef HAS_SCREEN #ifdef HAS_SCREEN
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK); display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
display_obj.tft.drawCentreString("Initializing...", TFT_WIDTH/2, TFT_HEIGHT * 0.82, 1); display_obj.tft.drawCentreString("Initializing...", TFT_WIDTH/2, TFT_HEIGHT * 0.82, 1);
@@ -280,14 +278,6 @@ void setup()
#ifdef HAS_BATTERY #ifdef HAS_BATTERY
battery_obj.RunSetup(); battery_obj.RunSetup();
#endif #endif
#ifdef HAS_SCREEN
//display_obj.tft.println(F(text_table0[5]));
#endif
#ifdef HAS_SCREEN
//display_obj.tft.println(F(text_table0[6]));
#endif
#ifdef HAS_BATTERY #ifdef HAS_BATTERY
battery_obj.battery_level = battery_obj.getBatteryLevel(); battery_obj.battery_level = battery_obj.getBatteryLevel();
@@ -304,28 +294,12 @@ void setup()
led_obj.RunSetup(); led_obj.RunSetup();
#endif #endif
#ifdef HAS_SCREEN
//display_obj.tft.println(F(text_table0[7]));
//delay(500);
#endif
#ifdef HAS_GPS #ifdef HAS_GPS
gps_obj.begin(); gps_obj.begin();
//#ifdef HAS_SCREEN
//if (gps_obj.getGpsModuleStatus())
//display_obj.tft.println("GPS Module connected");
//else
//display_obj.tft.println("GPS Module NOT connected");
//#endif
#endif #endif
#ifdef HAS_SCREEN #ifdef HAS_SCREEN
//display_obj.tft.println(F(text_table0[8]));
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK); display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
//delay(2000);
#endif #endif
#ifdef HAS_SCREEN #ifdef HAS_SCREEN