Speeduino
Loading...
Searching...
No Matches
storage_details.h
Go to the documentation of this file.
1#pragma once
2#include "storage.h"
3#include "sensors.h"
4#include "pages.h"
5
7
8// Exposed for unit testing
9namespace storage {
10
11namespace details {
12
13enum class SensorCalibrationTableElement : uint8_t {
17};
18
19constexpr uint16_t getCalibrationElementSize(SensorCalibrationTable sensor, SensorCalibrationTableElement element)
20{
21 if (element==SensorCalibrationTableElement::Crc) {
22 return sizeof(uint32_t);
23 }
25 if (element==SensorCalibrationTableElement::Values) {
26 return sizeof(decltype(cltCalibrationTable)::values);
27 }
28 if (element==SensorCalibrationTableElement::Bins) {
29 return sizeof(decltype(cltCalibrationTable)::axis);
30 }
31 }
33 if (element==SensorCalibrationTableElement::Values) {
34 return sizeof(decltype(iatCalibrationTable)::values);
35 }
36 if (element==SensorCalibrationTableElement::Bins) {
37 return sizeof(decltype(iatCalibrationTable)::axis);
38 }
39 }
41 if (element==SensorCalibrationTableElement::Values) {
42 return sizeof(decltype(o2CalibrationTable)::values);
43 }
44 if (element==SensorCalibrationTableElement::Bins) {
45 return sizeof(decltype(o2CalibrationTable)::axis);
46 }
47 }
48
49 return 0; // Fail safe
50}
51}
52
53}
SensorCalibrationTable
Enum to identify sensor calibration tables.
Definition storage.h:92
@ O2Sensor
The Oxygen (O2) sensor calibration curve.
@ CoolantSensor
The coolant sensor calibration curve.
@ IntakeAirTempSensor
Intake Air Temperature (IAT) sensor calibration curve.
constexpr uint8_t PAGE_IDX_CALIBRATION_VALUES
Index of a calibration table values on a "page".
Definition pages.h:39
constexpr uint8_t PAGE_IDX_CALIBRATION_CRC
Index of a calibration table CRC on a "page".
Definition pages.h:38
constexpr uint8_t PAGE_IDX_CALIBRATION_BINS
Index of a calibration table bins on a "page".
Definition pages.h:40
table2D_u16_u8_32 cltCalibrationTable
table2D_u16_u8_32 o2CalibrationTable
table2D_u16_u8_32 iatCalibrationTable
Functions for reading and writing user settings to/from EEPROM.