Skip to content

Commit

Permalink
Miniware+Pinecil: fix number of items in uVtoDegC array. This only af… (
Browse files Browse the repository at this point in the history
#1531)

Miniware+Pinecil: fix number of items in uVtoDegC array. This only affects us in case we go above 500degC, in which case we'll be reading invalid memory
  • Loading branch information
purdeaandrei authored Jan 16, 2023
1 parent e9f63cd commit b96dbb2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/Core/BSP/Miniware/ThermoModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ const int32_t uVtoDegC[] = {
38137, 500, //
};
#endif
const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(uint16_t));
const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(uVtoDegC[0]));

uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return Utils::InterpolateLookupTable(uVtoDegC, uVtoDegCItems, tipuVDelta); }
2 changes: 1 addition & 1 deletion source/Core/BSP/Pinecil/ThermoModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ const int32_t uVtoDegC[] = {
};
#endif

const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(uint16_t));
const int uVtoDegCItems = sizeof(uVtoDegC) / (2 * sizeof(uVtoDegC[0]));

uint32_t TipThermoModel::convertuVToDegC(uint32_t tipuVDelta) { return Utils::InterpolateLookupTable(uVtoDegC, uVtoDegCItems, tipuVDelta); }

0 comments on commit b96dbb2

Please sign in to comment.