Merge against latest 2.3

This commit is contained in:
Bertrand Songis
2019-09-17 13:28:42 +02:00
247 changed files with 35085 additions and 42445 deletions
+4
View File
@@ -64,6 +64,10 @@ const uint8_t LBM_TOPMENU_TXBATT[] = {
#include "mask_txbat.lbm"
};
const uint8_t LBM_TOPMENU_ANTENNA[] = {
#include "mask_antenna.lbm"
};
const uint8_t LBM_HTRIM_FRAME[] = {
#include "mask_htrim_frame.lbm"
};
+1
View File
@@ -26,6 +26,7 @@ extern const uint8_t LBM_DOT[];
// Main view icons
extern const uint8_t LBM_TOPMENU_USB[];
extern const uint8_t LBM_TOPMENU_ANTENNA[];
extern const uint8_t LBM_TOPMENU_VOLUME_0[];
extern const uint8_t LBM_TOPMENU_VOLUME_1[];
extern const uint8_t LBM_TOPMENU_VOLUME_2[];
-3
View File
@@ -342,9 +342,6 @@ extern uint8_t popupMenuOffsetType;
extern uint8_t popupMenuSelectedItem;
const char * runPopupMenu(event_t event);
extern void (*popupMenuHandler)(const char * result);
#define TEXT_FILENAME_MAXLEN 40
extern char s_text_file[TEXT_FILENAME_MAXLEN];
void pushMenuTextView(const char * filename);
void pushModelNotes();
void readModelNotes();
+4 -6
View File
@@ -133,15 +133,13 @@ void ModelFlightModesPage::build(FormWindow * window)
// Flight mode fade in / out
new StaticText(group, grid.getLabelSlot(true), "Fade in/out");
auto edit = new NumberEdit(group, grid.getFieldSlot(2, 0), 0, DELAY_MAX,
GET_DEFAULT(g_model.flightModeData[i].fadeIn * (10 / DELAY_STEP)),
SET_VALUE(g_model.flightModeData[i].fadeIn, newValue / (10 / DELAY_STEP)),
GET_DEFAULT(g_model.flightModeData[i].fadeIn),
SET_VALUE(g_model.flightModeData[i].fadeIn, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
edit = new NumberEdit(group, grid.getFieldSlot(2, 1), 0, DELAY_MAX,
GET_DEFAULT(g_model.flightModeData[i].fadeOut * (10 / DELAY_STEP)),
SET_VALUE(g_model.flightModeData[i].fadeOut, newValue / (10 / DELAY_STEP)),
GET_DEFAULT(g_model.flightModeData[i].fadeOut),
SET_VALUE(g_model.flightModeData[i].fadeOut, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
grid.nextLine();
group->setLastField(FormField::getCurrentField());
+3 -2
View File
@@ -158,14 +158,15 @@ bool menuModelGVars(event_t event)
gvar_t v = fm->gvars[i];
LcdFlags attr = RIGHT | ((sub == i && menuHorizontalPosition == j) ? (s_editMode > 0 ? BLINK | INVERS : INVERS) : 0);
if (j == curfm)
attr |= BOLD;
coord_t x = GVARS_FM_COLUMN(j);
coord_t yval = y;
if (v <= GVAR_MAX && (g_model.gvars[i].prec > 0 || abs(v) >= 1000 || ( abs(v) >= 100 && g_model.gvars[i].unit > 0))) {
attr |= SMLSIZE;
yval += 3;
}
else if (j == curfm) {
attr |= BOLD;
}
if (v <= GVAR_MAX && g_model.gvars[i].unit > 0) {
x -= 9;
lcdDrawText(GVARS_FM_COLUMN(j) - 9, y+5, "%", TINSIZE);
-4
View File
@@ -190,7 +190,6 @@ class MixEditWindow : public Page {
GET_DEFAULT(mix->delayUp),
SET_VALUE(mix->delayUp, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
edit->setSuffix("s");
grid.nextLine();
@@ -200,7 +199,6 @@ class MixEditWindow : public Page {
GET_DEFAULT(mix->delayDown),
SET_VALUE(mix->delayDown, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
edit->setSuffix("s");
grid.nextLine();
@@ -210,7 +208,6 @@ class MixEditWindow : public Page {
GET_DEFAULT(mix->speedUp),
SET_VALUE(mix->speedUp, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
edit->setSuffix("s");
grid.nextLine();
@@ -220,7 +217,6 @@ class MixEditWindow : public Page {
GET_DEFAULT(mix->speedDown),
SET_VALUE(mix->speedDown, newValue),
PREC1);
edit->setStep(10 / DELAY_STEP);
edit->setSuffix("s");
grid.nextLine();
+23 -22
View File
@@ -219,6 +219,27 @@ bool menuModelWizard(event_t event)
}
#endif
void onDeleteModelConfirm(const char * result)
{
if (result == STR_OK) {
if (deleteMode == MODE_DELETE_CATEGORY) {
modelslist.removeCategory(currentCategory);
modelslist.save();
setCurrentCategory(currentCategoryIndex > 0 ? currentCategoryIndex-1 : currentCategoryIndex);
}
else if (deleteMode == MODE_DELETE_MODEL){
int modelIndex = MODEL_INDEX();
modelslist.removeModel(currentCategory, currentModel);
s_copyMode = 0;
putEvent(EVT_REFRESH);
if (modelIndex > 0) {
modelIndex--;
}
setCurrentModel(modelIndex);
}
}
}
void onModelSelectMenu(const char * result)
{
if (result == STR_SELECT_MODEL) {
@@ -233,7 +254,7 @@ void onModelSelectMenu(const char * result)
chainMenu(menuMainView);
}
else if (result == STR_DELETE_MODEL) {
POPUP_CONFIRMATION(STR_DELETEMODEL);
POPUP_CONFIRMATION(STR_DELETEMODEL, onDeleteModelConfirm);
SET_WARNING_INFO(currentModel->modelName, LEN_MODEL_NAME, 0);
deleteMode = MODE_DELETE_MODEL;
}
@@ -279,7 +300,7 @@ void onModelSelectMenu(const char * result)
SET_WARNING_INFO(STR_CAT_NOT_EMPTY, sizeof(TR_CAT_NOT_EMPTY), 0);
}
else {
POPUP_CONFIRMATION(STR_DELETEMODEL);
POPUP_CONFIRMATION(STR_DELETEMODEL, onDeleteModelConfirm);
SET_WARNING_INFO(currentCategory->name, LEN_MODEL_FILENAME, 0);
deleteMode = MODE_DELETE_CATEGORY;
}
@@ -322,26 +343,6 @@ void initModelsList()
bool menuModelSelect(event_t event)
{
if (warningResult) {
warningResult = 0;
if (deleteMode == MODE_DELETE_CATEGORY) {
TRACE("DELETE CATEGORY");
modelslist.removeCategory(currentCategory);
modelslist.save();
setCurrentCategory(currentCategoryIndex > 0 ? currentCategoryIndex-1 : currentCategoryIndex);
}
else if (deleteMode == MODE_DELETE_MODEL){
int modelIndex = MODEL_INDEX();
modelslist.removeModel(currentCategory, currentModel);
s_copyMode = 0;
event = EVT_REFRESH;
if (modelIndex > 0) {
modelIndex--;
}
setCurrentModel(modelIndex);
}
}
const std::list<ModelsCategory*>& cats = modelslist.getCategories();
switch(event) {
case 0:
+8 -8
View File
@@ -831,20 +831,20 @@ void onBindMenu(const char * result)
uint8_t moduleIdx = 0; // TODO (menuVerticalPosition >= ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE);
if (result == STR_BINDING_1_8_TELEM_ON) {
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = false;
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = false;
g_model.moduleData[moduleIdx].pxx.receiverTelemetryOff = false;
g_model.moduleData[moduleIdx].pxx.receiverHigherChannels = false;
}
else if (result == STR_BINDING_1_8_TELEM_OFF) {
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = true;
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = false;
g_model.moduleData[moduleIdx].pxx.receiverTelemetryOff = true;
g_model.moduleData[moduleIdx].pxx.receiverHigherChannels = false;
}
else if (result == STR_BINDING_9_16_TELEM_ON) {
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = false;
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = true;
g_model.moduleData[moduleIdx].pxx.receiverTelemetryOff = false;
g_model.moduleData[moduleIdx].pxx.receiverHigherChannels = true;
}
else if (result == STR_BINDING_9_16_TELEM_OFF) {
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = true;
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = true;
g_model.moduleData[moduleIdx].pxx.receiverTelemetryOff = true;
g_model.moduleData[moduleIdx].pxx.receiverHigherChannels = true;
}
else {
return;
+1 -1
View File
@@ -118,7 +118,7 @@ void RadioToolsPage::checkEvents()
void RadioToolsPage::rebuild(FormWindow * window)
{
FormGridLayout grid;
grid.spacer(8);
grid.spacer(PAGE_PADDING);
grid.setLabelWidth(100);
window->clear();
+1 -1
View File
@@ -36,8 +36,8 @@ void RadioTrainerPage::build(FormWindow * window)
#define TRAINER_LABEL_WIDTH 100
#endif
FormGridLayout grid;
grid.spacer(PAGE_PADDING);
grid.setLabelWidth(TRAINER_LABEL_WIDTH);
grid.nextLine();
for (uint8_t i=0; i<NUM_STICKS; i++) {
uint8_t chan = channelOrder(i+1);
+1 -1
View File
@@ -96,7 +96,7 @@ class FrskyTheme: public Theme
void loadIcons() const
{
#if defined(LOG_TELEMETRY) || defined(WATCHDOG_DISABLED)
#if defined(LOG_TELEMETRY) || !defined(WATCHDOG)
loadMenuIcon(ICON_OPENTX, "mask_opentx_testmode.png", TEXT_COLOR);
#else
loadMenuIcon(ICON_OPENTX, "mask_opentx.png");
+6
View File
@@ -55,6 +55,12 @@ void drawTopBar()
lcdDrawSolidFilledRect(LCD_W-90 + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
}
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
lcdDrawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, MENU_TITLE_COLOR);
}
#endif
/* Audio volume */
lcdDrawBitmapPattern(LCD_W-130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR);
if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet)
@@ -98,7 +98,6 @@ bool menuStatsDebug(event_t event)
switch(event) {
case EVT_ENTRY:
case EVT_ENTRY_UP:
enableVBatBridge();
break;
case EVT_KEY_FIRST(KEY_ENTER):
+8 -81
View File
@@ -20,91 +20,17 @@
#include "opentx.h"
#define TEXT_FILE_MAXSIZE 2048
char s_text_file[TEXT_FILENAME_MAXLEN];
char s_text_screen[NUM_BODY_LINES][LCD_COLS+1];
void readTextFile(int & lines_count)
{
FIL file;
int result;
char c;
unsigned int sz;
int line_length = 0;
int escape = 0;
char escape_chars[2];
int current_line = 0;
memset(s_text_screen, 0, sizeof(s_text_screen));
result = f_open(&file, s_text_file, FA_OPEN_EXISTING | FA_READ);
if (result == FR_OK) {
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-menuVerticalOffset<NUM_BODY_LINES); i++) {
if (c == '\n') {
++current_line;
line_length = 0;
escape = 0;
}
else if (c!='\r' && current_line>=menuVerticalOffset && current_line-menuVerticalOffset<NUM_BODY_LINES && line_length<LCD_COLS) {
if (c=='\\' && escape==0) {
escape = 1;
continue;
}
else if (c!='\\' && escape>0 && escape<4) {
escape_chars[escape-1] = c;
if (escape == 2 && !strncmp(escape_chars, "up", 2)) {
c = '\300';
escape = 0;
}
else if (escape == 2 && !strncmp(escape_chars, "dn", 2)) {
c = '\301';
escape = 0;
}
else if (escape == 3) {
int val = atoi(escape_chars);
if (val >= 200 && val < 225) {
c = '\200' + val-200;
}
escape = 0;
}
else {
escape++;
continue;
}
}
else if (c=='~') {
c = 'z'+1;
}
else if (c=='\t') {
c = 0x1D; //tab
}
escape = 0;
s_text_screen[current_line-menuVerticalOffset][line_length++] = c;
}
}
if (c != '\n') {
current_line += 1;
}
f_close(&file);
}
if (lines_count == 0) {
lines_count = current_line;
}
}
bool menuTextView(event_t event)
{
static int lines_count;
drawMenuTemplate(STR_TEXT_VIEWER, ICON_OPENTX);
drawMenuTemplate(STR_TEXT_VIEWER, ICON_OPENTX, nullptr, OPTION_MENU_NO_SCROLLBAR);
switch (event) {
case EVT_ENTRY:
menuVerticalOffset = 0;
lines_count = 0;
readTextFile(lines_count);
sdReadTextFile(reusableBuffer.viewText.filename, reusableBuffer.viewText.lines, lines_count);
break;
case EVT_ROTARY_LEFT:
@@ -112,24 +38,25 @@ bool menuTextView(event_t event)
break;
else
menuVerticalOffset--;
readTextFile(lines_count);
sdReadTextFile(reusableBuffer.viewText.filename, reusableBuffer.viewText.lines, lines_count);
break;
case EVT_ROTARY_RIGHT:
if (menuVerticalOffset+NUM_BODY_LINES >= lines_count)
if (menuVerticalOffset + NUM_BODY_LINES >= lines_count)
break;
else
++menuVerticalOffset;
readTextFile(lines_count);
sdReadTextFile(reusableBuffer.viewText.filename, reusableBuffer.viewText.lines, lines_count);
break;
case EVT_KEY_FIRST(KEY_EXIT):
menuVerticalOffset = 0;
popMenu();
break;
}
for (int i=0; i<NUM_BODY_LINES; i++) {
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, reusableBuffer.viewText.lines[i]);
}
#if 0
@@ -148,7 +75,7 @@ bool menuTextView(event_t event)
void pushMenuTextView(const char *filename)
{
if (strlen(filename) < TEXT_FILENAME_MAXLEN) {
strcpy(s_text_file, filename);
strcpy(reusableBuffer.viewText.filename, filename);
pushMenu(menuTextView);
}
}
+3 -2
View File
@@ -22,6 +22,7 @@
#define _WIDGET_H_
#include <list>
#include <string.h>
#include "zone.h"
#define MAX_WIDGET_OPTIONS 5
@@ -58,7 +59,7 @@ class Widget
virtual const char * getErrorMessage() const
{
return NULL;
return nullptr;
}
inline ZoneOptionValue * getOptionValue(unsigned int index) const
@@ -83,7 +84,7 @@ void registerWidget(const WidgetFactory * factory);
class WidgetFactory
{
public:
WidgetFactory(const char * name, const ZoneOption * options=NULL):
WidgetFactory(const char * name, const ZoneOption * options=nullptr):
name(name),
options(options)
{