diff --git a/firmware/config/engines/custom_engine.cpp b/firmware/config/engines/custom_engine.cpp index bc776d26d9..786deae396 100644 --- a/firmware/config/engines/custom_engine.cpp +++ b/firmware/config/engines/custom_engine.cpp @@ -928,6 +928,10 @@ pid = Pid.new(2, 0, 0, -100, 100) biasCurveIndex = findCurveIndex("bias") +function onCanRx(id, dlc, data) + print(id .. ' ' .. dlc .. data) +end + function onTick() local targetVoltage = getAuxAnalog(0) diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index fa9f750b97..1c944c98e9 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -376,15 +376,6 @@ static int lua_setFuelMult(lua_State* l) { #endif // EFI_UNIT_TEST -#if EFI_CAN_SUPPORT -static int lua_canRxAdd(lua_State* l) { - auto eid = luaL_checkinteger(l, 1); - addLuaCanRxFilter(eid); - - return 0; -} -#endif // EFI_CAN_SUPPORT - struct LuaSensor final : public StoredValueSensor { LuaSensor() : LuaSensor("Invalid") { } @@ -479,7 +470,6 @@ void configureRusefiLuaHooks(lua_State* l) { lua_register(l, "table3d", lua_table3d); lua_register(l, "curve", lua_curve2d); lua_register(l, "findCurveIndex", lua_findCurveIndex); - lua_register(l, "txCan", lua_txCan); #if !EFI_UNIT_TEST lua_register(l, "startPwm", lua_startPwm); @@ -511,7 +501,13 @@ void configureRusefiLuaHooks(lua_State* l) { }); #if EFI_CAN_SUPPORT - lua_register(l, "canRxAdd", lua_canRxAdd); + lua_register(l, "txCan", lua_txCan); + lua_register(l, "canRxAdd", [](lua_State* l) { + auto eid = luaL_checkinteger(l, 1); + addLuaCanRxFilter(eid); + + return 0; + }); #endif // EFI_CAN_SUPPORT #endif // not EFI_UNIT_TEST }