mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 12:25:12 +03:00
Massive clean thanks to Schwabe : unifdef -m -DCPUARM -UCPUM64 -UCPUM2560 -UPCBSTD -UPCBMEGA2560 -UPCBGRUVIN9X -UPCB9X $(find . -name "*.cpp" -or -name "*.h")
This commit is contained in:
parent
c032b30247
commit
dd632969f3
106 changed files with 27 additions and 6626 deletions
|
@ -132,44 +132,5 @@ inline void beep(uint8_t) { }
|
|||
#define START_SILENCE_PERIOD()
|
||||
#endif /* !AUDIO */
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#if defined(BUZZER)
|
||||
inline void BUZZER_HEARTBEAT()
|
||||
{
|
||||
if (g_beepCnt) {
|
||||
if (!beepAgainOrig) {
|
||||
beepAgainOrig = g_beepCnt;
|
||||
beepOn = true;
|
||||
}
|
||||
g_beepCnt--;
|
||||
}
|
||||
else {
|
||||
if (beepAgain && beepAgainOrig) {
|
||||
beepOn = !beepOn;
|
||||
g_beepCnt = beepOn ? beepAgainOrig : 8;
|
||||
if (beepOn) beepAgain--;
|
||||
}
|
||||
else {
|
||||
beepAgainOrig = 0;
|
||||
beepOn = false;
|
||||
warble = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (beepOn) {
|
||||
warbleC = warble && !warbleC;
|
||||
if (warbleC)
|
||||
buzzerOff();
|
||||
else
|
||||
buzzerOn();
|
||||
}
|
||||
else {
|
||||
buzzerOff();
|
||||
}
|
||||
}
|
||||
#else // BUZZER
|
||||
#define BUZZER_HEARTBEAT()
|
||||
#endif // BUZZER
|
||||
#endif // CPUARM
|
||||
|
||||
#endif // _BUZZER_H_
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
uint8_t s_curveChan;
|
||||
|
||||
#if defined(CPUARM)
|
||||
int8_t * curveEnd[MAX_CURVES];
|
||||
void loadCurves()
|
||||
{
|
||||
|
@ -94,59 +93,7 @@ void resetCustomCurveX(int8_t * points, int noPoints)
|
|||
points[noPoints+i] = getCurveX(noPoints, i+1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
int8_t * curveAddress(uint8_t idx)
|
||||
{
|
||||
return &g_model.points[idx==0 ? 0 : 5*idx+g_model.curves[idx-1]];
|
||||
}
|
||||
|
||||
CurveInfo curveInfo(uint8_t idx)
|
||||
{
|
||||
CurveInfo result;
|
||||
result.crv = curveAddress(idx);
|
||||
int8_t *next = curveAddress(idx+1);
|
||||
uint8_t size = next - result.crv;
|
||||
if ((size & 1) == 0) {
|
||||
result.points = (size / 2) + 1;
|
||||
result.custom = true;
|
||||
}
|
||||
else {
|
||||
result.points = size;
|
||||
result.custom = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool moveCurve(uint8_t index, int8_t shift, int8_t custom) // TODO move?
|
||||
{
|
||||
if (g_model.curves[MAX_CURVES-1] + shift > MAX_CURVE_POINTS-5*MAX_CURVES) {
|
||||
AUDIO_WARNING2();
|
||||
return false;
|
||||
}
|
||||
|
||||
int8_t * crv = curveAddress(index);
|
||||
if (shift < 0) {
|
||||
for (uint8_t i=0; i<custom; i++)
|
||||
crv[i] = crv[2*i];
|
||||
}
|
||||
|
||||
int8_t * nextCrv = curveAddress(index+1);
|
||||
memmove(nextCrv+shift, nextCrv, 5*(MAX_CURVES-index-1)+g_model.curves[MAX_CURVES-1]-g_model.curves[index]);
|
||||
if (shift < 0) memclear(&g_model.points[MAX_CURVE_POINTS-1] + shift, -shift);
|
||||
while (index<MAX_CURVES) {
|
||||
g_model.curves[index++] += shift;
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<custom-2; i++) {
|
||||
crv[custom + i] = -100 + ((200 * (i + 1) + custom / 2) / (custom - 1));
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CUSTOM_POINT_X(points, count, idx) ((idx)==0 ? -100 : (((idx)==(count)-1) ? 100 : points[(count)+(idx)-1]))
|
||||
int32_t compute_tangent(CurveInfo * crv, int8_t * points, int i)
|
||||
{
|
||||
|
@ -261,21 +208,13 @@ int16_t hermite_spline(int16_t x, uint8_t idx)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int intpol(int x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 100
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
CurveInfo & crv = g_model.curves[idx];
|
||||
int8_t * points = curveAddress(idx);
|
||||
uint8_t count = crv.points+5;
|
||||
bool custom = (crv.type == CURVE_TYPE_CUSTOM);
|
||||
#else
|
||||
CurveInfo crv = curveInfo(idx);
|
||||
int8_t * points = crv.crv;
|
||||
uint8_t count = crv.points;
|
||||
bool custom = crv.custom;
|
||||
#endif
|
||||
int16_t erg = 0;
|
||||
|
||||
x += RESXu;
|
||||
|
@ -308,7 +247,6 @@ int intpol(int x, uint8_t idx) // -100, -75, -50, -25, 0 ,25 ,50, 75, 100
|
|||
return erg / 25; // 100*D5/RESX;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
int applyCurve(int x, CurveRef & curve)
|
||||
{
|
||||
switch (curve.type) {
|
||||
|
@ -375,50 +313,14 @@ int applyCustomCurve(int x, uint8_t idx)
|
|||
else
|
||||
return intpol(x, idx);
|
||||
}
|
||||
#else
|
||||
int applyCurve(int x, int8_t idx)
|
||||
{
|
||||
/* already tried to have only one return at the end */
|
||||
switch(idx) {
|
||||
case CURVE_NONE:
|
||||
return x;
|
||||
case CURVE_X_GT0:
|
||||
if (x < 0) x = 0; //x|x>0
|
||||
return x;
|
||||
case CURVE_X_LT0:
|
||||
if (x > 0) x = 0; //x|x<0
|
||||
return x;
|
||||
case CURVE_ABS_X: // x|abs(x)
|
||||
return abs(x);
|
||||
case CURVE_F_GT0: //f|f>0
|
||||
return x > 0 ? RESX : 0;
|
||||
case CURVE_F_LT0: //f|f<0
|
||||
return x < 0 ? -RESX : 0;
|
||||
case CURVE_ABS_F: //f|abs(f)
|
||||
return x > 0 ? RESX : -RESX;
|
||||
}
|
||||
if (idx < 0) {
|
||||
x = -x;
|
||||
idx = -idx + CURVE_BASE - 1;
|
||||
}
|
||||
return applyCustomCurve(x, idx - CURVE_BASE);
|
||||
}
|
||||
#endif
|
||||
|
||||
point_t getPoint(uint8_t i)
|
||||
{
|
||||
point_t result = {0, 0};
|
||||
#if defined(CPUARM)
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
bool custom = (crv.type == CURVE_TYPE_CUSTOM);
|
||||
uint8_t count = 5+crv.points;
|
||||
#else
|
||||
CurveInfo crv = curveInfo(s_curveChan);
|
||||
int8_t * points = crv.crv;
|
||||
bool custom = crv.custom;
|
||||
uint8_t count = crv.points;
|
||||
#endif
|
||||
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;
|
||||
|
|
|
@ -101,11 +101,7 @@
|
|||
#define MAX_TELEMETRY_SENSORS 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_TIMERS 3
|
||||
#else
|
||||
#define MAX_TIMERS 2
|
||||
#endif
|
||||
|
||||
#define NUM_CYC 3
|
||||
#define NUM_CAL_PPM 4
|
||||
|
@ -116,11 +112,7 @@ enum CurveType {
|
|||
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MIN_POINTS_PER_CURVE 3
|
||||
#else
|
||||
#define MIN_POINTS_PER_CURVE 3
|
||||
#endif
|
||||
|
||||
#define MAX_POINTS_PER_CURVE 17
|
||||
|
||||
|
@ -148,7 +140,7 @@ enum CurveType {
|
|||
#define LEN_FUNCTION_NAME 8
|
||||
#define MAX_CURVES 32
|
||||
#define MAX_CURVE_POINTS 512
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define LEN_MODEL_NAME 10
|
||||
#define LEN_TIMER_NAME 3
|
||||
#define LEN_FLIGHT_MODE_NAME 6
|
||||
|
@ -159,11 +151,6 @@ enum CurveType {
|
|||
#define LEN_FUNCTION_NAME 6
|
||||
#define MAX_CURVES 16 // TODO next EEPROM check if can be changed to 32 to have all ARM the same
|
||||
#define MAX_CURVE_POINTS 512
|
||||
#else
|
||||
#define LEN_MODEL_NAME 10
|
||||
#define LEN_FLIGHT_MODE_NAME 6
|
||||
#define MAX_CURVES 8
|
||||
#define MAX_CURVE_POINTS (112-MAX_CURVES)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
|
||||
|
@ -180,9 +167,6 @@ enum CurveType {
|
|||
#elif defined(PCBSKY9X)
|
||||
#define MAX_ROTARY_ENCODERS 1
|
||||
#define NUM_ROTARY_ENCODERS 1
|
||||
#elif defined(CPUM2560)
|
||||
#define MAX_ROTARY_ENCODERS 2
|
||||
#define NUM_ROTARY_ENCODERS 2
|
||||
#else
|
||||
#define MAX_ROTARY_ENCODERS 0
|
||||
#define NUM_ROTARY_ENCODERS 0
|
||||
|
@ -286,13 +270,12 @@ enum UartModes {
|
|||
#define LEN_ANA_NAME 3
|
||||
#define LEN_MODEL_FILENAME 16
|
||||
#define LEN_BLUETOOTH_NAME 10
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define LEN_SWITCH_NAME 3
|
||||
#define LEN_ANA_NAME 3
|
||||
#define LEN_BLUETOOTH_NAME 10
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEM_LABEL_LEN 4
|
||||
enum TelemetryUnit {
|
||||
UNIT_RAW,
|
||||
|
@ -341,109 +324,6 @@ enum TelemetryUnit {
|
|||
#define UNIT_DIST UNIT_METERS
|
||||
#define UNIT_TEMPERATURE UNIT_CELSIUS
|
||||
#define UNIT_SPEED UNIT_KMH
|
||||
#else
|
||||
#if !defined(CPUARM)
|
||||
enum TelemetrySource {
|
||||
TELEM_NONE,
|
||||
TELEM_TX_VOLTAGE,
|
||||
TELEM_TIMER1,
|
||||
TELEM_TIMER2,
|
||||
TELEM_TIMER_MAX=TELEM_TIMER2,
|
||||
TELEM_RSSI_TX,
|
||||
TELEM_RSSI_RX,
|
||||
TELEM_A_FIRST,
|
||||
TELEM_A1=TELEM_A_FIRST,
|
||||
TELEM_A2,
|
||||
TELEM_A_LAST=TELEM_A2,
|
||||
TELEM_ALT,
|
||||
TELEM_RPM,
|
||||
TELEM_FUEL,
|
||||
TELEM_T1,
|
||||
TELEM_T2,
|
||||
TELEM_SPEED,
|
||||
TELEM_DIST,
|
||||
TELEM_GPSALT,
|
||||
TELEM_CELL,
|
||||
TELEM_CELLS_SUM,
|
||||
TELEM_VFAS,
|
||||
TELEM_CURRENT,
|
||||
TELEM_CONSUMPTION,
|
||||
TELEM_POWER,
|
||||
TELEM_ACCx,
|
||||
TELEM_ACCy,
|
||||
TELEM_ACCz,
|
||||
TELEM_HDG,
|
||||
TELEM_VSPEED,
|
||||
TELEM_ASPEED,
|
||||
TELEM_DTE,
|
||||
TELEM_MIN_A_FIRST,
|
||||
TELEM_MIN_A1=TELEM_MIN_A_FIRST,
|
||||
TELEM_MIN_A2,
|
||||
TELEM_MIN_A_LAST=TELEM_MIN_A2,
|
||||
TELEM_MIN_ALT,
|
||||
TELEM_MAX_ALT,
|
||||
TELEM_MAX_RPM,
|
||||
TELEM_MAX_T1,
|
||||
TELEM_MAX_T2,
|
||||
TELEM_MAX_SPEED,
|
||||
TELEM_MAX_DIST,
|
||||
TELEM_MAX_ASPEED,
|
||||
TELEM_MIN_CELL,
|
||||
TELEM_MIN_CELLS_SUM,
|
||||
TELEM_MIN_VFAS,
|
||||
TELEM_MAX_CURRENT,
|
||||
TELEM_MAX_POWER,
|
||||
TELEM_ACC,
|
||||
TELEM_GPS_TIME,
|
||||
TELEM_CSW_MAX = TELEM_MAX_POWER,
|
||||
TELEM_NOUSR_MAX = TELEM_A2,
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
TELEM_DISPLAY_MAX = TELEM_MAX_POWER,
|
||||
#else
|
||||
TELEM_DISPLAY_MAX = TELEM_TIMER2, // because used also in PlayValue
|
||||
#endif
|
||||
TELEM_STATUS_MAX = TELEM_GPS_TIME,
|
||||
TELEM_FIRST_STREAMED_VALUE = TELEM_RSSI_TX,
|
||||
};
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
#define NUM_TELEMETRY TELEM_CSW_MAX
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
#define NUM_TELEMETRY TELEM_ALT
|
||||
#elif defined(TELEMETRY_FRSKY)
|
||||
#define NUM_TELEMETRY TELEM_A2
|
||||
#elif defined(TELEMETRY_MAVLINK)
|
||||
#define NUM_TELEMETRY 4
|
||||
#else
|
||||
#define NUM_TELEMETRY TELEM_TIMER2
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
enum TelemetryUnit {
|
||||
UNIT_VOLTS,
|
||||
UNIT_AMPS,
|
||||
UNIT_METERS_PER_SECOND,
|
||||
UNIT_RAW,
|
||||
UNIT_SPEED,
|
||||
UNIT_DIST,
|
||||
UNIT_TEMPERATURE,
|
||||
UNIT_PERCENT,
|
||||
UNIT_MILLIAMPS,
|
||||
UNIT_A1A2_MAX = UNIT_MILLIAMPS,
|
||||
UNIT_MAH,
|
||||
UNIT_WATTS,
|
||||
UNIT_DB,
|
||||
UNIT_FEET,
|
||||
UNIT_KTS,
|
||||
UNIT_HOURS,
|
||||
UNIT_MINUTES,
|
||||
UNIT_SECONDS,
|
||||
UNIT_RPMS,
|
||||
UNIT_G,
|
||||
UNIT_HDG
|
||||
};
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
#define NUM_LINE_ITEMS 3
|
||||
|
@ -455,7 +335,6 @@ enum TelemetryUnit {
|
|||
#define MAX_TELEM_SCRIPT_INPUTS 8
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum TelemetryScreenType {
|
||||
TELEMETRY_SCREEN_TYPE_NONE,
|
||||
TELEMETRY_SCREEN_TYPE_VALUES,
|
||||
|
@ -470,13 +349,6 @@ enum TelemetryScreenType {
|
|||
#define MAX_TELEMETRY_SCREENS 4
|
||||
#define TELEMETRY_SCREEN_TYPE(screenIndex) TelemetryScreenType((g_model.frsky.screensType >> (2*(screenIndex))) & 0x03)
|
||||
#define IS_BARS_SCREEN(screenIndex) (TELEMETRY_SCREEN_TYPE(screenIndex) == TELEMETRY_SCREEN_TYPE_GAUGES)
|
||||
#else
|
||||
#define MAX_FRSKY_A_CHANNELS 2
|
||||
#define MAX_TELEMETRY_SCREENS 2
|
||||
#define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
|
||||
#define MIN_BLADES 0 // 2 blades
|
||||
#define MAX_BLADES 3 // 5 blades
|
||||
#endif
|
||||
|
||||
#define FAILSAFE_CHANNEL_HOLD 2000
|
||||
#define FAILSAFE_CHANNEL_NOPULSE 2001
|
||||
|
@ -492,24 +364,14 @@ enum PotsWarnMode {
|
|||
POTS_WARN_AUTO
|
||||
};
|
||||
|
||||
#if !defined(PCBSTD)
|
||||
#define LEN_GVAR_NAME 3
|
||||
#define GVAR_MAX 1024
|
||||
#define GVAR_MIN -GVAR_MAX
|
||||
#endif
|
||||
|
||||
#define RESERVE_RANGE_FOR_GVARS 10
|
||||
// even we do not spend space in EEPROM for 10 GVARS, we reserve the space inside the range of values, like offset, weight, etc.
|
||||
|
||||
#if defined(PCBSTD) && defined(GVARS)
|
||||
#define MAX_GVARS 5
|
||||
#elif defined(PCBSTD)
|
||||
#define MAX_GVARS 0
|
||||
#elif defined(CPUARM)
|
||||
#define MAX_GVARS 9
|
||||
#else
|
||||
#define MAX_GVARS 5
|
||||
#endif
|
||||
|
||||
enum SwitchSources {
|
||||
SWSRC_NONE = 0,
|
||||
|
@ -630,9 +492,6 @@ enum SwitchSources {
|
|||
|
||||
#if defined(PCBSKY9X)
|
||||
SWSRC_REa,
|
||||
#elif defined(CPUM2560)
|
||||
SWSRC_REa,
|
||||
SWSRC_REb,
|
||||
#endif
|
||||
|
||||
SWSRC_FIRST_LOGICAL_SWITCH,
|
||||
|
@ -653,14 +512,12 @@ enum SwitchSources {
|
|||
SWSRC_ON,
|
||||
SWSRC_ONE,
|
||||
|
||||
#if defined(CPUARM)
|
||||
SWSRC_FIRST_FLIGHT_MODE,
|
||||
SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
|
||||
|
||||
SWSRC_TELEMETRY_STREAMING,
|
||||
SWSRC_FIRST_SENSOR,
|
||||
SWSRC_LAST_SENSOR = SWSRC_FIRST_SENSOR+MAX_TELEMETRY_SENSORS-1,
|
||||
#endif
|
||||
|
||||
SWSRC_COUNT,
|
||||
|
||||
|
@ -669,20 +526,13 @@ enum SwitchSources {
|
|||
SWSRC_LAST = SWSRC_COUNT-1,
|
||||
SWSRC_FIRST = -SWSRC_LAST,
|
||||
|
||||
#if defined(CPUARM)
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_COUNT-1,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_COUNT-1,
|
||||
#else
|
||||
SWSRC_LAST_IN_LOGICAL_SWITCHES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
SWSRC_LAST_IN_MIXES = SWSRC_LAST_LOGICAL_SWITCH,
|
||||
#endif
|
||||
|
||||
SWSRC_FIRST_IN_LOGICAL_SWITCHES = -SWSRC_LAST_IN_LOGICAL_SWITCHES,
|
||||
SWSRC_FIRST_IN_MIXES = -SWSRC_LAST_IN_MIXES,
|
||||
|
||||
#if defined(CPUARM)
|
||||
SWSRC_INVERT = SWSRC_COUNT+1,
|
||||
#endif
|
||||
};
|
||||
|
||||
#define SWSRC_LAST_TRIM (SWSRC_FIRST_TRIM + 2*NUM_TRIMS - 1)
|
||||
|
@ -755,16 +605,6 @@ enum MixSources {
|
|||
#if defined(PCBSKY9X)
|
||||
MIXSRC_REa,
|
||||
MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REa,
|
||||
#elif defined(CPUM2560)
|
||||
MIXSRC_REa,
|
||||
MIXSRC_REb,
|
||||
#if ROTARY_ENCODERS > 2
|
||||
MIXSRC_REc,
|
||||
MIXSRC_REd,
|
||||
MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REd,
|
||||
#else
|
||||
MIXSRC_LAST_ROTARY_ENCODER = MIXSRC_REb,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MIXSRC_MAX,
|
||||
|
@ -863,7 +703,6 @@ enum MixSources {
|
|||
MIXSRC_GVAR1 = MIXSRC_FIRST_GVAR, LUA_EXPORT_MULTIPLE("gvar", "Global variable %d", MAX_GVARS)
|
||||
MIXSRC_LAST_GVAR = MIXSRC_FIRST_GVAR+MAX_GVARS-1,
|
||||
|
||||
#if defined(CPUARM)
|
||||
MIXSRC_TX_VOLTAGE, LUA_EXPORT("tx-voltage", "Transmitter battery voltage [volts]")
|
||||
MIXSRC_TX_TIME, LUA_EXPORT("clock", "RTC clock [minutes from midnight]")
|
||||
#if defined(INTERNAL_GPS)
|
||||
|
@ -881,14 +720,9 @@ enum MixSources {
|
|||
MIXSRC_TIMER2, LUA_EXPORT("timer2", "Timer 2 value [seconds]")
|
||||
MIXSRC_TIMER3, LUA_EXPORT("timer3", "Timer 3 value [seconds]")
|
||||
MIXSRC_LAST_TIMER = MIXSRC_TIMER3,
|
||||
#endif
|
||||
|
||||
MIXSRC_FIRST_TELEM,
|
||||
#if defined(CPUARM)
|
||||
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
|
||||
#else
|
||||
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+NUM_TELEMETRY-1
|
||||
#endif
|
||||
};
|
||||
|
||||
#define MIXSRC_FIRST (MIXSRC_NONE+1)
|
||||
|
@ -910,36 +744,25 @@ enum Functions {
|
|||
FUNC_TRAINER,
|
||||
FUNC_INSTANT_TRIM,
|
||||
FUNC_RESET,
|
||||
#if defined(CPUARM)
|
||||
FUNC_SET_TIMER,
|
||||
#endif
|
||||
FUNC_ADJUST_GVAR,
|
||||
#if defined(CPUARM)
|
||||
FUNC_VOLUME,
|
||||
FUNC_SET_FAILSAFE,
|
||||
FUNC_RANGECHECK,
|
||||
FUNC_BIND,
|
||||
#endif
|
||||
// then the other functions
|
||||
FUNC_FIRST_WITHOUT_ENABLE,
|
||||
FUNC_PLAY_SOUND = FUNC_FIRST_WITHOUT_ENABLE,
|
||||
FUNC_PLAY_TRACK,
|
||||
#if !defined(CPUARM)
|
||||
FUNC_PLAY_BOTH,
|
||||
#endif
|
||||
FUNC_PLAY_VALUE,
|
||||
#if defined(CPUARM)
|
||||
FUNC_RESERVE4,
|
||||
FUNC_PLAY_SCRIPT,
|
||||
FUNC_RESERVE5,
|
||||
FUNC_BACKGND_MUSIC,
|
||||
FUNC_BACKGND_MUSIC_PAUSE,
|
||||
#endif
|
||||
FUNC_VARIO,
|
||||
FUNC_HAPTIC,
|
||||
#if !defined(PCBSTD)
|
||||
FUNC_LOGS,
|
||||
#endif
|
||||
FUNC_BACKLIGHT,
|
||||
#if defined(PCBTARANIS)
|
||||
FUNC_SCREENSHOT,
|
||||
|
@ -972,9 +795,7 @@ enum CountDownModes {
|
|||
enum ResetFunctionParam {
|
||||
FUNC_RESET_TIMER1,
|
||||
FUNC_RESET_TIMER2,
|
||||
#if defined(CPUARM)
|
||||
FUNC_RESET_TIMER3,
|
||||
#endif
|
||||
FUNC_RESET_FLIGHT,
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
FUNC_RESET_TELEMETRY,
|
||||
|
@ -985,10 +806,8 @@ enum ResetFunctionParam {
|
|||
#if ROTARY_ENCODERS > 1
|
||||
FUNC_RESET_ROTENC2,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
FUNC_RESET_PARAM_FIRST_TELEM,
|
||||
FUNC_RESET_PARAM_LAST_TELEM = FUNC_RESET_PARAM_FIRST_TELEM + MAX_TELEMETRY_SENSORS,
|
||||
#endif
|
||||
FUNC_RESET_PARAMS_COUNT,
|
||||
FUNC_RESET_PARAM_LAST = FUNC_RESET_PARAMS_COUNT-1,
|
||||
};
|
||||
|
|
|
@ -24,19 +24,10 @@
|
|||
#include <inttypes.h>
|
||||
#include "dataconstants.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define ARM_FIELD(x) x;
|
||||
#define AVR_FIELD(x)
|
||||
#else
|
||||
#define ARM_FIELD(x)
|
||||
#define AVR_FIELD(x) x;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define N_PCBSTD_FIELD(x)
|
||||
#else
|
||||
#define N_PCBSTD_FIELD(x) x;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define N_TARANIS_FIELD(x)
|
||||
|
@ -76,7 +67,6 @@ typedef uint8_t source_t;
|
|||
* Mixer structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct CurveRef {
|
||||
uint8_t type;
|
||||
int8_t value;
|
||||
|
@ -100,56 +90,11 @@ PACK(struct MixData {
|
|||
uint8_t speedDown;
|
||||
NOBACKUP(char name[LEN_EXPOMIX_NAME]);
|
||||
});
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
PACK(struct MixData {
|
||||
uint8_t destCh:4; // 0, 1..MAX_OUTPUT_CHANNELS
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t weightMode:1;
|
||||
uint8_t offsetMode:1;
|
||||
uint8_t srcRaw;
|
||||
int8_t weight;
|
||||
int8_t swtch;
|
||||
uint8_t flightModes;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
int8_t carryTrim:3;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t spare:1;
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t offset;
|
||||
});
|
||||
#else
|
||||
PACK(struct MixData {
|
||||
uint8_t destCh:4; // 0, 1..MAX_OUTPUT_CHANNELS
|
||||
uint8_t curveMode:1; // O=curve, 1=differential
|
||||
uint8_t noExpo:1;
|
||||
uint8_t weightMode:1;
|
||||
uint8_t offsetMode:1;
|
||||
int8_t weight;
|
||||
int8_t swtch:6;
|
||||
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||
uint8_t flightModes:5;
|
||||
int8_t carryTrim:3;
|
||||
uint8_t srcRaw:6;
|
||||
uint8_t mixWarn:2; // mixer warning
|
||||
uint8_t delayUp:4;
|
||||
uint8_t delayDown:4;
|
||||
uint8_t speedUp:4;
|
||||
uint8_t speedDown:4;
|
||||
int8_t curveParam;
|
||||
int8_t offset;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Expo/Input structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct ExpoData {
|
||||
uint16_t mode:2;
|
||||
uint16_t scale:14;
|
||||
|
@ -164,34 +109,11 @@ PACK(struct ExpoData {
|
|||
int8_t offset;
|
||||
CurveRef curve;
|
||||
});
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
PACK(struct ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
uint8_t chn:2;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t spare:3;
|
||||
uint8_t flightModes;
|
||||
int8_t swtch;
|
||||
uint8_t weight;
|
||||
int8_t curveParam;
|
||||
});
|
||||
#else
|
||||
PACK(struct ExpoData {
|
||||
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
|
||||
int8_t swtch:6;
|
||||
uint8_t chn:2;
|
||||
uint8_t flightModes:5;
|
||||
uint8_t curveMode:1;
|
||||
uint8_t weight; // One spare bit here (used for GVARS)
|
||||
int8_t curveParam;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Limit structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct LimitData {
|
||||
int32_t min:11;
|
||||
int32_t max:11;
|
||||
|
@ -203,22 +125,11 @@ PACK(struct LimitData {
|
|||
int8_t curve;
|
||||
NOBACKUP(char name[LEN_CHANNEL_NAME]);
|
||||
});
|
||||
#else
|
||||
PACK(struct LimitData {
|
||||
int8_t min;
|
||||
int8_t max;
|
||||
int8_t ppmCenter;
|
||||
int16_t offset:14;
|
||||
uint16_t symetrical:1;
|
||||
uint16_t revert:1;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* LogicalSwitch structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct LogicalSwitchData {
|
||||
uint8_t func;
|
||||
int32_t v1:10;
|
||||
|
@ -230,20 +141,11 @@ PACK(struct LogicalSwitchData {
|
|||
uint8_t delay;
|
||||
uint8_t duration;
|
||||
});
|
||||
#else
|
||||
PACK(struct LogicalSwitchData {
|
||||
int8_t v1; //input
|
||||
int8_t v2; //offset
|
||||
uint8_t func:4;
|
||||
uint8_t andsw:4;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SpecialFunction structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define CFN_SPARE_TYPE int32_t
|
||||
|
@ -273,51 +175,15 @@ PACK(struct CustomFunctionData {
|
|||
});
|
||||
uint8_t active;
|
||||
});
|
||||
#elif defined(CPUM2560)
|
||||
PACK(struct CustomFunctionData {
|
||||
int8_t swtch;
|
||||
uint8_t func;
|
||||
uint8_t mode:2;
|
||||
uint8_t param:4;
|
||||
uint8_t active:1;
|
||||
uint8_t spare:1;
|
||||
uint8_t value;
|
||||
});
|
||||
#else
|
||||
PACK(struct CustomFunctionData {
|
||||
PACK(union {
|
||||
PACK(struct {
|
||||
int16_t swtch:6;
|
||||
uint16_t func:4;
|
||||
uint16_t mode:2;
|
||||
uint16_t param:3;
|
||||
uint16_t active:1;
|
||||
}) gvar;
|
||||
|
||||
PACK(struct {
|
||||
int16_t swtch:6;
|
||||
uint16_t func:4;
|
||||
uint16_t param:4;
|
||||
uint16_t spare:1;
|
||||
uint16_t active:1;
|
||||
}) all;
|
||||
});
|
||||
uint8_t value;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* FlightMode structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct trim_t {
|
||||
int16_t value:11;
|
||||
uint16_t mode:5;
|
||||
});
|
||||
#else
|
||||
typedef int16_t trim_t;
|
||||
#endif
|
||||
|
||||
typedef int16_t gvar_t;
|
||||
|
||||
|
@ -327,7 +193,6 @@ typedef int16_t gvar_t;
|
|||
#define FLIGHT_MODE_ROTARY_ENCODERS_FIELD
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct FlightModeData {
|
||||
trim_t trim[NUM_TRIMS];
|
||||
NOBACKUP(char name[LEN_FLIGHT_MODE_NAME]);
|
||||
|
@ -338,47 +203,22 @@ PACK(struct FlightModeData {
|
|||
FLIGHT_MODE_ROTARY_ENCODERS_FIELD
|
||||
gvar_t gvars[MAX_GVARS];
|
||||
});
|
||||
#elif !defined(PCBSTD)
|
||||
PACK(struct FlightModeData {
|
||||
trim_t trim[NUM_STICKS];
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
NOBACKUP(char name[LEN_FLIGHT_MODE_NAME]);
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
FLIGHT_MODE_ROTARY_ENCODERS_FIELD
|
||||
gvar_t gvars[MAX_GVARS];
|
||||
});
|
||||
#else
|
||||
PACK(struct FlightModeData {
|
||||
int8_t trim[NUM_STICKS];
|
||||
int8_t trim_ext; // 2 extra bits per trim (10bits)
|
||||
int8_t swtch; // swtch of phase[0] is not used
|
||||
NOBACKUP(char name[LEN_FLIGHT_MODE_NAME]);
|
||||
uint8_t fadeIn:4;
|
||||
uint8_t fadeOut:4;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Curve structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct CurveData {
|
||||
uint8_t type:1;
|
||||
uint8_t smooth:1;
|
||||
int8_t points:6; // describes number of points - 5
|
||||
NOBACKUP(char name[LEN_CURVE_NAME]);
|
||||
});
|
||||
#else
|
||||
typedef int8_t CurveData;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GVar structure
|
||||
*/
|
||||
|
||||
#if !defined(PCBSTD)
|
||||
PACK(struct GVarData {
|
||||
NOBACKUP(char name[LEN_GVAR_NAME]);
|
||||
uint32_t min:12;
|
||||
|
@ -388,13 +228,11 @@ PACK(struct GVarData {
|
|||
uint32_t unit:2;
|
||||
uint32_t spare:4;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Timer structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct TimerData {
|
||||
int32_t mode:9; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint32_t start:23;
|
||||
|
@ -406,25 +244,6 @@ PACK(struct TimerData {
|
|||
uint32_t direction:1;
|
||||
NOBACKUP(char name[LEN_TIMER_NAME]);
|
||||
});
|
||||
#elif defined(CPUM2560)
|
||||
PACK(struct TimerData {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t start;
|
||||
uint8_t countdownBeep:2;
|
||||
uint8_t minuteBeep:1;
|
||||
uint8_t persistent:2;
|
||||
uint8_t countdownStart:3;
|
||||
uint16_t value;
|
||||
});
|
||||
#else
|
||||
PACK(struct TimerData {
|
||||
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
uint16_t start:12;
|
||||
uint16_t countdownBeep:1;
|
||||
uint16_t minuteBeep:1;
|
||||
uint16_t spare:2;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Swash Ring structure
|
||||
|
@ -468,7 +287,6 @@ PACK(struct ScriptData {
|
|||
/*
|
||||
* Frsky Telemetry structure
|
||||
*/
|
||||
#if defined(CPUARM)
|
||||
PACK(struct RssiAlarmData {
|
||||
int8_t disabled:1;
|
||||
int8_t spare:1;
|
||||
|
@ -478,18 +296,8 @@ PACK(struct RssiAlarmData {
|
|||
inline int8_t getWarningRssi() {return 45 + warning;}
|
||||
inline int8_t getCriticalRssi() {return 42 + critical;}
|
||||
});
|
||||
#else
|
||||
PACK(struct FrSkyRSSIAlarm {
|
||||
int8_t level:2;
|
||||
int8_t value:6;
|
||||
});
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int16_t ls_telemetry_value_t;
|
||||
#else
|
||||
typedef uint8_t ls_telemetry_value_t;
|
||||
#endif
|
||||
|
||||
#if !defined(COLORLCD)
|
||||
PACK(struct FrSkyBarData {
|
||||
|
@ -527,7 +335,7 @@ PACK(struct FrSkyTelemetryData { // TODO EEPROM change, rename to VarioData
|
|||
int8_t varioMin;
|
||||
int8_t varioMax;
|
||||
});
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
// TODO remove this also on Taranis
|
||||
PACK(struct FrSkyTelemetryData {
|
||||
uint8_t voltsSource;
|
||||
|
@ -541,33 +349,6 @@ PACK(struct FrSkyTelemetryData {
|
|||
int8_t varioMin;
|
||||
int8_t varioMax;
|
||||
});
|
||||
#else
|
||||
PACK(struct FrSkyChannelData {
|
||||
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
int16_t offset:12;
|
||||
uint16_t type:4; // channel unit (0=volts, ...)
|
||||
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
|
||||
uint8_t alarms_level:4;
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t multiplier:2; // 0=no multiplier, 1=*2 multiplier
|
||||
});
|
||||
|
||||
PACK(struct FrSkyTelemetryData {
|
||||
FrSkyChannelData channels[MAX_FRSKY_A_CHANNELS];
|
||||
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh, 3=Halcyon
|
||||
uint8_t blades:2; // How many blades for RPMs, 0=2 blades
|
||||
uint8_t screensType:2;
|
||||
uint8_t voltsSource:2;
|
||||
int8_t varioMin:4;
|
||||
int8_t varioMax:4;
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
FrSkyScreenData screens[MAX_TELEMETRY_SCREENS];
|
||||
uint8_t varioSource:3;
|
||||
int8_t varioCenterMin:5;
|
||||
uint8_t currentSource:3;
|
||||
int8_t varioCenterMax:5;
|
||||
int8_t fasOffset;
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -587,7 +368,6 @@ PACK(struct MavlinkTelemetryData {
|
|||
* Telemetry Sensor structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(struct TelemetrySensor {
|
||||
union {
|
||||
uint16_t id; // data identifier, for FrSky we can reuse existing ones. Source unit is derived from type.
|
||||
|
@ -641,7 +421,6 @@ PACK(struct TelemetrySensor {
|
|||
int32_t getPrecMultiplier() const;
|
||||
int32_t getPrecDivisor() const);
|
||||
});
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Module structure
|
||||
|
@ -709,11 +488,7 @@ PACK(struct ModuleData {
|
|||
* Model structure
|
||||
*/
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
typedef uint16_t BeepANACenter;
|
||||
#else
|
||||
typedef uint8_t BeepANACenter;
|
||||
#endif
|
||||
|
||||
#if LEN_BITMAP_NAME > 0
|
||||
#define MODEL_HEADER_BITMAP_FIELD NOBACKUP(char bitmap[LEN_BITMAP_NAME]);
|
||||
|
@ -753,23 +528,9 @@ typedef uint8_t swarnenable_t;
|
|||
swarnenable_t switchWarningEnable;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(GVARS)
|
||||
#define MODEL_GVARS_DATA gvar_t gvars[MAX_GVARS];
|
||||
#elif defined(PCBSTD)
|
||||
#define MODEL_GVARS_DATA
|
||||
#else
|
||||
#define MODEL_GVARS_DATA GVarData gvars[MAX_GVARS];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky); NOBACKUP(RssiAlarmData rssiAlarms);
|
||||
#elif defined(TELEMETRY_MAVLINK)
|
||||
#define TELEMETRY_DATA MavlinkTelemetryData mavlink;
|
||||
#elif defined(TELEMETRY_FRSKY) || !defined(PCBSTD)
|
||||
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky);
|
||||
#else
|
||||
#define TELEMETRY_DATA
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#include "gui/480x272/layout.h"
|
||||
|
@ -885,13 +646,10 @@ PACK(struct TrainerData {
|
|||
#define SPLASH_MODE uint8_t splashSpares:3
|
||||
#elif defined(FSPLASH)
|
||||
#define SPLASH_MODE uint8_t splashMode:3
|
||||
#elif defined(CPUARM)
|
||||
#define SPLASH_MODE int8_t splashMode:3
|
||||
#else
|
||||
#define SPLASH_MODE uint8_t splashMode:1; uint8_t splashSpare:2
|
||||
#define SPLASH_MODE int8_t splashMode:3
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EXTRA_GENERAL_FIELDS_ARM \
|
||||
NOBACKUP(uint8_t backlightBright); \
|
||||
NOBACKUP(uint32_t globalTimer); \
|
||||
|
@ -912,7 +670,6 @@ PACK(struct TrainerData {
|
|||
NOBACKUP(int8_t varioRange); \
|
||||
NOBACKUP(int8_t varioRepeat); \
|
||||
CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS];
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
|
@ -959,12 +716,8 @@ PACK(struct TrainerData {
|
|||
uint8_t rotarySteps; \
|
||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
|
||||
#elif defined(CPUARM)
|
||||
#define EXTRA_GENERAL_FIELDS EXTRA_GENERAL_FIELDS_ARM
|
||||
#elif defined(PXX)
|
||||
#define EXTRA_GENERAL_FIELDS uint8_t countryCode;
|
||||
#else
|
||||
#define EXTRA_GENERAL_FIELDS
|
||||
#define EXTRA_GENERAL_FIELDS EXTRA_GENERAL_FIELDS_ARM
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
|
@ -1061,9 +814,7 @@ static inline void check_struct()
|
|||
#define CHKSIZE(x, y) check_size<struct x, y>()
|
||||
#define CHKTYPE(x, y) check_size<x, y>()
|
||||
|
||||
#if defined(CPUARM)
|
||||
CHKSIZE(CurveRef, 2);
|
||||
#endif
|
||||
|
||||
/* Difference between Taranis/Horus is LEN_EXPOMIX_NAME */
|
||||
/* LEN_FUNCTION_NAME is the difference in CustomFunctionData */
|
||||
|
@ -1143,43 +894,21 @@ static inline void check_struct()
|
|||
CHKSIZE(ExpoData, 4);
|
||||
#endif
|
||||
|
||||
#if defined(CPUM2560)
|
||||
CHKSIZE(CustomFunctionData, 4);
|
||||
CHKSIZE(TimerData, 6);
|
||||
#else
|
||||
CHKSIZE(CustomFunctionData, 3);
|
||||
CHKSIZE(TimerData, 3);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
CHKSIZE(FlightModeData, 13);
|
||||
CHKSIZE(RadioData, 84);
|
||||
#else
|
||||
CHKSIZE(FlightModeData, 30);
|
||||
CHKSIZE(RadioData, 85);
|
||||
#endif
|
||||
|
||||
#endif /* board specific ifdefs*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
CHKSIZE(LogicalSwitchData, 9);
|
||||
CHKSIZE(TelemetrySensor, 13);
|
||||
CHKSIZE(ModuleData,70);
|
||||
#else
|
||||
CHKSIZE(LogicalSwitchData, 3);
|
||||
CHKSIZE(FrSkyChannelData, 6);
|
||||
CHKSIZE(ModuleData, 38);
|
||||
#endif
|
||||
|
||||
#if !defined(PCBSTD)
|
||||
CHKSIZE(GVarData, 7);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
CHKSIZE(RssiAlarmData, 2);
|
||||
#else
|
||||
CHKSIZE(FrSkyRSSIAlarm, 1);
|
||||
#endif
|
||||
CHKSIZE(TrainerData, 16);
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "dump.h"
|
||||
#if defined(CLI)
|
||||
#include "cli.h"
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#include "serial.h"
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,11 +48,7 @@
|
|||
#define __NOINIT
|
||||
#endif
|
||||
|
||||
#if defined(SIMU) || defined(CPUARM) || GCC_VERSION < 472
|
||||
typedef int32_t int24_t;
|
||||
#else
|
||||
typedef __int24 int24_t;
|
||||
#endif
|
||||
|
||||
#if __GNUC__
|
||||
#define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__))
|
||||
|
|
|
@ -46,7 +46,6 @@ extern const pm_uchar font_10x14[];
|
|||
extern const pm_uchar font_5x7_B[];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern const pm_uchar font_3x5[];
|
||||
extern const pm_uchar font_4x6[];
|
||||
extern const pm_uchar font_8x10[];
|
||||
|
@ -54,7 +53,6 @@ extern const pm_uchar font_22x38_num[];
|
|||
extern const pm_uchar font_5x7_extra[];
|
||||
extern const pm_uchar font_10x14_extra[];
|
||||
extern const pm_uchar font_4x6_extra[];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
|
||||
CustomFunctionsContext modelFunctionsContext = { 0 };
|
||||
|
||||
#if defined(CPUARM)
|
||||
CustomFunctionsContext globalFunctionsContext = { 0 };
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
/*
|
||||
|
@ -49,7 +47,6 @@ PLAY_FUNCTION(playValue, source_t idx)
|
|||
|
||||
getvalue_t val = getValue(idx);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (idx >= MIXSRC_FIRST_TELEM) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[(idx-MIXSRC_FIRST_TELEM) / 3];
|
||||
uint8_t attr = 0;
|
||||
|
@ -89,128 +86,9 @@ PLAY_FUNCTION(playValue, source_t idx)
|
|||
}
|
||||
PLAY_NUMBER(val, 0, 0);
|
||||
}
|
||||
#else
|
||||
switch (idx) {
|
||||
case MIXSRC_FIRST_TELEM+TELEM_TX_VOLTAGE-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_VOLTS, PREC1);
|
||||
break;
|
||||
case MIXSRC_FIRST_TELEM+TELEM_TIMER1-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_TIMER2-1:
|
||||
PLAY_DURATION(val, 0);
|
||||
break;
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
case MIXSRC_FIRST_TELEM+TELEM_RSSI_TX-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_RSSI_RX-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_DB, 0);
|
||||
break;
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_A1-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_A2-1:
|
||||
idx -= TELEM_MIN_A1-TELEM_A1;
|
||||
// no break
|
||||
case MIXSRC_FIRST_TELEM+TELEM_A1-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_A2-1:
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
idx -= (MIXSRC_FIRST_TELEM+TELEM_A1-1);
|
||||
uint8_t att = 0;
|
||||
int16_t converted_value = div_and_round(applyChannelRatio(idx, val), 10);
|
||||
if (ANA_CHANNEL_UNIT(idx) < UNIT_RAW) {
|
||||
att = PREC1;
|
||||
}
|
||||
PLAY_NUMBER(converted_value, 1+ANA_CHANNEL_UNIT(idx), att);
|
||||
}
|
||||
break;
|
||||
case MIXSRC_FIRST_TELEM+TELEM_CELL-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_CELL-1:
|
||||
PLAY_NUMBER(div_and_round(val, 10), 1+UNIT_VOLTS, PREC1);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_VFAS-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_CELLS_SUM-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_CELLS_SUM-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_VFAS-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_VOLTS, PREC1);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_CURRENT-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MAX_CURRENT-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_AMPS, PREC1);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_ACCx-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_ACCy-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_ACCz-1:
|
||||
PLAY_NUMBER(div_and_round(val, 10), 1+UNIT_G, PREC1);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_VSPEED-1:
|
||||
PLAY_NUMBER(div_and_round(val, 10), 1+UNIT_METERS_PER_SECOND, PREC1);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_ASPEED-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MAX_ASPEED-1:
|
||||
PLAY_NUMBER(val/10, 1+UNIT_KTS, 0);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_CONSUMPTION-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_MAH, 0);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_POWER-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_WATTS, 0);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_ALT-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MIN_ALT-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MAX_ALT-1:
|
||||
#if defined(WS_HOW_HIGH)
|
||||
if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH())
|
||||
PLAY_NUMBER(val, 1+UNIT_FEET, 0);
|
||||
else
|
||||
#endif
|
||||
PLAY_NUMBER(val, 1+UNIT_DIST, 0);
|
||||
break;
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_RPM-1:
|
||||
case MIXSRC_FIRST_TELEM+TELEM_MAX_RPM-1:
|
||||
{
|
||||
getvalue_t rpm = val;
|
||||
if (rpm > 100)
|
||||
rpm = 10 * div_and_round(rpm, 10);
|
||||
if (rpm > 1000)
|
||||
rpm = 10 * div_and_round(rpm, 10);
|
||||
PLAY_NUMBER(rpm, 1+UNIT_RPMS, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case MIXSRC_FIRST_TELEM+TELEM_HDG-1:
|
||||
PLAY_NUMBER(val, 1+UNIT_HDG, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
uint8_t unit = 1;
|
||||
if (idx < MIXSRC_GVAR1)
|
||||
val = calcRESXto100(val);
|
||||
if (idx >= MIXSRC_FIRST_TELEM+TELEM_ALT-1 && idx <= MIXSRC_FIRST_TELEM+TELEM_GPSALT-1)
|
||||
unit = idx - (MIXSRC_FIRST_TELEM+TELEM_ALT-1);
|
||||
else if (idx >= MIXSRC_FIRST_TELEM+TELEM_MAX_T1-1 && idx <= MIXSRC_FIRST_TELEM+TELEM_MAX_DIST-1)
|
||||
unit = 3 + idx - (MIXSRC_FIRST_TELEM+TELEM_MAX_T1-1);
|
||||
|
||||
unit = pgm_read_byte(bchunit_ar+unit);
|
||||
PLAY_NUMBER(val, unit == UNIT_RAW ? 0 : unit+1, 0);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
default:
|
||||
PLAY_NUMBER(val, 0, 0);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void playCustomFunctionFile(const CustomFunctionData * sd, uint8_t id)
|
||||
{
|
||||
if (sd->play.name[0] != '\0') {
|
||||
|
@ -222,9 +100,7 @@ void playCustomFunctionFile(const CustomFunctionData * sd, uint8_t id)
|
|||
PLAY_FILE(filename, sd->func==FUNC_BACKGND_MUSIC ? PLAY_BACKGROUND : 0, id);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isRepeatDelayElapsed(const CustomFunctionData * functions, CustomFunctionsContext & functionsContext, uint8_t index)
|
||||
{
|
||||
const CustomFunctionData * cfn = &functions[index];
|
||||
|
@ -241,32 +117,17 @@ bool isRepeatDelayElapsed(const CustomFunctionData * functions, CustomFunctionsC
|
|||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define isRepeatDelayElapsed(...) true
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define VOLUME_HYSTERESIS 10 // how much must a input value change to actually be considered for new volume setting
|
||||
getvalue_t requiredSpeakerVolumeRawLast = 1024 + 1; //initial value must be outside normal range
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
#else
|
||||
#define functions g_model.customFn
|
||||
#define functionsContext modelFunctionsContext
|
||||
void evalFunctions()
|
||||
#endif
|
||||
{
|
||||
MASK_FUNC_TYPE newActiveFunctions = 0;
|
||||
MASK_CFN_TYPE newActiveSwitches = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t playFirstIndex = (functions == g_model.customFn ? 1 : 1+MAX_SPECIAL_FUNCTIONS);
|
||||
#define PLAY_INDEX (i+playFirstIndex)
|
||||
#else
|
||||
#define PLAY_INDEX (i+1)
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS)
|
||||
static rotenc_t rePreviousValues[ROTARY_ENCODERS];
|
||||
|
@ -290,11 +151,7 @@ void evalFunctions()
|
|||
if (swtch) {
|
||||
MASK_CFN_TYPE switch_mask = ((MASK_CFN_TYPE)1 << i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool active = getSwitch(swtch, IS_PLAY_FUNC(CFN_FUNC(cfn)) ? GETSWITCH_MIDPOS_DELAY : 0);
|
||||
#else
|
||||
bool active = getSwitch(swtch);
|
||||
#endif
|
||||
|
||||
if (HAS_ENABLE_PARAM(CFN_FUNC(cfn))) {
|
||||
active &= (bool)CFN_ACTIVE(cfn);
|
||||
|
@ -333,18 +190,12 @@ void evalFunctions()
|
|||
switch (CFN_PARAM(cfn)) {
|
||||
case FUNC_RESET_TIMER1:
|
||||
case FUNC_RESET_TIMER2:
|
||||
#if defined(CPUARM)
|
||||
case FUNC_RESET_TIMER3:
|
||||
#endif
|
||||
timerReset(CFN_PARAM(cfn));
|
||||
break;
|
||||
case FUNC_RESET_FLIGHT:
|
||||
if (!(functionsContext.activeSwitches & switch_mask)) {
|
||||
#if defined(CPUARM)
|
||||
mainRequestFlags |= (1 << REQUEST_FLIGHT_RESET); // on systems with threads flightReset() must not be called from the mixers thread!
|
||||
#else
|
||||
flightReset();
|
||||
#endif // defined(CPUARM)
|
||||
}
|
||||
break;
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
|
@ -362,17 +213,14 @@ void evalFunctions()
|
|||
break;
|
||||
#endif
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (CFN_PARAM(cfn)>=FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
uint8_t item = CFN_PARAM(cfn)-FUNC_RESET_PARAM_FIRST_TELEM;
|
||||
if (item < MAX_TELEMETRY_SENSORS) {
|
||||
telemetryItems[item].clear();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case FUNC_SET_TIMER:
|
||||
timerSet(CFN_TIMER_INDEX(cfn), CFN_PARAM(cfn));
|
||||
break;
|
||||
|
@ -392,7 +240,6 @@ void evalFunctions()
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
#endif // defined(CPUARM)
|
||||
|
||||
#if defined(GVARS)
|
||||
case FUNC_ADJUST_GVAR:
|
||||
|
@ -404,11 +251,7 @@ void evalFunctions()
|
|||
}
|
||||
else if (CFN_GVAR_MODE(cfn) == FUNC_ADJUST_GVAR_INCDEC) {
|
||||
if (!(functionsContext.activeSwitches & switch_mask)) {
|
||||
#if defined(CPUARM)
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), limit<int16_t>(MODEL_GVAR_MIN(CFN_GVAR_INDEX(cfn)), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + CFN_PARAM(cfn), MODEL_GVAR_MAX(CFN_GVAR_INDEX(cfn))), mixerCurrentFlightMode);
|
||||
#else
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + (CFN_PARAM(cfn) ? +1 : -1), mixerCurrentFlightMode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (CFN_PARAM(cfn) >= MIXSRC_FIRST_TRIM && CFN_PARAM(cfn) <= MIXSRC_LAST_TRIM) {
|
||||
|
@ -418,20 +261,12 @@ void evalFunctions()
|
|||
else if (CFN_PARAM(cfn) >= MIXSRC_REa && CFN_PARAM(cfn) < MIXSRC_TrimRud) {
|
||||
int8_t scroll = rePreviousValues[CFN_PARAM(cfn)-MIXSRC_REa] - (rotencValue[CFN_PARAM(cfn)-MIXSRC_REa] / ROTARY_ENCODER_GRANULARITY);
|
||||
if (scroll) {
|
||||
#if defined(CPUARM)
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), limit<int16_t>(MODEL_GVAR_MIN(CFN_GVAR_INDEX(cfn)), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, MODEL_GVAR_MAX(CFN_GVAR_INDEX(cfn))), mixerCurrentFlightMode);
|
||||
#else
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), GVAR_VALUE(CFN_GVAR_INDEX(cfn), getGVarFlightMode(mixerCurrentFlightMode, CFN_GVAR_INDEX(cfn))) + scroll, mixerCurrentFlightMode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), limit<int16_t>(MODEL_GVAR_MIN(CFN_GVAR_INDEX(cfn)), calcRESXto100(getValue(CFN_PARAM(cfn))), MODEL_GVAR_MAX(CFN_GVAR_INDEX(cfn))), mixerCurrentFlightMode);
|
||||
#else
|
||||
SET_GVAR(CFN_GVAR_INDEX(cfn), calcRESXto100(getValue(CFN_PARAM(cfn))), mixerCurrentFlightMode);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
@ -543,18 +378,6 @@ void evalFunctions()
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(HAPTIC) && !defined(CPUARM)
|
||||
case FUNC_HAPTIC:
|
||||
{
|
||||
tmr10ms_t tmr10ms = get_tmr10ms();
|
||||
uint8_t repeatParam = CFN_PLAY_REPEAT(cfn);
|
||||
if (!functionsContext.lastFunctionTime[i] || (repeatParam && (signed)(tmr10ms-functionsContext.lastFunctionTime[i])>=1000*repeatParam)) {
|
||||
functionsContext.lastFunctionTime[i] = tmr10ms;
|
||||
haptic.event(AU_SPECIAL_SOUND_LAST+CFN_PARAM(cfn));
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
case FUNC_LOGS:
|
||||
|
@ -617,7 +440,3 @@ void evalFunctions()
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#undef functions
|
||||
#undef functionsContext
|
||||
#endif
|
||||
|
|
|
@ -21,11 +21,7 @@
|
|||
#include "opentx.h"
|
||||
|
||||
const pm_uchar font_5x7[] PROGMEM = {
|
||||
#if defined (CPUARM)
|
||||
#include "font_05x07.lbm"
|
||||
#else
|
||||
#include "font_05x07_avr.lbm"
|
||||
#endif
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_05x07.lbm"
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
|
@ -56,7 +52,6 @@ const pm_uchar font_5x7_B[] PROGMEM = {
|
|||
#if !defined(BOOT)
|
||||
const pm_uchar font_10x14[] PROGMEM = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#if defined(CPUARM)
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_10x14.lbm"
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
|
@ -76,7 +71,6 @@ const pm_uchar font_10x14[] PROGMEM = {
|
|||
#elif defined(TRANSLATIONS_SE)
|
||||
#include "font_se_10x14.lbm"
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -54,14 +54,7 @@ extern uint8_t noHighlightCounter;
|
|||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
#elif defined(GRAPHICS)
|
||||
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr);
|
||||
#define drawSlider(x, y, value, max, attr) lcdDrawNumber(x, y, value, attr|LEFT)
|
||||
#else
|
||||
#define drawSlider(x, y, value, max, attr) lcdDrawNumber(x, y, value, attr|LEFT)
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
extern int16_t p1valdiff;
|
||||
|
@ -92,28 +85,15 @@ extern int8_t s_editMode; // global editmode
|
|||
#define INCDEC_REP10 0x40
|
||||
#define NO_DBLKEYS 0x80
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
#elif defined(CPUM64)
|
||||
#define INCDEC_DECLARE_VARS(f)
|
||||
#define INCDEC_SET_FLAG(f)
|
||||
#define INCDEC_ENABLE_CHECK(fn)
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, EE_MODEL)
|
||||
#else
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f)
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn)
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag)
|
||||
#endif
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
struct CheckIncDecStops {
|
||||
const int count;
|
||||
const int stops[];
|
||||
|
@ -146,19 +126,10 @@ extern const CheckIncDecStops &stopsSwitch;
|
|||
#define CATEGORY_END(val) \
|
||||
(val), (val+1)
|
||||
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
|
||||
#else
|
||||
int16_t checkIncDec(event_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max);
|
||||
int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#else
|
||||
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
|
||||
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
|
||||
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
|
||||
#endif
|
||||
|
||||
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \
|
||||
var = checkIncDecModel(event, var, min, max)
|
||||
|
@ -166,47 +137,19 @@ int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
|||
#define CHECK_INCDEC_MODELVAR_ZERO(event, var, max) \
|
||||
var = checkIncDecModelZero(event, var, max)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL, check)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, var, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
|
||||
#elif defined(AUTOSWITCH)
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
|
||||
#else
|
||||
#define AUTOSWITCH_ENTER_LONG() (0)
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
CHECK_INCDEC_MODELVAR(event, var, min, max)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_MODELVAR(event, var, min, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
|
||||
#elif defined(AUTOSOURCE)
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELSOURCE CHECK_INCDEC_MODELVAR
|
||||
#endif
|
||||
|
||||
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
|
||||
var = checkIncDecGen(event, var, min, max)
|
||||
|
@ -224,11 +167,7 @@ void check_submenu_simple(event_t event, uint8_t maxrow);
|
|||
void title(const pm_char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
#else
|
||||
#define MENU_TAB(...) static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#define MENU_CHECK(tab, menu, lines_count) \
|
||||
|
@ -284,11 +223,7 @@ void title(const pm_char * s);
|
|||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int choice_t;
|
||||
#else
|
||||
typedef int8_t choice_t;
|
||||
#endif
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, event_t event);
|
||||
|
@ -321,17 +256,9 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
|
|||
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr=ZCHAR);
|
||||
#else
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active)
|
||||
#else
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
#endif
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay);
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
|
@ -367,14 +294,12 @@ void drawStatusLine();
|
|||
#define drawStatusLine()
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
void readModelNotes();
|
||||
#endif
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
|
@ -416,11 +341,7 @@ void drawStatusLine();
|
|||
#define EDIT_MODE_INIT -1
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define editNameCursorPos menuHorizontalPosition
|
||||
#else
|
||||
extern uint8_t editNameCursorPos;
|
||||
#endif
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
uint8_t getExposCount();
|
||||
|
@ -454,9 +375,7 @@ void doMainScreenGraphics();
|
|||
void drawProgressBar(const char * label, int num, int den);
|
||||
void drawSleepBitmap();
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void drawAlertBox(const pm_char * title, const pm_char * text, const char * action);
|
||||
|
@ -481,9 +400,7 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
|
|||
#endif
|
||||
#define IS_OTHER_VIEW_DISPLAYED() false
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
||||
#endif
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
|
||||
|
|
|
@ -29,7 +29,6 @@ void lcdClear()
|
|||
|
||||
coord_t lcdLastRightPos;
|
||||
coord_t lcdNextPos;
|
||||
#if defined(CPUARM)
|
||||
coord_t lcdLastLeftPos;
|
||||
|
||||
void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
|
@ -282,7 +281,6 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
|||
lcdPutPattern(x, y, q, 5, 7, flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c)
|
||||
{
|
||||
|
@ -309,10 +307,8 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
|||
{
|
||||
const coord_t orig_x = x;
|
||||
|
||||
#if defined(CPUARM)
|
||||
const uint8_t orig_len = len;
|
||||
uint32_t fontsize = FONTSIZE(flags);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
uint8_t width = 0;
|
||||
|
@ -354,27 +350,21 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
|||
setx = true;
|
||||
}
|
||||
else if (c == 0x1E) { //NEWLINE
|
||||
#if defined(CPUARM)
|
||||
len = orig_len;
|
||||
#endif
|
||||
x = orig_x;
|
||||
y += FH;
|
||||
#if defined(CPUARM)
|
||||
if (fontsize == DBLSIZE)
|
||||
y += FH;
|
||||
else if (fontsize == MIDSIZE)
|
||||
y += 4;
|
||||
else if (fontsize == SMLSIZE)
|
||||
y--;
|
||||
#endif
|
||||
if (y >= LCD_H) break;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (c == 0x1D) { // TAB
|
||||
x |= 0x3F;
|
||||
x += 1;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
x += (c*FW/2); // EXTENDED SPACE
|
||||
}
|
||||
|
@ -426,7 +416,6 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, Lcd
|
|||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
{
|
||||
x += FWNUM*4+1;
|
||||
|
@ -438,19 +427,6 @@ void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
|||
val >>= 4;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint16_t val)
|
||||
{
|
||||
x += FWNUM*4+1;
|
||||
for(int i=0; i<4; i++) {
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c>9 ? c+'A'-10 : c+'0';
|
||||
lcdDrawChar(x, y, c, c>='A' ? CONDENSED : 0);
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val)
|
||||
{
|
||||
|
@ -464,7 +440,6 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags)
|
|||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
char str[16+1];
|
||||
char *s = str+16;
|
||||
*s = '\0';
|
||||
|
@ -492,106 +467,6 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t l
|
|||
}
|
||||
flags &= ~LEADING0;
|
||||
lcdDrawText(x, y, s, flags);
|
||||
#else // CPUARM
|
||||
bool dblsize = flags & DBLSIZE;
|
||||
uint8_t fw = FWNUM;
|
||||
int8_t mode = MODE(flags);
|
||||
flags &= ~LEADING0;
|
||||
|
||||
bool neg = false;
|
||||
if (flags & UNSIGN) {
|
||||
flags -= UNSIGN;
|
||||
}
|
||||
else if (val < 0) {
|
||||
neg = true;
|
||||
val = -val;
|
||||
}
|
||||
|
||||
coord_t xn = 0;
|
||||
uint8_t ln = 2;
|
||||
|
||||
if (mode != MODE(LEADING0)) {
|
||||
len = 1;
|
||||
lcduint_t tmp = ((lcduint_t)val) / 10;
|
||||
while (tmp) {
|
||||
len++;
|
||||
tmp /= 10;
|
||||
}
|
||||
if (len <= mode) {
|
||||
len = mode + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (dblsize) {
|
||||
fw += FWNUM;
|
||||
}
|
||||
else {
|
||||
if (IS_LEFT_ALIGNED(flags)) {
|
||||
if (mode > 0) {
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOLD_FONT) && !defined(CPUM64) || defined(TELEMETRY_NONE)
|
||||
if (flags & BOLD) fw += 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (IS_LEFT_ALIGNED(flags)) {
|
||||
x += len * fw;
|
||||
if (neg) {
|
||||
x += ((dblsize) ? 7 : FWNUM);
|
||||
}
|
||||
}
|
||||
|
||||
lcdLastRightPos = x;
|
||||
x -= fw;
|
||||
if (dblsize) x++;
|
||||
|
||||
for (uint8_t i=1; i<=len; i++) {
|
||||
div_t qr = div((lcduint_t)val, 10);
|
||||
char c = qr.rem + '0';
|
||||
LcdFlags f = flags;
|
||||
if (dblsize) {
|
||||
if (c=='1' && i==len && xn>x+10) { x+=1; }
|
||||
if ((lcduint_t)val >= 1000) { x+=FWNUM; f &= ~DBLSIZE; }
|
||||
}
|
||||
lcdDrawChar(x, y, c, f);
|
||||
if (mode == i) {
|
||||
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
|
||||
if (dblsize) {
|
||||
xn = x - 2;
|
||||
if (c>='2' && c<='3') ln++;
|
||||
uint8_t tn = (qr.quot % 10);
|
||||
if (tn==2 || tn==4) {
|
||||
if (c=='4') {
|
||||
xn++;
|
||||
}
|
||||
else {
|
||||
xn--;
|
||||
ln++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
x -= 2;
|
||||
lcdDrawChar(x, y, '.', f);
|
||||
}
|
||||
}
|
||||
if (dblsize && (lcduint_t)val >= 1000 && (lcduint_t)val < 10000) x-=2;
|
||||
val = qr.quot;
|
||||
x -= fw;
|
||||
#if defined(BOLD_FONT) && !defined(CPUM64) || defined(TELEMETRY_NONE)
|
||||
if (i==len && (flags & BOLD)) x += 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (xn) {
|
||||
// TODO needed on CPUAVR? y &= ~0x07;
|
||||
lcdDrawSolidFilledRect(xn, y+2*FH-3, ln, 2);
|
||||
}
|
||||
if (neg) lcdDrawChar(x, y, '-', flags);
|
||||
#endif // CPUARM
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -646,60 +521,11 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(CPUM64)
|
||||
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
if (y<0) { h+=y; y=0; }
|
||||
if (y+h > LCD_H) { h = LCD_H - y; }
|
||||
|
||||
if (pat==DOTTED && !(y%2))
|
||||
pat = ~pat;
|
||||
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
y = (y & 0x07);
|
||||
if (y) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= ~(BITMASK(y)-1) & pat;
|
||||
p += LCD_W;
|
||||
h -= 8-y;
|
||||
}
|
||||
while (h>0) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= pat;
|
||||
p += LCD_W;
|
||||
h -= 8;
|
||||
}
|
||||
if (h < 0) h += 8;
|
||||
if (h) {
|
||||
p -= LCD_W;
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= ~(BITMASK(h)-1) & pat;
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, SOLID);
|
||||
}
|
||||
|
||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, pat);
|
||||
lcdDrawVerticalLine(x+w-1, y, h, pat);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcdDrawHorizontalLine(x, y+h-1, w, pat);
|
||||
lcdDrawHorizontalLine(x, y, w, pat);
|
||||
}
|
||||
#else
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
#if defined(CPUARM)
|
||||
// should never happen on 9X
|
||||
if (y >= LCD_H) return;
|
||||
#endif
|
||||
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
if (y<0) { h+=y; y=0; }
|
||||
|
@ -744,17 +570,10 @@ void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFla
|
|||
lcdDrawHorizontalLine(x, y+h-1, w, pat, att);
|
||||
lcdDrawHorizontalLine(x, y, w, pat, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
#if defined(CPUM64)
|
||||
for (scoord_t i=y; i<(scoord_t)(y+h); i++) {
|
||||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#else
|
||||
for (scoord_t i=y; i<(scoord_t)(y+h); i++) { // cast to scoord_t needed otherwise (y+h) is promoted to int (see #5055)
|
||||
if ((att&ROUND) && (i==y || i==y+h-1))
|
||||
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
|
||||
|
@ -762,7 +581,6 @@ void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat,
|
|||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawTelemetryTopBar()
|
||||
|
@ -804,28 +622,22 @@ void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
|||
|
||||
qr = div((int)tme, 60);
|
||||
|
||||
#if defined(CPUARM)
|
||||
char separator = ':';
|
||||
if (tme >= 3600) {
|
||||
qr = div(qr.quot, 60);
|
||||
separator = CHR_HOUR;
|
||||
}
|
||||
#else
|
||||
#define separator ':'
|
||||
#endif
|
||||
if(qr.quot < 100) {
|
||||
lcdDrawNumber(x, y, qr.quot, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, qr.quot, att|LEFT);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (FONTSIZE(att) == MIDSIZE) {
|
||||
lcdLastRightPos--;
|
||||
}
|
||||
if (separator == CHR_HOUR)
|
||||
att &= ~DBLSIZE;
|
||||
#endif
|
||||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
if (att & TIMEBLINK)
|
||||
lcdDrawChar(lcdLastRightPos, y, separator, BLINK);
|
||||
|
@ -847,7 +659,6 @@ void putsVBat(coord_t x, coord_t y, LcdFlags att)
|
|||
putsVolts(x, y, g_vbat100mV, att);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == MIXSRC_NONE) {
|
||||
|
@ -937,40 +748,6 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
|||
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void drawSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx < MIXSRC_THR)
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx, att);
|
||||
else if (idx < MIXSRC_SW1)
|
||||
drawSwitch(x, y, idx-MIXSRC_THR+1+3*(1), att);
|
||||
else if (idx <= MIXSRC_LAST_LOGICAL_SWITCH)
|
||||
drawSwitch(x, y, SWSRC_SW1+idx-MIXSRC_SW1, att);
|
||||
else if (idx < MIXSRC_CH1)
|
||||
drawStringWithIndex(x, y, STR_PPM_TRAINER, idx-MIXSRC_FIRST_TRAINER+1, att);
|
||||
else if (idx <= MIXSRC_LAST_CH) {
|
||||
drawStringWithIndex(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
|
||||
}
|
||||
#if defined(GVARS) || !defined(PCBSTD)
|
||||
else if (idx <= MIXSRC_LAST_GVAR)
|
||||
drawStringWithIndex(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
|
||||
#endif
|
||||
else if (idx < MIXSRC_FIRST_TELEM) {
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-(MIXSRC_SW1-MIXSRC_THR)-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else {
|
||||
idx -= MIXSRC_FIRST_TELEM;
|
||||
div_t qr = div(idx, 3);
|
||||
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, ZLEN(g_model.telemetrySensors[qr.quot].label), ZCHAR|att);
|
||||
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
}
|
||||
#else
|
||||
else
|
||||
lcdDrawTextAtIndex(x, y, STR_VTELEMCHNS, idx-MIXSRC_FIRST_TELEM+1, att);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
|
@ -989,47 +766,18 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawSwitch(coord_t x, coord_t y, swsrc_t idx, LcdFlags flags)
|
||||
{
|
||||
char s[8];
|
||||
getSwitchString(s, idx);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
#else
|
||||
void drawSwitch(coord_t x, coord_t y, swsrc_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == SWSRC_OFF)
|
||||
return lcdDrawTextAtIndex(x, y, STR_OFFON, 0, att);
|
||||
if (idx < 0) {
|
||||
lcdDrawChar(x-2, y, '!', att);
|
||||
idx = -idx;
|
||||
}
|
||||
#if defined(CPUARM) && defined(FLIGHT_MODES)
|
||||
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
|
||||
return drawStringWithIndex(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
#endif
|
||||
return lcdDrawTextAtIndex(x, y, STR_VSWITCHES, idx, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
char s[8];
|
||||
getCurveString(s, idx);
|
||||
lcdDrawText(x, y, s, att);
|
||||
#else // CPUARM
|
||||
if (idx < 0) {
|
||||
lcdDrawChar(x-3, y, '!', att);
|
||||
idx = -idx+CURVE_BASE-1;
|
||||
}
|
||||
if (idx < CURVE_BASE)
|
||||
lcdDrawTextAtIndex(x, y, STR_VCURVEFUNC, idx, att);
|
||||
else
|
||||
drawStringWithIndex(x, y, STR_CV, idx-CURVE_BASE+1, att);
|
||||
#endif // CPUARM
|
||||
}
|
||||
|
||||
void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
||||
|
@ -1043,7 +791,6 @@ void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
|||
drawSwitch(x, y, mode, att);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
trim_t v = getRawTrimValue(fm, idx);
|
||||
|
@ -1071,21 +818,6 @@ void drawShortTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags a
|
|||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
trim_t v = getRawTrimValue(fm, idx);
|
||||
|
||||
if (v > TRIM_EXTENDED_MAX) {
|
||||
uint8_t p = v - TRIM_EXTENDED_MAX - 1;
|
||||
if (p >= fm) p++;
|
||||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
else {
|
||||
putsChnLetter(x, y, idx+1, att);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ROTARY_ENCODERS > 0
|
||||
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att)
|
||||
|
@ -1103,7 +835,6 @@ void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, Lcd
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
|
@ -1195,160 +926,6 @@ void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, Lcd
|
|||
{
|
||||
drawGPSPosition(x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
|
||||
}
|
||||
#elif defined(TELEMETRY_FRSKY)
|
||||
void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
convertUnit(val, unit);
|
||||
lcdDrawNumber(x, y, val, att & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT) && unit != UNIT_RAW) {
|
||||
lcdDrawTextAtIndex(lcdLastRightPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_DIST, // Alt
|
||||
UNIT_RAW, // Rpm
|
||||
UNIT_PERCENT, // Fuel
|
||||
UNIT_TEMPERATURE, // T1
|
||||
UNIT_TEMPERATURE, // T2
|
||||
UNIT_KTS, // Speed
|
||||
UNIT_DIST, // Dist
|
||||
UNIT_DIST, // GPS Alt
|
||||
};
|
||||
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TIMER1-1:
|
||||
case TELEM_TIMER2-1:
|
||||
att &= ~NO_UNIT;
|
||||
drawTimer(x, y, val, att, att);
|
||||
break;
|
||||
|
||||
case TELEM_MIN_A1-1:
|
||||
case TELEM_MIN_A2-1:
|
||||
channel -= TELEM_MIN_A1-TELEM_A1;
|
||||
// no break
|
||||
case TELEM_A1-1:
|
||||
case TELEM_A2-1:
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
lcdint_t converted_value = applyChannelRatio(channel, val);
|
||||
if (ANA_CHANNEL_UNIT(channel) >= UNIT_RAW) {
|
||||
converted_value = div_and_round(converted_value, 10);
|
||||
}
|
||||
else {
|
||||
if (abs(converted_value) < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
converted_value = div_and_round(converted_value, 10);
|
||||
att |= PREC1;
|
||||
}
|
||||
}
|
||||
drawValueWithUnit(x, y, converted_value, g_model.frsky.channels[channel].type, att);
|
||||
break;
|
||||
}
|
||||
|
||||
case TELEM_CELL-1:
|
||||
case TELEM_MIN_CELL-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_VOLTS, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
case TELEM_VFAS-1:
|
||||
case TELEM_CELLS_SUM-1:
|
||||
case TELEM_MIN_CELLS_SUM-1:
|
||||
case TELEM_MIN_VFAS-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_VOLTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CURRENT-1:
|
||||
case TELEM_MAX_CURRENT-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_AMPS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CONSUMPTION-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_MAH, att);
|
||||
break;
|
||||
|
||||
case TELEM_POWER-1:
|
||||
case TELEM_MAX_POWER-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_WATTS, att);
|
||||
break;
|
||||
|
||||
case TELEM_ACCx-1:
|
||||
case TELEM_ACCy-1:
|
||||
case TELEM_ACCz-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_RAW, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_VSPEED-1:
|
||||
drawValueWithUnit(x, y, div_and_round(val, 10), UNIT_RAW, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_ASPEED-1:
|
||||
case TELEM_MAX_ASPEED-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_KTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_RSSI_TX-1:
|
||||
case TELEM_RSSI_RX-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_RAW, att);
|
||||
break;
|
||||
|
||||
case TELEM_HDG-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_HDG, att);
|
||||
break;
|
||||
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
case TELEM_ALT-1:
|
||||
drawValueWithUnit(x, y, div_and_round(val, 10), UNIT_DIST, att|PREC1);
|
||||
break;
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
case TELEM_ALT-1:
|
||||
case TELEM_MIN_ALT-1:
|
||||
case TELEM_MAX_ALT-1:
|
||||
if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
drawValueWithUnit(x, y, val, UNIT_FEET, att);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
uint8_t unit = 1;
|
||||
if (channel >= TELEM_MAX_T1-1 && channel <= TELEM_MAX_DIST-1)
|
||||
channel -= TELEM_MAX_T1 - TELEM_T1;
|
||||
if (channel <= TELEM_GPSALT-1)
|
||||
unit = channel + 1 - TELEM_ALT;
|
||||
if (channel >= TELEM_MIN_ALT-1 && channel <= TELEM_MAX_ALT-1)
|
||||
unit = 0;
|
||||
drawValueWithUnit(x, y, val, pgm_read_byte(bchunit_ar+unit), att);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // defined(TELEMETRY_FRSKY)
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TIMER1-1:
|
||||
case TELEM_TIMER2-1:
|
||||
att &= ~NO_UNIT;
|
||||
drawTimer(x, y, val, att, att);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
lcdDrawNumber(x, y, val, (att|PREC1) & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT))
|
||||
lcdDrawChar(lcdLastRightPos/*+1*/, y, 'V');
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdSetContrast()
|
||||
{
|
||||
|
@ -1357,159 +934,7 @@ void lcdSetContrast()
|
|||
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void lcdDrawChar(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
const pm_uchar *q = &font_5x7[(c-0x20)*5];
|
||||
|
||||
lcdNextPos = x-1;
|
||||
p--;
|
||||
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
unsigned char c_remapped = 0;
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & (DBLSIZE+BOLD)) {
|
||||
#else
|
||||
if (flags & DBLSIZE) {
|
||||
#endif
|
||||
// To save space only some DBLSIZE and BOLD chars are available
|
||||
// c has to be remapped. All non existing chars mapped to 0 (space)
|
||||
|
||||
if (c>=',' && c<=':')
|
||||
c_remapped = c - ',' + 1;
|
||||
else if (c>='A' && c<='Z')
|
||||
c_remapped = c - 'A' + 16;
|
||||
else if (c>='a' && c<='z')
|
||||
c_remapped = c - 'a' + 42;
|
||||
else if (c=='_')
|
||||
c_remapped = 4;
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
else if (c!=' ')
|
||||
flags &= ~BOLD;
|
||||
#endif
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
}
|
||||
if (flags & DBLSIZE) {
|
||||
#endif
|
||||
|
||||
/* each letter consists of ten top bytes followed by
|
||||
* by ten bottom bytes (20 bytes per * char) */
|
||||
q = &font_10x14[((uint16_t)c_remapped)*20];
|
||||
for (int8_t i=0; i<=11; i++) {
|
||||
uint8_t b1=0, b2=0;
|
||||
if (!i) {
|
||||
if (!x || !inv) {
|
||||
lcdNextPos++;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (i <= 10) {
|
||||
b1 = pgm_read_byte(q++); /*top byte*/
|
||||
b2 = pgm_read_byte(q++);
|
||||
}
|
||||
if ((b1 & b2) == 0xff) continue;
|
||||
if (inv) {
|
||||
b1 = ~b1;
|
||||
b2 = ~b2;
|
||||
}
|
||||
if(p+LCD_W < DISPLAY_END) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
ASSERT_IN_DISPLAY(p+LCD_W);
|
||||
LCD_BYTE_FILTER(p, 0, b1);
|
||||
LCD_BYTE_FILTER(p+LCD_W, 0, b2);
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const uint8_t ym8 = (y & 0x07);
|
||||
#if defined(BOLD_FONT)
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & BOLD) {
|
||||
q = &font_5x7_B[(c_remapped)*5];
|
||||
}
|
||||
#else
|
||||
uint8_t bb = 0;
|
||||
if (inv) bb = 0xff;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t *lineEnd = &displayBuf[ y / 8 * LCD_W + LCD_W ];
|
||||
|
||||
for (int8_t i=0; i<=6; i++) {
|
||||
uint8_t b = 0;
|
||||
if (i==0) {
|
||||
if (!x || !inv) {
|
||||
lcdNextPos++;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (i <= 5) {
|
||||
b = pgm_read_byte(q++);
|
||||
}
|
||||
if (b == 0xff) {
|
||||
if (flags & FIXEDWIDTH)
|
||||
b = 0;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (inv) b = ~b;
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(BOLD_FONT) && !defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & BOLD) {
|
||||
uint8_t a;
|
||||
if (inv)
|
||||
a = b & bb;
|
||||
else
|
||||
a = b | bb;
|
||||
bb = b;
|
||||
b = a;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p<DISPLAY_END && p<lineEnd) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
uint8_t mask = ~(0xff << ym8);
|
||||
LCD_BYTE_FILTER(p, mask, b << ym8);
|
||||
if (ym8) {
|
||||
uint8_t *r = p + LCD_W;
|
||||
if (r<DISPLAY_END)
|
||||
LCD_BYTE_FILTER(r, ~mask, b >> (8-ym8));
|
||||
}
|
||||
|
||||
if (inv && (ym8 == 1)) *p |= 0x01;
|
||||
}
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const uint8_t * img, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
const uint8_t * q = img;
|
||||
|
@ -1527,32 +952,6 @@ void lcdDraw1bitBitmap(coord_t x, coord_t y, const uint8_t * img, uint8_t idx, L
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define LCD_IMG_FUNCTION(NAME, TYPE, READ_BYTE) \
|
||||
void NAME(coord_t x, coord_t y, TYPE img, uint8_t idx, LcdFlags att) \
|
||||
{ \
|
||||
TYPE q = img; \
|
||||
uint8_t w = READ_BYTE(q++); \
|
||||
uint8_t hb = (READ_BYTE(q++)+7)/8; \
|
||||
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false); \
|
||||
q += idx*w*hb; \
|
||||
for (uint8_t yb = 0; yb < hb; yb++) { \
|
||||
uint8_t *p = &displayBuf[(y / 8 + yb) * LCD_W + x]; \
|
||||
for (uint8_t i=0; i<w; i++){ \
|
||||
uint8_t b = READ_BYTE(q); \
|
||||
q++; \
|
||||
ASSERT_IN_DISPLAY(p); \
|
||||
*p++ = inv ? ~b : b; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
LCD_IMG_FUNCTION(lcd_imgfar, uint_farptr_t, pgm_read_byte_far)
|
||||
#endif
|
||||
|
||||
LCD_IMG_FUNCTION(lcdDraw1bitBitmap, const pm_uchar *, pgm_read_byte)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,13 +29,8 @@
|
|||
#define CENTER
|
||||
#define CENTER_OFS 0
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int32_t lcdint_t;
|
||||
typedef uint32_t lcduint_t;
|
||||
#else
|
||||
typedef int16_t lcdint_t;
|
||||
typedef uint16_t lcduint_t;
|
||||
#endif
|
||||
|
||||
#define FW 6
|
||||
#define FWNUM 5
|
||||
|
@ -63,11 +58,7 @@
|
|||
/* lcd puts flags */
|
||||
/* no 0x80 here because of "GV"1 which is aligned LEFT */
|
||||
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
|
||||
#if defined(CPUARM)
|
||||
#define BSS 0x00
|
||||
#else
|
||||
#define BSS 0x20
|
||||
#endif
|
||||
#define ZCHAR 0x80
|
||||
|
||||
/* lcd outdez flags */
|
||||
|
@ -76,15 +67,9 @@
|
|||
#define PREC1 0x20
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
#if defined(CPUARM)
|
||||
#define LEFT 0x00 /* fake */
|
||||
#define RIGHT 0x04 /* align right */
|
||||
#define IS_LEFT_ALIGNED(att) !((att) & RIGHT)
|
||||
#else
|
||||
#define LEFT 0x80 /* align left */
|
||||
#define RIGHT 0x00 /* fake */
|
||||
#define IS_LEFT_ALIGNED(att) ((att) & LEFT)
|
||||
#endif
|
||||
#define IS_RIGHT_ALIGNED(att) (!IS_LEFT_ALIGNED(att))
|
||||
|
||||
/* line, rect, square flags */
|
||||
|
@ -95,7 +80,6 @@
|
|||
/* telemetry flags */
|
||||
#define NO_UNIT 0x40
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FONTSIZE_MASK 0x0700
|
||||
#define FONTSIZE(x) ((x) & FONTSIZE_MASK)
|
||||
#define TINSIZE 0x0100
|
||||
|
@ -105,28 +89,12 @@
|
|||
#define XXLSIZE 0x0500
|
||||
#define ERASEBG 0x8000
|
||||
#define VERTICAL 0x0800
|
||||
#else
|
||||
#define DBLSIZE 0x04
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#define XXLSIZE 0x00
|
||||
#define ERASEBG 0x00
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TIMEBLINK 0x1000
|
||||
#define TIMEHOUR 0x2000
|
||||
#define STREXPANDED 0x4000
|
||||
#else
|
||||
#define STREXPANDED 0x00
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef uint32_t LcdFlags;
|
||||
#else
|
||||
typedef uint8_t LcdFlags;
|
||||
#endif
|
||||
|
||||
#define display_t uint8_t
|
||||
#define DISPLAY_BUFFER_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
|
@ -140,9 +108,6 @@ extern coord_t lcdNextPos;
|
|||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
extern volatile uint8_t LcdLock ;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint8_t lcdLock ;
|
||||
|
@ -166,11 +131,7 @@ void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
|
|||
|
||||
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
#else
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint16_t val);
|
||||
#endif
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
|
||||
|
@ -186,11 +147,7 @@ void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
|||
void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
|
||||
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
#if defined(CPUARM)
|
||||
void drawShortTrimMode(coord_t x, coord_t y, uint8_t mode, uint8_t idx, LcdFlags att);
|
||||
#else
|
||||
#define drawShortTrimMode drawTrimMode
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
|
@ -202,17 +159,9 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
|
|||
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att);
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define putstime_t int32_t
|
||||
#define FlightModesType uint16_t
|
||||
#else
|
||||
#define putstime_t int16_t
|
||||
#define FlightModesType uint8_t
|
||||
#endif
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att);
|
||||
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
|
||||
|
@ -228,17 +177,10 @@ void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
|
|||
void lcdMaskPoint(uint8_t *p, uint8_t mask, LcdFlags att=0);
|
||||
void lcdDrawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
|
||||
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
|
||||
#if defined(CPUM64)
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, int8_t h, uint8_t pat);
|
||||
#else
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h, LcdFlags att=0);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att=0)
|
||||
|
@ -258,9 +200,6 @@ void drawTelemetryTopBar();
|
|||
lcdDrawSolidVerticalLine(xx ,yy-ll,ll); \
|
||||
lcdDrawSolidVerticalLine(xx+1,yy-ll,ll)
|
||||
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
void lcd_imgfar(coord_t x, coord_t y, const uint_farptr_t img, uint8_t idx, LcdFlags att); // progmem "far"
|
||||
#endif
|
||||
|
||||
void lcdClear(void);
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
|
@ -292,8 +231,6 @@ const char * writeScreenshot();
|
|||
|
||||
void drawShutdownAnimation(uint32_t index, const char * message);
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t getTextWidth(const char * s, uint8_t len=0, LcdFlags flags=0);
|
||||
#endif
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
|
|
@ -39,102 +39,13 @@ uint8_t s_maxLines = 8;
|
|||
uint8_t s_copySrcIdx;
|
||||
uint8_t s_copySrcCh;
|
||||
|
||||
#if !defined(CPUM64)
|
||||
uint8_t editNameCursorPos = 0;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
#if defined(CPUM64)
|
||||
// in order to save flash
|
||||
lcdDrawTextAlignedLeft(y, STR_NAME);
|
||||
#endif
|
||||
|
||||
uint8_t mode = 0;
|
||||
if (active) {
|
||||
if (s_editMode <= 0)
|
||||
mode = INVERS + FIXEDWIDTH;
|
||||
else
|
||||
mode = FIXEDWIDTH;
|
||||
}
|
||||
|
||||
lcdDrawSizedText(x, y, name, size, ZCHAR | mode);
|
||||
|
||||
if (active) {
|
||||
uint8_t cur = editNameCursorPos;
|
||||
if (s_editMode > 0) {
|
||||
int8_t c = name[cur];
|
||||
int8_t v = c;
|
||||
|
||||
if (p1valdiff || IS_ROTARY_RIGHT(event) || IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP)
|
||||
|| event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP)) {
|
||||
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
|
||||
if (c <= 0) v = -v;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode == EDIT_MODIFY_FIELD) {
|
||||
s_editMode = EDIT_MODIFY_STRING;
|
||||
cur = 0;
|
||||
}
|
||||
else if (cur<size-1)
|
||||
cur++;
|
||||
else
|
||||
s_editMode = 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
if (cur>0) cur--;
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (cur<size-1) cur++;
|
||||
break;
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_LONG:
|
||||
if (v == 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
if (v>=-26 && v<=26) {
|
||||
v = -v; // toggle case
|
||||
if (event==EVT_KEY_LONG(KEY_LEFT))
|
||||
killEvents(KEY_LEFT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (c != v) {
|
||||
name[cur] = v;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
cur = 0;
|
||||
}
|
||||
editNameCursorPos = cur;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, label);
|
||||
editName(x, y, name, size, event, active);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t s_currIdx;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuRadioSpecialFunctions(event_t event)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
|
@ -40,4 +39,3 @@ void menuRadioSpecialFunctions(event_t event)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -63,7 +63,6 @@ void pushMenu(MenuHandlerFunc newMenu)
|
|||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuModelNotes(event_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
|
@ -79,4 +78,3 @@ void pushModelNotes()
|
|||
{
|
||||
pushMenu(menuModelNotes);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -41,9 +41,7 @@ typedef uint8_t vertpos_t;
|
|||
|
||||
typedef void (*MenuHandlerFunc)(event_t event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
|
|
|
@ -31,29 +31,6 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
|
|||
} while (p!=0);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
drawFieldLabel(x, y, STR_FLMODE);
|
||||
|
||||
uint8_t posHorz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
lcdDrawChar(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
|
||||
x += FW;
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) {
|
||||
s_editMode = 0;
|
||||
value ^= (1<<posHorz);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum MenuModelFlightModeItems {
|
||||
ITEM_MODEL_FLIGHT_MODE_NAME,
|
||||
|
@ -69,12 +46,10 @@ enum MenuModelFlightModeItems {
|
|||
ITEM_MODEL_FLIGHT_MODE_GV3,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV4,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV5,
|
||||
#if defined(CPUARM)
|
||||
ITEM_MODEL_FLIGHT_MODE_GV6,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV7,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV8,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV9,
|
||||
#endif
|
||||
#endif
|
||||
ITEM_MODEL_FLIGHT_MODE_MAX
|
||||
};
|
||||
|
@ -137,7 +112,6 @@ void menuModelFlightModeOne(event_t event)
|
|||
|
||||
case ITEM_MODEL_FLIGHT_MODE_TRIMS:
|
||||
lcdDrawTextAlignedLeft(y, STR_TRIMS);
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t t = 0; t < NUM_STICKS; t++) {
|
||||
drawTrimMode(MIXES_2ND_COLUMN + (t*2*FW), y, s_currIdx, t, menuHorizontalPosition == t ? attr : 0);
|
||||
if (s_editMode >= 0 && attr && menuHorizontalPosition == t) {
|
||||
|
@ -145,22 +119,6 @@ void menuModelFlightModeOne(event_t event)
|
|||
v.mode = checkIncDec(event, v.mode==TRIM_MODE_NONE ? -1 : v.mode, -1, k==0 ? 0 : 2*MAX_FLIGHT_MODES-1, EE_MODEL, isTrimModeAvailable);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (uint8_t t = 0; t < NUM_STICKS; t++) {
|
||||
drawTrimMode(MIXES_2ND_COLUMN + (t*FW), y, s_currIdx, t, menuHorizontalPosition == t ? attr : 0);
|
||||
if (attr && menuHorizontalPosition == t && ((editMode > 0) || p1valdiff)) {
|
||||
int16_t v = getRawTrimValue(s_currIdx, t);
|
||||
if (v < TRIM_EXTENDED_MAX)
|
||||
v = TRIM_EXTENDED_MAX;
|
||||
v = checkIncDec(event, v, TRIM_EXTENDED_MAX, TRIM_EXTENDED_MAX + MAX_FLIGHT_MODES - 1, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (v == TRIM_EXTENDED_MAX)
|
||||
v = 0;
|
||||
setTrimValue(s_currIdx, t, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if ROTARY_ENCODERS > 0
|
||||
|
@ -202,16 +160,12 @@ void menuModelFlightModeOne(event_t event)
|
|||
if (attr && posHorz > 0 && s_currIdx==0) posHorz++;
|
||||
|
||||
drawStringWithIndex(INDENT_WIDTH, y, STR_GV, idx+1, posHorz==0 ? attr : 0);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSizedText(4*FW, y,g_model.gvars[idx].name, LEN_GVAR_NAME, ZCHAR);
|
||||
if (attr && editMode>0 && posHorz==0) {
|
||||
s_currIdx = sub - ITEM_MODEL_FLIGHT_MODE_GV1;
|
||||
editMode = 0;
|
||||
pushMenu(menuModelGVarOne);
|
||||
}
|
||||
#else
|
||||
editName(4*FW, y, g_model.gvars[idx].name, LEN_GVAR_NAME, event, posHorz==0 ? attr : 0);
|
||||
#endif
|
||||
int16_t v = fm->gvars[idx];
|
||||
if (v > GVAR_MAX) {
|
||||
uint8_t p = v - GVAR_MAX - 1;
|
||||
|
@ -229,15 +183,7 @@ void menuModelFlightModeOne(event_t event)
|
|||
fm->gvars[idx] = v;
|
||||
}
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
editGVarValue(17*FW, y, event, idx, getGVarFlightMode(s_currIdx, idx), posHorz==2 ? attr : 0);
|
||||
#else
|
||||
uint8_t p = getGVarFlightMode(s_currIdx, idx);
|
||||
lcdDrawNumber(18*FW, y, GVAR_VALUE(idx, p), posHorz==2 ? attr : 0);
|
||||
if (attr && posHorz==2 && ((editMode>0) || p1valdiff)) {
|
||||
GVAR_VALUE(idx, p) = checkIncDec(event, GVAR_VALUE(idx, p), -500, 500, EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -293,12 +239,8 @@ void menuModelFlightModesAll(event_t event)
|
|||
|
||||
uint8_t att;
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
#if defined(CPUARM)
|
||||
int8_t y = 1 + (1+i-menuVerticalOffset)*FH;
|
||||
if (y<1*FH+1 || y>(LCD_LINES-1)*FH+1) continue;
|
||||
#else
|
||||
uint8_t y = 1 + (i+1)*FH;
|
||||
#endif
|
||||
att = (i==sub ? INVERS : 0);
|
||||
FlightModeData * p = flightModeAddress(i);
|
||||
drawFlightMode(0, y, i+1, att|(getFlightMode()==i ? BOLD : 0));
|
||||
|
@ -327,11 +269,6 @@ void menuModelFlightModesAll(event_t event)
|
|||
for (uint8_t t=0; t<NUM_STICKS; t++) {
|
||||
drawShortTrimMode((9+LEN_FLIGHT_MODE_NAME+t)*FW+TRIMS_OFS, y, i, t, 0);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUM2560)
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode((13+LEN_FLIGHT_MODE_NAME+t)*FW+TRIMS_OFS+ROTARY_ENC_OFS, y, i, t, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -340,9 +277,7 @@ void menuModelFlightModesAll(event_t event)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
|
||||
#endif
|
||||
|
||||
lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
|
||||
drawFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
|
||||
|
|
|
@ -243,11 +243,9 @@ void menuModelExpoOne(event_t event)
|
|||
for (uint8_t i=0; i<EXPO_FIELD_MAX+1; i++) {
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch (i) {
|
||||
#if defined(CPUARM)
|
||||
case EXPO_FIELD_NAME:
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN-sizeof(ed->name)*FW, y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EXPO_FIELD_WEIGHT:
|
||||
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
|
||||
|
@ -309,13 +307,8 @@ void menuModelExpoOne(event_t event)
|
|||
int16_t y512 = expoFn(x512);
|
||||
lcdDrawNumber(LCD_W-8-6*FW, 1*FH, calcRESXto100(y512), 0);
|
||||
|
||||
#if defined(CPUARM)
|
||||
x512 = CURVE_CENTER_X+x512/(RESX/CURVE_SIDE_WIDTH);
|
||||
y512 = (LCD_H-1) - ((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#else
|
||||
x512 = CURVE_CENTER_X+x512/(RESXu/CURVE_SIDE_WIDTH);
|
||||
y512 = (LCD_H-1) - (uint16_t)((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#endif
|
||||
|
||||
lcdDrawSolidVerticalLine(x512, y512-3, 3*2+1);
|
||||
lcdDrawSolidHorizontalLine(x512-3, y512, 3*2+1);
|
||||
|
@ -339,7 +332,6 @@ enum MixFields {
|
|||
MIX_FIELD_COUNT
|
||||
};
|
||||
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
#define GAUGE_WIDTH 33
|
||||
#define GAUGE_HEIGHT 6
|
||||
void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
|
@ -349,13 +341,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
|||
int barMin = offset - weight;
|
||||
int barMax = offset + weight;
|
||||
if (y > 15) {
|
||||
#if defined(CPUARM)
|
||||
lcdDrawNumber(x-((barMin >= 0) ? 2 : 3), y-6, barMin, TINSIZE|LEFT);
|
||||
lcdDrawNumber(x+GAUGE_WIDTH+1, y-6, barMax, TINSIZE);
|
||||
#else
|
||||
lcdDrawNumber(x-((barMin >= 0) ? 2 : 3), y-8, barMin, LEFT);
|
||||
lcdDrawNumber(x+GAUGE_WIDTH+1, y-8, barMax);
|
||||
#endif
|
||||
}
|
||||
if (weight < 0) {
|
||||
barMin = -barMin;
|
||||
|
@ -390,7 +377,6 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
|||
}
|
||||
#undef GAUGE_WIDTH
|
||||
#undef GAUGE_HEIGHT
|
||||
#endif
|
||||
|
||||
void menuModelMixOne(event_t event)
|
||||
{
|
||||
|
@ -420,11 +406,9 @@ void menuModelMixOne(event_t event)
|
|||
|
||||
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch (i) {
|
||||
#if defined(CPUARM)
|
||||
case MIX_FIELD_NAME:
|
||||
editSingleName(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXNAME, md2->name, sizeof(md2->name), event, attr);
|
||||
break;
|
||||
#endif
|
||||
case MIX_FIELD_SOURCE:
|
||||
drawFieldLabel(COLUMN_X, y, NO_INDENT(STR_SOURCE));
|
||||
drawSource(COLUMN_X+MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr);
|
||||
|
@ -441,9 +425,7 @@ void menuModelMixOne(event_t event)
|
|||
MD_OFFSET_TO_UNION(md2, offset);
|
||||
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
|
||||
MD_UNION_TO_OFFSET(offset, md2);
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
drawOffsetBar(COLUMN_X+MIXES_2ND_COLUMN+22, y, md2);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -537,7 +519,6 @@ void menuModelMixOne(event_t event)
|
|||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EXPO_LINE_WEIGHT_POS 7*FW+1
|
||||
#define EXPO_LINE_EXPO_POS 10*FW+5
|
||||
#define EXPO_LINE_SWITCH_POS 11*FW+2
|
||||
|
@ -550,23 +531,6 @@ void menuModelMixOne(event_t event)
|
|||
#define MIX_LINE_CURVE_POS 12*FW+2
|
||||
#define MIX_LINE_SWITCH_POS 16*FW
|
||||
#define MIX_LINE_DELAY_POS 19*FW+7
|
||||
#else
|
||||
#define EXPO_LINE_WEIGHT_POS 7*FW+1
|
||||
#define EXPO_LINE_EXPO_POS 11*FW
|
||||
#define EXPO_LINE_SWITCH_POS 11*FW+4
|
||||
#if MAX_FLIGHT_MODES == 6
|
||||
#define EXPO_LINE_SIDE_POS 15*FW
|
||||
#else
|
||||
#define EXPO_LINE_SIDE_POS 15*FW+2
|
||||
#endif
|
||||
#define EXPO_LINE_FM_POS LCD_W-FW
|
||||
#define EXPO_LINE_SELECT_POS 24
|
||||
#define MIX_LINE_SRC_POS 4*FW-1
|
||||
#define MIX_LINE_WEIGHT_POS 11*FW+3
|
||||
#define MIX_LINE_CURVE_POS 12*FW+2
|
||||
#define MIX_LINE_SWITCH_POS 16*FW
|
||||
#define MIX_LINE_DELAY_POS 19*FW+7
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onExpoMixMenu(const char *result)
|
||||
|
@ -611,7 +575,6 @@ void displayMixInfos(coord_t y, MixData *md)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void displayMixLine(coord_t y, MixData * md)
|
||||
{
|
||||
if (md->name[0]) {
|
||||
|
@ -621,9 +584,6 @@ void displayMixLine(coord_t y, MixData * md)
|
|||
displayMixInfos(y, md);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define displayMixLine(y, md) displayMixInfos(y, md)
|
||||
#endif
|
||||
|
||||
void displayExpoInfos(coord_t y, ExpoData *ed)
|
||||
{
|
||||
|
@ -635,7 +595,6 @@ void displayExpoInfos(coord_t y, ExpoData *ed)
|
|||
drawSwitch(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
{
|
||||
displayExpoInfos(y, ed);
|
||||
|
@ -644,11 +603,6 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
|||
lcdDrawSizedText(EXPO_LINE_NAME_POS, y, ed->name, sizeof(ed->name), ZCHAR);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define displayExpoLine(y, ed) \
|
||||
displayExpoInfos(y, ed); \
|
||||
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes)
|
||||
#endif
|
||||
|
||||
void menuModelExpoMix(uint8_t expo, event_t event)
|
||||
{
|
||||
|
|
|
@ -25,10 +25,8 @@ enum LogicalSwitchFields {
|
|||
LS_FIELD_V1,
|
||||
LS_FIELD_V2,
|
||||
LS_FIELD_ANDSW,
|
||||
#if defined(CPUARM)
|
||||
LS_FIELD_DURATION,
|
||||
LS_FIELD_DELAY,
|
||||
#endif
|
||||
LS_FIELD_COUNT,
|
||||
LS_FIELD_LAST = LS_FIELD_COUNT-1
|
||||
};
|
||||
|
@ -38,7 +36,6 @@ enum LogicalSwitchFields {
|
|||
#define CSW_3RD_COLUMN (13*FW-6)
|
||||
#define CSW_4TH_COLUMN (18*FW+2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lattr, uint8_t rattr)
|
||||
{
|
||||
lcdDrawChar(x-4, y, '[');
|
||||
|
@ -166,11 +163,7 @@ void menuModelLogicalSwitchOne(event_t event)
|
|||
else if (cs->func == LS_FUNC_ADIFFEGREATER)
|
||||
v2_min = 0;
|
||||
else
|
||||
#if defined(CPUARM)
|
||||
v2_min = -v2_max;
|
||||
#else
|
||||
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
#endif
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
|
||||
if (cs->v2 < v2_min || cs->v2 > v2_max) {
|
||||
cs->v2 = 0;
|
||||
|
@ -332,149 +325,3 @@ void menuModelLogicalSwitches(event_t event)
|
|||
}
|
||||
}
|
||||
|
||||
#else // CPUARM
|
||||
|
||||
void menuModelLogicalSwitches(event_t event)
|
||||
{
|
||||
INCDEC_DECLARE_VARS(EE_MODEL);
|
||||
|
||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES, { HEADER_LINE_COLUMNS NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
|
||||
|
||||
uint8_t k = 0;
|
||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
horzpos_t horz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
k = i+menuVerticalOffset;
|
||||
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t attr1 = (horz==1 ? attr : 0);
|
||||
uint8_t attr2 = (horz==2 ? attr : 0);
|
||||
LogicalSwitchData * cs = lswAddress(k);
|
||||
|
||||
// CSW name
|
||||
uint8_t sw = SWSRC_SW1+k;
|
||||
drawSwitch(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
|
||||
// CSW func
|
||||
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
||||
|
||||
// CSW params
|
||||
uint8_t cstate = lswFamily(cs->func);
|
||||
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
#define v1_val cs->v1
|
||||
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||
v1_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v1_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
v2_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v2_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_COMP) {
|
||||
drawSource(CSW_2ND_COLUMN, y, v1_val, attr1);
|
||||
drawSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcdDrawNumber(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr1);
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||
v1_min = v2_min = -128;
|
||||
v1_max = v2_max = 122;
|
||||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
else {
|
||||
drawSource(CSW_2ND_COLUMN, y, v1_val, attr1);
|
||||
if (horz == 1) {
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailableInCustomSwitches);
|
||||
}
|
||||
else {
|
||||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
drawTelemetryValue(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT|attr2);
|
||||
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
if (cstate == LS_FAMILY_OFS) {
|
||||
v2_min = -128;
|
||||
v2_max -= 128;
|
||||
}
|
||||
else {
|
||||
v2_max = min((uint8_t)127, (uint8_t)v2_max);
|
||||
v2_min = -v2_max;
|
||||
}
|
||||
if (cs->v2 > v2_max) {
|
||||
cs->v2 = v2_max;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
|
||||
#if defined(CPUARM) && defined(GVARS)
|
||||
if (v1_val >= MIXSRC_GVAR1) {
|
||||
v2_min = -1024; v2_max = +1024;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
}
|
||||
#else // TELEMETRY_FRSKY
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
drawTelemetryValue(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT|attr2);
|
||||
v2_min = -128; v2_max = 127;
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
#endif // TELEMETRY_FRSKY
|
||||
}
|
||||
|
||||
// CSW AND switch
|
||||
uint8_t andsw = cs->andsw;
|
||||
if (andsw > SWSRC_LAST_SWITCH) {
|
||||
andsw += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
||||
}
|
||||
drawSwitch(CSW_4TH_COLUMN, y, andsw, horz==LS_FIELD_ANDSW ? attr : 0);
|
||||
if ((s_editMode>0 || p1valdiff) && attr) {
|
||||
switch (horz) {
|
||||
case LS_FIELD_FUNCTION:
|
||||
{
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, LS_FUNC_MAX);
|
||||
uint8_t new_cstate = lswFamily(cs->func);
|
||||
if (cstate != new_cstate) {
|
||||
#if defined(CPUARM)
|
||||
unsigned int save_func = cs->func;
|
||||
memset(cs, 0, sizeof(LogicalSwitchData));
|
||||
cs->func = save_func;
|
||||
#else
|
||||
cs->v1 = cs->v2 = 0;
|
||||
cs->andsw = 0;
|
||||
#endif
|
||||
if (new_cstate == LS_FAMILY_TIMER) {
|
||||
cs->v1 = cs->v2 = -119; // 1.0
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LS_FIELD_V1:
|
||||
cs->v1 = CHECK_INCDEC_PARAM(event, v1_val, v1_min, v1_max);
|
||||
break;
|
||||
case LS_FIELD_V2:
|
||||
cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max);
|
||||
break;
|
||||
case LS_FIELD_ANDSW:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_LS_ANDSW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CPUARM
|
||||
|
|
|
@ -54,13 +54,7 @@ void onModelSelectMenu(const char * result)
|
|||
#endif
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
#if defined(CPUARM)
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.mainname;
|
||||
eeLoadModelName(sub, name);
|
||||
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
|
||||
#endif
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else {
|
||||
|
@ -79,9 +73,7 @@ void menuModelSelect(event_t event)
|
|||
{
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
#if defined(CPUARM)
|
||||
storageCheck(true);
|
||||
#endif
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
|
@ -105,11 +97,6 @@ void menuModelSelect(event_t event)
|
|||
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (event) {
|
||||
eeFlush(); // flush eeprom write
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
|
@ -120,22 +107,13 @@ void menuModelSelect(event_t event)
|
|||
menuVerticalOffset = sub-(NUM_BODY_LINES-1);
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
#if !defined(CPUARM)
|
||||
storageCheck(true);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
#if defined(CPUARM)
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.mainname;
|
||||
eeLoadModelName(sub, name);
|
||||
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
s_copyMode = 0;
|
||||
|
@ -367,14 +345,7 @@ void menuModelSelect(event_t event)
|
|||
k %= MAX_MODELS;
|
||||
|
||||
if (eeModelExists(k)) {
|
||||
#if defined(CPUARM)
|
||||
putsModelName(4*FW, y, modelHeaders[k].name, k, 0);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.listnames[i];
|
||||
if (event) eeLoadModelName(k, name);
|
||||
putsModelName(4*FW, y, name, k, 0);
|
||||
lcdDrawNumber(20*FW, y, eeModelSize(k), RIGHT);
|
||||
#endif
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub)) {
|
||||
lcdDrawChar(1, y, '*');
|
||||
}
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t g_moduleIdx;
|
||||
void menuModelFailsafe(event_t event);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t getSwitchWarningsCount()
|
||||
|
@ -82,7 +80,6 @@ enum MenuModelSetupItems {
|
|||
ITEM_MODEL_INTERNAL_MODULE_ANTENNA,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
ITEM_MODEL_EXTERNAL_MODULE_LABEL,
|
||||
ITEM_MODEL_EXTERNAL_MODULE_MODE,
|
||||
#if defined(MULTIMODULE)
|
||||
|
@ -106,10 +103,6 @@ enum MenuModelSetupItems {
|
|||
ITEM_MODEL_EXTRA_MODULE_CHANNELS,
|
||||
ITEM_MODEL_EXTRA_MODULE_BIND,
|
||||
#endif
|
||||
#else
|
||||
ITEM_MODEL_PPM1_PROTOCOL,
|
||||
ITEM_MODEL_PPM1_PARAMS,
|
||||
#endif
|
||||
#if defined(PCBX7)
|
||||
ITEM_MODEL_TRAINER_LABEL,
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
|
@ -146,7 +139,6 @@ enum MenuModelSetupItems {
|
|||
#define CURRENT_MODULE_EDITED(k) (EXTERNAL_MODULE)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBXLITE)
|
||||
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount()), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW) // X-Lite needs an additional column for full line selection (<])
|
||||
#else
|
||||
|
@ -205,16 +197,6 @@ enum MenuModelSetupItems {
|
|||
#define TRAINER_ROWS
|
||||
#endif
|
||||
|
||||
#elif defined(CPUM64)
|
||||
#define CURSOR_ON_CELL (true)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#elif defined(PCBXLITE)
|
||||
#define CURSOR_ON_CELL (menuHorizontalPosition >= 0)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#else
|
||||
#define CURSOR_ON_CELL (true)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void onBindMenu(const char * result)
|
||||
|
@ -296,7 +278,7 @@ void menuModelSetup(event_t event)
|
|||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
TRAINER_ROWS });
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0,
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROWS,
|
||||
|
@ -311,12 +293,6 @@ void menuModelSetup(event_t event)
|
|||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
TRAINER_ROWS });
|
||||
#elif defined(CPUM64)
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
|
||||
#else
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) });
|
||||
#endif
|
||||
|
||||
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE+MODEL_SETUP_MAX_LINES);
|
||||
|
@ -332,11 +308,9 @@ void menuModelSetup(event_t event)
|
|||
|
||||
TITLE(STR_MENUSETUP);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
int8_t editMode = s_editMode;
|
||||
|
@ -344,7 +318,6 @@ void menuModelSetup(event_t event)
|
|||
for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
if (++k >= (int)DIM(mstate_tab)) {
|
||||
|
@ -352,7 +325,6 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LcdFlags blink = ((editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
@ -360,12 +332,9 @@ void menuModelSetup(event_t event)
|
|||
switch (k) {
|
||||
case ITEM_MODEL_NAME:
|
||||
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_MODELNAME, g_model.header.name, sizeof(g_model.header.name), event, attr);
|
||||
#if defined(CPUARM)
|
||||
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_TIMER1:
|
||||
case ITEM_MODEL_TIMER2:
|
||||
case ITEM_MODEL_TIMER3:
|
||||
|
@ -447,69 +416,12 @@ void menuModelSetup(event_t event)
|
|||
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
|
||||
break;
|
||||
}
|
||||
#else // AVR
|
||||
case ITEM_MODEL_TIMER1:
|
||||
case ITEM_MODEL_TIMER2:
|
||||
case ITEM_MODEL_TIMER1_MINUTE_BEEP:
|
||||
case ITEM_MODEL_TIMER2_MINUTE_BEEP:
|
||||
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
|
||||
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
|
||||
{
|
||||
TimerData *timer = &g_model.timers[k>=ITEM_MODEL_TIMER2 ? 1 : 0];
|
||||
if (k==ITEM_MODEL_TIMER1_MINUTE_BEEP || k==ITEM_MODEL_TIMER2_MINUTE_BEEP) {
|
||||
timer->minuteBeep = editCheckBox(timer->minuteBeep, MODEL_SETUP_2ND_COLUMN, y, STR_MINUTEBEEP, attr, event);
|
||||
}
|
||||
else if (k==ITEM_MODEL_TIMER1_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER2_COUNTDOWN_BEEP) {
|
||||
timer->countdownBeep = editCheckBox(timer->countdownBeep, MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, attr, event);
|
||||
}
|
||||
else {
|
||||
drawStringWithIndex(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
|
||||
drawTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
|
||||
drawTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timer->mode, SWSRC_FIRST, TMRMODE_COUNT+SWSRC_LAST-1/*SWSRC_None removed*/, isSwitchAvailableInTimers);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
|
||||
timer->start = qr.rem + qr.quot*60;
|
||||
break;
|
||||
case 2:
|
||||
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62) - 2;
|
||||
if ((int16_t)timer->start >= qr.rem) {
|
||||
timer->start -= qr.rem ;
|
||||
}
|
||||
if ((int16_t)timer->start > 3599) {
|
||||
timer->start = 3599; // 59:59
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUM2560)
|
||||
case ITEM_MODEL_TIMER1_PERSISTENT:
|
||||
case ITEM_MODEL_TIMER2_PERSISTENT:
|
||||
{
|
||||
TimerData &timer = g_model.timers[k==ITEM_MODEL_TIMER2_PERSISTENT];
|
||||
timer.persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_EXTENDED_LIMITS:
|
||||
ON_OFF_MENU_ITEM(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_EXTENDED_TRIMS:
|
||||
#if defined(CPUM64)
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, attr, event);
|
||||
#else
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
|
@ -523,14 +435,11 @@ void menuModelSetup(event_t event)
|
|||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_DISPLAY_TRIMS:
|
||||
g_model.displayTrims = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_TRIM_INC:
|
||||
g_model.trimInc = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
|
||||
|
@ -557,7 +466,6 @@ void menuModelSetup(event_t event)
|
|||
ON_OFF_MENU_ITEM(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_PREFLIGHT_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_PREFLIGHT);
|
||||
break;
|
||||
|
@ -565,7 +473,6 @@ void menuModelSetup(event_t event)
|
|||
case ITEM_MODEL_CHECKLIST_DISPLAY:
|
||||
ON_OFF_MENU_ITEM(g_model.displayChecklist, MODEL_SETUP_2ND_COLUMN, y, STR_CHECKLIST, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_THROTTLE_WARNING:
|
||||
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLEWARNING, attr, event);
|
||||
|
@ -667,24 +574,13 @@ void menuModelSetup(event_t event)
|
|||
switch (event) {
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (menuHorizontalPosition < NUM_SWITCHES-1) {
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (menuHorizontalPosition == NUM_SWITCHES-1) {
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
|
@ -692,7 +588,6 @@ void menuModelSetup(event_t event)
|
|||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
|
@ -717,14 +612,8 @@ void menuModelSetup(event_t event)
|
|||
if (line && (menuHorizontalPosition == i)) {
|
||||
attr = BLINK | INVERS;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive) ? c : '-', attr);
|
||||
#else
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
|
||||
#endif
|
||||
#if !defined(CPUM64)
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? line : 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -796,13 +685,11 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
|
||||
lcdDrawTextAlignedLeft(y, STR_USE_GLOBAL_FUNCS);
|
||||
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
|
||||
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_INTERNAL_MODULE_LABEL:
|
||||
|
@ -831,7 +718,6 @@ void menuModelSetup(event_t event)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, TR_EXTERNALRF);
|
||||
break;
|
||||
|
@ -903,7 +789,6 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_SUBTYPE:
|
||||
|
@ -1014,7 +899,6 @@ void menuModelSetup(event_t event)
|
|||
#if defined(PCBSKY9X)
|
||||
case ITEM_MODEL_EXTRA_MODULE_CHANNELS:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
|
@ -1041,7 +925,6 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
case ITEM_MODEL_TRAINER_PARAMS:
|
||||
|
@ -1052,7 +935,6 @@ void menuModelSetup(event_t event)
|
|||
#if defined(PCBSKY9X)
|
||||
case ITEM_MODEL_EXTRA_MODULE_BIND:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
|
@ -1206,7 +1088,6 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && defined(REVX)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_OUTPUT_TYPE:
|
||||
|
@ -1221,7 +1102,6 @@ void menuModelSetup(event_t event)
|
|||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_INTERNAL_MODULE_FAILSAFE:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE: {
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
ModuleData &moduleData = g_model.moduleData[moduleIdx];
|
||||
|
@ -1385,31 +1265,7 @@ void menuModelSetup(event_t event)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_MODEL_PPM1_PROTOCOL:
|
||||
lcdDrawTextAlignedLeft(y, NO_INDENT(STR_PROTO));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, menuHorizontalPosition<=0 ? attr : 0);
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, menuHorizontalPosition!=0 ? attr : 0);
|
||||
}
|
||||
else if (menuHorizontalPosition>0 && attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && (editMode>0 || p1valdiff || (!IS_PPM_PROTOCOL(protocol) && !IS_DSM2_PROTOCOL(protocol)))) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.protocol, PROTO_MAX-1);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4);
|
||||
g_model.ppmFrameLength = g_model.ppmNCH * 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
case ITEM_MODEL_PPM2_PROTOCOL:
|
||||
|
@ -1456,60 +1312,6 @@ void menuModelSetup(event_t event)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_MODEL_PPM1_PARAMS:
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.pulsePol, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
else if (IS_DSM2_PROTOCOL(protocol) || IS_PXX_PROTOCOL(protocol)) {
|
||||
if (attr && menuHorizontalPosition > 1) {
|
||||
REPEAT_LAST_CURSOR_MOVE(); // limit 3 column row to 2 colums (Rx_Num and RANGE fields)
|
||||
}
|
||||
lcdDrawTextAlignedLeft(y, STR_RECEIVER_NUM);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (menuHorizontalPosition<=0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && (menuHorizontalPosition==0 && (editMode>0 || p1valdiff))) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[0], 99);
|
||||
}
|
||||
#if defined(PXX)
|
||||
if (protocol == PROTO_PXX) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_SYNCMENU, menuHorizontalPosition!=0 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
if (attr && menuHorizontalPosition>0 && editMode>0) {
|
||||
// send reset code
|
||||
newFlag = MODULE_BIND;
|
||||
}
|
||||
moduleFlag[0] = newFlag;
|
||||
}
|
||||
#endif
|
||||
#if defined(DSM2)
|
||||
if (IS_DSM2_PROTOCOL(protocol)) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_MODULE_RANGE, menuHorizontalPosition!=0 ? attr : 0);
|
||||
moduleFlag[0] = (attr && menuHorizontalPosition>0 && editMode>0) ? MODULE_RANGECHECK : 0; // [MENU] key toggles range check mode
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1535,17 +1337,14 @@ void menuModelSetup(event_t event)
|
|||
checkModelIdUnique(g_eeGeneral.currModel, EXTRA_MODULE);
|
||||
break;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
if (menuHorizontalPosition == 0)
|
||||
checkModelIdUnique(g_eeGeneral.currModel, EXTERNAL_MODULE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
|
@ -1660,4 +1459,3 @@ void menuModelFailsafe(event_t event)
|
|||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -145,11 +145,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
{
|
||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
#elif !defined(CPUM64) || defined(AUTOSWITCH)
|
||||
uint8_t eeFlags = EE_MODEL;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE)
|
||||
|
@ -193,7 +189,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
switch (j) {
|
||||
case 0:
|
||||
#if defined(CPUARM)
|
||||
if (sub==k && menuHorizontalPosition < 1 && CFN_SWITCH(cfn) == SWSRC_NONE) {
|
||||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | INVERS | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
|
@ -202,26 +197,16 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
}
|
||||
#else
|
||||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
#endif //CPUARM
|
||||
#if defined(CPUARM)
|
||||
if (func == FUNC_OVERRIDE_CHANNEL && functions != g_model.customFn) {
|
||||
func = CFN_FUNC(cfn) = func+1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (CFN_SWITCH(cfn)) {
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_2ND_COLUMN, y, STR_VFSWFUNC, func, attr);
|
||||
if (active) {
|
||||
#if defined(CPUARM)
|
||||
CFN_FUNC(cfn) = checkIncDec(event, CFN_FUNC(cfn), 0, FUNC_MAX-1, eeFlags, isAssignableFunctionAvailable);
|
||||
#else
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, CFN_FUNC(cfn), FUNC_MAX-1);
|
||||
#endif
|
||||
if (checkIncDec_Ret) CFN_RESET(cfn);
|
||||
}
|
||||
}
|
||||
|
@ -244,32 +229,22 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
#endif
|
||||
if (func == FUNC_TRAINER) {
|
||||
maxParam = 4;
|
||||
#if defined(CPUARM)
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
|
||||
#else
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
|
||||
#endif
|
||||
}
|
||||
#if defined(GVARS)
|
||||
else if (func == FUNC_ADJUST_GVAR) {
|
||||
maxParam = MAX_GVARS-1;
|
||||
drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_GVAR_INDEX(cfn), maxParam);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif // GVARS
|
||||
#if defined(CPUARM)
|
||||
else if (func == FUNC_SET_TIMER) {
|
||||
maxParam = MAX_TIMERS-1;
|
||||
lcdDrawTextAtIndex(lcdNextPos, y, STR_VFSWRESET, CFN_TIMER_INDEX(cfn), attr);
|
||||
if (active) CFN_TIMER_INDEX(cfn) = checkIncDec(event, CFN_TIMER_INDEX(cfn), 0, maxParam, eeFlags);
|
||||
break;
|
||||
}
|
||||
#endif // CPUARM
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
|
@ -281,15 +256,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
{
|
||||
INCDEC_DECLARE_VARS(eeFlags);
|
||||
int16_t val_displayed = CFN_PARAM(cfn);
|
||||
#if defined(CPUARM)
|
||||
int16_t val_min = 0;
|
||||
int16_t val_max = 255;
|
||||
#else
|
||||
int8_t val_min = 0;
|
||||
uint8_t val_max = 255;
|
||||
#endif
|
||||
if (func == FUNC_RESET) {
|
||||
#if defined (CPUARM)
|
||||
val_max = FUNC_RESET_PARAM_FIRST_TELEM+lastUsedTelemetryIndex();
|
||||
int param = CFN_PARAM(cfn);
|
||||
if (param < FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
|
@ -300,23 +269,13 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
lcdDrawSizedText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, sensor->label, TELEM_LABEL_LEN, attr|ZCHAR);
|
||||
}
|
||||
if (active) INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction);
|
||||
#else
|
||||
val_max = FUNC_RESET_PARAM_LAST;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_VFSWRESET, CFN_PARAM(cfn), attr);
|
||||
#endif // CPUARM
|
||||
}
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
|
||||
#else
|
||||
val_displayed = (int8_t)CFN_PARAM(cfn);
|
||||
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
|
||||
#endif
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif // OVERRIDE_CHANNEL_FUNCTION
|
||||
#if defined(CPUARM)
|
||||
else if (func >= FUNC_SET_FAILSAFE && func <= FUNC_BIND) {
|
||||
val_max = NUM_MODULES-1;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "\004Int.Ext.", CFN_PARAM(cfn), attr);
|
||||
|
@ -325,7 +284,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
getMixSrcRange(MIXSRC_FIRST_TIMER, val_min, val_max);
|
||||
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
|
||||
}
|
||||
#endif
|
||||
#if defined(AUDIO)
|
||||
else if (func == FUNC_PLAY_SOUND) {
|
||||
val_max = AU_SPECIAL_SOUND_LAST-AU_SPECIAL_SOUND_FIRST-1;
|
||||
|
@ -373,7 +331,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
}
|
||||
}
|
||||
#endif // CPUARM && SDCARD
|
||||
#if defined(CPUARM)
|
||||
else if (func == FUNC_VOLUME) {
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
|
@ -382,36 +339,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
}
|
||||
#elif defined(VOICE)
|
||||
else if (func == FUNC_PLAY_TRACK) {
|
||||
#if defined(GVARS)
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
s_editMode = !s_editMode;
|
||||
active = true;
|
||||
val_displayed = (val_displayed > 250 ? 0 : 251);
|
||||
}
|
||||
if (val_displayed > 250) {
|
||||
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed-250, attr);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
|
||||
}
|
||||
#else
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
|
||||
#endif // GVARS
|
||||
}
|
||||
else if (func == FUNC_PLAY_BOTH) {
|
||||
lcdDrawChar(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr);
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT);
|
||||
}
|
||||
else if (func == FUNC_PLAY_VALUE) {
|
||||
val_max = MIXSRC_FIRST_TELEM + TELEM_DISPLAY_MAX - 1;
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
|
||||
}
|
||||
#endif // CPUARM
|
||||
#if defined(SDCARD)
|
||||
else if (func == FUNC_LOGS) {
|
||||
if (val_displayed) {
|
||||
|
@ -428,13 +355,8 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
switch (CFN_GVAR_MODE(cfn)) {
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
val_displayed = (int16_t)CFN_PARAM(cfn);
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
|
||||
drawGVarValue(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_GVAR_INDEX(cfn), val_displayed, attr|LEFT);
|
||||
#else
|
||||
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
#endif // CPUARM
|
||||
break;
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
|
@ -449,14 +371,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
|
||||
break;
|
||||
default: // FUNC_ADJUST_GVAR_INC
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
|
||||
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, (val_displayed < 0 ? "-= " : "+= "), attr);
|
||||
drawGVarValue(lcdNextPos, y, CFN_GVAR_INDEX(cfn), abs(val_displayed), attr|LEFT);
|
||||
#else
|
||||
val_max = 1;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
|
||||
#endif // CPUARM
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -465,9 +382,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
s_editMode = !s_editMode;
|
||||
active = true;
|
||||
CFN_GVAR_MODE(cfn) += 1;
|
||||
#if defined(CPUARM)
|
||||
CFN_GVAR_MODE(cfn) &= 0x03;
|
||||
#endif
|
||||
val_displayed = 0;
|
||||
}
|
||||
}
|
||||
|
@ -502,29 +417,19 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
|||
case 4:
|
||||
if (HAS_ENABLE_PARAM(func)) {
|
||||
drawCheckBox(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_ACTIVE(cfn) = checkIncDec(event, CFN_ACTIVE(cfn), 0, 1, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_ACTIVE(cfn), 1);
|
||||
#endif
|
||||
}
|
||||
else if (HAS_REPEAT_PARAM(func)) {
|
||||
if (CFN_PLAY_REPEAT(cfn) == 0) {
|
||||
lcdDrawChar(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
|
||||
lcdDrawText(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+1, y, "!-", attr);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, RIGHT | attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_PLAY_REPEAT(cfn), 60/CFN_PLAY_REPEAT_MUL);
|
||||
#endif
|
||||
}
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
|
|
|
@ -24,23 +24,10 @@ enum MenuModelTelemetryFrskyItems {
|
|||
CASE_CPUARM(ITEM_TELEMETRY_PROTOCOL_TYPE)
|
||||
#if defined(REVX)
|
||||
ITEM_TELEMETRY_INVERTED_SERIAL,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
ITEM_TELEMETRY_A1_LABEL,
|
||||
ITEM_TELEMETRY_A1_RANGE,
|
||||
ITEM_TELEMETRY_A1_OFFSET,
|
||||
ITEM_TELEMETRY_A1_ALARM1,
|
||||
ITEM_TELEMETRY_A1_ALARM2,
|
||||
ITEM_TELEMETRY_A2_LABEL,
|
||||
ITEM_TELEMETRY_A2_RANGE,
|
||||
ITEM_TELEMETRY_A2_OFFSET,
|
||||
ITEM_TELEMETRY_A2_ALARM1,
|
||||
ITEM_TELEMETRY_A2_ALARM2,
|
||||
#endif
|
||||
ITEM_TELEMETRY_RSSI_LABEL,
|
||||
ITEM_TELEMETRY_RSSI_ALARM1,
|
||||
ITEM_TELEMETRY_RSSI_ALARM2,
|
||||
#if defined(CPUARM)
|
||||
ITEM_TELEMETRY_DISABLE_ALARMS,
|
||||
ITEM_TELEMETRY_SENSORS_LABEL,
|
||||
ITEM_TELEMETRY_SENSOR1,
|
||||
|
@ -79,37 +66,11 @@ enum MenuModelTelemetryFrskyItems {
|
|||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
ITEM_TELEMETRY_USR_LABEL,
|
||||
ITEM_TELEMETRY_USR_PROTO,
|
||||
ITEM_TELEMETRY_USR_BLADES,
|
||||
#endif
|
||||
ITEM_TELEMETRY_USR_VOLTAGE_SOURCE,
|
||||
ITEM_TELEMETRY_USR_CURRENT_SOURCE,
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
ITEM_TELEMETRY_FAS_OFFSET,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(VARIO)
|
||||
ITEM_TELEMETRY_VARIO_LABEL,
|
||||
ITEM_TELEMETRY_VARIO_SOURCE,
|
||||
ITEM_TELEMETRY_VARIO_RANGE,
|
||||
ITEM_TELEMETRY_VARIO_CENTER,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
// TODO check the cost of moving them to a new screen on the 9X
|
||||
ITEM_TELEMETRY_SCREEN_LABEL1,
|
||||
ITEM_TELEMETRY_SCREEN_LINE1,
|
||||
ITEM_TELEMETRY_SCREEN_LINE2,
|
||||
ITEM_TELEMETRY_SCREEN_LINE3,
|
||||
ITEM_TELEMETRY_SCREEN_LINE4,
|
||||
ITEM_TELEMETRY_SCREEN_LABEL2,
|
||||
ITEM_TELEMETRY_SCREEN_LINE5,
|
||||
ITEM_TELEMETRY_SCREEN_LINE6,
|
||||
ITEM_TELEMETRY_SCREEN_LINE7,
|
||||
ITEM_TELEMETRY_SCREEN_LINE8,
|
||||
#endif
|
||||
ITEM_TELEMETRY_MAX
|
||||
};
|
||||
|
@ -127,75 +88,36 @@ enum MenuModelTelemetryFrskyItems {
|
|||
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHANNELS_ROWS
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
|
||||
#else
|
||||
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
|
||||
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
|
||||
#define SENSORS_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#else
|
||||
#define IF_FAS_OFFSET(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define USRDATA_ROWS
|
||||
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
|
||||
#else
|
||||
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 1,
|
||||
#else
|
||||
#define RSSI_ROWS LABEL(RSSI), 1, 1,
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(GAUGES)
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#else
|
||||
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define VARIO_ROWS 1,
|
||||
#elif defined(CPUARM)
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#else
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 1,
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (PCBTARANIS)
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (! IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#elif defined (CPUARM)
|
||||
#else
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(REVX)
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY, TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_SCREENS_ROWS
|
||||
#else
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
|
||||
#define TELEMETRY_CURRENT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
|
||||
#define TELEMETRY_SCREENS_ROWS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum SensorFields {
|
||||
SENSOR_FIELD_NAME,
|
||||
SENSOR_FIELD_TYPE,
|
||||
|
@ -484,18 +406,15 @@ void onSensorMenu(const char * result)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuModelTelemetryFrsky(event_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS VARIO_ROWS TELEMETRY_SCREENS_ROWS });
|
||||
|
||||
|
@ -516,7 +435,6 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
if (++k >= (int)DIM(mstate_tab)) {
|
||||
|
@ -524,18 +442,11 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint8_t ch = TELEMETRY_CURRENT_CHANNEL(k);
|
||||
FrSkyChannelData & channel = g_model.frsky.channels[ch];
|
||||
uint8_t dest = TELEM_A1-1+ch;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_TELEMETRY_SENSORS) {
|
||||
int index = k - ITEM_TELEMETRY_SENSOR1;
|
||||
lcdDrawNumber(INDENT_WIDTH, y, index+1, LEFT|attr);
|
||||
|
@ -571,10 +482,8 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
switch (k) {
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_PROTOCOL_TYPE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
|
||||
|
@ -588,9 +497,7 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
ON_OFF_MENU_ITEM(g_model.moduleData[EXTERNAL_MODULE].invertedSerial, TELEM_COL2, y, STR_INVERTED_SERIAL, attr, event);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_SENSORS_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_SENSORS);
|
||||
break;
|
||||
|
@ -632,82 +539,7 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_TELEMETRY_A1_LABEL:
|
||||
case ITEM_TELEMETRY_A2_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_ACHANNEL);
|
||||
lcdDrawNumber(2*FW, y, ch+1, 0);
|
||||
drawTelemetryValue(TELEM_COL2+6*FW, y, dest, telemetryData.analog[ch].value, LEFT);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_RANGE:
|
||||
case ITEM_TELEMETRY_A2_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
drawTelemetryValue(TELEM_COL2, y, dest, 255-channel.offset, (menuHorizontalPosition<=0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcdDrawTextAtIndex(lcdLastRightPos, y, STR_VTELEMUNIT, channel.type, menuHorizontalPosition!=0 ? attr : 0);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint16_t ratio = checkIncDec(event, channel.ratio, 0, 256, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (ratio == 127 && channel.multiplier > 0) {
|
||||
channel.multiplier--; channel.ratio = 255;
|
||||
}
|
||||
else if (ratio == 256) {
|
||||
if (channel.multiplier < FRSKY_MULTIPLIER_MAX) { channel.multiplier++; channel.ratio = 128; }
|
||||
}
|
||||
else {
|
||||
channel.ratio = ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, channel.type, UNIT_A1A2_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_OFFSET:
|
||||
case ITEM_TELEMETRY_A2_OFFSET:
|
||||
lcdDrawTextAlignedLeft(y, STR_OFFSET);
|
||||
drawTelemetryValue(TELEM_COL2, y, dest, 0, LEFT|attr);
|
||||
if (attr) channel.offset = checkIncDec(event, channel.offset, -256, 256, EE_MODEL);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_ALARM1:
|
||||
case ITEM_TELEMETRY_A1_ALARM2:
|
||||
case ITEM_TELEMETRY_A2_ALARM1:
|
||||
case ITEM_TELEMETRY_A2_ALARM2:
|
||||
{
|
||||
uint8_t alarm = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
|
||||
lcdDrawTextAlignedLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
drawTelemetryValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0) | LEFT);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
uint8_t t;
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
t = ALARM_LEVEL(ch, alarm);
|
||||
channel.alarms_level = (channel.alarms_level & ~(3<<(2*alarm))) + (checkIncDecModel(event, t, 0, 3) << (2*alarm));
|
||||
break;
|
||||
case 1:
|
||||
t = ALARM_GREATER(ch, alarm);
|
||||
if (t != checkIncDecModel(event, t, 0, 1)) {
|
||||
channel.alarms_greater ^= (1 << alarm);
|
||||
frskySendAlarms();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
channel.alarms_value[alarm] = checkIncDec(event, channel.alarms_value[alarm], 0, 255, EE_MODEL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
|
@ -721,7 +553,6 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
#if defined(CPUARM)
|
||||
bool warning = (k==ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
lcdDrawTextAlignedLeft(y, (warning ? STR_LOWALARM : STR_CRITICALALARM));
|
||||
lcdDrawNumber(LCD_W, y, warning? g_model.rssiAlarms.getWarningRssi() : g_model.rssiAlarms.getCriticalRssi(), RIGHT | attr, 3);
|
||||
|
@ -731,71 +562,11 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
else
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.rssiAlarms.critical, -30, 30);
|
||||
}
|
||||
#else // CPUARM
|
||||
uint8_t alarm = (k-ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
lcdDrawTextAlignedLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawChar(TELEM_COL2+4*FW, y, '<');
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(menuHorizontalPosition!=0 ? attr : 0), 3);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].level, -3, 2); // circular (saves flash)
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // CPUARM
|
||||
break;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_DISABLE_ALARMS:
|
||||
g_model.rssiAlarms.disabled = editCheckBox(g_model.rssiAlarms.disabled, LCD_W - 10, y, STR_DISABLE_ALARM, attr, event);
|
||||
break;
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
case ITEM_TELEMETRY_USR_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_USRDATA);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_PROTO:
|
||||
lcdDrawTextAlignedLeft(y, STR_PROTO);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VTELPROTO, g_model.frsky.usrProto, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.usrProto, USR_PROTO_LAST);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_BLADES:
|
||||
lcdDrawTextAlignedLeft(y, STR_BLADES);
|
||||
lcdDrawNumber(TELEM_COL2+FWNUM, y, 2+g_model.frsky.blades, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, MAX_BLADES);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOLTAGE);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.voltsSource+1, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.voltsSource, FRSKY_VOLTS_SOURCE_LAST);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_CURRENT_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_CURRENT);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.currentSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, FRSKY_CURRENT_SOURCE_LAST);
|
||||
break;
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
case ITEM_TELEMETRY_FAS_OFFSET:
|
||||
lcdDrawTextAlignedLeft(y, STR_FAS_OFFSET);
|
||||
lcdDrawNumber(TELEM_COL2, y, g_model.frsky.fasOffset, attr|LEFT|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, telemetryData.hub.current, LEFT|PREC1);
|
||||
lcdDrawChar(TELEM_COL2+8*FW, y, 'A');
|
||||
if (attr) g_model.frsky.fasOffset = checkIncDec(event, g_model.frsky.fasOffset, -120, 120, EE_MODEL);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(VARIO)
|
||||
case ITEM_TELEMETRY_VARIO_LABEL:
|
||||
|
@ -804,35 +575,12 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
|
||||
case ITEM_TELEMETRY_VARIO_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_SOURCE);
|
||||
#if defined(CPUARM)
|
||||
drawSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr);
|
||||
if (attr) {
|
||||
g_model.frsky.varioSource = checkIncDec(event, g_model.frsky.varioSource, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
|
||||
}
|
||||
#else
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VARIOSRC, g_model.frsky.varioSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioSource, 0, VARIO_SOURCE_LAST);
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(PCBSTD)
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
|
||||
lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -15, +15);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMax, -7, 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
if (attr && CURSOR_ON_LINE()) {
|
||||
|
@ -856,9 +604,7 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
lcdDrawTextAlignedLeft(y, STR_CENTER);
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+4*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1|LEFT);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAtIndex(TELEM_COL2+8*FW, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));
|
||||
#endif
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
|
@ -867,99 +613,14 @@ void menuModelTelemetryFrsky(event_t event)
|
|||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -5+max<int8_t>(-10, g_model.frsky.varioCenterMin-5), +15);
|
||||
break;
|
||||
#if defined(CPUARM)
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.varioCenterSilent, 1);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL1:
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL2:
|
||||
{
|
||||
uint8_t screenIndex = (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 1 : 2);
|
||||
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex);
|
||||
#if defined(GAUGES)
|
||||
bool screenType = g_model.frsky.screensType & screenIndex;
|
||||
if (screenType != (bool)editChoice(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, screenType, 0, 1, attr, event))
|
||||
g_model.frsky.screensType ^= screenIndex;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_TELEMETRY_SCREEN_LINE1:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE2:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE3:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE4:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE5:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE6:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE7:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE8:
|
||||
{
|
||||
uint8_t screenIndex, lineIndex;
|
||||
if (k < ITEM_TELEMETRY_SCREEN_LABEL2) {
|
||||
screenIndex = 0;
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE1;
|
||||
}
|
||||
else {
|
||||
screenIndex = 1;
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5;
|
||||
}
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
lcdDrawTextAtIndex(TELEM_COL1, y, STR_VTELEMCHNS, barSource, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
drawTelemetryValue(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
drawTelemetryValue(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else if (attr && menuHorizontalPosition>0) {
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
bar.source = CHECK_INCDEC_MODELVAR_ZERO(event, barSource, TELEM_DISPLAY_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
bar.barMin = 0;
|
||||
bar.barMax = 255 - maxBarTelemValue(bar.source);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
case 2:
|
||||
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxBarTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (uint8_t c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
uint8_t cellAttr = (menuHorizontalPosition==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
uint8_t pos[] = {INDENT_WIDTH, TELEM_COL2};
|
||||
lcdDrawTextAtIndex(pos[c], y, STR_VTELEMCHNS, value, cellAttr);
|
||||
if (cellAttr && (s_editMode>0 || p1valdiff)) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, (lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX, isTelemetrySourceAvailable);
|
||||
}
|
||||
}
|
||||
if (attr && menuHorizontalPosition == NUM_LINE_ITEMS) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // !defined(CPUARM)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ int8_t checkIncDec_Ret;
|
|||
#define DBLKEYS_PRESSED_LFT_DWN(in) ((in & (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN)) == (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
INIT_STOPS(stops100, 3, -100, 0, 100)
|
||||
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
|
||||
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
|
||||
|
@ -515,138 +514,17 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
|||
return newval;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
int16_t checkIncDec(event_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags)
|
||||
{
|
||||
int16_t newval = val;
|
||||
|
||||
#if defined(DBLKEYS)
|
||||
uint8_t in = KEYS_PRESSED();
|
||||
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
|
||||
bool dblkey = true;
|
||||
if (DBLKEYS_PRESSED_RGT_LFT(in))
|
||||
newval = -val;
|
||||
else if (DBLKEYS_PRESSED_RGT_UP(in)) {
|
||||
newval = (i_max > 100 ? 100 : i_max);
|
||||
}
|
||||
else if (DBLKEYS_PRESSED_LFT_DWN(in)) {
|
||||
newval = (i_min < -100 ? -100 : i_min);
|
||||
}
|
||||
else if (DBLKEYS_PRESSED_UP_DWN(in)) {
|
||||
newval = 0;
|
||||
}
|
||||
else {
|
||||
dblkey = false;
|
||||
}
|
||||
|
||||
if (dblkey) {
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
killEvents(KEY_RIGHT);
|
||||
killEvents(KEY_LEFT);
|
||||
event = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT) || (s_editMode>0 && (IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)))) {
|
||||
newval++;
|
||||
}
|
||||
else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT) || (s_editMode>0 && (IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)))) {
|
||||
newval--;
|
||||
}
|
||||
|
||||
if (!READ_ONLY() && i_min==0 && i_max==1 && (event==EVT_KEY_BREAK(KEY_ENTER) || IS_ROTARY_BREAK(event))) {
|
||||
s_editMode = 0;
|
||||
newval = !val;
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
// change values based on P1
|
||||
newval -= p1valdiff;
|
||||
p1valdiff = 0;
|
||||
#endif
|
||||
|
||||
#if defined(AUTOSWITCH)
|
||||
if (i_flags & INCDEC_SWITCH) {
|
||||
newval = checkIncDecMovedSwitch(newval);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AUTOSOURCE)
|
||||
if (i_flags & INCDEC_SOURCE) {
|
||||
if (s_editMode>0) {
|
||||
int8_t source = GET_MOVED_SOURCE(i_min, i_max);
|
||||
if (source) {
|
||||
newval = source;
|
||||
}
|
||||
#if defined(AUTOSWITCH)
|
||||
else {
|
||||
uint8_t swtch = abs(getMovedSwitch());
|
||||
if (swtch) {
|
||||
newval = switchToMix(swtch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newval > i_max || newval < i_min) {
|
||||
newval = (newval > i_max ? i_max : i_min);
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
|
||||
if (newval != val) {
|
||||
if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && (newval==0 || newval==-100 || newval==+100) && !IS_ROTARY_EVENT(event)) {
|
||||
pauseEvents(event); // delay before auto-repeat continues
|
||||
}
|
||||
if (!IS_KEY_REPT(event)) {
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
checkIncDec_Ret = (newval > val ? 1 : -1);
|
||||
}
|
||||
else {
|
||||
checkIncDec_Ret = 0;
|
||||
}
|
||||
return newval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
{
|
||||
return checkIncDec(event, i_val, i_min, i_max, EE_MODEL);
|
||||
}
|
||||
|
||||
int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max)
|
||||
{
|
||||
return checkIncDecModel(event, i_val, 0, i_max);
|
||||
}
|
||||
|
||||
int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
{
|
||||
return checkIncDec(event, i_val, i_min, i_max, EE_GENERAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SCROLL_TH 64
|
||||
#define SCROLL_POT1_TH 32
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
|
||||
#else
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) (MAXCOL(row) == TITLE_ROW)
|
||||
#endif
|
||||
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
#if defined(CPUARM)
|
||||
tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
|
@ -1024,9 +902,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
|||
switch (event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
#if defined(CPUARM)
|
||||
menuEntryTime = get_tmr10ms();
|
||||
#endif
|
||||
l_posVert = 0;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
|
@ -1185,7 +1061,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
|||
|
||||
uint8_t maxLines = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
|
||||
#if defined(CPUARM)
|
||||
int linesCount = maxrow;
|
||||
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||
menuVerticalOffset = 0;
|
||||
|
@ -1233,11 +1108,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (l_posVert<1) {
|
||||
menuVerticalOffset=0;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
if (l_posVert>maxLines+menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert-maxLines;
|
||||
|
@ -1249,7 +1119,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
|||
|
||||
menuVerticalPosition = l_posVert;
|
||||
menuHorizontalPosition = l_posHorz;
|
||||
#if !defined(CPUM64)
|
||||
// cosmetics on 9x
|
||||
if (menuVerticalOffset > 0) {
|
||||
l_posVert--;
|
||||
|
@ -1257,7 +1126,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
|||
menuVerticalOffset = l_posVert-1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -26,22 +26,16 @@ uint8_t warningInfoLength;
|
|||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
#endif
|
||||
|
||||
void drawMessageBox()
|
||||
{
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN);
|
||||
#else
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, warningText);
|
||||
#endif
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
|
@ -114,13 +108,11 @@ void runPopupWarning(event_t event)
|
|||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
#if defined(CPUARM)
|
||||
default:
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,13 +34,11 @@ void runPopupWarning(event_t event);
|
|||
|
||||
#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL)
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern void (*popupFunc)(event_t event);
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
#endif
|
||||
|
||||
#if !defined(GUI)
|
||||
#define DISPLAY_WARNING(...)
|
||||
|
@ -49,19 +47,13 @@ extern uint8_t warningInfoFlags;
|
|||
#define POPUP_INPUT(...)
|
||||
#define WARNING_INFO_FLAGS 0
|
||||
#define SET_WARNING_INFO(...)
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
#else
|
||||
#define DISPLAY_WARNING runPopupWarning
|
||||
#define POPUP_WARNING(s) warningText = s
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM)
|
||||
#define WARNING_INFO_FLAGS ZCHAR
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len)
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
|
@ -70,7 +62,6 @@ extern uint8_t warningInfoFlags;
|
|||
#define POPUP_MENU_ADD_SD_ITEM(s)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuNoItems ? s : popupMenuNoItems) : 0)
|
||||
|
@ -86,19 +77,6 @@ extern uint8_t warningInfoFlags;
|
|||
};
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
extern uint8_t s_menu_item;
|
||||
#elif defined(SDCARD) || (defined(ROTARY_ENCODER_NAVIGATION) && !defined(CPUM64))
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 6
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
|
||||
#define POPUP_MENU_SET_BSS_FLAG() (popupMenuFlags = BSS)
|
||||
#define POPUP_MENU_UNSET_BSS_FLAG() (popupMenuFlags = 0)
|
||||
extern uint8_t popupMenuFlags;
|
||||
#else
|
||||
#define popupMenuNoItems 0
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
extern uint16_t popupMenuOffset;
|
||||
|
|
|
@ -49,11 +49,7 @@ void menuRadioDiagAnalogs(event_t event)
|
|||
lcdDrawChar(lcdNextPos, y, ':');
|
||||
#endif
|
||||
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));
|
||||
#if defined(CPUARM)
|
||||
lcdDrawNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256, RIGHT);
|
||||
#else
|
||||
lcdDraw8bitsNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256);
|
||||
#endif
|
||||
}
|
||||
|
||||
// RAS
|
||||
|
@ -63,7 +59,7 @@ void menuRadioDiagAnalogs(event_t event)
|
|||
lcdDrawText(1, y, "RAS:");
|
||||
lcdDrawNumber(1 + 4*FW, y, telemetryData.swr.value, LEFT);
|
||||
}
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE)) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + ((NUM_STICKS+NUM_POTS+NUM_SLIDERS)/2)*FH;
|
||||
uint8_t x = ((NUM_STICKS+NUM_POTS+NUM_SLIDERS) & 1) ? (LCD_W/2)+FW : 0;
|
||||
|
@ -73,11 +69,6 @@ void menuRadioDiagAnalogs(event_t event)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
// Display raw BandGap result (debug)
|
||||
lcdDrawText(64+5, MENU_HEADER_HEIGHT+1+3*FH, STR_BG);
|
||||
lcdDrawNumber(64+5+6*FW-3, 1+4*FH, BandGap, RIGHT);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH + 2, STR_BATT_CALIB);
|
||||
|
@ -90,14 +81,6 @@ void menuRadioDiagAnalogs(event_t event)
|
|||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
lcdDrawTextAlignedLeft(6*FH-2, STR_BATT_CALIB);
|
||||
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
|
||||
// TODO board.cpp
|
||||
static uint16_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
|
||||
lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, g_vbat100mV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
|
|
|
@ -30,21 +30,11 @@ const pm_uchar sticks[] PROGMEM = {
|
|||
#define RADIO_SETUP_DATE_COLUMN (FW*15+7)
|
||||
#define RADIO_SETUP_TIME_COLUMN (FW*15+9)
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
#elif defined(GRAPHICS)
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
#else
|
||||
#define SLIDER_5POS(y, value, label, event, attr) value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event)
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
|
@ -270,16 +260,12 @@ void menuRadioSetup(event_t event)
|
|||
CHECK_INCDEC_GENVAR(event, b, 0, VOLUME_LEVEL_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
g_eeGeneral.speakerVolume = (int8_t)b-VOLUME_LEVEL_DEF;
|
||||
#if !defined(CPUARM)
|
||||
setScaledVolume(b);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_BEEP_VOLUME:
|
||||
SLIDER_5POS(y, g_eeGeneral.beepVolume, STR_BEEP_VOLUME, event, attr);
|
||||
break;
|
||||
|
@ -289,7 +275,6 @@ void menuRadioSetup(event_t event)
|
|||
case ITEM_SETUP_BACKGROUND_VOLUME:
|
||||
SLIDER_5POS(y, g_eeGeneral.backgroundVolume, STR_BG_VOLUME, event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_BEEP_LENGTH:
|
||||
SLIDER_5POS(y, g_eeGeneral.beepLength, STR_BEEP_LENGTH, event, attr);
|
||||
|
@ -298,13 +283,9 @@ void menuRadioSetup(event_t event)
|
|||
#if defined(AUDIO)
|
||||
case ITEM_SETUP_SPEAKER_PITCH:
|
||||
lcdDrawTextAlignedLeft( y, STR_SPKRPITCH);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, "Hz", attr);
|
||||
#else
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.speakerPitch, attr|LEFT);
|
||||
#endif
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 20);
|
||||
}
|
||||
|
@ -389,14 +370,12 @@ void menuRadioSetup(event_t event)
|
|||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_RSSI_POWEROFF_ALARM:
|
||||
{
|
||||
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
|
||||
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
case ITEM_SETUP_CAPACITY_WARNING:
|
||||
|
@ -449,7 +428,6 @@ void menuRadioSetup(event_t event)
|
|||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcdDrawTextAlignedLeft(y, STR_BRIGHTNESS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
|
@ -459,7 +437,6 @@ void menuRadioSetup(event_t event)
|
|||
g_eeGeneral.backlightBright = 100 - b;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PWM_BACKLIGHT)
|
||||
case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF:
|
||||
|
@ -478,7 +455,6 @@ void menuRadioSetup(event_t event)
|
|||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
case ITEM_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
if (SPLASH_NEEDED()) {
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT);
|
||||
|
@ -489,11 +465,6 @@ void menuRadioSetup(event_t event)
|
|||
}
|
||||
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
|
||||
break;
|
||||
#else
|
||||
uint8_t b = 1-g_eeGeneral.splashMode;
|
||||
g_eeGeneral.splashMode = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -504,11 +475,9 @@ void menuRadioSetup(event_t event)
|
|||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_ADJUST_RTC:
|
||||
g_eeGeneral.adjustRTC = editCheckBox(g_eeGeneral.adjustRTC, RADIO_SETUP_2ND_COLUMN, y, STR_ADJUST_RTC, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_GPSFORMAT:
|
||||
g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
|
||||
|
@ -521,7 +490,6 @@ void menuRadioSetup(event_t event)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_LANGUAGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOICELANG);
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
|
||||
|
@ -537,7 +505,6 @@ void menuRadioSetup(event_t event)
|
|||
case ITEM_SETUP_IMPERIAL:
|
||||
g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
case ITEM_SETUP_FAI:
|
||||
|
@ -557,14 +524,12 @@ void menuRadioSetup(event_t event)
|
|||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_SWITCHES_DELAY:
|
||||
lcdDrawTextAlignedLeft(y, STR_SWITCHES_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, STR_MS, attr);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, 100-15);
|
||||
break;
|
||||
#endif
|
||||
#if defined(STM32)
|
||||
case ITEM_SETUP_USB_MODE:
|
||||
g_eeGeneral.USBMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_USBMODE, STR_USBMODES, g_eeGeneral.USBMode, USB_UNSELECTED_MODE, USB_MAX_MODE, attr, event);
|
||||
|
|
|
@ -51,11 +51,7 @@ const pm_uchar * const splash_lbm = splashdata+4;
|
|||
void drawSplash()
|
||||
{
|
||||
lcdClear();
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
lcd_imgfar(0, 0, (GET_FAR_ADDRESS(splashdata)+4), 0, 0); // use progmem "far" for splash working with all other options enabled
|
||||
#else
|
||||
lcdDraw1bitBitmap(0, 0, splash_lbm, 0, 0);
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
if (readonly == false) {
|
||||
|
|
|
@ -105,18 +105,14 @@ void displayTrims(uint8_t phase)
|
|||
uint8_t att = ROUND;
|
||||
int16_t val = getTrimValue(phase, i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if(getRawTrimValue(phase, i).mode == TRIM_MODE_NONE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
int16_t dir = val;
|
||||
bool exttrim = false;
|
||||
if (val < TRIM_MIN || val > TRIM_MAX) {
|
||||
exttrim = true;
|
||||
}
|
||||
#endif
|
||||
if (val < -(TRIM_LEN+1)*4) {
|
||||
val = -(TRIM_LEN+1);
|
||||
}
|
||||
|
@ -135,7 +131,6 @@ void displayTrims(uint8_t phase)
|
|||
lcdDrawSolidVerticalLine(xm+1, ym-1, 3);
|
||||
}
|
||||
ym -= val;
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3);
|
||||
|
@ -146,14 +141,11 @@ void displayTrims(uint8_t phase)
|
|||
if (exttrim) {
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym, 3);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber(dir>0 ? 12 : 40, xm-2, -abs(dir/5), TINSIZE|VERTICAL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
ym = 60;
|
||||
|
@ -161,7 +153,6 @@ void displayTrims(uint8_t phase)
|
|||
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3);
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym+1, 3);
|
||||
xm += val;
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidVerticalLine(xm+1, ym-1, 3);
|
||||
|
@ -172,14 +163,11 @@ void displayTrims(uint8_t phase)
|
|||
if (exttrim) {
|
||||
lcdDrawSolidVerticalLine(xm, ym-1, 3);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? (dir>0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir>0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym-2, -abs(dir/5), TINSIZE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
lcdDrawSquare(xm-3, ym-3, 7, att);
|
||||
}
|
||||
|
@ -193,7 +181,6 @@ FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
|||
const uint8_t negative = (timerState.val<0 ? BLINK | INVERS : 0);
|
||||
LcdFlags att = RIGHT | DBLSIZE | negative;
|
||||
drawTimer(x, y, timerState.val, att, att);
|
||||
#if defined(CPUARM)
|
||||
uint8_t xLabel = (negative ? x-56 : x-49);
|
||||
uint8_t len = zlen(timer.name, LEN_TIMER_NAME);
|
||||
if (len > 0) {
|
||||
|
@ -202,10 +189,6 @@ FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
|||
else {
|
||||
drawTimerMode(xLabel, y+FH, timer.mode, RIGHT);
|
||||
}
|
||||
#else
|
||||
uint8_t xLabel = (negative ? x-76 : x-69);
|
||||
drawTimerMode(xLabel, y+FH, timer.mode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,7 +272,6 @@ void onMainViewMenu(const char *result)
|
|||
timerReset(2);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_VIEW_NOTES) {
|
||||
pushModelNotes();
|
||||
}
|
||||
|
@ -302,7 +284,6 @@ void onMainViewMenu(const char *result)
|
|||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
|
@ -314,11 +295,9 @@ void onMainViewMenu(const char *result)
|
|||
else if (result == STR_STATISTICS) {
|
||||
chainMenu(menuStatisticsView);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_ABOUT_US) {
|
||||
chainMenu(menuAboutView);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -348,14 +327,10 @@ void menuMainView(event_t event)
|
|||
case EVT_KEY_NEXT_PAGE:
|
||||
case EVT_KEY_PREVIOUS_PAGE:
|
||||
if (view_base <= VIEW_INPUTS) {
|
||||
#if defined(CPUARM)
|
||||
if (view_base == VIEW_INPUTS)
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
else
|
||||
g_eeGeneral.view = (g_eeGeneral.view + (4*ALTERNATE_VIEW) + ((event==EVT_KEY_PREVIOUS_PAGE) ? -ALTERNATE_VIEW : ALTERNATE_VIEW)) % (4*ALTERNATE_VIEW);
|
||||
#else
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
#endif
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
|
@ -365,27 +340,14 @@ void menuMainView(event_t event)
|
|||
case EVT_KEY_CONTEXT_MENU:
|
||||
killEvents(event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (modelHasNotes()) {
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
#else
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
#endif
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
#endif
|
||||
|
||||
POPUP_MENU_ADD_ITEM(STR_STATISTICS);
|
||||
#if defined(CPUARM)
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
#endif
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
break;
|
||||
#endif
|
||||
|
@ -501,19 +463,11 @@ void menuMainView(event_t event)
|
|||
if (view_base < VIEW_INPUTS) {
|
||||
// scroll bar
|
||||
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSolidHorizontalLine(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
|
||||
#else
|
||||
lcdDrawSolidHorizontalLine((g_eeGeneral.view & ALTERNATE_VIEW) ? 64 : 38, 34, 26, SOLID);
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
uint8_t x0,y0;
|
||||
#if defined(CPUARM)
|
||||
uint8_t chan = 8*(g_eeGeneral.view / ALTERNATE_VIEW) + i;
|
||||
#else
|
||||
uint8_t chan = (g_eeGeneral.view & ALTERNATE_VIEW) ? 8+i : i;
|
||||
#endif
|
||||
|
||||
int16_t val = channelOutputs[chan];
|
||||
|
||||
|
@ -585,22 +539,8 @@ void menuMainView(event_t event)
|
|||
#endif
|
||||
}
|
||||
else {
|
||||
#if defined(PCBMEGA2560) && defined(ROTARY_ENCODERS)
|
||||
for (uint8_t i=0; i<NUM_ROTARY_ENCODERS; i++) {
|
||||
int16_t val = getRotaryEncoder(i);
|
||||
int8_t len = limit((int16_t)0, (int16_t)(((val+1024) * BAR_HEIGHT) / 2048), (int16_t)BAR_HEIGHT);
|
||||
#if ROTARY_ENCODERS > 2
|
||||
#define V_BAR_W 5
|
||||
V_BAR(LCD_W/2-8+V_BAR_W*i, LCD_H-8, len);
|
||||
#else
|
||||
#define V_BAR_W 5
|
||||
V_BAR(LCD_W/2-3+V_BAR_W*i, LCD_H-8, len);
|
||||
#endif
|
||||
}
|
||||
#endif // PCBGRUVIN9X && ROTARY_ENCODERS
|
||||
|
||||
// Logical Switches
|
||||
#if defined(CPUARM)
|
||||
uint8_t index = 0;
|
||||
uint8_t y = LCD_H-20;
|
||||
for (uint8_t line=0; line<2; line++) {
|
||||
|
@ -613,19 +553,6 @@ void menuMainView(event_t event)
|
|||
}
|
||||
y += 12;
|
||||
}
|
||||
#elif defined(CPUM2560)
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-3 + (i/3)*(i/3>2 ? 3*FW+2 : (3*FW-1)) + (i/3>2 ? 2*FW : 0), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#elif !defined(PCBSTD)
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-2 + (i/3)*(4*FW-1), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#else
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-3 + (i/3)*(4*FW), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -649,14 +576,10 @@ void menuMainView(event_t event)
|
|||
drawMessageBox();
|
||||
lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
|
||||
lcdDrawText(16+6*FW, 5*FH, PSTR("["), BOLD);
|
||||
#if defined(CPUARM)
|
||||
drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD);
|
||||
if (g_model.gvars[gvarLastChanged].unit) {
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD);
|
||||
}
|
||||
#else
|
||||
lcdDrawNumber(lcdLastRightPos, 5*FH, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), BOLD);
|
||||
#endif
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, PSTR("]"), BOLD);
|
||||
warningText = NULL;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ void menuStatisticsView(event_t event)
|
|||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_LONG(KEY_MENU): // historical
|
||||
#endif
|
||||
|
@ -58,13 +57,11 @@ void menuStatisticsView(event_t event)
|
|||
storageDirty(EE_GENERAL);
|
||||
sessionTimer = 0;
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
// Session and Total timers
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
|
||||
|
@ -85,17 +82,6 @@ void menuStatisticsView(event_t event)
|
|||
else
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
|
||||
}
|
||||
#else
|
||||
lcdDrawText( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
|
||||
|
||||
drawTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, RIGHT, 0);
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, RIGHT, 0);
|
||||
|
||||
drawTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, RIGHT, 0);
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, RIGHT, 0);
|
||||
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, RIGHT, 0);
|
||||
#endif
|
||||
|
||||
#if defined(THRTRACE)
|
||||
const coord_t x = 5;
|
||||
|
@ -114,7 +100,6 @@ void menuStatisticsView(event_t event)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MENU_DEBUG_COL1_OFS (11*FW-3)
|
||||
#define MENU_DEBUG_COL2_OFS (17*FW)
|
||||
#define MENU_DEBUG_Y_CURRENT (1*FH)
|
||||
|
@ -128,16 +113,12 @@ void menuStatisticsView(event_t event)
|
|||
#define MENU_DEBUG_Y_USB (2*FH)
|
||||
#define MENU_DEBUG_Y_LUA (3*FH)
|
||||
#define MENU_DEBUG_Y_FREE_RAM (4*FH)
|
||||
#else
|
||||
#define MENU_DEBUG_COL1_OFS (14*FW)
|
||||
#endif
|
||||
|
||||
void menuStatisticsDebug(event_t event)
|
||||
{
|
||||
TITLE(STR_MENUDEBUG);
|
||||
|
||||
switch (event) {
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#if defined(PCBSKY9X)
|
||||
g_eeGeneral.mAhUsed = 0;
|
||||
|
@ -148,13 +129,8 @@ void menuStatisticsDebug(event_t event)
|
|||
storageDirty(EE_GENERAL);
|
||||
killEvents(event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
#if !defined(CPUARM)
|
||||
g_tmr1Latency_min = 0xff;
|
||||
g_tmr1Latency_max = 0;
|
||||
#endif
|
||||
maxMixerDuration = 0;
|
||||
break;
|
||||
|
||||
|
@ -248,31 +224,16 @@ void menuStatisticsDebug(event_t event)
|
|||
#endif // LUA
|
||||
#endif // PCBTARANIS
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcdDrawNumber(lcdLastRightPos+1, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcdDrawNumber(lcdLastRightPos+1, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT);
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(1*FH, STR_TMR1LATMAXUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 );
|
||||
lcdDrawTextAlignedLeft(2*FH, STR_TMR1LATMINUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 );
|
||||
lcdDrawTextAlignedLeft(3*FH, STR_TMR1JITTERUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
|
||||
lcdDrawTextAlignedLeft(4*FH, STR_TMIXMAXMS);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
|
||||
lcdDrawTextAlignedLeft(5*FH, STR_FREESTACKMINB);
|
||||
lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
|
||||
#endif
|
||||
|
||||
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
|
||||
lcdInvertLastLine();
|
||||
|
|
|
@ -37,25 +37,12 @@ void displayRssiLine()
|
|||
if (TELEMETRY_STREAMING()) {
|
||||
lcdDrawSolidHorizontalLine(0, 55, 128, 0); // separator
|
||||
uint8_t rssi;
|
||||
#if defined(CPUARM)
|
||||
rssi = min((uint8_t)99, TELEMETRY_RSSI());
|
||||
lcdDrawNumber(LCD_W/2 -2, STATUS_BAR_Y, rssi, LEADING0 | RIGHT | SMLSIZE, 2);
|
||||
lcdDrawText(lcdLastLeftPos,STATUS_BAR_Y, "RSSI : ", RIGHT | SMLSIZE);
|
||||
lcdDrawRect(65, 57, 38, 7);
|
||||
uint8_t v = 4*rssi/11;
|
||||
lcdDrawFilledRect(66+36-v, 58, v, 5, (rssi < g_model.rssiAlarms.getWarningRssi()) ? DOTTED : SOLID);
|
||||
#else
|
||||
rssi = min((uint8_t)99, telemetryData.rssi[1].value);
|
||||
lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_TX); lcdDrawNumber(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcdDrawRect(BAR_LEFT+1, 57, 38, 7);
|
||||
lcdDrawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
|
||||
rssi = min((uint8_t)99, TELEMETRY_RSSI());
|
||||
lcdDrawText(104, STATUS_BAR_Y, STR_RX); lcdDrawNumber(105+4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcdDrawRect(65, 57, 38, 7);
|
||||
uint8_t v = 4*rssi/11;
|
||||
lcdDrawFilledRect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcdDrawText(7*FW, STATUS_BAR_Y, STR_NODATA, BLINK);
|
||||
|
@ -63,165 +50,18 @@ void displayRssiLine()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS) && !defined(CPUARM)
|
||||
void displayGpsTime()
|
||||
{
|
||||
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
lcdDrawNumber(CENTER_OFS+6*FW+7, STATUS_BAR_Y, telemetryData.hub.hour, att, 2);
|
||||
lcdDrawChar(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawNumber(CENTER_OFS+9*FW+2, STATUS_BAR_Y, telemetryData.hub.min, att, 2);
|
||||
lcdDrawChar(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawNumber(CENTER_OFS+12*FW-3, STATUS_BAR_Y, telemetryData.hub.sec, att, 2);
|
||||
lcdInvertLastLine();
|
||||
}
|
||||
|
||||
void drawGPSCoord(uint8_t y, char direction, int16_t bp, int16_t ap)
|
||||
{
|
||||
if (telemetryData.hub.gpsFix >= 0) {
|
||||
if (!direction) direction = '-';
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN, y, bp / 100, LEFT); // ddd before '.'
|
||||
lcdDrawChar(lcdLastRightPos, y, '@');
|
||||
uint8_t mn = bp % 100; // TODO div_t
|
||||
if (g_eeGeneral.gpsFormat == 0) {
|
||||
lcdDrawChar(lcdLastRightPos+FWNUM, y, direction);
|
||||
lcdDrawNumber(lcdLastRightPos+FW+FW+1, y, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos, y, 2);
|
||||
uint16_t ss = ap * 6;
|
||||
lcdDrawNumber(lcdLastRightPos+3, y, ss / 1000, LEFT|LEADING0, 2); // ''
|
||||
lcdDrawPoint(lcdLastRightPos, y+FH-2, 0); // small decimal point
|
||||
lcdDrawNumber(lcdLastRightPos+2, y, ss % 1000, LEFT|LEADING0, 3); // ''
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos, y, 2);
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos+2, y, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(lcdLastRightPos+FW, y, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcdDrawPoint(lcdLastRightPos, y+FH-2, 0); // small decimal point
|
||||
lcdDrawNumber(lcdLastRightPos+2, y, ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcdDrawChar(lcdLastRightPos+1, y, direction);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no fix
|
||||
lcdDrawText(TELEM_2ND_COLUMN, y, STR_VCSWFUNC+1/*----*/);
|
||||
}
|
||||
}
|
||||
#elif !defined(CPUARM)
|
||||
#define displayGpsTime()
|
||||
#define drawGPSCoord(...)
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void displayVoltageScreenLine(uint8_t y, uint8_t index)
|
||||
{
|
||||
drawStringWithIndex(0, y, STR_A, index+1, 0);
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
drawTelemetryValue(3*FW+6*FW+4, y-FH, index+TELEM_A1-1, telemetryData.analog[index].value, DBLSIZE);
|
||||
lcdDrawChar(12*FW-1, y-FH, '<'); drawTelemetryValue(17*FW, y-FH, index+TELEM_A1-1, telemetryData.analog[index].min, NO_UNIT);
|
||||
lcdDrawChar(12*FW, y, '>'); drawTelemetryValue(17*FW, y, index+TELEM_A1-1, telemetryData.analog[index].max, NO_UNIT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t barCoord(int16_t value, int16_t min, int16_t max)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (value <= min)
|
||||
return 0;
|
||||
else if (value >= max)
|
||||
return BAR_WIDTH-1;
|
||||
else
|
||||
return ((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min);
|
||||
#else
|
||||
return limit((uint8_t)0, (uint8_t)(((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min)), (uint8_t)BAR_WIDTH);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void displayVoltagesScreen()
|
||||
{
|
||||
// Volts / Amps / Watts / mAh
|
||||
uint8_t analog = 0;
|
||||
lcdDrawTextAtIndex(0, 2*FH, STR_AMPSRC, g_model.frsky.voltsSource+1, 0);
|
||||
switch (g_model.frsky.voltsSource) {
|
||||
case FRSKY_VOLTS_SOURCE_A1:
|
||||
case FRSKY_VOLTS_SOURCE_A2:
|
||||
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
|
||||
analog = 1+g_model.frsky.voltsSource;
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case FRSKY_VOLTS_SOURCE_FAS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, FH, TELEM_VFAS-1, telemetryData.hub.vfas, DBLSIZE);
|
||||
break;
|
||||
case FRSKY_VOLTS_SOURCE_CELLS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, FH, TELEM_CELLS_SUM-1, telemetryData.hub.cellsSum, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_model.frsky.currentSource) {
|
||||
lcdDrawTextAtIndex(0, 4*FH, STR_AMPSRC, g_model.frsky.currentSource, 0);
|
||||
switch(g_model.frsky.currentSource) {
|
||||
case FRSKY_CURRENT_SOURCE_A1:
|
||||
case FRSKY_CURRENT_SOURCE_A2:
|
||||
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case FRSKY_CURRENT_SOURCE_FAS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, 3*FH, TELEM_CURRENT-1, telemetryData.hub.current, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
drawTelemetryValue(4, 5*FH, TELEM_POWER-1, telemetryData.hub.power, LEFT|DBLSIZE);
|
||||
drawTelemetryValue(3*FW+4+4*FW+6*FW+FW, 5*FH, TELEM_CONSUMPTION-1, telemetryData.hub.currentConsumption, DBLSIZE);
|
||||
}
|
||||
else {
|
||||
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
|
||||
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
// Cells voltage
|
||||
if (telemetryData.hub.cellsCount > 0) {
|
||||
uint8_t y = 1*FH;
|
||||
for (uint8_t k=0; k<telemetryData.hub.cellsCount && k<6; k++) {
|
||||
#if defined(GAUGES)
|
||||
uint8_t attr = (barsThresholds[THLD_CELL] && telemetryData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
|
||||
#else
|
||||
uint8_t attr = PREC2;
|
||||
#endif
|
||||
lcdDrawNumber(LCD_W, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
|
||||
y += 1*FH;
|
||||
}
|
||||
lcdDrawSolidVerticalLine(LCD_W-3*FW-2, 8, 47);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
void displayAfterFlightScreen()
|
||||
{
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_GPS_AVAILABLE()) {
|
||||
// Latitude
|
||||
lcdDrawTextAlignedLeft(line, STR_LATITUDE);
|
||||
drawGPSCoord(line, telemetryData.hub.gpsLatitudeNS, telemetryData.hub.gpsLatitude_bp, telemetryData.hub.gpsLatitude_ap);
|
||||
// Longitude
|
||||
line+=1*FH+1;
|
||||
lcdDrawTextAlignedLeft(line, STR_LONGITUDE);
|
||||
drawGPSCoord(line, telemetryData.hub.gpsLongitudeEW, telemetryData.hub.gpsLongitude_bp, telemetryData.hub.gpsLongitude_ap);
|
||||
displayGpsTime();
|
||||
line+=1*FH+1;
|
||||
}
|
||||
// Rssi
|
||||
lcdDrawTextAlignedLeft(line, STR_MINRSSI);
|
||||
lcdDrawText(TELEM_2ND_COLUMN, line, STR_TX);
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN+3*FW, line, telemetryData.rssi[1].min, LEFT|LEADING0, 2);
|
||||
lcdDrawText(TELEM_2ND_COLUMN+6*FW, line, STR_RX);
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN+9*FW, line, telemetryData.rssi[0].min, LEFT|LEADING0, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
|
@ -230,67 +70,24 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
|||
for (int8_t i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
source_t source = bar.source;
|
||||
#if defined(CPUARM)
|
||||
getvalue_t barMin = bar.barMin;
|
||||
getvalue_t barMax = bar.barMax;
|
||||
if (source <= MIXSRC_LAST_CH) {
|
||||
barMin = calc100toRESX(barMin);
|
||||
barMax = calc100toRESX(barMax);
|
||||
}
|
||||
#else
|
||||
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
|
||||
#endif
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
#if defined(CPUARM)
|
||||
drawSource(0, y+barHeight/2-3, source, SMLSIZE);
|
||||
#else
|
||||
lcdDrawTextAtIndex(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
#endif
|
||||
lcdDrawRect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
|
||||
#if defined(CPUARM)
|
||||
getvalue_t value = getValue(source);
|
||||
#else
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-1);
|
||||
#endif
|
||||
|
||||
uint8_t thresholdX = 0;
|
||||
|
||||
#if !defined(CPUARM)
|
||||
getvalue_t threshold = 0;
|
||||
if (source <= TELEM_TIMER_MAX)
|
||||
threshold = 0;
|
||||
else if (source <= TELEM_RSSI_RX)
|
||||
threshold = getRssiAlarmValue(source-TELEM_RSSI_TX);
|
||||
else if (source <= TELEM_A2)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
#if defined(FRSKY_HUB)
|
||||
else {
|
||||
#if defined(GAUGES)
|
||||
threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (threshold) {
|
||||
thresholdX = barCoord(threshold, barMin, barMax);
|
||||
if (thresholdX == 100)
|
||||
thresholdX = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t barShade = SOLID;
|
||||
#else
|
||||
// reversed barshade for T1/T2
|
||||
uint8_t barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
if (source == TELEM_T1 || source == TELEM_T2) {
|
||||
barShade = -barShade;
|
||||
}
|
||||
#endif
|
||||
|
||||
lcdDrawFilledRect(BAR_LEFT+1, y+1, width, barHeight, barShade);
|
||||
|
||||
|
@ -313,7 +110,6 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
|||
return barHeight < 13;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with numbers
|
||||
|
@ -367,62 +163,7 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
|||
lcdInvertLastLine();
|
||||
return fields_count;
|
||||
}
|
||||
#else
|
||||
bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with numbers
|
||||
uint8_t fields_count = 0;
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
for (uint8_t j=0; j<NUM_LINE_ITEMS; j++) {
|
||||
uint8_t field = screen.lines[i].sources[j];
|
||||
if (field > 0) {
|
||||
fields_count++;
|
||||
}
|
||||
if (i==3) {
|
||||
lcdDrawSolidVerticalLine(63, 8, 48);
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
#if defined(FRSKY_HUB)
|
||||
if (field == TELEM_ACC) {
|
||||
lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_ACCEL);
|
||||
lcdDrawNumber(4*FW, STATUS_BAR_Y, telemetryData.hub.accelX, LEFT|PREC2);
|
||||
lcdDrawNumber(10*FW, STATUS_BAR_Y, telemetryData.hub.accelY, LEFT|PREC2);
|
||||
lcdDrawNumber(16*FW, STATUS_BAR_Y, telemetryData.hub.accelZ, LEFT|PREC2);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(FRSKY_HUB) && defined(GPS)
|
||||
else if (field == TELEM_GPS_TIME) {
|
||||
displayGpsTime();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
displayRssiLine();
|
||||
return fields_count;
|
||||
}
|
||||
}
|
||||
if (field) {
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-1);
|
||||
uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
|
||||
coord_t pos[] = {0, 65, 130};
|
||||
drawTelemetryValue(pos[j+1]-2, FH+2*FH*i, field-1, value, att);
|
||||
|
||||
if (field >= TELEM_TIMER1 && field <= TELEM_TIMER_MAX && i!=3) {
|
||||
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead
|
||||
field = field-TELEM_TIMER1+TELEM_T1;
|
||||
}
|
||||
|
||||
lcdDrawTextAtIndex(pos[j], 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
lcdInvertLastLine();
|
||||
return fields_count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool displayCustomTelemetryScreen(uint8_t index)
|
||||
{
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[index];
|
||||
|
@ -437,20 +178,6 @@ bool displayCustomTelemetryScreen(uint8_t index)
|
|||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool displayCustomTelemetryScreen(uint8_t index)
|
||||
{
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[index];
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(s_frsky_view)) {
|
||||
return displayGaugesTelemetryScreen(screen);
|
||||
}
|
||||
#endif
|
||||
|
||||
return displayNumbersTelemetryScreen(screen);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displayTelemetryScreen()
|
||||
{
|
||||
|
@ -472,11 +199,9 @@ bool displayTelemetryScreen()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_NONE) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
drawTelemetryTopBar();
|
||||
|
||||
|
@ -484,22 +209,11 @@ bool displayTelemetryScreen()
|
|||
return displayCustomTelemetryScreen(s_frsky_view);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (s_frsky_view == TELEMETRY_VOLTAGES_SCREEN) {
|
||||
displayVoltagesScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM) && defined(FRSKY_HUB)
|
||||
else {
|
||||
displayAfterFlightScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum NavigationDirection {
|
||||
none,
|
||||
up,
|
||||
|
@ -507,18 +221,6 @@ enum NavigationDirection {
|
|||
};
|
||||
#define decrTelemetryScreen() direction = up
|
||||
#define incrTelemetryScreen() direction = down
|
||||
#else
|
||||
void decrTelemetryScreen()
|
||||
{
|
||||
if (s_frsky_view-- == 0)
|
||||
s_frsky_view = TELEMETRY_VIEW_MAX;
|
||||
}
|
||||
void incrTelemetryScreen()
|
||||
{
|
||||
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
|
||||
s_frsky_view = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_LONG(KEY_LEFT)
|
||||
|
@ -533,9 +235,7 @@ void incrTelemetryScreen()
|
|||
|
||||
void menuViewTelemetryFrsky(event_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
enum NavigationDirection direction = none;
|
||||
#endif
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
|
@ -569,20 +269,14 @@ void menuViewTelemetryFrsky(event_t event)
|
|||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
#else
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
telemetryReset();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
|
||||
if (direction == up) {
|
||||
if (s_frsky_view-- == 0)
|
||||
|
@ -603,11 +297,6 @@ void menuViewTelemetryFrsky(event_t event)
|
|||
drawTelemetryTopBar();
|
||||
lcdDrawText(2*FW, 3*FH, "No Telemetry Screens");
|
||||
displayRssiLine();
|
||||
#else
|
||||
if (!displayTelemetryScreen()) {
|
||||
putEvent(event == EVT_KEY_FIRST(KEY_UP) ? event : EVT_KEY_FIRST(KEY_DOWN));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef EVT_KEY_PREVIOUS_VIEW
|
||||
|
|
|
@ -55,7 +55,6 @@ void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
|||
lcdDrawNumber(x, 0, index+1, RIGHT | attr);
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, DOTTED);
|
||||
|
@ -65,7 +64,6 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
|
|||
yhgt = h - yofs;
|
||||
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void title(const pm_char * s)
|
||||
{
|
||||
|
@ -98,21 +96,12 @@ int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t eve
|
|||
return value;
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
|
||||
{
|
||||
lcdDrawChar(x+(value*4*FW)/max, y, '$');
|
||||
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, FORCE);
|
||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
|
||||
}
|
||||
#elif defined(GRAPHICS)
|
||||
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr)
|
||||
{
|
||||
lcdDrawChar(x+2*FW+(value*FW), y, '$');
|
||||
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, SOLID);
|
||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(GVARS) && defined(CPUARM)
|
||||
|
@ -257,7 +246,6 @@ void drawProgressBar(const char * label, int num, int den)
|
|||
lcdRefresh();
|
||||
}
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
const pm_uchar SLEEP_BITMAP[] PROGMEM = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
@ -271,4 +259,3 @@ void drawSleepBitmap()
|
|||
lcdDraw1bitBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, SLEEP_BITMAP, 0);
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -83,13 +83,11 @@ void menuModelCurvesAll(event_t event)
|
|||
#endif
|
||||
{
|
||||
drawStringWithIndex(0, y, STR_CV, k+1, attr);
|
||||
#if defined(CPUARM)
|
||||
CurveData & crv = g_model.curves[k];
|
||||
editName(4*FW, y, crv.name, sizeof(crv.name), 0, 0);
|
||||
#if LCD_W >= 212
|
||||
lcdDrawNumber(11*FW, y, 5+crv.points, LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, STR_PTS, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -104,7 +102,6 @@ void menuModelCurvesAll(event_t event)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags)
|
||||
{
|
||||
coord_t x1 = x;
|
||||
|
@ -155,4 +152,3 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
|||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,10 +20,8 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupFunc)(event_t event) = NULL;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
|
@ -43,11 +41,7 @@ const char * runPopupMenu(event_t event)
|
|||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
#if defined(CPUARM)
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i+(popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)], 0);
|
||||
#else
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i], popupMenuFlags);
|
||||
#endif
|
||||
if (i == s_menu_item) lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
|
||||
}
|
||||
|
||||
|
@ -71,11 +65,7 @@ const char * runPopupMenu(event_t event)
|
|||
}
|
||||
#endif
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
s_menu_item = min<uint8_t>(display_count, MENU_MAX_DISPLAY_LINES) - 1;
|
||||
#else
|
||||
s_menu_item = display_count - 1;
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
if (popupMenuNoItems > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - display_count;
|
||||
|
@ -114,11 +104,7 @@ const char * runPopupMenu(event_t event)
|
|||
CASE_EVT_ROTARY_BREAK
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUARM)
|
||||
result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)];
|
||||
#else
|
||||
result = popupMenuItems[s_menu_item];
|
||||
#endif
|
||||
// no break
|
||||
|
||||
#if defined(CASE_EVT_ROTARY_LONG)
|
||||
|
|
|
@ -83,7 +83,6 @@ void onSdManagerMenu(const char * result)
|
|||
else if (result == STR_SD_FORMAT) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_COPY_FILE) {
|
||||
clipboard.type = CLIPBOARD_TYPE_SD_FILE;
|
||||
f_getcwd(clipboard.data.sd.directory, CLIPBOARD_PATH_LEN);
|
||||
|
@ -111,7 +110,6 @@ void onSdManagerMenu(const char * result)
|
|||
s_editMode = EDIT_MODIFY_STRING;
|
||||
editNameCursorPos = 0;
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_DELETE_FILE) {
|
||||
getSelectionFullPath(lfn);
|
||||
f_unlink(lfn);
|
||||
|
@ -120,13 +118,11 @@ void onSdManagerMenu(const char * result)
|
|||
showStatusLine();
|
||||
REFRESH_FILES();
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
getSelectionFullPath(lfn);
|
||||
audioQueue.stopAll();
|
||||
audioQueue.playFile(lfn, 0, ID_PLAY_FROM_SD_MANAGER);
|
||||
}
|
||||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
else if (result == STR_ASSIGN_BITMAP) {
|
||||
strAppendFilename(g_model.header.bitmap, line, sizeof(g_model.header.bitmap));
|
||||
|
@ -134,12 +130,10 @@ void onSdManagerMenu(const char * result)
|
|||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_VIEW_TEXT) {
|
||||
getSelectionFullPath(lfn);
|
||||
pushMenuTextView(lfn);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
else if (result == STR_FLASH_BOOTLOADER) {
|
||||
getSelectionFullPath(lfn);
|
||||
|
@ -176,9 +170,7 @@ void menuRadioSdManager(event_t _event)
|
|||
#if defined(PCBSKY9X)
|
||||
Card_state = SD_ST_DATA;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
audioQueue.stopSD();
|
||||
#endif
|
||||
if(sdCardFormat()) {
|
||||
f_chdir("/");
|
||||
REFRESH_FILES();
|
||||
|
@ -258,7 +250,6 @@ void menuRadioSdManager(event_t _event)
|
|||
if (!strcmp(line, "..")) {
|
||||
break; // no menu for parent dir
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
const char * ext = getFileExtension(line);
|
||||
if (ext) {
|
||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
|
@ -295,15 +286,12 @@ void menuRadioSdManager(event_t _event)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!READ_ONLY()) {
|
||||
#if defined(CPUARM)
|
||||
if (IS_FILE(line))
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
#endif
|
||||
if (IS_FILE(line))
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
|
@ -404,7 +392,6 @@ void menuRadioSdManager(event_t _event)
|
|||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) {
|
||||
lcdDrawChar(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
||||
uint8_t extlen, efflen;
|
||||
const char * ext = getFileExtension(reusableBuffer.sdmanager.originalName, 0, 0, NULL, &extlen);
|
||||
|
@ -424,9 +411,6 @@ void menuRadioSdManager(event_t _event)
|
|||
else {
|
||||
lcdDrawText(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
}
|
||||
#else
|
||||
lcdDrawText(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
#endif
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) {
|
||||
lcdDrawChar(lcdNextPos, y, ']', s_editMode == EDIT_MODIFY_STRING ? 0 : attr);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
int posHorz = menuHorizontalPosition;
|
||||
|
@ -60,9 +59,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
|
|||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr)
|
||||
{
|
||||
uint8_t mode = 0;
|
||||
|
@ -176,7 +173,6 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
|||
lcdNextPos = backupNextPos;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event)
|
||||
{
|
||||
|
@ -186,11 +182,9 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
|
|||
MD_UNION_TO_WEIGHT(weight, md);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t idx, LcdFlags flags)
|
||||
{
|
||||
char s[8];
|
||||
getGVarString(s, idx);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#define CASE_EVT_ROTARY_RIGHT
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef bool (*IsValueAvailable)(int);
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
|
@ -70,7 +69,6 @@ bool isTelemetryFieldComparisonAvailable(int index);
|
|||
bool isSensorAvailable(int sensor);
|
||||
|
||||
bool modelHasNotes();
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
bool isSwitch2POSWarningStateAvailable(int state);
|
||||
|
@ -88,7 +86,6 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
|||
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "telemetry/telemetry_sensors.h"
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);
|
||||
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
|
||||
|
@ -99,7 +96,6 @@ void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, Lcd
|
|||
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
|
||||
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags flags=0);
|
||||
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
|
||||
#endif
|
||||
|
||||
void drawCurve(coord_t offset=0);
|
||||
|
||||
|
|
|
@ -20,31 +20,6 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(PCBSTD)
|
||||
int16_t getGVarFieldValue(int16_t x, int16_t min, int16_t max)
|
||||
{
|
||||
if (GV_IS_GV_VALUE(x, min, max)) {
|
||||
int8_t idx = GV_INDEX_CALCULATION(x, max);
|
||||
int8_t mul = 1;
|
||||
|
||||
if (idx < 0) {
|
||||
idx = -1-idx;
|
||||
mul = -1;
|
||||
}
|
||||
|
||||
x = GVAR_VALUE(idx, -1) * mul;
|
||||
}
|
||||
|
||||
return limit(min, x, max);
|
||||
}
|
||||
|
||||
void setGVarValue(uint8_t idx, int8_t value)
|
||||
{
|
||||
if (GVAR_VALUE(idx, -1) != value) {
|
||||
SET_GVAR_VALUE(idx, -1, value);
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint8_t gvarDisplayTimer = 0;
|
||||
uint8_t gvarLastChanged = 0;
|
||||
|
||||
|
@ -115,4 +90,3 @@ int32_t getGVarFieldValuePrec1(int16_t val, int16_t min, int16_t max, int8_t fm)
|
|||
}
|
||||
return limit<int>(min*10, val, max*10);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -21,12 +21,6 @@
|
|||
#ifndef _GVARS_H_
|
||||
#define _GVARS_H_
|
||||
|
||||
#if defined(PCBSTD)
|
||||
// GVars are common to all flight modes
|
||||
#define GVAR_VALUE(x, p) g_model.gvars[x]
|
||||
#define SET_GVAR_VALUE(idx, phase, value) \
|
||||
(GVAR_VALUE(idx, phase) = value, storageDirty(EE_MODEL))
|
||||
#else
|
||||
// GVars have one value per flight mode
|
||||
#define GVAR_VALUE(gv, fm) g_model.flightModeData[fm].gvars[gv]
|
||||
#define SET_GVAR_VALUE(idx, phase, value) \
|
||||
|
@ -36,15 +30,8 @@
|
|||
gvarLastChanged = idx; \
|
||||
gvarDisplayTimer = GVAR_DISPLAY_TIME; \
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#if defined(PCBSTD)
|
||||
int16_t getGVarFieldValue(int16_t x, int16_t min, int16_t max);
|
||||
void setGVarValue(uint8_t x, int8_t value);
|
||||
#define GET_GVAR(x, min, max, fm) getGVarFieldValue(x, min, max)
|
||||
#define SET_GVAR(idx, val, fm) setGVarValue(idx, val)
|
||||
#else
|
||||
uint8_t getGVarFlightMode(uint8_t fm, uint8_t gv);
|
||||
int16_t getGVarFieldValue(int16_t x, int16_t min, int16_t max, int8_t fm);
|
||||
int32_t getGVarFieldValuePrec1(int16_t x, int16_t min, int16_t max, int8_t fm);
|
||||
|
@ -57,21 +44,14 @@
|
|||
#define GET_GVAR_PREC1(x, min, max, fm) getGVarFieldValuePrec1(x, min, max, fm)
|
||||
extern uint8_t gvarDisplayTimer;
|
||||
extern uint8_t gvarLastChanged;
|
||||
#endif
|
||||
#else
|
||||
#define GET_GVAR(x, ...) (x)
|
||||
#define GET_GVAR_PREC1(x, ...) (x*10)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GV_GET_GV1_VALUE(max) ((max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? GV1_SMALL : GV1_LARGE)
|
||||
#define GV_INDEX_CALCULATION(x,max) ((max<=GV_RANGESMALL && min>=GV_RANGESMALL_NEG) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE))
|
||||
#define GV_IS_GV_VALUE(x,min,max) ((max>GV1_SMALL || min<-GV1_SMALL) ? (x>GV_RANGELARGE || x<GV_RANGELARGE_NEG) : (x>max) || (x<min))
|
||||
#else
|
||||
#define GV_GET_GV1_VALUE(max) ((max<=GV_RANGESMALL) ? GV1_SMALL : GV1_LARGE)
|
||||
#define GV_INDEX_CALCULATION(x,max) ((max<=GV1_SMALL) ? (uint8_t) x-GV1_SMALL : ((x&(GV1_LARGE*2-1))-GV1_LARGE))
|
||||
#define GV_IS_GV_VALUE(x,min,max) ((x>max) || (x<min) )
|
||||
#endif
|
||||
|
||||
#define GV_INDEX_CALC_DELTA(x,delta) ((x&(delta*2-1)) - delta)
|
||||
|
||||
|
@ -83,7 +63,6 @@
|
|||
#define GV_RANGELARGE (GV1_LARGE - (RESERVE_RANGE_FOR_GVARS+1))
|
||||
#define GV_RANGELARGE_NEG (-GV1_LARGE + (RESERVE_RANGE_FOR_GVARS+1))
|
||||
|
||||
#if defined(CPUARM)
|
||||
// the define GV1_LARGE marks the highest bit value used for this variables
|
||||
// because this would give too big numbers for ARM, we limit it further for
|
||||
// offset and weight
|
||||
|
@ -91,12 +70,5 @@
|
|||
#define GV_RANGELARGE_WEIGHT_NEG (-GV_RANGE_WEIGHT)
|
||||
#define GV_RANGELARGE_OFFSET (GV_RANGE_OFFSET)
|
||||
#define GV_RANGELARGE_OFFSET_NEG (-GV_RANGE_OFFSET)
|
||||
#else
|
||||
// for stock we just use as much as possible
|
||||
#define GV_RANGELARGE_WEIGHT GV_RANGELARGE
|
||||
#define GV_RANGELARGE_WEIGHT_NEG GV_RANGELARGE_NEG
|
||||
#define GV_RANGELARGE_OFFSET GV_RANGELARGE
|
||||
#define GV_RANGELARGE_OFFSET_NEG GV_RANGELARGE_NEG
|
||||
#endif
|
||||
|
||||
#endif // _GVARS_H_
|
|
@ -42,7 +42,6 @@ event_t s_evt;
|
|||
struct t_inactivity inactivity = {0};
|
||||
Key keys[NUM_KEYS];
|
||||
|
||||
#if defined(CPUARM)
|
||||
event_t getEvent(bool trim)
|
||||
{
|
||||
event_t evt = s_evt;
|
||||
|
@ -57,14 +56,6 @@ event_t getEvent(bool trim)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
#else
|
||||
event_t getEvent()
|
||||
{
|
||||
event_t evt = s_evt;
|
||||
s_evt = 0;
|
||||
return evt;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Key::input(bool val)
|
||||
{
|
||||
|
@ -185,7 +176,6 @@ void killEvents(event_t event)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool clearKeyEvents()
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
|
@ -217,24 +207,3 @@ bool clearKeyEvents()
|
|||
putEvent(0);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
void clearKeyEvents()
|
||||
{
|
||||
// loop until all keys are up
|
||||
while (keyDown()) {
|
||||
|
||||
#if defined(SIMU)
|
||||
SIMU_SLEEP(1/*ms*/);
|
||||
#else
|
||||
wdt_reset();
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(ROTARY_ENCODER_NAVIGATION) && !defined(TELEMETREZ)
|
||||
rotencPoll();
|
||||
#endif
|
||||
}
|
||||
|
||||
memclear(keys, sizeof(keys));
|
||||
putEvent(0);
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
|
|
@ -108,15 +108,9 @@ extern event_t s_evt;
|
|||
void pauseEvents(event_t event);
|
||||
void killEvents(event_t event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool clearKeyEvents();
|
||||
event_t getEvent(bool trim=false);
|
||||
bool keyDown();
|
||||
#else
|
||||
void clearKeyEvents();
|
||||
event_t getEvent();
|
||||
uint8_t keyDown();
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -124,13 +124,6 @@ void logsClose()
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
getvalue_t getConvertedTelemetryValue(getvalue_t val, uint8_t unit)
|
||||
{
|
||||
convertUnit(val, unit);
|
||||
return val;
|
||||
}
|
||||
#endif
|
||||
|
||||
void writeHeader()
|
||||
{
|
||||
|
@ -141,23 +134,7 @@ void writeHeader()
|
|||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#if !defined(CPUARM)
|
||||
f_puts("Buffer,RX,TX,A1,A2,", &g_oLogFile);
|
||||
#if defined(FRSKY_HUB)
|
||||
if (IS_USR_PROTO_FRSKY_HUB()) {
|
||||
f_puts("GPS Date,GPS Time,Long,Lat,Course,GPS Speed(kts),GPS Alt,Baro Alt(", &g_oLogFile);
|
||||
f_puts(TELEMETRY_BARO_ALT_UNIT, &g_oLogFile);
|
||||
f_puts("),Vertical Speed,Air Speed(kts),Temp1,Temp2,RPM,Fuel," TELEMETRY_CELLS_LABEL "Current,Consumption,Vfas,AccelX,AccelY,AccelZ,", &g_oLogFile);
|
||||
}
|
||||
#endif
|
||||
#if defined(WS_HOW_HIGH)
|
||||
if (IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
f_puts("WSHH Alt,", &g_oLogFile);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
char label[TELEM_LABEL_LEN+7];
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
|
@ -178,7 +155,6 @@ void writeHeader()
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
for (uint8_t i=1; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS+1; i++) {
|
||||
|
@ -249,59 +225,7 @@ void logsWrite()
|
|||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#if !defined(CPUARM)
|
||||
f_printf(&g_oLogFile, "%d,%d,%d,", telemetryStreaming, RAW_FRSKY_MINMAX(telemetryData.rssi[0]), RAW_FRSKY_MINMAX(telemetryData.rssi[1]));
|
||||
for (uint8_t i=0; i<MAX_FRSKY_A_CHANNELS; i++) {
|
||||
int16_t converted_value = applyChannelRatio(i, RAW_FRSKY_MINMAX(telemetryData.analog[i]));
|
||||
f_printf(&g_oLogFile, "%d.%02d,", converted_value/100, converted_value%100);
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
TELEMETRY_BARO_ALT_PREPARE();
|
||||
|
||||
if (IS_USR_PROTO_FRSKY_HUB()) {
|
||||
f_printf(&g_oLogFile, "%4d-%02d-%02d,%02d:%02d:%02d,%03d.%04d%c,%03d.%04d%c,%03d.%02d," TELEMETRY_GPS_SPEED_FORMAT TELEMETRY_GPS_ALT_FORMAT TELEMETRY_BARO_ALT_FORMAT TELEMETRY_VSPEED_FORMAT TELEMETRY_ASPEED_FORMAT "%d,%d,%d,%d," TELEMETRY_CELLS_FORMAT TELEMETRY_CURRENT_FORMAT "%d," TELEMETRY_VFAS_FORMAT "%d,%d,%d,",
|
||||
telemetryData.hub.year+2000,
|
||||
telemetryData.hub.month,
|
||||
telemetryData.hub.day,
|
||||
telemetryData.hub.hour,
|
||||
telemetryData.hub.min,
|
||||
telemetryData.hub.sec,
|
||||
telemetryData.hub.gpsLongitude_bp,
|
||||
telemetryData.hub.gpsLongitude_ap,
|
||||
telemetryData.hub.gpsLongitudeEW ? telemetryData.hub.gpsLongitudeEW : '-',
|
||||
telemetryData.hub.gpsLatitude_bp,
|
||||
telemetryData.hub.gpsLatitude_ap,
|
||||
telemetryData.hub.gpsLatitudeNS ? telemetryData.hub.gpsLatitudeNS : '-',
|
||||
telemetryData.hub.gpsCourse_bp,
|
||||
telemetryData.hub.gpsCourse_ap,
|
||||
TELEMETRY_GPS_SPEED_ARGS
|
||||
TELEMETRY_GPS_ALT_ARGS
|
||||
TELEMETRY_BARO_ALT_ARGS
|
||||
TELEMETRY_VSPEED_ARGS
|
||||
TELEMETRY_ASPEED_ARGS
|
||||
telemetryData.hub.temperature1,
|
||||
telemetryData.hub.temperature2,
|
||||
telemetryData.hub.rpm,
|
||||
telemetryData.hub.fuelLevel,
|
||||
TELEMETRY_CELLS_ARGS
|
||||
TELEMETRY_CURRENT_ARGS
|
||||
telemetryData.hub.currentConsumption,
|
||||
TELEMETRY_VFAS_ARGS
|
||||
telemetryData.hub.accelX,
|
||||
telemetryData.hub.accelY,
|
||||
telemetryData.hub.accelZ);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WS_HOW_HIGH)
|
||||
if (IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
f_printf(&g_oLogFile, "%d,", TELEMETRY_RELATIVE_BARO_ALT_BP);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
|
@ -339,7 +263,6 @@ void logsWrite()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
|
|
|
@ -20,86 +20,6 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if !defined(CPUARM)
|
||||
// #define CORRECT_NEGATIVE_SHIFTS
|
||||
// open.20.fsguruh; shift right operations do the rounding different for negative values compared to positive values
|
||||
// so all negative divisions round always further down, which give absolute values bigger compared to a usual division
|
||||
// this is noticable on the display, because instead of -100.0 -99.9 is shown; While in praxis I doublt somebody will notice a
|
||||
// difference this is more a mental thing. Maybe people are distracted, because the easy calculations are obviously wrong
|
||||
// this define would correct this, but costs 34 bytes code for stock version
|
||||
|
||||
// currently we set this to active always, because it might cause a fault about 1% compared positive and negative values
|
||||
// is done now in makefile
|
||||
|
||||
int16_t calc100to256_16Bits(int16_t x) // return x*2.56
|
||||
{
|
||||
// y = 2*x + x/2 +x/16-x/512-x/2048
|
||||
// 512 and 2048 are out of scope from int8 input --> forget it
|
||||
#ifdef CORRECT_NEGATIVE_SHIFTS
|
||||
int16_t res=(int16_t)x<<1;
|
||||
//int8_t sign=(uint8_t) x>>7;
|
||||
int8_t sign=(x<0?1:0);
|
||||
|
||||
x-=sign;
|
||||
res+=(x>>1);
|
||||
res+=sign;
|
||||
res+=(x>>4);
|
||||
res+=sign;
|
||||
return res;
|
||||
#else
|
||||
return ((int16_t)x<<1)+(x>>1)+(x>>4);
|
||||
#endif
|
||||
}
|
||||
|
||||
int16_t calc100to256(int8_t x) // return x*2.56
|
||||
{
|
||||
return calc100to256_16Bits(x);
|
||||
}
|
||||
|
||||
int16_t calc100toRESX_16Bits(int16_t x) // return x*10.24
|
||||
{
|
||||
#ifdef CORRECT_NEGATIVE_SHIFTS
|
||||
int16_t res= ((int16_t)x*41)>>2;
|
||||
int8_t sign=(x<0?1:0);
|
||||
//int8_t sign=(uint8_t) x>>7;
|
||||
x-=sign;
|
||||
res-=(x>>6);
|
||||
res-=sign;
|
||||
return res;
|
||||
#else
|
||||
// return (int16_t)x*10 + x/4 - x/64;
|
||||
return ((x*41)>>2) - (x>>6);
|
||||
#endif
|
||||
}
|
||||
|
||||
int16_t calc100toRESX(int8_t x) // return x*10.24
|
||||
{
|
||||
return calc100toRESX_16Bits(x);
|
||||
}
|
||||
|
||||
// return x*1.024
|
||||
int16_t calc1000toRESX(int16_t x) // improve calc time by Pat MacKenzie
|
||||
{
|
||||
// return x + x/32 - x/128 + x/512;
|
||||
int16_t y = x>>5;
|
||||
x+=y;
|
||||
y=y>>2;
|
||||
x-=y;
|
||||
return x+(y>>2);
|
||||
}
|
||||
|
||||
int16_t calcRESXto1000(int16_t x) // return x/1.024
|
||||
{
|
||||
// *1000/1024 = x - x/32 + x/128
|
||||
return (x - (x>>5) + (x>>7));
|
||||
}
|
||||
|
||||
int8_t calcRESXto100(int16_t x)
|
||||
{
|
||||
return (x*25) >> 8;
|
||||
}
|
||||
#endif
|
||||
#if defined(HELI) || defined(FRSKY_HUB) || defined(CPUARM)
|
||||
uint16_t isqrt32(uint32_t n)
|
||||
{
|
||||
uint16_t c = 0x8000;
|
||||
|
@ -114,7 +34,6 @@ uint16_t isqrt32(uint32_t n)
|
|||
g |= c;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Division by 10 and rounding or fixed point arithmetic values
|
||||
|
@ -127,60 +46,7 @@ uint16_t isqrt32(uint32_t n)
|
|||
-204 -> -20
|
||||
*/
|
||||
|
||||
#if defined(FRSKY_HUB) && !defined(CPUARM)
|
||||
// convert latitude and longitude to 1/10^6 degrees
|
||||
void extractLatitudeLongitude(uint32_t * latitude, uint32_t * longitude)
|
||||
{
|
||||
div_t qr = div(telemetryData.hub.gpsLatitude_bp, 100);
|
||||
*latitude = ((uint32_t)(qr.quot) * 1000000) + (((uint32_t)(qr.rem) * 10000 + telemetryData.hub.gpsLatitude_ap) * 5) / 3;
|
||||
|
||||
qr = div(telemetryData.hub.gpsLongitude_bp, 100);
|
||||
*longitude = ((uint32_t)(qr.quot) * 1000000) + (((uint32_t)(qr.rem) * 10000 + telemetryData.hub.gpsLongitude_ap) * 5) / 3;
|
||||
}
|
||||
|
||||
#if __clang__
|
||||
// clang does not like packed member access at all. Since mavlink is a 3rd party library, ignore the errors
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic warning "-Waddress-of-packed-member"
|
||||
#endif
|
||||
void getGpsPilotPosition()
|
||||
{
|
||||
extractLatitudeLongitude(&telemetryData.hub.pilotLatitude, &telemetryData.hub.pilotLongitude);
|
||||
// distFromEarthAxis = cos(lat) * EARTH_RADIUS
|
||||
// 1 - x2/2 + x4/24
|
||||
uint32_t lat = telemetryData.hub.pilotLatitude / 10000;
|
||||
uint32_t angle2 = (lat*lat) / 10000;
|
||||
uint32_t angle4 = angle2 * angle2;
|
||||
telemetryData.hub.distFromEarthAxis = 139 * (((uint32_t)10000000-((angle2*(uint32_t)123370)/81)+(angle4/25)) / 12500);
|
||||
// TRACE("telemetryData.hub.distFromEarthAxis=%d", telemetryData.hub.distFromEarthAxis);
|
||||
}
|
||||
|
||||
void getGpsDistance()
|
||||
{
|
||||
uint32_t lat, lng;
|
||||
|
||||
extractLatitudeLongitude(&lat, &lng);
|
||||
|
||||
// printf("lat=%d (%d), long=%d (%d)\n", lat, abs(lat - telemetryData.hub.pilotLatitude), lng, abs(lng - telemetryData.hub.pilotLongitude));
|
||||
|
||||
uint32_t angle = (lat > telemetryData.hub.pilotLatitude) ? lat - telemetryData.hub.pilotLatitude : telemetryData.hub.pilotLatitude - lat;
|
||||
uint32_t dist = EARTH_RADIUS * angle / 1000000;
|
||||
uint32_t result = dist*dist;
|
||||
|
||||
angle = (lng > telemetryData.hub.pilotLongitude) ? lng - telemetryData.hub.pilotLongitude : telemetryData.hub.pilotLongitude - lng;
|
||||
dist = telemetryData.hub.distFromEarthAxis * angle / 1000000;
|
||||
result += dist*dist;
|
||||
|
||||
dist = abs(TELEMETRY_BARO_ALT_AVAILABLE() ? TELEMETRY_RELATIVE_BARO_ALT_BP : TELEMETRY_RELATIVE_GPS_ALT_BP);
|
||||
result += dist*dist;
|
||||
|
||||
telemetryData.hub.gpsDistance = isqrt32(result);
|
||||
if (telemetryData.hub.gpsDistance > telemetryData.hub.maxGpsDistance)
|
||||
telemetryData.hub.maxGpsDistance = telemetryData.hub.gpsDistance;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
// djb2 hash algorithm
|
||||
uint32_t hash(const void * ptr, uint32_t size)
|
||||
{
|
||||
|
@ -191,4 +57,3 @@ uint32_t hash(const void * ptr, uint32_t size)
|
|||
}
|
||||
return hash;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -193,29 +193,13 @@ void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS)
|
|||
cur_chn = ed->chn;
|
||||
|
||||
//========== CURVE=================
|
||||
#if defined(CPUARM)
|
||||
if (ed->curve.value) {
|
||||
v = applyCurve(v, ed->curve);
|
||||
}
|
||||
#else
|
||||
int8_t curveParam = ed->curveParam;
|
||||
if (curveParam) {
|
||||
if (ed->curveMode == MODE_CURVE)
|
||||
v = applyCurve(v, curveParam);
|
||||
else
|
||||
v = expo(v, GET_GVAR(curveParam, -100, 100, mixerCurrentFlightMode));
|
||||
}
|
||||
#endif
|
||||
|
||||
//========== WEIGHT ===============
|
||||
#if defined(CPUARM)
|
||||
int32_t weight = GET_GVAR_PREC1(ed->weight, MIN_EXPO_WEIGHT, 100, mixerCurrentFlightMode);
|
||||
v = div_and_round((int32_t)v * weight, 1000);
|
||||
#else
|
||||
int16_t weight = GET_GVAR(ed->weight, MIN_EXPO_WEIGHT, 100, mixerCurrentFlightMode);
|
||||
weight = calc100to256(weight);
|
||||
v = ((int32_t)v * weight) >> 8;
|
||||
#endif
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
//========== OFFSET ===============
|
||||
|
@ -425,7 +409,6 @@ getvalue_t getValue(mixsrc_t i)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
else if (i == MIXSRC_TX_VOLTAGE) {
|
||||
return g_vbat100mV;
|
||||
}
|
||||
|
@ -440,16 +423,7 @@ getvalue_t getValue(mixsrc_t i)
|
|||
else if (i <= MIXSRC_LAST_TIMER) {
|
||||
return timersStates[i-MIXSRC_FIRST_TIMER].val;
|
||||
}
|
||||
#else
|
||||
else if (i == MIXSRC_FIRST_TELEM-1+TELEM_TX_VOLTAGE) {
|
||||
return g_vbat100mV;
|
||||
}
|
||||
else if (i <= MIXSRC_FIRST_TELEM-1+TELEM_TIMER2) {
|
||||
return timersStates[i-MIXSRC_FIRST_TELEM+1-TELEM_TIMER1].val;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
else if (i <= MIXSRC_LAST_TELEM) {
|
||||
if(IS_FAI_FORBIDDEN(i)) {
|
||||
return 0;
|
||||
|
@ -466,42 +440,6 @@ getvalue_t getValue(mixsrc_t i)
|
|||
return telemetryItem.value;
|
||||
}
|
||||
}
|
||||
#elif defined(TELEMETRY_FRSKY)
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_RSSI_TX) return telemetryData.rssi[1].value;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_RSSI_RX) return telemetryData.rssi[0].value;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_A1) return telemetryData.analog[TELEM_ANA_A1].value;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_A2) return telemetryData.analog[TELEM_ANA_A2].value;
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ALT) return telemetryData.hub.baroAltitude;
|
||||
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ALT) return TELEMETRY_RELATIVE_BARO_ALT_BP;
|
||||
#endif
|
||||
#if defined(FRSKY_HUB)
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_RPM) return telemetryData.hub.rpm;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_FUEL) return telemetryData.hub.fuelLevel;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_T1) return telemetryData.hub.temperature1;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_T2) return telemetryData.hub.temperature2;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_SPEED) return TELEMETRY_GPS_SPEED_BP;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_DIST) return telemetryData.hub.gpsDistance;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_GPSALT) return TELEMETRY_RELATIVE_GPS_ALT_BP;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_CELL) return (int16_t)TELEMETRY_MIN_CELL_VOLTAGE;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_CELLS_SUM) return (int16_t)telemetryData.hub.cellsSum;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_VFAS) return (int16_t)telemetryData.hub.vfas;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_CURRENT) return (int16_t)telemetryData.hub.current;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_CONSUMPTION) return telemetryData.hub.currentConsumption;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_POWER) return telemetryData.hub.power;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ACCx) return telemetryData.hub.accelX;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ACCy) return telemetryData.hub.accelY;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ACCz) return telemetryData.hub.accelZ;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_HDG) return telemetryData.hub.gpsCourse_bp;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_VSPEED) return telemetryData.hub.varioSpeed;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_ASPEED) return telemetryData.hub.airSpeed;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_DTE) return telemetryData.hub.dTE;
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_MIN_A1) return telemetryData.analog[TELEM_ANA_A1].min;
|
||||
else if (i==MIXSRC_FIRST_TELEM-1+TELEM_MIN_A2) return telemetryData.analog[TELEM_ANA_A2].min;
|
||||
else if (i<=MIXSRC_FIRST_TELEM-1+TELEM_CSW_MAX) return *(((int16_t*)(&telemetryData.hub.minAltitude))+i-(MIXSRC_FIRST_TELEM-1+TELEM_MIN_ALT));
|
||||
#endif
|
||||
#endif
|
||||
else return 0;
|
||||
}
|
||||
|
||||
|
@ -550,7 +488,6 @@ void evalInputs(uint8_t mode)
|
|||
|
||||
// filtering for center beep
|
||||
uint8_t tmp = (uint16_t)abs(v) / 16;
|
||||
#if defined(CPUARM)
|
||||
if (mode == e_perout_mode_normal) {
|
||||
if (tmp==0 || (tmp==1 && (bpanaCenter & mask))) {
|
||||
anaCenter |= mask;
|
||||
|
@ -561,9 +498,6 @@ void evalInputs(uint8_t mode)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (tmp <= 1) anaCenter |= (tmp==0 ? mask : (bpanaCenter & mask));
|
||||
#endif
|
||||
|
||||
if (ch < NUM_STICKS) { // only do this for sticks
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
|
@ -635,10 +569,6 @@ void evalInputs(uint8_t mode)
|
|||
evalTrims(); // when no virtual inputs, the trims need the anas array calculated above (when throttle trim enabled)
|
||||
|
||||
if (mode == e_perout_mode_normal) {
|
||||
#if !defined(CPUARM)
|
||||
anaCenter &= g_model.beepANACenter;
|
||||
if (((bpanaCenter ^ anaCenter) & anaCenter)) AUDIO_POT_MIDDLE();
|
||||
#endif
|
||||
bpanaCenter = anaCenter;
|
||||
}
|
||||
}
|
||||
|
@ -928,14 +858,8 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
int32_t weight = GET_GVAR_PREC1(MD_WEIGHT(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
weight = calc100to256_16Bits(weight);
|
||||
#else
|
||||
// saves 12 bytes code if done here and not together with weight; unknown reason
|
||||
int16_t weight = GET_GVAR(MD_WEIGHT(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
weight = calc100to256_16Bits(weight);
|
||||
#endif
|
||||
//========== SPEED ===============
|
||||
// now its on input side, but without weight compensation. More like other remote controls
|
||||
// lower weight causes slower movement
|
||||
|
@ -978,48 +902,24 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
|||
}
|
||||
|
||||
//========== CURVES ===============
|
||||
#if defined(CPUARM)
|
||||
if (apply_offset_and_curve && md->curve.type != CURVE_REF_DIFF && md->curve.value) {
|
||||
v = applyCurve(v, md->curve);
|
||||
}
|
||||
#else
|
||||
if (apply_offset_and_curve && md->curveParam && md->curveMode == MODE_CURVE) {
|
||||
v = applyCurve(v, md->curveParam);
|
||||
}
|
||||
#endif
|
||||
|
||||
//========== WEIGHT ===============
|
||||
int32_t dv = (int32_t)v * weight;
|
||||
#if defined(CPUARM)
|
||||
dv = div_and_round(dv, 10);
|
||||
#endif
|
||||
|
||||
//========== OFFSET / AFTER ===============
|
||||
if (apply_offset_and_curve) {
|
||||
#if defined(CPUARM)
|
||||
int32_t offset = GET_GVAR_PREC1(MD_OFFSET(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
if (offset) dv += div_and_round(calc100toRESX_16Bits(offset), 10) << 8;
|
||||
#else
|
||||
int16_t offset = GET_GVAR(MD_OFFSET(md), GV_RANGELARGE_NEG, GV_RANGELARGE, mixerCurrentFlightMode);
|
||||
if (offset) dv += int32_t(calc100toRESX_16Bits(offset)) << 8;
|
||||
#endif
|
||||
}
|
||||
|
||||
//========== DIFFERENTIAL =========
|
||||
#if defined(CPUARM)
|
||||
if (md->curve.type == CURVE_REF_DIFF && md->curve.value) {
|
||||
dv = applyCurve(dv, md->curve);
|
||||
}
|
||||
#else
|
||||
if (md->curveMode == MODE_DIFFERENTIAL) {
|
||||
// @@@2 also recalculate curveParam to a 256 basis which ease the calculation later a lot
|
||||
int16_t curveParam = calc100to256(GET_GVAR(md->curveParam, -100, 100, mixerCurrentFlightMode));
|
||||
if (curveParam > 0 && dv < 0)
|
||||
dv = (dv * (256 - curveParam)) >> 8;
|
||||
else if (curveParam < 0 && dv > 0)
|
||||
dv = (dv * (256 + curveParam)) >> 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t * ptr = &chans[md->destCh]; // Save calculating address several times
|
||||
|
||||
|
@ -1100,17 +1000,12 @@ void evalFlightModeMixes(uint8_t mode, uint8_t tick10ms)
|
|||
#define MAX_ACT 0xffff
|
||||
uint8_t lastFlightMode = 255; // TODO reinit everything here when the model changes, no???
|
||||
|
||||
#if defined(CPUARM)
|
||||
tmr10ms_t flightModeTransitionTime;
|
||||
uint8_t flightModeTransitionLast = 255;
|
||||
#endif
|
||||
|
||||
void evalMixes(uint8_t tick10ms)
|
||||
{
|
||||
int32_t sum_chans512[MAX_OUTPUT_CHANNELS];
|
||||
#if defined(PCBMEGA2560) && defined(DEBUG) && !defined(VOICE)
|
||||
PORTH |= 0x40; // PORTH:6 LOW->HIGH signals start of mixer interrupt
|
||||
#endif
|
||||
|
||||
static uint16_t fp_act[MAX_FLIGHT_MODES] = {0};
|
||||
static uint16_t delta = 0;
|
||||
|
@ -1121,9 +1016,7 @@ void evalMixes(uint8_t tick10ms)
|
|||
uint8_t fm = getFlightMode();
|
||||
|
||||
if (lastFlightMode != fm) {
|
||||
#if defined(CPUARM)
|
||||
flightModeTransitionTime = get_tmr10ms();
|
||||
#endif
|
||||
|
||||
if (lastFlightMode == 255) {
|
||||
fp_act[fm] = MAX_ACT;
|
||||
|
@ -1140,14 +1033,11 @@ void evalMixes(uint8_t tick10ms)
|
|||
fp_act[lastFlightMode] = 0;
|
||||
fp_act[fm] = MAX_ACT;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
logicalSwitchesCopyState(lastFlightMode, fm); // push last logical switches state from old to new flight mode
|
||||
#endif
|
||||
}
|
||||
lastFlightMode = fm;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (flightModeTransitionTime && get_tmr10ms() > flightModeTransitionTime+SWITCHES_DELAY()) {
|
||||
flightModeTransitionTime = 0;
|
||||
if (fm != flightModeTransitionLast) {
|
||||
|
@ -1158,7 +1048,6 @@ void evalMixes(uint8_t tick10ms)
|
|||
flightModeTransitionLast = fm;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t weight = 0;
|
||||
if (flightModesFade) {
|
||||
|
@ -1190,14 +1079,10 @@ void evalMixes(uint8_t tick10ms)
|
|||
requiredSpeakerVolume = g_eeGeneral.speakerVolume + VOLUME_LEVEL_DEF;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (!g_model.noGlobalFunctions) {
|
||||
evalFunctions(g_eeGeneral.customFn, globalFunctionsContext);
|
||||
}
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext);
|
||||
#else
|
||||
evalFunctions();
|
||||
#endif
|
||||
}
|
||||
|
||||
//========== LIMITS ===============
|
||||
|
@ -1209,11 +1094,7 @@ void evalMixes(uint8_t tick10ms)
|
|||
// this limits based on v original values and min=-1024, max=1024 RESX=1024
|
||||
int32_t q = (flightModesFade ? (sum_chans512[i] / weight) << 4 : chans[i]);
|
||||
|
||||
#if defined(PCBSTD)
|
||||
ex_chans[i] = q >> 8;
|
||||
#else
|
||||
ex_chans[i] = q / 256;
|
||||
#endif
|
||||
|
||||
int16_t value = applyLimits(i, q); // applyLimits will remove the 256 100% basis
|
||||
|
||||
|
@ -1247,7 +1128,4 @@ void evalMixes(uint8_t tick10ms)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUM2560) && defined(DEBUG) && !defined(VOICE)
|
||||
PORTH &= ~0x40; // PORTH:6 HIGH->LOW signals end of mixer interrupt
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -35,17 +35,8 @@
|
|||
#define WARN_MEM (!(g_eeGeneral.warnOpts & WARN_MEM_BIT))
|
||||
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EEPROM_VER 218
|
||||
#define FIRST_CONV_EEPROM_VER 216
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
#define EEPROM_VER 217
|
||||
#define FIRST_CONV_EEPROM_VER EEPROM_VER
|
||||
#elif defined(CPUM128)
|
||||
#define EEPROM_VER 217
|
||||
#else
|
||||
#define EEPROM_VER 216
|
||||
#endif
|
||||
|
||||
#define GET_PPM_POLARITY(idx) g_model.moduleData[idx].ppm.pulsePol
|
||||
#define GET_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
|
||||
|
@ -68,13 +59,8 @@
|
|||
#define IS_PLAY_FUNC(func) ((func) == FUNC_PLAY_SOUND)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_PLAY_BOTH_FUNC(func) (0)
|
||||
#define IS_VOLUME_FUNC(func) ((func) == FUNC_VOLUME)
|
||||
#else
|
||||
#define IS_PLAY_BOTH_FUNC(func) ((func) == FUNC_PLAY_BOTH)
|
||||
#define IS_VOLUME_FUNC(func) (0)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#define IS_ADJUST_GV_FUNC(func) ((func) == FUNC_ADJUST_GVAR)
|
||||
|
@ -91,7 +77,6 @@
|
|||
#define HAS_ENABLE_PARAM(func) ((func) < FUNC_FIRST_WITHOUT_ENABLE)
|
||||
#define HAS_REPEAT_PARAM(func) (IS_PLAY_FUNC(func) || IS_HAPTIC_FUNC(func))
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CFN_EMPTY(p) (!(p)->swtch)
|
||||
#define CFN_SWITCH(p) ((p)->swtch)
|
||||
#define CFN_FUNC(p) ((p)->func)
|
||||
|
@ -109,33 +94,6 @@
|
|||
#define CFN_GVAR_CST_MAX GVAR_MAX
|
||||
#define MODEL_GVAR_MIN(idx) (CFN_GVAR_CST_MIN + g_model.gvars[idx].min)
|
||||
#define MODEL_GVAR_MAX(idx) (CFN_GVAR_CST_MAX - g_model.gvars[idx].max)
|
||||
#elif defined(CPUM2560)
|
||||
#define CFN_SWITCH(p) ((p)->swtch)
|
||||
#define CFN_FUNC(p) ((p)->func)
|
||||
#define CFN_ACTIVE(p) ((p)->active)
|
||||
#define CFN_CH_INDEX(p) ((p)->param)
|
||||
#define CFN_TIMER_INDEX(p) ((p)->param)
|
||||
#define CFN_GVAR_INDEX(p) ((p)->param)
|
||||
#define CFN_PLAY_REPEAT(p) ((p)->param)
|
||||
#define CFN_PLAY_REPEAT_MUL 10
|
||||
#define CFN_GVAR_MODE(p) ((p)->mode)
|
||||
#define CFN_PARAM(p) ((p)->value)
|
||||
#define CFN_RESET(p) ((p)->active = 0, CFN_PARAM(p) = 0)
|
||||
#define CFN_GVAR_CST_MAX 125
|
||||
#else
|
||||
#define CFN_SWITCH(p) ((p)->all.swtch)
|
||||
#define CFN_FUNC(p) ((p)->all.func)
|
||||
#define CFN_ACTIVE(p) ((p)->all.active)
|
||||
#define CFN_CH_INDEX(p) ((p)->all.param)
|
||||
#define CFN_TIMER_INDEX(p) ((p)->all.param)
|
||||
#define CFN_GVAR_INDEX(p) ((p)->gvar.param)
|
||||
#define CFN_PLAY_REPEAT(p) ((p)->all.param)
|
||||
#define CFN_PLAY_REPEAT_MUL 10
|
||||
#define CFN_GVAR_MODE(p) ((p)->gvar.mode)
|
||||
#define CFN_PARAM(p) ((p)->value)
|
||||
#define CFN_RESET(p) ((p)->all.active = 0, CFN_PARAM(p) = 0)
|
||||
#define CFN_GVAR_CST_MAX 125
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
enum SwitchConfig {
|
||||
|
@ -187,27 +145,11 @@ enum CurveRefType {
|
|||
CURVE_REF_CUSTOM
|
||||
};
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#define MODE_DIFFERENTIAL 0
|
||||
#define MODE_EXPO 0
|
||||
#define MODE_CURVE 1
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MIN_EXPO_WEIGHT -100
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||
#define MIN_EXPO_WEIGHT 0
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#else
|
||||
#define MIN_EXPO_WEIGHT 0
|
||||
#define EXPO_VALID(ed) ((ed)->mode)
|
||||
#define EXPO_MODE_ENABLE(ed, v) (((v)<0 && ((ed)->mode&1)) || ((v)>=0 && ((ed)->mode&2)))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define limit_min_max_t int16_t
|
||||
#define LIMIT_EXT_PERCENT 150
|
||||
#define LIMIT_EXT_MAX (LIMIT_EXT_PERCENT*10)
|
||||
|
@ -218,18 +160,6 @@ enum CurveRefType {
|
|||
#define LIMIT_MAX_RESX(lim) calc1000toRESX(LIMIT_MAX(lim))
|
||||
#define LIMIT_MIN_RESX(lim) calc1000toRESX(LIMIT_MIN(lim))
|
||||
#define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
|
||||
#else
|
||||
#define limit_min_max_t int8_t
|
||||
#define LIMIT_EXT_PERCENT 125
|
||||
#define LIMIT_EXT_MAX LIMIT_EXT_PERCENT
|
||||
#define PPM_CENTER_MAX 125
|
||||
#define LIMIT_MAX(lim) (lim->max+100)
|
||||
#define LIMIT_MIN(lim) (lim->min-100)
|
||||
#define LIMIT_OFS(lim) (lim->offset)
|
||||
#define LIMIT_MAX_RESX(lim) calc100toRESX(LIMIT_MAX(lim))
|
||||
#define LIMIT_MIN_RESX(lim) calc100toRESX(LIMIT_MIN(lim))
|
||||
#define LIMIT_OFS_RESX(lim) calc1000toRESX(LIMIT_OFS(lim))
|
||||
#endif
|
||||
|
||||
#define TRIM_OFF (1)
|
||||
#define TRIM_ON (0)
|
||||
|
@ -249,7 +179,6 @@ enum CurveRefType {
|
|||
#define MLTPX_MUL 1
|
||||
#define MLTPX_REP 2
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GV1_SMALL 128
|
||||
#define GV1_LARGE 1024
|
||||
#define GV_RANGE_WEIGHT 500
|
||||
|
@ -268,64 +197,20 @@ enum CurveRefType {
|
|||
#define MD_UNION_TO_OFFSET(var, md) md->offset = var.word
|
||||
// #define MD_SETOFFSET(md, val) md->offset = val
|
||||
|
||||
#else
|
||||
|
||||
// highest bit used for small values in mix 128 --> 8 bit is enough
|
||||
#define GV1_SMALL 128
|
||||
// highest bit used for large values in mix 256 --> 9 bits is used (8 bits + 1 extra bit from weightMode/offsetMode)
|
||||
#define GV1_LARGE 256
|
||||
|
||||
#define DELAY_STEP 2
|
||||
#define SLOW_STEP 2
|
||||
#define DELAY_MAX 15 /* 7.5 seconds */
|
||||
#define SLOW_MAX 15 /* 7.5 seconds */
|
||||
|
||||
PACK(union u_gvarint_t {
|
||||
struct {
|
||||
int8_t lo;
|
||||
uint8_t hi;
|
||||
} bytes_t;
|
||||
int16_t word;
|
||||
|
||||
u_gvarint_t(int8_t l, uint8_t h) {bytes_t.lo=l; bytes_t.hi=h?255:0;} // hi bit is negativ sign
|
||||
|
||||
private:
|
||||
// prevent unwanted constructors, also saves program
|
||||
u_gvarint_t() {}
|
||||
u_gvarint_t(const u_gvarint_t&) {}
|
||||
});
|
||||
#define MD_WEIGHT(md) (u_gvarint_t(md->weight,md->weightMode).word)
|
||||
|
||||
#define MD_WEIGHT_TO_UNION(md, var) var.bytes_t.lo=md->weight; var.bytes_t.hi=md->weightMode?255:0
|
||||
#define MD_UNION_TO_WEIGHT(var, md) md->weight=var.bytes_t.lo; if (var.word<0) md->weightMode=1; else md->weightMode=0
|
||||
// #define MD_SETWEIGHT(md, val) md->weight=val; if (val<0) md->weightMode=1; else md->weightMode=0
|
||||
|
||||
#define MD_OFFSET(md) (u_gvarint_t(md->offset,md->offsetMode).word)
|
||||
#define MD_OFFSET_TO_UNION(md, var) var.bytes_t.lo=md->offset; var.bytes_t.hi=md->offsetMode?255:0
|
||||
#define MD_UNION_TO_OFFSET(var, md) md->offset=var.bytes_t.lo; if (var.word<0) md->offsetMode=1; else md->offsetMode=0 /* set negative sign */
|
||||
// #define MD_SETOFFSET(md, val) md->offset=val; if (val<0) md->offsetMode=1; else md->offsetMode=0
|
||||
|
||||
#endif
|
||||
|
||||
enum LogicalSwitchesFunctions {
|
||||
LS_FUNC_NONE,
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_VEQUAL, // v==offset
|
||||
#endif
|
||||
LS_FUNC_VALMOSTEQUAL, // v~=offset
|
||||
LS_FUNC_VPOS, // v>offset
|
||||
LS_FUNC_VNEG, // v<offset
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_RANGE,
|
||||
#endif
|
||||
LS_FUNC_APOS, // |v|>offset
|
||||
LS_FUNC_ANEG, // |v|<offset
|
||||
LS_FUNC_AND,
|
||||
LS_FUNC_OR,
|
||||
LS_FUNC_XOR,
|
||||
#if defined(CPUARM)
|
||||
LS_FUNC_EDGE,
|
||||
#endif
|
||||
LS_FUNC_EQUAL,
|
||||
LS_FUNC_GREATER,
|
||||
LS_FUNC_LESS,
|
||||
|
@ -337,15 +222,10 @@ enum LogicalSwitchesFunctions {
|
|||
LS_FUNC_MAX = LS_FUNC_COUNT-1
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MAX_LS_DURATION 250 /*25s*/
|
||||
#define MAX_LS_DELAY 250 /*25s*/
|
||||
#define MAX_LS_ANDSW SWSRC_LAST
|
||||
#else
|
||||
#define MAX_LS_ANDSW 15
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
//#define TELEM_FLAG_TIMEOUT 0x01
|
||||
#define TELEM_FLAG_LOG 0x02
|
||||
//#define TELEM_FLAG_PERSISTENT 0x04
|
||||
|
@ -373,7 +253,6 @@ enum TelemetrySensorFormula
|
|||
TELEM_FORMULA_DIST,
|
||||
TELEM_FORMULA_LAST = TELEM_FORMULA_DIST
|
||||
};
|
||||
#endif
|
||||
|
||||
enum VarioSource {
|
||||
#if !defined(TELEMETRY_FRSKY_SPORT)
|
||||
|
@ -401,10 +280,8 @@ enum FrskyCurrentSource {
|
|||
FRSKY_CURRENT_SOURCE_NONE,
|
||||
FRSKY_CURRENT_SOURCE_A1,
|
||||
FRSKY_CURRENT_SOURCE_A2,
|
||||
#if defined(CPUARM)
|
||||
FRSKY_CURRENT_SOURCE_A3,
|
||||
FRSKY_CURRENT_SOURCE_A4,
|
||||
#endif
|
||||
FRSKY_CURRENT_SOURCE_FAS,
|
||||
FRSKY_CURRENT_SOURCE_LAST=FRSKY_CURRENT_SOURCE_FAS
|
||||
};
|
||||
|
@ -412,10 +289,8 @@ enum FrskyCurrentSource {
|
|||
enum FrskyVoltsSource {
|
||||
FRSKY_VOLTS_SOURCE_A1,
|
||||
FRSKY_VOLTS_SOURCE_A2,
|
||||
#if defined(CPUARM)
|
||||
FRSKY_VOLTS_SOURCE_A3,
|
||||
FRSKY_VOLTS_SOURCE_A4,
|
||||
#endif
|
||||
FRSKY_VOLTS_SOURCE_FAS,
|
||||
FRSKY_VOLTS_SOURCE_CELLS,
|
||||
FRSKY_VOLTS_SOURCE_LAST=FRSKY_VOLTS_SOURCE_CELLS
|
||||
|
@ -439,22 +314,10 @@ enum SwashType {
|
|||
|
||||
#define ROTARY_ENCODER_MAX 1024
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define TRIMS_ARRAY_SIZE 5
|
||||
#else
|
||||
#define TRIMS_ARRAY_SIZE 8
|
||||
#if defined(CPUARM)
|
||||
#define TRIM_MODE_NONE 0x1F // 0b11111
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
|
||||
#elif defined(CPUM2560)
|
||||
#define IS_MANUAL_RESET_TIMER(idx) (g_model.timers[idx].persistent == 2)
|
||||
#else
|
||||
#define IS_MANUAL_RESET_TIMER(idx) 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(PCBSKY9X)
|
||||
#define TIMER_COUNTDOWN_START(x) (g_model.timers[x].countdownStart > 0 ? 5 : 10 - g_model.timers[x].countdownStart * 10)
|
||||
|
@ -464,10 +327,6 @@ enum SwashType {
|
|||
|
||||
enum Protocols {
|
||||
PROTO_PPM,
|
||||
#if !defined(CPUARM)
|
||||
PROTO_PPM16,
|
||||
PROTO_PPMSIM,
|
||||
#endif
|
||||
#if defined(PXX) || defined(DSM2) || defined(IRPROTOS)
|
||||
PROTO_PXX,
|
||||
#endif
|
||||
|
@ -476,9 +335,7 @@ enum Protocols {
|
|||
PROTO_DSM2_DSM2,
|
||||
PROTO_DSM2_DSMX,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
PROTO_CROSSFIRE,
|
||||
#endif
|
||||
#if defined(IRPROTOS)
|
||||
// only used on AVR
|
||||
// we will need 4 bits for proto :(
|
||||
|
@ -487,10 +344,8 @@ enum Protocols {
|
|||
PROTO_PICZ,
|
||||
PROTO_SWIFT,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
PROTO_MULTIMODULE,
|
||||
PROTO_SBUS,
|
||||
#endif
|
||||
PROTO_MAX,
|
||||
PROTO_NONE
|
||||
};
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -45,13 +45,8 @@
|
|||
#define CASE_PCBSKY9X(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CASE_CPUARM(x) x,
|
||||
#define IF_CPUARM(x) x
|
||||
#else
|
||||
#define CASE_CPUARM(x)
|
||||
#define IF_CPUARM(x)
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
#define CASE_STM32(x) x,
|
||||
|
@ -71,11 +66,7 @@
|
|||
#define CASE_LUA(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
#define CASE_PERSISTENT_TIMERS(x) x,
|
||||
#else
|
||||
#define CASE_PERSISTENT_TIMERS(x)
|
||||
#endif
|
||||
|
||||
#if defined(RTCLOCK)
|
||||
#define CASE_RTCLOCK(x) x,
|
||||
|
@ -225,11 +216,7 @@
|
|||
#define IF_FAI_CHOICE(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && isFaiForbidden(idx))
|
||||
#else
|
||||
#define IS_FAI_FORBIDDEN(idx) (IS_FAI_ENABLED() && idx >= MIXSRC_FIRST_TELEM)
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
#if defined(X9E) && !defined(USEHORUSBT)
|
||||
|
@ -244,9 +231,7 @@
|
|||
#define IS_SLAVE_TRAINER() (g_model.trainerMode == TRAINER_MODE_SLAVE)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MASTER_VOLUME
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64) && !defined(ACCURAT_THROTTLE_TIMER)
|
||||
// code cost is about 16 bytes for higher throttle accuracy for timer
|
||||
|
@ -272,7 +257,7 @@
|
|||
|
||||
#if defined(SIMU)
|
||||
#include "targets/simu/simpgmspace.h"
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
typedef const unsigned char pm_uchar;
|
||||
typedef const char pm_char;
|
||||
typedef const uint16_t pm_uint16_t;
|
||||
|
@ -304,11 +289,7 @@
|
|||
|
||||
#include "myeeprom.h"
|
||||
|
||||
#if defined(CPUM64)
|
||||
void memclear(void * ptr, uint8_t size);
|
||||
#else
|
||||
#define memclear(p, s) memset(p, 0, s)
|
||||
#endif
|
||||
|
||||
void memswap(void * a, void * b, uint8_t size);
|
||||
|
||||
|
@ -365,23 +346,11 @@ void memswap(void * a, void * b, uint8_t size);
|
|||
#define PPM_CH_CENTER(ch) (PPM_CENTER)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "fifo.h"
|
||||
#include "io/io_arm.h"
|
||||
// This doesn't need protection on this processor
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
#define get_tmr10ms() g_tmr10ms
|
||||
#else
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
extern inline uint16_t get_tmr10ms()
|
||||
{
|
||||
uint16_t time ;
|
||||
cli();
|
||||
time = g_tmr10ms ;
|
||||
sei();
|
||||
return time ;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
extern uint8_t StickScrollAllowed;
|
||||
|
@ -400,12 +369,10 @@ void memswap(void * a, void * b, uint8_t size);
|
|||
#include "storage/storage.h"
|
||||
#include "pulses/pulses.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
// Order is the same as in enum Protocols in myeeprom.h (none, ppm, xjt, dsm, crossfire, multi, r9m, sbus)
|
||||
static const int8_t maxChannelsModules[] = { 0, 8, 8, -2, 8, 4, 8, 8}; // relative to 8!
|
||||
static const int8_t maxChannelsXJT[] = { 0, 8, 0, 4 }; // relative to 8!
|
||||
#define MAX_TRAINER_CHANNELS_M8() (MAX_TRAINER_CHANNELS-8)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -471,16 +438,8 @@ void memswap(void * a, void * b, uint8_t size);
|
|||
#define DEFAULT_CHANNELS(idx) (IS_MODULE_PPM(idx) ? 0 : MAX_CHANNELS(idx))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MASK_CFN_TYPE uint64_t // current max = 64 function switches
|
||||
#define MASK_FUNC_TYPE uint32_t // current max = 32 functions
|
||||
#elif defined(CPUM64)
|
||||
#define MASK_CFN_TYPE uint16_t // current max = 16 function switches
|
||||
#define MASK_FUNC_TYPE uint8_t // current max = 8 functions
|
||||
#else
|
||||
#define MASK_CFN_TYPE uint32_t // current max = 32 function switches
|
||||
#define MASK_FUNC_TYPE uint8_t // current max = 8 functions
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
MASK_FUNC_TYPE activeFunctions;
|
||||
|
@ -537,10 +496,8 @@ extern uint8_t channel_order(uint8_t x);
|
|||
#define SPLASH_NEEDED() (false)
|
||||
#elif defined(PCBTARANIS)
|
||||
#define SPLASH_NEEDED() (g_eeGeneral.splashMode != 3)
|
||||
#elif defined(CPUARM)
|
||||
#define SPLASH_NEEDED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_DSM2 && !g_eeGeneral.splashMode)
|
||||
#else
|
||||
#define SPLASH_NEEDED() (!IS_DSM2_PROTOCOL(g_model.protocol) && !g_eeGeneral.splashMode)
|
||||
#define SPLASH_NEEDED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_DSM2 && !g_eeGeneral.splashMode)
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
|
@ -608,11 +565,9 @@ extern struct t_inactivity inactivity;
|
|||
|
||||
char hex2zchar(uint8_t hex);
|
||||
char idx2char(int8_t idx);
|
||||
#if defined(CPUARM) || defined(SIMU)
|
||||
int8_t char2idx(char c);
|
||||
void str2zchar(char *dest, const char *src, int size);
|
||||
int zchar2str(char *dest, const char *src, int size);
|
||||
#endif
|
||||
|
||||
#include "keys.h"
|
||||
#include "pwr.h"
|
||||
|
@ -666,21 +621,13 @@ enum StartupWarningStates {
|
|||
|
||||
|
||||
// Fiddle to force compiler to use a pointer
|
||||
#if defined(CPUARM) || defined(SIMU)
|
||||
#define FORCE_INDIRECT(ptr)
|
||||
#else
|
||||
#define FORCE_INDIRECT(ptr) __asm__ __volatile__ ("" : "=e" (ptr) : "0" (ptr))
|
||||
#endif
|
||||
|
||||
extern uint8_t mixerCurrentFlightMode;
|
||||
extern uint8_t lastFlightMode;
|
||||
extern uint8_t flightModeTransitionLast;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define bitfield_channels_t uint32_t
|
||||
#else
|
||||
#define bitfield_channels_t uint16_t
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
inline int availableMemory() { return 1000; }
|
||||
|
@ -698,35 +645,21 @@ void evalMixes(uint8_t tick10ms);
|
|||
void doMixerCalculations();
|
||||
void scheduleNextMixerCalculation(uint8_t module, uint16_t period_ms);
|
||||
|
||||
#if defined(CPUARM)
|
||||
void checkTrims();
|
||||
#endif
|
||||
void perMain();
|
||||
NOINLINE void per10ms();
|
||||
|
||||
getvalue_t getValue(mixsrc_t i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GETSWITCH_MIDPOS_DELAY 1
|
||||
bool getSwitch(swsrc_t swtch, uint8_t flags=0);
|
||||
#else
|
||||
bool getSwitch(swsrc_t swtch);
|
||||
#endif
|
||||
|
||||
void logicalSwitchesTimerTick();
|
||||
void logicalSwitchesReset();
|
||||
|
||||
#if defined(CPUARM)
|
||||
void evalLogicalSwitches(bool isCurrentPhase=true);
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||
#else
|
||||
#define evalLogicalSwitches(xxx)
|
||||
#define GETSWITCH_RECURSIVE_TYPE uint16_t
|
||||
extern volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used;
|
||||
extern volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value;
|
||||
#define LS_RECURSIVE_EVALUATION_RESET() s_last_switch_used = 0
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
void getSwitchesPosition(bool startup);
|
||||
|
@ -737,15 +670,9 @@ void logicalSwitchesReset();
|
|||
extern swarnstate_t switches_states;
|
||||
swsrc_t getMovedSwitch();
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GET_MOVED_SOURCE_PARAMS uint8_t min
|
||||
int8_t getMovedSource(GET_MOVED_SOURCE_PARAMS);
|
||||
#define GET_MOVED_SOURCE(min, max) getMovedSource(min)
|
||||
#else
|
||||
#define GET_MOVED_SOURCE_PARAMS
|
||||
int8_t getMovedSource();
|
||||
#define GET_MOVED_SOURCE(min, max) getMovedSource()
|
||||
#endif
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
extern uint8_t getFlightMode();
|
||||
|
@ -753,11 +680,7 @@ swsrc_t getMovedSwitch();
|
|||
#define getFlightMode() 0
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint8_t getTrimFlightMode(uint8_t phase, uint8_t idx);
|
||||
#else
|
||||
#define getTrimFlightMode(phase, idx) (phase)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
extern int8_t trimGvar[NUM_TRIMS];
|
||||
|
@ -769,20 +692,14 @@ swsrc_t getMovedSwitch();
|
|||
trim_t getRawTrimValue(uint8_t phase, uint8_t idx);
|
||||
int getTrimValue(uint8_t phase, uint8_t idx);
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||
#else
|
||||
void setTrimValue(uint8_t phase, uint8_t idx, int trim);
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
int16_t getRotaryEncoder(uint8_t idx);
|
||||
void incRotaryEncoder(uint8_t idx, int8_t inc);
|
||||
#endif
|
||||
|
||||
#if defined(PCBGRUVIN9X) || defined(PCBMEGA2560)
|
||||
#define ROTARY_ENCODER_GRANULARITY (1)
|
||||
#elif defined(PCBSKY9X)
|
||||
#if defined(PCBSKY9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY (2 << g_eeGeneral.rotarySteps)
|
||||
#elif defined(PCBHORUS)
|
||||
#define ROTARY_ENCODER_GRANULARITY (1)
|
||||
|
@ -797,20 +714,14 @@ extern uint16_t s_timeCumThr;
|
|||
extern uint16_t s_timeCum16ThrP;
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
#if defined(CPUARM)
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -4096
|
||||
#else
|
||||
#define OVERRIDE_CHANNEL_UNDEFINED -128
|
||||
#endif
|
||||
extern safetych_t safetyCh[MAX_OUTPUT_CHANNELS];
|
||||
#endif
|
||||
|
||||
extern uint8_t trimsCheckTimer;
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern uint8_t trimsDisplayTimer;
|
||||
extern uint8_t trimsDisplayMask;
|
||||
#endif
|
||||
|
||||
void flightReset(uint8_t check=true);
|
||||
|
||||
|
@ -818,17 +729,8 @@ extern uint8_t unexpectedShutdown;
|
|||
|
||||
extern uint16_t maxMixerDuration;
|
||||
|
||||
#if !defined(CPUARM)
|
||||
extern uint8_t g_tmr1Latency_max;
|
||||
extern uint8_t g_tmr1Latency_min;
|
||||
extern uint16_t lastMixerDuration;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define DURATION_MS_PREC2(x) ((x)/20)
|
||||
#else
|
||||
#define DURATION_MS_PREC2(x) ((x)*100)/16
|
||||
#endif
|
||||
|
||||
#if defined(THRTRACE)
|
||||
#if defined(COLORLCD)
|
||||
|
@ -857,9 +759,6 @@ extern uint16_t lastMixerDuration;
|
|||
uint16_t getTmr16KHz();
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint16_t stackAvailable();
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH)
|
||||
void doSplash();
|
||||
|
@ -883,11 +782,7 @@ void checkAll();
|
|||
|
||||
#if !defined(SIMU)
|
||||
void getADC();
|
||||
#if defined(CPUARM)
|
||||
#define GET_ADC_IF_MIXER_NOT_RUNNING() do { if (s_pulses_paused) getADC(); } while(0)
|
||||
#else
|
||||
#define GET_ADC_IF_MIXER_NOT_RUNNING() getADC()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "sbus.h"
|
||||
|
@ -938,7 +833,6 @@ void checkModelIdUnique(uint8_t index, uint8_t module);
|
|||
uint8_t findNextUnusedModelId(uint8_t index, uint8_t module);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint32_t hash(const void * ptr, uint32_t size);
|
||||
inline int divRoundClosest(const int n, const int d)
|
||||
{
|
||||
|
@ -976,15 +870,6 @@ inline int calcRESXto100(int x)
|
|||
return divRoundClosest(x*100, RESX);
|
||||
}
|
||||
|
||||
#else
|
||||
extern int16_t calc100to256_16Bits(int16_t x); // @@@2 open.20.fsguruh: return x*2.56
|
||||
extern int16_t calc100to256(int8_t x); // @@@2 open.20.fsguruh: return x*2.56
|
||||
extern int16_t calc100toRESX_16Bits(int16_t x); // @@@ open.20.fsguruh
|
||||
extern int16_t calc100toRESX(int8_t x);
|
||||
extern int16_t calc1000toRESX(int16_t x);
|
||||
extern int16_t calcRESXto1000(int16_t x);
|
||||
extern int8_t calcRESXto100(int16_t x);
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
extern const char vers_stamp[];
|
||||
|
@ -1021,15 +906,10 @@ extern int16_t ex_chans[MAX_OUTPUT_CHANNELS]; // Outputs (before LIMI
|
|||
extern int16_t channelOutputs[MAX_OUTPUT_CHANNELS];
|
||||
extern uint16_t BandGap;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define NUM_INPUTS (MAX_INPUTS)
|
||||
#else
|
||||
#define NUM_INPUTS (NUM_STICKS)
|
||||
#endif
|
||||
|
||||
int expo(int x, int k);
|
||||
|
||||
#if defined(CPUARM)
|
||||
inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax, LcdFlags * flags = 0)
|
||||
{
|
||||
if (source >= MIXSRC_FIRST_TRIM && source <= MIXSRC_LAST_TRIM) {
|
||||
|
@ -1079,7 +959,6 @@ inline void getMixSrcRange(const int source, int16_t & valMin, int16_t & valMax,
|
|||
valMin = -valMax;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Curves
|
||||
enum BaseCurves {
|
||||
|
@ -1102,7 +981,7 @@ point_t getPoint(uint8_t i);
|
|||
#if !defined(CURVES)
|
||||
#define LOAD_MODEL_CURVES()
|
||||
#define applyCurve(x, idx) (x)
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
typedef CurveData CurveInfo;
|
||||
void loadCurves();
|
||||
#define LOAD_MODEL_CURVES() loadCurves()
|
||||
|
@ -1113,33 +992,13 @@ int applyCurrentCurve(int x);
|
|||
int8_t getCurveX(int noPoints, int point);
|
||||
void resetCustomCurveX(int8_t * points, int noPoints);
|
||||
bool moveCurve(uint8_t index, int8_t shift); // TODO bool?
|
||||
#else
|
||||
struct CurveInfo {
|
||||
int8_t * crv;
|
||||
uint8_t points:7;
|
||||
uint8_t custom:1;
|
||||
};
|
||||
CurveInfo curveInfo(uint8_t idx);
|
||||
int intpol(int x, uint8_t idx);
|
||||
int applyCurve(int x, int8_t idx);
|
||||
#define LOAD_MODEL_CURVES()
|
||||
#define applyCustomCurve(x, idx) intpol(x, idx)
|
||||
int applyCurrentCurve(int x);
|
||||
bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS_INC , uint8_t ovwrIdx=0, int16_t ovwrValue=0
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS , uint8_t ovwrIdx, int16_t ovwrValue
|
||||
#else
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS_INC
|
||||
#define APPLY_EXPOS_EXTRA_PARAMS
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void clearInputs();
|
||||
void defaultInputs();
|
||||
#endif
|
||||
|
||||
void applyExpos(int16_t * anas, uint8_t mode APPLY_EXPOS_EXTRA_PARAMS_INC);
|
||||
int16_t applyLimits(uint8_t channel, int32_t value);
|
||||
|
@ -1164,11 +1023,7 @@ LogicalSwitchData * lswAddress(uint8_t idx);
|
|||
|
||||
// static variables used in evalFlightModeMixes - moved here so they don't interfere with the stack
|
||||
// It's also easier to initialize them here.
|
||||
#if defined(CPUARM)
|
||||
extern int8_t virtualInputsTrims[NUM_INPUTS];
|
||||
#else
|
||||
extern int16_t rawAnas[NUM_INPUTS];
|
||||
#endif
|
||||
|
||||
extern int16_t anas [NUM_INPUTS];
|
||||
extern int16_t trims[NUM_TRIMS];
|
||||
|
@ -1185,7 +1040,6 @@ void copyTrimsToOffset(uint8_t ch);
|
|||
void copySticksToOffset(uint8_t ch);
|
||||
void moveTrimsToOffsets();
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define ACTIVE_PHASES_TYPE uint16_t
|
||||
#define DELAY_POS_SHIFT 0
|
||||
#define DELAY_POS_MARGIN 3
|
||||
|
@ -1197,19 +1051,6 @@ PACK(typedef struct {
|
|||
uint8_t activeMix;
|
||||
uint8_t activeExpo;
|
||||
}) SwOn;
|
||||
#else
|
||||
#define ACTIVE_PHASES_TYPE uint8_t
|
||||
#define DELAY_POS_SHIFT 10
|
||||
#define DELAY_POS_MARGIN 0
|
||||
#define delayval_t int8_t
|
||||
PACK(typedef struct {
|
||||
uint16_t delay:10;
|
||||
int16_t now:2; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||
int16_t prev:2;
|
||||
int16_t activeMix:1;
|
||||
int16_t activeExpo:1;
|
||||
}) SwOn;
|
||||
#endif
|
||||
|
||||
extern SwOn swOn[MAX_MIXERS];
|
||||
extern int24_t act[MAX_MIXERS];
|
||||
|
@ -1251,10 +1092,8 @@ enum FunctionsActive {
|
|||
#if defined(SDCARD)
|
||||
FUNCTION_LOGS,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
FUNCTION_BACKGND_MUSIC,
|
||||
FUNCTION_BACKGND_MUSIC_PAUSE,
|
||||
#endif
|
||||
};
|
||||
|
||||
#define VARIO_FREQUENCY_ZERO 700/*Hz*/
|
||||
|
@ -1262,7 +1101,6 @@ enum FunctionsActive {
|
|||
#define VARIO_REPEAT_ZERO 500/*ms*/
|
||||
#define VARIO_REPEAT_MAX 80/*ms*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern CustomFunctionsContext modelFunctionsContext;
|
||||
extern CustomFunctionsContext globalFunctionsContext;
|
||||
inline bool isFunctionActive(uint8_t func)
|
||||
|
@ -1275,19 +1113,11 @@ inline void customFunctionsReset()
|
|||
globalFunctionsContext.reset();
|
||||
modelFunctionsContext.reset();
|
||||
}
|
||||
#else
|
||||
extern CustomFunctionsContext modelFunctionsContext;
|
||||
#define isFunctionActive(func) modelFunctionsContext.isFunctionActive(func)
|
||||
void evalFunctions();
|
||||
#define customFunctionsReset() modelFunctionsContext.reset()
|
||||
#endif
|
||||
|
||||
#include "telemetry/telemetry.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t crc8(const uint8_t * ptr, uint32_t len);
|
||||
uint16_t crc16(const uint8_t * ptr, uint32_t len);
|
||||
#endif
|
||||
|
||||
#define PLAY_REPEAT(x) (x) /* Range 0 to 15 */
|
||||
#define PLAY_NOW 0x10
|
||||
|
@ -1296,9 +1126,7 @@ uint16_t crc16(const uint8_t * ptr, uint32_t len);
|
|||
|
||||
enum AUDIO_SOUNDS {
|
||||
AUDIO_HELLO,
|
||||
#if defined(CPUARM)
|
||||
AU_BYE,
|
||||
#endif
|
||||
#if defined(VOICE)
|
||||
AU_THROTTLE_ALERT,
|
||||
AU_SWITCH_ALERT,
|
||||
|
@ -1306,7 +1134,6 @@ enum AUDIO_SOUNDS {
|
|||
#endif
|
||||
AU_TX_BATTERY_LOW,
|
||||
AU_INACTIVITY,
|
||||
#if defined(CPUARM)
|
||||
AU_RSSI_ORANGE,
|
||||
AU_RSSI_RED,
|
||||
AU_RAS_RED,
|
||||
|
@ -1318,7 +1145,6 @@ enum AUDIO_SOUNDS {
|
|||
AU_SERVO_KO,
|
||||
AU_RX_OVERLOAD,
|
||||
AU_MODEL_STILL_POWERED,
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
AU_TX_MAH_HIGH,
|
||||
AU_TX_TEMP_HIGH,
|
||||
|
@ -1328,16 +1154,12 @@ enum AUDIO_SOUNDS {
|
|||
AU_WARNING2,
|
||||
AU_WARNING3,
|
||||
AU_TRIM_MIDDLE,
|
||||
#if defined(CPUARM)
|
||||
AU_TRIM_MIN,
|
||||
AU_TRIM_MAX,
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
AU_STICK1_MIDDLE,
|
||||
AU_STICK2_MIDDLE,
|
||||
AU_STICK3_MIDDLE,
|
||||
AU_STICK4_MIDDLE,
|
||||
#endif
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
AU_POT1_MIDDLE,
|
||||
AU_POT2_MIDDLE,
|
||||
|
@ -1351,21 +1173,17 @@ enum AUDIO_SOUNDS {
|
|||
AU_SLIDER3_MIDDLE,
|
||||
AU_SLIDER4_MIDDLE,
|
||||
#endif
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
AU_POT1_MIDDLE,
|
||||
AU_POT2_MIDDLE,
|
||||
AU_POT3_MIDDLE,
|
||||
#else
|
||||
AU_POT_MIDDLE,
|
||||
#endif
|
||||
AU_MIX_WARNING_1,
|
||||
AU_MIX_WARNING_2,
|
||||
AU_MIX_WARNING_3,
|
||||
#if defined(CPUARM)
|
||||
AU_TIMER1_ELAPSED,
|
||||
AU_TIMER2_ELAPSED,
|
||||
AU_TIMER3_ELAPSED,
|
||||
#endif
|
||||
|
||||
AU_SPECIAL_SOUND_FIRST,
|
||||
AU_SPECIAL_SOUND_BEEP1 = AU_SPECIAL_SOUND_FIRST,
|
||||
|
@ -1390,26 +1208,13 @@ enum AUDIO_SOUNDS {
|
|||
};
|
||||
|
||||
#if defined(AUDIO)
|
||||
#if defined(CPUARM)
|
||||
#include "audio_arm.h"
|
||||
#else
|
||||
#include "audio_avr.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "buzzer.h"
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
#include "targets/9x/voice.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBGRUVIN9X) && defined(VOICE)
|
||||
#include "targets/gruvin9x/voice.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBMEGA2560) && defined(VOICE)
|
||||
#include "targets/mega2560/voice.h"
|
||||
#endif
|
||||
|
||||
#include "translations.h"
|
||||
#include "fonts.h"
|
||||
|
@ -1431,18 +1236,14 @@ void setMFP();
|
|||
void clearMFP();
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern uint8_t requiredSpeakerVolume;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum MainRequest {
|
||||
REQUEST_SCREENSHOT,
|
||||
REQUEST_FLIGHT_RESET,
|
||||
};
|
||||
|
||||
extern uint8_t mainRequestFlags;
|
||||
#endif
|
||||
|
||||
void checkBattery();
|
||||
void opentxClose(uint8_t shutdown=true);
|
||||
|
@ -1468,9 +1269,6 @@ union ReusableBuffer
|
|||
// ARM 334 bytes
|
||||
struct
|
||||
{
|
||||
#if !defined(CPUARM)
|
||||
char listnames[NUM_BODY_LINES][LEN_MODEL_NAME];
|
||||
#endif
|
||||
#if defined(EEPROM_RLC) && LCD_W < 212
|
||||
uint16_t eepromfree;
|
||||
#endif
|
||||
|
@ -1533,7 +1331,6 @@ extern union ReusableBuffer reusableBuffer;
|
|||
|
||||
void checkFlashOnBeep();
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t zlen(const char *str, uint8_t size);
|
||||
bool zexist(const char *str, uint8_t size);
|
||||
unsigned int effectiveLen(const char * str, unsigned int size);
|
||||
|
@ -1547,7 +1344,6 @@ char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defa
|
|||
#endif
|
||||
#define ZLEN(s) zlen(s, sizeof(s))
|
||||
#define ZEXIST(s) zexist(s, sizeof(s))
|
||||
#endif
|
||||
|
||||
// Stick tolerance varies between transmitters, Higher is better
|
||||
#if defined (PCB9XR) || defined (PCB9XR128)
|
||||
|
@ -1574,11 +1370,7 @@ enum BarThresholdIdx {
|
|||
THLD_MAX,
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FILL_THRESHOLD(idx, val) barsThresholds[idx] = (val)
|
||||
#else
|
||||
#define FILL_THRESHOLD(idx, val) barsThresholds[idx] = 128 + (val)
|
||||
#endif
|
||||
|
||||
extern bar_threshold_t barsThresholds[THLD_MAX];
|
||||
#else
|
||||
|
@ -1593,28 +1385,18 @@ extern bar_threshold_t barsThresholds[THLD_MAX];
|
|||
#define maxTelemValue(channel) 255
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value);
|
||||
ls_telemetry_value_t max8bitsTelemValue(source_t channel);
|
||||
#endif
|
||||
|
||||
getvalue_t convert8bitsTelemValue(source_t channel, ls_telemetry_value_t value);
|
||||
getvalue_t convertLswTelemValue(LogicalSwitchData * cs);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define convertTelemValue(channel, value) convert16bitsTelemValue(channel, value)
|
||||
#define convertBarTelemValue(channel, value) convert8bitsTelemValue(channel, value)
|
||||
#define maxBarTelemValue(channel) max8bitsTelemValue(channel)
|
||||
#else
|
||||
#define convertTelemValue(channel, value) convert8bitsTelemValue(channel, value)
|
||||
#define convertBarTelemValue(channel, value) convert8bitsTelemValue(channel, value)
|
||||
#define maxBarTelemValue(channel) maxTelemValue(channel)
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) || defined(CPUARM)
|
||||
lcdint_t applyChannelRatio(source_t channel, lcdint_t val);
|
||||
#define ANA_CHANNEL_UNIT(channel) g_model.frsky.channels[channel].type
|
||||
#endif
|
||||
|
||||
inline int div_and_round(int num, int den)
|
||||
{
|
||||
|
@ -1631,30 +1413,17 @@ inline int div_and_round(int num, int den)
|
|||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#if !defined(CPUARM)
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
||||
#endif
|
||||
|
||||
extern const pm_uint8_t bchunit_ar[];
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FRSKY_MULTIPLIER_MAX 5
|
||||
#else
|
||||
#define FRSKY_MULTIPLIER_MAX 3
|
||||
#endif
|
||||
|
||||
enum TelemetryViews {
|
||||
TELEMETRY_CUSTOM_SCREEN_1,
|
||||
TELEMETRY_CUSTOM_SCREEN_2,
|
||||
#if defined(CPUARM)
|
||||
TELEMETRY_CUSTOM_SCREEN_3,
|
||||
TELEMETRY_CUSTOM_SCREEN_4,
|
||||
TELEMETRY_VIEW_MAX = TELEMETRY_CUSTOM_SCREEN_4
|
||||
#else
|
||||
TELEMETRY_VOLTAGES_SCREEN,
|
||||
TELEMETRY_AFTER_FLIGHT_SCREEN,
|
||||
TELEMETRY_VIEW_MAX = TELEMETRY_AFTER_FLIGHT_SCREEN
|
||||
#endif
|
||||
};
|
||||
|
||||
extern uint8_t s_frsky_view;
|
||||
|
@ -1674,57 +1443,9 @@ void varioWakeup();
|
|||
#define IS_SOUND_OFF() (g_eeGeneral.beepMode == e_mode_quiet)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_IMPERIAL_ENABLE() (g_eeGeneral.imperial)
|
||||
#elif defined(IMPERIAL_UNITS)
|
||||
#define IS_IMPERIAL_ENABLE() (1)
|
||||
#else
|
||||
#define IS_IMPERIAL_ENABLE() (0)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#elif defined(TELEMETRY_FRSKY)
|
||||
FORCEINLINE void convertUnit(getvalue_t & val, uint8_t & unit)
|
||||
{
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_TEMPERATURE) {
|
||||
val += 18;
|
||||
val *= 115;
|
||||
val >>= 6;
|
||||
}
|
||||
if (unit == UNIT_DIST) {
|
||||
// m to ft *105/32
|
||||
val = val * 3 + (val >> 2) + (val >> 5);
|
||||
}
|
||||
if (unit == UNIT_FEET) {
|
||||
unit = UNIT_DIST;
|
||||
}
|
||||
if (unit == UNIT_KTS) {
|
||||
// kts to mph
|
||||
unit = UNIT_SPEED;
|
||||
val = (val * 23) / 20;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (unit == UNIT_KTS) {
|
||||
// kts to km/h
|
||||
unit = UNIT_SPEED;
|
||||
val = (val * 50) / 27;
|
||||
}
|
||||
}
|
||||
|
||||
if (unit == UNIT_HDG) {
|
||||
unit = UNIT_TEMPERATURE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define convertUnit(...)
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#define IS_USR_PROTO_FRSKY_HUB() (g_model.frsky.usrProto == USR_PROTO_FRSKY)
|
||||
#define IS_USR_PROTO_WS_HOW_HIGH() (g_model.frsky.usrProto == USR_PROTO_WS_HOW_HIGH)
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS)
|
||||
#define IS_GPS_AVAILABLE() IS_USR_PROTO_FRSKY_HUB()
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#ifndef _OTXTYPES_H_
|
||||
#define _OTXTYPES_H_
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef uint32_t tmr10ms_t;
|
||||
typedef int32_t rotenc_t;
|
||||
typedef int32_t getvalue_t;
|
||||
|
@ -29,14 +28,5 @@
|
|||
typedef int32_t swsrc_t;
|
||||
typedef int16_t safetych_t;
|
||||
typedef uint16_t bar_threshold_t;
|
||||
#else
|
||||
typedef uint16_t tmr10ms_t;
|
||||
typedef int8_t rotenc_t;
|
||||
typedef int16_t getvalue_t;
|
||||
typedef uint8_t mixsrc_t;
|
||||
typedef int8_t swsrc_t;
|
||||
typedef int8_t safetych_t;
|
||||
typedef uint8_t bar_threshold_t;
|
||||
#endif
|
||||
|
||||
#endif // _OTXTYPES_H_
|
||||
|
|
|
@ -29,9 +29,7 @@ enum ModuleFlag
|
|||
// MODULE_OFF, // will need an EEPROM conversion
|
||||
};
|
||||
|
||||
#if defined(CPUARM) // (PXX) || defined(DSM2)
|
||||
extern uint8_t moduleFlag[NUM_MODULES];
|
||||
#endif
|
||||
|
||||
#if NUM_MODULES > 1
|
||||
#define IS_RANGECHECK_ENABLE() (moduleFlag[0] == MODULE_RANGECHECK || moduleFlag[1] == MODULE_RANGECHECK)
|
||||
|
@ -44,11 +42,7 @@ enum ModuleFlag
|
|||
extern uint8_t dsm2BindTimer;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_PPM_PROTOCOL(protocol) (protocol==PROTO_PPM)
|
||||
#else
|
||||
#define IS_PPM_PROTOCOL(protocol) (protocol<=PROTO_PPMSIM)
|
||||
#endif
|
||||
|
||||
#if defined(PXX)
|
||||
#define IS_PXX_PROTOCOL(protocol) (protocol==PROTO_PXX)
|
||||
|
@ -77,17 +71,9 @@ enum ModuleFlag
|
|||
#define IS_MULTIMODULE_PROTOCOL(protocol) (0)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define IS_SBUS_PROTOCOL(protocol) (protocol == PROTO_SBUS)
|
||||
#else
|
||||
#define IS_SBUS_PROTOCOL(protocol) (0)
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "pulses_arm.h"
|
||||
#else
|
||||
#include "pulses_avr.h"
|
||||
#endif
|
||||
|
||||
#endif // _PULSES_H_
|
||||
|
|
|
@ -62,17 +62,6 @@ void set_timer3_ppm(void);
|
|||
|
||||
void startPulses()
|
||||
{
|
||||
#if defined(CPUM2560)
|
||||
#if defined(DSM2_SERIAL)
|
||||
if (!IS_DSM2_PROTOCOL(g_model.protocol))
|
||||
#endif
|
||||
{
|
||||
// TODO g: There has to be a better place for this bug fix
|
||||
OCR1B = 0xffff; /* Prevent any PPM_OUT pin toggle before the TCNT1 interrupt
|
||||
fires for the first time and sets up the pulse period.
|
||||
*** Prevents WDT reset loop. */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
s_current_protocol[0] = g_model.protocol;
|
||||
|
@ -107,17 +96,6 @@ ISR(TIMER1_COMPA_vect) // 2MHz pulse generation (BLOCKING ISR).
|
|||
if (IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0]) || *((uint16_t*)pulses2MHzRPtr) == 0) {
|
||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0])) {
|
||||
OCR1A = SETUP_PULSES_DURATION;
|
||||
#if defined(CPUM2560) // CPUM2560 hardware toggled PPM out.
|
||||
OCR1B = OCR1A;
|
||||
if (g_model.pulsePol) {
|
||||
TCCR1A = (TCCR1A | (1<<COM1B1)) & ~(1<<COM1B0); // Set idle level.
|
||||
}
|
||||
else {
|
||||
TCCR1A |= 3<<COM1B0;
|
||||
}
|
||||
TCCR1C = 1<<FOC1B; // Strobe FOC1B.
|
||||
TCCR1A = (TCCR1A | (1<<COM1B0)) & ~(1<<COM1B1); // Toggle OC1B on next match.
|
||||
#endif
|
||||
}
|
||||
setupPulses(); // Does not sei() for setupPulsesPPM.
|
||||
heartbeat |= HEART_TIMER_PULSES;
|
||||
|
@ -125,7 +103,6 @@ ISR(TIMER1_COMPA_vect) // 2MHz pulse generation (BLOCKING ISR).
|
|||
}
|
||||
|
||||
if (s_current_protocol[0] != PROTO_NONE) {
|
||||
#if !defined(CPUM2560)
|
||||
// Original Bit-bang for PPM.
|
||||
if (g_ppmPulsePolarity) {
|
||||
PORTB |= (1<<OUT_B_PPM); // GCC optimisation should result in a single SBI instruction
|
||||
|
@ -135,16 +112,6 @@ ISR(TIMER1_COMPA_vect) // 2MHz pulse generation (BLOCKING ISR).
|
|||
PORTB &= ~(1<<OUT_B_PPM);
|
||||
g_ppmPulsePolarity = 1;
|
||||
}
|
||||
#else // defined(CPUM2560)
|
||||
// CPUM2560 hardware toggled PPM out.
|
||||
if (*(uint16_t*)(pulses2MHzRPtr + sizeof(uint16_t)) == 0) {
|
||||
// Look one step ahead to see if we are currently the "rest" period.
|
||||
OCR1B = 0xffff; // Prevent next compare match hence toggle.
|
||||
}
|
||||
else {
|
||||
OCR1B = *((uint16_t*) pulses2MHzRPtr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
OCR1A = *((uint16_t*) pulses2MHzRPtr); // Schedule next Timer1 interrupt vector (to this function).
|
||||
|
@ -487,23 +454,13 @@ void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1
|
|||
len += BITLEN_DSM2;
|
||||
}
|
||||
else {
|
||||
#if defined(CPUM2560)
|
||||
// G: Compensate for main clock synchronisation -- to get accurate 8us bit length
|
||||
// NOTE: This has now been tested as NOT required on the stock board, with the ATmega64A chip.
|
||||
_send_1(nlev ? len-5 : len+3);
|
||||
#else
|
||||
_send_1(len-1);
|
||||
#endif
|
||||
len = BITLEN_DSM2;
|
||||
lev = nlev;
|
||||
}
|
||||
b = (b>>1) | 0x80; //shift in stop bit
|
||||
}
|
||||
#if defined (CPUM2560)
|
||||
_send_1(len+BITLEN_DSM2+3); // 2 stop bits
|
||||
#else
|
||||
_send_1(len+BITLEN_DSM2-1); // 2 stop bits
|
||||
#endif
|
||||
}
|
||||
|
||||
// DSM2=PPM mode
|
||||
|
@ -554,10 +511,8 @@ void setupPulsesDSM2()
|
|||
|
||||
pulses2MHzWPtr -= 1; //remove last stopbits and
|
||||
|
||||
#if !defined(CPUM2560)
|
||||
//G: Removed to get waveform correct on analyser. Leave in for stock board until tests can be done.
|
||||
_send_1(255); // prolong them
|
||||
#endif
|
||||
_send_1(0); //end of pulse stream
|
||||
|
||||
pulses2MHzRPtr = pulses2MHz;
|
||||
|
@ -749,16 +704,6 @@ void setupPulses()
|
|||
required_protocol = PROTO_NONE;
|
||||
}
|
||||
|
||||
#if defined(CPUM2560) && defined(DSM2_PPM) && defined(TX_CADDY)
|
||||
// This should be here, executed on every loop, to ensure re-setting of the
|
||||
// TX moudle power control output register, in case of electrical glitch.
|
||||
// (Following advice of Atmel for MCU's used in industrial / mission cricital
|
||||
// applications.)
|
||||
if (IS_DSM2_PROTOCOL(required_protocol))
|
||||
PORTH &= ~0x80;
|
||||
else
|
||||
PORTH |= 0x80;
|
||||
#endif
|
||||
|
||||
if (s_current_protocol[0] != required_protocol) {
|
||||
|
||||
|
@ -901,12 +846,6 @@ void setupPulses()
|
|||
sei();
|
||||
#endif
|
||||
setupPulsesDSM2(); // Different versions for DSM2=SERIAL vs. DSM2=PPM
|
||||
#if defined(CPUM2560) && defined(DSM2_PPM)
|
||||
// Ensure each DSM2=PPM serial packet starts out with the correct bit polarity
|
||||
TCCR1A = (0 << WGM10) | (3<<COM1B1); // Make Waveform Generator 'SET' OCR1B pin on next compare event and ...
|
||||
TCCR1C = (1<<FOC1B); // ... force compare event, to set OCR1B pin high.
|
||||
TCCR1A = (1<<COM1B0); // Output is ready. Now configure OCR1B pin into 'TOGGLE' mode.
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
@ -939,26 +878,11 @@ void setupPulses()
|
|||
#if defined(DSM2_PPM) || defined(PXX)
|
||||
ISR(TIMER1_CAPT_vect) // 2MHz pulse generation
|
||||
{
|
||||
#if defined (CPUM2560)
|
||||
/*** G9X V4 hardware toggled PPM_out avoids any chance of output timing jitter ***/
|
||||
|
||||
// OCR1B output pin (PPM_OUT) is pre-SET in setupPulses -- on every new
|
||||
// frame, for safety -- and then configured to toggle on each OCR1B compare match.
|
||||
// Thus, all we need do here is update the compare regisiter(s) ...
|
||||
uint8_t x;
|
||||
x = *pulses2MHzRPtr++; // Byte size
|
||||
ICR1 = x;
|
||||
OCR1B = (uint16_t)x; // Duplicate capture compare value for OCR1B, because Timer1 is in CTC mode
|
||||
// and thus we cannot use the OCR1B int. vector. (Should have put PPM_OUT
|
||||
// pin on OCR1A. Oh well.)
|
||||
|
||||
#else // manual bit-bang mode
|
||||
uint8_t x;
|
||||
PORTB ^= (1<<OUT_B_PPM); // Toggle PPM_OUT
|
||||
x = *pulses2MHzRPtr++; // Byte size
|
||||
ICR1 = x;
|
||||
if (x > 200) PORTB |= (1<<OUT_B_PPM); // Make sure pulses are the correct way up.
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PXX)
|
||||
|
|
|
@ -259,11 +259,8 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
|
|||
uint8_t fnLen, extLen;
|
||||
char tmpExt[LEN_FILE_EXTENSION_MAX+1] = "\0";
|
||||
|
||||
#if defined(CPUARM)
|
||||
popupMenuOffsetType = MENU_OFFSET_EXTERNAL;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
static uint8_t s_last_flags;
|
||||
|
||||
if (selection) {
|
||||
|
@ -273,7 +270,6 @@ bool sdListFiles(const char * path, const char * extension, const uint8_t maxlen
|
|||
else {
|
||||
flags = s_last_flags;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (popupMenuOffset == 0) {
|
||||
lastpopupMenuOffset = 0;
|
||||
|
|
|
@ -141,9 +141,6 @@ const char * getFileExtension(const char * filename, uint8_t size=0, uint8_t ext
|
|||
#elif defined(PCBSKY9X)
|
||||
#define OTX_FOURCC 0x3278746F // otx for sky9x
|
||||
#define O9X_FOURCC 0x3278396F // o9x for sky9x
|
||||
#elif defined(PCBGRUVIN9X) || defined(PCBMEGA2560)
|
||||
#define OTX_FOURCC 0x3178746F // otx for gruvin9x/MEGA2560
|
||||
#define O9X_FOURCC 0x3178396F // o9x for gruvin9x/MEGA2560
|
||||
#endif
|
||||
|
||||
bool isFileAvailable(const char * filename, bool exclDir = false);
|
||||
|
|
|
@ -589,9 +589,6 @@ uint16_t anaIn(uint8_t chan)
|
|||
return 5.1*1500/11.3;
|
||||
else if (chan == TX_CURRENT)
|
||||
return 100;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
else if (chan == TX_VOLTAGE)
|
||||
return 150;
|
||||
#else
|
||||
else if (chan == TX_VOLTAGE)
|
||||
return 1500;
|
||||
|
|
|
@ -24,11 +24,7 @@
|
|||
#define STR2(s) #s
|
||||
#define DEFNUMSTR(s) STR2(s)
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define EEPROM_STR DEFNUMSTR(EEPROM_VER) "-" DEFNUMSTR(EEPROM_VARIANT)
|
||||
#else
|
||||
#define EEPROM_STR DEFNUMSTR(EEPROM_VER);
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define TAB "\037\075"
|
||||
|
|
|
@ -78,7 +78,6 @@ void selectModel(uint8_t sub)
|
|||
eeLoadModel(sub);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
ModelHeader modelHeaders[MAX_MODELS];
|
||||
void eeLoadModelHeaders()
|
||||
{
|
||||
|
@ -86,7 +85,6 @@ void eeLoadModelHeaders()
|
|||
eeLoadModelHeader(i, &modelHeaders[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void storageReadRadioSettings()
|
||||
{
|
||||
|
@ -97,14 +95,12 @@ void storageReadRadioSettings()
|
|||
eeLoadModelHeaders();
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t i=0; languagePacks[i]!=NULL; i++) {
|
||||
if (!strncmp(g_eeGeneral.ttsLanguage, languagePacks[i]->id, 2)) {
|
||||
currentLanguagePackIdx = i;
|
||||
currentLanguagePack = languagePacks[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void storageReadCurrentModel()
|
||||
|
|
|
@ -30,13 +30,9 @@ void ConvertModel(int id, int version);
|
|||
uint8_t eeFindEmptyModel(uint8_t id, bool down);
|
||||
void selectModel(uint8_t sub);
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern ModelHeader modelHeaders[MAX_MODELS];
|
||||
void eeLoadModelHeader(uint8_t id, ModelHeader *header);
|
||||
void eeLoadModelHeaders();
|
||||
#else
|
||||
#define eeLoadModelHeaders()
|
||||
#endif
|
||||
|
||||
void storageReadRadioSettings();
|
||||
void storageReadCurrentModel();
|
||||
|
|
|
@ -194,14 +194,12 @@ enum Telemetry216Source {
|
|||
TELEM216_GPS_TIME,
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(typedef struct {
|
||||
uint8_t type:3;
|
||||
uint8_t smooth:1;
|
||||
uint8_t spare:4;
|
||||
int8_t points;
|
||||
}) CurveData_v216;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
PACK(typedef struct {
|
||||
|
|
|
@ -27,9 +27,7 @@ uint8_t s_write_err = 0; // error reasons
|
|||
RlcFile theFile; //used for any file operation
|
||||
EeFs eeFs;
|
||||
|
||||
#if defined(CPUARM)
|
||||
blkid_t freeBlocks = 0;
|
||||
#endif
|
||||
|
||||
uint8_t s_sync_write = false;
|
||||
|
||||
|
@ -42,13 +40,9 @@ static uint8_t EeFsRead(blkid_t blk, uint8_t ofs)
|
|||
|
||||
static blkid_t EeFsGetLink(blkid_t blk)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
blkid_t ret;
|
||||
eepromReadBlock((uint8_t *)&ret, blk*BS+BLOCKS_OFFSET, sizeof(blkid_t));
|
||||
return ret;
|
||||
#else
|
||||
return EeFsRead(blk, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void EeFsSetLink(blkid_t blk, blkid_t val)
|
||||
|
@ -85,16 +79,7 @@ static void EeFsFlush()
|
|||
|
||||
uint16_t EeFsGetFree()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
int32_t ret = freeBlocks * (BS-sizeof(blkid_t));
|
||||
#else
|
||||
int16_t ret = 0;
|
||||
blkid_t i = eeFs.freeList;
|
||||
while (i) {
|
||||
ret += BS-sizeof(blkid_t);
|
||||
i = EeFsGetLink(i);
|
||||
}
|
||||
#endif
|
||||
ret += eeFs.files[FILE_TMP].size;
|
||||
ret -= eeFs.files[FILE_MODEL(g_eeGeneral.currModel)].size;
|
||||
return (ret > 0 ? ret : 0);
|
||||
|
@ -106,15 +91,11 @@ static void EeFsFree(blkid_t blk)
|
|||
blkid_t i = blk;
|
||||
blkid_t tmp;
|
||||
|
||||
#if defined(CPUARM)
|
||||
freeBlocks++;
|
||||
#endif
|
||||
|
||||
while ((tmp=EeFsGetLink(i))) {
|
||||
i = tmp;
|
||||
#if defined(CPUARM)
|
||||
freeBlocks++;
|
||||
#endif
|
||||
}
|
||||
|
||||
EeFsSetLink(i, eeFs.freeList);
|
||||
|
@ -130,13 +111,9 @@ void eepromCheck()
|
|||
memclear(bufp, BLOCKS);
|
||||
blkid_t blk ;
|
||||
|
||||
#if defined(CPUARM)
|
||||
blkid_t blocksCount;
|
||||
#endif
|
||||
for (uint8_t i=0; i<=MAXFILES; i++) {
|
||||
#if defined(CPUARM)
|
||||
blocksCount = 0;
|
||||
#endif
|
||||
blkid_t blk = (i==MAXFILES ? eeFs.freeList : eeFs.files[i].startBlk);
|
||||
blkid_t lastBlk = 0;
|
||||
while (blk) {
|
||||
|
@ -153,9 +130,7 @@ void eepromCheck()
|
|||
blk = 0; // abort
|
||||
}
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
blocksCount++;
|
||||
#endif
|
||||
bufp[blk] = i+1;
|
||||
lastBlk = blk;
|
||||
blk = EeFsGetLink(blk);
|
||||
|
@ -163,15 +138,11 @@ void eepromCheck()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
freeBlocks = blocksCount;
|
||||
#endif
|
||||
|
||||
for (blk=FIRSTBLK; blk<BLOCKS; blk++) {
|
||||
if (!bufp[blk]) { // unused block
|
||||
#if defined(CPUARM)
|
||||
freeBlocks++;
|
||||
#endif
|
||||
EeFsSetLink(blk, eeFs.freeList);
|
||||
eeFs.freeList = blk; // chain in front
|
||||
EeFsFlushFreelist();
|
||||
|
@ -201,9 +172,7 @@ void storageFormat()
|
|||
}
|
||||
EeFsSetLink(BLOCKS-1, 0);
|
||||
eeFs.freeList = FIRSTBLK;
|
||||
#if defined(CPUARM)
|
||||
freeBlocks = BLOCKS;
|
||||
#endif
|
||||
EeFsFlush();
|
||||
|
||||
ENABLE_SYNC_WRITE(false);
|
||||
|
@ -358,9 +327,7 @@ void RlcFile::nextWriteStep()
|
|||
if (!m_currBlk && m_pos==0) {
|
||||
eeFs.files[FILE_TMP].startBlk = m_currBlk = eeFs.freeList;
|
||||
if (m_currBlk) {
|
||||
#if defined(CPUARM)
|
||||
freeBlocks--;
|
||||
#endif
|
||||
eeFs.freeList = EeFsGetLink(m_currBlk);
|
||||
m_write_step |= WRITE_FIRST_LINK;
|
||||
EeFsFlushFreelist();
|
||||
|
@ -397,9 +364,7 @@ void RlcFile::nextWriteStep()
|
|||
switch (m_write_step & 0x0f) {
|
||||
case WRITE_NEXT_LINK_1:
|
||||
m_currBlk = eeFs.freeList;
|
||||
#if defined(CPUARM)
|
||||
freeBlocks--;
|
||||
#endif
|
||||
eeFs.freeList = EeFsGetLink(eeFs.freeList);
|
||||
m_write_step += 1;
|
||||
EeFsFlushFreelist();
|
||||
|
@ -636,9 +601,7 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
eeLoadModelHeader(i_fileDst, &modelHeaders[i_fileDst]);
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -722,14 +685,10 @@ void RlcFile::nextRlcWriteStep()
|
|||
// TODO reuse EeFsFree!!!
|
||||
blkid_t prev_freeList = eeFs.freeList;
|
||||
eeFs.freeList = fri;
|
||||
#if defined(CPUARM)
|
||||
freeBlocks++;
|
||||
#endif
|
||||
while (EeFsGetLink(fri)) {
|
||||
fri = EeFsGetLink(fri);
|
||||
#if defined(CPUARM)
|
||||
freeBlocks++;
|
||||
#endif
|
||||
}
|
||||
m_write_step = WRITE_FREE_UNUSED_BLOCKS_STEP1;
|
||||
EeFsSetLink(fri, prev_freeList);
|
||||
|
@ -795,20 +754,16 @@ void RlcFile::drawProgressBar(uint8_t x)
|
|||
#endif
|
||||
|
||||
// For conversions ...
|
||||
#if defined(CPUARM)
|
||||
uint16_t eeLoadGeneralSettingsData()
|
||||
{
|
||||
memset(&g_eeGeneral, 0, sizeof(g_eeGeneral));
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
return theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral));
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t eeLoadModelData(uint8_t index)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
memset(&g_model, 0, sizeof(g_model));
|
||||
#endif
|
||||
theFile.openRlc(FILE_MODEL(index));
|
||||
return theFile.readRlc((uint8_t*)&g_model, sizeof(g_model));
|
||||
}
|
||||
|
@ -886,7 +841,6 @@ void storageCheck(bool immediately)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void eeLoadModelHeader(uint8_t id, ModelHeader *header)
|
||||
{
|
||||
memclear(header, sizeof(ModelHeader));
|
||||
|
@ -922,7 +876,6 @@ void eeDeleteModel(uint8_t idx)
|
|||
EFile::rm(FILE_MODEL(idx));
|
||||
memset(&modelHeaders[idx], 0, sizeof(ModelHeader));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
void eepromBackup()
|
||||
|
|
|
@ -23,22 +23,10 @@
|
|||
|
||||
#include "definitions.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define blkid_t uint16_t
|
||||
#define EEFS_VERS 5
|
||||
#define MAXFILES 62
|
||||
#define BS 64
|
||||
#elif defined(CPUM2560) || defined(CPUM2561) || defined(CPUM128)
|
||||
#define blkid_t uint8_t
|
||||
#define EEFS_VERS 5
|
||||
#define MAXFILES 36
|
||||
#define BS 16
|
||||
#else
|
||||
#define blkid_t uint8_t
|
||||
#define EEFS_VERS 4
|
||||
#define MAXFILES 20
|
||||
#define BS 16
|
||||
#endif
|
||||
|
||||
PACK(struct DirEnt {
|
||||
blkid_t startBlk;
|
||||
|
@ -46,11 +34,7 @@ PACK(struct DirEnt {
|
|||
uint16_t typ:4;
|
||||
});
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EEFS_EXTRA_FIELDS uint8_t spare[2];
|
||||
#else
|
||||
#define EEFS_EXTRA_FIELDS
|
||||
#endif
|
||||
|
||||
PACK(struct EeFs {
|
||||
uint8_t version;
|
||||
|
@ -74,15 +58,9 @@ extern EeFs eeFs;
|
|||
|
||||
#define RESV sizeof(EeFs) //reserv for eeprom header with directory (eeFs)
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define FIRSTBLK (RESV/BS)
|
||||
#define BLOCKS (EEPROM_SIZE/BS)
|
||||
#define BLOCKS_OFFSET 0
|
||||
#else
|
||||
#define FIRSTBLK 1
|
||||
#define BLOCKS (1+(EEPROM_SIZE-RESV)/BS)
|
||||
#define BLOCKS_OFFSET (RESV-BS)
|
||||
#endif
|
||||
|
||||
uint16_t EeFsGetFree();
|
||||
|
||||
|
@ -200,15 +178,9 @@ inline void eepromWriteProcess()
|
|||
#define DISPLAY_PROGRESS_BAR(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool eeCopyModel(uint8_t dst, uint8_t src);
|
||||
void eeSwapModels(uint8_t id1, uint8_t id2);
|
||||
void eeDeleteModel(uint8_t idx);
|
||||
#else
|
||||
#define eeCopyModel(dst, src) theFile.copy(FILE_MODEL(dst), FILE_MODEL(src))
|
||||
#define eeSwapModels(id1, id2) EFile::swap(FILE_MODEL(id1), FILE_MODEL(id2))
|
||||
#define eeDeleteModel(idx) EFile::rm(FILE_MODEL(idx))
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
const pm_char * eeBackupModel(uint8_t i_fileSrc);
|
||||
|
@ -216,17 +188,14 @@ const pm_char * eeRestoreModel(uint8_t i_fileDst, char *model_name);
|
|||
#endif
|
||||
|
||||
// For conversions
|
||||
#if defined(CPUARM)
|
||||
void loadRadioSettingsSettings();
|
||||
void loadModel(int index, bool alarms=true);
|
||||
#endif
|
||||
|
||||
bool eepromOpen();
|
||||
void eeLoadModelName(uint8_t id, char *name);
|
||||
bool eeLoadGeneral();
|
||||
|
||||
// For EEPROM backup/restore
|
||||
#if defined(CPUARM)
|
||||
inline bool isEepromStart(const void * buffer)
|
||||
{
|
||||
// OpenTX EEPROM
|
||||
|
@ -249,6 +218,5 @@ inline bool isEepromStart(const void * buffer)
|
|||
}
|
||||
|
||||
void eepromBackup();
|
||||
#endif
|
||||
|
||||
#endif // _EEPROM_RLC_H_
|
||||
|
|
|
@ -193,14 +193,12 @@ void storageReadAll()
|
|||
storageEraseAll(true);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t i=0; languagePacks[i]!=NULL; i++) {
|
||||
if (!strncmp(g_eeGeneral.ttsLanguage, languagePacks[i]->id, 2)) {
|
||||
currentLanguagePackIdx = i;
|
||||
currentLanguagePack = languagePacks[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (loadModel(g_eeGeneral.currModelFilename, false) != NULL) {
|
||||
sdCheckAndCreateDirectory(MODELS_PATH);
|
||||
|
|
|
@ -29,8 +29,6 @@
|
|||
#define WRITE_DELAY_10MS 500
|
||||
#elif defined(PCBSKY9X) && !defined(REV0)
|
||||
#define WRITE_DELAY_10MS 500
|
||||
#elif defined(PCBGRUVIN9X) && !defined(REV0)
|
||||
#define WRITE_DELAY_10MS 500
|
||||
#else
|
||||
#define WRITE_DELAY_10MS 200
|
||||
#endif
|
||||
|
|
|
@ -41,9 +41,7 @@ void storageDirty(uint8_t msk)
|
|||
|
||||
void preModelLoad()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
watchdogSuspend(500/*5s*/);
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
logsClose();
|
||||
|
@ -76,7 +74,6 @@ void postModelLoad(bool alarms)
|
|||
|
||||
restoreTimers();
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent) {
|
||||
|
@ -84,7 +81,6 @@ void postModelLoad(bool alarms)
|
|||
telemetryItems[i].lastReceived = TELEMETRY_VALUE_OLD; // #3595: make value visible even before the first new value is received)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LOAD_MODEL_CURVES();
|
||||
|
||||
|
@ -120,7 +116,6 @@ void storageFlushCurrentModel()
|
|||
{
|
||||
saveTimers();
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED && sensor.persistent && sensor.persistentValue != telemetryItems[i].value) {
|
||||
|
@ -128,9 +123,7 @@ void storageFlushCurrentModel()
|
|||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (g_model.potsWarnMode == POTS_WARN_AUTO) {
|
||||
for (int i=0; i<NUM_POTS+NUM_SLIDERS; i++) {
|
||||
if (!(g_model.potsWarnEnabled & (1 << i))) {
|
||||
|
@ -139,5 +132,4 @@ void storageFlushCurrentModel()
|
|||
}
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ char idx2char(int8_t idx)
|
|||
return ' ';
|
||||
}
|
||||
|
||||
#if defined(CPUARM) || defined(SIMU)
|
||||
int8_t char2idx(char c)
|
||||
{
|
||||
if (c == '_') return 37;
|
||||
|
@ -78,9 +77,7 @@ int zchar2str(char * dest, const char * src, int size)
|
|||
} while (size >= 0 && dest[size] == ' ');
|
||||
return size+1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
unsigned int effectiveLen(const char * str, unsigned int size)
|
||||
{
|
||||
while (size > 0) {
|
||||
|
@ -143,7 +140,6 @@ char * strcat_zchar(char * dest, const char * name, uint8_t size, const char * d
|
|||
return &dest[len];
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
char * getStringAtIndex(char * dest, const char * s, int idx)
|
||||
|
@ -438,7 +434,6 @@ char * strAppendSigned(char * dest, int32_t value, uint8_t digits, uint8_t radix
|
|||
return strAppendUnsigned(dest, (uint32_t)value, digits, radix);
|
||||
}
|
||||
|
||||
#if defined(CPUARM) || defined(SDCARD)
|
||||
char * strAppend(char * dest, const char * source, int len)
|
||||
{
|
||||
while ((*dest++ = *source++)) {
|
||||
|
@ -516,4 +511,3 @@ char * strAppendDate(char * str, bool time)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#define SWITCH_WARNING_LIST_Y 4*FH+4
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
enum LogicalSwitchContextState {
|
||||
SWITCH_START,
|
||||
|
@ -57,15 +56,6 @@ LogicalSwitchesFlightModeContext lswFm[MAX_FLIGHT_MODES];
|
|||
|
||||
#define LS_LAST_VALUE(fm, idx) lswFm[fm].lsw[idx].lastValue
|
||||
|
||||
#else
|
||||
|
||||
int16_t lsLastValue[MAX_LOGICAL_SWITCHES];
|
||||
#define LS_LAST_VALUE(fm, idx) lsLastValue[idx]
|
||||
|
||||
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_used = 0;
|
||||
volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value = 0;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#if defined(PCBX9E)
|
||||
|
@ -231,21 +221,10 @@ bool getLogicalSwitch(uint8_t idx)
|
|||
LogicalSwitchData * ls = lswAddress(idx);
|
||||
bool result;
|
||||
|
||||
#if defined(CPUARM)
|
||||
swsrc_t s = ls->andsw;
|
||||
#else
|
||||
uint8_t s = ls->andsw;
|
||||
if (s > SWSRC_LAST_SWITCH) {
|
||||
s += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ls->func == LS_FUNC_NONE || (s && !getSwitch(s))) {
|
||||
#if defined(CPUARM)
|
||||
if (ls->func != LS_FUNC_STICKY && ls->func != LS_FUNC_EDGE ) {
|
||||
#else
|
||||
if (ls->func != LS_FUNC_STICKY) {
|
||||
#endif
|
||||
// AND switch must not affect STICKY and EDGE processing
|
||||
LS_LAST_VALUE(mixerCurrentFlightMode, idx) = CS_LAST_VALUE_INIT;
|
||||
}
|
||||
|
@ -273,11 +252,9 @@ bool getLogicalSwitch(uint8_t idx)
|
|||
else if (s == LS_FAMILY_STICKY) {
|
||||
result = (LS_LAST_VALUE(mixerCurrentFlightMode, idx) & (1<<0));
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (s == LS_FAMILY_EDGE) {
|
||||
result = (LS_LAST_VALUE(mixerCurrentFlightMode, idx) & (1<<0));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
getvalue_t x = getValueForLogicalSwitch(ls->v1);
|
||||
getvalue_t y;
|
||||
|
@ -301,26 +278,13 @@ bool getLogicalSwitch(uint8_t idx)
|
|||
#if defined(TELEMETRY_FRSKY)
|
||||
// Telemetry
|
||||
if (v1 >= MIXSRC_FIRST_TELEM) {
|
||||
#if defined(CPUARM)
|
||||
if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1-1)) {
|
||||
#else
|
||||
if ((!TELEMETRY_STREAMING() && v1 >= MIXSRC_FIRST_TELEM+TELEM_FIRST_STREAMED_VALUE-1) || IS_FAI_FORBIDDEN(v1-1)) {
|
||||
#endif
|
||||
result = false;
|
||||
goto DurationAndDelayProcessing;
|
||||
}
|
||||
|
||||
y = convertLswTelemValue(ls);
|
||||
|
||||
#if defined(GAUGES) && !defined(CPUARM)
|
||||
// Fill the telemetry bars threshold array
|
||||
if (s == LS_FAMILY_OFS) {
|
||||
uint8_t idx = v1-MIXSRC_FIRST_TELEM+1-TELEM_ALT;
|
||||
if (idx < THLD_MAX) {
|
||||
FILL_THRESHOLD(idx, ls->v2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
else if (v1 >= MIXSRC_GVAR1) {
|
||||
|
@ -342,11 +306,9 @@ bool getLogicalSwitch(uint8_t idx)
|
|||
#endif
|
||||
|
||||
switch (ls->func) {
|
||||
#if defined(CPUARM)
|
||||
case LS_FUNC_VEQUAL:
|
||||
result = (x==y);
|
||||
break;
|
||||
#endif
|
||||
case LS_FUNC_VALMOSTEQUAL:
|
||||
#if defined(GVARS)
|
||||
if (v1 >= MIXSRC_GVAR1 && v1 <= MIXSRC_LAST_GVAR)
|
||||
|
@ -402,7 +364,6 @@ bool getLogicalSwitch(uint8_t idx)
|
|||
DurationAndDelayProcessing:
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (ls->delay || ls->duration) {
|
||||
LogicalSwitchContext &context = lswFm[mixerCurrentFlightMode].lsw[idx];
|
||||
if (result) {
|
||||
|
@ -439,16 +400,11 @@ DurationAndDelayProcessing:
|
|||
context.timer = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool getSwitch(swsrc_t swtch, uint8_t flags)
|
||||
#else
|
||||
bool getSwitch(swsrc_t swtch)
|
||||
#endif
|
||||
{
|
||||
bool result;
|
||||
|
||||
|
@ -508,7 +464,6 @@ bool getSwitch(swsrc_t swtch)
|
|||
result = REB_DOWN();
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
else if (cs_idx >= SWSRC_FIRST_SENSOR) {
|
||||
result = !telemetryItems[cs_idx-SWSRC_FIRST_SENSOR].isOld();
|
||||
}
|
||||
|
@ -526,33 +481,14 @@ bool getSwitch(swsrc_t swtch)
|
|||
result = false;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
cs_idx -= SWSRC_FIRST_LOGICAL_SWITCH;
|
||||
#if defined(CPUARM)
|
||||
result = lswFm[mixerCurrentFlightMode].lsw[cs_idx].state;
|
||||
#else
|
||||
GETSWITCH_RECURSIVE_TYPE mask = ((GETSWITCH_RECURSIVE_TYPE)1 << cs_idx);
|
||||
if (s_last_switch_used & mask) {
|
||||
result = (s_last_switch_value & mask);
|
||||
}
|
||||
else {
|
||||
s_last_switch_used |= mask;
|
||||
result = getLogicalSwitch(cs_idx);
|
||||
if (result) {
|
||||
s_last_switch_value |= mask;
|
||||
}
|
||||
else {
|
||||
s_last_switch_value &= ~mask;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return swtch > 0 ? result : !result;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
/**
|
||||
@brief Calculates new state of logical switches for mixerCurrentFlightMode
|
||||
*/
|
||||
|
@ -572,7 +508,6 @@ void evalLogicalSwitches(bool isCurrentPhase)
|
|||
context.state = result;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
swarnstate_t switches_states = 0;
|
||||
swsrc_t getMovedSwitch()
|
||||
|
@ -843,9 +778,7 @@ void checkSwitches()
|
|||
wdt_reset();
|
||||
|
||||
SIMU_SLEEP(1);
|
||||
#if defined(CPUARM)
|
||||
CoTickDelay(10);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -855,9 +788,7 @@ void checkSwitches()
|
|||
|
||||
void logicalSwitchesTimerTick()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t fm=0; fm<MAX_FLIGHT_MODES; fm++) {
|
||||
#endif
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
LogicalSwitchData * ls = lswAddress(i);
|
||||
if (ls->func == LS_FUNC_TIMER) {
|
||||
|
@ -895,7 +826,6 @@ void logicalSwitchesTimerTick()
|
|||
}
|
||||
}
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (ls->func == LS_FUNC_EDGE) {
|
||||
ls_stay_struct & lastValue = (ls_stay_struct &)LS_LAST_VALUE(fm, i);
|
||||
// if this ls was reset by the logicalSwitchesReset() the lastValue will be set to CS_LAST_VALUE_INIT(0x8000)
|
||||
|
@ -925,11 +855,8 @@ void logicalSwitchesTimerTick()
|
|||
if (context.timer) {
|
||||
context.timer--;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LogicalSwitchData * lswAddress(uint8_t idx)
|
||||
|
@ -943,10 +870,8 @@ uint8_t lswFamily(uint8_t func)
|
|||
return LS_FAMILY_OFS;
|
||||
else if (func <= LS_FUNC_XOR)
|
||||
return LS_FAMILY_BOOL;
|
||||
#if defined(CPUARM)
|
||||
else if (func == LS_FUNC_EDGE)
|
||||
return LS_FAMILY_EDGE;
|
||||
#endif
|
||||
else if (func <= LS_FUNC_LESS)
|
||||
return LS_FAMILY_COMP;
|
||||
else if (func <= LS_FUNC_ADIFFEGREATER)
|
||||
|
@ -962,40 +887,23 @@ int16_t lswTimerValue(delayval_t val)
|
|||
|
||||
void logicalSwitchesReset()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
memset(lswFm, 0, sizeof(lswFm));
|
||||
#else
|
||||
s_last_switch_value = 0;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t fm=0; fm<MAX_FLIGHT_MODES; fm++) {
|
||||
#endif
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
LS_LAST_VALUE(fm, i) = CS_LAST_VALUE_INIT;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
getvalue_t convertLswTelemValue(LogicalSwitchData * ls)
|
||||
{
|
||||
getvalue_t val;
|
||||
#if defined(CPUARM)
|
||||
val = convert16bitsTelemValue(ls->v1 - MIXSRC_FIRST_TELEM + 1, ls->v2);
|
||||
#else
|
||||
if (lswFamily(ls->func)==LS_FAMILY_OFS)
|
||||
val = convert8bitsTelemValue(ls->v1 - MIXSRC_FIRST_TELEM + 1, 128+ls->v2);
|
||||
else
|
||||
val = convert8bitsTelemValue(ls->v1 - MIXSRC_FIRST_TELEM + 1, 128+ls->v2) - convert8bitsTelemValue(ls->v1 - MIXSRC_FIRST_TELEM + 1, 128);
|
||||
#endif
|
||||
return val;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst)
|
||||
{
|
||||
lswFm[dst] = lswFm[src];
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -25,11 +25,7 @@
|
|||
#define MAX_LOGICAL_SWITCHES NUM_CSW
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define GET_SWITCH_BOOL(sw__) getSwitch((sw__), 0);
|
||||
#else
|
||||
#define GET_SWITCH_BOOL(sw__) getSwitch(sw__);
|
||||
#endif
|
||||
|
||||
#define OTXS_DBG qDebug() << "(" << simuTimerMicros() << "us)"
|
||||
|
||||
|
@ -211,7 +207,6 @@ void OpenTxSimulator::setTrim(unsigned int idx, int value)
|
|||
i = modn12x3[4 * getStickMode() + idx];
|
||||
uint8_t phase = getTrimFlightMode(getFlightMode(), i);
|
||||
|
||||
#ifdef CPUARM
|
||||
if (!setTrimValue(phase, i, value)) {
|
||||
QTimer *timer = new QTimer(this);
|
||||
timer->setSingleShot(true);
|
||||
|
@ -222,9 +217,6 @@ void OpenTxSimulator::setTrim(unsigned int idx, int value)
|
|||
});
|
||||
timer->start(350);
|
||||
}
|
||||
#else
|
||||
setTrimValue(phase, i, value);
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenTxSimulator::setTrainerInput(unsigned int inputNumber, int16_t value)
|
||||
|
@ -535,10 +527,8 @@ void OpenTxSimulator::checkOutputsChanged()
|
|||
#if defined(GVAR_VALUE) && defined(GVARS)
|
||||
gVarMode_t gvar;
|
||||
for (uint8_t gv=0; gv < MAX_GVARS; gv++) {
|
||||
#if !defined(PCBSTD)
|
||||
gvar.prec = g_model.gvars[gv].prec;
|
||||
gvar.unit = g_model.gvars[gv].unit;
|
||||
#endif
|
||||
for (uint8_t fm=0; fm < MAX_FLIGHT_MODES; fm++) {
|
||||
gvar.mode = fm;
|
||||
gvar.value = (int16_t)GVAR_VALUE(gv, getGVarFlightMode(fm, gv));
|
||||
|
@ -588,8 +578,6 @@ const int OpenTxSimulator::voltageToAdc(const int volts)
|
|||
ret = (float)volts * 16.2f;
|
||||
#elif defined(PCBTARANIS) || defined(PCBSKY9X)
|
||||
ret = (float)volts * 13.3f;
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
ret = (float)volts * 1.63f;
|
||||
#else
|
||||
ret = (float)volts * 14.15f;
|
||||
#endif
|
||||
|
|
|
@ -18,12 +18,7 @@
|
|||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#if defined(QT_CORE_LIB) && 0 // experimental
|
||||
#define SIMPGMSPC_USE_QT 1
|
||||
#include <QElapsedTimer>
|
||||
#else
|
||||
#define SIMPGMSPC_USE_QT 0
|
||||
#endif
|
||||
|
||||
#include "opentx.h"
|
||||
#include <errno.h>
|
||||
|
@ -58,7 +53,7 @@ DMA_Stream_TypeDef dma1_stream2, dma1_stream5, dma1_stream7, dma2_stream1, dma2_
|
|||
DMA_TypeDef dma2;
|
||||
USART_TypeDef Usart0, Usart1, Usart2, Usart3, Usart4;
|
||||
SysTick_Type systick;
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
Pio Pioa, Piob, Pioc;
|
||||
Pmc pmc;
|
||||
Ssc ssc;
|
||||
|
@ -159,7 +154,6 @@ void simuInit()
|
|||
if ((int)state > 0) pin |= (mask); else pin &= ~(mask); \
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBHORUS) || (defined(PCBTARANIS) && !defined(PCBX9E))
|
||||
#define SWITCH_CASE NEG_CASE
|
||||
#define SWITCH_INV POS_CASE
|
||||
|
@ -173,19 +167,6 @@ void simuInit()
|
|||
if ((int)state > 0) pin2 &= ~(mask2); else pin2 |= (mask2); \
|
||||
break;
|
||||
#define SWITCH_3_INV(swtch, pin1, pin2, mask1, mask2) SWITCH_3_CASE(swtch, pin2, pin1, mask2, mask1)
|
||||
#else // AVR
|
||||
#if defined(PCBMEGA2560)
|
||||
#define SWITCH_CASE POS_CASE
|
||||
#else
|
||||
#define SWITCH_CASE NEG_CASE
|
||||
#endif
|
||||
#define KEY_CASE POS_CASE
|
||||
#define SWITCH_3_CASE(swtch, pin1, pin2, mask1, mask2) \
|
||||
case swtch: \
|
||||
if ((int)state >= 0) pin1 &= ~(mask1); else pin1 |= (mask1); \
|
||||
if ((int)state <= 0) pin2 &= ~(mask2); else pin2 |= (mask2); \
|
||||
break;
|
||||
#endif
|
||||
|
||||
#define TRIM_CASE KEY_CASE
|
||||
|
||||
|
@ -236,10 +217,6 @@ void simuSetKey(uint8_t key, bool state)
|
|||
#endif
|
||||
#if defined(PCBSKY9X) && !defined(REVX) && !defined(AR9X) && defined(ROTARY_ENCODERS)
|
||||
KEY_CASE(BTN_REa, PIOB->PIO_PDSR, 0x40)
|
||||
#elif (defined(PCBGRUVIN9X) || defined(PCBMEGA2560)) && (defined(ROTARY_ENCODERS) || defined(ROTARY_ENCODER_NAVIGATION))
|
||||
KEY_CASE(BTN_REa, pind, 0x20)
|
||||
#elif defined(PCB9X) && defined(ROTARY_ENCODER_NAVIGATION)
|
||||
KEY_CASE(BTN_REa, RotEncoder, 0x20)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -329,22 +306,6 @@ void simuSetSwitch(uint8_t swtch, int8_t state)
|
|||
SWITCH_CASE(4, PIOA->PIO_PDSR, 1<<2)
|
||||
SWITCH_CASE(5, PIOC->PIO_PDSR, 1<<16)
|
||||
SWITCH_CASE(6, PIOC->PIO_PDSR, 1<<8)
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
SWITCH_3_CASE(0, ping, pinb, (1<<INP_G_ID1), (1<<INP_B_ID2))
|
||||
SWITCH_CASE(1, ping, 1<<INP_G_ThrCt)
|
||||
SWITCH_CASE(2, ping, 1<<INP_G_RuddDR)
|
||||
SWITCH_CASE(3, pinc, 1<<INP_C_ElevDR)
|
||||
SWITCH_CASE(4, pinc, 1<<INP_C_AileDR)
|
||||
SWITCH_CASE(5, ping, 1<<INP_G_Gear)
|
||||
SWITCH_CASE(6, pinb, 1<<INP_B_Trainer)
|
||||
#elif defined(PCBMEGA2560)
|
||||
SWITCH_3_CASE(0, pinc, pinc, (1<<INP_C_ID1), (1<<INP_C_ID2))
|
||||
SWITCH_CASE(1, ping, 1<<INP_G_ThrCt)
|
||||
SWITCH_CASE(2, ping, 1<<INP_G_RuddDR)
|
||||
SWITCH_CASE(3, pinc, 1<<INP_L_ElevDR)
|
||||
SWITCH_CASE(4, pinc, 1<<INP_C_AileDR)
|
||||
SWITCH_CASE(5, ping, 1<<INP_G_Gear)
|
||||
SWITCH_CASE(6, pinb, 1<<INP_L_Trainer)
|
||||
#else // PCB9X
|
||||
SWITCH_3_CASE(0, ping, pine, (1<<INP_G_ID1), (1<<INP_E_ID2))
|
||||
#if defined(TELEMETRY_JETI) || defined(TELEMETRY_FRSKY) || defined(TELEMETRY_NMEA) || defined(TELEMETRY_ARDUPILOT) || defined(TELEMETRY_MAVLINK)
|
||||
|
@ -418,14 +379,11 @@ void StopSimu()
|
|||
|
||||
main_thread_running = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
pthread_join(mixerTaskId, NULL);
|
||||
pthread_join(menusTaskId, NULL);
|
||||
#endif
|
||||
pthread_join(main_thread_pid, NULL);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
struct SimulatorAudio {
|
||||
int volumeGain;
|
||||
int currentVolume;
|
||||
|
@ -434,7 +392,6 @@ struct SimulatorAudio {
|
|||
bool threadRunning;
|
||||
pthread_t threadPid;
|
||||
} simuAudio;
|
||||
#endif
|
||||
|
||||
void audioConsumeCurrentBuffer()
|
||||
{
|
||||
|
@ -636,7 +593,6 @@ int lcdRestoreBackupBuffer()
|
|||
}
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
void pwrOff()
|
||||
{
|
||||
}
|
||||
|
@ -648,7 +604,6 @@ uint32_t pwrPressed()
|
|||
return true;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
void pwrInit() { }
|
||||
|
|
|
@ -208,16 +208,10 @@ extern uint8_t eeprom[EEPROM_SIZE];
|
|||
extern uint8_t * eeprom;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern void startPdcUsartReceive() ;
|
||||
extern uint32_t txPdcUsart( uint8_t *buffer, uint32_t size );
|
||||
extern uint32_t txPdcPending();
|
||||
extern void rxPdcUsart( void (*pChProcess)(uint8_t x) );
|
||||
#else
|
||||
#define PIOA 0
|
||||
#define PIOB 0
|
||||
#define PIOC 0
|
||||
#endif
|
||||
|
||||
#define loop_until_bit_is_set( port, bitnum) \
|
||||
while ( 0/*! ( (port) & (1 << (bitnum)) )*/ ) ;
|
||||
|
@ -336,7 +330,6 @@ extern void rxPdcUsart( void (*pChProcess)(uint8_t x) );
|
|||
#define asm(...)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern uint32_t Master_frequency;
|
||||
#define NVIC_EnableIRQ(x)
|
||||
#define NVIC_DisableIRQ(x)
|
||||
|
@ -344,7 +337,6 @@ extern uint32_t Master_frequency;
|
|||
#define NVIC_SystemReset() exit(0)
|
||||
#define __disable_irq()
|
||||
#define __enable_irq()
|
||||
#endif
|
||||
|
||||
extern uint8_t portb, portc, porth, dummyport;
|
||||
extern uint16_t dummyport16;
|
||||
|
@ -378,11 +370,6 @@ void StopEepromThread();
|
|||
#define StopAudioThread()
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#define wdt_disable(...) sleep(1/*ms*/)
|
||||
#define wdt_enable(...) sleep(1/*ms*/)
|
||||
#define wdt_reset() sleep(1/*ms*/)
|
||||
#endif
|
||||
|
||||
#define OS_MutexID pthread_mutex_t
|
||||
extern OS_MutexID audioMutex;
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE];
|
||||
uint8_t frskyTxBufferCount = 0;
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETREZ)
|
||||
#define PRIVATE 0x1B
|
||||
|
@ -152,23 +148,3 @@ NOINLINE void processFrskyTelemetryData(uint8_t data)
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB) && !defined(CPUARM)
|
||||
void frskyUpdateCells(void)
|
||||
{
|
||||
// Voltage => Cell number + Cell voltage
|
||||
uint8_t battnumber = ((telemetryData.hub.volts & 0x00F0) >> 4);
|
||||
if (battnumber < 12) {
|
||||
if (telemetryData.hub.cellsCount < battnumber+1) {
|
||||
telemetryData.hub.cellsCount = battnumber+1;
|
||||
}
|
||||
uint8_t cellVolts = (uint8_t)(((((telemetryData.hub.volts & 0xFF00) >> 8) + ((telemetryData.hub.volts & 0x000F) << 8))) / 10);
|
||||
telemetryData.hub.cellVolts[battnumber] = cellVolts;
|
||||
if (!telemetryData.hub.minCellVolts || cellVolts<telemetryData.hub.minCellVolts || battnumber==telemetryData.hub.minCellIdx) {
|
||||
telemetryData.hub.minCellIdx = battnumber;
|
||||
telemetryData.hub.minCellVolts = cellVolts;
|
||||
if (!telemetryData.hub.minCell || telemetryData.hub.minCellVolts<telemetryData.hub.minCell)
|
||||
telemetryData.hub.minCell = telemetryData.hub.minCellVolts;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -194,116 +194,6 @@ enum FrSkyDataState {
|
|||
#define DATA_ID_SP2UH 0x45 // 5
|
||||
#define DATA_ID_SP2UR 0xC6 // 6
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB)
|
||||
PACK(struct FrskyTelemetryData {
|
||||
int16_t baroAltitudeOffset; // spare reused
|
||||
int16_t gpsAltitude_bp; // 0x01 before punct
|
||||
int16_t temperature1; // 0x02 -20 .. 250 deg. celcius
|
||||
uint16_t rpm; // 0x03 0..60,000 revs. per minute
|
||||
uint16_t fuelLevel; // 0x04 0, 25, 50, 75, 100 percent
|
||||
int16_t temperature2; // 0x05 -20 .. 250 deg. celcius
|
||||
uint16_t volts; // 0x06 1/500V increments (0..4.2V)
|
||||
uint32_t distFromEarthAxis; // 2 spares reused
|
||||
int16_t gpsAltitude_ap; // 0x01+8 after punct
|
||||
uint8_t cellVolts[12]; // 6 spares reused
|
||||
int16_t baroAltitude_bp; // 0x10 0..9,999 meters
|
||||
uint16_t gpsSpeed_bp; // 0x11 before punct
|
||||
uint16_t gpsLongitude_bp; // 0x12 before punct
|
||||
uint16_t gpsLatitude_bp; // 0x13 before punct
|
||||
uint16_t gpsCourse_bp; // 0x14 before punct (0..359.99 deg. -- seemingly 2-decimal precision)
|
||||
uint8_t day; // 0x15
|
||||
uint8_t month; // 0x15
|
||||
uint16_t year; // 0x16
|
||||
uint8_t hour; // 0x17
|
||||
uint8_t min; // 0x17
|
||||
uint16_t sec; // 0x18
|
||||
uint16_t gpsSpeed_ap; // 0x11+8
|
||||
uint16_t gpsLongitude_ap; // 0x12+8
|
||||
uint16_t gpsLatitude_ap; // 0x13+8
|
||||
uint16_t gpsCourse_ap; // 0x14+8
|
||||
uint32_t pilotLatitude; // 2 spares reused
|
||||
uint32_t pilotLongitude; // 2 spares reused
|
||||
uint16_t baroAltitude_ap; // 0x21 after punct
|
||||
uint16_t gpsLongitudeEW; // 0x1A+8 East/West
|
||||
uint16_t gpsLatitudeNS; // 0x1B+8 North/South
|
||||
int16_t accelX; // 0x24 1/256th gram (-8g ~ +8g)
|
||||
int16_t accelY; // 0x25 1/256th gram (-8g ~ +8g)
|
||||
int16_t accelZ; // 0x26 1/256th gram (-8g ~ +8g)
|
||||
uint8_t gpsDistNeeded:1; // 1bits out of 16bits spare reused
|
||||
int8_t gpsFix:2; // 2bits out of 16bits spare reused: -1=never fixed, 0=not fixed now, 1=fixed
|
||||
uint8_t openXsensor:1; // 1bits out of 16bits spare reused: we receive data from the openXsensor
|
||||
uint8_t cellsCount:4; // 4bits out of 16bits spare reused
|
||||
uint8_t minCellVolts; // 8bits out of 16bits spare reused
|
||||
uint16_t current; // 0x28 Current
|
||||
int16_t spare[5];
|
||||
int32_t varioAltitude_cm;
|
||||
int16_t varioSpeed; // 0x30 Vertical speed in cm/s
|
||||
|
||||
uint16_t gpsDistance;
|
||||
int16_t gpsAltitudeOffset;
|
||||
uint8_t varioAltitudeQueuePointer; // circular-buffer pointer
|
||||
uint8_t minCellIdx;
|
||||
int16_t cellsSum;
|
||||
uint16_t currentConsumption; // 0x35 openXsensor only! Otherwise calculated by the Tx from current
|
||||
uint16_t currentPrescale;
|
||||
uint16_t power; // 0x37 openXsensor only! Otherwise calculated by the Tx from current and voltage
|
||||
int16_t airSpeed;
|
||||
|
||||
uint16_t vfas; // 0x39 Added to FrSky protocol for home made sensors with a better precision
|
||||
uint16_t volts_bp; // 0x3A
|
||||
uint16_t volts_ap; // 0x3B
|
||||
// end of FrSky Hub data
|
||||
|
||||
/* next fields must keep this order! */
|
||||
int16_t minAltitude;
|
||||
int16_t maxAltitude;
|
||||
uint16_t maxRpm;
|
||||
int16_t maxTemperature1;
|
||||
int16_t maxTemperature2;
|
||||
uint16_t maxGpsSpeed;
|
||||
uint16_t maxGpsDistance;
|
||||
uint16_t maxAirSpeed;
|
||||
int16_t minCell;
|
||||
int16_t minCells;
|
||||
int16_t minVfas;
|
||||
uint16_t maxCurrent;
|
||||
uint16_t maxPower;
|
||||
/* end */
|
||||
|
||||
int16_t dTE;
|
||||
});
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
PACK(struct FrskyTelemetryData {
|
||||
int16_t baroAltitude_bp; // 0..9,999 meters
|
||||
int16_t baroAltitudeOffset;
|
||||
int16_t minAltitude;
|
||||
int16_t maxAltitude;
|
||||
uint16_t currentConsumption;
|
||||
uint16_t currentPrescale;
|
||||
uint16_t power;
|
||||
uint16_t maxPower;
|
||||
#if defined(VARIO)
|
||||
int16_t varioSpeed; // Vertical speed in cm/s
|
||||
#endif
|
||||
});
|
||||
#elif defined(VARIO)
|
||||
PACK(struct FrskyTelemetryData {
|
||||
int16_t varioSpeed; // Vertical speed in cm/s
|
||||
uint16_t currentConsumption;
|
||||
uint16_t currentPrescale;
|
||||
uint16_t power;
|
||||
uint16_t maxPower;
|
||||
});
|
||||
#else
|
||||
PACK(struct FrskyTelemetryData {
|
||||
uint16_t currentConsumption;
|
||||
uint16_t currentPrescale;
|
||||
uint16_t power;
|
||||
uint16_t maxPower;
|
||||
});
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(NO_RAS)
|
||||
#define IS_RAS_VALUE_VALID() (false)
|
||||
|
@ -327,7 +217,6 @@ enum AlarmLevel {
|
|||
#define ALARM_GREATER(channel, alarm) ((g_model.frsky.channels[channel].alarms_greater >> alarm) & 1)
|
||||
#define ALARM_LEVEL(channel, alarm) ((g_model.frsky.channels[channel].alarms_level >> (2*alarm)) & 3)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_STREAMING() (telemetryData.rssi.value > 0)
|
||||
#define TELEMETRY_RSSI() (telemetryData.rssi.value)
|
||||
#define TELEMETRY_RSSI_MIN() (telemetryData.rssi.min)
|
||||
|
@ -366,50 +255,6 @@ enum AlarmLevel {
|
|||
#define TELEMETRY_ASPEED_FORMAT "%d.%d,"
|
||||
#define TELEMETRY_ASPEED_ARGS telemetryData.hub.airSpeed / 10, telemetryData.hub.airSpeed % 10,
|
||||
#define TELEMETRY_OPENXSENSOR() (0)
|
||||
#else
|
||||
#define TELEMETRY_STREAMING() (telemetryStreaming > 0)
|
||||
#define TELEMETRY_RSSI() (telemetryData.rssi[0].value)
|
||||
#define TELEMETRY_RSSI_MIN() (telemetryData.rssi[0].min)
|
||||
|
||||
#define TELEMETRY_CELL_VOLTAGE_MUTLIPLIER 2
|
||||
|
||||
#define TELEMETRY_BARO_ALT_AVAILABLE() (telemetryData.hub.baroAltitudeOffset)
|
||||
#define TELEMETRY_BARO_ALT_UNIT (IS_IMPERIAL_ENABLE() ? LENGTH_UNIT_IMP : LENGTH_UNIT_METR)
|
||||
|
||||
#define TELEMETRY_RELATIVE_BARO_ALT_BP telemetryData.hub.baroAltitude_bp
|
||||
#define TELEMETRY_RELATIVE_BARO_ALT_AP telemetryData.hub.baroAltitude_ap
|
||||
#define TELEMETRY_RELATIVE_GPS_ALT_BP telemetryData.hub.gpsAltitude_bp
|
||||
#define TELEMETRY_GPS_SPEED_BP telemetryData.hub.gpsSpeed_bp
|
||||
#define TELEMETRY_GPS_SPEED_AP telemetryData.hub.gpsSpeed_ap
|
||||
|
||||
#define TELEMETRY_BARO_ALT_PREPARE()
|
||||
#define TELEMETRY_BARO_ALT_FORMAT "%d,"
|
||||
#define TELEMETRY_BARO_ALT_ARGS telemetryData.hub.baroAltitude_bp,
|
||||
#define TELEMETRY_GPS_ALT_FORMAT "%d,"
|
||||
#define TELEMETRY_GPS_ALT_ARGS telemetryData.hub.gpsAltitude_bp,
|
||||
#define TELEMETRY_SPEED_UNIT (IS_IMPERIAL_ENABLE() ? SPEED_UNIT_IMP : SPEED_UNIT_METR)
|
||||
#define TELEMETRY_GPS_SPEED_FORMAT "%d,"
|
||||
#define TELEMETRY_GPS_SPEED_ARGS telemetryData.hub.gpsSpeed_bp,
|
||||
|
||||
#define TELEMETRY_CELLS_ARGS telemetryData.hub.cellsSum / 10, telemetryData.hub.cellsSum % 10, telemetryData.hub.cellVolts[0]*2/100, telemetryData.hub.cellVolts[0]*2%100, telemetryData.hub.cellVolts[1]*2/100, telemetryData.hub.cellVolts[1]*2%100, telemetryData.hub.cellVolts[2]*2/100, telemetryData.hub.cellVolts[2]*2%100, telemetryData.hub.cellVolts[3]*2/100, telemetryData.hub.cellVolts[3]*2%100, telemetryData.hub.cellVolts[4]*2/100, telemetryData.hub.cellVolts[4]*2%100, telemetryData.hub.cellVolts[5]*2/100, telemetryData.hub.cellVolts[5]*2%100,
|
||||
#define TELEMETRY_CELLS_FORMAT "%d.%d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,%d.%02d,"
|
||||
#define TELEMETRY_CELLS_LABEL "Cell volts,Cell 1,Cell 2,Cell 3,Cell 4,Cell 5,Cell 6,"
|
||||
|
||||
#define TELEMETRY_CURRENT_FORMAT "%d.%02d,"
|
||||
#define TELEMETRY_CURRENT_ARGS telemetryData.hub.current / 100, telemetryData.hub.current % 100,
|
||||
#define TELEMETRY_VFAS_FORMAT "%d.%d,"
|
||||
#define TELEMETRY_VFAS_ARGS telemetryData.hub.vfas / 10, telemetryData.hub.vfas % 10,
|
||||
#define TELEMETRY_VSPEED_FORMAT "%c%d.%02d,"
|
||||
#define TELEMETRY_VSPEED_ARGS telemetryData.hub.varioSpeed < 0 ? '-' : ' ', telemetryData.hub.varioSpeed / 100, telemetryData.hub.varioSpeed % 100,
|
||||
#define TELEMETRY_ASPEED_FORMAT "%d.%d,"
|
||||
#define TELEMETRY_ASPEED_ARGS telemetryData.hub.airSpeed / 10, telemetryData.hub.airSpeed % 10,
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
#define TELEMETRY_OPENXSENSOR() (telemetryData.hub.openXsensor)
|
||||
#else
|
||||
#define TELEMETRY_OPENXSENSOR() (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define TELEMETRY_CELL_VOLTAGE(k) (telemetryData.hub.cellVolts[k] * TELEMETRY_CELL_VOLTAGE_MUTLIPLIER)
|
||||
#define TELEMETRY_MIN_CELL_VOLTAGE (telemetryData.hub.minCellVolts * TELEMETRY_CELL_VOLTAGE_MUTLIPLIER)
|
||||
|
@ -418,20 +263,7 @@ enum AlarmLevel {
|
|||
#define BYTESTUFF 0x7d
|
||||
#define STUFF_MASK 0x20
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define frskySendAlarms()
|
||||
#else
|
||||
#define SEND_RSSI_ALARMS 6
|
||||
#define SEND_MODEL_ALARMS 4
|
||||
extern uint8_t frskyAlarmsSendState;
|
||||
#define FRSKY_TX_PACKET_SIZE 12
|
||||
extern uint8_t frskyTxBuffer[FRSKY_TX_PACKET_SIZE];
|
||||
extern uint8_t frskyTxBufferCount;
|
||||
inline void frskySendAlarms(void)
|
||||
{
|
||||
frskyAlarmsSendState = SEND_RSSI_ALARMS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
typedef enum {
|
||||
|
@ -454,12 +286,8 @@ void sportProcessTelemetryPacket(const uint8_t * packet);
|
|||
void telemetryWakeup();
|
||||
void telemetryReset();
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern uint8_t telemetryProtocol;
|
||||
void telemetryInit(uint8_t protocol);
|
||||
#else
|
||||
void telemetryInit(void);
|
||||
#endif
|
||||
|
||||
void telemetryInterrupt10ms();
|
||||
|
||||
|
@ -476,41 +304,25 @@ enum TelemetryProtocol
|
|||
enum TelemAnas {
|
||||
TELEM_ANA_A1,
|
||||
TELEM_ANA_A2,
|
||||
#if defined(CPUARM)
|
||||
TELEM_ANA_A3,
|
||||
TELEM_ANA_A4,
|
||||
#endif
|
||||
TELEM_ANA_COUNT
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
struct TelemetryData {
|
||||
TelemetryValueWithMin swr; // TODO Min not needed
|
||||
TelemetryValueWithMin rssi; // TODO Min not needed
|
||||
uint16_t xjtVersion;
|
||||
bool varioHighPrecision;
|
||||
};
|
||||
#else
|
||||
struct TelemetryData {
|
||||
TelemetryValueWithMinMax analog[TELEM_ANA_COUNT];
|
||||
TelemetryValueWithMin rssi[2];
|
||||
FrskyTelemetryData hub;
|
||||
};
|
||||
#endif
|
||||
|
||||
extern TelemetryData telemetryData;
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef uint16_t frskyCellVoltage_t;
|
||||
#elif defined(FRSKY_HUB)
|
||||
typedef uint8_t frskyCellVoltage_t;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(FRSKY_HUB)
|
||||
void frskySetCellsCount(uint8_t cellscount);
|
||||
void frskySetCellVoltage(uint8_t battnumber, frskyCellVoltage_t cellVolts);
|
||||
void frskyUpdateCells();
|
||||
#endif
|
||||
|
||||
void processFrskyTelemetryData(uint8_t data);
|
||||
|
||||
|
|
|
@ -114,12 +114,10 @@ void parseTelemHubByte(uint8_t byte)
|
|||
break;
|
||||
|
||||
case offsetof(FrskyTelemetryData, current):
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
if ((int16_t)telemetryData.hub.current > 0 && ((int16_t)telemetryData.hub.current + g_model.frsky.fasOffset) > 0)
|
||||
telemetryData.hub.current += g_model.frsky.fasOffset;
|
||||
else
|
||||
telemetryData.hub.current = 0;
|
||||
#endif
|
||||
if (telemetryData.hub.current > telemetryData.hub.maxCurrent)
|
||||
telemetryData.hub.maxCurrent = telemetryData.hub.current;
|
||||
break;
|
||||
|
|
|
@ -30,31 +30,16 @@ uint8_t wshhStreaming = 0;
|
|||
|
||||
uint8_t link_counter = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t telemetryState = TELEMETRY_INIT;
|
||||
#endif
|
||||
|
||||
TelemetryData telemetryData;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t telemetryProtocol = 255;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && defined(REVX)
|
||||
uint8_t serialInversion = 0;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint16_t getChannelRatio(source_t channel)
|
||||
{
|
||||
return (uint16_t)g_model.frsky.channels[channel].ratio << g_model.frsky.channels[channel].multiplier;
|
||||
}
|
||||
|
||||
lcdint_t applyChannelRatio(source_t channel, lcdint_t val)
|
||||
{
|
||||
return ((int32_t)val+g_model.frsky.channels[channel].offset) * getChannelRatio(channel) * 2 / 51;
|
||||
}
|
||||
#endif
|
||||
|
||||
void processTelemetryData(uint8_t data)
|
||||
{
|
||||
|
@ -83,7 +68,6 @@ void processTelemetryData(uint8_t data)
|
|||
|
||||
void telemetryWakeup()
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
uint8_t requiredTelemetryProtocol = modelTelemetryProtocol();
|
||||
#if defined(REVX)
|
||||
uint8_t requiredSerialInversion = g_model.moduleData[EXTERNAL_MODULE].invertedSerial;
|
||||
|
@ -94,7 +78,6 @@ void telemetryWakeup()
|
|||
#endif
|
||||
telemetryInit(requiredTelemetryProtocol);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
uint8_t data;
|
||||
|
@ -118,27 +101,13 @@ void telemetryWakeup()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (IS_FRSKY_D_PROTOCOL()) {
|
||||
// Attempt to transmit any waiting Fr-Sky alarm set packets every 50ms (subject to packet buffer availability)
|
||||
static uint8_t frskyTxDelay = 5;
|
||||
if (frskyAlarmsSendState && (--frskyTxDelay == 0)) {
|
||||
frskyTxDelay = 5; // 50ms
|
||||
#if !defined(SIMU)
|
||||
frskyDSendNextAlarm();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED) {
|
||||
telemetryItems[i].eval(sensor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(VARIO)
|
||||
if (TELEMETRY_STREAMING() && !IS_FAI_ENABLED()) {
|
||||
|
@ -148,7 +117,6 @@ void telemetryWakeup()
|
|||
|
||||
#define FRSKY_BAD_ANTENNA() (IS_RAS_VALUE_VALID() && telemetryData.swr.value > 0x33)
|
||||
|
||||
#if defined(CPUARM)
|
||||
static tmr10ms_t alarmsCheckTime = 0;
|
||||
#define SCHEDULE_NEXT_ALARMS_CHECK(seconds) alarmsCheckTime = get_tmr10ms() + (100*(seconds))
|
||||
if (int32_t(get_tmr10ms() - alarmsCheckTime) > 0) {
|
||||
|
@ -206,70 +174,21 @@ void telemetryWakeup()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void telemetryInterrupt10ms()
|
||||
{
|
||||
#if defined(FRSKY_HUB) && !defined(CPUARM)
|
||||
uint16_t voltage = 0; /* unit: 1/10 volts */
|
||||
for (uint8_t i=0; i<telemetryData.hub.cellsCount; i++)
|
||||
voltage += telemetryData.hub.cellVolts[i];
|
||||
voltage /= (10 / TELEMETRY_CELL_VOLTAGE_MUTLIPLIER);
|
||||
telemetryData.hub.cellsSum = voltage;
|
||||
if (telemetryData.hub.cellsSum < telemetryData.hub.minCells) {
|
||||
telemetryData.hub.minCells = telemetryData.hub.cellsSum;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
if (!TELEMETRY_OPENXSENSOR()) {
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
const TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
if (sensor.type == TELEM_TYPE_CALCULATED) {
|
||||
telemetryItems[i].per10ms(sensor);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// power calculation
|
||||
uint8_t channel = g_model.frsky.voltsSource;
|
||||
if (channel <= FRSKY_VOLTS_SOURCE_A2) {
|
||||
voltage = applyChannelRatio(channel, telemetryData.analog[channel].value) / 10;
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
else if (channel == FRSKY_VOLTS_SOURCE_FAS) {
|
||||
voltage = telemetryData.hub.vfas;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
uint16_t current = telemetryData.hub.current; /* unit: 1/10 amps */
|
||||
#else
|
||||
uint16_t current = 0;
|
||||
#endif
|
||||
|
||||
channel = g_model.frsky.currentSource - FRSKY_CURRENT_SOURCE_A1;
|
||||
if (channel < MAX_FRSKY_A_CHANNELS) {
|
||||
current = applyChannelRatio(channel, telemetryData.analog[channel].value) / 10;
|
||||
}
|
||||
|
||||
telemetryData.hub.power = ((current>>1) * (voltage>>1)) / 25;
|
||||
|
||||
telemetryData.hub.currentPrescale += current;
|
||||
if (telemetryData.hub.currentPrescale >= 3600) {
|
||||
telemetryData.hub.currentConsumption += 1;
|
||||
telemetryData.hub.currentPrescale -= 3600;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (telemetryData.hub.power > telemetryData.hub.maxPower) {
|
||||
telemetryData.hub.maxPower = telemetryData.hub.power;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(WS_HOW_HIGH)
|
||||
|
@ -283,12 +202,7 @@ void telemetryInterrupt10ms()
|
|||
}
|
||||
else {
|
||||
#if !defined(SIMU)
|
||||
#if defined(CPUARM)
|
||||
telemetryData.rssi.reset();
|
||||
#else
|
||||
telemetryData.rssi[0].set(0);
|
||||
telemetryData.rssi[1].set(0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -297,82 +211,18 @@ void telemetryReset()
|
|||
{
|
||||
memclear(&telemetryData, sizeof(telemetryData));
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int index=0; index<MAX_TELEMETRY_SENSORS; index++) {
|
||||
telemetryItems[index].clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
telemetryStreaming = 0; // reset counter only if valid frsky packets are being detected
|
||||
link_counter = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
telemetryState = TELEMETRY_INIT;
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB) && !defined(CPUARM)
|
||||
telemetryData.hub.gpsLatitude_bp = 2;
|
||||
telemetryData.hub.gpsLongitude_bp = 2;
|
||||
telemetryData.hub.gpsFix = -1;
|
||||
#endif
|
||||
|
||||
#if defined(SIMU) && !defined(CPUARM)
|
||||
telemetryData.rssi[0].value = 75;
|
||||
telemetryData.rssi[1].value = 75;
|
||||
telemetryData.analog[TELEM_ANA_A1].set(120, UNIT_VOLTS);
|
||||
telemetryData.analog[TELEM_ANA_A2].set(240, UNIT_VOLTS);
|
||||
|
||||
telemetryData.hub.fuelLevel = 75;
|
||||
telemetryData.hub.rpm = 12000;
|
||||
telemetryData.hub.vfas = 100;
|
||||
telemetryData.hub.minVfas = 90;
|
||||
|
||||
#if defined(GPS)
|
||||
telemetryData.hub.gpsFix = 1;
|
||||
telemetryData.hub.gpsLatitude_bp = 4401;
|
||||
telemetryData.hub.gpsLatitude_ap = 7710;
|
||||
telemetryData.hub.gpsLongitude_bp = 1006;
|
||||
telemetryData.hub.gpsLongitude_ap = 8872;
|
||||
telemetryData.hub.gpsSpeed_bp = 200; //in knots
|
||||
telemetryData.hub.gpsSpeed_ap = 0;
|
||||
getGpsPilotPosition();
|
||||
|
||||
telemetryData.hub.gpsLatitude_bp = 4401;
|
||||
telemetryData.hub.gpsLatitude_ap = 7455;
|
||||
telemetryData.hub.gpsLongitude_bp = 1006;
|
||||
telemetryData.hub.gpsLongitude_ap = 9533;
|
||||
getGpsDistance();
|
||||
#endif
|
||||
|
||||
telemetryData.hub.airSpeed = 1000; // 185.1 km/h
|
||||
|
||||
telemetryData.hub.cellsCount = 6;
|
||||
telemetryData.hub.cellVolts[0] = 410/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.cellVolts[1] = 420/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.cellVolts[2] = 430/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.cellVolts[3] = 440/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.cellVolts[4] = 450/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.cellVolts[5] = 460/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.minCellVolts = 250/TELEMETRY_CELL_VOLTAGE_MUTLIPLIER;
|
||||
telemetryData.hub.minCell = 300; //unit 10mV
|
||||
telemetryData.hub.minCells = 220; //unit 100mV
|
||||
//telemetryData.hub.cellsSum = 261; //calculated from cellVolts[]
|
||||
|
||||
telemetryData.hub.gpsAltitude_bp = 50;
|
||||
telemetryData.hub.baroAltitude_bp = 50;
|
||||
telemetryData.hub.minAltitude = 10;
|
||||
telemetryData.hub.maxAltitude = 500;
|
||||
|
||||
telemetryData.hub.accelY = 100;
|
||||
telemetryData.hub.temperature1 = -30;
|
||||
telemetryData.hub.maxTemperature1 = 100;
|
||||
|
||||
telemetryData.hub.current = 55;
|
||||
telemetryData.hub.maxCurrent = 65;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
// we don't reset the telemetry here as we would also reset the consumption after model load
|
||||
void telemetryInit(uint8_t protocol)
|
||||
{
|
||||
|
@ -432,19 +282,7 @@ void telemetryInit(uint8_t protocol)
|
|||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
void telemetryInit()
|
||||
{
|
||||
telemetryPortInit();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
|
||||
{
|
||||
return (45 - 3*alarm + g_model.frsky.rssiAlarms[alarm].value);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LOG_TELEMETRY) && !defined(SIMU)
|
||||
extern FIL g_telemetryFile;
|
||||
|
|
|
@ -55,14 +55,12 @@ extern uint8_t wshhStreaming;
|
|||
|
||||
extern uint8_t link_counter;
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum TelemetryStates {
|
||||
TELEMETRY_INIT,
|
||||
TELEMETRY_OK,
|
||||
TELEMETRY_KO
|
||||
};
|
||||
extern uint8_t telemetryState;
|
||||
#endif
|
||||
|
||||
#define TELEMETRY_TIMEOUT10ms 100 // 1 second
|
||||
|
||||
|
@ -80,7 +78,6 @@ extern uint8_t telemetryState;
|
|||
extern uint8_t telemetryRxBuffer[TELEMETRY_RX_PACKET_SIZE];
|
||||
extern uint8_t telemetryRxBufferCount;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_AVERAGE_COUNT 3
|
||||
|
||||
enum {
|
||||
|
@ -119,12 +116,10 @@ int32_t convertTelemetryValue(int32_t value, uint8_t unit, uint8_t prec, uint8_t
|
|||
|
||||
void frskySportSetDefault(int index, uint16_t id, uint8_t subId, uint8_t instance);
|
||||
void frskyDSetDefault(int index, uint16_t id);
|
||||
#endif
|
||||
|
||||
#define IS_DISTANCE_UNIT(unit) ((unit) == UNIT_METERS || (unit) == UNIT_FEET)
|
||||
#define IS_SPEED_UNIT(unit) ((unit) >= UNIT_KTS && (unit) <= UNIT_MPH)
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern uint8_t telemetryProtocol;
|
||||
#define IS_FRSKY_D_PROTOCOL() (telemetryProtocol == PROTOCOL_FRSKY_D)
|
||||
#if defined (MULTIMODULE)
|
||||
|
@ -134,12 +129,7 @@ extern uint8_t telemetryProtocol;
|
|||
#define IS_FRSKY_SPORT_PROTOCOL() (telemetryProtocol == PROTOCOL_FRSKY_SPORT)
|
||||
#endif
|
||||
#define IS_SPEKTRUM_PROTOCOL() (telemetryProtocol == PROTOCOL_SPEKTRUM)
|
||||
#else
|
||||
#define IS_FRSKY_D_PROTOCOL() (true)
|
||||
#define IS_FRSKY_SPORT_PROTOCOL() (false)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
inline uint8_t modelTelemetryProtocol()
|
||||
{
|
||||
#if defined(CROSSFIRE)
|
||||
|
@ -161,11 +151,8 @@ inline uint8_t modelTelemetryProtocol()
|
|||
// default choice
|
||||
return PROTOCOL_FRSKY_SPORT;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "telemetry_sensors.h"
|
||||
#endif
|
||||
|
||||
#if defined(LOG_TELEMETRY) && !defined(SIMU)
|
||||
void logTelemetryWriteStart();
|
||||
|
@ -204,3 +191,4 @@ extern Fifo<uint8_t, LUA_TELEMETRY_INPUT_FIFO_SIZE> * luaInputTelemetryFifo;
|
|||
#endif
|
||||
|
||||
#endif // _TELEMETRY_H_
|
||||
|
||||
|
|
|
@ -20,16 +20,13 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
void TelemetryValueWithMin::reset()
|
||||
{
|
||||
memclear(this, sizeof(*this));
|
||||
}
|
||||
#endif
|
||||
|
||||
void TelemetryValueWithMin::set(uint8_t value)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (this->value == 0) {
|
||||
memset(values, value, TELEMETRY_AVERAGE_COUNT);
|
||||
this->value = value;
|
||||
|
@ -47,18 +44,6 @@ void TelemetryValueWithMin::set(uint8_t value)
|
|||
sum += value;
|
||||
this->value = sum/(TELEMETRY_AVERAGE_COUNT+1);
|
||||
}
|
||||
#else
|
||||
if (this->value == 0) {
|
||||
this->value = value;
|
||||
}
|
||||
else {
|
||||
sum += value;
|
||||
if (link_counter == 0) {
|
||||
this->value = sum / (IS_FRSKY_D_PROTOCOL() ? FRSKY_D_AVERAGING : FRSKY_SPORT_AVERAGING);
|
||||
sum = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!min || value < min) {
|
||||
min = value;
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_AVERAGE_COUNT 3 // we actually average one more reading!
|
||||
#define RAW_FRSKY_MINMAX(v) v.values[TELEMETRY_AVERAGE_COUNT-1]
|
||||
class TelemetryValueWithMin {
|
||||
|
@ -34,16 +33,6 @@ class TelemetryValueWithMin {
|
|||
void set(uint8_t value);
|
||||
void reset();
|
||||
};
|
||||
#else
|
||||
#define RAW_FRSKY_MINMAX(v) v.value
|
||||
class TelemetryValueWithMin {
|
||||
public:
|
||||
uint8_t value;
|
||||
uint8_t min;
|
||||
uint16_t sum;
|
||||
void set(uint8_t value);
|
||||
};
|
||||
#endif
|
||||
|
||||
class TelemetryValueWithMinMax: public TelemetryValueWithMin {
|
||||
public:
|
||||
|
|
|
@ -40,9 +40,7 @@
|
|||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
#pragma message("Templates are not implemented on this board")
|
||||
#endif
|
||||
|
||||
MixData* setDest(uint8_t dch, uint8_t src, bool clear=false)
|
||||
{
|
||||
|
|
|
@ -30,59 +30,6 @@ void frskyCalculateCellStats(void);
|
|||
void displayVoltagesScreen();
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && !defined(CPUARM)
|
||||
TEST(FrSky, gpsNfuel)
|
||||
{
|
||||
MODEL_RESET();
|
||||
TELEMETRY_RESET();
|
||||
g_model.frsky.usrProto = 1;
|
||||
telemetryData.hub.gpsFix = 1;
|
||||
|
||||
uint8_t pkt1[] = { 0xfd, 0x07, 0x00, 0x5e, 0x14, 0x2c, 0x00, 0x5e, 0x1c, 0x03 };
|
||||
uint8_t pkt2[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x13, 0x38, 0x0c, 0x5e, 0x1b };
|
||||
uint8_t pkt3[] = { 0xfd, 0x07, 0x00, 0xc9, 0x06, 0x5e, 0x23, 0x4e, 0x00, 0x5e };
|
||||
uint8_t pkt4[] = { 0xfd, 0x07, 0x00, 0x12, 0xef, 0x2e, 0x5e, 0x1a, 0x98, 0x26 };
|
||||
uint8_t pkt5[] = { 0xfd, 0x07, 0x00, 0x5e, 0x22, 0x45, 0x00, 0x5e, 0x11, 0x02 };
|
||||
uint8_t pkt6[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x19, 0x93, 0x00, 0x5e, 0x04 };
|
||||
uint8_t pkt7[] = { 0xfd, 0x03, 0x00, 0x64, 0x00, 0x5e };
|
||||
frskyDProcessPacket(pkt1);
|
||||
frskyDProcessPacket(pkt2);
|
||||
frskyDProcessPacket(pkt3);
|
||||
frskyDProcessPacket(pkt4);
|
||||
frskyDProcessPacket(pkt5);
|
||||
frskyDProcessPacket(pkt6);
|
||||
frskyDProcessPacket(pkt7);
|
||||
EXPECT_EQ(telemetryData.hub.gpsCourse_bp, 44);
|
||||
EXPECT_EQ(telemetryData.hub.gpsCourse_ap, 03);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_bp / 100, 120);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_bp % 100, 15);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitude_ap, 0x2698);
|
||||
EXPECT_EQ(telemetryData.hub.gpsLatitudeNS, 'N');
|
||||
EXPECT_EQ(telemetryData.hub.gpsLongitudeEW, 'E');
|
||||
EXPECT_EQ(telemetryData.hub.fuelLevel, 100);
|
||||
}
|
||||
|
||||
TEST(FrSky, dateNtime)
|
||||
{
|
||||
MODEL_RESET();
|
||||
TELEMETRY_RESET();
|
||||
g_model.frsky.usrProto = 1;
|
||||
telemetryData.hub.gpsFix = 1;
|
||||
|
||||
uint8_t pkt1[] = { 0xfd, 0x07, 0x00, 0x5e, 0x15, 0x0f, 0x07, 0x5e, 0x16, 0x0b };
|
||||
uint8_t pkt2[] = { 0xfd, 0x07, 0x00, 0x00, 0x5e, 0x17, 0x06, 0x12, 0x5e, 0x18 };
|
||||
uint8_t pkt3[] = { 0xfd, 0x03, 0x00, 0x32, 0x00, 0x5e };
|
||||
frskyDProcessPacket(pkt1);
|
||||
frskyDProcessPacket(pkt2);
|
||||
frskyDProcessPacket(pkt3);
|
||||
EXPECT_EQ(telemetryData.hub.day, 15);
|
||||
EXPECT_EQ(telemetryData.hub.month, 07);
|
||||
EXPECT_EQ(telemetryData.hub.year, 11);
|
||||
EXPECT_EQ(telemetryData.hub.hour, 06);
|
||||
EXPECT_EQ(telemetryData.hub.min, 18);
|
||||
EXPECT_EQ(telemetryData.hub.sec, 50);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(CPUARM)
|
||||
TEST(FrSky, TelemetryValueWithMinAveraging)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
class SpecialFunctionsTest : public OpenTxTest {};
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST_F(SpecialFunctionsTest, SwitchFiledSize)
|
||||
{
|
||||
// test the size of swtch member
|
||||
|
@ -117,4 +116,3 @@ TEST_F(SpecialFunctionsTest, GvarsInc)
|
|||
|
||||
#endif // #if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
|
||||
#endif // #if defined(CPUARM)
|
||||
|
|
|
@ -70,10 +70,6 @@ inline void MIXER_RESET()
|
|||
memset(ex_chans, 0, sizeof(ex_chans));
|
||||
memset(act, 0, sizeof(act));
|
||||
memset(swOn, 0, sizeof(swOn));
|
||||
#if !defined(CPUARM)
|
||||
s_last_switch_used = 0;
|
||||
s_last_switch_value = 0;
|
||||
#endif
|
||||
mixerCurrentFlightMode = lastFlightMode = 0;
|
||||
lastAct = 0;
|
||||
logicalSwitchesReset();
|
||||
|
@ -85,14 +81,12 @@ inline void TELEMETRY_RESET()
|
|||
memclear(&telemetryData, sizeof(telemetryData));
|
||||
TELEMETRY_RSSI() = 100;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
telemetryItems[i].clear();
|
||||
}
|
||||
#endif
|
||||
memclear(g_model.telemetrySensors, sizeof(g_model.telemetrySensors));
|
||||
#endif
|
||||
}
|
||||
|
||||
class OpenTxTest : public testing::Test
|
||||
|
|
|
@ -122,7 +122,6 @@ TEST(outdezNAtt, test_unsigned)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(outdezNAtt, testBigNumbers)
|
||||
{
|
||||
lcdClear();
|
||||
|
@ -130,7 +129,6 @@ TEST(outdezNAtt, testBigNumbers)
|
|||
lcdDrawNumber(0, FH, -1234567, LEFT);
|
||||
EXPECT_TRUE(checkScreenshot("big_numbers"));
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
TEST(Lcd, Invers_0_0)
|
||||
{
|
||||
|
@ -160,14 +158,12 @@ TEST(Lcd, Prec2_Right)
|
|||
EXPECT_TRUE(checkScreenshot("prec2_right"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Prec1_Dblsize_Invers)
|
||||
{
|
||||
lcdClear();
|
||||
lcdDrawNumber(LCD_W, 10, 51, PREC1|DBLSIZE|INVERS|RIGHT);
|
||||
EXPECT_TRUE(checkScreenshot("prec1_dblsize_invers"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Lcd, Line_Wrap)
|
||||
{
|
||||
|
@ -183,14 +179,12 @@ TEST(Lcd, DblsizeBottomRight)
|
|||
EXPECT_TRUE(checkScreenshot("dblsize_bottom_right"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Smlsize_drawStringWithIndex)
|
||||
{
|
||||
lcdClear();
|
||||
drawStringWithIndex(0, 0, "FM", 0, SMLSIZE);
|
||||
EXPECT_TRUE(checkScreenshot("smlsize_drawstringwithindex"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Lcd, vline)
|
||||
{
|
||||
|
@ -201,7 +195,6 @@ TEST(Lcd, vline)
|
|||
EXPECT_TRUE(checkScreenshot("vline"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, vline_x_lt0)
|
||||
{
|
||||
lcdClear();
|
||||
|
@ -209,9 +202,7 @@ TEST(Lcd, vline_x_lt0)
|
|||
lcdDrawSolidVerticalLine(100, -10, 1);
|
||||
EXPECT_TRUE(checkScreenshot("vline_lt0"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Smlsize)
|
||||
{
|
||||
lcdClear();
|
||||
|
@ -279,7 +270,6 @@ TEST(Lcd, Dblsize)
|
|||
|
||||
EXPECT_TRUE(checkScreenshot("dblsize"));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) && LCD_W >= 212
|
||||
TEST(Lcd, DrawSwitch)
|
||||
|
|
|
@ -347,17 +347,10 @@ TEST_F(TrimsTest, infiniteChainedTrims)
|
|||
TEST_F(TrimsTest, CopyTrimsToOffset)
|
||||
{
|
||||
setTrimValue(0, ELE_STICK, -100); // -100 on elevator
|
||||
#if defined(CPUARM)
|
||||
evalFunctions(g_model.customFn, modelFunctionsContext); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -195);
|
||||
#else
|
||||
evalFunctions(); // it disables all safety channels
|
||||
copyTrimsToOffset(1);
|
||||
EXPECT_EQ(getTrimValue(0, ELE_STICK), -100); // unchanged
|
||||
EXPECT_EQ(g_model.limitData[1].offset, -200);
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_F(TrimsTest, CopySticksToOffset)
|
||||
|
@ -408,127 +401,6 @@ TEST(Curves, LinearIntpol)
|
|||
}
|
||||
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(FlightModes, nullFadeOut_posFadeIn)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
lastFlightMode = 255;
|
||||
simuSetSwitch(3, 1);
|
||||
g_model.flightModeData[1].swtch = SWSRC_ID1;
|
||||
g_model.flightModeData[1].fadeIn = 15;
|
||||
evalMixes(1);
|
||||
simuSetSwitch(3, 0);
|
||||
evalMixes(1);
|
||||
// run mixes enough time to fade out flight modes (otherwise the mixer internal state flightModesFade could affect other tests)
|
||||
simuSetSwitch(3, 1);
|
||||
for(int n=0; n<200; n++) {
|
||||
evalMixes(1);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, R2029Comment)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].swtch = -SWSRC_THR;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_Thr;
|
||||
g_model.mixData[1].swtch = SWSRC_THR;
|
||||
g_model.mixData[1].weight = 100;
|
||||
anaInValues[THR_STICK] = 1024;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], 0);
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, Cascaded3Channels)
|
||||
{
|
||||
SYSTEM_RESET();
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
modelDefault(0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH3;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[2].destCh = 2;
|
||||
g_model.mixData[2].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[2].weight = 100;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, CascadedOrderedChannels)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH1;
|
||||
g_model.mixData[1].weight = 100;
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, Cascaded5Channels)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_CH2;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[1].destCh = 1;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_CH3;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[2].destCh = 2;
|
||||
g_model.mixData[2].srcRaw = MIXSRC_CH4;
|
||||
g_model.mixData[2].weight = 100;
|
||||
g_model.mixData[3].destCh = 3;
|
||||
g_model.mixData[3].srcRaw = MIXSRC_CH5;
|
||||
g_model.mixData[3].weight = 100;
|
||||
g_model.mixData[4].destCh = 4;
|
||||
g_model.mixData[4].srcRaw = MIXSRC_THR;
|
||||
g_model.mixData[4].weight = 100;
|
||||
for (uint8_t i=0; i<10; i++) {
|
||||
simuSetSwitch(1, 1);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[3], CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[4], CHANNEL_MAX);
|
||||
simuSetSwitch(1, 0);
|
||||
evalMixes(1);
|
||||
EXPECT_EQ(chans[0], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[1], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[2], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[3], -CHANNEL_MAX);
|
||||
EXPECT_EQ(chans[4], -CHANNEL_MAX);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, InfiniteRecursiveChannels)
|
||||
{
|
||||
|
@ -600,56 +472,6 @@ TEST_F(MixerTest, RecursiveAddChannelAfterInactivePhase)
|
|||
EXPECT_EQ(chans[1], CHANNEL_MAX);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitch)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = SWSRC_THR;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, -1);
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
|
||||
TEST_F(MixerTest, SlowUpOnSwitch)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = SWSRC_THR;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = 0;
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
s_mixer_first_run_done = true;
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
lastAct = 0;
|
||||
simuSetSwitch(1, 1);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 100);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, SlowOnPhase)
|
||||
{
|
||||
|
@ -673,36 +495,6 @@ TEST_F(MixerTest, SlowOnPhase)
|
|||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitchAndPhase)
|
||||
{
|
||||
g_model.flightModeData[1].swtch = TR(SWSRC_THR, SWSRC_SA0);
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].swtch = TR(SWSRC_THR, SWSRC_SA0);
|
||||
#if defined(CPUARM)
|
||||
g_model.mixData[0].flightModes = 0x2 + 0x4 + 0x8 + 0x10 + 0x20 + 0x40 + 0x80 + 0x100 /*only enabled in phase 0*/;
|
||||
#else
|
||||
g_model.mixData[0].flightModes = 0x2 + 0x4 + 0x8 + 0x10 /*only enabled in phase 0*/;
|
||||
#endif
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
evalFlightModeMixes(e_perout_mode_normal, 0);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
mixerCurrentFlightMode = 0;
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
|
||||
simuSetSwitch(1, -1);
|
||||
mixerCurrentFlightMode = 1;
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(MixerTest, SlowOnSwitchSource)
|
||||
{
|
||||
|
@ -775,63 +567,7 @@ TEST_F(MixerTest, DelayOnSwitch)
|
|||
EXPECT_EQ(chans[0], 0);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowAndDelayOnReplace3POSSource)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_REP;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_3POS;
|
||||
g_model.mixData[0].weight = 100;
|
||||
g_model.mixData[0].delayUp = 10;
|
||||
g_model.mixData[0].speedUp = SLOW_STEP*5;
|
||||
g_model.mixData[0].speedDown = SLOW_STEP*5;
|
||||
|
||||
s_mixer_first_run_done = true;
|
||||
|
||||
simuSetSwitch(0, -1);
|
||||
CHECK_SLOW_MOVEMENT(0, -1, 250);
|
||||
EXPECT_EQ(chans[0], -CHANNEL_MAX);
|
||||
|
||||
simuSetSwitch(0, 0);
|
||||
CHECK_DELAY(0, 500);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250/*half course*/);
|
||||
EXPECT_EQ(chans[0], 0);
|
||||
|
||||
simuSetSwitch(0, 1);
|
||||
CHECK_DELAY(0, 500);
|
||||
CHECK_SLOW_MOVEMENT(0, +1, 250);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST_F(MixerTest, SlowOnSwitchReplace)
|
||||
{
|
||||
g_model.mixData[0].destCh = 0;
|
||||
g_model.mixData[0].mltpx = MLTPX_ADD;
|
||||
g_model.mixData[0].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[0].weight = 50;
|
||||
g_model.mixData[1].destCh = 0;
|
||||
g_model.mixData[1].mltpx = MLTPX_REP;
|
||||
g_model.mixData[1].srcRaw = MIXSRC_MAX;
|
||||
g_model.mixData[1].weight = 100;
|
||||
g_model.mixData[1].swtch = SWSRC_THR;
|
||||
g_model.mixData[1].speedDown = SLOW_STEP*5;
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX/2);
|
||||
|
||||
simuSetSwitch(1, 1);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
// slow is not applied, but it's better than the first mix not applied at all!
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX);
|
||||
|
||||
simuSetSwitch(1, 0);
|
||||
evalFlightModeMixes(e_perout_mode_normal, 1);
|
||||
// slow is not applied, but it's better than the first mix not applied at all!
|
||||
EXPECT_EQ(chans[0], CHANNEL_MAX/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(VIRTUAL_INPUTS)
|
||||
TEST_F(MixerTest, NoTrimOnInactiveMix)
|
||||
|
|
|
@ -29,21 +29,6 @@ TEST(getSwitch, undefCSW)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(getSwitch, circularCSW)
|
||||
{
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
g_model.logicalSw[0] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_OR };
|
||||
g_model.logicalSw[1] = { SWSRC_SW1, SWSRC_SW1, LS_FUNC_AND };
|
||||
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(-SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||
EXPECT_EQ(getSwitch(-SWSRC_SW2), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
void setLogicalSwitch(int index, uint16_t _func, int16_t _v1, int16_t _v2, int16_t _v3 = 0, uint8_t _delay = 0, uint8_t _duration = 0, int8_t _andsw = 0)
|
||||
|
@ -99,38 +84,6 @@ TEST(getSwitch, nullSW)
|
|||
EXPECT_EQ(getSwitch(0), true);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
TEST(getSwitch, recursiveSW)
|
||||
{
|
||||
MODEL_RESET();
|
||||
MIXER_RESET();
|
||||
|
||||
g_model.logicalSw[0] = { SWSRC_RUD, -SWSRC_SW2, LS_FUNC_OR };
|
||||
g_model.logicalSw[1] = { SWSRC_ELE, -SWSRC_SW1, LS_FUNC_OR };
|
||||
|
||||
simuSetSwitch(2, 0); // RUD 0
|
||||
simuSetSwitch(3, 0); // ELE 0
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), false);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
simuSetSwitch(2, 1); // RUD 1
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), true);
|
||||
|
||||
LS_RECURSIVE_EVALUATION_RESET();
|
||||
evalLogicalSwitches();
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW1), true);
|
||||
EXPECT_EQ(getSwitch(SWSRC_SW2), false);
|
||||
}
|
||||
#endif // #if !defined(CPUARM)
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
TEST(getSwitch, inputWithTrim)
|
||||
|
|
|
@ -20,16 +20,6 @@
|
|||
|
||||
#include "gtests.h"
|
||||
|
||||
#if !defined(CPUARM)
|
||||
#undef timerSet
|
||||
void timerSet(int idx, int16_t val)
|
||||
{
|
||||
TimerState & timerState = timersStates[idx];
|
||||
timerState.state = TMR_OFF; // is changed to RUNNING dep from mode
|
||||
timerState.val = val;
|
||||
timerState.val_10ms = 0 ;
|
||||
}
|
||||
#endif // #if !defined(CPUARM)
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
#define THR_100 128 // approximately 10% full throttle
|
||||
|
@ -78,7 +68,6 @@ TEST(Timers, timerReset)
|
|||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 1, TMR_OFF, 0));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Timers, timerSet)
|
||||
{
|
||||
timerSet(0, 500);
|
||||
|
@ -95,9 +84,7 @@ TEST(Timers, timerGreaterThan9hours)
|
|||
// test with 24 hours
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(24*3600, THR_100, 0, TMR_RUNNING, 24*3600));
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
TEST(Timers, saveRestoreTimers)
|
||||
{
|
||||
g_model.timers[0].persistent = 1;
|
||||
|
@ -116,7 +103,6 @@ TEST(Timers, saveRestoreTimers)
|
|||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 0, TMR_OFF, 500));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(0, THR_100, 1, TMR_OFF, 1500));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(Timers, timerOff)
|
||||
{
|
||||
|
@ -149,12 +135,6 @@ TEST(Timers, timerAbsolute)
|
|||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_NEGATIVE, -1));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_STOPPED, -101));
|
||||
|
||||
#if !defined(CPUARM)
|
||||
// min timer value test
|
||||
timerSet(0, TIMER_MIN+10);
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(1, THR_100, 0, TMR_RUNNING, TIMER_MIN+9));
|
||||
EXPECT_TRUE(evalTimersForNSecondsAndTest(100, THR_100, 0, TMR_RUNNING, TIMER_MIN));
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(Timers, timerThrottle)
|
||||
|
|
5
radio/src/thirdparty/FatFs/ffconf.h
vendored
5
radio/src/thirdparty/FatFs/ffconf.h
vendored
|
@ -119,13 +119,8 @@ extern "C" {
|
|||
*/
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define _USE_LFN 2
|
||||
#define _MAX_LFN 255
|
||||
#else
|
||||
#define _USE_LFN 1
|
||||
#define _MAX_LFN 32
|
||||
#endif
|
||||
/* The _USE_LFN switches the support of long file name (LFN).
|
||||
/
|
||||
/ 0: Disable support of LFN. _MAX_LFN has no effect.
|
||||
|
|
|
@ -35,7 +35,6 @@ void timerReset(uint8_t idx)
|
|||
timerState.val_10ms = 0 ;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void timerSet(int idx, int val)
|
||||
{
|
||||
TimerState & timerState = timersStates[idx];
|
||||
|
@ -43,9 +42,7 @@ void timerSet(int idx, int val)
|
|||
timerState.val = val;
|
||||
timerState.val_10ms = 0 ;
|
||||
}
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
void restoreTimers()
|
||||
{
|
||||
for (uint8_t i=0; i<TIMERS; i++) {
|
||||
|
@ -67,7 +64,6 @@ void saveTimers()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif // #if defined(CPUARM) || defined(CPUM2560)
|
||||
|
||||
#if defined(ACCURAT_THROTTLE_TIMER)
|
||||
#define THR_TRG_TRESHOLD 13 // approximately 10% full throttle
|
||||
|
|
|
@ -26,17 +26,10 @@
|
|||
#define TMR_NEGATIVE 2
|
||||
#define TMR_STOPPED 3
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int32_t tmrval_t;
|
||||
typedef uint32_t tmrstart_t;
|
||||
typedef int16_t tmrmode_t;
|
||||
#define TIMER_MAX (0xffffff/2)
|
||||
#else
|
||||
typedef int16_t tmrval_t;
|
||||
typedef uint16_t tmrstart_t;
|
||||
typedef int8_t tmrmode_t;
|
||||
#define TIMER_MAX (0xffff/2)
|
||||
#endif
|
||||
|
||||
#define TIMER_MIN (tmrval_t(-TIMER_MAX-1))
|
||||
|
||||
|
@ -52,17 +45,10 @@ extern TimerState timersStates[TIMERS];
|
|||
|
||||
void timerReset(uint8_t idx);
|
||||
|
||||
#if defined(CPUARM)
|
||||
void timerSet(int idx, int val);
|
||||
#endif // #if defined(CPUARM)
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
void saveTimers();
|
||||
void restoreTimers();
|
||||
#else
|
||||
#define saveTimers()
|
||||
#define restoreTimers()
|
||||
#endif
|
||||
|
||||
void evalTimers(int16_t throttle, uint8_t tick10ms);
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ int16_t ppmInput[MAX_TRAINER_CHANNELS];
|
|||
uint8_t ppmInputValidityTimer;
|
||||
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "audio_arm.h"
|
||||
|
||||
void checkTrainerSignalWarning()
|
||||
|
@ -50,4 +49,3 @@ void checkTrainerSignalWarning()
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,11 +32,7 @@ extern uint8_t ppmInputValidityTimer;
|
|||
|
||||
#define IS_TRAINER_INPUT_VALID() (ppmInputValidityTimer != 0)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void checkTrainerSignalWarning();
|
||||
#else
|
||||
#define checkTrainerSignalWarning()
|
||||
#endif
|
||||
|
||||
// Needs to be inlined to avoid slow function calls in ISR routines
|
||||
inline void captureTrainerPulses(uint16_t capture)
|
||||
|
|
|
@ -46,9 +46,7 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||
ISTR(SLIDERTYPES)
|
||||
#endif
|
||||
ISTR(VTRIMINC)
|
||||
#if defined(CPUARM)
|
||||
ISTR(VDISPLAYTRIMS)
|
||||
#endif
|
||||
ISTR(RETA123)
|
||||
ISTR(VPROTOS)
|
||||
ISTR(POSNEG)
|
||||
|
@ -64,10 +62,6 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||
ISTR(VFSWFUNC)
|
||||
ISTR(VFSWRESET)
|
||||
ISTR(FUNCSOUNDS)
|
||||
#if !defined(CPUARM)
|
||||
ISTR(VTELEMCHNS)
|
||||
#endif
|
||||
#if defined(TELEMETRY_FRSKY) || defined(CPUARM)
|
||||
ISTR(VTELEMUNIT)
|
||||
ISTR(VALARM)
|
||||
ISTR(VALARMFN)
|
||||
|
@ -76,7 +70,6 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||
ISTR(AMPSRC)
|
||||
ISTR(VARIOSRC)
|
||||
ISTR(VTELEMSCREENTYPE)
|
||||
#endif
|
||||
#if defined(TEMPLATES)
|
||||
ISTR(VTEMPLATES)
|
||||
#endif
|
||||
|
@ -90,22 +83,15 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||
ISTR(INPUTNAMES)
|
||||
#endif
|
||||
ISTR(VTMRMODES)
|
||||
#if defined(CPUM2560) || defined(CPUARM)
|
||||
ISTR(DATETIME)
|
||||
ISTR(VPERSISTENT)
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
ISTR(VLCD)
|
||||
ISTR(VUNITSSYSTEM)
|
||||
ISTR(VBEEPCOUNTDOWN)
|
||||
ISTR(VVARIOCENTER)
|
||||
#endif
|
||||
#if defined(PXX) || defined(CPUARM)
|
||||
ISTR(COUNTRYCODES)
|
||||
ISTR(USBMODES)
|
||||
ISTR(VFAILSAFE)
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
ISTR(VTRAINERMODES)
|
||||
ISTR(TARANIS_PROTOCOLS)
|
||||
ISTR(R9M_REGION)
|
||||
|
@ -127,7 +113,6 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
|||
ISTR(BLUETOOTH_MODES)
|
||||
#endif
|
||||
ISTR(VANTENNATYPES)
|
||||
#endif
|
||||
#if defined(TELEMETRY_MAVLINK)
|
||||
ISTR(MAVLINK_BAUDS)
|
||||
ISTR(MAVLINK_AC_MODES)
|
||||
|
@ -164,10 +149,8 @@ const pm_char STR_USE_GLOBAL_FUNCS[] PROGMEM = TR_USE_GLOBAL_FUNCS;
|
|||
#endif
|
||||
const pm_char STR_PROTO[] PROGMEM = TR_PROTO;
|
||||
const pm_char STR_PPMFRAME[] PROGMEM = TR_PPMFRAME;
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_REFRESHRATE[] PROGMEM = TR_REFRESHRATE;
|
||||
const pm_char SSTR_WARN_BATTVOLTAGE[] PROGMEM = STR_WARN_BATTVOLTAGE;
|
||||
#endif
|
||||
const pm_char STR_MS[] PROGMEM = TR_MS;
|
||||
const pm_char STR_SWITCH[] PROGMEM = TR_SWITCH;
|
||||
const pm_char STR_TRIMS[] PROGMEM = TR_TRIMS;
|
||||
|
@ -222,9 +205,7 @@ const pm_char STR_BLADES[] PROGMEM = TR_BLADES;
|
|||
const pm_char STR_SCREEN[] PROGMEM = TR_SCREEN;
|
||||
const pm_char STR_SOUND_LABEL[] PROGMEM = TR_SOUND_LABEL;
|
||||
const pm_char STR_LENGTH[] PROGMEM = TR_LENGTH;
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_BEEP_LENGTH[] PROGMEM = TR_BEEP_LENGTH;
|
||||
#endif
|
||||
#if defined(AUDIO)
|
||||
const pm_char STR_SPKRPITCH[] PROGMEM = TR_SPKRPITCH;
|
||||
#endif
|
||||
|
@ -234,9 +215,7 @@ const pm_char STR_HAPTICSTRENGTH[] PROGMEM = TR_HAPTICSTRENGTH;
|
|||
#endif
|
||||
const pm_char STR_CONTRAST[] PROGMEM = TR_CONTRAST;
|
||||
const pm_char STR_ALARMS_LABEL[] PROGMEM = TR_ALARMS_LABEL;
|
||||
#if defined(BATTGRAPH) || defined(CPUARM)
|
||||
const pm_char STR_BATTERY_RANGE[] PROGMEM = TR_BATTERY_RANGE;
|
||||
#endif
|
||||
const pm_char STR_BATTERYWARNING[] PROGMEM = TR_BATTERYWARNING;
|
||||
const pm_char STR_INACTIVITYALARM[] PROGMEM = TR_INACTIVITYALARM;
|
||||
const pm_char STR_MEMORYWARNING[] PROGMEM = TR_MEMORYWARNING;
|
||||
|
@ -306,9 +285,7 @@ const pm_char STR_PPM_TRAINER[] PROGMEM = TR_PPM_TRAINER;
|
|||
const pm_char STR_CH[] PROGMEM = TR_CH;
|
||||
const pm_char STR_MODEL[] PROGMEM = TR_MODEL;
|
||||
const pm_char STR_FP[] PROGMEM = TR_FP;
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_MIX[] PROGMEM = TR_MIX;
|
||||
#endif
|
||||
const pm_char STR_ALERT[] PROGMEM = TR_ALERT;
|
||||
const pm_char STR_PRESSANYKEYTOSKIP[] PROGMEM = TR_PRESSANYKEYTOSKIP;
|
||||
const pm_char STR_THROTTLENOTIDLE[] PROGMEM = TR_THROTTLENOTIDLE;
|
||||
|
@ -331,13 +308,9 @@ const pm_char STR_STORAGE_WARNING[] PROGMEM = TR_STORAGE_WARNING;
|
|||
const pm_char STR_STORAGE_FORMAT[] PROGMEM = TR_STORAGE_FORMAT;
|
||||
#endif
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
const pm_char STR_FAS_OFFSET[] PROGMEM = TR_FAS_OFFSET;
|
||||
#endif
|
||||
|
||||
#if defined(CPUM2560) || defined(CPUARM)
|
||||
const pm_char STR_MENUDATEANDTIME[] PROGMEM = TR_MENUDATEANDTIME;
|
||||
#endif
|
||||
|
||||
const pm_char STR_MENUTRAINER[] PROGMEM = TR_MENUTRAINER;
|
||||
const pm_char STR_MENUSPECIALFUNCS[] PROGMEM = TR_MENUSPECIALFUNCS;
|
||||
|
@ -390,7 +363,6 @@ const pm_char STR_RECEIVER[] PROGMEM = TR_RECEIVER;
|
|||
const pm_char STR_REBIND[] PROGMEM = TR_REBIND;
|
||||
#endif
|
||||
|
||||
#if defined(PXX) || defined(CPUARM)
|
||||
const pm_char STR_SYNCMENU[] PROGMEM = TR_SYNCMENU;
|
||||
const pm_char STR_INTERNALRF[] PROGMEM = TR_INTERNALRF;
|
||||
const pm_char STR_EXTERNALRF[] PROGMEM = TR_EXTERNALRF;
|
||||
|
@ -405,7 +377,6 @@ const pm_char STR_NONE[] PROGMEM = TR_NONE;
|
|||
const pm_char STR_MENUSENSOR[] PROGMEM = TR_MENUSENSOR;
|
||||
const pm_char STR_SENSOR[] PROGMEM = TR_SENSOR;
|
||||
const pm_char STR_DISABLE_INTERNAL[] PROGMEM = TR_DISABLE_INTERNAL;
|
||||
#endif
|
||||
|
||||
const pm_char STR_INVERT_THR[] PROGMEM = TR_INVERT_THR;
|
||||
const pm_char STR_AND_SWITCH[] PROGMEM = TR_AND_SWITCH;
|
||||
|
@ -418,10 +389,8 @@ const pm_char STR_LATITUDE[] PROGMEM = TR_LATITUDE;
|
|||
const pm_char STR_LONGITUDE[] PROGMEM = TR_LONGITUDE;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
const pm_char STR_SHUTDOWN[] PROGMEM = TR_SHUTDOWN;
|
||||
const pm_char STR_SAVEMODEL[] PROGMEM = TR_SAVEMODEL;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9E)
|
||||
const pm_char STR_POWEROFF[] PROGMEM = TR_POWEROFF;
|
||||
|
@ -429,12 +398,9 @@ const pm_char STR_POWEROFF[] PROGMEM = TR_POWEROFF;
|
|||
|
||||
const pm_char STR_BATT_CALIB[] PROGMEM = TR_BATT_CALIB;
|
||||
|
||||
#if defined(CPUARM) || defined(TELEMETRY_FRSKY)
|
||||
const pm_char STR_VOLTAGE[] PROGMEM = TR_VOLTAGE;
|
||||
const pm_char STR_CURRENT[] PROGMEM = TR_CURRENT;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_CURRENT_CALIB[] PROGMEM = TR_CURRENT_CALIB;
|
||||
const pm_char STR_UNITSSYSTEM[] PROGMEM = TR_UNITSSYSTEM;
|
||||
const pm_char STR_VOICELANG[] PROGMEM = TR_VOICELANG;
|
||||
|
@ -443,7 +409,6 @@ const pm_char STR_BEEP_VOLUME[] PROGMEM = INDENT TR_BEEP_VOLUME;
|
|||
const pm_char STR_WAV_VOLUME[] PROGMEM = INDENT TR_WAV_VOLUME;
|
||||
const pm_char STR_BG_VOLUME[] PROGMEM = INDENT TR_BG_VOLUME;
|
||||
const pm_char STR_PERSISTENT_MAH[] PROGMEM = TR_PERSISTENT_MAH;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
const pm_char STR_SELECT_MODEL[] PROGMEM = TR_SELECT_MODEL;
|
||||
|
@ -606,13 +571,11 @@ const pm_char STR_CONFIRMRESET[] PROGMEM = TR_CONFIRMRESET;
|
|||
const pm_char STR_TOO_MANY_LUA_SCRIPTS[] PROGMEM = TR_TO_MANY_LUA_SCRIPTS;
|
||||
const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
||||
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_MODELNAME[] PROGMEM = TR_MODELNAME;
|
||||
const pm_char STR_PHASENAME[] PROGMEM = TR_PHASENAME;
|
||||
const pm_char STR_MIXNAME[] PROGMEM = TR_MIXNAME;
|
||||
const pm_char STR_INPUTNAME[] PROGMEM = TR_INPUTNAME;
|
||||
const pm_char STR_EXPONAME[] PROGMEM = TR_EXPONAME;
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
const char * const STR_PHASES_HEADERS[] = TR_PHASES_HEADERS;
|
||||
|
@ -622,7 +585,6 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const char * const STR_GVAR_HEADERS[] = TR_GVAR_HEADERS;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_TRAINER[] PROGMEM = TR_TRAINER;
|
||||
const pm_char STR_MODULE_BIND[] PROGMEM = TR_MODULE_BIND;
|
||||
const pm_char STR_BINDING_1_8_TELEM_ON[] PROGMEM = TR_BINDING_CH1_8_TELEM_ON;
|
||||
|
@ -688,9 +650,7 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_MAIN_COLOR[] PROGMEM = TR_MAIN_COLOR;
|
||||
const pm_char STR_TEXT_VIEWER[] PROGMEM = TR_TEXT_VIEWER;
|
||||
const pm_char STR_MULTI_RFPOWER[] PROGMEM = TR_MULTI_RFPOWER;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
const pm_char STR_BYTES[] PROGMEM = TR_BYTES;
|
||||
const pm_char STR_ANTENNAPROBLEM[] PROGMEM = TR_ANTENNAPROBLEM;
|
||||
const pm_char STR_MODULE[] PROGMEM = TR_MODULE;
|
||||
|
@ -740,7 +700,6 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_MENU_OTHER[] PROGMEM = TR_MENU_OTHER;
|
||||
const pm_char STR_MENU_INVERT[] PROGMEM = TR_MENU_INVERT;
|
||||
const pm_char STR_JITTER_FILTER[] PROGMEM = TR_JITTER_FILTER;
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
const pm_char STR_UNLOCKED[] PROGMEM = TR_UNLOCKED;
|
||||
|
@ -786,7 +745,6 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_MAVLINK_LON[] PROGMEM = TR_MAVLINK_LON;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
const pm_char STR_ABOUTUS[] PROGMEM = TR_ABOUTUS;
|
||||
const pm_char STR_ABOUT_OPENTX_1[] PROGMEM = TR_ABOUT_OPENTX_1;
|
||||
const pm_char STR_ABOUT_OPENTX_2[] PROGMEM = TR_ABOUT_OPENTX_2;
|
||||
|
@ -830,4 +788,3 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_ABOUT_PARENTS_2[] PROGMEM = TR_ABOUT_PARENTS_2;
|
||||
const pm_char STR_ABOUT_PARENTS_3[] PROGMEM = TR_ABOUT_PARENTS_3;
|
||||
const pm_char STR_ABOUT_PARENTS_4[] PROGMEM = TR_ABOUT_PARENTS_4;
|
||||
#endif
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_SBUS_MODULE TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY TR_VTRAINER_BLUETOOTH
|
||||
#elif defined(PCBTARANIS)
|
||||
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_SBUS_MODULE TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define TR_VTRAINERMODES TR_VTRAINER_MASTER_JACK TR_VTRAINER_SLAVE_JACK TR_VTRAINER_MASTER_CPPM_MODULE TR_VTRAINER_MASTER_BATTERY
|
||||
#endif
|
||||
|
||||
|
@ -135,12 +135,8 @@ extern const pm_char STR_OPEN9X[];
|
|||
#else
|
||||
#define OFS_VTRIMINC (OFS_TRNCHN + sizeof(TR_TRNCHN))
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
#define OFS_VDISPLAYTRIMS (OFS_VTRIMINC + sizeof(TR_VTRIMINC))
|
||||
#define OFS_RETA123 (OFS_VDISPLAYTRIMS + sizeof(TR_VDISPLAYTRIMS))
|
||||
#else
|
||||
#define OFS_RETA123 (OFS_VTRIMINC + sizeof(TR_VTRIMINC))
|
||||
#endif
|
||||
#define OFS_VPROTOS (OFS_RETA123 + sizeof(TR_RETA123))
|
||||
#define OFS_POSNEG (OFS_VPROTOS + sizeof(TR_VPROTOS))
|
||||
#if defined(PCBSKY9X) && defined(REVX)
|
||||
|
@ -158,14 +154,8 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define OFS_VFSWRESET (OFS_VFSWFUNC + sizeof(TR_VFSWFUNC))
|
||||
#define OFS_FUNCSOUNDS (OFS_VFSWRESET + sizeof(TR_VFSWRESET))
|
||||
#define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS))
|
||||
#if defined(TELEMETRY_FRSKY) || defined(CPUARM)
|
||||
#if defined(CPUARM)
|
||||
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS)
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
||||
#else
|
||||
#define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT))
|
||||
#endif
|
||||
#define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM))
|
||||
#define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN))
|
||||
#define OFS_GPSFORMAT (OFS_VTELPROTO + sizeof(TR_VTELPROTO))
|
||||
|
@ -173,9 +163,6 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define OFS_VARIOSRC (OFS_AMPSRC + sizeof(TR_AMPSRC))
|
||||
#define OFS_VSCREEN (OFS_VARIOSRC + sizeof(TR_VARIOSRC))
|
||||
#define OFS_VTEMPLATES (OFS_VSCREEN + sizeof(TR_VTELEMSCREENTYPE))
|
||||
#else
|
||||
#define OFS_VTEMPLATES (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS))
|
||||
#endif
|
||||
#if defined(TEMPLATES)
|
||||
#define TR_VTEMPLATES TR_TEMPLATE_CLEAR_MIXES TR_TEMPLATE_SIMPLE_4CH TR_TEMPLATE_STICKY_TCUT TR_TEMPLATE_VTAIL TR_TEMPLATE_DELTA TR_TEMPLATE_ECCPM TR_TEMPLATE_HELI TR_TEMPLATE_SERVO_TEST
|
||||
#define OFS_VSWASHTYPE (OFS_VTEMPLATES + sizeof(TR_VTEMPLATES))
|
||||
|
@ -196,29 +183,15 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define OFS_VTMRMODES (OFS_VSRCRAW + sizeof(TR_VSRCRAW))
|
||||
#endif
|
||||
#define OFS_DATETIME (OFS_VTMRMODES + sizeof(TR_VTMRMODES))
|
||||
#if defined(CPUM2560) || defined(CPUARM)
|
||||
#define OFS_VPERSISTENT (OFS_DATETIME + sizeof(TR_DATETIME))
|
||||
#define OFS_VLCD (OFS_VPERSISTENT + sizeof(TR_VPERSISTENT))
|
||||
#else
|
||||
#define OFS_VLCD (OFS_DATETIME)
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
#define OFS_VUNITSSYSTEM (OFS_VLCD + sizeof(TR_VLCD))
|
||||
#define OFS_VBEEPCOUNTDOWN (OFS_VUNITSSYSTEM + sizeof(TR_VUNITSSYSTEM))
|
||||
#define OFS_VVARIOCENTER (OFS_VBEEPCOUNTDOWN + sizeof(TR_VBEEPCOUNTDOWN))
|
||||
#define OFS_COUNTRYCODES (OFS_VVARIOCENTER + sizeof(TR_VVARIOCENTER))
|
||||
#define OFS_USBMODES (OFS_COUNTRYCODES + sizeof(TR_COUNTRYCODES))
|
||||
#else
|
||||
#define OFS_COUNTRYCODES (OFS_VLCD)
|
||||
#endif
|
||||
#if defined(PXX) || defined(CPUARM)
|
||||
#define OFS_VFAILSAFE (OFS_USBMODES + sizeof(TR_USBMODES))
|
||||
#define OFS_VTRAINERMODES (OFS_VFAILSAFE + sizeof(TR_VFAILSAFE))
|
||||
#else
|
||||
#define OFS_VFAILSAFE (OFS_COUNTRYCODES)
|
||||
#define OFS_VTRAINERMODES (OFS_VFAILSAFE)
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
#define OFS_TARANIS_PROTOCOLS (OFS_VTRAINERMODES + sizeof(TR_VTRAINERMODES))
|
||||
#define OFS_R9M_REGION (OFS_TARANIS_PROTOCOLS + sizeof(TR_TARANIS_PROTOCOLS))
|
||||
#define OFS_R9M_FCC_POWER_VALUES (OFS_R9M_REGION + sizeof(TR_R9M_REGION))
|
||||
|
@ -244,9 +217,6 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define OFS_VANTENNATYPES (OFS_VCELLINDEX + sizeof(TR_VCELLINDEX))
|
||||
#endif
|
||||
#define OFS_MAVLINK_BAUDS (OFS_VANTENNATYPES + sizeof(TR_VANTENNATYPES))
|
||||
#else
|
||||
#define OFS_MAVLINK_BAUDS (OFS_VTRAINERMODES)
|
||||
#endif
|
||||
#if defined(TELEMETRY_MAVLINK)
|
||||
#define OFS_MAVLINK_AC_MODES (OFS_MAVLINK_BAUDS + sizeof(TR_MAVLINK_BAUDS))
|
||||
#define OFS_MAVLINK_AP_MODES (OFS_MAVLINK_AC_MODES + sizeof(TR_MAVLINK_AC_MODES))
|
||||
|
@ -289,13 +259,8 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define STR_FUNCSOUNDS (STR_OPEN9X + OFS_FUNCSOUNDS)
|
||||
#define STR_VTELEMCHNS (STR_OPEN9X + OFS_VTELEMCHNS)
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) || defined(CPUARM)
|
||||
#if defined(CPUARM)
|
||||
#define STR_VTELEMUNIT (STR_OPEN9X + OFS_VTELEMUNIT)
|
||||
#define STR_VOLTSRC (STR_OPEN9X + OFS_VOLTSRC)
|
||||
#else
|
||||
#define STR_VTELEMUNIT (STR_OPEN9X + OFS_VTELEMUNIT)
|
||||
#endif
|
||||
#define STR_VALARM (STR_OPEN9X + OFS_VALARM)
|
||||
#define STR_VALARMFN (STR_OPEN9X + OFS_VALARMFN)
|
||||
#define STR_VTELPROTO (STR_OPEN9X + OFS_VTELPROTO)
|
||||
|
@ -304,7 +269,6 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define STR_VARIOSRC (STR_OPEN9X + OFS_VARIOSRC)
|
||||
#define STR_VTELEMSCREENTYPE (STR_OPEN9X + OFS_VSCREEN)
|
||||
#define STR_TELEMCHNS (STR_OPEN9X + OFS_TELEMCHNS)
|
||||
#endif
|
||||
|
||||
#if defined(TEMPLATES)
|
||||
#define STR_VTEMPLATES (STR_OPEN9X + OFS_VTEMPLATES)
|
||||
|
@ -330,25 +294,18 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define STR_VRENCODERS (STR_OPEN9X + OFS_VRENCODERS)
|
||||
#endif
|
||||
|
||||
#if defined(CPUM2560) || defined(CPUARM)
|
||||
#define STR_DATETIME (STR_OPEN9X + OFS_DATETIME)
|
||||
#define STR_VPERSISTENT (STR_OPEN9X + OFS_VPERSISTENT)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define STR_VLCD (STR_OPEN9X + OFS_VLCD)
|
||||
#define STR_VUNITSSYSTEM (STR_OPEN9X + OFS_VUNITSSYSTEM)
|
||||
#define STR_VBEEPCOUNTDOWN (STR_OPEN9X + OFS_VBEEPCOUNTDOWN)
|
||||
#define STR_VVARIOCENTER (STR_OPEN9X + OFS_VVARIOCENTER)
|
||||
#endif
|
||||
|
||||
#if defined(PXX) || defined(CPUARM)
|
||||
#define STR_COUNTRYCODES (STR_OPEN9X + OFS_COUNTRYCODES)
|
||||
#define STR_USBMODES (STR_OPEN9X + OFS_USBMODES)
|
||||
#define STR_VFAILSAFE (STR_OPEN9X + OFS_VFAILSAFE)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define STR_VTRAINERMODES (STR_OPEN9X + OFS_VTRAINERMODES)
|
||||
#define STR_TARANIS_PROTOCOLS (STR_OPEN9X + OFS_TARANIS_PROTOCOLS)
|
||||
#define STR_R9M_REGION (STR_OPEN9X + OFS_R9M_REGION)
|
||||
|
@ -366,7 +323,6 @@ extern const pm_char STR_OPEN9X[];
|
|||
#define STR_VPREC (STR_OPEN9X + OFS_VPREC)
|
||||
#define STR_VCELLINDEX (STR_OPEN9X + OFS_VCELLINDEX)
|
||||
#define STR_VANTENNATYPES (STR_OPEN9X + OFS_VANTENNATYPES)
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
extern const pm_char STR_BLUETOOTH[];
|
||||
|
@ -421,10 +377,8 @@ extern const pm_char STR_USE_GLOBAL_FUNCS[];
|
|||
#endif
|
||||
extern const pm_char STR_PROTO[];
|
||||
extern const pm_char STR_PPMFRAME[];
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_REFRESHRATE[];
|
||||
extern const pm_char SSTR_WARN_BATTVOLTAGE[];
|
||||
#endif
|
||||
extern const pm_char STR_MS[];
|
||||
extern const pm_char STR_SWITCH[];
|
||||
extern const pm_char STR_TRIMS[];
|
||||
|
@ -481,19 +435,13 @@ extern const pm_char STR_SCREEN[];
|
|||
extern const pm_char STR_SOUND_LABEL[];
|
||||
extern const pm_char STR_LENGTH[];
|
||||
extern const pm_char STR_BEEP_LENGTH[];
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_BEEP_LENGTH[];
|
||||
#else
|
||||
#define STR_BEEP_LENGTH STR_LENGTH
|
||||
#endif
|
||||
extern const pm_char STR_SPKRPITCH[];
|
||||
extern const pm_char STR_HAPTIC_LABEL[];
|
||||
extern const pm_char STR_HAPTICSTRENGTH[];
|
||||
extern const pm_char STR_CONTRAST[];
|
||||
extern const pm_char STR_ALARMS_LABEL[];
|
||||
#if defined(BATTGRAPH) || defined(CPUARM)
|
||||
extern const pm_char STR_BATTERY_RANGE[];
|
||||
#endif
|
||||
extern const pm_char STR_BATTERYWARNING[];
|
||||
extern const pm_char STR_INACTIVITYALARM[];
|
||||
extern const pm_char STR_MEMORYWARNING[];
|
||||
|
@ -559,9 +507,7 @@ extern const pm_char STR_PPM_TRAINER[];
|
|||
extern const pm_char STR_CH[];
|
||||
extern const pm_char STR_MODEL[];
|
||||
extern const pm_char STR_FP[];
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_MIX[];
|
||||
#endif
|
||||
extern const pm_char STR_EEPROMLOWMEM[];
|
||||
extern const pm_char STR_ALERT[];
|
||||
extern const pm_char STR_PRESSANYKEYTOSKIP[];
|
||||
|
@ -609,9 +555,7 @@ extern const pm_char STR_AND_SWITCH[];
|
|||
extern const pm_char STR_SF[];
|
||||
extern const pm_char STR_GF[];
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
extern const pm_char STR_FAS_OFFSET[];
|
||||
#endif
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
extern const pm_char STR_MULTI_CUSTOM[];
|
||||
|
@ -641,7 +585,6 @@ extern const pm_char STR_RECEIVER[];
|
|||
extern const pm_char STR_REBIND[];
|
||||
#endif
|
||||
|
||||
#if defined(PXX) || defined(CPUARM)
|
||||
extern const pm_char STR_SYNCMENU[];
|
||||
extern const pm_char STR_INTERNALRF[];
|
||||
extern const pm_char STR_EXTERNALRF[];
|
||||
|
@ -656,7 +599,6 @@ extern const pm_char STR_SENSOR[];
|
|||
extern const pm_char STR_COUNTRYCODE[];
|
||||
extern const pm_char STR_USBMODE[];
|
||||
extern const pm_char STR_DISABLE_INTERNAL[];
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
extern const pm_char STR_LIMIT[];
|
||||
|
@ -668,10 +610,8 @@ extern const pm_char STR_LATITUDE[];
|
|||
extern const pm_char STR_LONGITUDE[];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
extern const pm_char STR_SHUTDOWN[];
|
||||
extern const pm_char STR_SAVEMODEL[];
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9E)
|
||||
extern const pm_char STR_POWEROFF[];
|
||||
|
@ -679,12 +619,9 @@ extern const pm_char STR_POWEROFF[];
|
|||
|
||||
extern const pm_char STR_BATT_CALIB[];
|
||||
|
||||
#if defined(CPUARM) || defined(TELEMETRY_FRSKY)
|
||||
extern const pm_char STR_VOLTAGE[];
|
||||
extern const pm_char STR_CURRENT[];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_CURRENT_CALIB[];
|
||||
extern const pm_char STR_UNITSSYSTEM[];
|
||||
extern const pm_char STR_VOICELANG[];
|
||||
|
@ -693,7 +630,6 @@ extern const pm_char STR_BEEP_VOLUME[];
|
|||
extern const pm_char STR_WAV_VOLUME[];
|
||||
extern const pm_char STR_BG_VOLUME[];
|
||||
extern const pm_char STR_PERSISTENT_MAH[];
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define LEN_CALIB_FIELDS (PSIZE(TR_BATT_CALIB) > PSIZE(TR_CURRENT_CALIB) ? PSIZE(TR_BATT_CALIB) : PSIZE(TR_CURRENT_CALIB))
|
||||
|
@ -900,18 +836,11 @@ extern const pm_char STR_BLCOLOR[];
|
|||
#define LANGUAGE_PACK_DECLARE_DEFAULT(lng, name)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_MODELNAME[];
|
||||
extern const pm_char STR_PHASENAME[];
|
||||
extern const pm_char STR_MIXNAME[];
|
||||
extern const pm_char STR_INPUTNAME[];
|
||||
extern const pm_char STR_EXPONAME[];
|
||||
#else
|
||||
#define STR_MODELNAME STR_NAME
|
||||
#define STR_PHASENAME STR_NAME
|
||||
#define STR_MIXNAME STR_NAME
|
||||
#define STR_EXPONAME STR_NAME
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
#define TR_PHASES_HEADERS { TR_PHASES_HEADERS_NAME, TR_PHASES_HEADERS_SW, TR_PHASES_HEADERS_RUD_TRIM, TR_PHASES_HEADERS_ELE_TRIM, TR_PHASES_HEADERS_THT_TRIM, TR_PHASES_HEADERS_AIL_TRIM, TR_PHASES_HEADERS_CH5_TRIM, TR_PHASES_HEADERS_CH6_TRIM, TR_PHASES_HEADERS_FAD_IN, TR_PHASES_HEADERS_FAD_OUT }
|
||||
|
@ -931,7 +860,6 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const char * const STR_GVAR_HEADERS[];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_TRAINER[];
|
||||
extern const pm_char STR_MODULE_BIND[];
|
||||
extern const pm_char STR_BINDING_1_8_TELEM_ON[];
|
||||
|
@ -997,9 +925,7 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_MAIN_COLOR[];
|
||||
extern const pm_char STR_TEXT_VIEWER[];
|
||||
extern const pm_char STR_MULTI_RFPOWER[];
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern const pm_char STR_BYTES[];
|
||||
extern const pm_char STR_ANTENNAPROBLEM[];
|
||||
extern const pm_char STR_MODULE[];
|
||||
|
@ -1050,7 +976,6 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_MENU_OTHER[];
|
||||
extern const pm_char STR_MENU_INVERT[];
|
||||
extern const pm_char STR_JITTER_FILTER[];
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
extern const pm_char STR_UNLOCKED[];
|
||||
|
@ -1087,7 +1012,6 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_MAVLINK_LON[];
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
extern const pm_char STR_ABOUTUS[];
|
||||
extern const pm_char STR_ABOUT_OPENTX_1[];
|
||||
extern const pm_char STR_ABOUT_OPENTX_2[];
|
||||
|
@ -1131,7 +1055,6 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_ABOUT_PARENTS_2[];
|
||||
extern const pm_char STR_ABOUT_PARENTS_3[];
|
||||
extern const pm_char STR_ABOUT_PARENTS_4[];
|
||||
#endif
|
||||
|
||||
#define CHR_SHORT TR_CHR_SHORT
|
||||
#define CHR_LONG TR_CHR_LONG
|
||||
|
|
|
@ -41,11 +41,7 @@ enum CzechPrompts {
|
|||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CZ_PUSH_UNIT_PROMPT(u, p) cz_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define CZ_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
#define MALE 0x80
|
||||
#define FEMALE 0x81
|
||||
|
@ -53,7 +49,6 @@ enum CzechPrompts {
|
|||
|
||||
I18N_PLAY_FUNCTION(cz, pushUnitPrompt, uint8_t unit, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
TRACE("CZSAY unit:%d number:%d", unit, number);
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unit, 0);
|
||||
|
@ -61,15 +56,6 @@ I18N_PLAY_FUNCTION(cz, pushUnitPrompt, uint8_t unit, int16_t number)
|
|||
PUSH_UNIT_PROMPT(unit, 1);
|
||||
else
|
||||
PUSH_UNIT_PROMPT(unit, 2);
|
||||
#else
|
||||
unitprompt = CZ_PROMPT_UNITS_BASE+((unit-1)*4);
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unit);
|
||||
else if (number > 1 && number < 5)
|
||||
PUSH_NUMBER_PROMPT(unit+1);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unit+2);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -79,31 +65,12 @@ I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, FEMALE);
|
||||
|
@ -117,11 +84,7 @@ I18N_PLAY_FUNCTION(cz, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
PUSH_NUMBER_PROMPT(CZ_PROMPT_CELYCH);
|
||||
};
|
||||
PLAY_NUMBER(qr.rem, 0, FEMALE);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(unit, 3);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(CZ_PROMPT_UNITS_BASE+((unit-1)*4)+3);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -62,29 +62,18 @@ enum GermanPrompts {
|
|||
DE_PROMPT_SECONDS = DE_PROMPT_UNITS_BASE+UNIT_SECONDS,
|
||||
DE_PROMPT_RPMS = DE_PROMPT_UNITS_BASE+UNIT_RPMS,
|
||||
DE_PROMPT_G = DE_PROMPT_UNITS_BASE+UNIT_G,
|
||||
#if defined(CPUARM)
|
||||
DE_PROMPT_MILLILITERS = DE_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
|
||||
DE_PROMPT_FLOZ = DE_PROMPT_UNITS_BASE+UNIT_FLOZ,
|
||||
DE_PROMPT_FEET_PER_SECOND = DE_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(VOICE)
|
||||
#if defined(CPUARM)
|
||||
#define DE_PUSH_UNIT_PROMPT(u) de_pushUnitPrompt((u), id)
|
||||
#else
|
||||
#define DE_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(de, pushUnitPrompt, uint8_t unitprompt)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
#else
|
||||
unitprompt = DE_PROMPT_UNITS_BASE + unitprompt*2
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -104,31 +93,12 @@ I18N_PLAY_FUNCTION(de, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem > 0) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -50,26 +50,14 @@ enum EnglishPrompts {
|
|||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EN_PUSH_UNIT_PROMPT(u, p) en_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define EN_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(en, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
else
|
||||
PUSH_UNIT_PROMPT(unitprompt, 1);
|
||||
#else
|
||||
unitprompt = EN_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -79,31 +67,12 @@ I18N_PLAY_FUNCTION(en, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -81,29 +81,18 @@ enum SpanishPrompts {
|
|||
ES_PROMPT_SECONDS = ES_PROMPT_UNITS_BASE+UNIT_SECONDS,
|
||||
ES_PROMPT_RPMS = ES_PROMPT_UNITS_BASE+UNIT_RPMS,
|
||||
ES_PROMPT_G = ES_PROMPT_UNITS_BASE+UNIT_G,
|
||||
#if defined(CPUARM)
|
||||
ES_PROMPT_MILLILITERS = ES_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
|
||||
ES_PROMPT_FLOZ = ES_PROMPT_UNITS_BASE+UNIT_FLOZ,
|
||||
ES_PROMPT_FEET_PER_SECOND = ES_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(VOICE)
|
||||
#if defined(CPUARM)
|
||||
#define ES_PUSH_UNIT_PROMPT(u) es_pushUnitPrompt((u), id)
|
||||
#else
|
||||
#define ES_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(es, pushUnitPrompt, uint8_t unitprompt)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
#else
|
||||
unitprompt = ES_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -123,31 +112,12 @@ I18N_PLAY_FUNCTION(es, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem > 0) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
@ -206,19 +176,11 @@ I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT)
|
|||
ore = tmp;
|
||||
if (tmp > 1) {
|
||||
PLAY_NUMBER(tmp, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
|
||||
PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_HORAS);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_HORA);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,38 +189,22 @@ I18N_PLAY_FUNCTION(es, playDuration, int seconds PLAY_DURATION_ATT)
|
|||
if (tmp > 0 || ore >0) {
|
||||
if (tmp != 1) {
|
||||
PLAY_NUMBER(tmp, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
|
||||
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTOS);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_MINUTO);
|
||||
#endif
|
||||
}
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_Y);
|
||||
}
|
||||
|
||||
if (seconds != 1) {
|
||||
PLAY_NUMBER(seconds, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UNA);
|
||||
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDOS);
|
||||
}
|
||||
else {
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_UN);
|
||||
PUSH_NUMBER_PROMPT(ES_PROMPT_SEGUNDO);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,20 +54,11 @@ enum FrenchPrompts {
|
|||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FR_PUSH_UNIT_PROMPT(u) fr_pushUnitPrompt((u), id)
|
||||
#else
|
||||
#define FR_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(fr, pushUnitPrompt, uint8_t unitprompt)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
#else
|
||||
unitprompt = FR_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define FEMININ 0x80
|
||||
|
@ -89,31 +80,12 @@ I18N_PLAY_FUNCTION(fr, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -50,26 +50,14 @@ enum HungarianPrompts {
|
|||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define HU_PUSH_UNIT_PROMPT(u, p) hu_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define HU_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(hu, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
else
|
||||
PUSH_UNIT_PROMPT(unitprompt, 1);
|
||||
#else
|
||||
unitprompt = HU_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -79,31 +67,12 @@ I18N_PLAY_FUNCTION(hu, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -53,35 +53,21 @@ enum ItalianPrompts {
|
|||
IT_PROMPT_WATTS = IT_PROMPT_UNITS_BASE+(UNIT_WATTS*2),
|
||||
IT_PROMPT_FEET = IT_PROMPT_UNITS_BASE+(UNIT_FEET*2),
|
||||
IT_PROMPT_KTS = IT_PROMPT_UNITS_BASE+(UNIT_KTS*2),
|
||||
#if defined(CPUARM)
|
||||
IT_PROMPT_MILLILITERS = IT_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*2),
|
||||
IT_PROMPT_FLOZ = IT_PROMPT_UNITS_BASE+(UNIT_FLOZ*2),
|
||||
IT_PROMPT_FEET_PER_SECOND = IT_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*2),
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if defined(VOICE)
|
||||
#if defined(CPUARM)
|
||||
#define IT_PUSH_UNIT_PROMPT(u, p) it_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define IT_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(it, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
else
|
||||
PUSH_UNIT_PROMPT(unitprompt, 1);
|
||||
#else
|
||||
unitprompt = IT_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -102,31 +88,12 @@ I18N_PLAY_FUNCTION(it, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
orignumber=number;
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem > 0) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -37,26 +37,14 @@ enum DutchPrompts {
|
|||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define NL_PUSH_UNIT_PROMPT(u, p) nl_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define NL_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(nl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
else
|
||||
PUSH_UNIT_PROMPT(unitprompt, 1);
|
||||
#else
|
||||
unitprompt = NL_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(nl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -66,31 +54,12 @@ I18N_PLAY_FUNCTION(nl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div(number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
|
|
@ -58,20 +58,14 @@ enum PolishPrompts {
|
|||
PL_PROMPT_SECONDS = PL_PROMPT_UNITS_BASE+(UNIT_SECONDS*4),
|
||||
PL_PROMPT_RPMS = PL_PROMPT_UNITS_BASE+(UNIT_RPMS*4),
|
||||
PL_PROMPT_G = PL_PROMPT_UNITS_BASE+(UNIT_G*4),
|
||||
#if defined(CPUARM)
|
||||
PL_PROMPT_MILLILITERS = PL_PROMPT_UNITS_BASE+(UNIT_MILLILITERS*4),
|
||||
PL_PROMPT_FLOZ = PL_PROMPT_UNITS_BASE+(UNIT_FLOZ*4),
|
||||
PL_PROMPT_FEET_PER_SECOND = PL_PROMPT_UNITS_BASE+(UNIT_FEET_PER_SECOND*4),
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define PL_PUSH_UNIT_PROMPT(u, p) pl_pushUnitPrompt((u), (p), id)
|
||||
#else
|
||||
#define PL_PUSH_UNIT_PROMPT(u, p) pushUnitPrompt((u), (p))
|
||||
#endif
|
||||
|
||||
#define MESKI 0x80
|
||||
#define ZENSKI 0x81
|
||||
|
@ -79,7 +73,6 @@ enum PolishPrompts {
|
|||
|
||||
I18N_PLAY_FUNCTION(pl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (number == 1)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
else if (number > 1 && number < 5)
|
||||
|
@ -94,23 +87,6 @@ I18N_PLAY_FUNCTION(pl, pushUnitPrompt, uint8_t unitprompt, int16_t number)
|
|||
else
|
||||
PUSH_UNIT_PROMPT(unitprompt, 2);
|
||||
}
|
||||
#else
|
||||
unitprompt = PL_PROMPT_UNITS_BASE + unitprompt*4;
|
||||
if (number == 1)
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
else if (number > 1 && number < 5)
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
else {
|
||||
int test_2 =0;
|
||||
test_2 =number % 10;
|
||||
int ten=0;
|
||||
ten=(number - (number % 10))/10;
|
||||
if ((test_2 > 1 && test_2 < 5) && ten >=2)
|
||||
PUSH_NUMBER_PROMPT(unitprompt+1);
|
||||
else
|
||||
PUSH_NUMBER_PROMPT(unitprompt+2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -121,31 +97,12 @@ I18N_PLAY_FUNCTION(pl, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem) {
|
||||
PLAY_NUMBER(qr.quot, 0, ZENSKI);
|
||||
|
|
|
@ -76,29 +76,18 @@ enum PortuguesePrompts {
|
|||
PT_PROMPT_WATTS = PT_PROMPT_UNITS_BASE+UNIT_WATTS,
|
||||
PT_PROMPT_FEET = PT_PROMPT_UNITS_BASE+UNIT_FEET,
|
||||
PT_PROMPT_KTS = PT_PROMPT_UNITS_BASE+UNIT_KTS,
|
||||
#if defined(CPUARM)
|
||||
PT_PROMPT_MILLILITERS = PT_PROMPT_UNITS_BASE+UNIT_MILLILITERS,
|
||||
PT_PROMPT_FLOZ = PT_PROMPT_UNITS_BASE+UNIT_FLOZ,
|
||||
PT_PROMPT_FEET_PER_SECOND = PT_PROMPT_UNITS_BASE+UNIT_FEET_PER_SECOND,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(VOICE)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define PT_PUSH_UNIT_PROMPT(u) pt_pushUnitPrompt((u), id)
|
||||
#else
|
||||
#define PT_PUSH_UNIT_PROMPT(u) pushUnitPrompt((u))
|
||||
#endif
|
||||
|
||||
I18N_PLAY_FUNCTION(pt, pushUnitPrompt, uint8_t unitprompt)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(unitprompt, 0);
|
||||
#else
|
||||
unitprompt = PT_PROMPT_UNITS_BASE + unitprompt*2;
|
||||
PUSH_NUMBER_PROMPT(unitprompt);
|
||||
#endif
|
||||
}
|
||||
|
||||
I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
||||
|
@ -108,31 +97,12 @@ I18N_PLAY_FUNCTION(pt, playNumber, getvalue_t number, uint8_t unit, uint8_t att)
|
|||
number = -number;
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (unit) {
|
||||
unit--;
|
||||
convertUnit(number, unit);
|
||||
if (IS_IMPERIAL_ENABLE()) {
|
||||
if (unit == UNIT_DIST) {
|
||||
unit = UNIT_FEET;
|
||||
}
|
||||
if (unit == UNIT_SPEED) {
|
||||
unit = UNIT_KTS;
|
||||
}
|
||||
}
|
||||
unit++;
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t mode = MODE(att);
|
||||
if (mode > 0) {
|
||||
#if defined(CPUARM)
|
||||
if (mode == 2) {
|
||||
number /= 10;
|
||||
}
|
||||
#else
|
||||
// we assume that we are PREC1
|
||||
#endif
|
||||
div_t qr = div((int)number, 10);
|
||||
if (qr.rem > 0) {
|
||||
PLAY_NUMBER(qr.quot, 0, 0);
|
||||
|
@ -185,25 +155,13 @@ I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT)
|
|||
ore=tmp;
|
||||
if (tmp > 2) {
|
||||
PLAY_NUMBER(tmp, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
|
||||
#endif
|
||||
} else if (tmp==2) {
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_DUAS);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_HOURS, 1);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
|
||||
#endif
|
||||
} else if (tmp==1) {
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_UMA);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_HOURS, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_HORAS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,36 +170,20 @@ I18N_PLAY_FUNCTION(pt, playDuration, int seconds PLAY_DURATION_ATT)
|
|||
if (tmp > 0 || ore >0) {
|
||||
if (tmp != 1) {
|
||||
PLAY_NUMBER(tmp, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_MINUTES, 1);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTOS);
|
||||
#endif
|
||||
} else {
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_MINUTES, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_MINUTO);
|
||||
#endif
|
||||
}
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_E);
|
||||
}
|
||||
|
||||
if (seconds != 1) {
|
||||
PLAY_NUMBER(seconds, 0, 0);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_SECONDS, 1);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDOS);
|
||||
#endif
|
||||
} else {
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_NUMBERS_BASE+1);
|
||||
#if defined(CPUARM)
|
||||
PUSH_UNIT_PROMPT(UNIT_SECONDS, 0);
|
||||
#else
|
||||
PUSH_NUMBER_PROMPT(PT_PROMPT_SEGUNDO);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue