[Horus] Next round of screen changes + refactoring
This commit is contained in:
@@ -268,14 +268,4 @@ void lcdRefresh();
|
||||
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
extern bool lcd_refresh;
|
||||
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
char *strAppend(char * dest, const char * source, int len=0);
|
||||
char *strSetCursor(char *dest, int position);
|
||||
char *strAppendDate(char * str, bool time=false);
|
||||
char *strAppendFilename(char * dest, const char * filename, const int size);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -88,7 +88,7 @@ enum EnumTabDiag {
|
||||
e_Calib
|
||||
};
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
||||
const MenuFuncP menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralSetup,
|
||||
CASE_SDCARD(menuGeneralSdManager)
|
||||
CASE_CPUARM(menuGeneralCustomFunctions)
|
||||
|
||||
@@ -99,7 +99,7 @@ uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, cons
|
||||
}
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
|
||||
const MenuFuncP menuTabModel[] PROGMEM = {
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
|
||||
@@ -67,9 +67,8 @@ extern uint8_t calibrationState;
|
||||
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef void (*MenuFuncP)(uint8_t event);
|
||||
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
|
||||
@@ -83,7 +83,7 @@ enum mavlink_menu_ {
|
||||
};
|
||||
|
||||
//! \brief Pointer array to mavlink settings menus.
|
||||
const MenuFuncP_PROGMEM menuTabMav[] PROGMEM = {
|
||||
const MenuFuncP menuTabMav[] PROGMEM = {
|
||||
menuTelemetryMavlinkSetup
|
||||
};
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ const uint8_t LBM_CURRENT_DOT[] = {
|
||||
* Main view bitmaps
|
||||
*/
|
||||
|
||||
const uint16_t LBM_MAINVIEW_BACKGROUND[] = {
|
||||
const uint8_t LBM_MAINVIEW_BACKGROUND[] = {
|
||||
#include "../../bitmaps/Horus/background.lbm"
|
||||
};
|
||||
|
||||
@@ -224,10 +224,30 @@ const uint8_t LBM_LIBRARY_SLOT[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_slot.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_LIBRARY_CURSOR[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_category_index.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SCORE0[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_score_0.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_SCORE1[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_score_1.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_STAR0[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_star_0.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_STAR1[] = {
|
||||
#include "../../bitmaps/Horus/mask_library_star_1.lbm"
|
||||
};
|
||||
|
||||
/*
|
||||
* Other
|
||||
*/
|
||||
|
||||
const uint16_t LBM_ASTERISK[] = {
|
||||
const uint8_t LBM_ASTERISK[] = {
|
||||
#include "../../bitmaps/Horus/asterisk.lbm"
|
||||
};
|
||||
|
||||
@@ -74,6 +74,8 @@ void drawFooter();
|
||||
#define drawStatusLine(...)
|
||||
void drawProgressBar(const char *label);
|
||||
void updateProgressBar(int num, int den);
|
||||
void drawTopmenuDatetime();
|
||||
|
||||
|
||||
// Header bitmaps
|
||||
extern const uint8_t LBM_TOPMENU_POLYGON[];
|
||||
@@ -83,7 +85,7 @@ extern const uint8_t LBM_CURRENT_SHADOW[];
|
||||
extern const uint8_t LBM_CURRENT_DOT[];
|
||||
|
||||
// Main view icons
|
||||
extern const uint16_t LBM_MAINVIEW_BACKGROUND[];
|
||||
extern const uint8_t LBM_MAINVIEW_BACKGROUND[];
|
||||
extern const uint8_t LBM_TOPMENU_OPENTX[];
|
||||
extern const uint8_t LBM_TOPMENU_USB[];
|
||||
extern const uint8_t LBM_HTRIM_FRAME[];
|
||||
@@ -101,7 +103,12 @@ extern const uint8_t * const LBM_MODEL_ICONS[];
|
||||
// Model selection icons
|
||||
extern const uint8_t LBM_LIBRARY_ICON[];
|
||||
extern const uint8_t LBM_LIBRARY_SLOT[];
|
||||
extern const uint8_t LBM_LIBRARY_CURSOR[];
|
||||
extern const uint8_t LBM_SCORE0[];
|
||||
extern const uint8_t LBM_SCORE1[];
|
||||
extern const uint8_t LBM_STAR0[];
|
||||
extern const uint8_t LBM_STAR1[];
|
||||
|
||||
// Other icons
|
||||
extern const uint16_t LBM_ASTERISK[];
|
||||
extern const uint8_t LBM_ASTERISK[];
|
||||
|
||||
|
||||
+66
-45
@@ -147,6 +147,27 @@ int getFontHeight(LcdFlags flags)
|
||||
return heightTable[FONTSIZE(flags) >> 8];
|
||||
}
|
||||
|
||||
int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight)
|
||||
{
|
||||
int widthScale, heightScale;
|
||||
|
||||
int bmpWidth = getBitmapWidth(bmp);
|
||||
int bmpHeight = getBitmapHeight(bmp);
|
||||
|
||||
if (bmpWidth == 0 || bmpHeight == 0)
|
||||
return 0;
|
||||
|
||||
if (bmpWidth > dstWidth)
|
||||
widthScale = -((bmpWidth+dstWidth-1) / dstWidth);
|
||||
else
|
||||
widthScale = (dstWidth / bmpWidth);
|
||||
if (bmpHeight > dstHeight)
|
||||
heightScale = -((bmpHeight+dstHeight-1) / dstHeight);
|
||||
else
|
||||
heightScale = (dstHeight / bmpHeight);
|
||||
return min(widthScale, heightScale);
|
||||
}
|
||||
|
||||
int getTextWidth(const pm_char * s, int len, LcdFlags flags)
|
||||
{
|
||||
const uint16_t * specs = fontspecsTable[FONTSIZE(flags) >> 8];
|
||||
@@ -228,24 +249,14 @@ void lcdDrawTextWithLen(coord_t x, coord_t y, const pm_char * s, uint8_t len, Lc
|
||||
lcdNextPos = x;
|
||||
}
|
||||
|
||||
void lcd_putsn(coord_t x, coord_t y, const pm_char * s, uint8_t len)
|
||||
{
|
||||
lcdDrawTextWithLen(x, y, s, len, TEXT_COLOR);
|
||||
}
|
||||
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags flags)
|
||||
{
|
||||
lcdDrawTextWithLen(x, y, s, 255, flags);
|
||||
}
|
||||
|
||||
void lcd_puts(coord_t x, coord_t y, const pm_char * s)
|
||||
{
|
||||
lcdDrawText(x, y, s, 0);
|
||||
}
|
||||
|
||||
void lcd_putsLeft(coord_t y, const pm_char * s)
|
||||
{
|
||||
lcd_puts(MENUS_MARGIN_LEFT, y, s);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, s);
|
||||
}
|
||||
|
||||
void lcd_putsCenter(coord_t y, const pm_char * s, LcdFlags attr)
|
||||
@@ -277,17 +288,7 @@ void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
|
||||
void lcd_outdez8(coord_t x, coord_t y, int8_t val)
|
||||
{
|
||||
lcd_outdezAtt(x, y, val);
|
||||
}
|
||||
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, const char *suffix, const char *prefix)
|
||||
{
|
||||
lcd_outdezNAtt(x, y, val, flags, 0, suffix, prefix);
|
||||
}
|
||||
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, int len, const char *suffix, const char *prefix)
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t len, const char * prefix, const char * suffix)
|
||||
{
|
||||
char str[48+1]; // max=16 for the prefix, 16 chars for the number, 16 chars for the suffix
|
||||
char *s = str+32;
|
||||
@@ -455,7 +456,7 @@ void putsTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att)
|
||||
// TODO to be optimized with putsValueWithUnit
|
||||
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)), (~att & NO_UNIT) ? "v" : NULL);
|
||||
lcdDrawNumber(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1)), 0, NULL, (~att & NO_UNIT) ? "v" : NULL);
|
||||
}
|
||||
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att)
|
||||
@@ -477,7 +478,7 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, 0, att); // TODO macro
|
||||
}
|
||||
else if (idx <= MIXSRC_LAST_INPUT) {
|
||||
char s[32] = "\323";
|
||||
char s[32] = "\314";
|
||||
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT])) {
|
||||
zchar2str(s+1, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME);
|
||||
s[1+LEN_INPUT_NAME] = '\0';
|
||||
@@ -713,16 +714,16 @@ const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_DIST, // GPS Alt
|
||||
};
|
||||
|
||||
void putsValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
void putsValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
if (!(att & NO_UNIT) && unit != UNIT_RAW) {
|
||||
char unitStr[8];
|
||||
strAppend(unitStr, STR_VTELEMUNIT+1+unit*STR_VTELEMUNIT[0], STR_VTELEMUNIT[0]);
|
||||
lcd_outdezAtt(x, y, val, att, unitStr);
|
||||
lcdDrawNumber(x, y, val, att, 0, NULL, unitStr);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(x, y, val, att);
|
||||
lcdDrawNumber(x, y, val, att);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -734,7 +735,7 @@ void displayGpsCoords(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFl
|
||||
{
|
||||
}
|
||||
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t value, LcdFlags att)
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, int32_t value, LcdFlags att)
|
||||
{
|
||||
TelemetryItem & telemetryItem = telemetryItems[channel];
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[channel];
|
||||
@@ -755,7 +756,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
|
||||
}
|
||||
}
|
||||
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t value, LcdFlags att)
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, int32_t value, LcdFlags att)
|
||||
{
|
||||
if (channel >= MIXSRC_FIRST_TELEM) {
|
||||
channel = (channel-MIXSRC_FIRST_TELEM) / 3;
|
||||
@@ -765,20 +766,20 @@ void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t value, Lc
|
||||
putsTimer(x, y, value, att);
|
||||
}
|
||||
else if (channel == MIXSRC_TX_VOLTAGE) {
|
||||
lcd_outdezAtt(x, y, value, att|PREC1);
|
||||
lcdDrawNumber(x, y, value, att|PREC1);
|
||||
}
|
||||
else if (channel < MIXSRC_FIRST_CH) {
|
||||
lcd_outdezAtt(x, y, calcRESXto100(value), att);
|
||||
lcdDrawNumber(x, y, calcRESXto100(value), att);
|
||||
}
|
||||
else if (channel <= MIXSRC_LAST_CH) {
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(x, y, calcRESXto1000(value), att|PREC1);
|
||||
lcdDrawNumber(x, y, calcRESXto1000(value), att|PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(x, y, calcRESXto100(value), att);
|
||||
lcdDrawNumber(x, y, calcRESXto100(value), att);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(x, y, value, att);
|
||||
lcdDrawNumber(x, y, value, att);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,11 +884,10 @@ void lcdDrawVerticalLine(coord_t x, coord_t y, coord_t h, uint8_t pat, LcdFlags
|
||||
}
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint16_t * img, coord_t offset, coord_t width)
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * bmp, coord_t offset, coord_t width, int scale)
|
||||
{
|
||||
const uint16_t * q = img;
|
||||
coord_t w = *q++;
|
||||
coord_t height = *q++;
|
||||
int w = getBitmapWidth(bmp);
|
||||
int height = getBitmapHeight(bmp);
|
||||
|
||||
if (!width || width > w) {
|
||||
width = w;
|
||||
@@ -897,12 +897,33 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint16_t * img, coord_t offset, c
|
||||
width = LCD_W-x;
|
||||
}
|
||||
|
||||
for (coord_t row=0; row<height; row++) {
|
||||
display_t * p = &displayBuf[(row+y)*LCD_W + x];
|
||||
q = img + 2 + row*w + offset;
|
||||
for (coord_t col=0; col<width; col++) {
|
||||
lcdDrawPixel(p, *q);
|
||||
p++; q++;
|
||||
if (scale == 0) {
|
||||
scale = -1;
|
||||
}
|
||||
|
||||
if (scale < 0) {
|
||||
for (coord_t i=0, row=0; row<height; i+=1, row-=scale) {
|
||||
display_t * p = &displayBuf[(y+i)*LCD_W + x];
|
||||
const uint8_t * q = bmp + 4 + (row*w + offset) * 3;
|
||||
for (coord_t col=0; col<width; col-=scale) {
|
||||
lcdDrawTransparentPixel(p, *(q+2), *((uint16_t *)q));
|
||||
p++; q-=3*scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (coord_t row=0; row<height; row++) {
|
||||
for (int i=0; i<scale; i++) {
|
||||
display_t * p = &displayBuf[(y+scale*row+i)*LCD_W + x];
|
||||
const uint8_t * q = bmp + 4 + (row*w + offset) * 3;
|
||||
for (coord_t col=0; col<width; col++) {
|
||||
for (int j=0; j<scale; j++) {
|
||||
lcdDrawTransparentPixel(p, *(q+2), *((uint16_t *)q));
|
||||
p++;
|
||||
}
|
||||
q+=3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,7 +931,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint16_t * img, coord_t offset, c
|
||||
|
||||
void lcdDrawBlackOverlay()
|
||||
{
|
||||
// lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, TEXT_COLOR | (8<<24));
|
||||
lcdDrawFilledRect(0, 0, LCD_W, LCD_H, SOLID, TEXT_COLOR | (8<<24));
|
||||
}
|
||||
|
||||
void lcdDrawCircle(int x0, int y0, int radius)
|
||||
|
||||
+27
-26
@@ -49,16 +49,11 @@
|
||||
#define CONTRAST_MAX 45
|
||||
|
||||
#define lcdint_t int32_t
|
||||
#define lcduint_t uint32_t
|
||||
|
||||
#define LCD_LINES 17 // TODO change this constant which has no sense here, the header uses more than one line
|
||||
#define LCD_COLS 30
|
||||
|
||||
#define BSS 0x00
|
||||
// #define ERASE 0x00
|
||||
// #define FORCE 0x00
|
||||
#define FIXEDWIDTH 0x00
|
||||
// #define FILLWHITE 0x00
|
||||
#define BOLD 0x00
|
||||
|
||||
/* lcd common flags */
|
||||
@@ -194,15 +189,12 @@ extern coord_t lcdNextPos;
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR);
|
||||
void lcdDrawText(coord_t x, coord_t y, const pm_char * s, LcdFlags attr=TEXT_COLOR);
|
||||
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=TEXT_COLOR);
|
||||
void lcdDrawTextWithLen(coord_t x, coord_t y, const pm_char * s, unsigned char len, LcdFlags attr=TEXT_COLOR);
|
||||
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 lcdDrawTextWithLen(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags attr=TEXT_COLOR);
|
||||
void lcdDrawTextWithLen(coord_t x, coord_t y, const pm_char * s, unsigned char len);
|
||||
void lcd_putsLeft(coord_t y, const pm_char * s);
|
||||
void lcd_putsCenter(coord_t y, const pm_char * s, LcdFlags attr=0);
|
||||
void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, int len, const char *suffix=NULL, const char *prefix=NULL);
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0, const char *suffix=NULL, const char *prefix=NULL);
|
||||
void lcd_outdez8(coord_t x, coord_t y, int8_t val);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, int32_t val, LcdFlags flags=0, uint8_t len=0, const char * prefix=NULL, const char * suffix=NULL);
|
||||
|
||||
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, int idx, LcdFlags att=0, const char *prefix="");
|
||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||
@@ -220,9 +212,9 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
|
||||
void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att);
|
||||
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t val, LcdFlags att=0);
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags att=0);
|
||||
void putsChannel(coord_t x, coord_t y, source_t channel, LcdFlags att=0);
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, int32_t val, LcdFlags att=0);
|
||||
|
||||
#define putstime_t int32_t
|
||||
|
||||
@@ -286,17 +278,36 @@ inline void lcdDrawSquare(coord_t x, coord_t y, coord_t w, LcdFlags att=0)
|
||||
lcdDrawSolidRect(x, y, w, w, att);
|
||||
}
|
||||
|
||||
void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
inline int getBitmapWidth(const uint8_t * bmp)
|
||||
{
|
||||
return *((const uint16_t *)bmp);
|
||||
}
|
||||
|
||||
inline int getBitmapHeight(const uint8_t * bmp)
|
||||
{
|
||||
return *(((const uint16_t *)bmp)+1);
|
||||
}
|
||||
|
||||
inline int getBitmapScaledSize(int size, int scale)
|
||||
{
|
||||
if (scale >= -1 && scale <= 1)
|
||||
return size;
|
||||
else if (scale < 0)
|
||||
return -(size / scale);
|
||||
else
|
||||
return size * scale;
|
||||
}
|
||||
|
||||
int getBitmapScale(const uint8_t * bmp, int dstWidth, int dstHeight);
|
||||
int getTextWidth(const pm_char *s, int len=0, LcdFlags flags=0);
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint16_t * img, coord_t offset=0, coord_t width=0);
|
||||
void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0, coord_t width=0, int scale=0);
|
||||
void lcdDrawBitmapPattern(coord_t x, coord_t y, const uint8_t * img, LcdFlags flags=0, coord_t offset=0, coord_t width=0);
|
||||
|
||||
#define lcdSetRefVolt(...)
|
||||
void lcdSetContrast();
|
||||
#define lcdOff(...)
|
||||
|
||||
const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height);
|
||||
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
@@ -304,14 +315,4 @@ const pm_char * bmpLoad(uint8_t *dest, const char *filename, const unsigned int
|
||||
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
|
||||
#endif
|
||||
|
||||
#ifdef SIMU
|
||||
extern bool lcd_refresh;
|
||||
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
char *strAppend(char * dest, const char * source, int len=0);
|
||||
char *strSetCursor(char *dest, int position);
|
||||
char *strAppendDate(char * str, bool time=false);
|
||||
char *strAppendFilename(char * dest, const char * filename, const int size);
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
||||
@@ -64,12 +64,12 @@ const LanguagePack * LP_CONST languagePacks[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
void menuGeneralSetup(evt_t event);
|
||||
void menuGeneralSdManager(evt_t event);
|
||||
void menuGeneralCustomFunctions(evt_t event);
|
||||
void menuGeneralTrainer(evt_t event);
|
||||
void menuGeneralVersion(evt_t event);
|
||||
void menuGeneralCalib(evt_t event);
|
||||
bool menuGeneralSetup(evt_t event);
|
||||
bool menuGeneralSdManager(evt_t event);
|
||||
bool menuGeneralCustomFunctions(evt_t event);
|
||||
bool menuGeneralTrainer(evt_t event);
|
||||
bool menuGeneralVersion(evt_t event);
|
||||
bool menuGeneralCalib(evt_t event);
|
||||
|
||||
enum EnumTabDiag {
|
||||
e_Setup,
|
||||
@@ -80,7 +80,7 @@ enum EnumTabDiag {
|
||||
e_Vers,
|
||||
};
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
||||
const MenuFuncP menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralSetup,
|
||||
menuGeneralSdManager,
|
||||
menuGeneralCustomFunctions,
|
||||
@@ -89,7 +89,7 @@ const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralVersion,
|
||||
};
|
||||
|
||||
void menuGeneralCustomFunctions(evt_t event)
|
||||
bool menuGeneralCustomFunctions(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUGLOBALFUNCS, menuTabGeneral, e_GeneralCustomFunctions, NUM_CFN, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||
return menuCustomFunctions(event, g_eeGeneral.customFn, globalFunctionsContext);
|
||||
|
||||
@@ -69,7 +69,7 @@ void drawSticksPositions()
|
||||
drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
||||
}
|
||||
|
||||
void menuCommonCalib(evt_t event)
|
||||
bool menuCommonCalib(evt_t event)
|
||||
{
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
||||
int16_t vt = anaIn(i);
|
||||
@@ -216,13 +216,15 @@ void menuCommonCalib(evt_t event)
|
||||
steps = calib->count + 1;
|
||||
}
|
||||
if (steps > 0 && steps <= XPOTS_MULTIPOS_COUNT) {
|
||||
lcd_outdezAtt(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
|
||||
lcdDrawNumber(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuGeneralCalib(evt_t event)
|
||||
bool menuGeneralCalib(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
@@ -232,17 +234,18 @@ void menuGeneralCalib(evt_t event)
|
||||
calibrationState = 0;
|
||||
}
|
||||
|
||||
menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||
return menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||
}
|
||||
|
||||
void menuFirstCalib(evt_t event)
|
||||
bool menuFirstCalib(evt_t event)
|
||||
{
|
||||
if (event == EVT_KEY_BREAK(KEY_EXIT) || reusableBuffer.calib.state == 4) {
|
||||
calibrationState = 0;
|
||||
chainMenu(menuMainView);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
drawMenuTemplate(STR_MENUCALIBRATION, event);
|
||||
menuCommonCalib(event);
|
||||
drawScreenTemplate(STR_MENUCALIBRATION);
|
||||
return menuCommonCalib(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,38 +36,52 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define REFRESH_FILES() reusableBuffer.sdmanager.offset = 65535
|
||||
#define REFRESH_FILES() do { reusableBuffer.sdmanager.offset = 65535; lastBitmap = -1; } while (0)
|
||||
#define NODE_TYPE(fname) fname[SD_SCREEN_FILE_LENGTH+1]
|
||||
#define IS_DIRECTORY(fname) ((bool)(!NODE_TYPE(fname)))
|
||||
#define IS_FILE(fname) ((bool)(NODE_TYPE(fname)))
|
||||
|
||||
void menuGeneralSdManagerInfo(evt_t event)
|
||||
int lastBitmap;
|
||||
|
||||
bool menuGeneralSdManagerInfo(evt_t event)
|
||||
{
|
||||
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
lcd_putsLeft(2*FH, STR_SD_TYPE);
|
||||
lcd_puts(100, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
|
||||
lcdDrawText(100, 2*FH, SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD);
|
||||
|
||||
lcd_putsLeft(3*FH, STR_SD_SIZE);
|
||||
lcd_outdezAtt(100, 3*FH, sdGetSize(), LEFT, "M");
|
||||
lcdDrawNumber(100, 3*FH, sdGetSize(), LEFT, 0, NULL, "M");
|
||||
|
||||
lcd_putsLeft(4*FH, STR_SD_SECTORS);
|
||||
#if defined(SD_GET_FREE_BLOCKNR)
|
||||
lcd_outdezAtt(100, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT, "/");
|
||||
lcd_outdezAtt(150, 4*FH, sdGetNoSectors()/1000, LEFT);
|
||||
lcdDrawNumber(100, 4*FH, SD_GET_FREE_BLOCKNR()/1000, LEFT, 0, NULL, "/");
|
||||
lcdDrawNumber(150, 4*FH, sdGetNoSectors()/1000, LEFT);
|
||||
#else
|
||||
lcd_outdezAtt(100, 4*FH, sdGetNoSectors()/1000, LEFT, "k");
|
||||
lcdDrawNumber(100, 4*FH, sdGetNoSectors()/1000, LEFT, 0, NULL, "k");
|
||||
#endif
|
||||
|
||||
lcd_putsLeft(5*FH, STR_SD_SPEED);
|
||||
lcd_outdezAtt(100, 5*FH, SD_GET_SPEED()/1000, LEFT, "kb/s");
|
||||
lcdDrawNumber(100, 5*FH, SD_GET_SPEED()/1000, LEFT, 0, NULL, "kb/s");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool isFilenameGreater(bool isfile, const char * fn, const char * line)
|
||||
{
|
||||
return (isfile && !line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) > 0);
|
||||
return (isfile && IS_DIRECTORY(line)) || (isfile==IS_FILE(line) && strcasecmp(fn, line) > 0);
|
||||
}
|
||||
|
||||
inline bool isFilenameLower(bool isfile, const char * fn, const char * line)
|
||||
{
|
||||
return (!isfile && line[SD_SCREEN_FILE_LENGTH+1]) || (isfile==(bool)line[SD_SCREEN_FILE_LENGTH+1] && strcasecmp(fn, line) < 0);
|
||||
return (!isfile && IS_FILE(line)) || (isfile==IS_FILE(line) && strcasecmp(fn, line) < 0);
|
||||
}
|
||||
|
||||
void getSelectionFullPath(char *lfn)
|
||||
{
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, reusableBuffer.sdmanager.lines[m_posVert - s_pgOfs]);
|
||||
}
|
||||
|
||||
void onSdManagerMenu(const char *result)
|
||||
@@ -92,39 +106,39 @@ void onSdManagerMenu(const char *result)
|
||||
}
|
||||
else if (result == STR_PASTE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
|
||||
REFRESH_FILES();
|
||||
// if destination is dir, copy into that dir
|
||||
if (IS_DIRECTORY(line)) {
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, line);
|
||||
}
|
||||
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
|
||||
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, clipboard.data.sd.filename, lfn));
|
||||
REFRESH_FILES();
|
||||
}
|
||||
}
|
||||
else if (result == STR_RENAME_FILE) {
|
||||
char *ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
memcpy(reusableBuffer.sdmanager.originalName, line, sizeof(reusableBuffer.sdmanager.originalName));
|
||||
char * ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext) {
|
||||
memcpy(reusableBuffer.sdmanager.originalName, line, sizeof(reusableBuffer.sdmanager.originalName));
|
||||
// write spaces to allow a longer filename
|
||||
memset(ext, ' ', SD_SCREEN_FILE_LENGTH-LEN_FILE_EXTENSION-(ext-line));
|
||||
line[SD_SCREEN_FILE_LENGTH-LEN_FILE_EXTENSION] = '\0';
|
||||
s_editMode = EDIT_MODIFY_STRING;
|
||||
editNameCursorPos = 0;
|
||||
}
|
||||
else {
|
||||
int len = strlen(line);
|
||||
memset(line + strlen(line), ' ', SD_SCREEN_FILE_LENGTH - len);
|
||||
line[SD_SCREEN_FILE_LENGTH] = '\0';
|
||||
}
|
||||
s_editMode = EDIT_MODIFY_STRING;
|
||||
editNameCursorPos = 0;
|
||||
}
|
||||
else if (result == STR_DELETE_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, PSTR("/"));
|
||||
strcat(lfn, line);
|
||||
getSelectionFullPath(lfn);
|
||||
f_unlink(lfn);
|
||||
REFRESH_FILES();
|
||||
if (m_posVert == reusableBuffer.sdmanager.count-1)
|
||||
m_posVert--;
|
||||
}
|
||||
/* TODO else if (result == STR_LOAD_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
POPUP_WARNING(eeLoadModelSD(lfn));
|
||||
} */
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
getSelectionFullPath(lfn);
|
||||
audioQueue.stopAll();
|
||||
audioQueue.playFile(lfn, 0, ID_PLAY_FROM_SD_MANAGER);
|
||||
}
|
||||
@@ -136,38 +150,25 @@ void onSdManagerMenu(const char *result)
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_VIEW_TEXT) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
getSelectionFullPath(lfn);
|
||||
pushMenuTextView(lfn);
|
||||
}
|
||||
#if 0
|
||||
else if (result == STR_FLASH_BOOTLOADER) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
getSelectionFullPath(lfn);
|
||||
flashBootloader(lfn);
|
||||
}
|
||||
#endif
|
||||
#if defined(LUA)
|
||||
else if (result == STR_EXECUTE_FILE) {
|
||||
f_getcwd(lfn, _MAX_LFN);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, line);
|
||||
getSelectionFullPath(lfn);
|
||||
luaExec(lfn);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void menuGeneralSdManager(evt_t _event)
|
||||
bool menuGeneralSdManager(evt_t _event)
|
||||
{
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
displayPopup(STR_FORMATTING);
|
||||
@@ -197,7 +198,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
if (!READ_ONLY() && s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
MENU_ADD_ITEM(STR_SD_INFO); TODO: Implement
|
||||
MENU_ADD_ITEM(STR_SD_INFO);
|
||||
MENU_ADD_ITEM(STR_SD_FORMAT);
|
||||
menuHandler = onSdManagerMenu;
|
||||
}
|
||||
@@ -219,26 +220,26 @@ void menuGeneralSdManager(evt_t _event)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if (!reusableBuffer.sdmanager.lines[index][SD_SCREEN_FILE_LENGTH+1]) {
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[index])) {
|
||||
f_chdir(reusableBuffer.sdmanager.lines[index]);
|
||||
s_pgOfs = 0;
|
||||
m_posVert = 1;
|
||||
index = 1;
|
||||
REFRESH_FILES();
|
||||
killEvents(_event);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(_event);
|
||||
if (m_posVert < 0) {
|
||||
break;
|
||||
}
|
||||
if (s_editMode == 0) {
|
||||
char *line = reusableBuffer.sdmanager.lines[index];
|
||||
char *ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
killEvents(_event);
|
||||
char * line = reusableBuffer.sdmanager.lines[index];
|
||||
char * ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
if (!strcmp(line, "..")) {
|
||||
break; // no menu for parent dir
|
||||
}
|
||||
if (ext) {
|
||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_PLAY_FILE);
|
||||
@@ -246,9 +247,6 @@ void menuGeneralSdManager(evt_t _event)
|
||||
else if (!strcasecmp(ext, TEXT_EXT)) {
|
||||
MENU_ADD_ITEM(STR_VIEW_TEXT);
|
||||
}
|
||||
else if (!strcasecmp(ext, FIRMWARE_EXT) && !READ_ONLY()) {
|
||||
MENU_ADD_ITEM(STR_FLASH_BOOTLOADER);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (!strcasecmp(ext, SCRIPTS_EXT)) {
|
||||
MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
@@ -256,19 +254,27 @@ void menuGeneralSdManager(evt_t _event)
|
||||
#endif
|
||||
}
|
||||
if (!READ_ONLY()) {
|
||||
if (line[SD_SCREEN_FILE_LENGTH+1]) // it's a file
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
// MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
}
|
||||
menuHandler = onSdManagerMenu;
|
||||
break;
|
||||
}
|
||||
|
||||
if (reusableBuffer.sdmanager.offset != s_pgOfs) {
|
||||
FILINFO fno;
|
||||
DIR dir;
|
||||
char *fn; /* This function is assuming non-Unicode cfg. */
|
||||
TCHAR lfn[_MAX_LFN + 1];
|
||||
fno.lfname = lfn;
|
||||
fno.lfsize = sizeof(lfn);
|
||||
|
||||
if (s_pgOfs == 0) {
|
||||
reusableBuffer.sdmanager.offset = 0;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
@@ -280,7 +286,7 @@ void menuGeneralSdManager(evt_t _event)
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1][SD_SCREEN_FILE_LENGTH+1] = 1;
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = 1;
|
||||
}
|
||||
else {
|
||||
memmove(reusableBuffer.sdmanager.lines[1], reusableBuffer.sdmanager.lines[0], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
@@ -311,9 +317,9 @@ void menuGeneralSdManager(evt_t _event)
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
if (i < NUM_BODY_LINES-1) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (NUM_BODY_LINES-1-i));
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[i]));
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(line, fn);
|
||||
line[SD_SCREEN_FILE_LENGTH+1] = isfile;
|
||||
NODE_TYPE(line) = isfile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -323,9 +329,9 @@ void menuGeneralSdManager(evt_t _event)
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) {
|
||||
if (i > 0) memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], sizeof(reusableBuffer.sdmanager.lines[0]) * i);
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[i]));
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(line, fn);
|
||||
line[SD_SCREEN_FILE_LENGTH+1] = isfile;
|
||||
NODE_TYPE(line) = isfile;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -334,14 +340,14 @@ void menuGeneralSdManager(evt_t _event)
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-2]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1])) {
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], fn);
|
||||
reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1][SD_SCREEN_FILE_LENGTH+1] = isfile;
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = isfile;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[1]) && isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[0])) {
|
||||
memset(reusableBuffer.sdmanager.lines[0], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[0], fn);
|
||||
reusableBuffer.sdmanager.lines[0][SD_SCREEN_FILE_LENGTH+1] = isfile;
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[0]) = isfile;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,8 +360,8 @@ void menuGeneralSdManager(evt_t _event)
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
LcdFlags attr = (index == i ? INVERS : 0);
|
||||
if (reusableBuffer.sdmanager.lines[i][0]) {
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) {
|
||||
char s[SD_SCREEN_FILE_LENGTH+1+2];
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) {
|
||||
char s[sizeof(reusableBuffer.sdmanager.lines[0])+2];
|
||||
sprintf(s, "[%s]", reusableBuffer.sdmanager.lines[i]);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, s, attr);
|
||||
}
|
||||
@@ -364,4 +370,17 @@ void menuGeneralSdManager(evt_t _event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext && !strcasecmp(ext, BITMAPS_EXT)) {
|
||||
if (lastBitmap != m_posVert) {
|
||||
if (bmpLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||
((uint32_t *)modelBitmap)[0] = 0;
|
||||
lastBitmap = m_posVert;
|
||||
}
|
||||
}
|
||||
lcdDrawBitmap(LCD_W/2, (LCD_H-MODEL_BITMAP_HEIGHT)/2, modelBitmap);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ enum menuGeneralSetupItems {
|
||||
ITEM_SETUP_MAX
|
||||
};
|
||||
|
||||
void menuGeneralSetup(evt_t event)
|
||||
bool menuGeneralSetup(evt_t event)
|
||||
{
|
||||
#if defined(RTCLOCK)
|
||||
struct gtm t;
|
||||
@@ -151,11 +151,11 @@ void menuGeneralSetup(evt_t event)
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, t.tm_year+1900, LEFT|flags|rowattr);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, t.tm_year+1900, LEFT|flags|rowattr);
|
||||
if (rowattr && s_editMode>0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+MONTH_OFFSET, y, t.tm_mon+1, LEFT|flags|rowattr|LEADING0, 2);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+MONTH_OFFSET, y, t.tm_mon+1, LEFT|flags|rowattr|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0);
|
||||
break;
|
||||
case 2:
|
||||
@@ -164,7 +164,7 @@ void menuGeneralSetup(evt_t event)
|
||||
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+DAY_OFFSET, y, t.tm_mday, LEFT|flags|rowattr|LEADING0, 2);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+DAY_OFFSET, y, t.tm_mday, LEFT|flags|rowattr|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
|
||||
break;
|
||||
}
|
||||
@@ -191,15 +191,15 @@ void menuGeneralSetup(evt_t event)
|
||||
switch (j) {
|
||||
case 0:
|
||||
if (rowattr && s_editMode>0) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN, y, t.tm_hour, flags|rowattr|LEFT|LEADING0, 2);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, t.tm_hour, flags|rowattr|LEFT|LEADING0, 2);
|
||||
break;
|
||||
case 1:
|
||||
if (rowattr && s_editMode>0) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+MINUTE_OFFSET, y, t.tm_min, flags|rowattr|LEFT|LEADING0, 2);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+MINUTE_OFFSET, y, t.tm_min, flags|rowattr|LEFT|LEADING0, 2);
|
||||
break;
|
||||
case 2:
|
||||
if (rowattr && s_editMode>0) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+SECOND_OFFSET, y, t.tm_sec, flags|rowattr|LEFT|LEADING0, 2);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+SECOND_OFFSET, y, t.tm_sec, flags|rowattr|LEFT|LEADING0, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ void menuGeneralSetup(evt_t event)
|
||||
lcdDrawSolidFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 90, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN, y, 90+g_eeGeneral.vBatMin, color|(m_posHorz==0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
lcd_puts(RADIO_SETUP_2ND_COLUMN+20, y, "-");
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN+20, y, "-");
|
||||
putsVolts(RADIO_SETUP_2ND_COLUMN+28, y, 120+g_eeGeneral.vBatMax, color|(m_posHorz>0 ? attr : 0)|LEFT|NO_UNIT);
|
||||
if (attr && s_editMode>0) {
|
||||
if (m_posHorz==0)
|
||||
@@ -271,7 +271,7 @@ void menuGeneralSetup(evt_t event)
|
||||
|
||||
case ITEM_SETUP_SPEAKER_PITCH:
|
||||
lcd_putsLeft( y, STR_SPKRPITCH);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.speakerPitch*15, attr|LEFT, "Hz", "+");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.speakerPitch*15, attr|LEFT, 0, "+", "Hz");
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 20);
|
||||
}
|
||||
@@ -286,17 +286,17 @@ void menuGeneralSetup(evt_t event)
|
||||
break;
|
||||
case ITEM_SETUP_VARIO_PITCH:
|
||||
lcd_putsLeft(y, STR_PITCH_AT_ZERO);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT, "Hz");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10), attr|LEFT, 0, NULL, "Hz");
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioPitch, -40, 40);
|
||||
break;
|
||||
case ITEM_SETUP_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_PITCH_AT_MAX);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT, "Hz");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_FREQUENCY_ZERO+(g_eeGeneral.varioPitch*10)+VARIO_FREQUENCY_RANGE+(g_eeGeneral.varioRange*10), attr|LEFT, 0, NULL, "Hz");
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRange, -80, 80);
|
||||
break;
|
||||
case ITEM_SETUP_VARIO_REPEAT:
|
||||
lcd_putsLeft(y, STR_REPEAT_AT_ZERO);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT, STR_MS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, VARIO_REPEAT_ZERO+(g_eeGeneral.varioRepeat*10), attr|LEFT, 0, NULL, STR_MS);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.varioRepeat, -30, 50);
|
||||
break;
|
||||
#endif
|
||||
@@ -322,7 +322,7 @@ void menuGeneralSetup(evt_t event)
|
||||
#if 0
|
||||
case ITEM_SETUP_CONTRAST:
|
||||
lcd_putsLeft(y, STR_CONTRAST);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.contrast, attr|LEFT);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.contrast, CONTRAST_MIN, CONTRAST_MAX);
|
||||
lcdSetContrast();
|
||||
@@ -374,7 +374,7 @@ void menuGeneralSetup(evt_t event)
|
||||
|
||||
case ITEM_SETUP_INACTIVITY_ALARM:
|
||||
lcd_putsLeft( y,STR_INACTIVITYALARM);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT, "m");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.inactivityTimer, attr|LEFT, 0, NULL, "m");
|
||||
if (attr) g_eeGeneral.inactivityTimer = checkIncDec(event, g_eeGeneral.inactivityTimer, 0, 250, EE_GENERAL); //0..250minutes
|
||||
break;
|
||||
|
||||
@@ -393,13 +393,13 @@ void menuGeneralSetup(evt_t event)
|
||||
|
||||
case ITEM_SETUP_BACKLIGHT_DELAY:
|
||||
lcd_putsLeft(y, STR_BLDELAY);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT, "s");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT, 0, NULL, "s");
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcd_putsLeft(y, STR_BRIGHTNESS);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
if (attr) {
|
||||
uint8_t b = 100 - g_eeGeneral.backlightBright;
|
||||
CHECK_INCDEC_GENVAR(event, b, 0, 100);
|
||||
@@ -419,7 +419,7 @@ void menuGeneralSetup(evt_t event)
|
||||
{
|
||||
lcd_putsLeft(y, STR_SPLASHSCREEN);
|
||||
if (SPLASH_NEEDED()) {
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT, "s");
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT, 0, NULL, "s");
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAtIndex(RADIO_SETUP_2ND_COLUMN, y, STR_MMMINV, 0, attr); // TODO define
|
||||
@@ -431,7 +431,7 @@ void menuGeneralSetup(evt_t event)
|
||||
|
||||
case ITEM_SETUP_TIMEZONE:
|
||||
lcd_putsLeft(y, STR_TIMEZONE);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
break;
|
||||
|
||||
@@ -479,7 +479,7 @@ void menuGeneralSetup(evt_t event)
|
||||
|
||||
case ITEM_SETUP_SWITCHES_DELAY:
|
||||
lcd_putsLeft(y, STR_SWITCHES_DELAY);
|
||||
lcd_outdezAtt(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT, STR_MS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT, 0, NULL, STR_MS);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, +15);
|
||||
break;
|
||||
|
||||
@@ -519,4 +519,6 @@ void menuGeneralSetup(evt_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
#define TRAINER_CALIB_POS 12
|
||||
|
||||
void menuGeneralTrainer(evt_t event)
|
||||
bool menuGeneralTrainer(evt_t event)
|
||||
{
|
||||
uint8_t y;
|
||||
bool slave = SLAVE_MODE();
|
||||
@@ -52,7 +52,7 @@ void menuGeneralTrainer(evt_t event)
|
||||
|
||||
if (slave) {
|
||||
lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
uint8_t attr;
|
||||
@@ -83,7 +83,7 @@ void menuGeneralTrainer(evt_t event)
|
||||
break;
|
||||
|
||||
case 1:
|
||||
lcd_outdezAtt(TRAINER_COLUMN_2, y, td->studWeight, LEFT|attr, "%");
|
||||
lcdDrawNumber(TRAINER_COLUMN_2, y, td->studWeight, LEFT|attr, 0, NULL, "%");
|
||||
if (attr&BLINK) CHECK_INCDEC_GENVAR(event, td->studWeight, -125, 125);
|
||||
break;
|
||||
|
||||
@@ -98,7 +98,7 @@ void menuGeneralTrainer(evt_t event)
|
||||
|
||||
attr = (sub==5) ? blink : 0;
|
||||
lcd_putsLeft(MENU_CONTENT_TOP + 5*FH, STR_MULTIPLIER);
|
||||
lcd_outdezAtt(TRAINER_COLUMN_1, MENU_CONTENT_TOP + 5*FH, g_eeGeneral.PPM_Multiplier+10, LEFT|attr|PREC1);
|
||||
lcdDrawNumber(TRAINER_COLUMN_1, MENU_CONTENT_TOP + 5*FH, g_eeGeneral.PPM_Multiplier+10, LEFT|attr|PREC1);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.PPM_Multiplier, -10, 40);
|
||||
|
||||
attr = (sub==6) ? INVERS : 0;
|
||||
@@ -106,9 +106,9 @@ void menuGeneralTrainer(evt_t event)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 6*FH, STR_CAL, attr);
|
||||
for (int i=0; i<4; i++) {
|
||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(TRAINER_COLUMN_1+i*TRAINER_COLUMN_WIDTH, MENU_CONTENT_TOP + 6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, LEFT|PREC1);
|
||||
lcdDrawNumber(TRAINER_COLUMN_1+i*TRAINER_COLUMN_WIDTH, MENU_CONTENT_TOP + 6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, LEFT|PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(TRAINER_COLUMN_1+i*TRAINER_COLUMN_WIDTH, MENU_CONTENT_TOP + 6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5, LEFT);
|
||||
lcdDrawNumber(TRAINER_COLUMN_1+i*TRAINER_COLUMN_WIDTH, MENU_CONTENT_TOP + 6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])/5, LEFT);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -119,4 +119,6 @@ void menuGeneralTrainer(evt_t event)
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
void menuGeneralVersion(evt_t event)
|
||||
bool menuGeneralVersion(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, e_Vers, 1, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
@@ -50,4 +50,6 @@ void menuGeneralVersion(evt_t event)
|
||||
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
// backupEeprom();
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,21 +53,21 @@ enum EnumTabModel {
|
||||
CASE_FRSKY(e_Telemetry)
|
||||
};
|
||||
|
||||
void menuModelSelect(evt_t event);
|
||||
void menuModelSetup(evt_t event);
|
||||
void menuModelHeli(evt_t event);
|
||||
void menuModelFlightModesAll(evt_t event);
|
||||
void menuModelExposAll(evt_t event);
|
||||
void menuModelMixAll(evt_t event);
|
||||
void menuModelLimits(evt_t event);
|
||||
void menuModelCurvesAll(evt_t event);
|
||||
void menuModelCurveOne(evt_t event);
|
||||
void menuModelGVars(evt_t event);
|
||||
void menuModelLogicalSwitches(evt_t event);
|
||||
void menuModelCustomFunctions(evt_t event);
|
||||
void menuModelCustomScripts(evt_t event);
|
||||
void menuModelTelemetry(evt_t event);
|
||||
void menuModelExpoOne(evt_t event);
|
||||
bool menuModelSelect(evt_t event);
|
||||
bool menuModelSetup(evt_t event);
|
||||
bool menuModelHeli(evt_t event);
|
||||
bool menuModelFlightModesAll(evt_t event);
|
||||
bool menuModelExposAll(evt_t event);
|
||||
bool menuModelMixAll(evt_t event);
|
||||
bool menuModelLimits(evt_t event);
|
||||
bool menuModelCurvesAll(evt_t event);
|
||||
bool menuModelCurveOne(evt_t event);
|
||||
bool menuModelGVars(evt_t event);
|
||||
bool menuModelLogicalSwitches(evt_t event);
|
||||
bool menuModelCustomFunctions(evt_t event);
|
||||
bool menuModelCustomScripts(evt_t event);
|
||||
bool menuModelTelemetry(evt_t event);
|
||||
bool menuModelExpoOne(evt_t event);
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
|
||||
@@ -80,13 +80,13 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
|
||||
uint8_t editDelay(const coord_t x, const coord_t y, const evt_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
|
||||
{
|
||||
lcdDrawText(x+MENUS_MARGIN_LEFT, y, str, TEXT_COLOR);
|
||||
lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
|
||||
lcdDrawNumber(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
|
||||
return delay;
|
||||
}
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(x, y, event, attr, str, delay)
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
|
||||
const MenuFuncP menuTabModel[] = {
|
||||
// menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
|
||||
@@ -97,7 +97,7 @@ bool moveCurve(uint8_t index, int8_t shift)
|
||||
void displayPresetChoice(evt_t event)
|
||||
{
|
||||
displayWarning(event);
|
||||
lcd_outdezAtt(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*s_warning_input_value/4, LEFT|INVERS, "@");
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*s_warning_input_value/4, LEFT|INVERS, 0, NULL, "@");
|
||||
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
@@ -135,7 +135,7 @@ void onCurveOneMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelCurveOne(evt_t event)
|
||||
bool menuModelCurveOne(evt_t event)
|
||||
{
|
||||
static uint8_t pointsOfs = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
@@ -143,7 +143,7 @@ void menuModelCurveOne(evt_t event)
|
||||
|
||||
SIMPLE_SUBMENU(STR_MENUCURVE, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0), 0);
|
||||
|
||||
lcd_outdezAtt(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, s_curveChan+1, LEFT|HEADER_COLOR);
|
||||
lcdDrawNumber(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, s_curveChan+1, LEFT|HEADER_COLOR);
|
||||
|
||||
lcd_putsLeft(MENU_CONTENT_TOP, STR_NAME);
|
||||
editName(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + FH, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
|
||||
@@ -167,7 +167,7 @@ void menuModelCurveOne(evt_t event)
|
||||
|
||||
attr = (m_posVert==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcd_putsLeft(MENU_CONTENT_TOP + 4*FH, STR_COUNT);
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 5*FH, 5+crv.points, LEFT|attr, STR_PTS);
|
||||
lcdDrawNumber(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 5*FH, 5+crv.points, LEFT|attr, 0, NULL, STR_PTS);
|
||||
if (attr) {
|
||||
int count = checkIncDecModel(event, crv.points, -3, 12); // 2pts - 17pts
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -233,9 +233,9 @@ void menuModelCurveOne(evt_t event)
|
||||
if (i>=pointsOfs && i<pointsOfs+NUM_BODY_LINES) {
|
||||
int8_t x = -100 + 200*i/(5+crv.points-1);
|
||||
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) x = points[5+crv.points+i-1];
|
||||
lcd_outdezAtt(120, posY, i+1, LEFT|TEXT_DISABLE_COLOR);
|
||||
lcd_outdezAtt(150, posY, x, LEFT|(selectionMode==1?attr:0));
|
||||
lcd_outdezAtt(200, posY, points[i], LEFT|(selectionMode==2?attr:0));
|
||||
lcdDrawNumber(120, posY, i+1, LEFT|TEXT_DISABLE_COLOR);
|
||||
lcdDrawNumber(150, posY, x, LEFT|(selectionMode==1 ? attr : 0));
|
||||
lcdDrawNumber(200, posY, points[i], LEFT|(selectionMode==2 ? attr : 0));
|
||||
posY += FH;
|
||||
}
|
||||
|
||||
@@ -255,9 +255,9 @@ void menuModelCurveOne(evt_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (5+crv.points > NUM_BODY_LINES) {
|
||||
drawScrollbar(250, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
|
||||
}
|
||||
drawScrollbar(250, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr)
|
||||
@@ -291,7 +291,7 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelCurvesAll(evt_t event)
|
||||
bool menuModelCurvesAll(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, e_CurvesAll, MAX_CURVES, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
@@ -314,7 +314,7 @@ void menuModelCurvesAll(evt_t event)
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_CV, k+1, attr);
|
||||
editName(50, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), 0, 0);
|
||||
CurveInfo & crv = g_model.curves[k];
|
||||
lcd_outdezAtt(100, y, 5+crv.points, LEFT, STR_PTS);
|
||||
lcdDrawNumber(100, y, 5+crv.points, LEFT, 0, NULL, STR_PTS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,4 +322,6 @@ void menuModelCurvesAll(evt_t event)
|
||||
s_curveChan = sub;
|
||||
DrawCurve(23);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ void onCustomFunctionsMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext)
|
||||
{
|
||||
uint32_t sub = m_posVert;
|
||||
|
||||
@@ -217,7 +217,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif
|
||||
#if defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
@@ -237,7 +237,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
#if defined(HAPTIC)
|
||||
else if (func == FUNC_HAPTIC) {
|
||||
val_max = 3;
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
@@ -281,7 +281,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
}
|
||||
else if (func == FUNC_LOGS) {
|
||||
if (val_displayed) {
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT, "s");
|
||||
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|PREC1|LEFT, 0, NULL, "s");
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAtIndex(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, STR_MMMINV, 0, attr);
|
||||
@@ -301,7 +301,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
val_displayed = (int16_t)CFN_PARAM(cfn);
|
||||
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
lcdDrawNumber(MODEL_CUSTOM_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
break;
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
@@ -353,7 +353,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
lcdDrawText(MODEL_CUSTOM_FUNC_4TH_COLUMN-1, y, "!1x", attr);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(MODEL_CUSTOM_FUNC_4TH_COLUMN+12, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, attr, "s");
|
||||
lcdDrawNumber(MODEL_CUSTOM_FUNC_4TH_COLUMN+12, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, attr, 0, NULL, "s");
|
||||
}
|
||||
}
|
||||
else if (attr) {
|
||||
@@ -363,9 +363,11 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuModelCustomFunctions(evt_t event)
|
||||
bool menuModelCustomFunctions(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUCUSTOMFUNC, menuTabModel, e_CustomFunctions, NUM_CFN, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|4/*repeated*/ });
|
||||
return menuCustomFunctions(event, g_model.customFn, modelFunctionsContext);
|
||||
|
||||
@@ -60,7 +60,7 @@ bool isTrimModeAvailable(int mode)
|
||||
#define FLIGHT_MODES_FADEIN_COLUMN 400
|
||||
#define FLIGHT_MODES_FADEOUT_COLUMN 450
|
||||
|
||||
void menuModelFlightModesAll(evt_t event)
|
||||
bool menuModelFlightModesAll(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
|
||||
|
||||
@@ -106,7 +106,7 @@ void menuModelFlightModesAll(evt_t event)
|
||||
char s[32];
|
||||
sprintf(s, "Check FM%d Trims", mixerCurrentFlightMode);
|
||||
lcd_putsCenter(y, s, attr);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
FlightModeData *p = flightModeAddress(k);
|
||||
@@ -124,7 +124,7 @@ void menuModelFlightModesAll(evt_t event)
|
||||
case ITEM_FLIGHT_MODES_SWITCH:
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
if (k == 0)
|
||||
lcd_puts(FLIGHT_MODES_SWITCH_COLUMN, y, "N/A");
|
||||
lcdDrawText(FLIGHT_MODES_SWITCH_COLUMN, y, "N/A");
|
||||
else
|
||||
putsSwitches(FLIGHT_MODES_SWITCH_COLUMN, y, p->swtch, attr);
|
||||
break;
|
||||
@@ -145,15 +145,17 @@ void menuModelFlightModesAll(evt_t event)
|
||||
|
||||
case ITEM_FLIGHT_MODES_FADE_IN:
|
||||
if (active) p->fadeIn = checkIncDec(event, p->fadeIn, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
|
||||
lcd_outdezAtt(FLIGHT_MODES_FADEIN_COLUMN, y, (10/DELAY_STEP)*p->fadeIn, attr|PREC1);
|
||||
lcdDrawNumber(FLIGHT_MODES_FADEIN_COLUMN, y, (10/DELAY_STEP)*p->fadeIn, attr|PREC1);
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_FADE_OUT:
|
||||
if (active) p->fadeOut = checkIncDec(event, p->fadeOut, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
|
||||
lcd_outdezAtt(FLIGHT_MODES_FADEOUT_COLUMN, y, (10/DELAY_STEP)*p->fadeOut, attr|PREC1);
|
||||
lcdDrawNumber(FLIGHT_MODES_FADEOUT_COLUMN, y, (10/DELAY_STEP)*p->fadeOut, attr|PREC1);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ void onGVARSMenu(const char *result)
|
||||
|
||||
#define GVARS_FM_COLUMN(p) (123 + (p)*24)
|
||||
|
||||
void menuModelGVars(evt_t event)
|
||||
bool menuModelGVars(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUGLOBALVARS, menuTabModel, e_GVars/* TODO, first2seconds ? CHECK_FLAG_NO_SCREEN_INDEX : 0*/, MAX_GVARS, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES, NAVIGATION_LINE_BY_LINE|MAX_FLIGHT_MODES});
|
||||
|
||||
@@ -66,7 +66,7 @@ void menuModelGVars(evt_t event)
|
||||
for (int l=0; l<NUM_BODY_LINES; l++) {
|
||||
int i = l+s_pgOfs;
|
||||
coord_t y = MENU_CONTENT_TOP + l*FH;
|
||||
if (g_model.gvars[i].popup) lcd_puts(MENUS_MARGIN_LEFT+25, y, "!");
|
||||
if (g_model.gvars[i].popup) lcdDrawText(MENUS_MARGIN_LEFT+25, y, "!");
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_GV, i+1, ((sub==i && m_posHorz<0) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<1+MAX_FLIGHT_MODES; j++) {
|
||||
@@ -91,9 +91,9 @@ void menuModelGVars(evt_t event)
|
||||
}
|
||||
else {
|
||||
if (abs(v) >= 1000)
|
||||
lcd_outdezAtt(x, y+1, v, TINSIZE|attr);
|
||||
lcdDrawNumber(x, y+1, v, TINSIZE|attr);
|
||||
else
|
||||
lcd_outdezAtt(x, y, v, attr);
|
||||
lcdDrawNumber(x, y, v, attr);
|
||||
vmin = -GVAR_MAX; vmax = GVAR_MAX;
|
||||
}
|
||||
if (attr) {
|
||||
@@ -120,4 +120,6 @@ void menuModelGVars(evt_t event)
|
||||
MENU_ADD_ITEM(STR_CLEAR);
|
||||
menuHandler = onGVARSMenu;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ enum menuModelHeliItems {
|
||||
|
||||
#define MODEL_HELI_2ND_COLUMN (230)
|
||||
|
||||
void menuModelHeli(evt_t event)
|
||||
bool menuModelHeli(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, e_Heli, ITEM_HELI_MAX, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
@@ -68,7 +68,7 @@ void menuModelHeli(evt_t event)
|
||||
|
||||
case ITEM_HELI_SWASHRING:
|
||||
lcd_putsLeft(y, STR_SWASHRING);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
|
||||
break;
|
||||
|
||||
@@ -79,8 +79,8 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_ELE_WEIGHT:
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.elevatorWeight, -100, 100);
|
||||
break;
|
||||
|
||||
@@ -91,8 +91,8 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_AIL_WEIGHT:
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.aileronWeight, -100, 100);
|
||||
break;
|
||||
|
||||
@@ -103,11 +103,13 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_COL_WEIGHT:
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.collectiveWeight, -100, 100);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ enum ExposFields {
|
||||
|
||||
#define CURVE_ROWS 1
|
||||
|
||||
void menuModelExpoOne(evt_t event)
|
||||
bool menuModelExpoOne(evt_t event)
|
||||
{
|
||||
ExpoData *ed = expoAddress(s_currIdx);
|
||||
|
||||
@@ -359,12 +359,12 @@ void menuModelExpoOne(evt_t event)
|
||||
if (ed->scale > 0) x = (x * 1024) / convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(CURVE_CENTER_X+CURVE_SIDE_WIDTH, CURVE_CENTER_Y+CURVE_SIDE_WIDTH-FH+6, calcRESXto1000(x), PREC1);
|
||||
lcdDrawNumber(CURVE_CENTER_X+CURVE_SIDE_WIDTH, CURVE_CENTER_Y+CURVE_SIDE_WIDTH-FH+6, calcRESXto1000(x), PREC1);
|
||||
}
|
||||
|
||||
x = limit(-1024, x, 1024);
|
||||
int y = limit<int>(-1024, expoFn(x), 1024);
|
||||
lcd_outdezAtt(CURVE_CENTER_X-CURVE_SIDE_WIDTH, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, calcRESXto1000(y), LEFT|PREC1);
|
||||
lcdDrawNumber(CURVE_CENTER_X-CURVE_SIDE_WIDTH, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, calcRESXto1000(y), LEFT|PREC1);
|
||||
|
||||
x = divRound(x*CURVE_SIDE_WIDTH, RESX);
|
||||
y = getYCoord(expoFn, x);
|
||||
@@ -444,6 +444,8 @@ void menuModelExpoOne(evt_t event)
|
||||
}
|
||||
y += FH;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
enum MixFields {
|
||||
@@ -481,8 +483,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
int barMin = offset - weight;
|
||||
int barMax = offset + weight;
|
||||
if (y > 15) {
|
||||
lcd_outdezAtt(x-((barMin >= 0) ? 2 : 3), y-6, barMin, TINSIZE|LEFT);
|
||||
lcd_outdezAtt(x+GAUGE_WIDTH+1, y-6, barMax, TINSIZE);
|
||||
lcdDrawNumber(x-((barMin >= 0) ? 2 : 3), y-6, barMin, TINSIZE|LEFT);
|
||||
lcdDrawNumber(x+GAUGE_WIDTH+1, y-6, barMax, TINSIZE);
|
||||
}
|
||||
if (barMin < -101)
|
||||
barMin = -101;
|
||||
@@ -516,7 +518,7 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
#undef GAUGE_WIDTH
|
||||
#undef GAUGE_HEIGHT
|
||||
|
||||
void menuModelMixOne(evt_t event)
|
||||
bool menuModelMixOne(evt_t event)
|
||||
{
|
||||
MixData *md2 = mixAddress(s_currIdx) ;
|
||||
|
||||
@@ -594,7 +596,7 @@ void menuModelMixOne(evt_t event)
|
||||
case MIX_FIELD_WARNING:
|
||||
lcd_putsColumnLeft(x+MIXES_2ND_COLUMN, y, STR_MIXWARNING);
|
||||
if (md2->mixWarn)
|
||||
lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT);
|
||||
lcdDrawNumber(x+MIXES_2ND_COLUMN, y, md2->mixWarn, attr|LEFT);
|
||||
else
|
||||
lcdDrawText(x+MIXES_2ND_COLUMN, y, STR_OFF, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, md2->mixWarn, 3);
|
||||
@@ -617,6 +619,8 @@ void menuModelMixOne(evt_t event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static uint8_t s_copySrcIdx;
|
||||
@@ -709,7 +713,7 @@ void displayExpoInfos(coord_t y, ExpoData *ed)
|
||||
putsSwitches(EXPO_LINE_SWITCH_POS, y, ed->swtch);
|
||||
}
|
||||
if (ed->mode != 3) {
|
||||
lcd_puts(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? "\176" : "\177");
|
||||
lcdDrawText(EXPO_LINE_SIDE_POS, y, ed->mode == 2 ? "\176" : "\177");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -725,7 +729,7 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
bool menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
{
|
||||
int sub = m_posVert;
|
||||
|
||||
@@ -919,7 +923,7 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
cs[0] = 'S';
|
||||
if (md->delayUp || md->delayDown)
|
||||
cs[0] = (cs[0] =='S' ? '*' : 'D');
|
||||
lcd_puts(MIX_LINE_DELAY_POS, y, cs);
|
||||
lcdDrawText(MIX_LINE_DELAY_POS, y, cs);
|
||||
}
|
||||
if (s_copyMode) {
|
||||
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && i == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
@@ -967,14 +971,16 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
}
|
||||
|
||||
if (sub >= linesCount-1) m_posVert = linesCount-1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuModelExposAll(evt_t event)
|
||||
bool menuModelExposAll(evt_t event)
|
||||
{
|
||||
return menuModelExpoMix(1, event);
|
||||
}
|
||||
|
||||
void menuModelMixAll(evt_t event)
|
||||
bool menuModelMixAll(evt_t event)
|
||||
{
|
||||
return menuModelExpoMix(0, event);
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ void onLimitsMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelLimits(evt_t event)
|
||||
bool menuModelLimits(evt_t event)
|
||||
{
|
||||
MENU(STR_MENULIMITS, menuTabModel, e_Limits, NUM_CHNOUT+1, DEFAULT_SCROLLBAR_X,
|
||||
{ NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW, NAVIGATION_LINE_BY_LINE|ITEM_LIMITS_MAXROW,
|
||||
@@ -130,9 +130,9 @@ void menuModelLimits(evt_t event)
|
||||
|
||||
if (sub < NUM_CHNOUT) {
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(100, MENU_FOOTER_TOP, PPM_CH_CENTER(sub)+channelOutputs[sub]/2, HEADER_COLOR, STR_US);
|
||||
lcdDrawNumber(100, MENU_FOOTER_TOP, PPM_CH_CENTER(sub)+channelOutputs[sub]/2, HEADER_COLOR, 0, NULL, STR_US);
|
||||
#else
|
||||
lcd_outdezAtt(100, MENU_FOOTER_TOP, calcRESXto1000(channelOutputs[sub]), HEADER_COLOR|PREC1);
|
||||
lcdDrawNumber(100, MENU_FOOTER_TOP, calcRESXto1000(channelOutputs[sub]), HEADER_COLOR|PREC1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void menuModelLimits(evt_t event)
|
||||
moveTrimsToOffsets(); // if highlighted and menu pressed - move trims to offsets
|
||||
}
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
LimitData *ld = limitAddress(k);
|
||||
@@ -173,7 +173,7 @@ void menuModelLimits(evt_t event)
|
||||
char swVal[2] = "-"; // '-', '<', '>'
|
||||
if ((channelOutputs[k] - v) > 50) swVal[0] = (ld->revert ? 127 : 126); // Switch to raw inputs? - remove trim!
|
||||
if ((channelOutputs[k] - v) < -50) swVal[0] = (ld->revert ? 126 : 127);
|
||||
lcd_puts(LIMITS_DIRECTION_POS, y, swVal);
|
||||
lcdDrawText(LIMITS_DIRECTION_POS, y, swVal);
|
||||
|
||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||
|
||||
@@ -203,9 +203,9 @@ void menuModelLimits(evt_t event)
|
||||
}
|
||||
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcd_outdezAtt(LIMITS_OFFSET_POS, y, ((int32_t)ld->offset*128) / 25, attr|PREC1);
|
||||
lcdDrawNumber(LIMITS_OFFSET_POS, y, ((int32_t)ld->offset*128) / 25, attr|PREC1);
|
||||
#else
|
||||
lcd_outdezAtt(LIMITS_OFFSET_POS, y, ld->offset, attr|PREC1);
|
||||
lcdDrawNumber(LIMITS_OFFSET_POS, y, ld->offset, attr|PREC1);
|
||||
#endif
|
||||
if (active) {
|
||||
ld->offset = checkIncDec(event, ld->offset, -1000, 1000, EE_MODEL, NULL, stops1000);
|
||||
@@ -221,7 +221,7 @@ void menuModelLimits(evt_t event)
|
||||
ld->min = GVAR_MENU_ITEM(LIMITS_MIN_POS, y, ld->min, -LIMIT_EXT_MAX, LIMIT_EXT_MAX, attr|PREC1, 0, event);
|
||||
break;
|
||||
}
|
||||
lcd_outdezAtt(LIMITS_MIN_POS, y, MIN_MAX_DISPLAY(ld->min-LIMITS_MIN_MAX_OFFSET), attr|PREC1);
|
||||
lcdDrawNumber(LIMITS_MIN_POS, y, MIN_MAX_DISPLAY(ld->min-LIMITS_MIN_MAX_OFFSET), attr|PREC1);
|
||||
if (active) ld->min = LIMITS_MIN_MAX_OFFSET + checkIncDec(event, ld->min-LIMITS_MIN_MAX_OFFSET, -limit, 0, EE_MODEL, NULL, stops1000);
|
||||
break;
|
||||
|
||||
@@ -230,7 +230,7 @@ void menuModelLimits(evt_t event)
|
||||
ld->max = GVAR_MENU_ITEM(LIMITS_MAX_POS, y, ld->max, -LIMIT_EXT_MAX, LIMIT_EXT_MAX, attr|PREC1, 0, event);
|
||||
break;
|
||||
}
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, MIN_MAX_DISPLAY(ld->max+LIMITS_MIN_MAX_OFFSET), attr|PREC1);
|
||||
lcdDrawNumber(LIMITS_MAX_POS, y, MIN_MAX_DISPLAY(ld->max+LIMITS_MIN_MAX_OFFSET), attr|PREC1);
|
||||
if (active) ld->max = -LIMITS_MIN_MAX_OFFSET + checkIncDec(event, ld->max+LIMITS_MIN_MAX_OFFSET, 0, +limit, EE_MODEL, NULL, stops1000);
|
||||
break;
|
||||
|
||||
@@ -269,7 +269,7 @@ void menuModelLimits(evt_t event)
|
||||
|
||||
#if defined(PPM_CENTER_ADJUSTABLE)
|
||||
case ITEM_LIMITS_PPM_CENTER:
|
||||
lcd_outdezAtt(LIMITS_PPM_CENTER_POS, y, PPM_CENTER+ld->ppmCenter, attr);
|
||||
lcdDrawNumber(LIMITS_PPM_CENTER_POS, y, PPM_CENTER+ld->ppmCenter, attr);
|
||||
if (active) {
|
||||
CHECK_INCDEC_MODELVAR(event, ld->ppmCenter, -PPM_CENTER_MAX, +PPM_CENTER_MAX);
|
||||
}
|
||||
@@ -287,4 +287,6 @@ void menuModelLimits(evt_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lat
|
||||
char sright[10];
|
||||
sprintf(sright, "%d.%d", right.quot, right.rem);
|
||||
sprintf(s, "[%s:%s]", sleft, sright);
|
||||
lcd_puts(x-4, y, s);
|
||||
lcdDrawText(x-4, y, s);
|
||||
/* if (cs->v3 < 0)
|
||||
lcdDrawText(lcdLastPos+3, y, "<<", rattr);
|
||||
else if (cs->v3 == 0)
|
||||
@@ -95,7 +95,7 @@ void onLogicalSwitchesMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelLogicalSwitches(evt_t event)
|
||||
bool menuModelLogicalSwitches(evt_t event)
|
||||
{
|
||||
INCDEC_DECLARE_VARS(EE_MODEL);
|
||||
|
||||
@@ -173,8 +173,8 @@ void menuModelLogicalSwitches(evt_t event)
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
lcd_outdezAtt(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr1);
|
||||
lcd_outdezAtt(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||
lcdDrawNumber(CSW_2ND_COLUMN, y, lswTimerValue(cs->v1), LEFT|PREC1|attr1);
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, lswTimerValue(cs->v2), LEFT|PREC1|attr2);
|
||||
v1_min = v2_min = -128;
|
||||
v1_max = v2_max = 122;
|
||||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
@@ -201,19 +201,19 @@ void menuModelLogicalSwitches(evt_t event)
|
||||
|
||||
// CSW duration
|
||||
if (cs->duration > 0)
|
||||
lcd_outdezAtt(CSW_5TH_COLUMN, y, cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(CSW_5TH_COLUMN, y, cs->duration, (horz==LS_FIELD_DURATION ? attr : 0)|PREC1|LEFT);
|
||||
else
|
||||
lcdDrawTextAtIndex(CSW_5TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DURATION ? attr : 0);
|
||||
|
||||
// CSW delay
|
||||
if (cstate == LS_FAMILY_EDGE) {
|
||||
lcd_puts(CSW_6TH_COLUMN, y, STR_NA);
|
||||
lcdDrawText(CSW_6TH_COLUMN, y, STR_NA);
|
||||
if (attr && horz == LS_FIELD_DELAY) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
else if (cs->delay > 0) {
|
||||
lcd_outdezAtt(CSW_6TH_COLUMN, y, cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(CSW_6TH_COLUMN, y, cs->delay, (horz==LS_FIELD_DELAY ? attr : 0)|PREC1|LEFT);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAtIndex(CSW_6TH_COLUMN, y, STR_MMMINV, 0, horz==LS_FIELD_DELAY ? attr : 0);
|
||||
@@ -272,4 +272,6 @@ void menuModelLogicalSwitches(evt_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,26 +35,147 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define CATEGORIES_WIDTH 140
|
||||
#define CATEGORIES_WIDTH 140
|
||||
|
||||
void drawModel(coord_t x, coord_t y, const char * name)
|
||||
#define MODELCELL_WIDTH 153
|
||||
#define MODELCELL_HEIGHT 61
|
||||
|
||||
enum ModelSelectMode {
|
||||
MODE_SELECT_CATEGORY,
|
||||
MODE_SELECT_MODEL,
|
||||
};
|
||||
|
||||
uint8_t selectMode;
|
||||
uint8_t currentCategory;
|
||||
char selectedFilename[LEN_MODEL_FILENAME+1];
|
||||
|
||||
void drawCategory(coord_t y, const char * name, bool selected)
|
||||
{
|
||||
lcdDrawSolidRect(x, y, 153, 61, LINE_COLOR);
|
||||
lcdDrawText(x+5, y+2, name, TEXT_COLOR);
|
||||
lcdDrawSolidHorizontalLine(x+5, y+19, 143, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x+5, y+23, LBM_LIBRARY_SLOT, TEXT_COLOR);
|
||||
if (selected) {
|
||||
lcdDrawSolidFilledRect(0, y-INVERT_VERT_MARGIN, CATEGORIES_WIDTH, INVERT_LINE_HEIGHT, HEADER_BGCOLOR);
|
||||
lcdDrawBitmapPattern(CATEGORIES_WIDTH-12, y, LBM_LIBRARY_CURSOR, MENU_TITLE_COLOR);
|
||||
if (selectMode == MODE_SELECT_CATEGORY) {
|
||||
drawShadow(0, y-INVERT_VERT_MARGIN, CATEGORIES_WIDTH, INVERT_LINE_HEIGHT);
|
||||
}
|
||||
}
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, name, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
void menuModelSelect(evt_t event)
|
||||
void drawModel(coord_t x, coord_t y, const char * name, bool selected)
|
||||
{
|
||||
ModelHeader header;
|
||||
const char * error = readModel(name, (uint8_t *)&header, sizeof(header));
|
||||
if (error) {
|
||||
lcdDrawText(x+5, y+2, "(Invalid Model)", TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(x+5, y+23, LBM_LIBRARY_SLOT, TEXT_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextWithLen(x+5, y+2, header.name, LEN_MODEL_NAME, ZCHAR|TEXT_COLOR);
|
||||
putsTimer(x+104, y+41, 0, TEXT_COLOR|LEFT);
|
||||
for (int i=0; i<4; i++) {
|
||||
lcdDrawBitmapPattern(x+104+i*11, y+25, LBM_SCORE0, TITLE_BGCOLOR);
|
||||
}
|
||||
loadModelBitmap(header.bitmap, modelBitmap);
|
||||
lcdDrawBitmap(x+5, y+24, modelBitmap, 0, 0, getBitmapScale(modelBitmap, 64, 32));
|
||||
}
|
||||
lcdDrawSolidHorizontalLine(x+5, y+19, 143, LINE_COLOR);
|
||||
if (selectMode == MODE_SELECT_MODEL && selected) {
|
||||
lcdDrawSolidRect(x, y, MODELCELL_WIDTH, MODELCELL_HEIGHT, TITLE_BGCOLOR);
|
||||
drawShadow(x, y, MODELCELL_WIDTH, MODELCELL_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
void onModelSelectMenu(const char * result)
|
||||
{
|
||||
if (result == STR_SELECT_MODEL) {
|
||||
memcpy(g_eeGeneral.currModelFilename, selectedFilename, LEN_MODEL_FILENAME);
|
||||
storageDirty(EE_GENERAL);
|
||||
loadModel(g_eeGeneral.currModelFilename);
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
SET_WARNING_INFO(selectedFilename, LEN_MODEL_FILENAME, 0);
|
||||
}
|
||||
else if (result == STR_DUPLICATE_MODEL) {
|
||||
char duplicatedFilename[LEN_MODEL_FILENAME+1];
|
||||
memcpy(duplicatedFilename, selectedFilename, sizeof(duplicatedFilename));
|
||||
if (findNextFileIndex(duplicatedFilename, MODELS_PATH)) {
|
||||
sdCopyFile(selectedFilename, MODELS_PATH, duplicatedFilename, MODELS_PATH);
|
||||
storageInsertModel(duplicatedFilename, currentCategory, -1);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING("Invalid Filename");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define MODEL_INDEX() (m_posVert*2+m_posHorz)
|
||||
|
||||
bool menuModelSelect(evt_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
int modelIndex = MODEL_INDEX();
|
||||
storageRemoveModel(currentCategory, modelIndex);
|
||||
s_copyMode = 0;
|
||||
event = EVT_REFRESH;
|
||||
if (modelIndex > 0) {
|
||||
modelIndex--;
|
||||
m_posVert = modelIndex / 2;
|
||||
m_posHorz = modelIndex & 1;
|
||||
}
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
case 0:
|
||||
// no need to refresh the screen
|
||||
return;
|
||||
return false;
|
||||
|
||||
case EVT_ENTRY:
|
||||
selectMode = MODE_SELECT_CATEGORY;
|
||||
currentCategory = m_posVert = 0;
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
return;
|
||||
switch (selectMode) {
|
||||
case MODE_SELECT_CATEGORY:
|
||||
chainMenu(menuMainView);
|
||||
return false;
|
||||
case MODE_SELECT_MODEL:
|
||||
selectMode = MODE_SELECT_CATEGORY;
|
||||
m_posVert = currentCategory;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
switch (selectMode) {
|
||||
case MODE_SELECT_CATEGORY:
|
||||
selectMode = MODE_SELECT_MODEL;
|
||||
m_posVert = 0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
ModelHeader header;
|
||||
const char * error = readModel(selectedFilename, (uint8_t *)&header, sizeof(header));
|
||||
if (!error) {
|
||||
MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
MENU_ADD_ITEM(STR_DUPLICATE_MODEL);
|
||||
}
|
||||
// MENU_ADD_SD_ITEM(STR_BACKUP_MODEL);
|
||||
// MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
MENU_ADD_ITEM(STR_DELETE_MODEL);
|
||||
// MENU_ADD_ITEM(STR_CREATE_MODEL);
|
||||
// MENU_ADD_ITEM(STR_RESTORE_MODEL);
|
||||
menuHandler = onModelSelectMenu;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Header
|
||||
@@ -63,51 +184,71 @@ void menuModelSelect(evt_t event)
|
||||
lcdDrawBitmapPattern(5, 7, LBM_LIBRARY_ICON, MENU_TITLE_COLOR);
|
||||
drawTopmenuDatetime();
|
||||
|
||||
// Categories
|
||||
// Body
|
||||
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TITLE_BGCOLOR);
|
||||
lcdDrawSolidFilledRect(CATEGORIES_WIDTH, MENU_HEADER_HEIGHT, LCD_W-CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
|
||||
|
||||
// Footer
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
||||
// Categories
|
||||
StorageModelsList storage;
|
||||
const char * error = storageOpenModelsList(&storage);
|
||||
if (!error) {
|
||||
bool result = true;
|
||||
coord_t y = MENU_HEADER_HEIGHT+10;
|
||||
while (y < LCD_H) {
|
||||
char line[256];
|
||||
result = storageReadNextCategory(&storage, line, sizeof(line)-1);
|
||||
int index = 0;
|
||||
while (1) {
|
||||
char line[LEN_MODEL_FILENAME+1];
|
||||
result = storageReadNextCategory(&storage, line, LEN_MODEL_FILENAME);
|
||||
if (!result)
|
||||
break;
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, line, MENU_TITLE_COLOR);
|
||||
if (y < LCD_H) {
|
||||
drawCategory(y, line, currentCategory==index);
|
||||
}
|
||||
y += FH;
|
||||
index++;
|
||||
}
|
||||
if (selectMode == MODE_SELECT_CATEGORY) {
|
||||
if (navigate(event, index, 9)) {
|
||||
putEvent(EVT_REFRESH);
|
||||
currentCategory = m_posVert;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Models
|
||||
lcdDrawSolidFilledRect(CATEGORIES_WIDTH, MENU_HEADER_HEIGHT, LCD_W-CATEGORIES_WIDTH, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
|
||||
if (!error) {
|
||||
bool result = storageSeekCategory(&storage, 0);
|
||||
bool result = storageSeekCategory(&storage, currentCategory);
|
||||
coord_t y = MENU_HEADER_HEIGHT+7;
|
||||
unsigned int i = 0;
|
||||
int index = 0;
|
||||
while (result) {
|
||||
char line[256];
|
||||
result = storageReadNextModel(&storage, line, sizeof(line)-1);
|
||||
char line[LEN_MODEL_FILENAME+1];
|
||||
result = storageReadNextModel(&storage, line, LEN_MODEL_FILENAME);
|
||||
if (!result)
|
||||
break;
|
||||
if (y < LCD_H) {
|
||||
coord_t x;
|
||||
if (i & 1) {
|
||||
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+162, y, line);
|
||||
if (index >= s_pgOfs*2 && index < (s_pgOfs+3)*2) {
|
||||
bool selected = (m_posVert*2+m_posHorz==index);
|
||||
if (index & 1) {
|
||||
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+162, y, line, selected);
|
||||
y += 66;
|
||||
}
|
||||
else {
|
||||
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+1, y, line);
|
||||
drawModel(CATEGORIES_WIDTH+MENUS_MARGIN_LEFT+1, y, line, selected);
|
||||
}
|
||||
if (selected) {
|
||||
memcpy(selectedFilename, line, sizeof(selectedFilename));
|
||||
}
|
||||
}
|
||||
i++;
|
||||
index++;
|
||||
}
|
||||
if (selectMode == MODE_SELECT_MODEL) {
|
||||
if (navigate(event, index, 3, 2)) {
|
||||
putEvent(EVT_REFRESH);
|
||||
}
|
||||
}
|
||||
drawScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, s_pgOfs, (index+1)/2, 3);
|
||||
}
|
||||
|
||||
drawScrollbar(DEFAULT_SCROLLBAR_X, MENU_HEADER_HEIGHT+7, MENU_FOOTER_TOP-MENU_HEADER_HEIGHT-15, 0, 4, 2);
|
||||
|
||||
// Footer
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "../../opentx.h"
|
||||
|
||||
uint8_t g_moduleIdx;
|
||||
void menuModelFailsafe(evt_t event);
|
||||
bool menuModelFailsafe(evt_t event);
|
||||
|
||||
enum menuModelSetupItems {
|
||||
ITEM_MODEL_NAME,
|
||||
@@ -113,6 +113,7 @@ void onModelSetupBitmapMenu(const char *result)
|
||||
else {
|
||||
// The user choosed a bmp file in the list
|
||||
copySelection(g_model.header.bitmap, result, sizeof(g_model.header.bitmap));
|
||||
loadModelBitmap(g_model.header.bitmap, modelBitmap);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
@@ -170,7 +171,7 @@ int getSwitchWarningsCount()
|
||||
return count;
|
||||
}
|
||||
|
||||
void menuModelSetup(evt_t event)
|
||||
bool menuModelSetup(evt_t event)
|
||||
{
|
||||
horzpos_t l_posHorz = m_posHorz;
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_NONE ? HIDDEN_ROW : (uint8_t)(x))
|
||||
@@ -550,7 +551,7 @@ void menuModelSetup(evt_t event)
|
||||
lcd_putsLeft(y, STR_CHANNELRANGE);
|
||||
if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) {
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN, y, STR_CH, moduleData.channelsStart+1, m_posHorz==0 ? attr : 0);
|
||||
lcd_puts(MODEL_SETUP_2ND_COLUMN+30, y, "-");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+30, y, "-");
|
||||
putsStrIdx(MODEL_SETUP_2ND_COLUMN+40, y, STR_CH, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), m_posHorz==1 ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
@@ -577,8 +578,8 @@ void menuModelSetup(evt_t event)
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
if (IS_MODULE_PPM(moduleIdx)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT, STR_MS);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+70, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0, "us");
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)moduleData.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT, 0, NULL, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+70, y, (moduleData.ppmDelay*50)+300, (CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0, 0, NULL, "us");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+90, y, moduleData.ppmPulsePol ? "+" : "-", (CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0);
|
||||
|
||||
if (attr && s_editMode>0) {
|
||||
@@ -607,7 +608,7 @@ void menuModelSetup(evt_t event)
|
||||
lcd_putsLeft(y, STR_RXNUM);
|
||||
}
|
||||
if (IS_MODULE_XJT(moduleIdx) || IS_MODULE_DSM2(moduleIdx)) {
|
||||
if (xOffsetBind) lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (xOffsetBind) lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[moduleIdx], (l_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && l_posHorz==0 && s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[moduleIdx], IS_MODULE_DSM2(moduleIdx) ? 20 : 63);
|
||||
}
|
||||
@@ -663,11 +664,13 @@ void menuModelSetup(evt_t event)
|
||||
|
||||
if (IS_RANGECHECK_ENABLE()) {
|
||||
displayPopup("RSSI :");
|
||||
lcd_outdezAtt(WARNING_LINE_X, WARNING_INFOLINE_Y, TELEMETRY_RSSI(), DBLSIZE|LEFT);
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y, TELEMETRY_RSSI(), DBLSIZE|LEFT);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuModelFailsafe(evt_t event)
|
||||
bool menuModelFailsafe(evt_t event)
|
||||
{
|
||||
static bool longNames = false;
|
||||
bool newLongNames = false;
|
||||
@@ -731,13 +734,13 @@ void menuModelFailsafe(evt_t event)
|
||||
}
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? SLIDER_W-10 : SLIDER_W);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, PPM_CH_CENTER(ch)+val/2, flags);
|
||||
lcdDrawNumber(x+COL_W-4-wbar-ofs, y, PPM_CH_CENTER(ch)+val/2, flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? SLIDER_W-16 : SLIDER_W-6);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(val), PREC1|flags);
|
||||
lcdDrawNumber(x+COL_W-4-wbar-ofs, y, calcRESXto1000(val), PREC1|flags);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? SLIDER_W-10 : SLIDER_W);
|
||||
lcd_outdezAtt(x+COL_W-4-wbar-ofs, y, calcRESXto1000(val)/10, flags);
|
||||
lcdDrawNumber(x+COL_W-4-wbar-ofs, y, calcRESXto1000(val)/10, flags);
|
||||
#endif
|
||||
|
||||
// Gauge
|
||||
@@ -751,4 +754,6 @@ void menuModelFailsafe(evt_t event)
|
||||
}
|
||||
|
||||
longNames = newLongNames;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -208,13 +208,13 @@ bool isSensorAvailable(int sensor)
|
||||
#define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSOR_PERSISTENT_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
|
||||
|
||||
void menuModelSensor(evt_t event)
|
||||
bool menuModelSensor(evt_t event)
|
||||
{
|
||||
TelemetrySensor *sensor = &g_model.telemetrySensors[s_currIdx];
|
||||
|
||||
SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, DEFAULT_SCROLLBAR_X, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, 0 });
|
||||
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+getTextWidth(TR_MENUSENSOR)+5, MENU_FOOTER_TOP, s_currIdx+1, HEADER_COLOR|LEFT);
|
||||
lcdDrawNumber(MENUS_MARGIN_LEFT+getTextWidth(TR_MENUSENSOR)+5, MENU_FOOTER_TOP, s_currIdx+1, HEADER_COLOR|LEFT);
|
||||
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, MENU_FOOTER_TOP, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), HEADER_COLOR|LEFT);
|
||||
|
||||
int sub = m_posVert;
|
||||
@@ -252,7 +252,7 @@ void menuModelSensor(evt_t event)
|
||||
if (sensor->type == TELEM_TYPE_CUSTOM) {
|
||||
lcd_putsLeft(y, STR_ID);
|
||||
lcd_outhex4(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(m_posHorz==0 ? attr : 0));
|
||||
lcd_outdezAtt(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(m_posHorz==1 ? attr : 0));
|
||||
lcdDrawNumber(SENSOR_3RD_COLUMN, y, sensor->instance, LEFT|(m_posHorz==1 ? attr : 0));
|
||||
if (attr) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -337,7 +337,7 @@ void menuModelSensor(evt_t event)
|
||||
if (sensor->custom.ratio == 0)
|
||||
lcdDrawText(SENSOR_2ND_COLUMN, y, "-", attr);
|
||||
else
|
||||
lcd_outdezAtt(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
|
||||
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.ratio, LEFT|attr|PREC1);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
@@ -361,7 +361,7 @@ void menuModelSensor(evt_t event)
|
||||
lcd_putsLeft(y, NO_INDENT(STR_OFFSET));
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, sensor->custom.offset, -30000, +30000);
|
||||
if (sensor->prec > 0) attr |= (sensor->prec == 2 ? PREC2 : PREC1);
|
||||
lcd_outdezAtt(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr);
|
||||
lcdDrawNumber(SENSOR_2ND_COLUMN, y, sensor->custom.offset, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
@@ -400,6 +400,8 @@ void menuModelSensor(evt_t event)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void onSensorMenu(const char *result)
|
||||
@@ -442,7 +444,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuModelTelemetry(evt_t event)
|
||||
bool menuModelTelemetry(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX, DEFAULT_SCROLLBAR_X, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS CASE_VARIO(LABEL(Vario)) CASE_VARIO(0) CASE_VARIO(VARIO_RANGE_ROWS) LABEL(TopBar), 0, 0, TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1), TELEMETRY_SCREEN_ROWS(2), TELEMETRY_SCREEN_ROWS(3) });
|
||||
|
||||
@@ -461,10 +463,10 @@ void menuModelTelemetry(evt_t event)
|
||||
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
|
||||
int index = k-ITEM_TELEMETRY_SENSOR1;
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, index+1, LEFT|attr, ":");
|
||||
lcdDrawNumber(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, index+1, LEFT|attr, 0, NULL, ":");
|
||||
lcdDrawTextWithLen(60, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
|
||||
if (telemetryItems[index].isFresh()) {
|
||||
lcd_puts(100, y, "*");
|
||||
lcdDrawText(100, y, "*");
|
||||
}
|
||||
TelemetryItem & telemetryItem = telemetryItems[index];
|
||||
if (telemetryItem.isAvailable()) {
|
||||
@@ -472,7 +474,7 @@ void menuModelTelemetry(evt_t event)
|
||||
putsTelemetryChannelValue(TELEM_COL2, y, index, getValue(MIXSRC_FIRST_TELEM+3*index), LEFT|color);
|
||||
}
|
||||
else {
|
||||
lcd_puts(TELEM_COL2, y, "---"); // TODO shortcut
|
||||
lcdDrawText(TELEM_COL2, y, "---"); // TODO shortcut
|
||||
}
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
@@ -519,7 +521,7 @@ void menuModelTelemetry(evt_t event)
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
uint8_t alarm = k-ITEM_TELEMETRY_RSSI_ALARM1;
|
||||
lcd_putsLeft(y, (alarm==0 ? STR_LOWALARM : STR_CRITICALALARM));
|
||||
lcd_outdezNAtt(TELEM_COL2, y, getRssiAlarmValue(alarm), LEFT|attr, 3);
|
||||
lcdDrawNumber(TELEM_COL2, y, getRssiAlarmValue(alarm), LEFT|attr, 3);
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30);
|
||||
}
|
||||
@@ -541,10 +543,10 @@ void menuModelTelemetry(evt_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_LIMIT);
|
||||
lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
|
||||
lcd_outdezAtt(TELEM_COL2+70, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+115, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+160, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0));
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+70, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+115, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+160, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -725,4 +727,6 @@ void menuModelTelemetry(evt_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void pushMenu(MenuFuncP newMenu)
|
||||
menuEvent = EVT_ENTRY;
|
||||
}
|
||||
|
||||
void menuModelNotes(evt_t event)
|
||||
bool menuModelNotes(evt_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
strcpy(s_text_file, MODELS_PATH "/");
|
||||
@@ -84,7 +84,7 @@ void menuModelNotes(evt_t event)
|
||||
strcpy(buf, TEXT_EXT);
|
||||
}
|
||||
|
||||
menuTextView(event);
|
||||
return menuTextView(event);
|
||||
}
|
||||
|
||||
void pushModelNotes()
|
||||
|
||||
+38
-43
@@ -50,7 +50,7 @@
|
||||
|
||||
#define MENU_COLUMN2_X 280
|
||||
|
||||
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > MENU_COLUMN2_X+MENUS_MARGIN_LEFT+68) ? MENU_COLUMN2_X+MENUS_MARGIN_LEFT : MENUS_MARGIN_LEFT, y, str)
|
||||
#define lcd_putsColumnLeft(x, y, str) lcdDrawText((x > MENU_COLUMN2_X+MENUS_MARGIN_LEFT+68) ? MENU_COLUMN2_X+MENUS_MARGIN_LEFT : MENUS_MARGIN_LEFT, y, str)
|
||||
|
||||
typedef int16_t vertpos_t;
|
||||
|
||||
@@ -68,10 +68,9 @@ extern uint8_t calibrationState;
|
||||
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef void (*MenuFuncP)(evt_t event);
|
||||
typedef void (*MenuFuncP_PROGMEM)(evt_t event);
|
||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||
typedef bool (*MenuFuncP)(evt_t event);
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
@@ -85,33 +84,28 @@ void pushMenu(MenuFuncP newMenu);
|
||||
/// return to last menu in menustack
|
||||
void popMenu();
|
||||
|
||||
void menuFirstCalib(evt_t event);
|
||||
bool menuFirstCalib(evt_t event);
|
||||
|
||||
void onMainViewMenu(const char *result);
|
||||
void menuMainView(evt_t event);
|
||||
void menuGeneralDiagAna(evt_t event);
|
||||
|
||||
void menuTelemetryFrsky(evt_t event);
|
||||
void menuGeneralSetup(evt_t event);
|
||||
void menuGeneralCalib(evt_t event);
|
||||
void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
|
||||
void menuModelSelect(evt_t event);
|
||||
void menuModelSetup(evt_t event);
|
||||
void menuModelCustomFunctions(evt_t event);
|
||||
void menuStatisticsView(evt_t event);
|
||||
void menuStatisticsDebug(evt_t event);
|
||||
void menuAboutView(evt_t event);
|
||||
bool menuMainView(evt_t event);
|
||||
bool menuGeneralDiagAna(evt_t event);
|
||||
bool menuGeneralSetup(evt_t event);
|
||||
bool menuGeneralCalib(evt_t event);
|
||||
bool menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunctionsContext & functionsContext);
|
||||
bool menuModelSelect(evt_t event);
|
||||
bool menuModelSetup(evt_t event);
|
||||
bool menuModelCustomFunctions(evt_t event);
|
||||
bool menuStatisticsView(evt_t event);
|
||||
bool menuStatisticsDebug(evt_t event);
|
||||
bool menuAboutView(evt_t event);
|
||||
bool menuMainViewChannelsMonitor(evt_t event);
|
||||
bool menuChannelsView(evt_t event);
|
||||
bool menuChannelsView(evt_t event);
|
||||
bool menuTextView(evt_t event);
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
void menuTraceBuffer(evt_t event);
|
||||
#endif
|
||||
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
|
||||
void menuMainViewChannelsMonitor(evt_t event);
|
||||
void menuChannelsView(evt_t event);
|
||||
|
||||
extern int8_t checkIncDec_Ret; // global helper vars
|
||||
|
||||
#define EDIT_SELECT_MENU -1
|
||||
@@ -200,36 +194,40 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#define CURSOR_ON_LINE() (m_posHorz<0)
|
||||
|
||||
#define CHECK_FLAG_NO_SCREEN_INDEX 1
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
bool navigate(evt_t event, int count, int rows, int columns=1);
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t maxrow, uint8_t flags=0);
|
||||
bool check_simple(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, vertpos_t maxrow);
|
||||
bool check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
void drawMenuTemplate(const char *title, evt_t event, uint16_t scrollbar_X=0);
|
||||
void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h);
|
||||
void drawScreenTemplate(const char * title);
|
||||
void drawMenuTemplate(const char * title, uint16_t scrollbar_X=0);
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
|
||||
#define MENU(title, tab, menu, lines_count, scrollbar_X, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
||||
if (!check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)) return; \
|
||||
drawMenuTemplate(title, event, scrollbar_X); \
|
||||
if (!check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
|
||||
drawMenuTemplate(title, scrollbar_X); \
|
||||
|
||||
#define SIMPLE_MENU(title, tab, menu, lines_count, scrollbar_X) \
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
||||
if (!check_simple(event, menu, tab, DIM(tab), lines_count)) return; \
|
||||
drawMenuTemplate(title, event, scrollbar_X); \
|
||||
if (!check_simple(event, menu, tab, DIM(tab), lines_count)) return false; \
|
||||
drawMenuTemplate(title, scrollbar_X); \
|
||||
|
||||
#define SUBMENU(title, lines_count, scrollbar_X, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return; \
|
||||
drawMenuTemplate(title, event, scrollbar_X);
|
||||
if (!check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count)) return false; \
|
||||
drawMenuTemplate(title, scrollbar_X);
|
||||
|
||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||
if (!check_submenu_simple(event, lines_count)) return
|
||||
if (!check_submenu_simple(event, lines_count)) return false
|
||||
|
||||
#define SIMPLE_SUBMENU(title, lines_count, scrollbar_X) \
|
||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||
drawMenuTemplate(title, event, scrollbar_X)
|
||||
drawMenuTemplate(title, scrollbar_X)
|
||||
|
||||
typedef int select_menu_value_t;
|
||||
|
||||
@@ -250,7 +248,7 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e
|
||||
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
|
||||
#else
|
||||
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, evt_t event);
|
||||
#define displayGVar(x, y, v, min, max) lcd_outdez8(x, y, v)
|
||||
#define displayGVar(x, y, v, min, max) lcdDrawNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
void editName(coord_t x, coord_t y, char *name, uint8_t size, evt_t event, uint8_t active);
|
||||
@@ -272,9 +270,9 @@ extern uint8_t s_warning_type;
|
||||
#define POPUP_W 300
|
||||
#define POPUP_H 130
|
||||
#define WARNING_LINE_LEN 32
|
||||
#define WARNING_LINE_X (POPUP_X+86)
|
||||
#define WARNING_LINE_X (POPUP_X+76)
|
||||
#define WARNING_LINE_Y (POPUP_Y+9)
|
||||
#define WARNING_INFOLINE_Y (WARNING_LINE_Y+64)
|
||||
#define WARNING_INFOLINE_Y (WARNING_LINE_Y+68)
|
||||
|
||||
void displayBox();
|
||||
void displayPopup(const char *title);
|
||||
@@ -308,12 +306,9 @@ extern void (*menuHandler)(const char *result);
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(evt_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
|
||||
void menuChannelsView(evt_t event);
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
#define CURSOR_MOVED_LEFT(event) (event==EVT_ROTARY_LEFT || EVT_KEY_MASK(event) == KEY_LEFT)
|
||||
|
||||
@@ -222,7 +222,74 @@ uint8_t menuPageIndex;
|
||||
uint8_t menuPageCount;
|
||||
uint16_t linesCount;
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
bool navigate(evt_t event, int count, int rows, int columns)
|
||||
{
|
||||
int prevPosHorz = m_posHorz;
|
||||
int prevPosVert = m_posVert;
|
||||
|
||||
int maxrow = ((count+columns-1) / columns) - 1;
|
||||
int maxlastcol = count-maxrow*columns-1;
|
||||
int maxcol = (m_posVert != maxrow ? columns-1 : maxlastcol);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_REPT(KEY_RIGHT):
|
||||
INC(m_posHorz, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
DEC(m_posHorz, 0, maxcol);
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
INC(m_posVert, 0, maxrow);
|
||||
if (m_posVert == maxrow && m_posHorz > maxlastcol) {
|
||||
m_posHorz = maxlastcol;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
case EVT_KEY_REPT(KEY_UP):
|
||||
DEC(m_posVert, 0, maxrow);
|
||||
if (m_posVert == maxrow && m_posHorz > maxlastcol) {
|
||||
m_posHorz = maxlastcol;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (m_posHorz > 0) {
|
||||
m_posHorz--;
|
||||
}
|
||||
else {
|
||||
DEC(m_posVert, 0, maxrow);
|
||||
m_posHorz = (m_posVert != maxrow ? columns-1 : maxlastcol);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (m_posHorz < maxcol) {
|
||||
m_posHorz++;
|
||||
}
|
||||
else {
|
||||
INC(m_posVert, 0, maxrow);
|
||||
m_posHorz = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (s_pgOfs > m_posVert) {
|
||||
s_pgOfs = m_posVert;
|
||||
}
|
||||
else if (s_pgOfs <= m_posVert - rows) {
|
||||
s_pgOfs = m_posVert - rows + 1;
|
||||
}
|
||||
|
||||
return (prevPosHorz != m_posHorz || prevPosVert != m_posVert);
|
||||
}
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP * menuTab, uint8_t menuTabSize, const pm_uint8_t * horTab, uint8_t horTabMax, vertpos_t rowcount, uint8_t flags)
|
||||
{
|
||||
uint8_t maxcol = MAXCOL(m_posVert);
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ int16_t s_warning_input_max;
|
||||
|
||||
void displayAlertBox()
|
||||
{
|
||||
lcdDrawBlackOverlay();
|
||||
lcdClear();
|
||||
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
|
||||
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
|
||||
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
|
||||
@@ -57,7 +57,7 @@ void displayAlertBox()
|
||||
|
||||
void displayWarningBox()
|
||||
{
|
||||
lcdDrawBlackOverlay();
|
||||
// lcdDrawBlackOverlay();
|
||||
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
|
||||
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, ALARM_COLOR);
|
||||
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, ALARM_COLOR);
|
||||
@@ -66,7 +66,7 @@ void displayWarningBox()
|
||||
|
||||
void displayMessageBox()
|
||||
{
|
||||
lcdDrawBlackOverlay();
|
||||
// lcdDrawBlackOverlay();
|
||||
lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
|
||||
lcdDrawRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, SOLID, WARNING_COLOR);
|
||||
lcdDrawRect(POPUP_X+1, POPUP_Y+1, POPUP_W-2, POPUP_H-2, SOLID, WARNING_COLOR);
|
||||
@@ -85,9 +85,9 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+25, STR_WARNING, ALARM_COLOR|DBLSIZE);
|
||||
#endif
|
||||
|
||||
if (t) lcd_puts(WARNING_LINE_X, WARNING_INFOLINE_Y, t);
|
||||
if (t) lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y, t);
|
||||
if (last) {
|
||||
lcd_puts(WARNING_LINE_X, WARNING_INFOLINE_Y+12, last);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+16, last);
|
||||
AUDIO_ERROR_MESSAGE(sound);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ void message(const pm_char *title, const pm_char *t, const char *last MESSAGE_SO
|
||||
|
||||
void displayPopup(const char *title)
|
||||
{
|
||||
displayMessageBox();
|
||||
// displayMessageBox();
|
||||
lcdDrawTextWithLen(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR);
|
||||
lcdRefresh();
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void displayWarning(evt_t event)
|
||||
if (s_warning_info) {
|
||||
lcdDrawTextWithLen(WARNING_LINE_X, WARNING_INFOLINE_Y, s_warning_info, s_warning_info_len, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcd_puts(WARNING_LINE_X, WARNING_INFOLINE_Y+12, s_warning_type == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_INFOLINE_Y+20, s_warning_type == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_warning_type == WARNING_TYPE_ASTERISK)
|
||||
@@ -146,25 +146,6 @@ const char * displayMenu(evt_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
uint8_t display_count = min(s_menu_count, (uint16_t)MENU_MAX_LINES);
|
||||
int y = (LCD_H - (display_count*(FH+1))) / 2;
|
||||
|
||||
lcdDrawBlackOverlay();
|
||||
lcdDrawSolidFilledRect(MENU_X, y, MENU_W, display_count * (FH+1), TEXT_BGCOLOR);
|
||||
lcdDrawSolidRect(MENU_X, y, MENU_W, display_count * (FH+1) + 1, ALARM_COLOR);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
if (i == s_menu_item) {
|
||||
lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], TEXT_INVERTED_COLOR|s_menu_flags);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], s_menu_flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
drawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
case EVT_ROTARY_LEFT:
|
||||
@@ -215,5 +196,25 @@ const char * displayMenu(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
int y = (LCD_H - (display_count*(FH+1))) / 2;
|
||||
|
||||
// lcdDrawBlackOverlay();
|
||||
lcdDrawSolidFilledRect(MENU_X, y, MENU_W, display_count * (FH+1), TEXT_BGCOLOR);
|
||||
lcdDrawSolidRect(MENU_X, y, MENU_W, display_count * (FH+1) + 1, ALARM_COLOR);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
if (i == s_menu_item) {
|
||||
lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], TEXT_INVERTED_COLOR|s_menu_flags);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], s_menu_flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
drawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
const uint16_t LBM_SPLASH[] = {
|
||||
const uint8_t LBM_SPLASH[] = {
|
||||
#include "../../bitmaps/Horus/splash.lbm"
|
||||
};
|
||||
|
||||
@@ -50,7 +50,7 @@ void displaySplash()
|
||||
#if MENUS_LOCK == 1
|
||||
if (readonly == false) {
|
||||
lcdDrawSolidFilledRect((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 - 9, 50, (sizeof(TR_UNLOCKED)-1)*FW+16, 11, SOLID, ERASE|ROUND);
|
||||
lcd_puts((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED);
|
||||
lcdDrawText((LCD_W-(sizeof(TR_UNLOCKED)-1)*FW)/2 , 53, STR_UNLOCKED);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ enum AboutScreens {
|
||||
#define ABOUT_X 62
|
||||
#define ABOUT_INDENT 16
|
||||
|
||||
void menuAboutView(evt_t event)
|
||||
bool menuAboutView(evt_t event)
|
||||
{
|
||||
static uint8_t screenIndex = 0;
|
||||
static uint8_t greyIndex = 0;
|
||||
@@ -78,74 +78,74 @@ void menuAboutView(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
drawMenuTemplate("About", event);
|
||||
drawScreenTemplate("About");
|
||||
|
||||
uint8_t screenDuration = 150;
|
||||
|
||||
switch (screenIndex) {
|
||||
case ABOUT_OPENTX:
|
||||
case ABOUT_END:
|
||||
lcd_puts(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_OPENTX_1);
|
||||
lcd_puts(ABOUT_X, MENU_CONTENT_TOP + FH, STR_ABOUT_OPENTX_2);
|
||||
lcd_puts(ABOUT_X, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_OPENTX_3);
|
||||
lcd_puts(ABOUT_X, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_OPENTX_4);
|
||||
lcd_puts(ABOUT_X, MENU_CONTENT_TOP + 4*FH, STR_ABOUT_OPENTX_5);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_OPENTX_1);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + FH, STR_ABOUT_OPENTX_2);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_OPENTX_3);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_OPENTX_4);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP + 4*FH, STR_ABOUT_OPENTX_5);
|
||||
screenDuration = 255;
|
||||
break;
|
||||
|
||||
case ABOUT_BERTRAND:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_BERTRAND_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_BERTRAND_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_BERTRAND_3);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_BERTRAND_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_BERTRAND_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_BERTRAND_3);
|
||||
break;
|
||||
|
||||
case ABOUT_ANDRE:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_ANDRE_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ANDRE_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ANDRE_3);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ANDRE_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ANDRE_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ANDRE_3);
|
||||
break;
|
||||
|
||||
case ABOUT_MIKE:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_MIKE_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MIKE_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_MIKE_3);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_MIKE_4);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_MIKE_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MIKE_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_MIKE_3);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_MIKE_4);
|
||||
break;
|
||||
|
||||
case ABOUT_KJELL:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_KJELL_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_KJELL_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_KJELL_3);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_KJELL_4);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_KJELL_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_KJELL_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_KJELL_3);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_KJELL_4);
|
||||
break;
|
||||
|
||||
case ABOUT_MARTIN:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_MARTIN_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MARTIN_2);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_MARTIN_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_MARTIN_2);
|
||||
break;
|
||||
|
||||
case ABOUT_ROMOLO:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_ROMOLO_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROMOLO_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ROMOLO_3);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ROMOLO_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROMOLO_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_ROMOLO_3);
|
||||
break;
|
||||
|
||||
case ABOUT_ROB:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_ROB_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROB_2);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_ROB_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_ROB_2);
|
||||
break;
|
||||
|
||||
case ABOUT_HARDWARE:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, "FrSky", INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_HARDWARE_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_HARDWARE_3);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, "FrSky", INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_HARDWARE_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_HARDWARE_3);
|
||||
break;
|
||||
|
||||
case ABOUT_PARENTS:
|
||||
lcdDrawText(ABOUT_X, MENU_HEADER_HEIGHT+1, STR_ABOUT_PARENTS_1, INVERS);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_PARENTS_2);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_PARENTS_3);
|
||||
lcd_puts(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_PARENTS_4);
|
||||
lcdDrawText(ABOUT_X, MENU_CONTENT_TOP, STR_ABOUT_PARENTS_1, INVERS);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + FH, STR_ABOUT_PARENTS_2);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 2*FH, STR_ABOUT_PARENTS_3);
|
||||
lcdDrawText(ABOUT_X+ABOUT_INDENT, MENU_CONTENT_TOP + 3*FH, STR_ABOUT_PARENTS_4);
|
||||
screenDuration = 255;
|
||||
break;
|
||||
}
|
||||
@@ -156,4 +156,6 @@ void menuAboutView(evt_t event)
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
bool isChannelUsed(int channel);
|
||||
int getChannelsUsed();
|
||||
|
||||
void menuChannelsView(evt_t event)
|
||||
bool menuChannelsView(evt_t event)
|
||||
{
|
||||
const int CHANNEL_MARGIN = 16;
|
||||
const int CHANNEL_HEIGHT = 25;
|
||||
@@ -110,13 +110,15 @@ void menuChannelsView(evt_t event)
|
||||
// Value
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
lcd_outdezAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE); // G: Don't like the decimal part*
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE); // G: Don't like the decimal part*
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -36,13 +36,23 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define TRIM_LH_X 90
|
||||
#define TRIM_LV_X 24
|
||||
#define TRIM_RV_X (LCD_W-35)
|
||||
#define TRIM_RH_X (LCD_W-95)
|
||||
#define TRIM_V_Y 135
|
||||
#define TRIM_H_Y 235
|
||||
#define TRIM_LEN 80
|
||||
#define TRIM_LH_X 90
|
||||
#define TRIM_LV_X 24
|
||||
#define TRIM_RV_X (LCD_W-35)
|
||||
#define TRIM_RH_X (LCD_W-95)
|
||||
#define TRIM_V_Y 135
|
||||
#define TRIM_H_Y 235
|
||||
#define TRIM_LEN 80
|
||||
|
||||
#define MODELPANEL_LEFT 240
|
||||
#define MODELPANEL_TOP 68
|
||||
#define MODELPANEL_WIDTH MODEL_BITMAP_WIDTH
|
||||
#define MODELPANEL_HEIGHT 135
|
||||
|
||||
#define TIMER1PANEL_LEFT 46
|
||||
#define TIMER1PANEL_TOP 55
|
||||
#define TIMER2PANEL_LEFT TIMER1PANEL_LEFT
|
||||
#define TIMER2PANEL_TOP 134
|
||||
|
||||
void drawTrimSquare(coord_t x, coord_t y)
|
||||
{
|
||||
@@ -140,7 +150,7 @@ void drawTrims(uint8_t flightMode)
|
||||
drawVerticalTrimPosition(xm-1, ym-6, val);
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
// TODO lcd_outdezAtt(trim>0 ? 100 : 200, xm-2, trim, TINSIZE|VERTICAL);
|
||||
// TODO lcdDrawNumber(trim>0 ? 100 : 200, xm-2, trim, TINSIZE|VERTICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,7 +161,7 @@ void drawTrims(uint8_t flightMode)
|
||||
drawHorizontalTrimPosition(xm-3, ym-2, val);
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcd_outdezAtt((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+2, trim, TINSIZE);
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+2, trim, TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,11 +176,11 @@ void drawTimer(coord_t x, coord_t y, int index)
|
||||
if (timerData.start) {
|
||||
lcdDrawBitmapPatternPie(x+2, y+3, LBM_RSCALE, TITLE_BGCOLOR, 0, timerState.val <= 0 ? 360 : 360*(timerData.start-timerState.val)/timerData.start);
|
||||
}
|
||||
putsTimer(x+74, y+31, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
|
||||
putsTimer(x+76, y+31, abs(timerState.val), TEXT_COLOR|DBLSIZE|LEFT);
|
||||
if (ZLEN(timerData.name) > 0) {
|
||||
lcdDrawTextWithLen(x+74, y+20, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE|TEXT_COLOR);
|
||||
lcdDrawTextWithLen(x+78, y+20, timerData.name, LEN_TIMER_NAME, ZCHAR|SMLSIZE|TEXT_COLOR);
|
||||
}
|
||||
putsStrIdx(x+137, y+17, "TMR", 1, SMLSIZE|TEXT_COLOR);
|
||||
putsStrIdx(x+137, y+17, "TMR", index+1, SMLSIZE|TEXT_COLOR);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,16 +290,7 @@ void onMainViewMenu(const char *result)
|
||||
}
|
||||
}
|
||||
|
||||
const uint16_t LBM_MAINVIEW_FLAT[] = {
|
||||
#include "../../bitmaps/Horus/mainview_flat.lbm"
|
||||
};
|
||||
|
||||
const uint16_t LBM_CORSAIR[] = {
|
||||
#include "../../bitmaps/Horus/corsair.lbm"
|
||||
};
|
||||
|
||||
|
||||
void menuMainView(evt_t event)
|
||||
bool menuMainView(evt_t event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
@@ -298,6 +299,10 @@ void menuMainView(evt_t event)
|
||||
killEvents(KEY_DOWN);
|
||||
break;
|
||||
|
||||
case EVT_ENTRY_UP:
|
||||
LOAD_MODEL_BITMAP();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_MODEL_SELECT);
|
||||
@@ -341,14 +346,13 @@ void menuMainView(evt_t event)
|
||||
}
|
||||
|
||||
lcdDrawBitmap(0, 0, LBM_MAINVIEW_BACKGROUND);
|
||||
// lcdDrawBitmap(0, 0, LBM_MAINVIEW_FLAT);
|
||||
|
||||
// Header
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
|
||||
drawTopmenuDatetime();
|
||||
if (1 || usbPlugged()) {
|
||||
if (usbPlugged()) {
|
||||
lcdDrawBitmapPattern(378, 8, LBM_TOPMENU_USB, MENU_TITLE_COLOR);
|
||||
}
|
||||
const uint8_t rssiBarsValue[] = { 30, 40, 50, 60, 80 };
|
||||
@@ -358,7 +362,6 @@ void menuMainView(evt_t event)
|
||||
lcdDrawSolidFilledRect(390+i*6, 38-height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? MENU_TITLE_COLOR : MENU_TITLE_DISABLE_COLOR);
|
||||
}
|
||||
|
||||
|
||||
// Flight Mode Name
|
||||
int mode = mixerCurrentFlightMode;
|
||||
for (int i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
@@ -375,15 +378,21 @@ void menuMainView(evt_t event)
|
||||
drawTrims(mode);
|
||||
|
||||
// Model panel
|
||||
lcdDrawFilledRect(248, 58, 188, 158, SOLID, TEXT_BGCOLOR | OPACITY(5));
|
||||
lcdDrawBitmapPattern(256, 62, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
||||
lcdDrawTextWithLen(293, 68, g_model.header.name, LEN_MODEL_NAME, ZCHAR|SMLSIZE);
|
||||
lcdDrawSolidHorizontalLine(287, 85, 140, TITLE_BGCOLOR);
|
||||
lcdDrawBitmap(256, 104, LBM_CORSAIR);
|
||||
lcdDrawFilledRect(MODELPANEL_LEFT, MODELPANEL_TOP, MODELPANEL_WIDTH, MODELPANEL_HEIGHT, SOLID, TEXT_BGCOLOR | OPACITY(5));
|
||||
lcdDrawBitmapPattern(MODELPANEL_LEFT+6, MODELPANEL_TOP+4, LBM_MODEL_ICON, TITLE_BGCOLOR);
|
||||
lcdDrawTextWithLen(MODELPANEL_LEFT+45, MODELPANEL_TOP+10, g_model.header.name, LEN_MODEL_NAME, ZCHAR|SMLSIZE);
|
||||
lcdDrawSolidHorizontalLine(MODELPANEL_LEFT+39, MODELPANEL_TOP+27, MODELPANEL_WIDTH-48, TITLE_BGCOLOR);
|
||||
int scale = getBitmapScale(modelBitmap, MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT);
|
||||
int width = getBitmapScaledSize(getBitmapWidth(modelBitmap), scale);
|
||||
int height = getBitmapScaledSize(getBitmapHeight(modelBitmap), scale);
|
||||
lcdDrawBitmap(MODELPANEL_LEFT+(MODEL_BITMAP_WIDTH-width)/2, MODELPANEL_TOP+MODELPANEL_HEIGHT-MODEL_BITMAP_HEIGHT/2-height/2, modelBitmap, 0, 0, scale);
|
||||
|
||||
// Timer 1
|
||||
// Timers
|
||||
if (g_model.timers[0].mode) {
|
||||
drawTimer(50, 61, 0);
|
||||
drawTimer(TIMER1PANEL_LEFT, TIMER1PANEL_TOP, 0);
|
||||
}
|
||||
if (g_model.timers[1].mode) {
|
||||
drawTimer(TIMER2PANEL_LEFT, TIMER2PANEL_TOP, 1);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -392,18 +401,20 @@ void menuMainView(evt_t event)
|
||||
displayMessageBox();
|
||||
putsStrIdx(WARNING_LINE_X, WARNING_LINE_Y, STR_GV, s_gvar_last+1, DBLSIZE|YELLOW);
|
||||
lcdDrawTextWithLen(WARNING_LINE_X+45, WARNING_LINE_Y, g_model.gvars[s_gvar_last].name, LEN_GVAR_NAME, DBLSIZE|YELLOW|ZCHAR);
|
||||
lcd_outdezAtt(WARNING_LINE_X, WARNING_INFOLINE_Y, GVAR_VALUE(s_gvar_last, getGVarFlightPhase(mixerCurrentFlightMode, s_gvar_last)), DBLSIZE|LEFT);
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y, GVAR_VALUE(s_gvar_last, getGVarFlightPhase(mixerCurrentFlightMode, s_gvar_last)), DBLSIZE|LEFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void menuMainViewChannelsMonitor(evt_t event)
|
||||
bool menuMainViewChannelsMonitor(evt_t event)
|
||||
{
|
||||
switch(event) {
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
event = 0;
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
return menuChannelsView(event);
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
void menuStatisticsView(evt_t event)
|
||||
bool menuStatisticsView(evt_t event)
|
||||
{
|
||||
switch(event) {
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
chainMenu(menuStatisticsDebug);
|
||||
return;
|
||||
return false;
|
||||
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
g_eeGeneral.globalTimer = 0;
|
||||
@@ -51,10 +51,10 @@ void menuStatisticsView(evt_t event)
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
drawMenuTemplate("Statistics", event);
|
||||
drawScreenTemplate("Statistics");
|
||||
|
||||
lcdDrawText( 10, MENU_CONTENT_TOP + FH*0, "\037\145TOT:\037\317BATT:", HEADER_COLOR);
|
||||
lcdDrawText( 10, MENU_CONTENT_TOP + FH*1, "TM1:\037\145TM2:", HEADER_COLOR);
|
||||
@@ -84,6 +84,8 @@ void menuStatisticsView(evt_t event)
|
||||
if (traceRd==s_traceWr) break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define MENU_DEBUG_COL1_OFS (11*10-2)
|
||||
@@ -93,10 +95,8 @@ void menuStatisticsView(evt_t event)
|
||||
#define MENU_DEBUG_Y_STACK (MENU_CONTENT_TOP + 5*FH)
|
||||
#define MENU_DEBUG_Y_RTOS (MENU_CONTENT_TOP + 6*FH)
|
||||
|
||||
void menuStatisticsDebug(evt_t event)
|
||||
bool menuStatisticsDebug(evt_t event)
|
||||
{
|
||||
drawMenuTemplate(STR_MENUDEBUG, event);
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
@@ -107,6 +107,7 @@ void menuStatisticsDebug(evt_t event)
|
||||
killEvents(event);
|
||||
AUDIO_KEYPAD_UP();
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
#if defined(LUA)
|
||||
maxLuaInterval = 0;
|
||||
@@ -119,48 +120,52 @@ void menuStatisticsDebug(evt_t event)
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
pushMenu(menuTraceBuffer);
|
||||
return;
|
||||
return false;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
chainMenu(menuStatisticsView);
|
||||
break;
|
||||
return false;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
drawScreenTemplate(STR_MENUDEBUG);
|
||||
|
||||
lcd_putsLeft(MENU_DEBUG_Y_FREE_RAM, "Free Mem");
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT, "b");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_FREE_RAM, availableMemory(), LEFT, 0, NULL, "b");
|
||||
|
||||
#if defined(LUA)
|
||||
lcd_putsLeft(MENU_DEBUG_Y_LUA, "Lua scripts");
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_LUA+1, "[Duration]", HEADER_COLOR|SMLSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_LUA, 10*maxLuaDuration, LEFT);
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS+60, MENU_DEBUG_Y_LUA+1, "[Interval]", HEADER_COLOR|SMLSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_LUA, 10*maxLuaInterval, LEFT);
|
||||
#endif
|
||||
|
||||
lcd_putsLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, "ms");
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT, 0, NULL, "ms");
|
||||
|
||||
lcd_putsLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS+1, "[Menus]", HEADER_COLOR|SMLSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_RTOS, menusStack.available(), LEFT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+30, MENU_DEBUG_Y_RTOS, menusStack.available(), LEFT);
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS+60, MENU_DEBUG_Y_RTOS+1, "[Mix]", HEADER_COLOR|SMLSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_RTOS, mixerStack.available(), LEFT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+90, MENU_DEBUG_Y_RTOS, mixerStack.available(), LEFT);
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS+120, MENU_DEBUG_Y_RTOS+1, "[Audio]", HEADER_COLOR|SMLSIZE);
|
||||
lcd_outdezAtt(MENU_DEBUG_COL1_OFS+150, MENU_DEBUG_Y_RTOS, audioStack.available(), LEFT);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS+150, MENU_DEBUG_Y_RTOS, audioStack.available(), LEFT);
|
||||
|
||||
lcd_putsCenter(7*FH+1, STR_MENUTORESET);
|
||||
// lcd_status_line();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(DEBUG_TRACE_BUFFER)
|
||||
#include "stamp-opentx.h"
|
||||
|
||||
void menuTraceBuffer(evt_t event)
|
||||
bool menuTraceBuffer(evt_t event)
|
||||
{
|
||||
switch(event)
|
||||
{
|
||||
@@ -171,6 +176,7 @@ void menuTraceBuffer(evt_t event)
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU("Trace Buffer " VERS_STR, TRACE_BUFFER_LEN);
|
||||
|
||||
/* RTC time */
|
||||
struct gtm t;
|
||||
gettime(&t);
|
||||
@@ -181,16 +187,16 @@ void menuTraceBuffer(evt_t event)
|
||||
int8_t sub = m_posVert;
|
||||
|
||||
lcdDrawChar(0, FH, '#', TEXT_COLOR);
|
||||
lcd_puts(4*10, FH, "Time");
|
||||
lcd_puts(14*10, FH, "Event");
|
||||
lcd_puts(20*10, FH, "Data");
|
||||
lcdDrawText(4*10, FH, "Time");
|
||||
lcdDrawText(14*10, FH, "Event");
|
||||
lcdDrawText(20*10, FH, "Data");
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-2; i++) {
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
y = 1 + (i+2)*FH;
|
||||
k = i+s_pgOfs;
|
||||
|
||||
//item
|
||||
lcd_outdezAtt(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
// item
|
||||
lcdDrawNumber(0, y, k, LEFT | (sub==k ? INVERS : 0));
|
||||
|
||||
const struct TraceElement * te = getTraceElement(k);
|
||||
if (te) {
|
||||
@@ -198,7 +204,7 @@ void menuTraceBuffer(evt_t event)
|
||||
putstime_t tme = te->time % SECS_PER_DAY;
|
||||
putsTimer(4*10, y, tme, TIMEHOUR|LEFT);
|
||||
//event
|
||||
lcd_outdezNAtt(14*10, y, te->event, LEADING0|LEFT, 3);
|
||||
lcdDrawNumber(14*10, y, te->event, LEADING0|LEFT, 3);
|
||||
//data
|
||||
lcd_putsn (20*10, y, "0x", 2);
|
||||
lcd_outhex4(22*10-2, y, (uint16_t)(te->data >> 16));
|
||||
@@ -207,6 +213,6 @@ void menuTraceBuffer(evt_t event)
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif //#if defined(DEBUG_TRACE_BUFFER)
|
||||
#endif // defined(DEBUG_TRACE_BUFFER)
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#define TEXT_FILE_MAXSIZE 2048
|
||||
|
||||
char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
char s_text_screen[LCD_LINES-1][LCD_COLS+1];
|
||||
char s_text_screen[NUM_BODY_LINES][LCD_COLS+1];
|
||||
|
||||
void readTextFile(int & lines_count)
|
||||
{
|
||||
@@ -56,13 +56,13 @@ void readTextFile(int & lines_count)
|
||||
|
||||
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-s_pgOfs<LCD_LINES-1); i++) {
|
||||
for (int i=0; i<TEXT_FILE_MAXSIZE && f_read(&file, &c, 1, &sz)==FR_OK && sz==1 && (lines_count==0 || current_line-s_pgOfs<NUM_BODY_LINES); i++) {
|
||||
if (c == '\n') {
|
||||
++current_line;
|
||||
line_length = 0;
|
||||
escape = 0;
|
||||
}
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<LCD_LINES-1 && line_length<LCD_COLS) {
|
||||
else if (c!='\r' && current_line>=s_pgOfs && current_line-s_pgOfs<NUM_BODY_LINES && line_length<LCD_COLS) {
|
||||
if (c=='\\' && escape==0) {
|
||||
escape = 1;
|
||||
continue;
|
||||
@@ -103,11 +103,11 @@ void readTextFile(int & lines_count)
|
||||
}
|
||||
}
|
||||
|
||||
void menuTextView(evt_t event)
|
||||
bool menuTextView(evt_t event)
|
||||
{
|
||||
static int lines_count;
|
||||
|
||||
drawMenuTemplate("TEXT VIEWER", event);
|
||||
drawMenuTemplate("TEXT VIEWER");
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
@@ -138,7 +138,7 @@ void menuTextView(evt_t event)
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
lcd_puts(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
|
||||
}
|
||||
|
||||
char *title = s_text_file;
|
||||
@@ -147,9 +147,9 @@ void menuTextView(evt_t event)
|
||||
#endif
|
||||
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
|
||||
if (lines_count > NUM_BODY_LINES) {
|
||||
drawScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||
}
|
||||
drawScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void pushMenuTextView(const char *filename)
|
||||
|
||||
@@ -106,12 +106,14 @@ void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
|
||||
void drawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
|
||||
coord_t yofs = (h*offset + count/2) / count;
|
||||
coord_t yhgt = (h*visible + count/2) / count;
|
||||
if (yhgt + yofs > h)
|
||||
yhgt = h - yofs;
|
||||
lcdDrawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
|
||||
if (visible < count) {
|
||||
lcdDrawSolidVerticalLine(x, y, h, LINE_COLOR);
|
||||
coord_t yofs = (h*offset + count/2) / count;
|
||||
coord_t yhgt = (h*visible + count/2) / count;
|
||||
if (yhgt + yofs > h)
|
||||
yhgt = h - yofs;
|
||||
lcdDrawSolidFilledRect(x-1, y + yofs, 3, yhgt, SCROLLBOX_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawProgressBar(const char *label)
|
||||
@@ -130,9 +132,38 @@ void updateProgressBar(int num, int den)
|
||||
}
|
||||
}
|
||||
|
||||
void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h)
|
||||
{
|
||||
lcdDrawSolidVerticalLine(x+w, y+1, h, TEXT_COLOR);
|
||||
lcdDrawSolidHorizontalLine(x+1, y+h, w, TEXT_COLOR);
|
||||
lcdDrawSolidVerticalLine(x+w+1, y+2, h, LINE_COLOR);
|
||||
lcdDrawSolidHorizontalLine(x+2, y+h+1, w, LINE_COLOR);
|
||||
}
|
||||
|
||||
void drawScreenTemplate(const char * title)
|
||||
{
|
||||
// Header
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOPMENU_POLYGON, TITLE_BGCOLOR);
|
||||
drawTopmenuDatetime();
|
||||
|
||||
lcdDrawBitmapPattern(4, 10, LBM_TOPMENU_OPENTX, MENU_TITLE_COLOR);
|
||||
|
||||
if (title) {
|
||||
// must be done at the end so that we can write something at the right of the menu title
|
||||
lcdDrawText(50, 3, title, MENU_TITLE_COLOR|DBLSIZE);
|
||||
}
|
||||
|
||||
// Body
|
||||
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
|
||||
|
||||
// Footer
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
|
||||
#define MENU_ICONS_SPACING 31
|
||||
|
||||
void drawMenuTemplate(const char * name, evt_t event, uint16_t scrollbar_X)
|
||||
void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
{
|
||||
// clear the screen
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
@@ -257,7 +288,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(x, y, value, attr, "%");
|
||||
lcdDrawNumber(x, y, value, attr, 0, NULL, "%");
|
||||
if (invers) value = checkIncDec(event, value, min, max, EE_MODEL | editflags);
|
||||
}
|
||||
return value;
|
||||
@@ -266,7 +297,7 @@ int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t m
|
||||
int16_t gvarMenuItem(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, evt_t event)
|
||||
{
|
||||
if (attr & INVERS) value = checkIncDec(event, value, min, max, EE_MODEL);
|
||||
lcd_outdezAtt(x, y, value, attr, "%");
|
||||
lcdDrawNumber(x, y, value, attr, 0, NULL, "%");
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -325,12 +325,12 @@ void lcd_outdez8(coord_t x, coord_t y, int8_t val)
|
||||
lcd_outdezAtt(x, y, val);
|
||||
}
|
||||
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags)
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, int32_t val, LcdFlags flags)
|
||||
{
|
||||
lcd_outdezNAtt(x, y, val, flags);
|
||||
}
|
||||
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t len)
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, int32_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
uint8_t fw = FWNUM;
|
||||
int8_t mode = MODE(flags);
|
||||
@@ -356,7 +356,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
|
||||
if (mode != MODE(LEADING0)) {
|
||||
len = 1;
|
||||
lcduint_t tmp = ((lcduint_t)val) / 10;
|
||||
int32_t tmp = val / 10;
|
||||
while (tmp) {
|
||||
len++;
|
||||
tmp /= 10;
|
||||
@@ -400,7 +400,7 @@ void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t
|
||||
if (dblsize) x++;
|
||||
|
||||
for (uint8_t i=1; i<=len; i++) {
|
||||
div_t qr = div((lcduint_t)val, 10);
|
||||
div_t qr = div(val, 10);
|
||||
char c = qr.rem + '0';
|
||||
LcdFlags f = flags;
|
||||
lcdDrawChar(x, y, c, f);
|
||||
@@ -875,7 +875,7 @@ const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_DIST, // GPS Alt
|
||||
};
|
||||
|
||||
void putsValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
void putsValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
lcd_outdezAtt(x, y, val, att & (~NO_UNIT));
|
||||
@@ -956,7 +956,7 @@ void displayGpsCoords(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFl
|
||||
}
|
||||
}
|
||||
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t value, LcdFlags att)
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, int32_t value, LcdFlags att)
|
||||
{
|
||||
TelemetryItem & telemetryItem = telemetryItems[channel];
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[channel];
|
||||
@@ -976,7 +976,7 @@ void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t v
|
||||
}
|
||||
}
|
||||
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t value, LcdFlags att)
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, int32_t value, LcdFlags att)
|
||||
{
|
||||
if (channel >= MIXSRC_FIRST_TELEM) {
|
||||
channel = (channel-MIXSRC_FIRST_TELEM) / 3;
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#define CONTRAST_MAX 45
|
||||
|
||||
#define lcdint_t int32_t
|
||||
#define lcduint_t uint32_t
|
||||
|
||||
#define FW 6
|
||||
#define FWNUM 5
|
||||
@@ -156,8 +155,8 @@ void lcd_putsLeft(coord_t y, const pm_char * s);
|
||||
|
||||
void lcd_outhex4(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
|
||||
void lcd_outdezNAtt(coord_t x, coord_t y, int32_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
void lcd_outdezAtt(coord_t x, coord_t y, int32_t val, LcdFlags mode=0);
|
||||
void lcd_outdez8(coord_t x, coord_t y, int8_t val);
|
||||
|
||||
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
@@ -180,9 +179,9 @@ void putsVolts(coord_t x, coord_t y, uint16_t volts, LcdFlags att);
|
||||
void putsVBat(coord_t x, coord_t y, LcdFlags att);
|
||||
|
||||
#if !defined(BOOT)
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, lcdint_t val, LcdFlags att=0);
|
||||
void putsChannelValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags att=0);
|
||||
void putsChannel(coord_t x, coord_t y, source_t channel, LcdFlags att=0);
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
|
||||
void putsTelemetryChannelValue(coord_t x, coord_t y, uint8_t channel, int32_t val, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#define putstime_t int32_t
|
||||
@@ -232,8 +231,8 @@ void lcdSetContrast();
|
||||
void lcdRefresh();
|
||||
#endif
|
||||
|
||||
const char *bmpLoad(uint8_t *dest, const char *filename, const unsigned int width, const unsigned int height);
|
||||
const char *writeScreenshot();
|
||||
const char * bmpLoad(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||
const char * writeScreenshot();
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
@@ -241,14 +240,4 @@ const char *writeScreenshot();
|
||||
#define BLINK_ON_PHASE (g_blinkTmr10ms & (1<<6))
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
extern bool lcd_refresh;
|
||||
extern display_t lcd_buf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
char *strAppend(char * dest, const char * source, int len=0);
|
||||
char *strSetCursor(char *dest, int position);
|
||||
char *strAppendDate(char * str, bool time=false);
|
||||
char *strAppendFilename(char * dest, const char * filename, const int size);
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
||||
@@ -88,7 +88,7 @@ enum EnumTabDiag {
|
||||
e_Calib
|
||||
};
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabGeneral[] PROGMEM = {
|
||||
const MenuFuncP menuTabGeneral[] = {
|
||||
menuGeneralSetup,
|
||||
menuGeneralSdManager,
|
||||
menuGeneralCustomFunctions,
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#define IS_DIRECTORY(fname) ((bool)(!NODE_TYPE(fname)))
|
||||
#define IS_FILE(fname) ((bool)(NODE_TYPE(fname)))
|
||||
|
||||
void menuGeneralSdManagerInfo(uint8_t event)
|
||||
void menuGeneralSdManagerInfo(evt_t event)
|
||||
{
|
||||
SIMPLE_SUBMENU(STR_SD_INFO_TITLE, 1);
|
||||
|
||||
@@ -181,13 +181,13 @@ void onSdManagerMenu(const char *result)
|
||||
strcat(lfn, line);
|
||||
}
|
||||
if (strcmp(clipboard.data.sd.directory, lfn)) { // prevent copying to the same directory
|
||||
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, lfn));
|
||||
POPUP_WARNING(sdCopyFile(clipboard.data.sd.filename, clipboard.data.sd.directory, clipboard.data.sd.filename, lfn));
|
||||
REFRESH_FILES();
|
||||
}
|
||||
}
|
||||
else if (result == STR_RENAME_FILE) {
|
||||
memcpy(reusableBuffer.sdmanager.originalName, line, sizeof(reusableBuffer.sdmanager.originalName));
|
||||
char *ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
char * ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext) {
|
||||
// write spaces to allow a longer filename
|
||||
memset(ext, ' ', SD_SCREEN_FILE_LENGTH-LEN_FILE_EXTENSION-(ext-line));
|
||||
@@ -243,7 +243,7 @@ void onSdManagerMenu(const char *result)
|
||||
#endif
|
||||
}
|
||||
|
||||
void menuGeneralSdManager(uint8_t _event)
|
||||
void menuGeneralSdManager(evt_t _event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
@@ -261,7 +261,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
|
||||
int lastPos = m_posVert;
|
||||
|
||||
uint8_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||
evt_t event = (EVT_KEY_MASK(_event) == KEY_ENTER ? 0 : _event);
|
||||
SIMPLE_MENU(SD_IS_HC() ? STR_SDHC_CARD : STR_SD_CARD, menuTabGeneral, e_Sd, reusableBuffer.sdmanager.count);
|
||||
|
||||
int index = m_posVert-s_pgOfs;
|
||||
@@ -306,8 +306,8 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (s_editMode == 0) {
|
||||
killEvents(_event);
|
||||
char *line = reusableBuffer.sdmanager.lines[index];
|
||||
char *ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
char * line = reusableBuffer.sdmanager.lines[index];
|
||||
char * ext = getFileExtension(line, SD_SCREEN_FILE_LENGTH+1);
|
||||
if (!strcmp(line, "..")) {
|
||||
break; // no menu for parent dir
|
||||
}
|
||||
@@ -341,7 +341,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
if (!READ_ONLY()) {
|
||||
if (IS_FILE(line)) // it's a file
|
||||
if (IS_FILE(line))
|
||||
MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
MENU_ADD_ITEM(STR_PASTE);
|
||||
@@ -366,17 +366,17 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
reusableBuffer.sdmanager.offset = 0;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs == reusableBuffer.sdmanager.count-7) {
|
||||
else if (s_pgOfs == reusableBuffer.sdmanager.count-NUM_BODY_LINES) {
|
||||
reusableBuffer.sdmanager.offset = s_pgOfs;
|
||||
memset(reusableBuffer.sdmanager.lines, 0, sizeof(reusableBuffer.sdmanager.lines));
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], 6*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[6], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[6]) = 1;
|
||||
memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0xff, SD_SCREEN_FILE_LENGTH);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = 1;
|
||||
}
|
||||
else {
|
||||
memmove(reusableBuffer.sdmanager.lines[1], reusableBuffer.sdmanager.lines[0], 6*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memmove(reusableBuffer.sdmanager.lines[1], reusableBuffer.sdmanager.lines[0], (NUM_BODY_LINES-1)*sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
memset(reusableBuffer.sdmanager.lines[0], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameLower(isfile, fn, line)) {
|
||||
if (i < 6) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (6-i));
|
||||
if (i < NUM_BODY_LINES-1) memmove(reusableBuffer.sdmanager.lines[i+1], line, sizeof(reusableBuffer.sdmanager.lines[i]) * (NUM_BODY_LINES-1-i));
|
||||
memset(line, 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(line, fn);
|
||||
NODE_TYPE(line) = isfile;
|
||||
@@ -412,7 +412,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.sdmanager.offset == s_pgOfs) {
|
||||
for (int8_t i=6; i>=0; i--) {
|
||||
for (int8_t i=NUM_BODY_LINES-1; i>=0; i--) {
|
||||
char *line = reusableBuffer.sdmanager.lines[i];
|
||||
if (line[0] == '\0' || isFilenameGreater(isfile, fn, line)) {
|
||||
if (i > 0) memmove(reusableBuffer.sdmanager.lines[0], reusableBuffer.sdmanager.lines[1], sizeof(reusableBuffer.sdmanager.lines[0]) * i);
|
||||
@@ -424,10 +424,10 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
else if (s_pgOfs > reusableBuffer.sdmanager.offset) {
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[5]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[6])) {
|
||||
memset(reusableBuffer.sdmanager.lines[6], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[6], fn);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[6]) = isfile;
|
||||
if (isFilenameGreater(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-2]) && isFilenameLower(isfile, fn, reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1])) {
|
||||
memset(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], 0, sizeof(reusableBuffer.sdmanager.lines[0]));
|
||||
strcpy(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1], fn);
|
||||
NODE_TYPE(reusableBuffer.sdmanager.lines[NUM_BODY_LINES-1]) = isfile;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -471,7 +471,7 @@ void menuGeneralSdManager(uint8_t _event)
|
||||
}
|
||||
}
|
||||
|
||||
char *ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
|
||||
char * ext = getFileExtension(reusableBuffer.sdmanager.lines[index], SD_SCREEN_FILE_LENGTH+1);
|
||||
if (ext && !strcasecmp(ext, BITMAPS_EXT)) {
|
||||
if (lastPos != m_posVert) {
|
||||
if (bmpLoad(modelBitmap, reusableBuffer.sdmanager.lines[index], MODEL_BITMAP_WIDTH, MODEL_BITMAP_HEIGHT)) {
|
||||
|
||||
@@ -85,7 +85,7 @@ void menuGeneralVersion(uint8_t event)
|
||||
{
|
||||
if (s_warning_result) {
|
||||
s_warning_result = 0;
|
||||
displayPopup(STR_EEPROMFORMATTING);
|
||||
displayPopup(STR_STORAGE_FORMAT);
|
||||
storageEraseAll(false);
|
||||
#if !defined(SIMU)
|
||||
NVIC_SystemReset();
|
||||
|
||||
@@ -108,7 +108,7 @@ uint8_t editDelay(const coord_t y, const uint8_t event, const uint8_t attr, cons
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
#endif
|
||||
|
||||
const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = {
|
||||
const MenuFuncP menuTabModel[] = {
|
||||
menuModelSelect,
|
||||
menuModelSetup,
|
||||
CASE_HELI(menuModelHeli)
|
||||
|
||||
@@ -66,9 +66,8 @@ extern uint8_t calibrationState;
|
||||
void menu_lcd_onoff(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
typedef void (*MenuFuncP)(uint8_t event);
|
||||
typedef void (*MenuFuncP_PROGMEM)(uint8_t event);
|
||||
extern const MenuFuncP_PROGMEM menuTabModel[];
|
||||
extern const MenuFuncP_PROGMEM menuTabGeneral[];
|
||||
extern const MenuFuncP menuTabModel[];
|
||||
extern const MenuFuncP menuTabGeneral[];
|
||||
|
||||
extern MenuFuncP g_menuStack[5];
|
||||
extern uint8_t g_menuPos[4];
|
||||
|
||||
@@ -51,4 +51,9 @@
|
||||
#include "9X/gui.h"
|
||||
#endif
|
||||
|
||||
#if defined(SIMU)
|
||||
extern bool simuLcdRefresh;
|
||||
extern display_t simuLcdBuf[DISPLAY_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
#endif // _GUI_H_
|
||||
|
||||
Reference in New Issue
Block a user