Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | // file lua_hooks.h | |||
2 | ||||
3 | #pragma once | |||
4 | ||||
5 | struct lua_State; | |||
6 | void configureRusefiLuaHooks(lua_State*); | |||
7 | void luaDeInitPins(); | |||
8 | ||||
9 | struct AirmassModelBase; | |||
10 | AirmassModelBase& getLuaAirmassModel(); | |||
11 | bool getAuxDigital(int index); | |||
12 | uint32_t getLuaArray(lua_State* l, int paramIndex, uint8_t *data, uint32_t size); | |||
13 | ||||
14 | struct LuaOverrideSensor final : public Sensor { | |||
15 | 4 | LuaOverrideSensor(SensorType type, SensorType underlyingType) : Sensor(type) { | ||
16 | 4 | m_underlyingType = underlyingType; | ||
17 | 4 | reset(); | ||
18 | 4 | } | ||
19 | ||||
20 | 5 | void reset() { | ||
21 | 5 | overrideValue = -1; | ||
22 | 5 | } | ||
23 | ||||
24 | 1 | void setOverrideValue(float value) { | ||
25 | 1 | overrideValue = value; | ||
26 | 1 | } | ||
27 | ||||
28 | 4 | SensorResult get() const final override { | ||
29 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 time.
|
2/2✓ Decision 'true' taken 3 times.
✓ Decision 'false' taken 1 time.
|
4 | if (overrideValue < 0) |
30 | 3 | return Sensor::get(m_underlyingType); | ||
31 | 1 | return overrideValue; | ||
32 | } | |||
33 | ||||
34 | ✗ | void showInfo(const char* sensorName) const override { | ||
35 | ✗ | efiPrintf("LuaOverrideSensor \"%s\": override value %.2f", sensorName, overrideValue); | ||
36 | ✗ | } | ||
37 | ||||
38 | float overrideValue = -1; | |||
39 | SensorType m_underlyingType; | |||
40 | }; | |||
41 | ||||
42 | void startPwm(int index, float freq, float duty); | |||
43 | void setPwmDuty(int index, float duty); | |||
44 |