New UI merged
This commit is contained in:
+19
-12
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -70,14 +70,14 @@ bool moveCurve(uint8_t index, int8_t shift)
|
||||
AUDIO_WARNING2();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
int8_t * nextCrv = curveAddress(index+1);
|
||||
memmove(nextCrv+shift, nextCrv, 5*(MAX_CURVES-index-1)+curveEnd[MAX_CURVES-1]-curveEnd[index]);
|
||||
if (shift < 0) memclear(&g_model.points[MAX_CURVE_POINTS-1] + shift, -shift);
|
||||
while (index<MAX_CURVES) {
|
||||
curveEnd[index++] += shift;
|
||||
}
|
||||
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
return true;
|
||||
}
|
||||
@@ -314,19 +314,26 @@ int applyCustomCurve(int x, uint8_t idx)
|
||||
return intpol(x, idx);
|
||||
}
|
||||
|
||||
point_t getPoint(uint8_t i)
|
||||
point_t getPoint(uint8_t index)
|
||||
{
|
||||
return getPoint(s_curveChan, index);
|
||||
}
|
||||
|
||||
point_t getPoint(uint8_t curveIndex, uint8_t index)
|
||||
{
|
||||
point_t result = {0, 0};
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
CurveInfo & crv = g_model.curves[curveIndex];
|
||||
int8_t * points = curveAddress(curveIndex);
|
||||
bool custom = (crv.type == CURVE_TYPE_CUSTOM);
|
||||
uint8_t count = 5+crv.points;
|
||||
if (i < count) {
|
||||
result.x = CURVE_CENTER_X-1-CURVE_SIDE_WIDTH + i*CURVE_SIDE_WIDTH*2/(count-1);
|
||||
result.y = CURVE_CENTER_Y - (points[i]) * (CURVE_SIDE_WIDTH-1) / 100;
|
||||
if (custom && i>0 && i<count-1) {
|
||||
result.x = CURVE_CENTER_X - 1 - CURVE_SIDE_WIDTH + (100 + (100 + points[count + i - 1]) * (2 * CURVE_SIDE_WIDTH)) / 200;
|
||||
uint8_t count = 5 + crv.points;
|
||||
if (index < count) {
|
||||
if (custom && index > 0 && index < count - 1) {
|
||||
result.x = calc100toRESX(points[count + index - 1]);
|
||||
}
|
||||
else {
|
||||
result.x = -RESX + calc100toRESX(200 * index / (count - 1));
|
||||
}
|
||||
result.y = calc100toRESX(points[index]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user