Convert the interpolator to int32
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifdef TEMP_uV_LOOKUP_HAKKO
|
#ifdef TEMP_uV_LOOKUP_HAKKO
|
||||||
const uint16_t uVtoDegC[] = {
|
const int32_t uVtoDegC[] = {
|
||||||
//
|
//
|
||||||
// uv -> temp in C
|
// uv -> temp in C
|
||||||
0, 0, //
|
0, 0, //
|
||||||
@@ -67,6 +67,6 @@ const uint16_t uVtoDegC[] = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(uint16_t));
|
const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(int32_t));
|
||||||
|
|
||||||
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return Utils::InterpolateLookupTable(uVtoDegC, uVtoDegCItems, tipuVDelta); }
|
uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return Utils::InterpolateLookupTable(uVtoDegC, uVtoDegCItems, tipuVDelta); }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include <Utils.h>
|
#include <Utils.h>
|
||||||
|
|
||||||
int32_t Utils::InterpolateLookupTable(const uint16_t *lookupTable, const int noItems, const uint16_t value) {
|
int32_t Utils::InterpolateLookupTable(const int32_t *lookupTable, const int noItems, const int32_t value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
for (int i = 1; i < (noItems - 1); i++) {
|
for (int i = 1; i < (noItems - 1); i++) {
|
||||||
// If current tip temp is less than current lookup, then this current lookup is the higher point to interpolate
|
// If current tip temp is less than current lookup, then this current lookup is the higher point to interpolate
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
class Utils {
|
class Utils {
|
||||||
public:
|
public:
|
||||||
static int32_t InterpolateLookupTable(const uint16_t *lookupTable, const int noItems, const uint16_t value);
|
static int32_t InterpolateLookupTable(const int32_t *lookupTable, const int noItems, const int32_t value);
|
||||||
static int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x);
|
static int32_t LinearInterpolate(int32_t x1, int32_t y1, int32_t x2, int32_t y2, int32_t x);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user