Merge branch 'EdgeTX:main' into software-keyboard

This commit is contained in:
Kevin Koenig
2021-08-30 04:46:22 -04:00
committed by GitHub
4 changed files with 49 additions and 23 deletions
+18 -18
View File
@@ -1,23 +1,23 @@
{
"targets": [
["TX16s", "tx16s-"],
["QX7", "x7-"],
["X9D", "x9d-"],
["X9D Plus", "x9dp-"],
["X9D Plus 2019", "x9dp2019-"],
["T-Lite", "tlite-"],
["X-Lite", "xlite-"],
["X-Lite S", "xlites-"],
["X9 Lite", "x9lite-"],
["X9 Lite S", "x9lites-"],
["T16", "t16-"],
["T18", "t18-"],
["TX12", "tx12-"],
["Horus X12s", "x12s-"],
["Horus X10", "x10-"],
["T12", "t12-"],
["T8", "t8-"],
["NV14", "nv14-"]
["Flysky NV14", "nv14-"],
["Frsky Horus X10", "x10-"],
["Frsky Horus X12s", "x12s-"],
["Frsky QX7", "x7-"],
["Frsky X9D", "x9d-"],
["Frsky X9D Plus", "x9dp-"],
["Frsky X9D Plus 2019", "x9dp2019-"],
["Frsky X9 Lite", "x9lite-"],
["Frsky X9 Lite S", "x9lites-"],
["Frsky X-Lite", "xlite-"],
["Frsky X-Lite S", "xlites-"],
["Jumper T8", "t8-"],
["Jumper T12", "t12-"],
["Jumper T16", "t16-"],
["Jumper T18", "t18-"],
["Jumper T-Lite", "tlite-"],
["Radiomaster TX12", "tx12-"],
["Radiomaster TX16s", "tx16s-"]
],
"changelog": "- Major initial bug fixes"
}
+25
View File
@@ -503,3 +503,28 @@ void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFla
x = dc->drawSizedText(x, y, &c, 1, flags);
}
}
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags)
{
coord_t x = left;
coord_t y = top;
coord_t line = getFontHeight(flags & 0xFFFF);
coord_t space = getTextWidth(" ", 1, flags);
coord_t word;
char * eos = str + strlen(str);
char * nxt;
while (str < eos) {
nxt = strstr(str, " ");
if (!nxt) nxt = eos;
word = getTextWidth(str, nxt - str, flags);
if (x + word > left + width && x > left) {
x = left;
y += line;
}
if (y + line > top + height) break;
dc->drawSizedText(x, y, str, nxt - str, flags);
str = nxt + 1;
x += word + space;
}
}
+1
View File
@@ -72,6 +72,7 @@ void drawGPSPosition(BitmapBuffer * dc, coord_t x, coord_t y, int32_t longitude,
void drawDate(BitmapBuffer * dc, coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags flags = 0);
void drawValueWithUnit(BitmapBuffer * dc, coord_t x, coord_t y, int val, uint8_t unit, LcdFlags flags = 0);
void drawHexNumber(BitmapBuffer * dc, coord_t x, coord_t y, uint32_t val, LcdFlags flags = 0);
void drawTextLines(BitmapBuffer * dc, coord_t left, coord_t top, coord_t width, coord_t height, char * str, LcdFlags flags);
inline void drawChn(BitmapBuffer * dc, coord_t x, coord_t y, uint8_t idx, LcdFlags flags)
{
drawSource(dc, x, y, MIXSRC_CH1 + idx - 1, flags);
+5 -5
View File
@@ -442,10 +442,11 @@ void LuaWidget::setErrorMessage(const char * funcName)
{
TRACE("Error in widget %s %s function: %s", factory->getName(), funcName, lua_tostring(lsWidgets, -1));
TRACE("Widget disabled");
size_t needed = snprintf(NULL, 0, "%s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1;
errorMessage = (char *)malloc(needed);
size_t needed = snprintf(NULL, 0, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1)) + 1;
errorMessage = (char *)malloc(needed + 1);
if (errorMessage) {
snprintf(errorMessage, needed, "%s: %s", funcName, lua_tostring(lsWidgets, -1));
snprintf(errorMessage, needed, "ERROR in %s: %s", funcName, lua_tostring(lsWidgets, -1));
errorMessage[needed] = '\0';
}
}
@@ -459,8 +460,7 @@ void LuaWidget::refresh(BitmapBuffer* dc)
if (lsWidgets == 0) return;
if (errorMessage) {
lcdSetColor(RED);
dc->drawText(0, 0, "Disabled", FONT(XS) | CUSTOM_COLOR);
drawTextLines(dc, 0, 0, fullscreen ? LCD_W : rect.w, fullscreen ? LCD_H : rect.h, errorMessage, FONT(XS) | COLOR_THEME_WARNING);
return;
}