summaryrefslogtreecommitdiffstats
path: root/_log
diff options
context:
space:
mode:
Diffstat (limited to '_log')
-rw-r--r--_log/e-reader.md38
1 files changed, 18 insertions, 20 deletions
diff --git a/_log/e-reader.md b/_log/e-reader.md
index a1f1b0a..a754a52 100644
--- a/_log/e-reader.md
+++ b/_log/e-reader.md
@@ -1,29 +1,26 @@
---
-title: 512 KB e-reader
+title: Built a 0 MB streaming e-reader
date: 2023-10-24
layout: post
project: true
thumbnail: thumb_sm.png
---
-Been dabbling in microcontrollers—mostly Arduino Uno/ATmega328P. Math major, no
-formal electronics training. This, however, is an ESP-32 project—first
-resembling something practical.
+Built an e-reader using an ESP-WROOM-32, a 7.5" Waveshare e-paper display, and
+a three-button interface (prev/next/sleep).
<video style="max-width:100%;" controls="" poster="poster.png">
<source src="ereader.mp4" type="video/mp4">
</video>
-ESP-WROOM-32, 7.5" Waveshare e-paper display, three-button interface
-(prev/next/sleep).
+ESP-32-WROOM has 512 KB SRAM and 4 MB flash. Internal flash is unsuitable for
+storing books due to P/E cycle limit. Used HTTP Range requests to stream them
+on-demand. Saved reading progress to RTC memory to survive deep sleep without
+flash wear.
-Memory: 512 KB SRAM + 4 MB flash. Internal flash unsuitable for storing books
-due to P/E cycle limit. Used HTTP Range requests to stream them on-demand.
-Progress saved to RTC memory to survive deep sleep without flash wear.
-
-PDFs are rasterized and stored as sequences of bitmaps on a server. 1 byte = 8
-pixels, 1 page = 48 KB (display resolution), headerless. Optimized for Range
-requests without server-side logic:
+Rasterized PDFs into sequences of bitmaps. 1 byte = 8 pixels, 1 page = 48 KB
+(display resolution), headerless. Optimized for Range requests without
+server-side logic:
```
int r0 = ((page_n - 1) * PAGE_SIZE);
@@ -37,9 +34,9 @@ esp_http_client_set_header(http_client, "Range", buf);
esp_http_client_perform(http_client);
```
-Three pages (prev/current/next) stored in a circular buffer—max possible. Upon
-request (via GPIO interrupts), application cycles buffer, updates screen,
-prefetches next page.
+Implemented a three-page circular buffer (prev/current/next)—maximum possible
+with 512 KB. GPIO interrupts triggered by button presses cycle the buffer,
+update the screen, and prefetch the next page.
```
c_page_num++;
@@ -54,12 +51,13 @@ epd_draw_await();
```
System isn't as responsive as I'd hoped. Scheduling GPIO, SPI, and HTTP tasks
-on a single thread causes input lag. Pinned GPIO/SPI tasks to one core and the
-HTTP task to the other.
+on a single core causes input lag. Pinned the GPIO/SPI tasks to one core and
+the HTTP task to the other.
-Better, but screen updates block user input.
+Better, but screen updates block user input; page turning feels sluggish.
-Moved SPI buffers to DMA and made transfers async. Few more cycles saved.
+Moved the SPI buffers to DMA and made the transfers async, hoping to shave off
+a few more cycles.
Can't think of anything else. Led to [Etlas](../etlas/).