| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | /* | |||
| 2 | * @file engine_parts.h | |||
| 3 | * | |||
| 4 | * @date May 27, 2019 | |||
| 5 | * @author Andrey Belomutskiy, (c) 2012-2020 | |||
| 6 | */ | |||
| 7 | ||||
| 8 | #pragma once | |||
| 9 | ||||
| 10 | #include "static_vector.h" | |||
| 11 | #include <rusefi/timer.h> | |||
| 12 | ||||
| 13 | #define MOCK_ADC_SIZE 26 | |||
| 14 | ||||
| 15 | struct Accelerometer { | |||
| 16 | float lat = 0; // G value | |||
| 17 | float lon = 0; | |||
| 18 | float vert = 0; | |||
| 19 | float yawRate = 0; | |||
| 20 | }; | |||
| 21 | ||||
| 22 | struct SensorsState { | |||
| 23 | Accelerometer accelerometer; | |||
| 24 | }; | |||
| 25 | ||||
| 26 | class TransmissionState { | |||
| 27 | public: | |||
| 28 | gear_e gearSelectorPosition; | |||
| 29 | }; | |||
| 30 | ||||
| 31 | struct warning_t { | |||
| 32 | Timer LastTriggered; | |||
| 33 | ObdCode Code = ObdCode::None; | |||
| 34 | ||||
| 35 | 16272 | warning_t() { } | ||
| 36 | ||||
| 37 | 148 | explicit warning_t(ObdCode code) | ||
| 38 | 148 | : Code(code) | ||
| 39 | { | |||
| 40 | 148 | } | ||
| 41 | ||||
| 42 | // Equality just checks the code, timer doesn't matter | |||
| 43 | bool operator ==(const warning_t& other) const { | |||
| 44 | return other.Code == Code; | |||
| 45 | } | |||
| 46 | ||||
| 47 | // Compare against a plain OBD code | |||
| 48 | 7891 | bool operator ==(const ObdCode other) const { | ||
| 49 | 7891 | return other == Code; | ||
| 50 | } | |||
| 51 | }; | |||
| 52 | ||||
| 53 | typedef static_vector<warning_t, 24> warningBuffer_t; | |||
| 54 | ||||
| 55 | class WarningCodeState { | |||
| 56 | public: | |||
| 57 | WarningCodeState(); | |||
| 58 | void addWarningCode(ObdCode code, const char *text = nullptr); | |||
| 59 | bool isWarningNow() const; | |||
| 60 | bool isWarningNow(ObdCode code) const; | |||
| 61 | bool hasWarningMessage(); | |||
| 62 | const char* getWarningMessage(); | |||
| 63 | void refreshTs(); | |||
| 64 | void clear(); | |||
| 65 | int warningCounter; | |||
| 66 | ObdCode lastErrorCode = ObdCode::None; | |||
| 67 | const char *description; | |||
| 68 | ||||
| 69 | Timer timeSinceLastWarning; | |||
| 70 | ||||
| 71 | // text that may be assotiated with some warning and should be reported to TS | |||
| 72 | critical_msg_t m_msg; | |||
| 73 | warning_t *m_msgWarning = nullptr; | |||
| 74 | ||||
| 75 | // todo: we need a way to post multiple recent warnings into TS | |||
| 76 | warningBuffer_t recentWarnings; | |||
| 77 | }; | |||
| 78 | ||||
| 79 | struct multispark_state | |||
| 80 | { | |||
| 81 | efidur_t delay = 0; | |||
| 82 | efidur_t dwell = 0; | |||
| 83 | uint8_t count = 0; | |||
| 84 | }; | |||
| 85 |