Merge remote-tracking branch 'origin/next' into Horus
# Conflicts: # companion/src/CMakeLists.txt # companion/src/firmwares/opentx/opentxinterface.cpp # companion/src/firmwares/opentx/simulator/CMakeLists.txt # companion/src/firmwares/opentx/stamp-opentx.h.in # radio/src/Makefile # radio/src/cli.cpp # radio/src/gui/Taranis/helpers.cpp # radio/src/gui/Taranis/lcd.cpp # radio/src/gui/Taranis/menu_model_setup.cpp # radio/src/gui/Taranis/view_main.cpp # radio/src/lua_api.cpp # radio/src/main_avr.cpp # radio/src/myeeprom.h # radio/src/opentx.cpp # radio/src/pulses/pxx_arm.cpp # radio/src/storage/eeprom_conversions.cpp # radio/src/targets/Horus/adc_driver.cpp # radio/src/targets/Horus/board_horus.cpp # radio/src/targets/Horus/board_horus.h # radio/src/targets/Horus/diskio.cpp # radio/src/targets/Horus/hal.h # radio/src/targets/Horus/haptic_driver.cpp # radio/src/targets/Horus/i2c_driver.cpp # radio/src/targets/Horus/keys_driver.cpp # radio/src/targets/Horus/lcd_driver.cpp # radio/src/targets/Horus/led_driver.cpp # radio/src/targets/Horus/pulses_driver.cpp # radio/src/targets/Horus/pwr_driver.c # radio/src/targets/Horus/sdio_sd.c # radio/src/targets/Horus/sdio_sd.h # radio/src/targets/Horus/serial2_driver.cpp # radio/src/targets/Horus/telemetry_driver.cpp # radio/src/targets/Horus/usb_conf.h # radio/src/targets/Horus/usbd_desc.c # radio/src/targets/Horus/usbd_storage_msd.cpp
This commit is contained in:
@@ -881,6 +881,7 @@ void displayGpsCoords(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFl
|
||||
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t value, LcdFlags att)
|
||||
{
|
||||
if (channel >= MAX_SENSORS) return;
|
||||
TelemetryItem & telemetryItem = telemetryItems[channel];
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[channel];
|
||||
if (telemetrySensor.unit == UNIT_DATETIME) {
|
||||
@@ -1096,7 +1097,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
lcd_outdezAtt(x, y, val, (att|PREC1) & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT))
|
||||
lcd_putc(lcdLastPos/*+1*/, y, 'v');
|
||||
lcd_putc(lcdLastPos/*+1*/, y, 'V');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +262,13 @@ void lcdInit();
|
||||
|
||||
void lcdRefresh();
|
||||
|
||||
#if defined(LCD_ST7920)
|
||||
uint8_t lcdRefresh_ST7920(uint8_t full);
|
||||
#define IS_LCD_REFRESH_ALLOWED() (0==lcdstate)
|
||||
#else
|
||||
#define IS_LCD_REFRESH_ALLOWED() (1)
|
||||
#endif
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
#else
|
||||
|
||||
@@ -185,7 +185,11 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
else {
|
||||
#if defined(FRSKY)
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
#if defined(CPUARM)
|
||||
putsChannelValue(CSWONE_2ND_COLUMN, y, v1_val, convertLswTelemValue(cs), attr|LEFT);
|
||||
#else
|
||||
putsTelemetryChannelValue(CSWONE_2ND_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), attr|LEFT);
|
||||
#endif
|
||||
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
if (cs->func == LS_FUNC_DIFFEGREATER)
|
||||
v2_min = -v2_max;
|
||||
@@ -295,7 +299,11 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
uint8_t v1 = cs->v1;
|
||||
putsMixerSource(CSW_2ND_COLUMN, y, v1, 0);
|
||||
if (v1 >= MIXSRC_FIRST_TELEM) {
|
||||
#if defined(CPUARM)
|
||||
putsChannelValue(CSW_3RD_COLUMN, y, v1, convertLswTelemValue(cs), LEFT);
|
||||
#else
|
||||
putsTelemetryChannelValue(CSW_3RD_COLUMN, y, v1 - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2, LEFT);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#define RBOX_CENTERX (3*LCD_W/4 - 10)
|
||||
#define MODELNAME_X (2*FW-2)
|
||||
#define MODELNAME_Y (0)
|
||||
#define PHASE_X (6*FW)
|
||||
#define PHASE_X (6*FW-1)
|
||||
#define PHASE_Y (2*FH)
|
||||
#define PHASE_FLAGS 0
|
||||
#define VBATT_X (6*FW)
|
||||
@@ -206,13 +206,13 @@ void displayBattVoltage()
|
||||
{
|
||||
#if defined(BATTGRAPH)
|
||||
putsVBat(VBATT_X-8, VBATT_Y+1, 0);
|
||||
drawFilledRect(VBATT_X-25, VBATT_Y+9, 22, 5);
|
||||
lcd_vline(VBATT_X-3, VBATT_Y+10, 3);
|
||||
drawFilledRect(VBATT_X-25, VBATT_Y+9, 21, 5);
|
||||
lcd_vline(VBATT_X-4, VBATT_Y+10, 3);
|
||||
uint8_t count = GET_TXBATT_BARS();
|
||||
for (uint8_t i=0; i<count; i+=2)
|
||||
lcd_vline(VBATT_X-24+i, VBATT_Y+10, 3);
|
||||
if (!IS_TXBATT_WARNING() || BLINK_ON_PHASE)
|
||||
drawFilledRect(VBATT_X-26, VBATT_Y, 25, 15);
|
||||
drawFilledRect(VBATT_X-26, VBATT_Y, 24, 15);
|
||||
#else
|
||||
LcdFlags att = (IS_TXBATT_WARNING() ? BLINK|INVERS : 0) | BIGSIZE;
|
||||
putsVBat(VBATT_X-1, VBATT_Y, att|NO_UNIT);
|
||||
|
||||
@@ -779,6 +779,12 @@ void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
|
||||
else if (idx == SWSRC_TELEMETRY_STREAMING) {
|
||||
lcdDrawText(x, y, "Tele", att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_FLIGHT_MODE) {
|
||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
else if (idx == SWSRC_TELEMETRY_STREAMING) {
|
||||
lcdDrawText(x, y, "Tele", att);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextWithLen(x, y, g_model.telemetrySensors[idx-SWSRC_FIRST_SENSOR].label, TELEM_LABEL_LEN, ZCHAR|att);
|
||||
}
|
||||
@@ -958,6 +964,7 @@ void displayGpsCoords(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFl
|
||||
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, int32_t value, LcdFlags att)
|
||||
{
|
||||
if (channel >= MAX_SENSORS) return; //Lua luaLcdDrawChannel() can call us with a bad value
|
||||
TelemetryItem & telemetryItem = telemetryItems[channel];
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[channel];
|
||||
if (telemetrySensor.unit == UNIT_DATETIME) {
|
||||
|
||||
@@ -120,8 +120,10 @@ void menuModelFlightModesAll(uint8_t event)
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_SWITCH:
|
||||
putsSwitches((5+LEN_FLIGHT_MODE_NAME)*FW+FW/2, y, p->swtch, attr);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
if (k>0) {
|
||||
putsSwitches((5+LEN_FLIGHT_MODE_NAME)*FW+FW/2, y, p->swtch, attr);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_TRIM_RUD:
|
||||
|
||||
@@ -645,17 +645,14 @@ void menuModelSetup(uint8_t event)
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[INTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PPM)
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = 0;
|
||||
else
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = MAX_INTERNAL_MODULE_CHANNELS();
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[INTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = MAX_INTERNAL_MODULE_CHANNELS();
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -667,6 +664,7 @@ void menuModelSetup(uint8_t event)
|
||||
if (attr) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[0].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[0].type = MODULE_TYPE_XJT;
|
||||
g_model.moduleData[0].channelsStart = 0;
|
||||
g_model.moduleData[0].channelsCount = 0;
|
||||
}
|
||||
@@ -695,10 +693,8 @@ void menuModelSetup(uint8_t event)
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM)
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
|
||||
else
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = MAX_EXTERNAL_MODULE_CHANNELS();
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
|
||||
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -708,7 +704,7 @@ void menuModelSetup(uint8_t event)
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = MAX_EXTERNAL_MODULE_CHANNELS();
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -785,7 +781,7 @@ void menuModelSetup(uint8_t event)
|
||||
else {
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
coord_t xOffsetBind = MODEL_SETUP_BIND_OFS;
|
||||
if (IS_MODULE_XJT(moduleIdx) && !HAS_RF_PROTOCOL_FAILSAFE(g_model.moduleData[moduleIdx].rfProtocol)) {
|
||||
if (IS_MODULE_XJT(moduleIdx) && g_model.moduleData[moduleIdx].rfProtocol == RF_PROTO_D8) {
|
||||
xOffsetBind = 0;
|
||||
lcd_putsLeft(y, INDENT "Receiver");
|
||||
if (attr) l_posHorz += 1;
|
||||
@@ -871,14 +867,16 @@ void menuModelFailsafe(uint8_t event)
|
||||
static bool longNames = false;
|
||||
bool newLongNames = false;
|
||||
uint8_t ch = 0;
|
||||
uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert+channelStart];
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
s_editMode = 0;
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
else {
|
||||
@@ -888,14 +886,14 @@ void menuModelFailsafe(uint8_t event)
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = channelOutputs[m_posVert];
|
||||
failsafe = 0;
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(NUM_CHNOUT);
|
||||
SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx));
|
||||
|
||||
SET_SCROLLBAR_X(0);
|
||||
|
||||
@@ -904,10 +902,6 @@ void menuModelFailsafe(uint8_t event)
|
||||
// Column separator
|
||||
lcd_vline(LCD_W/2, FH, LCD_H-FH);
|
||||
|
||||
if (m_posVert >= 16) {
|
||||
ch = 16;
|
||||
}
|
||||
|
||||
lcd_putsCenter(0*FH, FAILSAFESET);
|
||||
lcd_invert_line(0);
|
||||
|
||||
@@ -919,77 +913,78 @@ void menuModelFailsafe(uint8_t event)
|
||||
// Channels
|
||||
for (uint8_t line=0; line<8; line++) {
|
||||
coord_t y = 9+line*7;
|
||||
int32_t channelValue = channelOutputs[ch];
|
||||
int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = 0;
|
||||
bool failsafeEditable = false;
|
||||
uint8_t ofs = (col ? 0 : 1);
|
||||
|
||||
if (ch >= g_model.moduleData[g_moduleIdx].channelsStart && ch < NUM_CHANNELS(g_moduleIdx) + g_model.moduleData[g_moduleIdx].channelsStart) {
|
||||
if (ch < NUM_CHANNELS(g_moduleIdx)) {
|
||||
failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
failsafeEditable = true;
|
||||
}
|
||||
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
}
|
||||
if (failsafeEditable) {
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
}
|
||||
|
||||
if (lenLabel > 0)
|
||||
lcdDrawTextWithLen(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
|
||||
else
|
||||
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
|
||||
if (lenLabel > 0)
|
||||
lcdDrawTextWithLen(x+1-ofs, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
|
||||
else
|
||||
putsChn(x+1-ofs, y, ch+1, SMLSIZE);
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (!failsafeEditable || failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (m_posVert == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? SLIDER_W-16 : SLIDER_W-6);
|
||||
uint8_t wbar = (longNames ? SLIDER_W-16 : SLIDER_W-6);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? SLIDER_W-10 : SLIDER_W);
|
||||
uint8_t wbar = (longNames ? SLIDER_W-10 : SLIDER_W);
|
||||
#endif
|
||||
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(x+COL_W-4-wbar-ofs-16, y, "HOLD", flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(x+COL_W-4-wbar-ofs-16, y, "NONE", flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(x+COL_W-4-wbar-ofs-16, y, "HOLD", flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(x+COL_W-4-wbar-ofs-16, y, "NONE", flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(failsafeValue), PREC1|flags);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(failsafeValue), PREC1|flags);
|
||||
#else
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(failsafeValue)/10, flags);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(failsafeValue)/10, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
|
||||
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
|
||||
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
|
||||
coord_t xChannel = (channelValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenChannel;
|
||||
coord_t xFailsafe = (failsafeValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenFailsafe;
|
||||
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
|
||||
lcd_hline(xFailsafe, y+3, lenFailsafe);
|
||||
lcd_hline(xFailsafe, y+4, lenFailsafe);
|
||||
|
||||
}
|
||||
|
||||
// Gauge
|
||||
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
|
||||
unsigned int lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
|
||||
unsigned int lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
|
||||
coord_t xChannel = (channelValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenChannel;
|
||||
coord_t xFailsafe = (failsafeValue>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-lenFailsafe;
|
||||
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
|
||||
lcd_hline(xFailsafe, y+3, lenFailsafe);
|
||||
lcd_hline(xFailsafe, y+4, lenFailsafe);
|
||||
}
|
||||
ch++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,12 +164,8 @@ enum SensorFields {
|
||||
|
||||
bool isSensorUnit(int sensor, uint8_t unit)
|
||||
{
|
||||
if (sensor == 0)
|
||||
return true;
|
||||
|
||||
sensor -= 1;
|
||||
|
||||
return g_model.telemetrySensors[sensor].unit == unit;
|
||||
if (sensor <= 0 || sensor > MAX_SENSORS ) return true;
|
||||
return g_model.telemetrySensors[--sensor].unit == unit;
|
||||
}
|
||||
|
||||
bool isCellsSensor(int sensor)
|
||||
@@ -184,7 +180,7 @@ bool isGPSSensor(int sensor)
|
||||
|
||||
bool isAltSensor(int sensor)
|
||||
{
|
||||
return isSensorUnit(sensor, UNIT_DIST);
|
||||
return isSensorUnit(sensor, UNIT_DIST) || isSensorUnit(sensor, UNIT_FEET);
|
||||
}
|
||||
|
||||
bool isVoltsSensor(int sensor)
|
||||
|
||||
@@ -236,22 +236,26 @@ void displayTopBar()
|
||||
/* Rx voltage */
|
||||
altitude_icon_x = batt_icon_x+7*FW+3;
|
||||
if (g_model.frsky.voltsSource) {
|
||||
TelemetryItem & voltsItem = telemetryItems[g_model.frsky.voltsSource-1];
|
||||
if (voltsItem.isAvailable()) {
|
||||
putsTelemetryChannelValue(batt_icon_x+7*FW+2, BAR_Y+1, g_model.frsky.voltsSource-1, voltsItem.value, LEFT);
|
||||
altitude_icon_x = lcdLastPos+1;
|
||||
uint8_t item = g_model.frsky.voltsSource-1;
|
||||
if (item < MAX_SENSORS) {
|
||||
TelemetryItem & voltsItem = telemetryItems[item];
|
||||
if (voltsItem.isAvailable()) {
|
||||
putsTelemetryChannelValue(batt_icon_x+7*FW+2, BAR_Y+1, item, voltsItem.value, LEFT);
|
||||
altitude_icon_x = lcdLastPos+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Altitude */
|
||||
if (g_model.frsky.altitudeSource) {
|
||||
TelemetryItem & altitudeItem = telemetryItems[g_model.frsky.altitudeSource-1];
|
||||
if (altitudeItem.isAvailable()) {
|
||||
LCD_ICON(altitude_icon_x, BAR_Y, ICON_ALTITUDE);
|
||||
int32_t value = altitudeItem.value;
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[g_model.frsky.altitudeSource-1];
|
||||
if (sensor.prec) value /= sensor.prec == 2 ? 100 : 10;
|
||||
putsValueWithUnit(altitude_icon_x+2*FW-1, BAR_Y+1, value, UNIT_METERS, LEFT);
|
||||
uint8_t item = g_model.frsky.altitudeSource-1;
|
||||
if (item < MAX_SENSORS) {
|
||||
TelemetryItem & altitudeItem = telemetryItems[item];
|
||||
if (altitudeItem.isAvailable()) {
|
||||
LCD_ICON(altitude_icon_x, BAR_Y, ICON_ALTITUDE);
|
||||
int32_t value = altitudeItem.value / g_model.telemetrySensors[item].getPrecDivisor();
|
||||
putsValueWithUnit(altitude_icon_x+2*FW-1, BAR_Y+1, value, g_model.telemetrySensors[item].unit, LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,11 +275,12 @@ void displayTopBar()
|
||||
if (TRAINER_CONNECTED()) {
|
||||
if (SLAVE_MODE()) {
|
||||
LCD_NOTIF_ICON(x, ICON_TRAINEE);
|
||||
x -= 12;
|
||||
}
|
||||
else {
|
||||
else if (IS_TRAINER_INPUT_VALID()) {
|
||||
LCD_NOTIF_ICON(x, ICON_TRAINER);
|
||||
x -= 12;
|
||||
}
|
||||
x -= 12;
|
||||
}
|
||||
|
||||
if (isFunctionActive(FUNCTION_LOGS)) {
|
||||
|
||||
Reference in New Issue
Block a user