Do not init points to identity function to avoid issues with radio firmware
This commit is contained in:
@@ -30,18 +30,6 @@ void CurveData::clear(int count)
|
|||||||
{
|
{
|
||||||
memset(reinterpret_cast<void *>(this), 0, sizeof(CurveData));
|
memset(reinterpret_cast<void *>(this), 0, sizeof(CurveData));
|
||||||
this->count = count;
|
this->count = count;
|
||||||
|
|
||||||
int incr = 200 / (count - 1);
|
|
||||||
|
|
||||||
// points[0].x must be -100
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
if (i < count - 1)
|
|
||||||
points[i].x = -100 + incr * i;
|
|
||||||
else
|
|
||||||
points[i].x = 100; // points[last].x must be +100 do not risk a rounding issue using incr
|
|
||||||
|
|
||||||
points[i].y = points[i].x;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CurveData::isEmpty() const
|
bool CurveData::isEmpty() const
|
||||||
|
|||||||
@@ -1280,10 +1280,6 @@ class CurvesField: public TransformedField {
|
|||||||
curve->points[j].x = *cur++;
|
curve->points[j].x = *cur++;
|
||||||
curve->points[curve->count-1].x = +100;
|
curve->points[curve->count-1].x = +100;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for (int j=0; j<curve->count; j++)
|
|
||||||
curve->points[j].x = -100 + (200*i) / (curve->count-1);
|
|
||||||
}
|
|
||||||
qCDebug(eepromImport) << QString("imported curve: %3 points").arg(curve->count);
|
qCDebug(eepromImport) << QString("imported curve: %3 points").arg(curve->count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user