rename assets/epaper.lua to assets/boot.lua
This commit is contained in:
parent
646f1eaf80
commit
45831590dc
4 changed files with 38 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
33
assets/post_test.lua
Normal file
33
assets/post_test.lua
Normal file
|
|
@ -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()
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue