A minimal EPUB/TXT reader for ESP32-C3 e-ink devices.
- Antialiased font rendering
- TXT file reader with advanced text layout
- File browser for SD card navigation
- EPUB reader
- Bold/Italic Font support
- EPUB support
- Hyphenation for better text justification
- Board: ESP32-C3 (QFN32) revision v0.4
- Chip: ESP32-C3 (RISC-V @ 160MHz)
- MAC Address: 9c:13:9e:64:a6:c4
- RAM: 400KB SRAM
- Flash: 16MB
- Display: 4.26" E-Ink GDEQ0426T82 (800×480px, SSD1677 controller)
- Custom SPI pins: SCLK=8, MOSI=10, CS=21, DC=4, RST=5, BUSY=6
- Supports B&W and 4-level grayscale modes
- Storage: SD Card
- Features: WiFi, BLE
# Build
platformio run
# Upload
platformio run -t upload
# Monitor
platformio device monitorBefore flashing custom firmware, back up the factory firmware:
# Read entire 16MB flash
python -m esptool --chip esp32c3 --port COM5 read_flash 0x0 0x1000000 firmware_backup.bin# Read only app0 (faster)
python -m esptool --chip esp32c3 --port COM5 read_flash 0x10000 0x640000 app0_backup.binTo restore the backed-up firmware:
# Write back the entire flash
python -m esptool --chip esp32c3 --port COM5 write_flash 0x0 firmware_backup.bin# Write back only app0 (faster)
python -m esptool --chip esp32c3 --port COM5 write_flash 0x10000 app0_backup.binImportant: Make sure to use the correct COM port for your device.
# Backup current OTA data first
python -m esptool --port COM4 read_flash 0xE000 0x2000 otadata_backup.bin
# Flash to switch boot partition
# Boot app0
python -m esptool --port COM4 write_flash 0xE000 otadata_boot_app0.bin
# Boot app1
python -m esptool --port COM4 write_flash 0xE000 otadata_boot_app1.binThe project includes a test suite for validating text layout, word providers, and rendering:
Available Tests:
StringWordProviderBidirectionalTest- Validates bidirectional text tokenizationGreedyLayoutBidirectionalParagraphTest- Tests greedy line breaking with bidirectional navigationTextLayoutPageRenderTest- Full page rendering and pagination tests
scripts/generate_simplefont/ - Generate grayscale font headers from TrueType fonts
- CLI tool with character subset support
- GUI for glyph preview
- Generates bitmap preview images
# Install dependencies first
python -m pip install -r scripts/generate_simplefont/requirements.txt
# Generate font header
python -m scripts.generate_simplefont.cli --name Font14 --size 16 --chars-file .\data\chars_input.txt --out src/resources/fonts/Font14.h --ttf .\data\YourFont.ttf
# Preview glyphs with GUI
python scripts/generate_simplefont/gui.pyscripts/simple_convert_image.py - Convert images to C++ byte arrays for display
- Supports 1-bit (B&W) and 2-bit (4-level grayscale) output
- Generates .h header files
scripts/lut_editor.py - Visual editor for e-ink display waveform lookup tables
- Edit voltage patterns and timing groups
- Configure display refresh settings
scripts/extract_chars.py - Extract unique characters from text files for font generation