From 45831590dc5b1a0a27b22164aef3b4ed18984bcf Mon Sep 17 00:00:00 2001 From: arne Date: Sun, 5 Oct 2025 12:11:56 +0200 Subject: [PATCH] rename `assets/epaper.lua` to `assets/boot.lua` --- README.md | 5 +++-- assets/{epaper.lua => boot.lua} | 0 assets/post_test.lua | 33 +++++++++++++++++++++++++++++++++ main/inkpot.c | 4 ++-- 4 files changed, 38 insertions(+), 4 deletions(-) rename assets/{epaper.lua => boot.lua} (100%) create mode 100644 assets/post_test.lua diff --git a/README.md b/README.md index b24ddfe..819705f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ You need to give it a 2.4Ghz Wifi SSID and password by adjusting `main/settings. You can send scripts like this: ``` bash -cat foo.lua | curl -X POST --data-binary @- 10.0.0.100/draw +cat assets/post_test.lua | curl -X POST --data-binary @- 10.0.0.100/draw ``` The IP address of the display is logged to its serial output and can be read via `idf.py monitor` (see below). @@ -42,5 +42,6 @@ You can stop the monitor by pressing `Ctrl + ]`. - `inkpot.c`: Main program containing embedded Lua script and file-based Lua execution. - `paper.c`: Defines the lua bindings to epdiy that can be used for drawing on the screen. - `assets/`: Directory containing all Lua scripts; some are older example scripts that are not executed - - `epaper.lua` contains the sketch that runs at startup + - `boot.lua` contains the sketch that runs at startup + - `post_test.lua` contains another sketch diff --git a/assets/epaper.lua b/assets/boot.lua similarity index 100% rename from assets/epaper.lua rename to assets/boot.lua diff --git a/assets/post_test.lua b/assets/post_test.lua new file mode 100644 index 0000000..364eb85 --- /dev/null +++ b/assets/post_test.lua @@ -0,0 +1,33 @@ +local math = require('math') +local paper = require('paper') + +paper.init() +paper.set_rotation("portrait") +paper.clear() + +local width = paper.get_width() +local height = paper.get_height() + +print( + 'width: ' .. width, + 'height: ' .. height +) + +paper.clear() +paper.fill_rect(0, 0, width, height, 0x22) + +for i = 0, 4 do + local off = 40 * i + + local color + if i % 2 == 0 then + color = 0x22 + else + color = 0xDD + end + + paper.fill_rect(off, off, width - off, height - off, color) +end + +paper.update() + diff --git a/main/inkpot.c b/main/inkpot.c index b6d0d65..a27555a 100644 --- a/main/inkpot.c +++ b/main/inkpot.c @@ -289,10 +289,10 @@ void app_main(void) { register_http_routes(server); } - // Run script in assets/epaper.lua; this is executed as a FreeRTOS task + // Run script in assets/boot.lua; this is executed as a FreeRTOS task // that may not be interrupted void runLuaFile (void* arg) { - run_lua_file("epaper.lua", "E-Paper Startup Script"); + run_lua_file("boot.lua", "E-Paper Startup Script"); vTaskDelete(NULL); } xTaskCreate(runLuaFile, "run_lua_file", 4096, NULL, tskIDLE_PRIORITY, NULL);