mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-07-30 22:22:02 +08:00
Back bone for lua interpreter service
This commit is contained in:
parent
86ef0248bf
commit
3accd2a694
@ -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"
|
||||
|
@ -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 /////////////////////////////////////////////////////////////////////////
|
||||
/************************************
|
||||
*
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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
|
40
esp3d/src/modules/lua_interpreter/lua_interpreter_service.h
Normal file
40
esp3d/src/modules/lua_interpreter/lua_interpreter_service.h
Normal 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
|
Loading…
x
Reference in New Issue
Block a user