forked modded sdk, changed pin references, inits,

modified paritions for 8MB esp32-s3
This commit is contained in:
Ian Chasse 2025-12-27 00:33:57 -05:00
parent 562d7492e4
commit d3886d74ee
4 changed files with 42 additions and 32 deletions

View File

@ -1,7 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000, # Name, Type, SubType, Offset, Size
otadata, data, ota, 0xe000, 0x2000, nvs, data, nvs, 0x9000, 0x5000
app0, app, ota_0, 0x10000, 0x640000, otadata, data, ota, 0xe000, 0x2000
app1, app, ota_1, 0x650000,0x640000, app0, app, ota_0, 0x10000, 0x1E0000
spiffs, data, spiffs, 0xc90000,0x360000, app1, app, ota_1, 0x1F0000,0x1E0000
coredump, data, coredump,0xFF0000,0x10000, spiffs, data, spiffs, 0x3D0000,0x430000

1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x640000 0x1E0000
5 app1 app ota_1 0x650000 0x1F0000 0x640000 0x1E0000
6 spiffs data spiffs 0xc90000 0x3D0000 0x360000 0x430000
7

View File

@ -4,7 +4,7 @@ default_envs = default
[base] [base]
platform = espressif32 @ 6.12.0 platform = espressif32 @ 6.12.0
board = esp32-c3-devkitm-1 board = esp32-s3-devkitc-1
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
upload_speed = 921600 upload_speed = 921600
@ -12,8 +12,8 @@ check_tool = cppcheck
check_flags = --enable=all --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=unmatchedSuppression --suppress=*:*/.pio/* --inline-suppr check_flags = --enable=all --suppress=missingIncludeSystem --suppress=unusedFunction --suppress=unmatchedSuppression --suppress=*:*/.pio/* --inline-suppr
check_skip_packages = yes check_skip_packages = yes
board_upload.flash_size = 16MB board_upload.flash_size = 8MB
board_upload.maximum_size = 16777216 board_upload.maximum_size = 8388608
board_upload.offset_address = 0x10000 board_upload.offset_address = 0x10000
build_flags = build_flags =
@ -28,7 +28,9 @@ build_flags =
; Board configuration ; Board configuration
board_build.flash_mode = dio board_build.flash_mode = dio
board_build.flash_size = 16MB board_build.flash_size = 8MB
board_build.psram_type = opi
board_build.arduino.memory_type = qio_opi
board_build.partitions = partitions.csv board_build.partitions = partitions.csv
extra_scripts = extra_scripts =
@ -36,8 +38,9 @@ extra_scripts =
; Libraries ; Libraries
lib_deps = lib_deps =
BatteryMonitor=symlink://open-x4-sdk/libs/hardware/BatteryMonitor BatteryMonitor=symlink://open-x4-sdk/libs/hardware/BatteryMonitorMinRead
InputManager=symlink://open-x4-sdk/libs/hardware/InputManager InputManager=symlink://open-x4-sdk/libs/hardware/InputManagerMinRead
SDCardManager=symlink://open-x4-sdk/libs/hardware/SDCardManagerMinRead
EInkDisplay=symlink://open-x4-sdk/libs/display/EInkDisplay EInkDisplay=symlink://open-x4-sdk/libs/display/EInkDisplay
ArduinoJson @ 7.4.2 ArduinoJson @ 7.4.2
QRCode @ 0.0.1 QRCode @ 0.0.1
@ -47,6 +50,7 @@ extends = base
build_flags = build_flags =
${base.build_flags} ${base.build_flags}
-DCROSSPOINT_VERSION=\"${platformio.crosspoint_version}-dev\" -DCROSSPOINT_VERSION=\"${platformio.crosspoint_version}-dev\"
-DBOARD_HAS_PSRAM=1
[env:gh_release] [env:gh_release]
extends = base extends = base

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <BatteryMonitor.h> #include <BatteryMonitor.h>
#define BAT_GPIO0 0 // Battery voltage #define BAT_GPIO0 1 // Battery voltage
static BatteryMonitor battery(BAT_GPIO0); static BatteryMonitor battery(BAT_GPIO0);

View File

@ -3,7 +3,7 @@
#include <Epub.h> #include <Epub.h>
#include <GfxRenderer.h> #include <GfxRenderer.h>
#include <InputManager.h> #include <InputManager.h>
#include <SD.h> #include <SDCardManager.h>
#include <SPI.h> #include <SPI.h>
#include <builtinFonts/bookerly_2b.h> #include <builtinFonts/bookerly_2b.h>
#include <builtinFonts/bookerly_bold_2b.h> #include <builtinFonts/bookerly_bold_2b.h>
@ -25,22 +25,23 @@
#include "activities/util/FullScreenMessageActivity.h" #include "activities/util/FullScreenMessageActivity.h"
#include "config.h" #include "config.h"
#include <esp_sleep.h>
#include <driver/rtc_io.h>
#define SPI_FQ 40000000 #define SPI_FQ 40000000
// Display SPI pins (custom pins for XteinkX4, not hardware SPI defaults) // Display SPI pins (custom pins for MinRead hardware)
#define EPD_SCLK 8 // SPI Clock #define EPD_SCLK 13 // SPI Clock
#define EPD_MOSI 10 // SPI MOSI (Master Out Slave In) #define EPD_MOSI 14 // SPI MOSI (Master Out Slave In)
#define EPD_CS 21 // Chip Select #define EPD_CS 12 // Chip Select
#define EPD_DC 4 // Data/Command #define EPD_DC 11 // Data/Command
#define EPD_RST 5 // Reset #define EPD_RST 10 // Reset
#define EPD_BUSY 6 // Busy #define EPD_BUSY 9 // Busy
#define UART0_RXD 20 // Used for USB connection detection #define UART0_RXD 20 // Used for USB connection detection
#define SD_SPI_CS 12
#define SD_SPI_MISO 7
EInkDisplay einkDisplay(EPD_SCLK, EPD_MOSI, EPD_CS, EPD_DC, EPD_RST, EPD_BUSY); EInkDisplay einkDisplay(EPD_SCLK, EPD_MOSI, EPD_CS, EPD_DC, EPD_RST, EPD_BUSY);
InputManager inputManager; InputManager inputManager;
SDCardManager sdCardManager;
GfxRenderer renderer(einkDisplay); GfxRenderer renderer(einkDisplay);
Activity* currentActivity; Activity* currentActivity;
@ -108,7 +109,10 @@ void verifyWakeupLongPress() {
if (abort) { if (abort) {
// Button released too early. Returning to sleep. // Button released too early. Returning to sleep.
// IMPORTANT: Re-arm the wakeup trigger before sleeping again // IMPORTANT: Re-arm the wakeup trigger before sleeping again
esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW); // Enable pull-up resistor for RTC GPIO
rtc_gpio_pullup_en((gpio_num_t)InputManager::PIN_CONFIRM);
// Configure wakeup on HIGH level (button released with pull-up)
esp_sleep_enable_ext1_wakeup(1ULL << InputManager::PIN_CONFIRM, ESP_EXT1_WAKEUP_ANY_HIGH);
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
} }
@ -129,9 +133,12 @@ void enterDeepSleep() {
einkDisplay.deepSleep(); einkDisplay.deepSleep();
Serial.printf("[%lu] [ ] Power button press calibration value: %lu ms\n", millis(), t2 - t1); Serial.printf("[%lu] [ ] Power button press calibration value: %lu ms\n", millis(), t2 - t1);
Serial.printf("[%lu] [ ] Entering deep sleep.\n", millis()); Serial.printf("[%lu] [ ] Entering deep sleep.\n", millis());
esp_deep_sleep_enable_gpio_wakeup(1ULL << InputManager::POWER_BUTTON_PIN, ESP_GPIO_WAKEUP_GPIO_LOW);
// Ensure that the power button has been released to avoid immediately turning back on if you're holding it // Ensure that the power button has been released to avoid immediately turning back on if you're holding it
waitForPowerRelease(); waitForPowerRelease();
// Enable pull-up resistor for RTC GPIO
rtc_gpio_pullup_en((gpio_num_t)InputManager::PIN_CONFIRM);
// Configure wakeup on HIGH level (button released with pull-up)
esp_sleep_enable_ext1_wakeup(1ULL << InputManager::PIN_CONFIRM, ESP_EXT1_WAKEUP_ANY_HIGH);
// Enter Deep Sleep // Enter Deep Sleep
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
@ -184,12 +191,11 @@ void setup() {
// Initialize pins // Initialize pins
pinMode(BAT_GPIO0, INPUT); pinMode(BAT_GPIO0, INPUT);
// Initialize SPI with custom pins // Initialize SPI for display (SD card now uses SDMMC, not SPI)
SPI.begin(EPD_SCLK, SD_SPI_MISO, EPD_MOSI, EPD_CS); SPI.begin(EPD_SCLK, -1, EPD_MOSI, EPD_CS); // MISO not needed for display-only SPI
// SD Card Initialization // SD Card Initialization using SDMMC
// We need 6 open files concurrently when parsing a new chapter if (!sdCardManager.begin()) {
if (!SD.begin(SD_SPI_CS, SPI, SPI_FQ, "/sd", 6)) {
Serial.printf("[%lu] [ ] SD card initialization failed\n", millis()); Serial.printf("[%lu] [ ] SD card initialization failed\n", millis());
setupDisplayAndFonts(); setupDisplayAndFonts();
exitActivity(); exitActivity();