mirror of
https://github.com/thooge/esp32-nmea2000-obp60.git
synced 2025-12-15 15:03:07 +01:00
Changed array for calibration data into a hash map; reduced unnecessary method parameters
This commit is contained in:
@@ -4,28 +4,29 @@
|
||||
#define _BOATDATACALIBRATION_H
|
||||
|
||||
#include "Pagedata.h"
|
||||
#include "WString.h"
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#define MAX_CALIBRATION_DATA 3 // maximum number of calibration data instances
|
||||
|
||||
typedef struct {
|
||||
String instance; // data type/instance to be calibrated
|
||||
// String instance; // data type/instance to be calibrated
|
||||
double offset; // calibration offset
|
||||
double slope; // calibration slope
|
||||
double smooth; // smoothing factor
|
||||
double value; // calibrated data value
|
||||
bool isCalibrated; // is data instance value calibrated?
|
||||
} CalibData;
|
||||
|
||||
const int maxCalibrationData = 3; // maximum number of calibration data instances
|
||||
} TypeCalibData;
|
||||
|
||||
class CalibrationDataList {
|
||||
public:
|
||||
CalibData list[maxCalibrationData]; // list of calibration data instances
|
||||
// CalibData list[maxCalibrationData]; // list of calibration data instances
|
||||
static std::unordered_map<std::string, TypeCalibData> calibMap; // list of calibration data instances
|
||||
|
||||
void readConfig(GwConfigHandler* config, GwLog* logger);
|
||||
int getInstanceListNo(String instance);
|
||||
void calibrateInstance(String instance, GwApi::BoatValue* boatDataValue, GwLog* logger);
|
||||
// void smoothInstance(String instance, double &dataValue, GwLog* logger);
|
||||
void smoothInstance(String instance, GwApi::BoatValue* boatDataValue, GwLog* logger);
|
||||
// int getInstanceListNo(std::string instance);
|
||||
void calibrateInstance(GwApi::BoatValue* boatDataValue, GwLog* logger);
|
||||
void smoothInstance(GwApi::BoatValue* boatDataValue, GwLog* logger);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user