diff options
Diffstat (limited to '_log/e-reader.md')
| -rw-r--r-- | _log/e-reader.md | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/_log/e-reader.md b/_log/e-reader.md index bc979ea..583788d 100644 --- a/_log/e-reader.md +++ b/_log/e-reader.md @@ -6,20 +6,20 @@ project: true thumbnail: thumb_sm.png --- -Built an e-reader using an ESP-WROOM-32, a 7.5" Waveshare e-paper display, and -a three-button interface (prev/next/sleep). +Stitched together 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-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 +ESP-WROOM-32 has 512 KB SRAM and 4 MB flash. Internal flash is unsuitable for +storing books due to P/E cycle limit. Streamed pages via HTTP on-demand +instead. Reading progress is saved in RTC memory to survive deep sleep without flash wear. Rasterized PDFs into sequences of bitmaps. 1 byte = 8 pixels, 1 page = 48 KB -(display resolution), headerless. Optimized for Range requests without +(the display resolution), headerless; optimized for HTTP Range requests without server-side logic: ``` @@ -34,30 +34,18 @@ esp_http_client_set_header(http_client, "Range", buf); esp_http_client_perform(http_client); ``` -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. +A circular buffer stores three pages—maximum possible with the 512 KB. +Button-triggered GPIO interrupts cycle the buffer, update the screen, and +prefetch the next page. -``` -c_page_num++; -pg.page_num = c_page_num + 2; -pg.page_buf = pages[(c_page_num + 1) % PAGE_LEN]; - -xSemaphoreGive(mutex); -xQueueSend(http_evt_queue, &pg, portMAX_DELAY); - -epd_draw_async(pages[c_page_num % PAGE_LEN], PAGE_SIZE); -epd_draw_await(); -``` +Reader isn't as responsive as I'd hoped. Scheduling GPIO, SPI, and HTTP tasks +on a single core causes input lag. -System isn't as responsive as I'd hoped. Scheduling GPIO, SPI, and HTTP tasks -on a single core causes input lag. Pinned the GPIO/SPI tasks to one core and -the HTTP task to the other. +Pinned the GPIO and SPI tasks to one core and the HTTP task to the other. -Better, but screen updates block user input; page turning feels sluggish. +Better, but screen updates block user input. Page turning feels sluggish. -Moved the SPI buffers to DMA and made the transfers async, hoping to shave off -a few more cycles. +Moved SPI buffers to DMA and made transfers async, hoping to offload the CPU. Can't think of anything else. Led to [Etlas](../etlas/). |
