rusEFI
The most advanced open source ECU
engine_parts.h
Go to the documentation of this file.
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 {
24 };
25 
27 public:
29 };
30 
31 struct warning_t {
34 
35  warning_t() { }
36 
38  : Code(code)
39  {
40  }
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  bool operator ==(const ObdCode other) const {
49  return other == Code;
50  }
51 };
52 
54 
56 public:
59  bool isWarningNow() const;
60  bool isWarningNow(ObdCode code) const;
61  void clear();
64 
66 
67  // todo: we need a way to post multiple recent warnings into TS
69 };
70 
72 {
75  uint8_t count = 0;
76 };
uint8_t code
Definition: bluetooth.cpp:39
gear_e gearSelectorPosition
Definition: engine_parts.h:28
warningBuffer_t recentWarnings
Definition: engine_parts.h:68
ObdCode lastErrorCode
Definition: engine_parts.h:63
void addWarningCode(ObdCode code)
Definition: engine2.cpp:40
bool isWarningNow() const
Definition: engine2.cpp:65
Timer timeSinceLastWarning
Definition: engine_parts.h:65
static_vector< warning_t, 24 > warningBuffer_t
Definition: engine_parts.h:53
ObdCode
gear_e
Definition: rusefi_enums.h:498
efitick_t efidur_t
Definition: rusefi_types.h:45
Accelerometer accelerometer
Definition: engine_parts.h:23
ObdCode Code
Definition: engine_parts.h:33
warning_t(ObdCode code)
Definition: engine_parts.h:37
bool operator==(const warning_t &other) const
Definition: engine_parts.h:43
Timer LastTriggered
Definition: engine_parts.h:32