Closed luc-github closed 2 months ago
the lua interpreter seems working well - it is currently limited to esp8266 but it compile on esp32 the footprint is not big so very promising there is a pr for adding additionnal commands that is also nice need to do a user case script to check like :
Lua interpreter Lib is now ready for integration : https://github.com/luc-github/ESP8266-Arduino-Lua works on ESP8266/ESP32 Next steps will be:
[ESP750] </FS:/scriptname> <RESIDENT>
command to execute script on demand, blocking (wait for end) or resident (create a task for it on ESP32 / TBD on ESP8266)[ESPXXX]<parameters>
from lua scriptsome integration figures for lib only without extra functions: On ESP32: with lib : 1178950 bytes without lib : 1081694 bytes footprint: 97,256 bytes
On ESP8266: with lib : 598338 bytes without lib : 497818 bytes footprint: 100,520 bytes
So for ESP8266 the impact is noticeable if not 4M Flash but should be ok on others which allow 1M firmware size.
here https://github.com/luc-github/ESP3D/issues/479 there some user case and should be a good start to list what is missing:
So far what I have been noted 1 - an ESP command to launch script but should not be blocking function 2 - need a function to send data to printer serial to be able to echo it also on websocket monitor, lua allows already to send directly to serial but in that case there is no control on output 3 - need a function to catch the serial input so script can process it 4 - need a state function to get if a script is active, the script name and for how long 5 - need a function to kill an script in case of too long or in dead loop, this part may be also in addition of kind of timeout
another user case that is also may will part of webUI : https://github.com/luc-github/ESP3D-WEBUI/issues/237 macro_-_home_XY_to_center_of_hole.gcode.txt
I created a new library https://github.com/luc-github/EspLuaEngine, it is inspired from https://github.com/fdu/ESP8266-Arduino-Lua but it is done from scratch, no common code, and logic is different.
While It is very basic but also very flexible, I want to add it to ESP3D, to replace ESP8266-Arduino-Lua
but to avoid a blocking script, I plan to limit usage to ESP32 to use tasks and become not blocking
On ESP8266 it could be challenging especially if script is supposed to monitor pins states
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I got several request for unsupported user cases adding some scripting would be a flexible solution like https://github.com/fdu/ESP8266-Arduino-Lua
may be use a dedicated task on esp32 for it for esp8266 TBD as is must not disturb wifi upload and esp8266 is very sensitive