more details into error message

This commit is contained in:
Andrey 2021-07-02 19:05:54 -04:00
parent 0d7c0a7f50
commit 8bd4a846ae
1 changed files with 4 additions and 2 deletions

View File

@ -30,8 +30,10 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl
template<typename TValue, int TSize>
void ensureArrayIsAscending(const char* msg, const TValue (&values)[TSize]) {
for (size_t i = 0; i < TSize - 1; i++) {
if (values[i + 1] < values[i]) {
firmwareError(CUSTOM_ERR_AXIS_ORDER, "Invalid table axis (must be ascending!): %s", msg);
auto cur = values[i];
auto next = values[i + 1];
if (next < cur) {
firmwareError(CUSTOM_ERR_AXIS_ORDER, "Invalid table axis (must be ascending!): %s %f %f", msg, cur, next);
}
}
}