Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,6 @@

All notable changes to SparkMiner will be documented in this file.

## [v2.9.6-pre] - 2026-09-19

### Fixed
- **ESP32-S3 zero-shares bug** (#36, issues #28/#10/#5): core 1 now mines the first SHA in software (same proven path as core 0) instead of the broken hardware midstate restore. Root cause: the S3 SHA_H digest-state registers expect big-endian state words (espressif/esp-idf#12440) and the old code seeded little-endian — reported hashrate was real hash speed but no share ever validated. S3 now shows an honest ~50-55 KH/s with shares landing at the pool; a faster correct HW path is tracked in #28.
- **WiFi reconnect after AP reboot / AUTH_EXPIRE** (#37, issues #31/#29): the watchdog re-issues `WiFi.begin()` with the NVS-stored credentials instead of `WiFi.reconnect()`. README note for the macOS captive-portal probe.
- **Config portal: SSIDs with spaces** (#45): scan-list autofill read the HTML-escaped visible text (spaces became U+00A0); now reads `data-ssid`.
- **Block-height and fee stats silently dead** (#44): mempool.space 301-redirects its HTTP endpoints to HTTPS and HTTPClient does not follow redirects; endpoints now use HTTPS via the existing TLS paths.

### Added
- **ESP32-C3/S2 hardware SHA mining path** (#39, issue #34): legitimate START→CONTINUE full double-hash with no midstate injection, software-verify gate on every submission, and a one-shot boot self-test that falls back to the software miner if the register sequence disagrees with the chip.
- **`esp32-devkit-oled` board target** (#38, issue #26): generic ESP32 DevKit + SSD1306 128x64 OLED on SDA=21/SCL=22. Both OLED envs added to the CI matrix.
- **CI artifact upload** — every PR now publishes test-build factory binaries; tags build all targets and publish a GitHub Release automatically.

### Changed
- README hashrate tables now report honest, pool-verified numbers.

## [v2.9.3] - 2026-01-22

### Added
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# SparkMiner v2.9.6-pre

**High-performance Bitcoin solo miner for ESP32, ESP32-S3 & ESP32-C3**
**High-performance Bitcoin solo miner for ESP32, ESP32-S3, ESP32-C3 & ESP32-PICO-V3-02**

<img src="images/1767589853452.jpg" alt="SparkMiner Display" width="575">

<img src="images/unnamed.jpg" alt="SparkMiner Display1" width="575">

SparkMiner is optimized firmware for ESP32-based boards with displays, delivering **~1+ MH/s** (pool-reported) using hardware-accelerated SHA-256 and pipelined assembly mining. Supports both ESP32 "Cheap Yellow Display" (CYD) boards and ESP32-S3 variants.

> **Solo Mining Disclaimer:** Solo mining on an ESP32 is a lottery. The odds of finding a block are astronomically low (~1 in 10^20 per hash at current difficulty). This project is for education, fun, and supporting network decentralization - not profit.
Expand Down Expand Up @@ -151,7 +153,6 @@ Find your board below and download the matching firmware from [Releases](https:/
| **ESP32-WROOM-32** | `esp32-headless_firmware.bin` | Headless — GPIO LED on pin 2 |
| **Wemos Lolin32 + OLED** | `wemos-lolin32-oled_firmware.bin` | 128x64 SSD1306 I2C (SDA=5, SCL=4, RST=16, addr=0x3C) |
| **NodeMCU ESP32** | `esp32-headless_firmware.bin` | Use headless firmware |
| **ESP32 DevKit + SSD1306 OLED** | `esp32-devkit-oled_firmware.bin` | 128x64 I2C OLED (SDA=GPIO21, SCL=GPIO22, addr=0x3C) |

### File Types

Expand All @@ -167,8 +168,8 @@ Find your board below and download the matching firmware from [Releases](https:/
| Chip | Hashrate | Notes |
|------|----------|-------|
| **ESP32** (dual-core) | ~715 KH/s | Best performance, hardware SHA-256 |
| **ESP32-S3** (dual-core) | ~50-55 KH/s | Every share software-verified (#36); faster HW path (~300+ KH/s) in progress — see [#28](https://github.com/SneezeGUI/SparkMiner/issues/28) |
| **ESP32-C3** (single-core) | TBD | HW SHA now wired with boot self-test (#39); software fallback ~1 KH/s. Numbers pending real-C3 validation ([#34](https://github.com/SneezeGUI/SparkMiner/issues/34)) |
| **ESP32-S3** (dual-core) | ~280-400 KH/s | Software SHA-256, more RAM |
| **ESP32-C3** (single-core) | ~200-300 KH/s | RISC-V, lowest power |

### Board Compatibility Status

Expand Down Expand Up @@ -264,10 +265,6 @@ If no SD card config is found, SparkMiner creates a WiFi access point:

1. **Connect** to WiFi network: `SparkMiner-XXXX` (password: minebitcoin)
2. **Open browser** to `http://192.168.4.1`
> **macOS users:** if the captive-portal page doesn't pop up automatically and
> Safari/Chrome shows `ERR_INTERNET_DISCONNECTED`, type the IP address
> `http://192.168.4.1` directly into the address bar (not a search term). The
> config page is served only by the device while it has no internet access. (Issue #29)
3. You will see the **new dark-themed portal** with full configuration options:
- Primary & Backup Pool settings
- Display brightness, rotation, and color inversion
Expand Down Expand Up @@ -395,7 +392,6 @@ If you don't need live stats and want maximum stability:
|------|-----|------|-----|-------|
| **Public Pool** | `public-pool.io` | `21496` | 0% | Recommended, solo mining |
| **FindMyBlock EU** | `eu.findmyblock.xyz` | `3335` | 0% | Solo mining, EU server |
| **SoloLuck** | `stratum.sololuck.io` | `3335` | 0% | Solo mining, minimum difficulty 1 |
| **CKPool Solo** | `solo.ckpool.org` | `3333` | 0.5% | Solo mining |
| **Braiins Pool** | `stratum.braiins.com` | `3333` | 2% | Pooled mining |

Expand Down Expand Up @@ -501,7 +497,7 @@ The display features color-coded indicators for quick health monitoring:
| Board | Device Display | Pool Reported | Power | Notes |
|-------|---------------|---------------|-------|-------|
| **ESP32-2432S028 (CYD)** | ~715-725 KH/s | ~715-725 KH/s | ~0.5W | Pipelined assembly v2 |
| **ESP32-S3 (Freenove)** | ~50-55 KH/s | ~50-55 KH/s | ~0.4W | Software-first SHA (#36); the old ~280-400 KH/s figures were invalid (zero shares accepted) |
| **ESP32-S3 (Freenove)** | ~280 KH/s | ~400 KH/s | ~0.4W | Midstate caching v3 |
| **ESP32 Headless** | ~750 KH/s | ~750 KH/s | ~0.3W | No display overhead |

> **Note:** Pool-reported hashrate is typically higher than device display due to share submission timing and pool difficulty adjustments.
Expand Down
638 changes: 638 additions & 0 deletions compile_commands.json

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions devtool.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ flash_freq = "40m"
needs_boot_mode = false
group = "CYD (Cheap Yellow Display)"

[boards.m5stickc-plus2]
name = "M5StickC Plus2"
env = "m5stickc_plus2"
chip = "esp32"
description = "M5Stack M5StickC Plus2, built-in 135x240 ST7789 display"
monitor_baud = 115200
flash_baud = 1500000
needs_boot_mode = false
group = "M5Stack"

[boards.freenove-s3]
name = "Freenove ESP32-S3 Display"
env = "esp32-s3-2432s028"
Expand Down Expand Up @@ -130,14 +140,6 @@ needs_boot_mode = true
port_changes_on_reset = true
group = "OLED Display"

[boards.esp32-devkit-oled]
name = "ESP32 DevKit OLED"
env = "esp32-devkit-oled"
chip = "esp32"
description = "Generic ESP32/WROOM with 128x64 SSD1306 OLED (SDA=GPIO21, SCL=GPIO22, addr=0x3C)"
needs_boot_mode = false
group = "OLED Display"

[boards.wireless-paper]
name = "Heltec Wireless Paper"
env = "wireless-paper"
Expand Down
Binary file removed firmware/v1.2.0/esp32-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v1.2.0/esp32-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.0.0/esp32-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.0.0/esp32-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.5.0/esp32-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.5.0/esp32-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-s3-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.6.0/esp32-s3-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-2432s028_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-2432s028_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-devkit_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-devkit_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.7.0/esp32-s3-mini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-1usb-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-1usb-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-1usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-1usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/cyd-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-s3-devkit_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-s3-devkit_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/esp32-s3-mini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/freenove-s3_factory.bin
Binary file not shown.
Binary file removed firmware/v2.8.0/freenove-s3_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0-3-gf6efe3e/cyd-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0-3-gf6efe3e/cyd-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-1usb-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-1usb-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-1usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-1usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/cyd-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-c3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-c3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-c3-supermini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-c3-supermini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-devkit_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-devkit_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-mini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/esp32-s3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/freenove-s3_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.0/freenove-s3_firmware.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/cyd-1usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/cyd-1usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/esp32-c3-oled_factory.bin
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/esp32-s3-oled_factory.bin
Binary file not shown.
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/freenove-s3_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1-1-g492f459/freenove-s3_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-1usb-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-1usb-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-1usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-1usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/cyd-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-c3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-c3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-c3-supermini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-c3-supermini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-devkit_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-devkit_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-mini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/esp32-s3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/freenove-s3_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.1/freenove-s3_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-1usb-st7789_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-1usb-st7789_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-1usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-1usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-2usb_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/cyd-2usb_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-c3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-c3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-c3-supermini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-c3-supermini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-devkit_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-devkit_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-mini_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-mini_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-oled_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/esp32-s3-oled_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/freenove-s3_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/freenove-s3_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/wireless-paper-headless_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/wireless-paper-headless_firmware.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/wireless-paper_factory.bin
Binary file not shown.
Binary file removed firmware/v2.9.3/wireless-paper_firmware.bin
Binary file not shown.
Binary file added images/unnamed.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 27 additions & 27 deletions include/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -396,42 +396,42 @@
// Defined in platformio.ini via -D USE_HARDWARE_SHA=1

// ============================================================
// Generic ESP32 DevKit / WROOM with SSD1306 OLED (Issue #26)
// Standard ESP32 I2C pins; classic Xtensa pipelined SHA (~715 KH/s)
// M5StickC Plus2 - 135x240 ST7789 (SPI)
// ESP32-PICO-V3-02 (classic ESP32/Xtensa LX6) with built-in
// display and two side buttons
// ============================================================
#elif defined(ESP32_DEVKIT_OLED)
#define BOARD_NAME "ESP32-DevKit-OLED"
#elif defined(M5STICKC_PLUS2)
#define BOARD_NAME "M5StickC-Plus2"

// Use OLED display (not TFT)
#define USE_DISPLAY 0
#define USE_OLED_DISPLAY 1

// OLED configuration (128x64 SSD1306 I2C, standard ESP32 I2C pins).
// Guarded so platformio.ini build flags can override per-board wiring.
#ifndef OLED_WIDTH
#define OLED_WIDTH 128
#endif
#ifndef OLED_HEIGHT
#define OLED_HEIGHT 64
#endif
#ifndef OLED_SDA_PIN
#define OLED_SDA_PIN 21
#ifndef USE_DISPLAY
#define USE_DISPLAY 1
#endif
#ifndef OLED_SCL_PIN
#define OLED_SCL_PIN 22
#define DISPLAY_TYPE_TFT 1

#ifdef TFT_WIDTH
#undef TFT_WIDTH
#endif
#ifndef OLED_I2C_ADDR
#define OLED_I2C_ADDR 0x3C
#define TFT_WIDTH 135
#ifdef TFT_HEIGHT
#undef TFT_HEIGHT
#endif
#define TFT_HEIGHT 240

// Main button used by OneButton (Button A -> BUTTON_PIN)
#ifndef BUTTON_PIN
#define BUTTON_PIN 0
#define BUTTON_PIN 37
#endif
#define BUTTON_ACTIVE_LOW 1

// SHA Implementation: classic ESP32 pipelined Xtensa ASM auto-selected via
// CONFIG_IDF_TARGET_ESP32 (USE_HARDWARE_SHA in platformio.ini is cosmetic here)
// Power hold pin: the Plus2 has no PMIC (AXP192 removed vs. the original
// Plus). GPIO4 must be driven HIGH early at boot to latch the power rail
// on; without it the board can brown out / stay unstable once the wake
// pulse ends, which is consistent with the TFT_eSPI init hang seen here.
#define POWER_HOLD_PIN 4

// SHA Implementation: classic ESP32 (Xtensa LX6) pipelined ASM path,
// selected automatically via CONFIG_IDF_TARGET_ESP32 in miner.cpp.
// USE_HARDWARE_SHA is defined in platformio.ini only for the boot log.

// ============================================================
// Default - Generic ESP32
Expand Down Expand Up @@ -496,7 +496,7 @@
// Network Configuration
// ============================================================
#define AP_SSID_PREFIX "SparkMiner_"
#define AP_PASSWORD "minebitcoin"
#define AP_PASSWORD "SparkMiner2024!"

#define WIFI_RECONNECT_MS 10000
#define NTP_UPDATE_MS 600000 // 10 minutes
Expand Down Expand Up @@ -524,4 +524,4 @@
#define MAX_WALLET_LEN 120
#define MAX_JOB_ID_LEN 64

#endif // BOARD_CONFIG_H
#endif // BOARD_CONFIG_H
133 changes: 72 additions & 61 deletions include/display/display_eink.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* SparkMiner - E-Ink Display Driver Implementation
* U8g2-based driver for monochrome e-ink displays
* SparkMiner - E-Ink Display Driver (header)
* Declarations only - implementation lives in src/display/display_eink.cpp
*
* GPL v3 License
*/
Expand All @@ -15,82 +15,93 @@

#if USE_EINK_DISPLAY

/**
* Initialize E-INK display hardware
* @param rotation Screen rotation (0 or 2 for 180 flip)
* @param brightness Not used for e-ink display
*/
void eink_display_init(uint8_t rotation, uint8_t brightness);
#include <HT_lCMEN2R13EFC1.h>
#include <SPI.h>

/**
* Update E-INK display with current data
* @param data Pointer to display data structure
*/
void eink_display_update(const display_data_t *data);
// Default pins (can be overridden in board_config.h)
#ifndef EINK_MOSI_PIN
#define EINK_MOSI_PIN 2
#endif

/**
* Cycle to next screen
*/
void eink_display_next_screen();
#ifndef EINK_MISO_PIN
#define EINK_MISO_PIN -1
#endif

/**
* Show AP configuration screen
*/
void eink_display_show_ap_config(const char *ssid, const char *password, const char *ip);
#ifndef EINK_CLK_PIN
#define EINK_CLK_PIN 3
#endif

/**
* Show boot screen
*/
void eink_display_show_boot();
#ifndef EINK_CS_PIN
#define EINK_CS_PIN 4
#endif

/**
* Show reset countdown
*/
void eink_display_show_reset_countdown(int seconds);
#ifndef EINK_DC_PIN
#define EINK_DC_PIN 5
#endif

/**
* Show reset complete
*/
void eink_display_show_reset_complete();
#ifndef EINK_RST_PIN
#define EINK_RST_PIN 6
#endif

/**
* Force redraw
*/
void eink_display_redraw();
#ifndef EINK_BUSY_PIN
#define EINK_BUSY_PIN 7
#endif

/**
* Flip rotation
*/
uint8_t eink_display_flip_rotation();
#ifndef EINK_EPD_EN_PIN
#define EINK_EPD_EN_PIN 45
#endif

/**
* Set inverted colors
*/
void eink_display_set_inverted(bool inverted);
// Display dimensions (set in board_config.h)
#ifndef EINK_WIDTH
#define EINK_WIDTH 250
#endif

/**
* Get display dimensions
*/
#ifndef EINK_HEIGHT
#define EINK_HEIGHT 122
#endif

#ifndef EINK_SMALL_FONT
#define EINK_SMALL_FONT ArialMT_Plain_10
#endif

#ifndef EINK_MEDIUM_FONT
#define EINK_MEDIUM_FONT ArialMT_Plain_16
#endif

#ifndef EINK_BIG_FONT
#define EINK_BIG_FONT ArialMT_Plain_24
#endif

#ifndef EINK_DEFAULT_FONT
#define EINK_DEFAULT_FONT EINK_MEDIUM_FONT
#endif

// Screen cycling
#define EINK_SCREEN_MAIN 0
#define EINK_SCREEN_STATS 1
#define EINK_SCREEN_COUNT 2

// Public driver API
void eink_display_init(uint8_t rotation, uint8_t brightness);
void eink_display_update(const display_data_t *data);
void eink_display_set_brightness(uint8_t brightness);
void eink_display_next_screen();
void eink_display_show_ap_config(const char *ssid, const char *password, const char *ip);
void eink_display_show_boot();
void eink_display_show_reset_countdown(int seconds);
void eink_display_show_reset_complete();
void eink_display_redraw();
uint8_t eink_display_flip_rotation();
void eink_display_set_rotation(uint8_t rotation);
void eink_display_set_inverted(bool inverted);
uint16_t eink_display_get_width();
uint16_t eink_display_get_height();

/**
* Check portrait mode
*/
bool eink_display_is_portrait();

/**
* Screen management
*/
uint8_t eink_display_get_screen();
void eink_display_set_screen(uint8_t screen);

/**
* Get the E-INK display driver
*/
DisplayDriver* eink_get_driver();

#endif // USE_EINK_DISPLAY

#endif // DISPLAY_EINK_H

#endif // DISPLAY_EINK_H
Loading