Merge with latest 2.3

This commit is contained in:
Bertrand Songis
2020-05-30 11:57:03 +02:00
240 changed files with 16050 additions and 14404 deletions
+65 -45
View File
@@ -84,7 +84,7 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t flightMode, uint8_t idx, LcdFlag
}
}
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att)
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
{
// convertUnit(val, unit);
lcdDrawNumber(x, y, val, att & (~NO_UNIT));
@@ -121,6 +121,40 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
return value;
}
char getNextChar(char c, uint8_t position)
{
if (c == ' ')
return (position == 0 ? 'A' : 'a');
if (c == 'Z' || c == 'z')
return '0';
static const char * specialChars = "9_-., ";
for (uint8_t i = 0; specialChars[i] != 0; i++) {
if (c == specialChars[i])
return specialChars[i + 1];
}
return c + 1;
}
char getPreviousChar(char c, uint8_t position)
{
if (c == 'A' || c == 'a')
return ' ';
if (c == '0')
return (position == 0 ? 'Z' : 'z');
static const char * specialChars = "9_-., ";
for (uint8_t i = 1; specialChars[i] != 0; i++) {
if (c == specialChars[i])
return specialChars[i - 1];
}
return c - 1;
}
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;
@@ -131,23 +165,24 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
mode = FIXEDWIDTH;
}
lcdDrawSizedText(x, y, name, size, attr | mode);
lcdDrawSizedText(x, y, name[0] == '\0' ? "---" : name, size, attr | mode);
coord_t backupNextPos = lcdNextPos;
if (active) {
uint8_t cur = editNameCursorPos;
if (s_editMode > 0) {
int8_t c = name[cur];
int8_t v = c;
if (IS_NEXT_EVENT(event) || IS_PREVIOUS_EVENT(event)) {
if (attr == ZCHAR) {
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
if (c <= 0) v = -v;
}
else {
v = checkIncDec(event, abs(v), '0', 'z', 0);
}
if (c == '\0')
c = ' ';
char v;
if (IS_NEXT_EVENT(event)) {
v = getNextChar(c, cur);
}
else if (IS_PREVIOUS_EVENT(event)) {
v = getPreviousChar(c, cur);
}
else {
v = c;
}
switch (event) {
@@ -164,11 +199,13 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
#if defined(NAVIGATION_XLITE) || defined(NAVIGATION_9X)
case EVT_KEY_BREAK(KEY_LEFT):
if (cur>0) cur--;
if (cur > 0)
cur--;
break;
case EVT_KEY_BREAK(KEY_RIGHT):
if (cur<size-1) cur++;
if (cur < size - 1)
cur++;
break;
#endif
@@ -181,33 +218,21 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
case EVT_KEY_LONG(KEY_ENTER):
#endif
if (attr & ZCHAR) {
#if defined(PCBTARANIS) && !defined(PCBXLITE)
if (v == 0) {
s_editMode = 0;
killEvents(event);
}
#endif
if (v >= -26 && v <= 26) {
v = -v; // toggle case
}
}
else {
#if !defined(NAVIGATION_XLITE)
if (v == ' ') {
s_editMode = 0;
killEvents(event);
break;
}
else
#endif
if (v >= 'A' && v <= 'Z') {
v = 'a' + v - 'A'; // toggle case
}
else if (v >= 'a' && v <= 'z') {
v = 'A' + v - 'a'; // toggle case
}
if (v == ' ') {
s_editMode = 0;
killEvents(event);
break;
}
else
#endif
if (v >= 'A' && v <= 'Z') {
v = 'a' + v - 'A'; // toggle case
}
else if (v >= 'a' && v <= 'z') {
v = 'A' + v - 'a'; // toggle case
}
#if defined(NAVIGATION_9X)
if (event==EVT_KEY_LONG(KEY_LEFT))
killEvents(KEY_LEFT);
@@ -220,12 +245,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
storageDirty(isModelMenuDisplayed() ? EE_MODEL : EE_GENERAL);
}
if (attr == ZCHAR) {
lcdDrawChar(x+editNameCursorPos*FW, y, zchar2char(v), ERASEBG|INVERS|FIXEDWIDTH);
}
else {
lcdDrawChar(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
}
lcdDrawChar(x+editNameCursorPos*FW, y, v, ERASEBG|INVERS|FIXEDWIDTH);
}
else {
cur = 0;
+1 -1
View File
@@ -25,7 +25,7 @@
void lcdDrawMultiProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t protocol, LcdFlags flags = 0);
void lcdDrawMultiSubProtocolString(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t subType, LcdFlags flags = 0);
void drawStringWithIndex(coord_t x, coord_t y, const char * str, uint8_t idx, LcdFlags att=0);
void drawValueWithUnit(coord_t x, coord_t y, int val, uint8_t unit, LcdFlags att=0);
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att=0);
void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att = 0);
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
+3 -3
View File
@@ -61,7 +61,7 @@ void menuModelCurvesAll(event_t event)
#endif
case EVT_KEY_FIRST(KEY_ENTER):
if (CURVE_SELECTED() && !READ_ONLY()) {
s_curveChan = sub;
s_currIdxSubMenu = sub;
pushMenu(menuModelCurveOne);
}
break;
@@ -94,7 +94,7 @@ void menuModelCurvesAll(event_t event)
}
if (CURVE_SELECTED()) {
s_curveChan = sub;
s_currIdxSubMenu = sub;
#if LCD_W >= 212
drawCurve(23);
#else
@@ -143,7 +143,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
drawCurveName(x, y, curve.value, flags);
if (active && menuHorizontalPosition==1) {
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
s_currIdxSubMenu = (curve.value<0 ? -curve.value-1 : curve.value-1);
pushMenu(menuModelCurveOne);
}
else {
+1 -1
View File
@@ -227,7 +227,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
lcdRefresh();
lcdSetContrast();
waitKeysReleased();
backlightOn();
resetBacklightTimeout();
checkBacklight();
}
+1 -1
View File
@@ -107,7 +107,7 @@ enum
{
warningText = message;
warningInfoText = info;
warningInfoLength = strlen(info);
warningInfoLength = info ? strlen(info) : 0;
warningInfoFlags = 0;
warningType = WARNING_TYPE_ASTERISK;
popupFunc = runPopupWarning;
@@ -624,22 +624,23 @@ void menuRadioHardware(event_t event)
break;
case ITEM_RADIO_HARDWARE_RAS:
#if defined(PCBX9LITE) && !defined(PCBX9LITES)
lcdDrawTextAlignedLeft(y, "Ext. RAS");
lcdNextPos = HW_SETTINGS_COLUMN2;
#else
#if defined(HARDWARE_INTERNAL_RAS)
lcdDrawTextAlignedLeft(y, "RAS");
if (telemetryData.swrInternal.isFresh())
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, telemetryData.swrInternal.value());
else
lcdDrawText(HW_SETTINGS_COLUMN2, y, "---");
lcdDrawText(lcdNextPos, y, "/");
#else
lcdDrawTextAlignedLeft(y, "Ext. RAS");
lcdNextPos = HW_SETTINGS_COLUMN2;
#endif
if (telemetryData.swrExternal.isFresh())
lcdDrawNumber(lcdNextPos, y, telemetryData.swrExternal.value());
else
lcdDrawText(lcdNextPos, y, "---");
break;
#if defined(SPORT_UPDATE_PWR_GPIO)
case ITEM_RADIO_HARDWARE_SPORT_UPDATE_POWER:
g_eeGeneral.sportUpdatePower = editChoice(HW_SETTINGS_COLUMN2, y, STR_SPORT_UPDATE_POWER_MODE, STR_SPORT_UPDATE_POWER_MODES, g_eeGeneral.sportUpdatePower, 0, 1, attr, event);
@@ -291,12 +291,14 @@ void menuRadioSdManager(event_t _event)
int lastPos = menuVerticalPosition;
#endif
if (moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode == MODULE_MODE_BIND && EVT_KEY_MASK(_event) == KEY_EXIT) {
#if defined(PXX2)
if (EVT_KEY_MASK(_event) == KEY_EXIT && moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode == MODULE_MODE_BIND) {
moduleState[reusableBuffer.sdManager.otaUpdateInformation.module].mode = MODULE_MODE_NORMAL;
CLEAR_POPUP();
killEvents(KEY_EXIT);
_event = 0;
}
#endif
event_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, MENU_RADIO_SD_MANAGER, HEADER_LINE + reusableBuffer.sdManager.count);
@@ -304,13 +306,13 @@ void menuRadioSdManager(event_t _event)
switch (_event) {
case EVT_ENTRY:
f_chdir(ROOT_PATH);
REFRESH_FILES();
#if LCD_DEPTH > 1
lastPos = -1;
#endif
break;
// no break
case EVT_ENTRY_UP:
memclear(&reusableBuffer.sdManager, sizeof(reusableBuffer.sdManager));
REFRESH_FILES();
break;
@@ -579,7 +581,7 @@ void menuRadioSdManager(event_t _event)
if (reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount > 0) {
if (reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount != popupMenuItemsCount) {
CLEAR_POPUP();
popupMenuItemsCount = min<uint8_t>(reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount,PXX2_MAX_RECEIVERS_PER_MODULE);
popupMenuItemsCount = min<uint8_t>(reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
for (auto rx = 0; rx < popupMenuItemsCount; rx++) {
popupMenuItems[rx] = reusableBuffer.sdManager.otaUpdateInformation.candidateReceiversNames[rx];
}
@@ -92,7 +92,7 @@ void menuViewTelemetry(event_t event)
}
drawTelemetryTopBar();
lcdDrawText(LCD_W / 2, 3 * FH, "No Telemetry Screens", CENTERED);
lcdDrawText(LCD_W / 2, 3 * FH, STR_NO_TELEMETRY_SCREENS, CENTERED);
displayRssiLine();
}