This commit is contained in:
bsongis
2014-06-09 23:06:59 +02:00
parent 2706a3d81c
commit d93b63d85c
@@ -1247,13 +1247,20 @@ class CurvesField: public TransformedField {
for (int i=0; i<maxCurves; i++) { for (int i=0; i<maxCurves; i++) {
CurveData *curve = &curves[i]; CurveData *curve = &curves[i];
int size = (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count); if (IS_TARANIS(board) && version >= 216) {
if (offset+size > maxPoints) { offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count);
EEPROMWarnings += ::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints) + "\n"; if (offset > maxPoints) {
break; EEPROMWarnings += ::QObject::tr("OpenTX only accepts %1 points in all curves").arg(maxPoints) + "\n";
break;
}
} }
if (!IS_TARANIS(board) || version < 216) { else {
_curves[i] = offset - (5*i); offset += (curve->type == CurveData::CURVE_TYPE_CUSTOM ? curve->count * 2 - 2 : curve->count) - 5;
if (offset > maxPoints - 5 * maxCurves) {
EEPROMWarnings += ::QObject::tr("openTx only accepts %1 points in all curves").arg(maxPoints) + "\n";
break;
}
_curves[i] = offset;
} }
for (int j=0; j<curve->count; j++) { for (int j=0; j<curve->count; j++) {
*cur++ = curve->points[j].y; *cur++ = curve->points[j].y;
@@ -1263,7 +1270,6 @@ class CurvesField: public TransformedField {
*cur++ = curve->points[j].x; *cur++ = curve->points[j].x;
} }
} }
offset += size;
} }
} }