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,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x640000,
app1, app, ota_1, 0x650000,0x640000,
spiffs, data, spiffs, 0xc90000,0x360000,
coredump, data, coredump,0xFF0000,0x10000,
# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x5000
otadata, data, ota, 0xe000, 0x2000
app0, app, ota_0, 0x10000, 0x1E0000
app1, app, ota_1, 0x1F0000,0x1E0000
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]
platform = espressif32 @ 6.12.0
board = esp32-c3-devkitm-1
board = esp32-s3-devkitc-1
framework = arduino
monitor_speed = 115200
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_skip_packages = yes
board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
board_upload.offset_address = 0x10000
build_flags =
@ -28,7 +28,9 @@ build_flags =
; Board configuration
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
extra_scripts =
@ -36,8 +38,9 @@ extra_scripts =
; Libraries
lib_deps =
BatteryMonitor=symlink://open-x4-sdk/libs/hardware/BatteryMonitor
InputManager=symlink://open-x4-sdk/libs/hardware/InputManager
BatteryMonitor=symlink://open-x4-sdk/libs/hardware/BatteryMonitorMinRead
InputManager=symlink://open-x4-sdk/libs/hardware/InputManagerMinRead
SDCardManager=symlink://open-x4-sdk/libs/hardware/SDCardManagerMinRead
EInkDisplay=symlink://open-x4-sdk/libs/display/EInkDisplay
ArduinoJson @ 7.4.2
QRCode @ 0.0.1
@ -47,6 +50,7 @@ extends = base
build_flags =
${base.build_flags}
-DCROSSPOINT_VERSION=\"${platformio.crosspoint_version}-dev\"
-DBOARD_HAS_PSRAM=1
[env:gh_release]
extends = base

View File

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

View File

@ -3,7 +3,7 @@
#include <Epub.h>
#include <GfxRenderer.h>
#include <InputManager.h>
#include <SD.h>
#include <SDCardManager.h>
#include <SPI.h>
#include <builtinFonts/bookerly_2b.h>
#include <builtinFonts/bookerly_bold_2b.h>
@ -25,22 +25,23 @@
#include "activities/util/FullScreenMessageActivity.h"
#include "config.h"
#include <esp_sleep.h>
#include <driver/rtc_io.h>
#define SPI_FQ 40000000
// Display SPI pins (custom pins for XteinkX4, not hardware SPI defaults)
#define EPD_SCLK 8 // SPI Clock
#define EPD_MOSI 10 // SPI MOSI (Master Out Slave In)
#define EPD_CS 21 // Chip Select
#define EPD_DC 4 // Data/Command
#define EPD_RST 5 // Reset
#define EPD_BUSY 6 // Busy
// Display SPI pins (custom pins for MinRead hardware)
#define EPD_SCLK 13 // SPI Clock
#define EPD_MOSI 14 // SPI MOSI (Master Out Slave In)
#define EPD_CS 12 // Chip Select
#define EPD_DC 11 // Data/Command
#define EPD_RST 10 // Reset
#define EPD_BUSY 9 // Busy
#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);
InputManager inputManager;
SDCardManager sdCardManager;
GfxRenderer renderer(einkDisplay);
Activity* currentActivity;
@ -108,7 +109,10 @@ void verifyWakeupLongPress() {
if (abort) {
// Button released too early. Returning to sleep.
// 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();
}
}
@ -129,9 +133,12 @@ void enterDeepSleep() {
einkDisplay.deepSleep();
Serial.printf("[%lu] [ ] Power button press calibration value: %lu ms\n", millis(), t2 - t1);
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
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
esp_deep_sleep_start();
}
@ -184,12 +191,11 @@ void setup() {
// Initialize pins
pinMode(BAT_GPIO0, INPUT);
// Initialize SPI with custom pins
SPI.begin(EPD_SCLK, SD_SPI_MISO, EPD_MOSI, EPD_CS);
// Initialize SPI for display (SD card now uses SDMMC, not SPI)
SPI.begin(EPD_SCLK, -1, EPD_MOSI, EPD_CS); // MISO not needed for display-only SPI
// SD Card Initialization
// We need 6 open files concurrently when parsing a new chapter
if (!SD.begin(SD_SPI_CS, SPI, SPI_FQ, "/sd", 6)) {
// SD Card Initialization using SDMMC
if (!sdCardManager.begin()) {
Serial.printf("[%lu] [ ] SD card initialization failed\n", millis());
setupDisplayAndFonts();
exitActivity();