GM ETB bench test in NJ #4688

SENT to Lua integration
This commit is contained in:
rusefi 2022-10-22 22:46:37 -04:00
parent 171e1ad2b3
commit 6e24020ab5
4 changed files with 23 additions and 2 deletions

View File

@ -24,7 +24,11 @@ using namespace luaaa;
#if EFI_PROD_CODE
#include "electronic_throttle_impl.h"
#endif
#endif // EFI_PROD_CODE
#if EFI_SENT_SUPPORT
#include "sent.h"
#endif // EFI_SENT_SUPPORT
static int lua_vin(lua_State* l) {
auto zeroBasedCharIndex = luaL_checkinteger(l, 1);
@ -669,6 +673,16 @@ void configureRusefiLuaHooks(lua_State* l) {
return 1;
});
#if EFI_SENT_SUPPORT
lua_register(l, "getSentValue",
[](lua_State* l) {
auto humanIndex = luaL_checkinteger(l, 1);
auto value = getSentValue(humanIndex - 1);
lua_pushnumber(l, value);
return 1;
});
#endif // EFI_SENT_SUPPORT
#if EFI_LAUNCH_CONTROL
lua_register(l, "setSparkSkipRatio", [](lua_State* l) {
auto targetSkipRatio = luaL_checknumber(l, 1);

View File

@ -572,6 +572,11 @@ static void printSentInfo()
}
}
float getSentValue(int index) {
// todo: just return ETB 0 to 100% for now?
return 23;
}
/* Should be called once */
void initSent(void)
{

View File

@ -18,3 +18,5 @@ void SENT_ISR_Handler(uint8_t ch, uint16_t val_res);
/* Stop/Start for config update */
void startSent(void);
void stopSent(void);
float getSentValue(int index);

View File

@ -249,7 +249,7 @@ void applyNewHardwareSettings() {
#if EFI_SENT_SUPPORT
stopSent();
#endif
#endif // EFI_SENT_SUPPORT
#if (HAL_USE_PAL && EFI_JOYSTICK)
stopJoystickPins();