Back bone for lua interpreter service

This commit is contained in:
Luc 2019-10-07 17:16:32 +08:00
parent 86ef0248bf
commit 3accd2a694
5 changed files with 113 additions and 0 deletions

View File

@ -47,6 +47,7 @@ before_script:
- cp -r $TRAVIS_BUILD_DIR/libraries/esp8266-oled-ssd1306-4.0.0 $HOME/arduino_ide/libraries/
- cp -r $TRAVIS_BUILD_DIR/libraries/TFT_eSPI-1.4.11 $HOME/arduino_ide/libraries/
- cp -r $TRAVIS_BUILD_DIR/libraries/lv_arduino-2.0.3 $HOME/arduino_ide/libraries/
- cp -r $TRAVIS_BUILD_DIR/libraries/ESP8266-Arduino-Lua-0.0.30 $HOME/arduino_ide/libraries/
- cd $TRAVIS_BUILD_DIR
- source command.sh
- export PATH="$HOME/arduino_ide:$PATH"

View File

@ -167,6 +167,9 @@
//can be a file name, if exists, commands inside will be processed, e.g "/FS:/autostart.esp"
#define ESP_AUTOSTART_SCRIPT "M117 Mouning SD\nM21\n"
//ESP_LUA_INTERPRETER_FEATURE : add lua scripting feature
#define ESP_LUA_INTERPRETER_FEATURE
//Extra features /////////////////////////////////////////////////////////////////////////
/************************************
*

View File

@ -43,6 +43,9 @@
#ifdef ESP_GCODE_HOST_FEATURE
#include "../modules/gcode_host/gcode_host.h"
#endif //ESP_GCODE_HOST_FEATURE
#ifdef ESP_LUA_INTERPRETER_FEATURE
#include "../modules/lua_interpreter/lua_interpreter_service.h"
#endif //#ifdef
#include "esp3doutput.h"
#include "../modules/boot_delay/boot_delay.h"

View File

@ -0,0 +1,66 @@
/*
lua_interpreter_service.cpp - ESP3D lua interpreter service class
Copyright (c) 2014 Luc Lebosse. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../../include/esp3d_config.h"
#ifdef ESP_LUA_INTERPRETER_FEATURE
#include "lua_interpreter_service.h"
#include "../../core/settings_esp3d.h"
#include "../../core/hal.h"
#include <LuaWrapper.h>
LuaWrapper luawrapper;
LuaInterpreter esp3d_lua_interpreter;
LuaInterpreter::LuaInterpreter()
{
_started = false;
}
bool LuaInterpreter::begin()
{
if(_started) {
end();
}
_started = true;
return _started;
}
void LuaInterpreter::end()
{
if(!_started) {
return;
}
_started = false;
}
void LuaInterpreter::handle()
{
//Nothing to do as handled by ticker / task
}
LuaInterpreter::~LuaInterpreter()
{
end();
}
#endif //ESP_LUA_INTERPRETER_FEATURE

View File

@ -0,0 +1,40 @@
/*
lua_interpreter_service.h - ESP3D lua interpreter service class
Copyright (c) 2014 Luc Lebosse. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _LUA_INTERPRETER_H
#define _LUA_INTERPRETER_H
class LuaInterpreter
{
public:
LuaInterpreter();
~LuaInterpreter();
bool started()
{
return _started;
}
bool begin();
void end();
void handle();
private:
bool _started;
};
extern LuaInterpreter esp3d_lua_interpreter;
#endif //_LUA_INTERPRETER_H