[all] Bug introduced in last revision in TELEMETRY screen!

[sky9x] About screen
[all] Expos/DRs screen cosmetics
[all] CSW Timer better range (0.1, 0.5 and 1.0 precision)
This commit is contained in:
bsongis@gmail.com
2013-06-05 21:11:28 +00:00
parent 784bab30b1
commit c84501fbd1
19 changed files with 259 additions and 232 deletions
+43 -51
View File
@@ -114,7 +114,7 @@ void selectModel(uint8_t sub)
saveTimers();
eeCheck(true); // force writing of current model data before this is changed
g_eeGeneral.currModel = sub;
STORE_GENERALVARS;
eeDirty(EE_GENERAL);
eeLoadModel(sub);
}
@@ -453,7 +453,7 @@ void menuModelSelect(uint8_t event)
if (s_copySrcRow != g_eeGeneral.currModel) {
g_eeGeneral.currModel = s_copySrcRow;
STORE_GENERALVARS;
eeDirty(EE_GENERAL);
}
s_copyMode = 0;
@@ -807,7 +807,7 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
if (c != v) {
name[cur] = v;
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), INVERS);
}
@@ -1120,7 +1120,7 @@ void menuModelSetup(uint8_t event)
case EVT_KEY_BREAK(KEY_RIGHT):
#endif
g_model.switchWarningStates ^= 0x01;
STORE_MODELVARS;
eeDirty(EE_MODEL);
break;
}
}
@@ -1159,7 +1159,7 @@ void menuModelSetup(uint8_t event)
if((event==EVT_KEY_BREAK(KEY_ENTER)) || p1valdiff) {
s_editMode = 0;
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
}
break;
@@ -1624,7 +1624,7 @@ FlightModesType editFlightModes(uint8_t x, uint8_t y, uint8_t event, FlightModes
if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) {
s_editMode = 0;
value ^= (1<<posHorz);
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
}
@@ -2504,7 +2504,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
}
resumeMixerCalculations();
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
static int8_t s_currCh;
@@ -2528,7 +2528,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
mix->weight = 100;
}
resumeMixerCalculations();
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
void copyExpoMix(uint8_t expo, uint8_t idx)
@@ -2543,7 +2543,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
}
resumeMixerCalculations();
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
void memswap(void *a, void *b, uint8_t size)
@@ -2948,23 +2948,21 @@ static uint8_t s_copySrcCh;
#define STR_MAX(x) _STR_MAX(x)
#if LCD_W >= 212
#define EXPO_LINE_WEIGHT_POS 7*FW
#define EXPO_LINE_EXPO_POS 12*FW
#define EXPO_LINE_SWITCH_POS 13*FW+4
#define EXPO_LINE_SIDE_POS 19*FW
#define EXPO_LINE_SELECT_POS 18
#elif defined(TRANSLATIONS_CZ)
#define EXPO_LINE_WEIGHT_POS 7*FW-2
#define EXPO_LINE_EXPO_POS 10*FW+2
#define EXPO_LINE_SWITCH_POS 13*FW+5
#define EXPO_LINE_SIDE_POS 17*FW
#define EXPO_LINE_SELECT_POS 24
#define EXPO_LINE_WEIGHT_POS 7*FW
#define EXPO_LINE_EXPO_POS 12*FW
#define EXPO_LINE_SWITCH_POS 13*FW+4
#define EXPO_LINE_SIDE_POS 19*FW
#define EXPO_LINE_SELECT_POS 18
#else
#define EXPO_LINE_WEIGHT_POS 6*FW-2
#define EXPO_LINE_EXPO_POS 9*FW+1
#define EXPO_LINE_SWITCH_POS 13*FW+4
#define EXPO_LINE_SIDE_POS 17*FW
#define EXPO_LINE_SELECT_POS 18
#define EXPO_LINE_WEIGHT_POS 7*FW-1
#define EXPO_LINE_EXPO_POS 10*FW+5
#define EXPO_LINE_SWITCH_POS 11*FW+2
#if MAX_PHASES == 6
#define EXPO_LINE_SIDE_POS 14*FW+2
#else
#define EXPO_LINE_SIDE_POS 14*FW+5
#endif
#define EXPO_LINE_SELECT_POS 24
#endif
#if defined(NAVIGATION_MENUS)
@@ -3049,7 +3047,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
swapExpoMix(expo, s_currIdx, s_copyTgtOfs > 0);
s_copyTgtOfs += (s_copyTgtOfs < 0 ? +1 : -1);
} while (s_copyTgtOfs != 0);
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
m_posVert = s_copySrcRow;
s_copyTgtOfs = 0;
@@ -3147,7 +3145,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
else {
// only swap the mix with its neighbor
if (!swapExpoMix(expo, s_currIdx, IS_ROTARY_UP(event) || key==KEY_MOVE_UP)) break;
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
s_copyTgtOfs = next_ofs;
@@ -3201,22 +3199,14 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
else
displayGVar(EXPO_LINE_EXPO_POS, y, ed->curveParam, -100, 100);
#if defined(PCBTARANIS)
putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0); // normal switches
if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0);
if (ed->mode!=3) lcd_putc(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? 126 : 127);
#else
#if defined(CPUARM)
if (ed->name[0]) {
putsSwitches(11*FW, y, ed->swtch, 0);
lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
}
else
#endif
{
putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0); // normal switches
if (ed->mode!=3) lcd_putc(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? 126 : 127);//'|' : (stkVal[i] ? '<' : '>'),0);*/
}
if (ed->name[0]) lcd_putsnAtt(LCD_W-sizeof(ed->name)*FW-MENUS_SCROLLBAR_WIDTH, y, ed->name, sizeof(ed->name), ZCHAR | (isExpoActive(i) ? BOLD : 0));
#else
editFlightModes(LCD_W-MAX_PHASES*FW-MENUS_SCROLLBAR_WIDTH, y, 0, ed->phases, 0);
#endif
}
else {
@@ -3419,7 +3409,7 @@ void menuModelLimits(uint8_t event)
LimitData *ld = limitAddress(sub);
ld->revert = !ld->revert;
s_warning_result = 0;
AUDIO_WARNING2();
eeDirty(EE_MODEL);
}
for (uint8_t i=0; i<LCD_LINES-1; i++) {
@@ -3499,7 +3489,7 @@ void menuModelLimits(uint8_t event)
ld->offset = (ld->revert) ? -zero : zero;
resumeMixerCalculations();
s_editMode = 0;
STORE_MODELVARS;
eeDirty(EE_MODEL);
}
break;
case ITEM_LIMITS_MIN:
@@ -3920,7 +3910,7 @@ void menuModelCustomSwitches(uint8_t event)
#else
uint8_t incdecFlag;
#define INCDEC_SET_FLAG(f) incdecFlag = (EE_MODEL|(f))
#define CHECK_INCDEC_CSPARAM(event, var, min, max) var=checkIncDec(event,var,min,max,incdecFlag)
#define CHECK_INCDEC_CSPARAM(event, var, min, max) var = checkIncDec(event, var, min, max, incdecFlag)
#endif
MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|CSW_FIELD_LAST/*repeated...*/});
@@ -3968,9 +3958,10 @@ void menuModelCustomSwitches(uint8_t event)
INCDEC_SET_FLAG(INCDEC_SOURCE);
}
else if (cstate == CS_VTIMER) {
lcd_outdezAtt(CSW_2ND_COLUMN, y, cs->v1+1, LEFT|attr1);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cs->v2+1, LEFT|attr2);
v1_max = 99; v2_max = 99;
lcd_outdezAtt(CSW_2ND_COLUMN, y, cswTimerValue(cs->v1), LEFT|PREC1|attr1);
lcd_outdezAtt(CSW_3RD_COLUMN, y, cswTimerValue(cs->v2), LEFT|PREC1|attr2);
v1_min = v2_min = -128;
v1_max = v2_max = 122;
INCDEC_SET_FLAG(0);
}
else {
@@ -4032,12 +4023,13 @@ void menuModelCustomSwitches(uint8_t event)
if ((s_editMode>0 || p1valdiff) && attr) {
switch (horz) {
case CSW_FIELD_FUNCTION:
{
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, CS_MAXF);
if (cstate != cswFamily(cs->func)) {
cs->v1 = 0;
cs->v2 = 0;
}
uint8_t new_cstate = cswFamily(cs->func);
if (cstate != new_cstate)
cs->v1 = cs->v2 = (new_cstate==CS_VTIMER ? -119/*1.0*/ : 0);
break;
}
case CSW_FIELD_V1:
CHECK_INCDEC_CSPARAM(event, cs->v1, v1_min, v1_max);
break;
+3 -11
View File
@@ -889,26 +889,20 @@ int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t m
bool invers = (attr & INVERS);
if (invers && event == EVT_KEY_LONG(KEY_ENTER)) {
s_editMode = !s_editMode;
value = (GV_IS_GV_VALUE(value,min,max) ? GET_GVAR(value, min, max, s_perout_flight_phase) : delta);
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, s_perout_flight_phase) : delta);
eeDirty(EE_MODEL);
}
if (GV_IS_GV_VALUE(value,min,max) ) {
if (GV_IS_GV_VALUE(value, min, max)) {
if (attr & LEFT)
attr -= LEFT; /* because of ZCHAR */
else
x -= 2*FW+FWNUM;
int8_t idx = (int16_t) GV_INDEX_CALC_DELTA(value,delta);
int8_t idx = (int16_t) GV_INDEX_CALC_DELTA(value, delta);
if (invers) {
CHECK_INCDEC_MODELVAR(event, idx, -MAX_GVARS, MAX_GVARS-1);
}
/* sometimes this implementation was smaller, but sometimes not....
value=delta+(int16_t) idx;
if (idx < 0) {idx = -1-idx; lcd_putcAtt(x-6, y, '-', attr); }
else value|=~(delta-1);
idx++; */
if (idx < 0) {
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx,delta);
idx = -idx;
@@ -918,7 +912,6 @@ int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t m
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx,delta);
idx++;
}
putsStrIdx(x, y, STR_GV, idx, attr);
}
else {
@@ -927,7 +920,6 @@ int16_t gvarMenuItem(uint8_t x, uint8_t y, int16_t value, int16_t min, int16_t m
}
return value;
}
#else
int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t event)
{
+57 -39
View File
@@ -38,7 +38,11 @@
#if defined(PCBTARANIS)
const pm_uchar about_bmp[] PROGMEM = {
#include "../bitmaps/about.lbm"
#include "../bitmaps/about_taranis.lbm"
};
#else
const pm_uchar about_bmp[] PROGMEM = {
#include "../bitmaps/about_9x.lbm"
};
#endif
@@ -56,10 +60,18 @@ enum AboutScreens {
ABOUT_COUNT,
};
#if defined(PCBTARANIS)
#define ABOUT_X 62
#define ABOUT_INDENT 6
#else
#define ABOUT_X 2
#define ABOUT_INDENT 4
#endif
void menuAboutView(uint8_t event)
{
static int screenIndex;
static int greyIndex;
static uint8_t screenIndex;
static uint8_t greyIndex;
switch(event)
{
@@ -80,73 +92,79 @@ void menuAboutView(uint8_t event)
return;
}
#if defined(PCBTARANIS)
lcd_bmp(0, 0, about_bmp);
lcd_putsAtt(64, 0, STR_ABOUTUS, DBLSIZE);
lcd_hline(62, 18, 120);
lcd_hline(62, 19, 130, GREY_DEFAULT);
lcd_hline(ABOUT_X, 18, 120);
lcd_hline(ABOUT_X, 19, 130, GREY_DEFAULT);
LcdFlags att = GREY(max(0, 15-greyIndex/2));
int screenDuration = 150;
#else
lcd_putsAtt(17, 0, STR_ABOUTUS, DBLSIZE|INVERS);
lcd_hline(17, 16, LCD_W-17);
lcd_img(8, 0, about_bmp, 0);
LcdFlags att = 0;
#endif
uint8_t screenDuration = 150;
switch (screenIndex) {
case ABOUT_OPENTX:
case ABOUT_END:
lcd_putsAtt(62, 22, STR_ABOUT_OPENTX_1, SMLSIZE);
lcd_putsAtt(62, 30, STR_ABOUT_OPENTX_2, SMLSIZE);
lcd_putsAtt(62, 38, STR_ABOUT_OPENTX_3, SMLSIZE);
lcd_putsAtt(62, 46, STR_ABOUT_OPENTX_4, SMLSIZE);
lcd_putsAtt(62, 54, STR_ABOUT_OPENTX_5, SMLSIZE);
screenDuration = 300;
lcd_putsAtt(ABOUT_X, 22, STR_ABOUT_OPENTX_1, SMLSIZE);
lcd_putsAtt(ABOUT_X, 30, STR_ABOUT_OPENTX_2, SMLSIZE);
lcd_putsAtt(ABOUT_X, 38, STR_ABOUT_OPENTX_3, SMLSIZE);
lcd_putsAtt(ABOUT_X, 46, STR_ABOUT_OPENTX_4, SMLSIZE);
lcd_putsAtt(ABOUT_X, 54, STR_ABOUT_OPENTX_5, SMLSIZE);
screenDuration = 255;
break;
case ABOUT_BERTRAND:
lcd_putsAtt(62, 24, STR_ABOUT_BERTRAND_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_BERTRAND_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_BERTRAND_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_BERTRAND_3, att|SMLSIZE);
break;
case ABOUT_MIKE:
lcd_putsAtt(62, 24, STR_ABOUT_MIKE_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_MIKE_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_MIKE_3, att|SMLSIZE);
lcd_putsAtt(67, 52, STR_ABOUT_MIKE_4, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_MIKE_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MIKE_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_MIKE_3, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT-1, 52, STR_ABOUT_MIKE_4, att|SMLSIZE);
break;
case ABOUT_ROMOLO:
lcd_putsAtt(62, 24, STR_ABOUT_ROMOLO_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ROMOLO_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROMOLO_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ROMOLO_3, att|SMLSIZE);
break;
case ABOUT_ANDRE:
lcd_putsAtt(62, 24, STR_ABOUT_ANDRE_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ANDRE_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ANDRE_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_ANDRE_3, att|SMLSIZE);
break;
case ABOUT_ROB:
lcd_putsAtt(62, 24, STR_ABOUT_ROB_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_ROB_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_ROB_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_ROB_2, att|SMLSIZE);
break;
case ABOUT_MARTIN:
lcd_putsAtt(62, 24, STR_ABOUT_MARTIN_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_MARTIN_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_MARTIN_2, att|SMLSIZE);
break;
case ABOUT_HARDWARE:
lcd_putsAtt(62, 24, STR_ABOUT_HARDWARE_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE);
screenDuration = 300;
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_HARDWARE_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_HARDWARE_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_HARDWARE_3, att|SMLSIZE);
break;
case ABOUT_PARENTS:
lcd_putsAtt(62, 24, STR_ABOUT_PARENTS_1, att);
lcd_putsAtt(68, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE);
lcd_putsAtt(68, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE);
lcd_putsAtt(67, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE);
screenDuration = 300;
lcd_putsAtt(ABOUT_X, 24, STR_ABOUT_PARENTS_1, att);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 36, STR_ABOUT_PARENTS_2, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT, 44, STR_ABOUT_PARENTS_3, att|SMLSIZE);
lcd_putsAtt(ABOUT_X+ABOUT_INDENT-1, 52, STR_ABOUT_PARENTS_4, att|SMLSIZE);
screenDuration = 255;
break;
}
+2 -2
View File
@@ -444,7 +444,7 @@ void onMainViewMenu(const char *result)
else if (result == STR_STATISTICS) {
chainMenu(menuStatisticsView);
}
#if defined(PCBTARANIS)
#if !defined(CPUM64)
else if (result == STR_ABOUT_US) {
chainMenu(menuAboutView);
}
@@ -511,7 +511,7 @@ void menuMainView(uint8_t event)
MENU_ADD_ITEM(STR_RESET_TELEMETRY);
#endif
MENU_ADD_ITEM(STR_STATISTICS);
#if defined(PCBTARANIS)
#if !defined(CPUM64)
MENU_ADD_ITEM(STR_ABOUT_US);
#endif
menuHandler = onMainViewMenu;
+5 -3
View File
@@ -150,9 +150,11 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
void displayVoltageScreenLine(uint8_t y, uint8_t index)
{
putsStrIdx(0, y, STR_A, index+1, 0);
putsTelemetryChannel(3*FW+6*FW+4, y-FH+1, index+TELEM_A1-1, frskyData.analog[index].value, DBLSIZE);
lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannel(17*FW, y-FH, index+TELEM_A1-1, frskyData.analog[index].min, NO_UNIT);
lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, index+TELEM_A1-1, frskyData.analog[index].max, NO_UNIT);
if (TELEMETRY_STREAMING()) {
putsTelemetryChannel(3*FW+6*FW+4, y-FH+1, index+TELEM_A1-1, frskyData.analog[index].value, DBLSIZE);
lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannel(17*FW, y-FH, index+TELEM_A1-1, frskyData.analog[index].min, NO_UNIT);
lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, index+TELEM_A1-1, frskyData.analog[index].max, NO_UNIT);
}
}
#if LCD_W >= 212