diff --git a/.travis.yml b/.travis.yml index 60fbf4be..03f963d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/esp3d/configuration.h b/esp3d/configuration.h index 58bb0b7b..078f0c2a 100644 --- a/esp3d/configuration.h +++ b/esp3d/configuration.h @@ -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 ///////////////////////////////////////////////////////////////////////// /************************************ * diff --git a/esp3d/src/core/esp3d.cpp b/esp3d/src/core/esp3d.cpp index 21907d21..ba6d0387 100644 --- a/esp3d/src/core/esp3d.cpp +++ b/esp3d/src/core/esp3d.cpp @@ -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" diff --git a/esp3d/src/modules/lua_interpreter/lua_interpreter_service.cpp b/esp3d/src/modules/lua_interpreter/lua_interpreter_service.cpp new file mode 100644 index 00000000..d6fbcf4a --- /dev/null +++ b/esp3d/src/modules/lua_interpreter/lua_interpreter_service.cpp @@ -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 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 diff --git a/esp3d/src/modules/lua_interpreter/lua_interpreter_service.h b/esp3d/src/modules/lua_interpreter/lua_interpreter_service.h new file mode 100644 index 00000000..80fb8860 --- /dev/null +++ b/esp3d/src/modules/lua_interpreter/lua_interpreter_service.h @@ -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