mirror of https://github.com/FOME-Tech/fome-fw.git
my first Lua
This commit is contained in:
parent
daf7bad539
commit
94fcb15506
|
@ -7,6 +7,7 @@
|
|||
#include "airmass.h"
|
||||
#include "lua_airmass.h"
|
||||
#include "can_msg_tx.h"
|
||||
#include "settings.h"
|
||||
|
||||
// Some functions lean on existing FSIO implementation
|
||||
#include "fsio_impl.h"
|
||||
|
@ -19,6 +20,14 @@ static int lua_efi_print(lua_State* l) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int lua_readpin(lua_State* l) {
|
||||
auto msg = luaL_checkstring(l, 1);
|
||||
#if ! EFI_UNIT_TEST
|
||||
readPin(msg);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lua_getSensor(lua_State* l) {
|
||||
auto sensorIndex = luaL_checkinteger(l, 1);
|
||||
|
||||
|
@ -281,6 +290,7 @@ static int lua_stopEngine(lua_State*) {
|
|||
|
||||
void configureRusefiLuaHooks(lua_State* l) {
|
||||
lua_register(l, "print", lua_efi_print);
|
||||
lua_register(l, "readpin", lua_readpin);
|
||||
lua_register(l, "getSensor", lua_getSensor);
|
||||
lua_register(l, "getSensorRaw", lua_getSensorRaw);
|
||||
lua_register(l, "hasSensor", lua_hasSensor);
|
||||
|
|
|
@ -466,7 +466,7 @@ static void setIgnitionPin(const char *indexStr, const char *pinName) {
|
|||
}
|
||||
|
||||
// this method is useful for desperate time debugging
|
||||
static void readPin(const char *pinName) {
|
||||
void readPin(const char *pinName) {
|
||||
brain_pin_e pin = parseBrainPinWithErrorMessage(pinName);
|
||||
if (pin == GPIO_INVALID) {
|
||||
return;
|
||||
|
|
|
@ -17,6 +17,8 @@ void scheduleStopEngine(void);
|
|||
void setCallFromPitStop(int durationMs);
|
||||
void printTPSInfo(void);
|
||||
void setEngineType(int value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void readPin(const char *pinName);
|
||||
|
||||
/**
|
||||
* See also getEngine_type_e()
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue