2024-04-17 22:16:40 -07:00
|
|
|
// file lua_hooks.h
|
|
|
|
|
2021-04-28 19:41:25 -07:00
|
|
|
#pragma once
|
|
|
|
|
2021-07-15 21:49:14 -07:00
|
|
|
struct lua_State;
|
2021-04-28 19:41:25 -07:00
|
|
|
void configureRusefiLuaHooks(lua_State*);
|
2021-06-28 05:39:03 -07:00
|
|
|
void luaDeInitPins();
|
2021-07-15 21:49:14 -07:00
|
|
|
|
|
|
|
struct AirmassModelBase;
|
|
|
|
AirmassModelBase& getLuaAirmassModel();
|
2023-11-21 08:53:15 -08:00
|
|
|
bool getAuxDigital(int index);
|
2024-03-21 07:48:17 -07:00
|
|
|
|
|
|
|
struct LuaOverrideSensor final : public Sensor {
|
|
|
|
LuaOverrideSensor(SensorType type, SensorType underlyingType) : Sensor(type) {
|
|
|
|
m_underlyingType = underlyingType;
|
|
|
|
reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
void reset() {
|
|
|
|
overrideValue = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setOverrideValue(float value) {
|
|
|
|
overrideValue = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
SensorResult get() const final override {
|
|
|
|
if (overrideValue < 0)
|
|
|
|
return Sensor::get(m_underlyingType);
|
|
|
|
return overrideValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
void showInfo(const char* sensorName) const override {
|
|
|
|
efiPrintf("LuaOverrideSensor \"%s\": override value %.2f", sensorName, overrideValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
float overrideValue = -1;
|
|
|
|
SensorType m_underlyingType;
|
|
|
|
};
|
2024-04-04 11:13:04 -07:00
|
|
|
|
|
|
|
void startPwm(int index, float freq, float duty);
|
|
|
|
void setPwmDuty(int index, float duty);
|