[Horus] SD Storage started. UI continued.
+ Some boyscout work on LCD functions
This commit is contained in:
@@ -43,234 +43,3 @@ uint8_t switchToMix(uint8_t source)
|
||||
else
|
||||
return MIXSRC_FIRST_SWITCH - 3 + source;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isSourceAvailable(int source)
|
||||
{
|
||||
#if !defined(HELI)
|
||||
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source>=MIXSRC_CH1 && source<=MIXSRC_LAST_CH) {
|
||||
uint8_t destCh = source-MIXSRC_CH1;
|
||||
for (uint8_t i = 0; i < MAX_MIXERS; i++) {
|
||||
MixData *md = mixAddress(i);
|
||||
if (md->srcRaw == 0) return false;
|
||||
if (md->destCh==destCh) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (source>=MIXSRC_SW1 && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||
LogicalSwitchData * cs = lswAddress(source-MIXSRC_SW1);
|
||||
return (cs->func != LS_FUNC_NONE);
|
||||
}
|
||||
|
||||
#if !defined(GVARS)
|
||||
if (source>=MIXSRC_GVAR1 && source<=MIXSRC_LAST_GVAR)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
if (source>=MIXSRC_RESERVE1 && source<=MIXSRC_RESERVE5)
|
||||
return false;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
|
||||
if (qr.rem == 0)
|
||||
return isTelemetryFieldAvailable(qr.quot);
|
||||
else
|
||||
return isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSourceAvailableInGlobalFunctions(int source)
|
||||
{
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
return false;
|
||||
}
|
||||
return isSourceAvailable(source);
|
||||
}
|
||||
|
||||
bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
|
||||
#if defined(FRSKY)
|
||||
if (result && source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
|
||||
result = isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isInputSourceAvailable(int source)
|
||||
{
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_TrimRud && source<MIXSRC_SW1)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM)
|
||||
return isTelemetryFieldAvailable(source-MIXSRC_FIRST_TELEM);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
enum SwitchContext
|
||||
{
|
||||
LogicalSwitchesContext,
|
||||
ModelCustomFunctionsContext,
|
||||
GeneralCustomFunctionsContext,
|
||||
TimersContext,
|
||||
MixesContext
|
||||
};
|
||||
|
||||
bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
{
|
||||
if (swtch < 0) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
if (context == GeneralCustomFunctionsContext) {
|
||||
return false;
|
||||
}
|
||||
else if (context != LogicalSwitchesContext) {
|
||||
LogicalSwitchData * cs = lswAddress(swtch-SWSRC_FIRST_LOGICAL_SWITCH);
|
||||
return (cs->func != LS_FUNC_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (swtch >= SWSRC_FIRST_FLIGHT_MODE && swtch <= SWSRC_LAST_FLIGHT_MODE) {
|
||||
if (context == MixesContext || context == GeneralCustomFunctionsContext) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
swtch -= SWSRC_FIRST_FLIGHT_MODE;
|
||||
if (swtch == 0) {
|
||||
return true;
|
||||
}
|
||||
FlightModeData * fm = flightModeAddress(swtch);
|
||||
return (fm->swtch != SWSRC_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch)
|
||||
{
|
||||
return isSwitchAvailable(swtch, LogicalSwitchesContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch)
|
||||
{
|
||||
if (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions)
|
||||
return isSwitchAvailable(swtch, ModelCustomFunctionsContext);
|
||||
else
|
||||
return isSwitchAvailable(swtch, GeneralCustomFunctionsContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInMixes(int swtch)
|
||||
{
|
||||
return isSwitchAvailable(swtch, MixesContext);
|
||||
}
|
||||
|
||||
bool isSwitchAvailableInTimers(int swtch)
|
||||
{
|
||||
if (swtch >= 0) {
|
||||
if (swtch < TMRMODE_COUNT)
|
||||
return true;
|
||||
else
|
||||
swtch -= TMRMODE_COUNT-1;
|
||||
}
|
||||
else {
|
||||
if (swtch > -TMRMODE_COUNT)
|
||||
return false;
|
||||
else
|
||||
swtch += TMRMODE_COUNT-1;
|
||||
}
|
||||
|
||||
return isSwitchAvailable(swtch, TimersContext);
|
||||
}
|
||||
|
||||
bool isLogicalSwitchFunctionAvailable(int function)
|
||||
{
|
||||
return function != LS_FUNC_RANGE;
|
||||
}
|
||||
|
||||
bool isAssignableFunctionAvailable(int function)
|
||||
{
|
||||
bool modelFunctions = (g_menuStack[g_menuStackPtr] == menuModelCustomFunctions);
|
||||
|
||||
switch (function) {
|
||||
case FUNC_OVERRIDE_CHANNEL:
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
return modelFunctions;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
case FUNC_ADJUST_GVAR:
|
||||
#if defined(GVARS)
|
||||
return modelFunctions;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
#if !defined(HAPTIC)
|
||||
case FUNC_HAPTIC:
|
||||
#endif
|
||||
case FUNC_RESERVE4:
|
||||
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
case FUNC_RANGECHECK:
|
||||
case FUNC_BIND:
|
||||
#endif
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
case FUNC_RESERVE5:
|
||||
return false;
|
||||
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isModuleAvailable(int module)
|
||||
{
|
||||
if (module == MODULE_TYPE_NONE)
|
||||
return false;
|
||||
|
||||
#if !defined(PXX)
|
||||
if (module == MODULE_TYPE_XJT)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool modelHasNotes()
|
||||
{
|
||||
char filename[sizeof(MODELS_PATH)+1+sizeof(g_model.header.name)+sizeof(TEXT_EXT)] = MODELS_PATH "/";
|
||||
char *buf = strcat_modelname(&filename[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
return isFileAvailable(filename);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+43
-43
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
display_t displayBuf[DISPLAY_BUF_SIZE];
|
||||
display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
|
||||
void lcd_clear()
|
||||
{
|
||||
@@ -132,7 +132,7 @@ void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width,
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
const pm_uchar * q;
|
||||
|
||||
@@ -205,7 +205,7 @@ void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
|
||||
void lcd_putc(coord_t x, coord_t y, const unsigned char c)
|
||||
{
|
||||
lcd_putcAtt(x, y, c, 0);
|
||||
lcdDrawChar(x, y, c, 0);
|
||||
}
|
||||
|
||||
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags flags)
|
||||
@@ -240,7 +240,7 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
|
||||
break;
|
||||
}
|
||||
else if (c >= 0x20) {
|
||||
lcd_putcAtt(x, y, c, flags);
|
||||
lcdDrawChar(x, y, c, flags);
|
||||
x = lcdNextPos;
|
||||
}
|
||||
else if (c == 0x1F) { //X-coord prefix
|
||||
@@ -317,7 +317,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c>9 ? c+'A'-10 : c+'0';
|
||||
lcd_putcAtt(x, y, c, flags|(c>='A' ? CONDENSED : 0));
|
||||
lcdDrawChar(x, y, c, flags|(c>='A' ? CONDENSED : 0));
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint16_t val)
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c>9 ? c+'A'-10 : c+'0';
|
||||
lcd_putcAtt(x, y, c, c>='A' ? CONDENSED : 0);
|
||||
lcdDrawChar(x, y, c, c>='A' ? CONDENSED : 0);
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
@@ -430,7 +430,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
if (c=='1' && i==len && xn>x+10) { x+=1; }
|
||||
if ((lcduint_t)val >= 1000) { x+=FWNUM; f &= ~DBLSIZE; }
|
||||
}
|
||||
lcd_putcAtt(x, y, c, f);
|
||||
lcdDrawChar(x, y, c, f);
|
||||
if (mode == i) {
|
||||
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
|
||||
if (dblsize) {
|
||||
@@ -449,7 +449,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
}
|
||||
else if (xxlsize) {
|
||||
x -= 17;
|
||||
lcd_putcAtt(x+2, y, '.', f);
|
||||
lcdDrawChar(x+2, y, '.', f);
|
||||
}
|
||||
else if (midsize) {
|
||||
x -= 3;
|
||||
@@ -472,7 +472,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
}
|
||||
else {
|
||||
x -= 2;
|
||||
lcd_putcAtt(x, y, '.', f);
|
||||
lcdDrawChar(x, y, '.', f);
|
||||
}
|
||||
}
|
||||
if (dblsize && (lcduint_t)val >= 1000 && (lcduint_t)val < 10000) x-=2;
|
||||
@@ -497,17 +497,17 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
drawFilledRect(xn, y+2*FH-3, ln, 2);
|
||||
}
|
||||
}
|
||||
if (neg) lcd_putcAtt(x, y, '-', flags);
|
||||
if (neg) lcdDrawChar(x, y, '-', flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att)
|
||||
{
|
||||
lcd_hlineStip(x, y, w, 0xff, att);
|
||||
lcdDrawHorizontalLine(x, y, w, 0xff, att);
|
||||
}
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
int dx = x2-x1; /* the horizontal distance of the line */
|
||||
int dy = y2-y1; /* the vertical distance of the line */
|
||||
@@ -553,16 +553,16 @@ void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, LcdFl
|
||||
|
||||
void lcd_vline(coord_t x, scoord_t y, scoord_t h)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, SOLID);
|
||||
lcdDrawVerticalLine(x, y, h, SOLID);
|
||||
}
|
||||
|
||||
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, pat);
|
||||
lcd_vlineStip(x+w-1, y, h, pat);
|
||||
lcdDrawVerticalLine(x, y, h, pat);
|
||||
lcdDrawVerticalLine(x+w-1, y, h, pat);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcd_hlineStip(x, y+h-1, w, pat);
|
||||
lcd_hlineStip(x, y, w, pat);
|
||||
lcdDrawHorizontalLine(x, y+h-1, w, pat);
|
||||
lcdDrawHorizontalLine(x, y, w, pat);
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
@@ -570,15 +570,15 @@ void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, Lc
|
||||
{
|
||||
#if defined(CPUM64)
|
||||
for (scoord_t i=y; i<y+h; i++) {
|
||||
lcd_hlineStip(x, i, w, pat, att);
|
||||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#else
|
||||
for (scoord_t i=y; i<y+h; i++) {
|
||||
if ((att&ROUND) && (i==y || i==y+h-1))
|
||||
lcd_hlineStip(x+1, i, w-2, pat, att);
|
||||
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
|
||||
else
|
||||
lcd_hlineStip(x, i, w, pat, att);
|
||||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#endif
|
||||
@@ -617,7 +617,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
}
|
||||
|
||||
if (tme < 0) {
|
||||
lcd_putcAtt(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
|
||||
lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
|
||||
tme = -tme;
|
||||
}
|
||||
|
||||
@@ -635,10 +635,10 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
lcd_outdezNAtt(x, y, qr.quot, att|LEADING0|LEFT, 2);
|
||||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
if (att&TIMEBLINK)
|
||||
lcd_putcAtt(lcdLastPos, y, separator, BLINK);
|
||||
lcdDrawChar(lcdLastPos, y, separator, BLINK);
|
||||
else
|
||||
#endif
|
||||
lcd_putcAtt(lcdLastPos, y, separator, att&att2);
|
||||
lcdDrawChar(lcdLastPos, y, separator, att&att2);
|
||||
lcd_outdezNAtt(lcdNextPos, y, qr.rem, att2|LEADING0|LEFT, 2);
|
||||
}
|
||||
|
||||
@@ -646,7 +646,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att)
|
||||
{
|
||||
lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)));
|
||||
if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'V', att);
|
||||
if (~att & NO_UNIT) lcdDrawChar(lcdLastPos, y, 'V', att);
|
||||
}
|
||||
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att)
|
||||
@@ -685,7 +685,7 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
idx -= MIXSRC_FIRST_TELEM;
|
||||
div_t qr = div(idx, 3);
|
||||
lcd_putsnAtt(x, y, g_model.telemetrySensors[qr.quot].label, ZLEN(g_model.telemetrySensors[qr.quot].label), ZCHAR|att);
|
||||
if (qr.rem) lcd_putcAtt(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
if (qr.rem) lcdDrawChar(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
}
|
||||
#else
|
||||
else
|
||||
@@ -715,7 +715,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
if (idx == SWSRC_OFF)
|
||||
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
||||
if (idx < 0) {
|
||||
lcd_putcAtt(x-2, y, '!', att);
|
||||
lcdDrawChar(x-2, y, '!', att);
|
||||
idx = -idx;
|
||||
}
|
||||
#if defined(CPUARM) && defined(FLIGHT_MODES)
|
||||
@@ -730,7 +730,7 @@ void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
|
||||
if (idx < 0) { lcd_putcAtt(x-2, y, '!', att); idx = -idx; }
|
||||
if (idx < 0) { lcdDrawChar(x-2, y, '!', att); idx = -idx; }
|
||||
if (att & CONDENSED)
|
||||
lcd_outdezNAtt(x+FW*1, y, idx-1, (att & ~CONDENSED), 1);
|
||||
else
|
||||
@@ -741,7 +741,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx < 0) {
|
||||
lcd_putcAtt(x-3, y, '!', att);
|
||||
lcdDrawChar(x-3, y, '!', att);
|
||||
idx = -idx+CURVE_BASE-1;
|
||||
}
|
||||
if (idx < CURVE_BASE)
|
||||
@@ -768,7 +768,7 @@ void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
|
||||
if (v > TRIM_EXTENDED_MAX) {
|
||||
uint8_t p = v - TRIM_EXTENDED_MAX - 1;
|
||||
if (p >= phase) p++;
|
||||
lcd_putcAtt(x, y, '0'+p, att);
|
||||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
else {
|
||||
putsChnLetter(x, y, idx+1, att);
|
||||
@@ -783,10 +783,10 @@ void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, Lcd
|
||||
if (v > ROTARY_ENCODER_MAX) {
|
||||
uint8_t p = v - ROTARY_ENCODER_MAX - 1;
|
||||
if (p >= phase) p++;
|
||||
lcd_putcAtt(x, y, '0'+p, att);
|
||||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
else {
|
||||
lcd_putcAtt(x, y, 'a'+idx, att);
|
||||
lcdDrawChar(x, y, 'a'+idx, att);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -816,7 +816,7 @@ void displayGpsCoord(coord_t x, coord_t y, char direction, int16_t bp, int16_t a
|
||||
{
|
||||
if (!direction) direction = '-';
|
||||
lcd_outdezAtt(x, y, bp / 100, att); // ddd before '.'
|
||||
lcd_putcAtt(lcdLastPos, y, '@', att);
|
||||
lcdDrawChar(lcdLastPos, y, '@', att);
|
||||
uint8_t mn = bp % 100; // TODO div_t
|
||||
if (g_eeGeneral.gpsFormat == 0) {
|
||||
lcd_outdezNAtt(lcdNextPos, y, mn, att|LEFT|LEADING0, 2); // mm before '.'
|
||||
@@ -845,22 +845,22 @@ void displayDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags a
|
||||
x -= 42;
|
||||
att &= ~0x0F00; // TODO constant
|
||||
lcd_outdezNAtt(x, y, telemetryItem.datetime.day, att|LEADING0|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos-1, y, '-', att);
|
||||
lcdDrawChar(lcdLastPos-1, y, '-', att);
|
||||
lcd_outdezNAtt(lcdNextPos-1, y, telemetryItem.datetime.month, att|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos-1, y, '-', att);
|
||||
lcdDrawChar(lcdLastPos-1, y, '-', att);
|
||||
lcd_outdezAtt(lcdNextPos-1, y, telemetryItem.datetime.year, att|LEFT);
|
||||
y += FH;
|
||||
lcd_outdezNAtt(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos, y, ':', att);
|
||||
lcdDrawChar(lcdLastPos, y, ':', att);
|
||||
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos, y, ':', att);
|
||||
lcdDrawChar(lcdLastPos, y, ':', att);
|
||||
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
else {
|
||||
lcd_outdezNAtt(x, y, telemetryItem.datetime.hour, att|LEADING0|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos, y, ':', att);
|
||||
lcdDrawChar(lcdLastPos, y, ':', att);
|
||||
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.min, att|LEADING0|LEFT, 2);
|
||||
lcd_putcAtt(lcdLastPos, y, ':', att);
|
||||
lcdDrawChar(lcdLastPos, y, ':', att);
|
||||
lcd_outdezNAtt(lcdNextPos, y, telemetryItem.datetime.sec, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
}
|
||||
@@ -1110,7 +1110,7 @@ void lcdSetContrast()
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void lcd_putcAtt(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
void lcdDrawChar(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
const pm_uchar *q = &font_5x7[(c-0x20)*5];
|
||||
@@ -1280,7 +1280,7 @@ void lcd_plot(coord_t x, coord_t y, LcdFlags att)
|
||||
lcd_mask(p, BITMASK(y%8), att);
|
||||
}
|
||||
|
||||
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
|
||||
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
if (y >= LCD_H) return;
|
||||
if (x+w > LCD_W) { w = LCD_W - x; }
|
||||
@@ -1300,7 +1300,7 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
|
||||
}
|
||||
|
||||
#if defined(CPUM64)
|
||||
void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
@@ -1333,7 +1333,7 @@ void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
}
|
||||
#else
|
||||
// allows the att parameter...
|
||||
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
#if defined(CPUARM)
|
||||
|
||||
+14
-15
@@ -135,17 +135,16 @@
|
||||
#endif
|
||||
|
||||
#define display_t uint8_t
|
||||
#define DISPLAY_BUF_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
#define DISPLAY_BUFFER_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
|
||||
extern display_t displayBuf[DISPLAY_BUF_SIZE];
|
||||
extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
|
||||
|
||||
#define lcdRefreshWait()
|
||||
|
||||
extern coord_t lcdLastPos;
|
||||
extern coord_t lcdNextPos;
|
||||
|
||||
#define DISPLAY_BUFFER_SIZE (sizeof(display_t)*DISPLAY_BUF_SIZE)
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
@@ -164,10 +163,10 @@ typedef const char pm_char;
|
||||
#endif
|
||||
|
||||
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags mode);
|
||||
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags mode);
|
||||
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags mode);
|
||||
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags mode);
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags);
|
||||
void lcd_putsAtt(coord_t x, coord_t y, const pm_char * s, LcdFlags flags);
|
||||
void lcd_putsiAtt(coord_t x, coord_t y, const pm_char * s,uint8_t idx, LcdFlags flags);
|
||||
void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s,unsigned char len, LcdFlags flags);
|
||||
void lcd_puts(coord_t x, coord_t y, const pm_char * s);
|
||||
void lcd_putsn(coord_t x, coord_t y, const pm_char * s, unsigned char len);
|
||||
void lcd_putsLeft(coord_t y, const pm_char * s);
|
||||
@@ -227,24 +226,24 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
void lcd_plot(coord_t x, coord_t y, LcdFlags att=0);
|
||||
void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att=0);
|
||||
void lcd_hline(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
|
||||
void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
|
||||
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
|
||||
void lcd_vline(coord_t x, scoord_t y, scoord_t h);
|
||||
#if defined(CPUM64)
|
||||
void lcd_vlineStip(coord_t x, scoord_t y, int8_t h, uint8_t pat);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, int8_t h, uint8_t pat);
|
||||
#else
|
||||
void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcd_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
void drawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
void lcd_rect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
|
||||
void lcd_invert_line(int8_t line);
|
||||
#define lcd_status_line() lcd_invert_line(LCD_LINES-1)
|
||||
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcd_rect(x, y, w, w, SOLID, att); }
|
||||
inline void lcd_square(coord_t x, coord_t y, coord_t w, LcdFlags att=0) { lcdDrawRect(x, y, w, w, SOLID, att); }
|
||||
|
||||
void lcdDrawTelemetryTopBar();
|
||||
|
||||
@@ -271,7 +270,7 @@ void lcdRefresh();
|
||||
|
||||
#if defined(SIMU)
|
||||
extern bool lcd_refresh;
|
||||
extern display_t lcd_buf[DISPLAY_BUF_SIZE];
|
||||
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
char *strAppend(char * dest, const char * source, int len=0);
|
||||
|
||||
@@ -104,7 +104,7 @@ void menuCommonCalib(uint8_t event)
|
||||
|
||||
case 3:
|
||||
g_eeGeneral.chkSum = evalChkSum();
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
reusableBuffer.calib.state = 4;
|
||||
break;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
void displayKeyState(uint8_t x, uint8_t y, EnumKeys key)
|
||||
{
|
||||
uint8_t t = switchState(key);
|
||||
lcd_putcAtt(x, y, t+'0', t ? INVERS : 0);
|
||||
lcdDrawChar(x, y, t+'0', t ? INVERS : 0);
|
||||
}
|
||||
|
||||
void menuGeneralDiagKeys(uint8_t event)
|
||||
|
||||
@@ -79,7 +79,7 @@ void menuGeneralHardware(uint8_t event)
|
||||
lcd_puts(INDENT_WIDTH+3*FW, y, PSTR("Gain"));
|
||||
uint8_t mask = (1<<(k-ITEM_SETUP_HW_STICK_LV_GAIN));
|
||||
uint8_t val = (g_eeGeneral.sticksGain & mask ? 1 : 0);
|
||||
lcd_putcAtt(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr);
|
||||
lcdDrawChar(GENERAL_HW_PARAM_OFS, y, val ? '2' : '1', attr);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, val, 0, 1);
|
||||
if (checkIncDec_Ret) {
|
||||
|
||||
@@ -291,9 +291,9 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
lcdNextPos = 0;
|
||||
uint8_t attr = (m_posVert-1-s_pgOfs == i ? BSS|INVERS : BSS);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(0, y, '[', attr); }
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcdDrawChar(0, y, '[', attr); }
|
||||
lcd_putsAtt(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcd_putcAtt(lcdNextPos, y, ']', attr); }
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) { lcdDrawChar(lcdNextPos, y, ']', attr); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
g_eeGeneral.fai = true;
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -304,7 +304,7 @@ void menuGeneralSetup(uint8_t event)
|
||||
case ITEM_SETUP_SPEAKER_PITCH:
|
||||
lcd_putsLeft( y, STR_SPKRPITCH);
|
||||
#if defined(CPUARM)
|
||||
lcd_putcAtt(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
|
||||
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
|
||||
lcd_putsAtt(lcdLastPos, y, "Hz", attr);
|
||||
#else
|
||||
@@ -565,13 +565,13 @@ void menuGeneralSetup(uint8_t event)
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickReverse, 0, 15);
|
||||
lcd_rect(6*FW-1, y-1, 15*FW+2, 9);
|
||||
lcdDrawRect(6*FW-1, y-1, 15*FW+2, 9);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
lcd_putcAtt(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
|
||||
lcdDrawChar(2*FW, y, '1'+g_eeGeneral.stickMode, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
putsMixerSource((6+4*i)*FW, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i), 0);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ void menuGeneralTrainer(uint8_t event)
|
||||
if (attr) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)){
|
||||
memcpy(g_eeGeneral.trainer.calib, ppmInput, sizeof(g_eeGeneral.trainer.calib));
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,10 +199,10 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, uint8_t event, uin
|
||||
|
||||
if (c != v) {
|
||||
name[cur] = v;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
cur = 0;
|
||||
|
||||
@@ -98,7 +98,7 @@ bool moveCurve(uint8_t index, int8_t shift, int8_t custom=0)
|
||||
for (uint8_t i=0; i<custom-2; i++)
|
||||
crv[custom+i] = -100 + ((200 * (i+1) + custom/2) / (custom-1)) ;
|
||||
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
m_posHorz = -4;
|
||||
for (uint8_t i=0; i<crv.points; i++)
|
||||
crv.crv[i] = (i-(crv.points/2)) * int8_t(m_posHorz) * 50 / (crv.points-1);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
killEvents(event);
|
||||
}
|
||||
break;
|
||||
@@ -207,7 +207,7 @@ void menuModelCurveOne(uint8_t event)
|
||||
if (crv.custom && i>0 && i<crv.points-1) x = crv.crv[crv.points+i-1];
|
||||
lcd_puts(7, 2*FH, PSTR("x=")); lcd_outdezAtt(7+2*FW, 2*FH, x, LEFT);
|
||||
lcd_puts(7, 3*FH, PSTR("y=")); lcd_outdezAtt(7+2*FW, 3*FH, crv.crv[i], LEFT);
|
||||
lcd_rect(3, 1*FH+4, 7*FW-2, 3*FH-2);
|
||||
lcdDrawRect(3, 1*FH+4, 7*FW-2, 3*FH-2);
|
||||
|
||||
if (p1valdiff || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP))
|
||||
CHECK_INCDEC_MODELVAR(event, crv.crv[i], -100, 100); // edit Y on up/down
|
||||
|
||||
@@ -72,7 +72,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
strcpy(directory, SOUNDS_PATH);
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (!listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
else {
|
||||
// The user choosed a file in the list
|
||||
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
|
||||
eeDirty(eeFlags);
|
||||
storageDirty(eeFlags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -244,7 +244,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
strcpy(directory, SOUNDS_PATH);
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (listSdFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
if (sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), cfn->play.name)) {
|
||||
menuHandler = onCustomFunctionsFileSelectionMenu;
|
||||
}
|
||||
else {
|
||||
@@ -287,7 +287,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
#endif
|
||||
}
|
||||
else if (func == FUNC_PLAY_BOTH) {
|
||||
lcd_putcAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
|
||||
lcdDrawChar(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr);
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT);
|
||||
}
|
||||
@@ -365,7 +365,7 @@ void menuCustomFunctions(uint8_t event, CustomFunctionData * functions, CustomFu
|
||||
}
|
||||
else if (HAS_REPEAT_PARAM(func)) {
|
||||
if (CFN_PLAY_REPEAT(cfn) == 0) {
|
||||
lcd_putcAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
|
||||
lcdDrawChar(MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
|
||||
|
||||
@@ -55,7 +55,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
|
||||
if (expoMenu && ((attr && p < posHorz-4) || (x > EXPO_ONE_2ND_COLUMN-FW)))
|
||||
continue;
|
||||
#endif
|
||||
lcd_putcAtt(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
|
||||
lcdDrawChar(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
|
||||
x += FW;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModes
|
||||
if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) {
|
||||
s_editMode = 0;
|
||||
value ^= (1<<posHorz);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ int16_t expoFn(int16_t x)
|
||||
|
||||
void DrawFunction(FnFuncP fn, uint8_t offset)
|
||||
{
|
||||
lcd_vlineStip(X0-offset, 0, LCD_H, 0xee);
|
||||
lcd_hlineStip(X0-WCHART-offset, Y0, WCHART*2, 0xee);
|
||||
lcdDrawVerticalLine(X0-offset, 0, LCD_H, 0xee);
|
||||
lcdDrawHorizontalLine(X0-WCHART-offset, Y0, WCHART*2, 0xee);
|
||||
|
||||
coord_t prev_yv = (coord_t)-1;
|
||||
|
||||
@@ -143,7 +143,7 @@ void deleteExpoMix(uint8_t expo, uint8_t idx)
|
||||
memclear(&g_model.mixData[MAX_MIXERS-1], sizeof(MixData));
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
// TODO avoid this global s_currCh on ARM boards ...
|
||||
@@ -168,7 +168,7 @@ void insertExpoMix(uint8_t expo, uint8_t idx)
|
||||
mix->weight = 100;
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void copyExpoMix(uint8_t expo, uint8_t idx)
|
||||
@@ -183,7 +183,7 @@ void copyExpoMix(uint8_t expo, uint8_t idx)
|
||||
memmove(mix+1, mix, (MAX_MIXERS-(idx+1))*sizeof(MixData));
|
||||
}
|
||||
resumeMixerCalculations();
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void memswap(void *a, void *b, uint8_t size)
|
||||
@@ -435,8 +435,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
barMin = -101;
|
||||
if (barMax > 101)
|
||||
barMax = 101;
|
||||
lcd_hlineStip(x-2, y, GAUGE_WIDTH+2, DOTTED);
|
||||
lcd_hlineStip(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
|
||||
lcdDrawHorizontalLine(x-2, y, GAUGE_WIDTH+2, DOTTED);
|
||||
lcdDrawHorizontalLine(x-2, y+GAUGE_HEIGHT, GAUGE_WIDTH+2, DOTTED);
|
||||
lcd_vline(x-2, y+1, GAUGE_HEIGHT-1);
|
||||
lcd_vline(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
|
||||
if (barMin <= barMax) {
|
||||
@@ -784,7 +784,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);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
m_posVert = s_copySrcRow;
|
||||
s_copyTgtOfs = 0;
|
||||
@@ -890,7 +890,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;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
s_copyTgtOfs = next_ofs;
|
||||
@@ -924,7 +924,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
do {
|
||||
if (s_copyMode) {
|
||||
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < 8 && s_copySrcCh == ch && s_copyTgtOfs != 0 && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcd_rect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
||||
lcdDrawRect(expo ? 18 : 22, y-1, expo ? LCD_W-18 : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
if (s_currIdx == i) {
|
||||
@@ -963,7 +963,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
if (s_copyMode) {
|
||||
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
/* draw a border around the raw on selection mode (copy/move) */
|
||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
}
|
||||
if (cur == sub) {
|
||||
/* invert the raw when it's the current one */
|
||||
@@ -974,7 +974,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
cur++; y+=FH; mixCnt++; i++; if (expo) ed++; else md++;
|
||||
} while (expo ? (i<MAX_EXPOS && ed->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && md->srcRaw && md->destCh+1 == ch));
|
||||
if (s_copyMode == MOVE_MODE && s_pgOfs < cur && cur-s_pgOfs < LCD_LINES && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
||||
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? LCD_W-EXPO_LINE_SELECT_POS : LCD_W-22, 9, DOTTED);
|
||||
cur++; y+=FH;
|
||||
}
|
||||
}
|
||||
@@ -995,7 +995,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event)
|
||||
putsChn(0, y, ch, attr); // show CHx
|
||||
}
|
||||
if (s_copyMode == MOVE_MODE && s_copySrcCh == ch) {
|
||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
|
||||
lcdDrawRect(expo ? EXPO_LINE_SELECT_POS : 22, y-1, expo ? (LCD_W-EXPO_LINE_SELECT_POS) : (LCD_W-22), 9, DOTTED);
|
||||
}
|
||||
}
|
||||
cur++; y+=FH;
|
||||
|
||||
@@ -125,7 +125,7 @@ void menuModelLimits(uint8_t event)
|
||||
s_warning_result = 0;
|
||||
LimitData *ld = limitAddress(sub);
|
||||
ld->revert = !ld->revert;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
@@ -209,7 +209,7 @@ void menuModelLimits(uint8_t event)
|
||||
{
|
||||
uint8_t revert = ld->revert;
|
||||
#if defined(PPM_CENTER_ADJUSTABLE)
|
||||
lcd_putcAtt(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
|
||||
lcdDrawChar(LIMITS_REVERT_POS, y, revert ? 127 : 126, attr);
|
||||
#else
|
||||
lcd_putsiAtt(LIMITS_REVERT_POS, y, STR_MMMINV, revert, attr);
|
||||
#endif
|
||||
@@ -237,9 +237,9 @@ void menuModelLimits(uint8_t event)
|
||||
#if defined(PPM_LIMITS_SYMETRICAL)
|
||||
case ITEM_LIMITS_SYMETRICAL:
|
||||
#if defined(CPUARM)
|
||||
lcd_putcAtt(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
|
||||
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '\306', attr);
|
||||
#else
|
||||
lcd_putcAtt(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '^', attr);
|
||||
lcdDrawChar(LCD_W-FW-MENUS_SCROLLBAR_WIDTH, y, ld->symetrical ? '=' : '^', attr);
|
||||
#endif
|
||||
if (active) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, ld->symetrical, 1);
|
||||
|
||||
@@ -196,7 +196,7 @@ void menuModelLogicalSwitchOne(uint8_t event)
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
|
||||
if (cs->v2 < v2_min || cs->v2 > v2_max) {
|
||||
cs->v2 = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -419,7 +419,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
|
||||
if (cs->v2 < v2_min || cs->v2 > v2_max) {
|
||||
cs->v2 = 0;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#else
|
||||
if (cstate == LS_FAMILY_OFS) {
|
||||
@@ -432,7 +432,7 @@ void menuModelLogicalSwitches(uint8_t event)
|
||||
}
|
||||
if (cs->v2 > v2_max) {
|
||||
cs->v2 = v2_max;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -58,11 +58,11 @@ void onModelSelectMenu(const char *result)
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (result == STR_BACKUP_MODEL) {
|
||||
eeCheck(true); // force writing of current model data before this is changed
|
||||
storageCheck(true); // force writing of current model data before this is changed
|
||||
POPUP_WARNING(eeBackupModel(sub));
|
||||
}
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
if (!listSdFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
|
||||
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
|
||||
POPUP_WARNING(STR_NO_MODELS_ON_SD);
|
||||
s_menu_flags = 0;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ void menuModelSelect(uint8_t event)
|
||||
if (sub >= LCD_LINES-1) s_pgOfs = sub-LCD_LINES+2;
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
eeCheck(true);
|
||||
storageCheck(true);
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
@@ -200,7 +200,7 @@ void menuModelSelect(uint8_t event)
|
||||
}
|
||||
else if (s_copyMode && (s_copyTgtOfs || s_copySrcRow>=0)) {
|
||||
displayPopup(s_copyMode==COPY_MODE ? STR_COPYINGMODEL : STR_MOVINGMODEL);
|
||||
eeCheck(true); // force writing of current model data before this is changed
|
||||
storageCheck(true); // force writing of current model data before this is changed
|
||||
|
||||
uint8_t cur = (MAX_MODELS + sub + s_copyTgtOfs) % MAX_MODELS;
|
||||
|
||||
@@ -223,7 +223,7 @@ void menuModelSelect(uint8_t event)
|
||||
|
||||
if (s_copySrcRow != g_eeGeneral.currModel) {
|
||||
g_eeGeneral.currModel = s_copySrcRow;
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
}
|
||||
|
||||
s_copyMode = 0;
|
||||
@@ -370,7 +370,7 @@ void menuModelSelect(uint8_t event)
|
||||
|
||||
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
|
||||
drawFilledRect(9, y, MODELSEL_W-1-9, 7);
|
||||
lcd_rect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
lcdDrawRect(8, y-1, MODELSEL_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ void menuModelSetup(uint8_t event)
|
||||
int8_t switchVal = checkIncDecMovedSwitch(val);
|
||||
if (val != switchVal) {
|
||||
timer->mode = switchVal + (TMRMODE_COUNT-1);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -335,7 +335,7 @@ void menuModelSetup(uint8_t event)
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
memclear(&g_model.flightModeData[i], TRIMS_ARRAY_SIZE);
|
||||
}
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
@@ -400,11 +400,11 @@ void menuModelSetup(uint8_t event)
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
g_model.switchWarningEnable ^= (1 << m_posHorz);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (m_posHorz < NUM_SWITCHES-1) {
|
||||
g_model.switchWarningEnable ^= (1 << m_posHorz);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -414,14 +414,14 @@ void menuModelSetup(uint8_t event)
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (m_posHorz == NUM_SWITCHES-1) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
killEvents(event);
|
||||
@@ -451,7 +451,7 @@ void menuModelSetup(uint8_t event)
|
||||
if (swactive)
|
||||
attr |= INVERS;
|
||||
}
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
|
||||
#if !defined(CPUM64)
|
||||
lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (m_posHorz == NUM_SWITCHES-1 && !s_noHi) ? line : 0);
|
||||
#endif
|
||||
@@ -471,7 +471,7 @@ void menuModelSetup(uint8_t event)
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = 0;
|
||||
g_model.beepANACenter ^= ((BeepANACenter)1<<m_posHorz);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -576,7 +576,7 @@ void menuModelSetup(uint8_t event)
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, moduleData.ppmPulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
@@ -729,7 +729,7 @@ void menuModelSetup(uint8_t event)
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.moduleData[1].ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -754,7 +754,7 @@ void menuModelSetup(uint8_t event)
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -821,7 +821,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && s_editMode) {
|
||||
s_noHi = NO_HI_LEN;
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[m_posVert] = channelOutputs[m_posVert];
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
@@ -876,7 +876,7 @@ void menuModelFailsafe(uint8_t event)
|
||||
#endif
|
||||
|
||||
// Gauge
|
||||
lcd_rect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
|
||||
lcdDrawRect(x+COL_W-3-wbar-ofs, y, wbar+1, 6);
|
||||
uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2;
|
||||
uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2));
|
||||
coord_t x0 = (val>0) ? x+COL_W-ofs-3-wbar/2 : x+COL_W-ofs-2-wbar/2-len;
|
||||
|
||||
@@ -409,7 +409,7 @@ void menuModelSensor(uint8_t event)
|
||||
lcd_putsLeft(y, STR_RATIO);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.ratio, 0, 30000);
|
||||
if (sensor->custom.ratio == 0)
|
||||
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
|
||||
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
|
||||
else
|
||||
lcd_outdezAtt(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
|
||||
break;
|
||||
@@ -452,7 +452,7 @@ void menuModelSensor(uint8_t event)
|
||||
source = checkIncDec(event, source, -MAX_SENSORS, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
|
||||
}
|
||||
if (source < 0) {
|
||||
lcd_putcAtt(SENSOR_2ND_COLUMN, y, '-', attr);
|
||||
lcdDrawChar(SENSOR_2ND_COLUMN, y, '-', attr);
|
||||
putsMixerSource(lcdNextPos, y, MIXSRC_FIRST_TELEM+3*(-1-source), attr);
|
||||
}
|
||||
else {
|
||||
@@ -511,7 +511,7 @@ void onSensorMenu(const char *result)
|
||||
TelemetryItem & sourceItem = telemetryItems[index];
|
||||
TelemetryItem & newItem = telemetryItems[newIndex];
|
||||
newItem = sourceItem;
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_TELEMETRYFULL);
|
||||
@@ -569,7 +569,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
|
||||
int index = k-ITEM_TELEMETRY_SENSOR1;
|
||||
lcd_outdezAtt(INDENT_WIDTH, y, index+1, LEFT|attr);
|
||||
lcd_putcAtt(lcdLastPos, y, ':', attr);
|
||||
lcdDrawChar(lcdLastPos, y, ':', attr);
|
||||
lcd_putsnAtt(3*FW, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
|
||||
if (telemetryItems[index].isFresh()) {
|
||||
lcd_putc(16*FW, y, '*');
|
||||
|
||||
@@ -156,7 +156,6 @@ extern int8_t s_editMode; // global editmode
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef bool (*IsValueAvailable)(int);
|
||||
struct CheckIncDecStops {
|
||||
const int count;
|
||||
const int stops[];
|
||||
@@ -224,13 +223,6 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch);
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch);
|
||||
bool isSwitchAvailableInMixes(int swtch);
|
||||
bool isSwitchAvailableInTimers(int swtch);
|
||||
bool isModuleAvailable(int module);
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
|
||||
@@ -251,11 +243,6 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool isInputAvailable(int input);
|
||||
bool isSourceAvailable(int source);
|
||||
bool isSourceAvailableInGlobalFunctions(int source);
|
||||
bool isSourceAvailableInCustomSwitches(int source);
|
||||
bool isInputSourceAvailable(int source);
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
|
||||
#elif defined(AUTOSOURCE)
|
||||
|
||||
@@ -205,7 +205,7 @@ int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int
|
||||
else
|
||||
AUDIO_KEYPAD_DOWN();
|
||||
}
|
||||
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
checkIncDec_Ret = (newval > val ? 1 : -1);
|
||||
}
|
||||
else {
|
||||
@@ -306,7 +306,7 @@ int16_t checkIncDec(uint8_t event, int16_t val, int16_t i_min, int16_t i_max, ui
|
||||
else
|
||||
AUDIO_KEYPAD_DOWN();
|
||||
}
|
||||
eeDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
checkIncDec_Ret = (newval > val ? 1 : -1);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -52,7 +52,7 @@ int16_t s_warning_input_max;
|
||||
void displayBox()
|
||||
{
|
||||
drawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcd_rect(10, 16, LCD_W-20, 40);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
#if defined(CPUARM)
|
||||
lcd_putsn(WARNING_LINE_X, WARNING_LINE_Y, s_warning, WARNING_LINE_LEN);
|
||||
#else
|
||||
@@ -152,7 +152,7 @@ const char * displayMenu(uint8_t event)
|
||||
uint8_t display_count = min<uint8_t>(s_menu_count, MENU_MAX_LINES);
|
||||
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
|
||||
drawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
|
||||
lcd_rect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
lcd_putsAtt(MENU_X+6, i*(FH+1) + y + 2, s_menu[i], s_menu_flags);
|
||||
|
||||
@@ -325,7 +325,7 @@ void menuMainView(uint8_t event)
|
||||
#else
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
#endif
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_KEYPAD_UP();
|
||||
}
|
||||
break;
|
||||
@@ -381,7 +381,7 @@ void menuMainView(uint8_t event)
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
g_eeGeneral.view = (event == EVT_KEY_BREAK(KEY_UP) ? (view_base == VIEW_COUNT-1 ? 0 : view_base+1) : (view_base == 0 ? VIEW_COUNT-1 : view_base-1));
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
|
||||
@@ -451,7 +451,7 @@ void menuMainView(uint8_t event)
|
||||
|
||||
if (view_base < VIEW_INPUTS) {
|
||||
// scroll bar
|
||||
lcd_hlineStip(38, 34, 54, DOTTED);
|
||||
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_hline(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
|
||||
#else
|
||||
@@ -491,7 +491,7 @@ void menuMainView(uint8_t event)
|
||||
int8_t len = (abs(val) * WBAR2 + lim/2) / lim;
|
||||
|
||||
if(len>WBAR2) len = WBAR2; // prevent bars from going over the end - comment for debugging
|
||||
lcd_hlineStip(x0-WBAR2, y0, WBAR2*2+1, DOTTED);
|
||||
lcdDrawHorizontalLine(x0-WBAR2, y0, WBAR2*2+1, DOTTED);
|
||||
lcd_vline(x0,y0-2,5);
|
||||
if (val>0)
|
||||
x0+=1;
|
||||
@@ -567,7 +567,7 @@ void menuMainView(uint8_t event)
|
||||
|
||||
// And ! in case of unexpected shutdown
|
||||
if (unexpectedShutdown) {
|
||||
lcd_putcAtt(REBOOT_X, 0*FH, '!', INVERS);
|
||||
lcdDrawChar(REBOOT_X, 0*FH, '!', INVERS);
|
||||
}
|
||||
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
|
||||
@@ -131,7 +131,7 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
|
||||
for (; i < 4; i++) {
|
||||
c = (lnum % 10) + '0';
|
||||
x1 -= xinc;
|
||||
lcd_putcAtt(x1, y, c, mode);
|
||||
lcdDrawChar(x1, y, c, mode);
|
||||
lnum /= 10;
|
||||
if (lnum == 0) {
|
||||
break;
|
||||
@@ -142,20 +142,20 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
|
||||
x1 = x;
|
||||
for (i = 0; i < 4; i++) {
|
||||
x1 -= FW;
|
||||
lcd_putcAtt(x1, y, '?', mode);
|
||||
lcdDrawChar(x1, y, '?', mode);
|
||||
}
|
||||
} else {
|
||||
if (val < 0) {
|
||||
val = -val;
|
||||
x1 -= xinc;
|
||||
lcd_putcAtt(x1, y, '-', mode);
|
||||
lcdDrawChar(x1, y, '-', mode);
|
||||
}
|
||||
if (precis)
|
||||
{
|
||||
uint8_t y_temp = y;
|
||||
if (mode & DBLSIZE)
|
||||
y_temp += FH;
|
||||
lcd_putcAtt(x, y_temp, '.', (mode & (~DBLSIZE)));
|
||||
lcdDrawChar(x, y_temp, '.', (mode & (~DBLSIZE)));
|
||||
x -= (xinc / 2);
|
||||
}
|
||||
for (i = 0; i < precis; i++) {
|
||||
@@ -163,7 +163,7 @@ void lcd_outdezFloat(uint8_t x, uint8_t y, float val, uint8_t precis, uint8_t mo
|
||||
int a = val;
|
||||
c = a + '0';
|
||||
x += xinc;
|
||||
lcd_putcAtt(x, y, c, mode);
|
||||
lcdDrawChar(x, y, c, mode);
|
||||
val -= a;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ void mav_title(const pm_char * s, uint8_t index)
|
||||
displayScreenIndex(index, MAX_MAVLINK_MENU, INVERS);
|
||||
lcd_putc(7 * FW, 0, (mav_heartbeat > 0) ? '*' : ' ');
|
||||
if (telemetry_data.active)
|
||||
lcd_putcAtt(8 * FW, 0, 'A', BLINK);
|
||||
lcdDrawChar(8 * FW, 0, 'A', BLINK);
|
||||
}
|
||||
|
||||
/*! \brief Global info menu
|
||||
@@ -444,7 +444,7 @@ void lcd_outhex2(uint8_t x, uint8_t y, uint8_t val) {
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c > 9 ? c + 'A' - 10 : c + '0';
|
||||
lcd_putcAtt(x, y, c, c >= 'A' ? CONDENSED : 0);
|
||||
lcdDrawChar(x, y, c, c >= 'A' ? CONDENSED : 0);
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void menuStatisticsView(uint8_t event)
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
g_eeGeneral.globalTimer = 0;
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
sessionTimer = 0;
|
||||
break;
|
||||
#endif
|
||||
@@ -110,7 +110,7 @@ void menuStatisticsDebug(uint8_t event)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
g_eeGeneral.mAhUsed = 0;
|
||||
g_eeGeneral.globalTimer = 0;
|
||||
eeDirty(EE_GENERAL);
|
||||
storageDirty(EE_GENERAL);
|
||||
#if defined(PCBSKY9X)
|
||||
Current_used = 0;
|
||||
#endif
|
||||
|
||||
@@ -56,12 +56,12 @@ void displayRssiLine()
|
||||
#if !defined(CPUARM)
|
||||
rssi = min((uint8_t)99, frskyData.rssi[1].value);
|
||||
lcd_putsLeft(STATUS_BAR_Y, STR_TX); lcd_outdezNAtt(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcd_rect(BAR_LEFT+1, 57, 38, 7);
|
||||
lcdDrawRect(BAR_LEFT+1, 57, 38, 7);
|
||||
drawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
#endif
|
||||
rssi = min((uint8_t)99, TELEMETRY_RSSI());
|
||||
lcd_puts(104, STATUS_BAR_Y, STR_RX); lcd_outdezNAtt(105+4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcd_rect(65, 57, 38, 7);
|
||||
lcdDrawRect(65, 57, 38, 7);
|
||||
uint8_t v = 4*rssi/11;
|
||||
drawFilledRect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
}
|
||||
@@ -76,9 +76,9 @@ void displayGpsTime()
|
||||
{
|
||||
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
lcd_outdezNAtt(CENTER_OFS+6*FW+7, STATUS_BAR_Y, frskyData.hub.hour, att, 2);
|
||||
lcd_putcAtt(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawChar(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
|
||||
lcd_outdezNAtt(CENTER_OFS+9*FW+2, STATUS_BAR_Y, frskyData.hub.min, att, 2);
|
||||
lcd_putcAtt(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawChar(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
|
||||
lcd_outdezNAtt(CENTER_OFS+12*FW-3, STATUS_BAR_Y, frskyData.hub.sec, att, 2);
|
||||
lcd_status_line();
|
||||
}
|
||||
@@ -261,7 +261,7 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
#else
|
||||
lcd_putsiAtt(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
#endif
|
||||
lcd_rect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
|
||||
lcdDrawRect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
|
||||
#if defined(CPUARM)
|
||||
getvalue_t value = getValue(source);
|
||||
#else
|
||||
@@ -314,7 +314,7 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
}
|
||||
|
||||
if (thresholdX) {
|
||||
lcd_vlineStip(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
|
||||
lcdDrawVerticalLine(BAR_LEFT+1+thresholdX, y-2, barHeight+3, DOTTED);
|
||||
lcd_hline(BAR_LEFT+thresholdX, y-2, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,19 +67,19 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
{
|
||||
lcd_outdezAtt(LCD_W, 0, count, attr);
|
||||
coord_t x = 1+LCD_W-FW*(count>9 ? 3 : 2);
|
||||
lcd_putcAtt(x, 0, '/', attr);
|
||||
lcdDrawChar(x, 0, '/', attr);
|
||||
lcd_outdezAtt(x, 0, index+1, attr);
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, DOTTED);
|
||||
lcdDrawVerticalLine(x, y, h, DOTTED);
|
||||
coord_t yofs = (h * offset) / count;
|
||||
coord_t yhgt = (h * visible) / count;
|
||||
if (yhgt + yofs > h)
|
||||
yhgt = h - yofs;
|
||||
lcd_vlineStip(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -149,7 +149,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode)*10 : delta);
|
||||
else
|
||||
value = (GV_IS_GV_VALUE(value, min, max) ? GET_GVAR(value, min, max, mixerCurrentFlightMode) : delta);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
if (GV_IS_GV_VALUE(value, min, max)) {
|
||||
@@ -169,7 +169,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
if (idx < 0) {
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
|
||||
idx = -idx;
|
||||
lcd_putcAtt(x-6, y, '-', attr);
|
||||
lcdDrawChar(x-6, y, '-', attr);
|
||||
}
|
||||
else {
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx-1, delta);
|
||||
@@ -193,7 +193,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
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, mixerCurrentFlightMode) : delta);
|
||||
eeDirty(EE_MODEL);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
if (GV_IS_GV_VALUE(value, min, max)) {
|
||||
if (attr & LEFT)
|
||||
@@ -208,7 +208,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
if (idx < 0) {
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_NEG(idx, delta);
|
||||
idx = -idx;
|
||||
lcd_putcAtt(x-6, y, '-', attr);
|
||||
lcdDrawChar(x-6, y, '-', attr);
|
||||
}
|
||||
else {
|
||||
value = (int16_t) GV_CALC_VALUE_IDX_POS(idx, delta);
|
||||
|
||||
Reference in New Issue
Block a user