rename main file to inkpot
This commit is contained in:
parent
2cfba0c5c8
commit
ad99018809
5 changed files with 8709 additions and 12 deletions
|
|
@ -1,2 +1,2 @@
|
|||
idf_component_register(SRCS "esp32-lua-example.c"
|
||||
idf_component_register(SRCS "inkpot.c"
|
||||
INCLUDE_DIRS ".")
|
||||
|
|
|
|||
2044
main/departure_mono_11.h
Normal file
2044
main/departure_mono_11.h
Normal file
File diff suppressed because it is too large
Load diff
6558
main/departure_mono_22.h
Normal file
6558
main/departure_mono_22.h
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -14,11 +14,7 @@
|
|||
#include "esp_littlefs.h"
|
||||
#include <dirent.h>
|
||||
|
||||
// epd
|
||||
//#include <epd_highlevel.h>
|
||||
#include <epdiy.h>
|
||||
|
||||
#define WAVEFORM EPD_BUILTIN_WAVEFORM
|
||||
#include "paper.h"
|
||||
|
||||
#define WIFI_SCAN_LIST_SIZE 10
|
||||
#define LUA_FILE_PATH "/assets"
|
||||
|
|
@ -110,6 +106,9 @@ void run_embedded_lua_test(const char *lua_script, const char *test_name) {
|
|||
luaL_openlibs(L);
|
||||
log_memory_usage("After luaL_openlibs");
|
||||
|
||||
luaopen_paper(L);
|
||||
log_memory_usage("After luaopen_paper");
|
||||
|
||||
if (luaL_dostring(L, lua_script) == LUA_OK) {
|
||||
lua_pop(L, lua_gettop(L));
|
||||
} else {
|
||||
|
|
@ -170,10 +169,8 @@ void scan_wifi_networks(void) {
|
|||
ESP_LOGI(TAG, "Wi-Fi scan completed.");
|
||||
}
|
||||
|
||||
EpdiyHighlevelState hl;
|
||||
uint8_t* fb;
|
||||
|
||||
void app_main(void) {
|
||||
/*
|
||||
epd_init(&epd_board_lilygo_t5_47, &ED097TC2, EPD_LUT_64K);
|
||||
// epd_set_vcom(1560);
|
||||
hl = epd_hl_init(WAVEFORM);
|
||||
|
|
@ -196,14 +193,37 @@ void app_main(void) {
|
|||
.width = 200,
|
||||
.height = 100
|
||||
};
|
||||
epd_fill_rect(some_rect, 0x0, fb);
|
||||
epd_draw_rect(some_rect, 0x0, fb);
|
||||
|
||||
// write a message
|
||||
int cursor_x = 100;
|
||||
int cursor_y = 300;
|
||||
epd_write_default(&DepartureMono22, "TODO 2025-10-04", &cursor_x, &cursor_y, fb);
|
||||
|
||||
int cursor_x_2 = 100;
|
||||
int cursor_y_2 = 344;
|
||||
epd_write_default(&DepartureMono11, "- [ ] Create epaper thingy", &cursor_x_2, &cursor_y_2, fb);
|
||||
|
||||
int cursor_x_3 = 100;
|
||||
int cursor_y_3 = 377;
|
||||
epd_write_default(&DepartureMono11, "- [ ] Be kind", &cursor_x_3, &cursor_y_3, fb);
|
||||
|
||||
int cursor_x_4 = 100;
|
||||
int cursor_y_4 = 410;
|
||||
epd_write_default(&DepartureMono11, "- [ ] Enjoy life", &cursor_x_4, &cursor_y_4, fb);
|
||||
|
||||
// draw a line pattern
|
||||
for (int i = 0; i < 20; i++) {
|
||||
epd_draw_line(400 + i * 20, 100, 400 + (i + 1) * 20, 300, 0x0, fb);
|
||||
epd_draw_line(401 + i * 20, 100, 401 + (i + 1) * 20, 300, 0x0, fb);
|
||||
}
|
||||
|
||||
// finally, update the display!
|
||||
int temperature = 25;
|
||||
epd_poweron();
|
||||
epd_hl_update_screen(&hl, MODE_GC16, temperature);
|
||||
epd_poweroff();
|
||||
|
||||
*/
|
||||
// Initialize and mount the filesystem
|
||||
init_filesystem();
|
||||
|
||||
|
|
@ -211,6 +231,9 @@ void app_main(void) {
|
|||
const char *simple_script = "answer = 42; print('The answer is: '..answer)";
|
||||
run_embedded_lua_test(simple_script, "Simple Embedded Script");
|
||||
|
||||
//const char *paper_script = "local paper = require('paper'); paper.init(); print('width: '..paper.get_width(), 'height: '..paper.get_height())";
|
||||
//run_embedded_lua_test(paper_script, "Paper Script");
|
||||
|
||||
// Test 2: Run Lua script from a file (e.g., fibonacci.lua)
|
||||
run_lua_file("fibonacci.lua", "Fibonacci Script from File");
|
||||
|
||||
|
|
@ -218,7 +241,7 @@ void app_main(void) {
|
|||
run_lua_file("qr_code.lua", "QR Code Script from File");
|
||||
|
||||
// Perform Wi-Fi scan
|
||||
scan_wifi_networks();
|
||||
// scan_wifi_networks();
|
||||
|
||||
ESP_LOGI(TAG, "End of testing application.");
|
||||
|
||||
|
|
|
|||
72
main/paper.h
Normal file
72
main/paper.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#ifndef PAPER_H_
|
||||
#define PAPER_H_
|
||||
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#include <epdiy.h>
|
||||
#include "departure_mono_11.h"
|
||||
#include "departure_mono_22.h"
|
||||
|
||||
#define WAVEFORM EPD_BUILTIN_WAVEFORM
|
||||
|
||||
EpdiyHighlevelState hl;
|
||||
uint8_t* fb;
|
||||
|
||||
static int init (lua_State *L) {
|
||||
epd_init(&epd_board_lilygo_t5_47, &ED097TC2, EPD_LUT_64K);
|
||||
// epd_set_vcom(1560);
|
||||
hl = epd_hl_init(WAVEFORM);
|
||||
epd_set_rotation(EPD_ROT_LANDSCAPE);
|
||||
fb = epd_hl_get_framebuffer(&hl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int clear (lua_State *L){
|
||||
epd_clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_width (lua_State *L) {
|
||||
int width = epd_rotated_display_width();
|
||||
lua_pushnumber(L, width);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int get_height (lua_State *L) {
|
||||
int height = epd_rotated_display_height();
|
||||
lua_pushnumber(L, height);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int draw_line (lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update (lua_State *L) {
|
||||
int temperature = 25;
|
||||
epd_poweron();
|
||||
epd_hl_update_screen(&hl, MODE_GC16, temperature);
|
||||
epd_poweroff();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct luaL_Reg paper[] = {
|
||||
{"init", init},
|
||||
{"clear", clear},
|
||||
|
||||
{"get_width", get_width},
|
||||
{"get_height", get_height},
|
||||
|
||||
{"draw_line", draw_line},
|
||||
{"update", update},
|
||||
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
int luaopen_paper (lua_State *L) {
|
||||
luaL_newlib(L, paper);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // PAPER_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue