Massive clean thanks to Schwabe : unifdef -m -DCPUARM -UCPUM64 -UCPUM2560 -UPCBSTD -UPCBMEGA2560 -UPCBGRUVIN9X -UPCB9X $(find . -name "*.cpp" -or -name "*.h")
This commit is contained in:
@@ -21,11 +21,7 @@
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar font_5x7[] PROGMEM = {
|
||||
#if defined (CPUARM)
|
||||
#include "font_05x07.lbm"
|
||||
#else
|
||||
#include "font_05x07_avr.lbm"
|
||||
#endif
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_05x07.lbm"
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
@@ -56,7 +52,6 @@ const pm_uchar font_5x7_B[] PROGMEM = {
|
||||
#if !defined(BOOT)
|
||||
const pm_uchar font_10x14[] PROGMEM = {
|
||||
#include "font_10x14_compressed.lbm"
|
||||
#if defined(CPUARM)
|
||||
#if defined(TRANSLATIONS_DE)
|
||||
#include "font_de_10x14.lbm"
|
||||
#elif defined(TRANSLATIONS_CZ)
|
||||
@@ -76,7 +71,6 @@ const pm_uchar font_10x14[] PROGMEM = {
|
||||
#elif defined(TRANSLATIONS_SE)
|
||||
#include "font_se_10x14.lbm"
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -54,14 +54,7 @@ extern uint8_t noHighlightCounter;
|
||||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
#elif defined(GRAPHICS)
|
||||
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr);
|
||||
#define drawSlider(x, y, value, max, attr) lcdDrawNumber(x, y, value, attr|LEFT)
|
||||
#else
|
||||
#define drawSlider(x, y, value, max, attr) lcdDrawNumber(x, y, value, attr|LEFT)
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
extern int16_t p1valdiff;
|
||||
@@ -92,28 +85,15 @@ extern int8_t s_editMode; // global editmode
|
||||
#define INCDEC_REP10 0x40
|
||||
#define NO_DBLKEYS 0x80
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
#elif defined(CPUM64)
|
||||
#define INCDEC_DECLARE_VARS(f)
|
||||
#define INCDEC_SET_FLAG(f)
|
||||
#define INCDEC_ENABLE_CHECK(fn)
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, EE_MODEL)
|
||||
#else
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f)
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn)
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag)
|
||||
#endif
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
struct CheckIncDecStops {
|
||||
const int count;
|
||||
const int stops[];
|
||||
@@ -146,19 +126,10 @@ extern const CheckIncDecStops &stopsSwitch;
|
||||
#define CATEGORY_END(val) \
|
||||
(val), (val+1)
|
||||
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
|
||||
#else
|
||||
int16_t checkIncDec(event_t event, int16_t i_pval, int16_t i_min, int16_t i_max, uint8_t i_flags=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max);
|
||||
int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#else
|
||||
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
|
||||
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
|
||||
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
|
||||
#endif
|
||||
|
||||
#define CHECK_INCDEC_MODELVAR(event, var, min, max) \
|
||||
var = checkIncDecModel(event, var, min, max)
|
||||
@@ -166,47 +137,19 @@ int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO(event, var, max) \
|
||||
var = checkIncDecModelZero(event, var, max)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL, check)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELVAR_CHECK(event, var, min, max, check) \
|
||||
var = checkIncDec(event, var, min, max, EE_MODEL)
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, var, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH, available)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
|
||||
#elif defined(AUTOSWITCH)
|
||||
#define AUTOSWITCH_ENTER_LONG() (attr && event==EVT_KEY_LONG(KEY_ENTER))
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
var = checkIncDec(event, var, min, max, (flags)|INCDEC_SWITCH)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_SWITCH(event, var, min, max, EE_MODEL, available)
|
||||
#else
|
||||
#define AUTOSWITCH_ENTER_LONG() (0)
|
||||
#define CHECK_INCDEC_SWITCH(event, var, min, max, flags, available) \
|
||||
CHECK_INCDEC_MODELVAR(event, var, min, max)
|
||||
#define CHECK_INCDEC_MODELSWITCH(event, var, min, max, available) \
|
||||
CHECK_INCDEC_MODELVAR(event, var, min, max)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isSourceAvailable)
|
||||
#elif defined(AUTOSOURCE)
|
||||
#define CHECK_INCDEC_MODELSOURCE(event, var, min, max) \
|
||||
var = checkIncDec(event,var,min,max,EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS)
|
||||
#else
|
||||
#define CHECK_INCDEC_MODELSOURCE CHECK_INCDEC_MODELVAR
|
||||
#endif
|
||||
|
||||
#define CHECK_INCDEC_GENVAR(event, var, min, max) \
|
||||
var = checkIncDecGen(event, var, min, max)
|
||||
@@ -224,11 +167,7 @@ void check_submenu_simple(event_t event, uint8_t maxrow);
|
||||
void title(const pm_char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
#else
|
||||
#define MENU_TAB(...) static const pm_uint8_t mstate_tab[] PROGMEM = __VA_ARGS__
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#define MENU_CHECK(tab, menu, lines_count) \
|
||||
@@ -284,11 +223,7 @@ void title(const pm_char * s);
|
||||
SIMPLE_SUBMENU_NOTITLE(lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int choice_t;
|
||||
#else
|
||||
typedef int8_t choice_t;
|
||||
#endif
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const pm_char * label, const pm_char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const pm_char * label, LcdFlags attr, event_t event);
|
||||
@@ -321,17 +256,9 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
|
||||
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr=ZCHAR);
|
||||
#else
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define editSingleName(x, y, label, name, size, event, active) editName(x, y, name, size, event, active)
|
||||
#else
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
#endif
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const pm_char * str, uint8_t delay);
|
||||
#define EDIT_DELAY(x, y, event, attr, str, delay) editDelay(y, event, attr, str, delay)
|
||||
@@ -367,14 +294,12 @@ void drawStatusLine();
|
||||
#define drawStatusLine()
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
void readModelNotes();
|
||||
#endif
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
@@ -416,11 +341,7 @@ void drawStatusLine();
|
||||
#define EDIT_MODE_INIT -1
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
#define editNameCursorPos menuHorizontalPosition
|
||||
#else
|
||||
extern uint8_t editNameCursorPos;
|
||||
#endif
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
uint8_t getExposCount();
|
||||
@@ -454,9 +375,7 @@ void doMainScreenGraphics();
|
||||
void drawProgressBar(const char * label, int num, int den);
|
||||
void drawSleepBitmap();
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void drawAlertBox(const pm_char * title, const pm_char * text, const char * action);
|
||||
@@ -481,9 +400,7 @@ void showAlertBox(const pm_char * title, const pm_char * text, const char * acti
|
||||
#endif
|
||||
#define IS_OTHER_VIEW_DISPLAYED() false
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
||||
#endif
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value);
|
||||
|
||||
@@ -29,7 +29,6 @@ void lcdClear()
|
||||
|
||||
coord_t lcdLastRightPos;
|
||||
coord_t lcdNextPos;
|
||||
#if defined(CPUARM)
|
||||
coord_t lcdLastLeftPos;
|
||||
|
||||
void lcdPutPattern(coord_t x, coord_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
@@ -282,7 +281,6 @@ void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
|
||||
lcdPutPattern(x, y, q, 5, 7, flags);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c)
|
||||
{
|
||||
@@ -309,10 +307,8 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
||||
{
|
||||
const coord_t orig_x = x;
|
||||
|
||||
#if defined(CPUARM)
|
||||
const uint8_t orig_len = len;
|
||||
uint32_t fontsize = FONTSIZE(flags);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) && !defined(BOOT)
|
||||
uint8_t width = 0;
|
||||
@@ -354,27 +350,21 @@ void lcdDrawSizedText(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdF
|
||||
setx = true;
|
||||
}
|
||||
else if (c == 0x1E) { //NEWLINE
|
||||
#if defined(CPUARM)
|
||||
len = orig_len;
|
||||
#endif
|
||||
x = orig_x;
|
||||
y += FH;
|
||||
#if defined(CPUARM)
|
||||
if (fontsize == DBLSIZE)
|
||||
y += FH;
|
||||
else if (fontsize == MIDSIZE)
|
||||
y += 4;
|
||||
else if (fontsize == SMLSIZE)
|
||||
y--;
|
||||
#endif
|
||||
if (y >= LCD_H) break;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (c == 0x1D) { // TAB
|
||||
x |= 0x3F;
|
||||
x += 1;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
x += (c*FW/2); // EXTENDED SPACE
|
||||
}
|
||||
@@ -426,7 +416,6 @@ void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s,uint8_t idx, Lcd
|
||||
lcdDrawSizedText(x, y, s+length*idx, length, flags & ~(BSS|ZCHAR));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
{
|
||||
x += FWNUM*4+1;
|
||||
@@ -438,19 +427,6 @@ void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint16_t val)
|
||||
{
|
||||
x += FWNUM*4+1;
|
||||
for(int i=0; i<4; i++) {
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c>9 ? c+'A'-10 : c+'0';
|
||||
lcdDrawChar(x, y, c, c>='A' ? CONDENSED : 0);
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val)
|
||||
{
|
||||
@@ -464,7 +440,6 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags)
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
char str[16+1];
|
||||
char *s = str+16;
|
||||
*s = '\0';
|
||||
@@ -492,106 +467,6 @@ void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags flags, uint8_t l
|
||||
}
|
||||
flags &= ~LEADING0;
|
||||
lcdDrawText(x, y, s, flags);
|
||||
#else // CPUARM
|
||||
bool dblsize = flags & DBLSIZE;
|
||||
uint8_t fw = FWNUM;
|
||||
int8_t mode = MODE(flags);
|
||||
flags &= ~LEADING0;
|
||||
|
||||
bool neg = false;
|
||||
if (flags & UNSIGN) {
|
||||
flags -= UNSIGN;
|
||||
}
|
||||
else if (val < 0) {
|
||||
neg = true;
|
||||
val = -val;
|
||||
}
|
||||
|
||||
coord_t xn = 0;
|
||||
uint8_t ln = 2;
|
||||
|
||||
if (mode != MODE(LEADING0)) {
|
||||
len = 1;
|
||||
lcduint_t tmp = ((lcduint_t)val) / 10;
|
||||
while (tmp) {
|
||||
len++;
|
||||
tmp /= 10;
|
||||
}
|
||||
if (len <= mode) {
|
||||
len = mode + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (dblsize) {
|
||||
fw += FWNUM;
|
||||
}
|
||||
else {
|
||||
if (IS_LEFT_ALIGNED(flags)) {
|
||||
if (mode > 0) {
|
||||
x += 2;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOLD_FONT) && !defined(CPUM64) || defined(TELEMETRY_NONE)
|
||||
if (flags & BOLD) fw += 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (IS_LEFT_ALIGNED(flags)) {
|
||||
x += len * fw;
|
||||
if (neg) {
|
||||
x += ((dblsize) ? 7 : FWNUM);
|
||||
}
|
||||
}
|
||||
|
||||
lcdLastRightPos = x;
|
||||
x -= fw;
|
||||
if (dblsize) x++;
|
||||
|
||||
for (uint8_t i=1; i<=len; i++) {
|
||||
div_t qr = div((lcduint_t)val, 10);
|
||||
char c = qr.rem + '0';
|
||||
LcdFlags f = flags;
|
||||
if (dblsize) {
|
||||
if (c=='1' && i==len && xn>x+10) { x+=1; }
|
||||
if ((lcduint_t)val >= 1000) { x+=FWNUM; f &= ~DBLSIZE; }
|
||||
}
|
||||
lcdDrawChar(x, y, c, f);
|
||||
if (mode == i) {
|
||||
flags &= ~PREC2; // TODO not needed but removes 20bytes, could be improved for sure, check asm
|
||||
if (dblsize) {
|
||||
xn = x - 2;
|
||||
if (c>='2' && c<='3') ln++;
|
||||
uint8_t tn = (qr.quot % 10);
|
||||
if (tn==2 || tn==4) {
|
||||
if (c=='4') {
|
||||
xn++;
|
||||
}
|
||||
else {
|
||||
xn--;
|
||||
ln++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
x -= 2;
|
||||
lcdDrawChar(x, y, '.', f);
|
||||
}
|
||||
}
|
||||
if (dblsize && (lcduint_t)val >= 1000 && (lcduint_t)val < 10000) x-=2;
|
||||
val = qr.quot;
|
||||
x -= fw;
|
||||
#if defined(BOLD_FONT) && !defined(CPUM64) || defined(TELEMETRY_NONE)
|
||||
if (i==len && (flags & BOLD)) x += 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (xn) {
|
||||
// TODO needed on CPUAVR? y &= ~0x07;
|
||||
lcdDrawSolidFilledRect(xn, y+2*FH-3, ln, 2);
|
||||
}
|
||||
if (neg) lcdDrawChar(x, y, '-', flags);
|
||||
#endif // CPUARM
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -646,60 +521,11 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(CPUM64)
|
||||
void lcdDrawVerticalLine(coord_t x, int8_t y, int8_t h, uint8_t pat)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
if (y<0) { h+=y; y=0; }
|
||||
if (y+h > LCD_H) { h = LCD_H - y; }
|
||||
|
||||
if (pat==DOTTED && !(y%2))
|
||||
pat = ~pat;
|
||||
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
y = (y & 0x07);
|
||||
if (y) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= ~(BITMASK(y)-1) & pat;
|
||||
p += LCD_W;
|
||||
h -= 8-y;
|
||||
}
|
||||
while (h>0) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= pat;
|
||||
p += LCD_W;
|
||||
h -= 8;
|
||||
}
|
||||
if (h < 0) h += 8;
|
||||
if (h) {
|
||||
p -= LCD_W;
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p ^= ~(BITMASK(h)-1) & pat;
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, SOLID);
|
||||
}
|
||||
|
||||
void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, pat);
|
||||
lcdDrawVerticalLine(x+w-1, y, h, pat);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcdDrawHorizontalLine(x, y+h-1, w, pat);
|
||||
lcdDrawHorizontalLine(x, y, w, pat);
|
||||
}
|
||||
#else
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
if (x >= LCD_W) return;
|
||||
#if defined(CPUARM)
|
||||
// should never happen on 9X
|
||||
if (y >= LCD_H) return;
|
||||
#endif
|
||||
|
||||
if (h<0) { y+=h; h=-h; }
|
||||
if (y<0) { h+=y; y=0; }
|
||||
@@ -744,17 +570,10 @@ void lcdDrawRect(coord_t x, coord_t y, coord_t w, coord_t h, uint8_t pat, LcdFla
|
||||
lcdDrawHorizontalLine(x, y+h-1, w, pat, att);
|
||||
lcdDrawHorizontalLine(x, y, w, pat, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOT)
|
||||
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat, LcdFlags att)
|
||||
{
|
||||
#if defined(CPUM64)
|
||||
for (scoord_t i=y; i<(scoord_t)(y+h); i++) {
|
||||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#else
|
||||
for (scoord_t i=y; i<(scoord_t)(y+h); i++) { // cast to scoord_t needed otherwise (y+h) is promoted to int (see #5055)
|
||||
if ((att&ROUND) && (i==y || i==y+h-1))
|
||||
lcdDrawHorizontalLine(x+1, i, w-2, pat, att);
|
||||
@@ -762,7 +581,6 @@ void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat,
|
||||
lcdDrawHorizontalLine(x, i, w, pat, att);
|
||||
pat = (pat >> 1) + ((pat & 1) << 7);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void drawTelemetryTopBar()
|
||||
@@ -804,28 +622,22 @@ void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2
|
||||
|
||||
qr = div((int)tme, 60);
|
||||
|
||||
#if defined(CPUARM)
|
||||
char separator = ':';
|
||||
if (tme >= 3600) {
|
||||
qr = div(qr.quot, 60);
|
||||
separator = CHR_HOUR;
|
||||
}
|
||||
#else
|
||||
#define separator ':'
|
||||
#endif
|
||||
if(qr.quot < 100) {
|
||||
lcdDrawNumber(x, y, qr.quot, att|LEADING0|LEFT, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, qr.quot, att|LEFT);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (FONTSIZE(att) == MIDSIZE) {
|
||||
lcdLastRightPos--;
|
||||
}
|
||||
if (separator == CHR_HOUR)
|
||||
att &= ~DBLSIZE;
|
||||
#endif
|
||||
#if defined(CPUARM) && defined(RTCLOCK)
|
||||
if (att & TIMEBLINK)
|
||||
lcdDrawChar(lcdLastRightPos, y, separator, BLINK);
|
||||
@@ -847,7 +659,6 @@ void putsVBat(coord_t x, coord_t y, LcdFlags att)
|
||||
putsVolts(x, y, g_vbat100mV, att);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == MIXSRC_NONE) {
|
||||
@@ -937,40 +748,6 @@ void drawSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void drawSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx < MIXSRC_THR)
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx, att);
|
||||
else if (idx < MIXSRC_SW1)
|
||||
drawSwitch(x, y, idx-MIXSRC_THR+1+3*(1), att);
|
||||
else if (idx <= MIXSRC_LAST_LOGICAL_SWITCH)
|
||||
drawSwitch(x, y, SWSRC_SW1+idx-MIXSRC_SW1, att);
|
||||
else if (idx < MIXSRC_CH1)
|
||||
drawStringWithIndex(x, y, STR_PPM_TRAINER, idx-MIXSRC_FIRST_TRAINER+1, att);
|
||||
else if (idx <= MIXSRC_LAST_CH) {
|
||||
drawStringWithIndex(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
|
||||
}
|
||||
#if defined(GVARS) || !defined(PCBSTD)
|
||||
else if (idx <= MIXSRC_LAST_GVAR)
|
||||
drawStringWithIndex(x, y, STR_GV, idx-MIXSRC_GVAR1+1, att);
|
||||
#endif
|
||||
else if (idx < MIXSRC_FIRST_TELEM) {
|
||||
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, idx-MIXSRC_Rud+1-(MIXSRC_SW1-MIXSRC_THR)-MAX_LOGICAL_SWITCHES-MAX_TRAINER_CHANNELS-MAX_OUTPUT_CHANNELS-MAX_GVARS, att);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else {
|
||||
idx -= MIXSRC_FIRST_TELEM;
|
||||
div_t qr = div(idx, 3);
|
||||
lcdDrawSizedText(x, y, g_model.telemetrySensors[qr.quot].label, ZLEN(g_model.telemetrySensors[qr.quot].label), ZCHAR|att);
|
||||
if (qr.rem) lcdDrawChar(lcdLastRightPos, y, qr.rem==2 ? '+' : '-', att);
|
||||
}
|
||||
#else
|
||||
else
|
||||
lcdDrawTextAtIndex(x, y, STR_VTELEMCHNS, idx-MIXSRC_FIRST_TELEM+1, att);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
@@ -989,47 +766,18 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawSwitch(coord_t x, coord_t y, swsrc_t idx, LcdFlags flags)
|
||||
{
|
||||
char s[8];
|
||||
getSwitchString(s, idx);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
#else
|
||||
void drawSwitch(coord_t x, coord_t y, swsrc_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == SWSRC_OFF)
|
||||
return lcdDrawTextAtIndex(x, y, STR_OFFON, 0, att);
|
||||
if (idx < 0) {
|
||||
lcdDrawChar(x-2, y, '!', att);
|
||||
idx = -idx;
|
||||
}
|
||||
#if defined(CPUARM) && defined(FLIGHT_MODES)
|
||||
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
|
||||
return drawStringWithIndex(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
#endif
|
||||
return lcdDrawTextAtIndex(x, y, STR_VSWITCHES, idx, att);
|
||||
}
|
||||
#endif
|
||||
|
||||
void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
char s[8];
|
||||
getCurveString(s, idx);
|
||||
lcdDrawText(x, y, s, att);
|
||||
#else // CPUARM
|
||||
if (idx < 0) {
|
||||
lcdDrawChar(x-3, y, '!', att);
|
||||
idx = -idx+CURVE_BASE-1;
|
||||
}
|
||||
if (idx < CURVE_BASE)
|
||||
lcdDrawTextAtIndex(x, y, STR_VCURVEFUNC, idx, att);
|
||||
else
|
||||
drawStringWithIndex(x, y, STR_CV, idx-CURVE_BASE+1, att);
|
||||
#endif // CPUARM
|
||||
}
|
||||
|
||||
void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
||||
@@ -1043,7 +791,6 @@ void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
||||
drawSwitch(x, y, mode, att);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
trim_t v = getRawTrimValue(fm, idx);
|
||||
@@ -1071,21 +818,6 @@ void drawShortTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags a
|
||||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
}
|
||||
#else
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t fm, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
trim_t v = getRawTrimValue(fm, idx);
|
||||
|
||||
if (v > TRIM_EXTENDED_MAX) {
|
||||
uint8_t p = v - TRIM_EXTENDED_MAX - 1;
|
||||
if (p >= fm) p++;
|
||||
lcdDrawChar(x, y, '0'+p, att);
|
||||
}
|
||||
else {
|
||||
putsChnLetter(x, y, idx+1, att);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ROTARY_ENCODERS > 0
|
||||
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att)
|
||||
@@ -1103,7 +835,6 @@ void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, Lcd
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
// convertUnit(val, unit);
|
||||
@@ -1195,160 +926,6 @@ void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, Lcd
|
||||
{
|
||||
drawGPSPosition(x, y, telemetryItem.gps.longitude, telemetryItem.gps.latitude, flags);
|
||||
}
|
||||
#elif defined(TELEMETRY_FRSKY)
|
||||
void drawValueWithUnit(coord_t x, coord_t y, lcdint_t val, uint8_t unit, LcdFlags att)
|
||||
{
|
||||
convertUnit(val, unit);
|
||||
lcdDrawNumber(x, y, val, att & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT) && unit != UNIT_RAW) {
|
||||
lcdDrawTextAtIndex(lcdLastRightPos/*+1*/, y, STR_VTELEMUNIT, unit, 0);
|
||||
}
|
||||
}
|
||||
|
||||
const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_DIST, // Alt
|
||||
UNIT_RAW, // Rpm
|
||||
UNIT_PERCENT, // Fuel
|
||||
UNIT_TEMPERATURE, // T1
|
||||
UNIT_TEMPERATURE, // T2
|
||||
UNIT_KTS, // Speed
|
||||
UNIT_DIST, // Dist
|
||||
UNIT_DIST, // GPS Alt
|
||||
};
|
||||
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TIMER1-1:
|
||||
case TELEM_TIMER2-1:
|
||||
att &= ~NO_UNIT;
|
||||
drawTimer(x, y, val, att, att);
|
||||
break;
|
||||
|
||||
case TELEM_MIN_A1-1:
|
||||
case TELEM_MIN_A2-1:
|
||||
channel -= TELEM_MIN_A1-TELEM_A1;
|
||||
// no break
|
||||
case TELEM_A1-1:
|
||||
case TELEM_A2-1:
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
lcdint_t converted_value = applyChannelRatio(channel, val);
|
||||
if (ANA_CHANNEL_UNIT(channel) >= UNIT_RAW) {
|
||||
converted_value = div_and_round(converted_value, 10);
|
||||
}
|
||||
else {
|
||||
if (abs(converted_value) < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
converted_value = div_and_round(converted_value, 10);
|
||||
att |= PREC1;
|
||||
}
|
||||
}
|
||||
drawValueWithUnit(x, y, converted_value, g_model.frsky.channels[channel].type, att);
|
||||
break;
|
||||
}
|
||||
|
||||
case TELEM_CELL-1:
|
||||
case TELEM_MIN_CELL-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_VOLTS, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
case TELEM_VFAS-1:
|
||||
case TELEM_CELLS_SUM-1:
|
||||
case TELEM_MIN_CELLS_SUM-1:
|
||||
case TELEM_MIN_VFAS-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_VOLTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CURRENT-1:
|
||||
case TELEM_MAX_CURRENT-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_AMPS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_CONSUMPTION-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_MAH, att);
|
||||
break;
|
||||
|
||||
case TELEM_POWER-1:
|
||||
case TELEM_MAX_POWER-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_WATTS, att);
|
||||
break;
|
||||
|
||||
case TELEM_ACCx-1:
|
||||
case TELEM_ACCy-1:
|
||||
case TELEM_ACCz-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_RAW, att|PREC2);
|
||||
break;
|
||||
|
||||
case TELEM_VSPEED-1:
|
||||
drawValueWithUnit(x, y, div_and_round(val, 10), UNIT_RAW, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_ASPEED-1:
|
||||
case TELEM_MAX_ASPEED-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_KTS, att|PREC1);
|
||||
break;
|
||||
|
||||
case TELEM_RSSI_TX-1:
|
||||
case TELEM_RSSI_RX-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_RAW, att);
|
||||
break;
|
||||
|
||||
case TELEM_HDG-1:
|
||||
drawValueWithUnit(x, y, val, UNIT_HDG, att);
|
||||
break;
|
||||
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
case TELEM_ALT-1:
|
||||
drawValueWithUnit(x, y, div_and_round(val, 10), UNIT_DIST, att|PREC1);
|
||||
break;
|
||||
#elif defined(WS_HOW_HIGH)
|
||||
case TELEM_ALT-1:
|
||||
case TELEM_MIN_ALT-1:
|
||||
case TELEM_MAX_ALT-1:
|
||||
if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH()) {
|
||||
drawValueWithUnit(x, y, val, UNIT_FEET, att);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
default:
|
||||
{
|
||||
uint8_t unit = 1;
|
||||
if (channel >= TELEM_MAX_T1-1 && channel <= TELEM_MAX_DIST-1)
|
||||
channel -= TELEM_MAX_T1 - TELEM_T1;
|
||||
if (channel <= TELEM_GPSALT-1)
|
||||
unit = channel + 1 - TELEM_ALT;
|
||||
if (channel >= TELEM_MIN_ALT-1 && channel <= TELEM_MAX_ALT-1)
|
||||
unit = 0;
|
||||
drawValueWithUnit(x, y, val, pgm_read_byte(bchunit_ar+unit), att);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else // defined(TELEMETRY_FRSKY)
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TIMER1-1:
|
||||
case TELEM_TIMER2-1:
|
||||
att &= ~NO_UNIT;
|
||||
drawTimer(x, y, val, att, att);
|
||||
break;
|
||||
|
||||
case TELEM_TX_VOLTAGE-1:
|
||||
lcdDrawNumber(x, y, val, (att|PREC1) & (~NO_UNIT));
|
||||
if (!(att & NO_UNIT))
|
||||
lcdDrawChar(lcdLastRightPos/*+1*/, y, 'V');
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcdSetContrast()
|
||||
{
|
||||
@@ -1357,159 +934,7 @@ void lcdSetContrast()
|
||||
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void lcdDrawChar(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
const pm_uchar *q = &font_5x7[(c-0x20)*5];
|
||||
|
||||
lcdNextPos = x-1;
|
||||
p--;
|
||||
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
unsigned char c_remapped = 0;
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & (DBLSIZE+BOLD)) {
|
||||
#else
|
||||
if (flags & DBLSIZE) {
|
||||
#endif
|
||||
// To save space only some DBLSIZE and BOLD chars are available
|
||||
// c has to be remapped. All non existing chars mapped to 0 (space)
|
||||
|
||||
if (c>=',' && c<=':')
|
||||
c_remapped = c - ',' + 1;
|
||||
else if (c>='A' && c<='Z')
|
||||
c_remapped = c - 'A' + 16;
|
||||
else if (c>='a' && c<='z')
|
||||
c_remapped = c - 'a' + 42;
|
||||
else if (c=='_')
|
||||
c_remapped = 4;
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
else if (c!=' ')
|
||||
flags &= ~BOLD;
|
||||
#endif
|
||||
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
}
|
||||
if (flags & DBLSIZE) {
|
||||
#endif
|
||||
|
||||
/* each letter consists of ten top bytes followed by
|
||||
* by ten bottom bytes (20 bytes per * char) */
|
||||
q = &font_10x14[((uint16_t)c_remapped)*20];
|
||||
for (int8_t i=0; i<=11; i++) {
|
||||
uint8_t b1=0, b2=0;
|
||||
if (!i) {
|
||||
if (!x || !inv) {
|
||||
lcdNextPos++;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (i <= 10) {
|
||||
b1 = pgm_read_byte(q++); /*top byte*/
|
||||
b2 = pgm_read_byte(q++);
|
||||
}
|
||||
if ((b1 & b2) == 0xff) continue;
|
||||
if (inv) {
|
||||
b1 = ~b1;
|
||||
b2 = ~b2;
|
||||
}
|
||||
if(p+LCD_W < DISPLAY_END) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
ASSERT_IN_DISPLAY(p+LCD_W);
|
||||
LCD_BYTE_FILTER(p, 0, b1);
|
||||
LCD_BYTE_FILTER(p+LCD_W, 0, b2);
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
const uint8_t ym8 = (y & 0x07);
|
||||
#if defined(BOLD_FONT)
|
||||
#if defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & BOLD) {
|
||||
q = &font_5x7_B[(c_remapped)*5];
|
||||
}
|
||||
#else
|
||||
uint8_t bb = 0;
|
||||
if (inv) bb = 0xff;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
uint8_t *lineEnd = &displayBuf[ y / 8 * LCD_W + LCD_W ];
|
||||
|
||||
for (int8_t i=0; i<=6; i++) {
|
||||
uint8_t b = 0;
|
||||
if (i==0) {
|
||||
if (!x || !inv) {
|
||||
lcdNextPos++;
|
||||
p++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (i <= 5) {
|
||||
b = pgm_read_byte(q++);
|
||||
}
|
||||
if (b == 0xff) {
|
||||
if (flags & FIXEDWIDTH)
|
||||
b = 0;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
if (inv) b = ~b;
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(BOLD_FONT) && !defined(BOLD_SPECIFIC_FONT)
|
||||
if (flags & BOLD) {
|
||||
uint8_t a;
|
||||
if (inv)
|
||||
a = b & bb;
|
||||
else
|
||||
a = b | bb;
|
||||
bb = b;
|
||||
b = a;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (p<DISPLAY_END && p<lineEnd) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
uint8_t mask = ~(0xff << ym8);
|
||||
LCD_BYTE_FILTER(p, mask, b << ym8);
|
||||
if (ym8) {
|
||||
uint8_t *r = p + LCD_W;
|
||||
if (r<DISPLAY_END)
|
||||
LCD_BYTE_FILTER(r, ~mask, b >> (8-ym8));
|
||||
}
|
||||
|
||||
if (inv && (ym8 == 1)) *p |= 0x01;
|
||||
}
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const uint8_t * img, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
const uint8_t * q = img;
|
||||
@@ -1527,32 +952,6 @@ void lcdDraw1bitBitmap(coord_t x, coord_t y, const uint8_t * img, uint8_t idx, L
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define LCD_IMG_FUNCTION(NAME, TYPE, READ_BYTE) \
|
||||
void NAME(coord_t x, coord_t y, TYPE img, uint8_t idx, LcdFlags att) \
|
||||
{ \
|
||||
TYPE q = img; \
|
||||
uint8_t w = READ_BYTE(q++); \
|
||||
uint8_t hb = (READ_BYTE(q++)+7)/8; \
|
||||
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false); \
|
||||
q += idx*w*hb; \
|
||||
for (uint8_t yb = 0; yb < hb; yb++) { \
|
||||
uint8_t *p = &displayBuf[(y / 8 + yb) * LCD_W + x]; \
|
||||
for (uint8_t i=0; i<w; i++){ \
|
||||
uint8_t b = READ_BYTE(q); \
|
||||
q++; \
|
||||
ASSERT_IN_DISPLAY(p); \
|
||||
*p++ = inv ? ~b : b; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
LCD_IMG_FUNCTION(lcd_imgfar, uint_farptr_t, pgm_read_byte_far)
|
||||
#endif
|
||||
|
||||
LCD_IMG_FUNCTION(lcdDraw1bitBitmap, const pm_uchar *, pgm_read_byte)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -29,13 +29,8 @@
|
||||
#define CENTER
|
||||
#define CENTER_OFS 0
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef int32_t lcdint_t;
|
||||
typedef uint32_t lcduint_t;
|
||||
#else
|
||||
typedef int16_t lcdint_t;
|
||||
typedef uint16_t lcduint_t;
|
||||
#endif
|
||||
|
||||
#define FW 6
|
||||
#define FWNUM 5
|
||||
@@ -63,11 +58,7 @@
|
||||
/* lcd puts flags */
|
||||
/* no 0x80 here because of "GV"1 which is aligned LEFT */
|
||||
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */
|
||||
#if defined(CPUARM)
|
||||
#define BSS 0x00
|
||||
#else
|
||||
#define BSS 0x20
|
||||
#endif
|
||||
#define ZCHAR 0x80
|
||||
|
||||
/* lcd outdez flags */
|
||||
@@ -76,15 +67,9 @@
|
||||
#define PREC1 0x20
|
||||
#define PREC2 0x30
|
||||
#define MODE(flags) ((((int8_t)(flags) & 0x30) - 0x10) >> 4)
|
||||
#if defined(CPUARM)
|
||||
#define LEFT 0x00 /* fake */
|
||||
#define RIGHT 0x04 /* align right */
|
||||
#define IS_LEFT_ALIGNED(att) !((att) & RIGHT)
|
||||
#else
|
||||
#define LEFT 0x80 /* align left */
|
||||
#define RIGHT 0x00 /* fake */
|
||||
#define IS_LEFT_ALIGNED(att) ((att) & LEFT)
|
||||
#endif
|
||||
#define IS_RIGHT_ALIGNED(att) (!IS_LEFT_ALIGNED(att))
|
||||
|
||||
/* line, rect, square flags */
|
||||
@@ -95,7 +80,6 @@
|
||||
/* telemetry flags */
|
||||
#define NO_UNIT 0x40
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define FONTSIZE_MASK 0x0700
|
||||
#define FONTSIZE(x) ((x) & FONTSIZE_MASK)
|
||||
#define TINSIZE 0x0100
|
||||
@@ -105,28 +89,12 @@
|
||||
#define XXLSIZE 0x0500
|
||||
#define ERASEBG 0x8000
|
||||
#define VERTICAL 0x0800
|
||||
#else
|
||||
#define DBLSIZE 0x04
|
||||
#define MIDSIZE DBLSIZE
|
||||
#define SMLSIZE 0x00
|
||||
#define TINSIZE 0x00
|
||||
#define XXLSIZE 0x00
|
||||
#define ERASEBG 0x00
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TIMEBLINK 0x1000
|
||||
#define TIMEHOUR 0x2000
|
||||
#define STREXPANDED 0x4000
|
||||
#else
|
||||
#define STREXPANDED 0x00
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef uint32_t LcdFlags;
|
||||
#else
|
||||
typedef uint8_t LcdFlags;
|
||||
#endif
|
||||
|
||||
#define display_t uint8_t
|
||||
#define DISPLAY_BUFFER_SIZE (LCD_W*((LCD_H+7)/8))
|
||||
@@ -140,9 +108,6 @@ extern coord_t lcdNextPos;
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUFFER_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
extern volatile uint8_t LcdLock ;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint8_t lcdLock ;
|
||||
@@ -166,11 +131,7 @@ void lcdDrawTextAlignedLeft(coord_t y, const pm_char * s);
|
||||
|
||||
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
#else
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint16_t val);
|
||||
#endif
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
|
||||
@@ -186,11 +147,7 @@ void drawCurveName(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
void drawTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
|
||||
|
||||
void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
#if defined(CPUARM)
|
||||
void drawShortTrimMode(coord_t x, coord_t y, uint8_t mode, uint8_t idx, LcdFlags att);
|
||||
#else
|
||||
#define drawShortTrimMode drawTrimMode
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
void putsRotaryEncoderMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
@@ -202,17 +159,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);
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void drawTelemetryValue(coord_t x, coord_t y, uint8_t channel, lcdint_t val, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define putstime_t int32_t
|
||||
#define FlightModesType uint16_t
|
||||
#else
|
||||
#define putstime_t int16_t
|
||||
#define FlightModesType uint8_t
|
||||
#endif
|
||||
|
||||
void drawRtcTime(coord_t x, coord_t y, LcdFlags att);
|
||||
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att, LcdFlags att2);
|
||||
@@ -228,17 +177,10 @@ void lcdDrawPoint(coord_t x, coord_t y, LcdFlags att=0);
|
||||
void lcdMaskPoint(uint8_t *p, uint8_t mask, LcdFlags att=0);
|
||||
void lcdDrawSolidHorizontalLine(coord_t x, coord_t y, coord_t w, LcdFlags att=0);
|
||||
void lcdDrawHorizontalLine(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att=0);
|
||||
#if defined(CPUM64)
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, int8_t h, uint8_t pat);
|
||||
#else
|
||||
void lcdDrawSolidVerticalLine(coord_t x, scoord_t y, scoord_t h, LcdFlags att=0);
|
||||
void lcdDrawVerticalLine(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
#endif
|
||||
|
||||
void lcdDrawFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, uint8_t pat=SOLID, LcdFlags att=0);
|
||||
inline void lcdDrawSolidFilledRect(coord_t x, scoord_t y, coord_t w, coord_t h, LcdFlags att=0)
|
||||
@@ -258,9 +200,6 @@ void drawTelemetryTopBar();
|
||||
lcdDrawSolidVerticalLine(xx ,yy-ll,ll); \
|
||||
lcdDrawSolidVerticalLine(xx+1,yy-ll,ll)
|
||||
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
void lcd_imgfar(coord_t x, coord_t y, const uint_farptr_t img, uint8_t idx, LcdFlags att); // progmem "far"
|
||||
#endif
|
||||
|
||||
void lcdClear(void);
|
||||
void lcdDraw1bitBitmap(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags att=0);
|
||||
@@ -292,8 +231,6 @@ const char * writeScreenshot();
|
||||
|
||||
void drawShutdownAnimation(uint32_t index, const char * message);
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t getTextWidth(const char * s, uint8_t len=0, LcdFlags flags=0);
|
||||
#endif
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
||||
@@ -39,102 +39,13 @@ uint8_t s_maxLines = 8;
|
||||
uint8_t s_copySrcIdx;
|
||||
uint8_t s_copySrcCh;
|
||||
|
||||
#if !defined(CPUM64)
|
||||
uint8_t editNameCursorPos = 0;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
#if defined(CPUM64)
|
||||
// in order to save flash
|
||||
lcdDrawTextAlignedLeft(y, STR_NAME);
|
||||
#endif
|
||||
|
||||
uint8_t mode = 0;
|
||||
if (active) {
|
||||
if (s_editMode <= 0)
|
||||
mode = INVERS + FIXEDWIDTH;
|
||||
else
|
||||
mode = FIXEDWIDTH;
|
||||
}
|
||||
|
||||
lcdDrawSizedText(x, y, name, size, ZCHAR | mode);
|
||||
|
||||
if (active) {
|
||||
uint8_t cur = editNameCursorPos;
|
||||
if (s_editMode > 0) {
|
||||
int8_t c = name[cur];
|
||||
int8_t v = c;
|
||||
|
||||
if (p1valdiff || IS_ROTARY_RIGHT(event) || IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_FIRST(KEY_UP)
|
||||
|| event==EVT_KEY_REPT(KEY_DOWN) || event==EVT_KEY_REPT(KEY_UP)) {
|
||||
v = checkIncDec(event, abs(v), 0, ZCHAR_MAX, 0);
|
||||
if (c <= 0) v = -v;
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode == EDIT_MODIFY_FIELD) {
|
||||
s_editMode = EDIT_MODIFY_STRING;
|
||||
cur = 0;
|
||||
}
|
||||
else if (cur<size-1)
|
||||
cur++;
|
||||
else
|
||||
s_editMode = 0;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
if (cur>0) cur--;
|
||||
break;
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
if (cur<size-1) cur++;
|
||||
break;
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_LONG:
|
||||
if (v == 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
case EVT_KEY_LONG(KEY_LEFT):
|
||||
case EVT_KEY_LONG(KEY_RIGHT):
|
||||
if (v>=-26 && v<=26) {
|
||||
v = -v; // toggle case
|
||||
if (event==EVT_KEY_LONG(KEY_LEFT))
|
||||
killEvents(KEY_LEFT);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (c != v) {
|
||||
name[cur] = v;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
lcdDrawChar(x+editNameCursorPos*FW, y, idx2char(v), ERASEBG|INVERS|FIXEDWIDTH);
|
||||
}
|
||||
else {
|
||||
cur = 0;
|
||||
}
|
||||
editNameCursorPos = cur;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void editSingleName(coord_t x, coord_t y, const pm_char * label, char * name, uint8_t size, event_t event, uint8_t active)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, label);
|
||||
editName(x, y, name, size, event, active);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t s_currIdx;
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuRadioSpecialFunctions(event_t event)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -40,4 +39,3 @@ void menuRadioSpecialFunctions(event_t event)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,6 @@ void pushMenu(MenuHandlerFunc newMenu)
|
||||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuModelNotes(event_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
@@ -79,4 +78,3 @@ void pushModelNotes()
|
||||
{
|
||||
pushMenu(menuModelNotes);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,7 @@ typedef uint8_t vertpos_t;
|
||||
|
||||
typedef void (*MenuHandlerFunc)(event_t event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
|
||||
@@ -31,29 +31,6 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
|
||||
} while (p!=0);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
drawFieldLabel(x, y, STR_FLMODE);
|
||||
|
||||
uint8_t posHorz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
lcdDrawChar(x, y, '0'+p, ((posHorz==p) && attr) ? BLINK|INVERS : ((value & (1<<p)) ? 0 : INVERS));
|
||||
x += FW;
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (s_editMode && ((event==EVT_KEY_BREAK(KEY_ENTER) || p1valdiff))) {
|
||||
s_editMode = 0;
|
||||
value ^= (1<<posHorz);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
enum MenuModelFlightModeItems {
|
||||
ITEM_MODEL_FLIGHT_MODE_NAME,
|
||||
@@ -69,12 +46,10 @@ enum MenuModelFlightModeItems {
|
||||
ITEM_MODEL_FLIGHT_MODE_GV3,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV4,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV5,
|
||||
#if defined(CPUARM)
|
||||
ITEM_MODEL_FLIGHT_MODE_GV6,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV7,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV8,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV9,
|
||||
#endif
|
||||
#endif
|
||||
ITEM_MODEL_FLIGHT_MODE_MAX
|
||||
};
|
||||
@@ -137,7 +112,6 @@ void menuModelFlightModeOne(event_t event)
|
||||
|
||||
case ITEM_MODEL_FLIGHT_MODE_TRIMS:
|
||||
lcdDrawTextAlignedLeft(y, STR_TRIMS);
|
||||
#if defined(CPUARM)
|
||||
for (uint8_t t = 0; t < NUM_STICKS; t++) {
|
||||
drawTrimMode(MIXES_2ND_COLUMN + (t*2*FW), y, s_currIdx, t, menuHorizontalPosition == t ? attr : 0);
|
||||
if (s_editMode >= 0 && attr && menuHorizontalPosition == t) {
|
||||
@@ -145,22 +119,6 @@ void menuModelFlightModeOne(event_t event)
|
||||
v.mode = checkIncDec(event, v.mode==TRIM_MODE_NONE ? -1 : v.mode, -1, k==0 ? 0 : 2*MAX_FLIGHT_MODES-1, EE_MODEL, isTrimModeAvailable);
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (uint8_t t = 0; t < NUM_STICKS; t++) {
|
||||
drawTrimMode(MIXES_2ND_COLUMN + (t*FW), y, s_currIdx, t, menuHorizontalPosition == t ? attr : 0);
|
||||
if (attr && menuHorizontalPosition == t && ((editMode > 0) || p1valdiff)) {
|
||||
int16_t v = getRawTrimValue(s_currIdx, t);
|
||||
if (v < TRIM_EXTENDED_MAX)
|
||||
v = TRIM_EXTENDED_MAX;
|
||||
v = checkIncDec(event, v, TRIM_EXTENDED_MAX, TRIM_EXTENDED_MAX + MAX_FLIGHT_MODES - 1, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (v == TRIM_EXTENDED_MAX)
|
||||
v = 0;
|
||||
setTrimValue(s_currIdx, t, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if ROTARY_ENCODERS > 0
|
||||
@@ -202,16 +160,12 @@ void menuModelFlightModeOne(event_t event)
|
||||
if (attr && posHorz > 0 && s_currIdx==0) posHorz++;
|
||||
|
||||
drawStringWithIndex(INDENT_WIDTH, y, STR_GV, idx+1, posHorz==0 ? attr : 0);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSizedText(4*FW, y,g_model.gvars[idx].name, LEN_GVAR_NAME, ZCHAR);
|
||||
if (attr && editMode>0 && posHorz==0) {
|
||||
s_currIdx = sub - ITEM_MODEL_FLIGHT_MODE_GV1;
|
||||
editMode = 0;
|
||||
pushMenu(menuModelGVarOne);
|
||||
}
|
||||
#else
|
||||
editName(4*FW, y, g_model.gvars[idx].name, LEN_GVAR_NAME, event, posHorz==0 ? attr : 0);
|
||||
#endif
|
||||
int16_t v = fm->gvars[idx];
|
||||
if (v > GVAR_MAX) {
|
||||
uint8_t p = v - GVAR_MAX - 1;
|
||||
@@ -229,15 +183,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
fm->gvars[idx] = v;
|
||||
}
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
editGVarValue(17*FW, y, event, idx, getGVarFlightMode(s_currIdx, idx), posHorz==2 ? attr : 0);
|
||||
#else
|
||||
uint8_t p = getGVarFlightMode(s_currIdx, idx);
|
||||
lcdDrawNumber(18*FW, y, GVAR_VALUE(idx, p), posHorz==2 ? attr : 0);
|
||||
if (attr && posHorz==2 && ((editMode>0) || p1valdiff)) {
|
||||
GVAR_VALUE(idx, p) = checkIncDec(event, GVAR_VALUE(idx, p), -500, 500, EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@@ -293,12 +239,8 @@ void menuModelFlightModesAll(event_t event)
|
||||
|
||||
uint8_t att;
|
||||
for (uint8_t i=0; i<MAX_FLIGHT_MODES; i++) {
|
||||
#if defined(CPUARM)
|
||||
int8_t y = 1 + (1+i-menuVerticalOffset)*FH;
|
||||
if (y<1*FH+1 || y>(LCD_LINES-1)*FH+1) continue;
|
||||
#else
|
||||
uint8_t y = 1 + (i+1)*FH;
|
||||
#endif
|
||||
att = (i==sub ? INVERS : 0);
|
||||
FlightModeData * p = flightModeAddress(i);
|
||||
drawFlightMode(0, y, i+1, att|(getFlightMode()==i ? BOLD : 0));
|
||||
@@ -327,11 +269,6 @@ void menuModelFlightModesAll(event_t event)
|
||||
for (uint8_t t=0; t<NUM_STICKS; t++) {
|
||||
drawShortTrimMode((9+LEN_FLIGHT_MODE_NAME+t)*FW+TRIMS_OFS, y, i, t, 0);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUM2560)
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode((13+LEN_FLIGHT_MODE_NAME+t)*FW+TRIMS_OFS+ROTARY_ENC_OFS, y, i, t, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -340,9 +277,7 @@ void menuModelFlightModesAll(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (menuVerticalOffset != MAX_FLIGHT_MODES-(LCD_LINES-2)) return;
|
||||
#endif
|
||||
|
||||
lcdDrawTextAlignedLeft((LCD_LINES-1)*FH+1, STR_CHECKTRIMS);
|
||||
drawFlightMode(OFS_CHECKTRIMS, (LCD_LINES-1)*FH+1, mixerCurrentFlightMode+1);
|
||||
|
||||
@@ -243,11 +243,9 @@ void menuModelExpoOne(event_t event)
|
||||
for (uint8_t i=0; i<EXPO_FIELD_MAX+1; i++) {
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch (i) {
|
||||
#if defined(CPUARM)
|
||||
case EXPO_FIELD_NAME:
|
||||
editSingleName(EXPO_ONE_2ND_COLUMN-sizeof(ed->name)*FW, y, STR_EXPONAME, ed->name, sizeof(ed->name), event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EXPO_FIELD_WEIGHT:
|
||||
lcdDrawTextAlignedLeft(y, STR_WEIGHT);
|
||||
@@ -309,13 +307,8 @@ void menuModelExpoOne(event_t event)
|
||||
int16_t y512 = expoFn(x512);
|
||||
lcdDrawNumber(LCD_W-8-6*FW, 1*FH, calcRESXto100(y512), 0);
|
||||
|
||||
#if defined(CPUARM)
|
||||
x512 = CURVE_CENTER_X+x512/(RESX/CURVE_SIDE_WIDTH);
|
||||
y512 = (LCD_H-1) - ((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#else
|
||||
x512 = CURVE_CENTER_X+x512/(RESXu/CURVE_SIDE_WIDTH);
|
||||
y512 = (LCD_H-1) - (uint16_t)((y512+RESX)/2) * (LCD_H-1) / RESX;
|
||||
#endif
|
||||
|
||||
lcdDrawSolidVerticalLine(x512, y512-3, 3*2+1);
|
||||
lcdDrawSolidHorizontalLine(x512-3, y512, 3*2+1);
|
||||
@@ -339,7 +332,6 @@ enum MixFields {
|
||||
MIX_FIELD_COUNT
|
||||
};
|
||||
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
#define GAUGE_WIDTH 33
|
||||
#define GAUGE_HEIGHT 6
|
||||
void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
@@ -349,13 +341,8 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
int barMin = offset - weight;
|
||||
int barMax = offset + weight;
|
||||
if (y > 15) {
|
||||
#if defined(CPUARM)
|
||||
lcdDrawNumber(x-((barMin >= 0) ? 2 : 3), y-6, barMin, TINSIZE|LEFT);
|
||||
lcdDrawNumber(x+GAUGE_WIDTH+1, y-6, barMax, TINSIZE);
|
||||
#else
|
||||
lcdDrawNumber(x-((barMin >= 0) ? 2 : 3), y-8, barMin, LEFT);
|
||||
lcdDrawNumber(x+GAUGE_WIDTH+1, y-8, barMax);
|
||||
#endif
|
||||
}
|
||||
if (weight < 0) {
|
||||
barMin = -barMin;
|
||||
@@ -390,7 +377,6 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
}
|
||||
#undef GAUGE_WIDTH
|
||||
#undef GAUGE_HEIGHT
|
||||
#endif
|
||||
|
||||
void menuModelMixOne(event_t event)
|
||||
{
|
||||
@@ -420,11 +406,9 @@ void menuModelMixOne(event_t event)
|
||||
|
||||
uint8_t attr = (sub==i ? (editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
switch (i) {
|
||||
#if defined(CPUARM)
|
||||
case MIX_FIELD_NAME:
|
||||
editSingleName(COLUMN_X+MIXES_2ND_COLUMN, y, STR_MIXNAME, md2->name, sizeof(md2->name), event, attr);
|
||||
break;
|
||||
#endif
|
||||
case MIX_FIELD_SOURCE:
|
||||
drawFieldLabel(COLUMN_X, y, NO_INDENT(STR_SOURCE));
|
||||
drawSource(COLUMN_X+MIXES_2ND_COLUMN, y, md2->srcRaw, STREXPANDED|attr);
|
||||
@@ -441,9 +425,7 @@ void menuModelMixOne(event_t event)
|
||||
MD_OFFSET_TO_UNION(md2, offset);
|
||||
offset.word = GVAR_MENU_ITEM(COLUMN_X+MIXES_2ND_COLUMN, y, offset.word, GV_RANGELARGE_OFFSET_NEG, GV_RANGELARGE_OFFSET, attr|LEFT, 0, event);
|
||||
MD_UNION_TO_OFFSET(offset, md2);
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
drawOffsetBar(COLUMN_X+MIXES_2ND_COLUMN+22, y, md2);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -537,7 +519,6 @@ void menuModelMixOne(event_t event)
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define EXPO_LINE_WEIGHT_POS 7*FW+1
|
||||
#define EXPO_LINE_EXPO_POS 10*FW+5
|
||||
#define EXPO_LINE_SWITCH_POS 11*FW+2
|
||||
@@ -550,23 +531,6 @@ void menuModelMixOne(event_t event)
|
||||
#define MIX_LINE_CURVE_POS 12*FW+2
|
||||
#define MIX_LINE_SWITCH_POS 16*FW
|
||||
#define MIX_LINE_DELAY_POS 19*FW+7
|
||||
#else
|
||||
#define EXPO_LINE_WEIGHT_POS 7*FW+1
|
||||
#define EXPO_LINE_EXPO_POS 11*FW
|
||||
#define EXPO_LINE_SWITCH_POS 11*FW+4
|
||||
#if MAX_FLIGHT_MODES == 6
|
||||
#define EXPO_LINE_SIDE_POS 15*FW
|
||||
#else
|
||||
#define EXPO_LINE_SIDE_POS 15*FW+2
|
||||
#endif
|
||||
#define EXPO_LINE_FM_POS LCD_W-FW
|
||||
#define EXPO_LINE_SELECT_POS 24
|
||||
#define MIX_LINE_SRC_POS 4*FW-1
|
||||
#define MIX_LINE_WEIGHT_POS 11*FW+3
|
||||
#define MIX_LINE_CURVE_POS 12*FW+2
|
||||
#define MIX_LINE_SWITCH_POS 16*FW
|
||||
#define MIX_LINE_DELAY_POS 19*FW+7
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onExpoMixMenu(const char *result)
|
||||
@@ -611,7 +575,6 @@ void displayMixInfos(coord_t y, MixData *md)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void displayMixLine(coord_t y, MixData * md)
|
||||
{
|
||||
if (md->name[0]) {
|
||||
@@ -621,9 +584,6 @@ void displayMixLine(coord_t y, MixData * md)
|
||||
displayMixInfos(y, md);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define displayMixLine(y, md) displayMixInfos(y, md)
|
||||
#endif
|
||||
|
||||
void displayExpoInfos(coord_t y, ExpoData *ed)
|
||||
{
|
||||
@@ -635,7 +595,6 @@ void displayExpoInfos(coord_t y, ExpoData *ed)
|
||||
drawSwitch(EXPO_LINE_SWITCH_POS, y, ed->swtch, 0);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
{
|
||||
displayExpoInfos(y, ed);
|
||||
@@ -644,11 +603,6 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
lcdDrawSizedText(EXPO_LINE_NAME_POS, y, ed->name, sizeof(ed->name), ZCHAR);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define displayExpoLine(y, ed) \
|
||||
displayExpoInfos(y, ed); \
|
||||
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes)
|
||||
#endif
|
||||
|
||||
void menuModelExpoMix(uint8_t expo, event_t event)
|
||||
{
|
||||
|
||||
@@ -25,10 +25,8 @@ enum LogicalSwitchFields {
|
||||
LS_FIELD_V1,
|
||||
LS_FIELD_V2,
|
||||
LS_FIELD_ANDSW,
|
||||
#if defined(CPUARM)
|
||||
LS_FIELD_DURATION,
|
||||
LS_FIELD_DELAY,
|
||||
#endif
|
||||
LS_FIELD_COUNT,
|
||||
LS_FIELD_LAST = LS_FIELD_COUNT-1
|
||||
};
|
||||
@@ -38,7 +36,6 @@ enum LogicalSwitchFields {
|
||||
#define CSW_3RD_COLUMN (13*FW-6)
|
||||
#define CSW_4TH_COLUMN (18*FW+2)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void putsEdgeDelayParam(coord_t x, coord_t y, LogicalSwitchData *cs, uint8_t lattr, uint8_t rattr)
|
||||
{
|
||||
lcdDrawChar(x-4, y, '[');
|
||||
@@ -166,11 +163,7 @@ void menuModelLogicalSwitchOne(event_t event)
|
||||
else if (cs->func == LS_FUNC_ADIFFEGREATER)
|
||||
v2_min = 0;
|
||||
else
|
||||
#if defined(CPUARM)
|
||||
v2_min = -v2_max;
|
||||
#else
|
||||
v2_min = minTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
#endif
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_REP10 | NO_INCDEC_MARKS);
|
||||
if (cs->v2 < v2_min || cs->v2 > v2_max) {
|
||||
cs->v2 = 0;
|
||||
@@ -332,149 +325,3 @@ void menuModelLogicalSwitches(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#else // CPUARM
|
||||
|
||||
void menuModelLogicalSwitches(event_t event)
|
||||
{
|
||||
INCDEC_DECLARE_VARS(EE_MODEL);
|
||||
|
||||
MENU(STR_MENULOGICALSWITCHES, menuTabModel, MENU_MODEL_LOGICAL_SWITCHES, HEADER_LINE+MAX_LOGICAL_SWITCHES, { HEADER_LINE_COLUMNS NAVIGATION_LINE_BY_LINE|LS_FIELD_LAST/*repeated...*/});
|
||||
|
||||
uint8_t k = 0;
|
||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
horzpos_t horz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
k = i+menuVerticalOffset;
|
||||
uint8_t attr = (sub==k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t attr1 = (horz==1 ? attr : 0);
|
||||
uint8_t attr2 = (horz==2 ? attr : 0);
|
||||
LogicalSwitchData * cs = lswAddress(k);
|
||||
|
||||
// CSW name
|
||||
uint8_t sw = SWSRC_SW1+k;
|
||||
drawSwitch(0, y, sw, (getSwitch(sw) ? BOLD : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
|
||||
// CSW func
|
||||
lcdDrawTextAtIndex(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
||||
|
||||
// CSW params
|
||||
uint8_t cstate = lswFamily(cs->func);
|
||||
int8_t v1_min=0, v1_max=MIXSRC_LAST_TELEM, v2_min=0, v2_max=MIXSRC_LAST_TELEM;
|
||||
#define v1_val cs->v1
|
||||
|
||||
if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
drawSwitch(CSW_2ND_COLUMN, y, cs->v1, attr1);
|
||||
drawSwitch(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||
v1_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v1_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
v2_min = SWSRC_FIRST_IN_LOGICAL_SWITCHES; v2_max = SWSRC_LAST_IN_LOGICAL_SWITCHES;
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SWITCH);
|
||||
INCDEC_ENABLE_CHECK(isSwitchAvailableInLogicalSwitches);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_COMP) {
|
||||
drawSource(CSW_2ND_COLUMN, y, v1_val, attr1);
|
||||
drawSource(CSW_3RD_COLUMN, y, cs->v2, attr2);
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
else if (cstate == LS_FAMILY_TIMER) {
|
||||
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);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
else {
|
||||
drawSource(CSW_2ND_COLUMN, y, v1_val, attr1);
|
||||
if (horz == 1) {
|
||||
INCDEC_SET_FLAG(EE_MODEL | INCDEC_SOURCE);
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailableInCustomSwitches);
|
||||
}
|
||||
else {
|
||||
INCDEC_SET_FLAG(EE_MODEL);
|
||||
INCDEC_ENABLE_CHECK(NULL);
|
||||
}
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
drawTelemetryValue(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT|attr2);
|
||||
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
if (cstate == LS_FAMILY_OFS) {
|
||||
v2_min = -128;
|
||||
v2_max -= 128;
|
||||
}
|
||||
else {
|
||||
v2_max = min((uint8_t)127, (uint8_t)v2_max);
|
||||
v2_min = -v2_max;
|
||||
}
|
||||
if (cs->v2 > v2_max) {
|
||||
cs->v2 = v2_max;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
|
||||
#if defined(CPUARM) && defined(GVARS)
|
||||
if (v1_val >= MIXSRC_GVAR1) {
|
||||
v2_min = -1024; v2_max = +1024;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
}
|
||||
#else // TELEMETRY_FRSKY
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
drawTelemetryValue(CSW_3RD_COLUMN, y, v1_val - MIXSRC_FIRST_TELEM, convertLswTelemValue(cs), LEFT|attr2);
|
||||
v2_min = -128; v2_max = 127;
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(CSW_3RD_COLUMN, y, cs->v2, LEFT|attr2);
|
||||
v2_min = -LIMIT_EXT_PERCENT; v2_max = +LIMIT_EXT_PERCENT;
|
||||
}
|
||||
#endif // TELEMETRY_FRSKY
|
||||
}
|
||||
|
||||
// CSW AND switch
|
||||
uint8_t andsw = cs->andsw;
|
||||
if (andsw > SWSRC_LAST_SWITCH) {
|
||||
andsw += SWSRC_SW1-SWSRC_LAST_SWITCH-1;
|
||||
}
|
||||
drawSwitch(CSW_4TH_COLUMN, y, andsw, horz==LS_FIELD_ANDSW ? attr : 0);
|
||||
if ((s_editMode>0 || p1valdiff) && attr) {
|
||||
switch (horz) {
|
||||
case LS_FIELD_FUNCTION:
|
||||
{
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->func, LS_FUNC_MAX);
|
||||
uint8_t new_cstate = lswFamily(cs->func);
|
||||
if (cstate != new_cstate) {
|
||||
#if defined(CPUARM)
|
||||
unsigned int save_func = cs->func;
|
||||
memset(cs, 0, sizeof(LogicalSwitchData));
|
||||
cs->func = save_func;
|
||||
#else
|
||||
cs->v1 = cs->v2 = 0;
|
||||
cs->andsw = 0;
|
||||
#endif
|
||||
if (new_cstate == LS_FAMILY_TIMER) {
|
||||
cs->v1 = cs->v2 = -119; // 1.0
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LS_FIELD_V1:
|
||||
cs->v1 = CHECK_INCDEC_PARAM(event, v1_val, v1_min, v1_max);
|
||||
break;
|
||||
case LS_FIELD_V2:
|
||||
cs->v2 = CHECK_INCDEC_PARAM(event, cs->v2, v2_min, v2_max);
|
||||
break;
|
||||
case LS_FIELD_ANDSW:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_LS_ANDSW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // CPUARM
|
||||
|
||||
@@ -54,13 +54,7 @@ void onModelSelectMenu(const char * result)
|
||||
#endif
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
#if defined(CPUARM)
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.mainname;
|
||||
eeLoadModelName(sub, name);
|
||||
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
|
||||
#endif
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else {
|
||||
@@ -79,9 +73,7 @@ void menuModelSelect(event_t event)
|
||||
{
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
#if defined(CPUARM)
|
||||
storageCheck(true);
|
||||
#endif
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
@@ -105,11 +97,6 @@ void menuModelSelect(event_t event)
|
||||
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (event) {
|
||||
eeFlush(); // flush eeprom write
|
||||
}
|
||||
#endif
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
|
||||
@@ -120,22 +107,13 @@ void menuModelSelect(event_t event)
|
||||
menuVerticalOffset = sub-(NUM_BODY_LINES-1);
|
||||
s_copyMode = 0;
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
#if !defined(CPUARM)
|
||||
storageCheck(true);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
#if defined(CPUARM)
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.mainname;
|
||||
eeLoadModelName(sub, name);
|
||||
SET_WARNING_INFO(name, sizeof(g_model.header.name), ZCHAR);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
s_copyMode = 0;
|
||||
@@ -367,14 +345,7 @@ void menuModelSelect(event_t event)
|
||||
k %= MAX_MODELS;
|
||||
|
||||
if (eeModelExists(k)) {
|
||||
#if defined(CPUARM)
|
||||
putsModelName(4*FW, y, modelHeaders[k].name, k, 0);
|
||||
#else
|
||||
char * name = reusableBuffer.modelsel.listnames[i];
|
||||
if (event) eeLoadModelName(k, name);
|
||||
putsModelName(4*FW, y, name, k, 0);
|
||||
lcdDrawNumber(20*FW, y, eeModelSize(k), RIGHT);
|
||||
#endif
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+menuVerticalOffset!=(vertpos_t)sub)) {
|
||||
lcdDrawChar(1, y, '*');
|
||||
}
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t g_moduleIdx;
|
||||
void menuModelFailsafe(event_t event);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
uint8_t getSwitchWarningsCount()
|
||||
@@ -82,7 +80,6 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_INTERNAL_MODULE_ANTENNA,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
ITEM_MODEL_EXTERNAL_MODULE_LABEL,
|
||||
ITEM_MODEL_EXTERNAL_MODULE_MODE,
|
||||
#if defined(MULTIMODULE)
|
||||
@@ -106,10 +103,6 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_EXTRA_MODULE_CHANNELS,
|
||||
ITEM_MODEL_EXTRA_MODULE_BIND,
|
||||
#endif
|
||||
#else
|
||||
ITEM_MODEL_PPM1_PROTOCOL,
|
||||
ITEM_MODEL_PPM1_PARAMS,
|
||||
#endif
|
||||
#if defined(PCBX7)
|
||||
ITEM_MODEL_TRAINER_LABEL,
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
@@ -146,7 +139,6 @@ enum MenuModelSetupItems {
|
||||
#define CURRENT_MODULE_EDITED(k) (EXTERNAL_MODULE)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if defined(PCBXLITE)
|
||||
#define SW_WARN_ROWS uint8_t(NAVIGATION_LINE_BY_LINE|getSwitchWarningsCount()), uint8_t(getSwitchWarningsCount() > 5 ? TITLE_ROW : HIDDEN_ROW) // X-Lite needs an additional column for full line selection (<])
|
||||
#else
|
||||
@@ -205,16 +197,6 @@ enum MenuModelSetupItems {
|
||||
#define TRAINER_ROWS
|
||||
#endif
|
||||
|
||||
#elif defined(CPUM64)
|
||||
#define CURSOR_ON_CELL (true)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#elif defined(PCBXLITE)
|
||||
#define CURSOR_ON_CELL (menuHorizontalPosition >= 0)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#else
|
||||
#define CURSOR_ON_CELL (true)
|
||||
#define MODEL_SETUP_MAX_LINES ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? HEADER_LINE+ITEM_MODEL_SETUP_MAX : HEADER_LINE+ITEM_MODEL_SETUP_MAX-1)
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void onBindMenu(const char * result)
|
||||
@@ -296,7 +278,7 @@ void menuModelSetup(event_t event)
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
TRAINER_ROWS });
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, CASE_CPUARM(LABEL(PreflightCheck)) CASE_CPUARM(0) 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, 0,
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROWS,
|
||||
@@ -311,12 +293,6 @@ void menuModelSetup(event_t event)
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
TRAINER_ROWS });
|
||||
#elif defined(CPUM64)
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
|
||||
#else
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 2, CASE_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, NUM_SWITCHES, NUM_STICKS+NUM_POTS+NUM_SLIDERS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, CASE_PCBSKY9X(1) CASE_PCBSKY9X(2) });
|
||||
#endif
|
||||
|
||||
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, HEADER_LINE+MODEL_SETUP_MAX_LINES);
|
||||
@@ -332,11 +308,9 @@ void menuModelSetup(event_t event)
|
||||
|
||||
TITLE(STR_MENUSETUP);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
int8_t editMode = s_editMode;
|
||||
@@ -344,7 +318,6 @@ void menuModelSetup(event_t event)
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
if (++k >= (int)DIM(mstate_tab)) {
|
||||
@@ -352,7 +325,6 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LcdFlags blink = ((editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
@@ -360,12 +332,9 @@ void menuModelSetup(event_t event)
|
||||
switch (k) {
|
||||
case ITEM_MODEL_NAME:
|
||||
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_MODELNAME, g_model.header.name, sizeof(g_model.header.name), event, attr);
|
||||
#if defined(CPUARM)
|
||||
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_TIMER1:
|
||||
case ITEM_MODEL_TIMER2:
|
||||
case ITEM_MODEL_TIMER3:
|
||||
@@ -447,69 +416,12 @@ void menuModelSetup(event_t event)
|
||||
timer->persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer->persistent, 0, 2, attr, event);
|
||||
break;
|
||||
}
|
||||
#else // AVR
|
||||
case ITEM_MODEL_TIMER1:
|
||||
case ITEM_MODEL_TIMER2:
|
||||
case ITEM_MODEL_TIMER1_MINUTE_BEEP:
|
||||
case ITEM_MODEL_TIMER2_MINUTE_BEEP:
|
||||
case ITEM_MODEL_TIMER1_COUNTDOWN_BEEP:
|
||||
case ITEM_MODEL_TIMER2_COUNTDOWN_BEEP:
|
||||
{
|
||||
TimerData *timer = &g_model.timers[k>=ITEM_MODEL_TIMER2 ? 1 : 0];
|
||||
if (k==ITEM_MODEL_TIMER1_MINUTE_BEEP || k==ITEM_MODEL_TIMER2_MINUTE_BEEP) {
|
||||
timer->minuteBeep = editCheckBox(timer->minuteBeep, MODEL_SETUP_2ND_COLUMN, y, STR_MINUTEBEEP, attr, event);
|
||||
}
|
||||
else if (k==ITEM_MODEL_TIMER1_COUNTDOWN_BEEP || k==ITEM_MODEL_TIMER2_COUNTDOWN_BEEP) {
|
||||
timer->countdownBeep = editCheckBox(timer->countdownBeep, MODEL_SETUP_2ND_COLUMN, y, STR_BEEPCOUNTDOWN, attr, event);
|
||||
}
|
||||
else {
|
||||
drawStringWithIndex(0*FW, y, STR_TIMER, k>=ITEM_MODEL_TIMER2 ? 2 : 1);
|
||||
drawTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, menuHorizontalPosition==0 ? attr : 0);
|
||||
drawTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, menuHorizontalPosition==1 ? attr : 0, menuHorizontalPosition==2 ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
div_t qr = div(timer->start, 60);
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timer->mode, SWSRC_FIRST, TMRMODE_COUNT+SWSRC_LAST-1/*SWSRC_None removed*/, isSwitchAvailableInTimers);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, qr.quot, 59);
|
||||
timer->start = qr.rem + qr.quot*60;
|
||||
break;
|
||||
case 2:
|
||||
qr.rem -= checkIncDecModel(event, qr.rem+2, 1, 62) - 2;
|
||||
if ((int16_t)timer->start >= qr.rem) {
|
||||
timer->start -= qr.rem ;
|
||||
}
|
||||
if ((int16_t)timer->start > 3599) {
|
||||
timer->start = 3599; // 59:59
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUM2560)
|
||||
case ITEM_MODEL_TIMER1_PERSISTENT:
|
||||
case ITEM_MODEL_TIMER2_PERSISTENT:
|
||||
{
|
||||
TimerData &timer = g_model.timers[k==ITEM_MODEL_TIMER2_PERSISTENT];
|
||||
timer.persistent = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_PERSISTENT, STR_VPERSISTENT, timer.persistent, 0, 2, attr, event);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_EXTENDED_LIMITS:
|
||||
ON_OFF_MENU_ITEM(g_model.extendedLimits, MODEL_SETUP_2ND_COLUMN, y, STR_ELIMITS, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_EXTENDED_TRIMS:
|
||||
#if defined(CPUM64)
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, attr, event);
|
||||
#else
|
||||
ON_OFF_MENU_ITEM(g_model.extendedTrims, MODEL_SETUP_2ND_COLUMN, y, STR_ETRIMS, menuHorizontalPosition<=0 ? attr : 0, event==EVT_KEY_BREAK(KEY_ENTER) ? event : 0);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_RESET_BTN, (menuHorizontalPosition>0 && !NO_HIGHLIGHT()) ? attr : 0);
|
||||
if (attr && menuHorizontalPosition>0) {
|
||||
@@ -523,14 +435,11 @@ void menuModelSetup(event_t event)
|
||||
AUDIO_WARNING1();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_DISPLAY_TRIMS:
|
||||
g_model.displayTrims = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_DISPLAY_TRIMS, STR_VDISPLAYTRIMS, g_model.displayTrims, 0, 2, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_TRIM_INC:
|
||||
g_model.trimInc = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_TRIMINC, STR_VTRIMINC, g_model.trimInc, -2, 2, attr, event);
|
||||
@@ -557,7 +466,6 @@ void menuModelSetup(event_t event)
|
||||
ON_OFF_MENU_ITEM(g_model.thrTrim, MODEL_SETUP_2ND_COLUMN, y, STR_TTRIM, attr, event);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_PREFLIGHT_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_PREFLIGHT);
|
||||
break;
|
||||
@@ -565,7 +473,6 @@ void menuModelSetup(event_t event)
|
||||
case ITEM_MODEL_CHECKLIST_DISPLAY:
|
||||
ON_OFF_MENU_ITEM(g_model.displayChecklist, MODEL_SETUP_2ND_COLUMN, y, STR_CHECKLIST, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_THROTTLE_WARNING:
|
||||
g_model.disableThrottleWarning = !editCheckBox(!g_model.disableThrottleWarning, MODEL_SETUP_2ND_COLUMN, y, STR_THROTTLEWARNING, attr, event);
|
||||
@@ -667,24 +574,13 @@ void menuModelSetup(event_t event)
|
||||
switch (event) {
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (menuHorizontalPosition < NUM_SWITCHES-1) {
|
||||
g_model.switchWarningEnable ^= (1 << menuHorizontalPosition);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#if defined(CPUM64)
|
||||
getMovedSwitch();
|
||||
g_model.switchWarningState = switches_states;
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
#else
|
||||
if (menuHorizontalPosition == NUM_SWITCHES-1) {
|
||||
START_NO_HIGHLIGHT();
|
||||
getMovedSwitch();
|
||||
@@ -692,7 +588,6 @@ void menuModelSetup(event_t event)
|
||||
AUDIO_WARNING1();
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
killEvents(event);
|
||||
break;
|
||||
}
|
||||
@@ -717,14 +612,8 @@ void menuModelSetup(event_t event)
|
||||
if (line && (menuHorizontalPosition == i)) {
|
||||
attr = BLINK | INVERS;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive) ? c : '-', attr);
|
||||
#else
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+i*FW, y, (swactive || (attr & BLINK)) ? c : '-', attr);
|
||||
#endif
|
||||
#if !defined(CPUM64)
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+(NUM_SWITCHES*FW), y, PSTR("<]"), (menuHorizontalPosition == NUM_SWITCHES-1 && !NO_HIGHLIGHT()) ? line : 0);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -796,13 +685,11 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_USE_GLOBAL_FUNCTIONS:
|
||||
lcdDrawTextAlignedLeft(y, STR_USE_GLOBAL_FUNCS);
|
||||
drawCheckBox(MODEL_SETUP_2ND_COLUMN, y, !g_model.noGlobalFunctions, attr);
|
||||
if (attr) g_model.noGlobalFunctions = !checkIncDecModel(event, !g_model.noGlobalFunctions, 0, 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_INTERNAL_MODULE_LABEL:
|
||||
@@ -831,7 +718,6 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, TR_EXTERNALRF);
|
||||
break;
|
||||
@@ -903,7 +789,6 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_SUBTYPE:
|
||||
@@ -1014,7 +899,6 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_MODEL_EXTRA_MODULE_CHANNELS:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
@@ -1041,7 +925,6 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
case ITEM_MODEL_TRAINER_PARAMS:
|
||||
@@ -1052,7 +935,6 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_MODEL_EXTRA_MODULE_BIND:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
@@ -1206,7 +1088,6 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && defined(REVX)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_OUTPUT_TYPE:
|
||||
@@ -1221,7 +1102,6 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PCBTARANIS)
|
||||
case ITEM_MODEL_INTERNAL_MODULE_FAILSAFE:
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE: {
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
ModuleData &moduleData = g_model.moduleData[moduleIdx];
|
||||
@@ -1385,31 +1265,7 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_MODEL_PPM1_PROTOCOL:
|
||||
lcdDrawTextAlignedLeft(y, NO_INDENT(STR_PROTO));
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VPROTOS, protocol, menuHorizontalPosition<=0 ? attr : 0);
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, menuHorizontalPosition!=0 ? attr : 0);
|
||||
}
|
||||
else if (menuHorizontalPosition>0 && attr) {
|
||||
MOVE_CURSOR_FROM_HERE();
|
||||
}
|
||||
if (attr && (editMode>0 || p1valdiff || (!IS_PPM_PROTOCOL(protocol) && !IS_DSM2_PROTOCOL(protocol)))) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.protocol, PROTO_MAX-1);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4);
|
||||
g_model.ppmFrameLength = g_model.ppmNCH * 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
case ITEM_MODEL_PPM2_PROTOCOL:
|
||||
@@ -1456,60 +1312,6 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_MODEL_PPM1_PARAMS:
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 35);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.pulsePol, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if defined(DSM2) || defined(PXX)
|
||||
else if (IS_DSM2_PROTOCOL(protocol) || IS_PXX_PROTOCOL(protocol)) {
|
||||
if (attr && menuHorizontalPosition > 1) {
|
||||
REPEAT_LAST_CURSOR_MOVE(); // limit 3 column row to 2 colums (Rx_Num and RANGE fields)
|
||||
}
|
||||
lcdDrawTextAlignedLeft(y, STR_RECEIVER_NUM);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, g_model.header.modelId[0], (menuHorizontalPosition<=0 ? attr : 0) | LEADING0|LEFT, 2);
|
||||
if (attr && (menuHorizontalPosition==0 && (editMode>0 || p1valdiff))) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.header.modelId[0], 99);
|
||||
}
|
||||
#if defined(PXX)
|
||||
if (protocol == PROTO_PXX) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_SYNCMENU, menuHorizontalPosition!=0 ? attr : 0);
|
||||
uint8_t newFlag = 0;
|
||||
if (attr && menuHorizontalPosition>0 && editMode>0) {
|
||||
// send reset code
|
||||
newFlag = MODULE_BIND;
|
||||
}
|
||||
moduleFlag[0] = newFlag;
|
||||
}
|
||||
#endif
|
||||
#if defined(DSM2)
|
||||
if (IS_DSM2_PROTOCOL(protocol)) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+4*FW, y, STR_MODULE_RANGE, menuHorizontalPosition!=0 ? attr : 0);
|
||||
moduleFlag[0] = (attr && menuHorizontalPosition>0 && editMode>0) ? MODULE_RANGECHECK : 0; // [MENU] key toggles range check mode
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1535,17 +1337,14 @@ void menuModelSetup(event_t event)
|
||||
checkModelIdUnique(g_eeGeneral.currModel, EXTRA_MODULE);
|
||||
break;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
if (menuHorizontalPosition == 0)
|
||||
checkModelIdUnique(g_eeGeneral.currModel, EXTERNAL_MODULE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
@@ -1660,4 +1459,3 @@ void menuModelFailsafe(event_t event)
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -145,11 +145,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
{
|
||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t eeFlags = (functions == g_model.customFn) ? EE_MODEL : EE_GENERAL;
|
||||
#elif !defined(CPUM64) || defined(AUTOSWITCH)
|
||||
uint8_t eeFlags = EE_MODEL;
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE)
|
||||
@@ -193,7 +189,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
switch (j) {
|
||||
case 0:
|
||||
#if defined(CPUARM)
|
||||
if (sub==k && menuHorizontalPosition < 1 && CFN_SWITCH(cfn) == SWSRC_NONE) {
|
||||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | INVERS | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
@@ -202,26 +197,16 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
}
|
||||
#else
|
||||
drawSwitch(MODEL_SPECIAL_FUNC_1ST_COLUMN, y, CFN_SWITCH(cfn), attr | ((functionsContext->activeSwitches & ((MASK_CFN_TYPE)1 << k)) ? BOLD : 0));
|
||||
if (active || AUTOSWITCH_ENTER_LONG()) CHECK_INCDEC_SWITCH(event, CFN_SWITCH(cfn), SWSRC_FIRST, SWSRC_LAST, eeFlags, isSwitchAvailableInCustomFunctions);
|
||||
#endif //CPUARM
|
||||
#if defined(CPUARM)
|
||||
if (func == FUNC_OVERRIDE_CHANNEL && functions != g_model.customFn) {
|
||||
func = CFN_FUNC(cfn) = func+1;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (CFN_SWITCH(cfn)) {
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_2ND_COLUMN, y, STR_VFSWFUNC, func, attr);
|
||||
if (active) {
|
||||
#if defined(CPUARM)
|
||||
CFN_FUNC(cfn) = checkIncDec(event, CFN_FUNC(cfn), 0, FUNC_MAX-1, eeFlags, isAssignableFunctionAvailable);
|
||||
#else
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, CFN_FUNC(cfn), FUNC_MAX-1);
|
||||
#endif
|
||||
if (checkIncDec_Ret) CFN_RESET(cfn);
|
||||
}
|
||||
}
|
||||
@@ -244,32 +229,22 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
#endif
|
||||
if (func == FUNC_TRAINER) {
|
||||
maxParam = 4;
|
||||
#if defined(CPUARM)
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_CH_INDEX(cfn)==0 ? 0 : MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
|
||||
#else
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, MIXSRC_Rud+CFN_CH_INDEX(cfn)-1, attr);
|
||||
#endif
|
||||
}
|
||||
#if defined(GVARS)
|
||||
else if (func == FUNC_ADJUST_GVAR) {
|
||||
maxParam = MAX_GVARS-1;
|
||||
drawStringWithIndex(lcdNextPos, y, STR_GV, CFN_GVAR_INDEX(cfn)+1, attr);
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_GVAR_INDEX(cfn) = checkIncDec(event, CFN_GVAR_INDEX(cfn), 0, maxParam, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_GVAR_INDEX(cfn), maxParam);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
#endif // GVARS
|
||||
#if defined(CPUARM)
|
||||
else if (func == FUNC_SET_TIMER) {
|
||||
maxParam = MAX_TIMERS-1;
|
||||
lcdDrawTextAtIndex(lcdNextPos, y, STR_VFSWRESET, CFN_TIMER_INDEX(cfn), attr);
|
||||
if (active) CFN_TIMER_INDEX(cfn) = checkIncDec(event, CFN_TIMER_INDEX(cfn), 0, maxParam, eeFlags);
|
||||
break;
|
||||
}
|
||||
#endif // CPUARM
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
@@ -281,15 +256,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
{
|
||||
INCDEC_DECLARE_VARS(eeFlags);
|
||||
int16_t val_displayed = CFN_PARAM(cfn);
|
||||
#if defined(CPUARM)
|
||||
int16_t val_min = 0;
|
||||
int16_t val_max = 255;
|
||||
#else
|
||||
int8_t val_min = 0;
|
||||
uint8_t val_max = 255;
|
||||
#endif
|
||||
if (func == FUNC_RESET) {
|
||||
#if defined (CPUARM)
|
||||
val_max = FUNC_RESET_PARAM_FIRST_TELEM+lastUsedTelemetryIndex();
|
||||
int param = CFN_PARAM(cfn);
|
||||
if (param < FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
@@ -300,23 +269,13 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
lcdDrawSizedText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, sensor->label, TELEM_LABEL_LEN, attr|ZCHAR);
|
||||
}
|
||||
if (active) INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalResetSpecialFunction : isSourceAvailableInResetSpecialFunction);
|
||||
#else
|
||||
val_max = FUNC_RESET_PARAM_LAST;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_VFSWRESET, CFN_PARAM(cfn), attr);
|
||||
#endif // CPUARM
|
||||
}
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
else if (func == FUNC_OVERRIDE_CHANNEL) {
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(MIXSRC_FIRST_CH, val_min, val_max);
|
||||
#else
|
||||
val_displayed = (int8_t)CFN_PARAM(cfn);
|
||||
val_min = -LIMIT_EXT_PERCENT; val_max = +LIMIT_EXT_PERCENT;
|
||||
#endif
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
}
|
||||
#endif // OVERRIDE_CHANNEL_FUNCTION
|
||||
#if defined(CPUARM)
|
||||
else if (func >= FUNC_SET_FAILSAFE && func <= FUNC_BIND) {
|
||||
val_max = NUM_MODULES-1;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, "\004Int.Ext.", CFN_PARAM(cfn), attr);
|
||||
@@ -325,7 +284,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
getMixSrcRange(MIXSRC_FIRST_TIMER, val_min, val_max);
|
||||
drawTimer(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT, attr);
|
||||
}
|
||||
#endif
|
||||
#if defined(AUDIO)
|
||||
else if (func == FUNC_PLAY_SOUND) {
|
||||
val_max = AU_SPECIAL_SOUND_LAST-AU_SPECIAL_SOUND_FIRST-1;
|
||||
@@ -373,7 +331,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
}
|
||||
#endif // CPUARM && SDCARD
|
||||
#if defined(CPUARM)
|
||||
else if (func == FUNC_VOLUME) {
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
@@ -382,36 +339,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
}
|
||||
#elif defined(VOICE)
|
||||
else if (func == FUNC_PLAY_TRACK) {
|
||||
#if defined(GVARS)
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
s_editMode = !s_editMode;
|
||||
active = true;
|
||||
val_displayed = (val_displayed > 250 ? 0 : 251);
|
||||
}
|
||||
if (val_displayed > 250) {
|
||||
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed-250, attr);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
|
||||
}
|
||||
#else
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed+PROMPT_CUSTOM_BASE, attr|LEFT);
|
||||
#endif // GVARS
|
||||
}
|
||||
else if (func == FUNC_PLAY_BOTH) {
|
||||
lcdDrawChar(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr);
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr);
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT);
|
||||
}
|
||||
else if (func == FUNC_PLAY_VALUE) {
|
||||
val_max = MIXSRC_FIRST_TELEM + TELEM_DISPLAY_MAX - 1;
|
||||
drawSource(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr);
|
||||
INCDEC_ENABLE_CHECK(functionsContext == &globalFunctionsContext ? isSourceAvailableInGlobalFunctions : isSourceAvailable);
|
||||
}
|
||||
#endif // CPUARM
|
||||
#if defined(SDCARD)
|
||||
else if (func == FUNC_LOGS) {
|
||||
if (val_displayed) {
|
||||
@@ -428,13 +355,8 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
switch (CFN_GVAR_MODE(cfn)) {
|
||||
case FUNC_ADJUST_GVAR_CONSTANT:
|
||||
val_displayed = (int16_t)CFN_PARAM(cfn);
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
|
||||
drawGVarValue(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, CFN_GVAR_INDEX(cfn), val_displayed, attr|LEFT);
|
||||
#else
|
||||
val_min = -CFN_GVAR_CST_MAX; val_max = +CFN_GVAR_CST_MAX;
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, val_displayed, attr|LEFT);
|
||||
#endif // CPUARM
|
||||
break;
|
||||
case FUNC_ADJUST_GVAR_SOURCE:
|
||||
val_max = MIXSRC_LAST_CH;
|
||||
@@ -449,14 +371,9 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
drawStringWithIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, STR_GV, val_displayed+1, attr);
|
||||
break;
|
||||
default: // FUNC_ADJUST_GVAR_INC
|
||||
#if defined(CPUARM)
|
||||
getMixSrcRange(CFN_GVAR_INDEX(cfn) + MIXSRC_FIRST_GVAR, val_min, val_max);
|
||||
lcdDrawText(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, (val_displayed < 0 ? "-= " : "+= "), attr);
|
||||
drawGVarValue(lcdNextPos, y, CFN_GVAR_INDEX(cfn), abs(val_displayed), attr|LEFT);
|
||||
#else
|
||||
val_max = 1;
|
||||
lcdDrawTextAtIndex(MODEL_SPECIAL_FUNC_3RD_COLUMN, y, PSTR("\003-=1+=1"), val_displayed, attr);
|
||||
#endif // CPUARM
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -465,9 +382,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
s_editMode = !s_editMode;
|
||||
active = true;
|
||||
CFN_GVAR_MODE(cfn) += 1;
|
||||
#if defined(CPUARM)
|
||||
CFN_GVAR_MODE(cfn) &= 0x03;
|
||||
#endif
|
||||
val_displayed = 0;
|
||||
}
|
||||
}
|
||||
@@ -502,29 +417,19 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
case 4:
|
||||
if (HAS_ENABLE_PARAM(func)) {
|
||||
drawCheckBox(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF, y, CFN_ACTIVE(cfn), attr);
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_ACTIVE(cfn) = checkIncDec(event, CFN_ACTIVE(cfn), 0, 1, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_ACTIVE(cfn), 1);
|
||||
#endif
|
||||
}
|
||||
else if (HAS_REPEAT_PARAM(func)) {
|
||||
if (CFN_PLAY_REPEAT(cfn) == 0) {
|
||||
lcdDrawChar(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+3, y, '-', attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (CFN_PLAY_REPEAT(cfn) == CFN_PLAY_REPEAT_NOSTART) {
|
||||
lcdDrawText(MODEL_SPECIAL_FUNC_4TH_COLUMN_ONOFF+1, y, "!-", attr);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawNumber(MODEL_SPECIAL_FUNC_4TH_COLUMN+2+FW, y, CFN_PLAY_REPEAT(cfn)*CFN_PLAY_REPEAT_MUL, RIGHT | attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (active) CFN_PLAY_REPEAT(cfn) = checkIncDec(event, CFN_PLAY_REPEAT(cfn)==CFN_PLAY_REPEAT_NOSTART?-1:CFN_PLAY_REPEAT(cfn), -1, 60/CFN_PLAY_REPEAT_MUL, eeFlags);
|
||||
#else
|
||||
if (active) CHECK_INCDEC_MODELVAR_ZERO(event, CFN_PLAY_REPEAT(cfn), 60/CFN_PLAY_REPEAT_MUL);
|
||||
#endif
|
||||
}
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
|
||||
@@ -24,23 +24,10 @@ enum MenuModelTelemetryFrskyItems {
|
||||
CASE_CPUARM(ITEM_TELEMETRY_PROTOCOL_TYPE)
|
||||
#if defined(REVX)
|
||||
ITEM_TELEMETRY_INVERTED_SERIAL,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
ITEM_TELEMETRY_A1_LABEL,
|
||||
ITEM_TELEMETRY_A1_RANGE,
|
||||
ITEM_TELEMETRY_A1_OFFSET,
|
||||
ITEM_TELEMETRY_A1_ALARM1,
|
||||
ITEM_TELEMETRY_A1_ALARM2,
|
||||
ITEM_TELEMETRY_A2_LABEL,
|
||||
ITEM_TELEMETRY_A2_RANGE,
|
||||
ITEM_TELEMETRY_A2_OFFSET,
|
||||
ITEM_TELEMETRY_A2_ALARM1,
|
||||
ITEM_TELEMETRY_A2_ALARM2,
|
||||
#endif
|
||||
ITEM_TELEMETRY_RSSI_LABEL,
|
||||
ITEM_TELEMETRY_RSSI_ALARM1,
|
||||
ITEM_TELEMETRY_RSSI_ALARM2,
|
||||
#if defined(CPUARM)
|
||||
ITEM_TELEMETRY_DISABLE_ALARMS,
|
||||
ITEM_TELEMETRY_SENSORS_LABEL,
|
||||
ITEM_TELEMETRY_SENSOR1,
|
||||
@@ -79,37 +66,11 @@ enum MenuModelTelemetryFrskyItems {
|
||||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
ITEM_TELEMETRY_USR_LABEL,
|
||||
ITEM_TELEMETRY_USR_PROTO,
|
||||
ITEM_TELEMETRY_USR_BLADES,
|
||||
#endif
|
||||
ITEM_TELEMETRY_USR_VOLTAGE_SOURCE,
|
||||
ITEM_TELEMETRY_USR_CURRENT_SOURCE,
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
ITEM_TELEMETRY_FAS_OFFSET,
|
||||
#endif
|
||||
#endif
|
||||
#if defined(VARIO)
|
||||
ITEM_TELEMETRY_VARIO_LABEL,
|
||||
ITEM_TELEMETRY_VARIO_SOURCE,
|
||||
ITEM_TELEMETRY_VARIO_RANGE,
|
||||
ITEM_TELEMETRY_VARIO_CENTER,
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
// TODO check the cost of moving them to a new screen on the 9X
|
||||
ITEM_TELEMETRY_SCREEN_LABEL1,
|
||||
ITEM_TELEMETRY_SCREEN_LINE1,
|
||||
ITEM_TELEMETRY_SCREEN_LINE2,
|
||||
ITEM_TELEMETRY_SCREEN_LINE3,
|
||||
ITEM_TELEMETRY_SCREEN_LINE4,
|
||||
ITEM_TELEMETRY_SCREEN_LABEL2,
|
||||
ITEM_TELEMETRY_SCREEN_LINE5,
|
||||
ITEM_TELEMETRY_SCREEN_LINE6,
|
||||
ITEM_TELEMETRY_SCREEN_LINE7,
|
||||
ITEM_TELEMETRY_SCREEN_LINE8,
|
||||
#endif
|
||||
ITEM_TELEMETRY_MAX
|
||||
};
|
||||
@@ -127,75 +88,36 @@ enum MenuModelTelemetryFrskyItems {
|
||||
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CHANNELS_ROWS
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
|
||||
#else
|
||||
#define CHANNEL_ROWS(x) LABEL(CHANNEL), 1, 0, 2, 2
|
||||
#define CHANNELS_ROWS CHANNEL_ROWS(0), CHANNEL_ROWS(1),
|
||||
#define SENSORS_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
#define IF_FAS_OFFSET(x) x,
|
||||
#else
|
||||
#define IF_FAS_OFFSET(x)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define USRDATA_ROWS
|
||||
#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
#define USRDATA_ROWS LABEL(UsrData), 0, 0, 0, 0, IF_FAS_OFFSET(0)
|
||||
#else
|
||||
#define USRDATA_ROWS 0, 0, IF_FAS_OFFSET(0)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 1,
|
||||
#else
|
||||
#define RSSI_ROWS LABEL(RSSI), 1, 1,
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM) || defined(GAUGES)
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
#else
|
||||
#define SCREEN_TYPE_ROWS LABEL(SCREEN)
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define VARIO_ROWS 1,
|
||||
#elif defined(CPUARM)
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#else
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 1,
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (PCBTARANIS)
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (! IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#elif defined (CPUARM)
|
||||
#else
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(REVX)
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY, TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define TELEMETRY_SCREENS_ROWS
|
||||
#else
|
||||
#define TELEMETRY_SCREEN_ROWS(x) SCREEN_TYPE_ROWS, 2, 2, 2, 2
|
||||
#define TELEMETRY_CURRENT_CHANNEL(k) (k >= ITEM_TELEMETRY_A2_LABEL ? TELEM_ANA_A2 : TELEM_ANA_A1)
|
||||
#define TELEMETRY_SCREENS_ROWS TELEMETRY_SCREEN_ROWS(0), TELEMETRY_SCREEN_ROWS(1)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum SensorFields {
|
||||
SENSOR_FIELD_NAME,
|
||||
SENSOR_FIELD_TYPE,
|
||||
@@ -484,18 +406,15 @@ void onSensorMenu(const char * result)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuModelTelemetryFrsky(event_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS VARIO_ROWS TELEMETRY_SCREENS_ROWS });
|
||||
|
||||
@@ -516,7 +435,6 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#if defined(CPUARM)
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
if (++k >= (int)DIM(mstate_tab)) {
|
||||
@@ -524,18 +442,11 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
#if !defined(CPUARM)
|
||||
uint8_t ch = TELEMETRY_CURRENT_CHANNEL(k);
|
||||
FrSkyChannelData & channel = g_model.frsky.channels[ch];
|
||||
uint8_t dest = TELEM_A1-1+ch;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_TELEMETRY_SENSORS) {
|
||||
int index = k - ITEM_TELEMETRY_SENSOR1;
|
||||
lcdDrawNumber(INDENT_WIDTH, y, index+1, LEFT|attr);
|
||||
@@ -571,10 +482,8 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
switch (k) {
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_PROTOCOL_TYPE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
|
||||
@@ -588,9 +497,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
ON_OFF_MENU_ITEM(g_model.moduleData[EXTERNAL_MODULE].invertedSerial, TELEM_COL2, y, STR_INVERTED_SERIAL, attr, event);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_SENSORS_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_SENSORS);
|
||||
break;
|
||||
@@ -632,82 +539,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
case ITEM_TELEMETRY_IGNORE_SENSOR_INSTANCE:
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_TELEMETRY_A1_LABEL:
|
||||
case ITEM_TELEMETRY_A2_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_ACHANNEL);
|
||||
lcdDrawNumber(2*FW, y, ch+1, 0);
|
||||
drawTelemetryValue(TELEM_COL2+6*FW, y, dest, telemetryData.analog[ch].value, LEFT);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_RANGE:
|
||||
case ITEM_TELEMETRY_A2_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
drawTelemetryValue(TELEM_COL2, y, dest, 255-channel.offset, (menuHorizontalPosition<=0 ? attr : 0)|NO_UNIT|LEFT);
|
||||
lcdDrawTextAtIndex(lcdLastRightPos, y, STR_VTELEMUNIT, channel.type, menuHorizontalPosition!=0 ? attr : 0);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint16_t ratio = checkIncDec(event, channel.ratio, 0, 256, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
if (ratio == 127 && channel.multiplier > 0) {
|
||||
channel.multiplier--; channel.ratio = 255;
|
||||
}
|
||||
else if (ratio == 256) {
|
||||
if (channel.multiplier < FRSKY_MULTIPLIER_MAX) { channel.multiplier++; channel.ratio = 128; }
|
||||
}
|
||||
else {
|
||||
channel.ratio = ratio;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, channel.type, UNIT_A1A2_MAX);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_OFFSET:
|
||||
case ITEM_TELEMETRY_A2_OFFSET:
|
||||
lcdDrawTextAlignedLeft(y, STR_OFFSET);
|
||||
drawTelemetryValue(TELEM_COL2, y, dest, 0, LEFT|attr);
|
||||
if (attr) channel.offset = checkIncDec(event, channel.offset, -256, 256, EE_MODEL);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_A1_ALARM1:
|
||||
case ITEM_TELEMETRY_A1_ALARM2:
|
||||
case ITEM_TELEMETRY_A2_ALARM1:
|
||||
case ITEM_TELEMETRY_A2_ALARM2:
|
||||
{
|
||||
uint8_t alarm = ((k==ITEM_TELEMETRY_A1_ALARM1 || k==ITEM_TELEMETRY_A2_ALARM1) ? 0 : 1);
|
||||
lcdDrawTextAlignedLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ALARM_LEVEL(ch, alarm), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawTextAtIndex(TELEM_COL2+4*FW, y, STR_VALARMFN, ALARM_GREATER(ch, alarm), (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
drawTelemetryValue(TELEM_COL2+6*FW, y, dest, channel.alarms_value[alarm], ((CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0) | LEFT);
|
||||
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
uint8_t t;
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
t = ALARM_LEVEL(ch, alarm);
|
||||
channel.alarms_level = (channel.alarms_level & ~(3<<(2*alarm))) + (checkIncDecModel(event, t, 0, 3) << (2*alarm));
|
||||
break;
|
||||
case 1:
|
||||
t = ALARM_GREATER(ch, alarm);
|
||||
if (t != checkIncDecModel(event, t, 0, 1)) {
|
||||
channel.alarms_greater ^= (1 << alarm);
|
||||
frskySendAlarms();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
channel.alarms_value[alarm] = checkIncDec(event, channel.alarms_value[alarm], 0, 255, EE_MODEL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
@@ -721,7 +553,6 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
#if defined(CPUARM)
|
||||
bool warning = (k==ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
lcdDrawTextAlignedLeft(y, (warning ? STR_LOWALARM : STR_CRITICALALARM));
|
||||
lcdDrawNumber(LCD_W, y, warning? g_model.rssiAlarms.getWarningRssi() : g_model.rssiAlarms.getCriticalRssi(), RIGHT | attr, 3);
|
||||
@@ -731,71 +562,11 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
else
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.rssiAlarms.critical, -30, 30);
|
||||
}
|
||||
#else // CPUARM
|
||||
uint8_t alarm = (k-ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
lcdDrawTextAlignedLeft(y, STR_ALARM);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VALARM, ((2+alarm+g_model.frsky.rssiAlarms[alarm].level)%4), menuHorizontalPosition<=0 ? attr : 0);
|
||||
lcdDrawChar(TELEM_COL2+4*FW, y, '<');
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, getRssiAlarmValue(alarm), LEFT|(menuHorizontalPosition!=0 ? attr : 0), 3);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].level, -3, 2); // circular (saves flash)
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.rssiAlarms[alarm].value, -30, 30);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // CPUARM
|
||||
break;
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
case ITEM_TELEMETRY_DISABLE_ALARMS:
|
||||
g_model.rssiAlarms.disabled = editCheckBox(g_model.rssiAlarms.disabled, LCD_W - 10, y, STR_DISABLE_ALARM, attr, event);
|
||||
break;
|
||||
#endif
|
||||
#if !defined(CPUARM)
|
||||
#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH)
|
||||
case ITEM_TELEMETRY_USR_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_USRDATA);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_PROTO:
|
||||
lcdDrawTextAlignedLeft(y, STR_PROTO);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VTELPROTO, g_model.frsky.usrProto, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.usrProto, USR_PROTO_LAST);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_BLADES:
|
||||
lcdDrawTextAlignedLeft(y, STR_BLADES);
|
||||
lcdDrawNumber(TELEM_COL2+FWNUM, y, 2+g_model.frsky.blades, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.blades, MAX_BLADES);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOLTAGE);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.voltsSource+1, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.voltsSource, FRSKY_VOLTS_SOURCE_LAST);
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_USR_CURRENT_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_CURRENT);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_AMPSRC, g_model.frsky.currentSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, FRSKY_CURRENT_SOURCE_LAST);
|
||||
break;
|
||||
|
||||
#if defined(FAS_OFFSET) || !defined(CPUM64)
|
||||
case ITEM_TELEMETRY_FAS_OFFSET:
|
||||
lcdDrawTextAlignedLeft(y, STR_FAS_OFFSET);
|
||||
lcdDrawNumber(TELEM_COL2, y, g_model.frsky.fasOffset, attr|LEFT|PREC1);
|
||||
lcdDrawNumber(TELEM_COL2+6*FW, y, telemetryData.hub.current, LEFT|PREC1);
|
||||
lcdDrawChar(TELEM_COL2+8*FW, y, 'A');
|
||||
if (attr) g_model.frsky.fasOffset = checkIncDec(event, g_model.frsky.fasOffset, -120, 120, EE_MODEL);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(VARIO)
|
||||
case ITEM_TELEMETRY_VARIO_LABEL:
|
||||
@@ -804,35 +575,12 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_VARIO_SOURCE:
|
||||
lcdDrawTextAlignedLeft(y, STR_SOURCE);
|
||||
#if defined(CPUARM)
|
||||
drawSource(TELEM_COL2, y, g_model.frsky.varioSource ? MIXSRC_FIRST_TELEM+3*(g_model.frsky.varioSource-1) : 0, attr);
|
||||
if (attr) {
|
||||
g_model.frsky.varioSource = checkIncDec(event, g_model.frsky.varioSource, 0, MAX_TELEMETRY_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
|
||||
}
|
||||
#else
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_VARIOSRC, g_model.frsky.varioSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioSource, 0, VARIO_SOURCE_LAST);
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(PCBSTD)
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
|
||||
lcdDrawNumber(TELEM_COL2, y, 5+g_model.frsky.varioCenterMax, (menuHorizontalPosition==0 ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+8*FW, y, 10+g_model.frsky.varioMax, (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -15, +15);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMax, -7, 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_RANGE);
|
||||
if (attr && CURSOR_ON_LINE()) {
|
||||
@@ -856,9 +604,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_CENTER);
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+4*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1|LEFT);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAtIndex(TELEM_COL2+8*FW, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));
|
||||
#endif
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
@@ -867,99 +613,14 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMax, -5+max<int8_t>(-10, g_model.frsky.varioCenterMin-5), +15);
|
||||
break;
|
||||
#if defined(CPUARM)
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.varioCenterSilent, 1);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL1:
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL2:
|
||||
{
|
||||
uint8_t screenIndex = (k < ITEM_TELEMETRY_SCREEN_LABEL2 ? 1 : 2);
|
||||
drawStringWithIndex(0*FW, y, STR_SCREEN, screenIndex);
|
||||
#if defined(GAUGES)
|
||||
bool screenType = g_model.frsky.screensType & screenIndex;
|
||||
if (screenType != (bool)editChoice(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, screenType, 0, 1, attr, event))
|
||||
g_model.frsky.screensType ^= screenIndex;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_TELEMETRY_SCREEN_LINE1:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE2:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE3:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE4:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE5:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE6:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE7:
|
||||
case ITEM_TELEMETRY_SCREEN_LINE8:
|
||||
{
|
||||
uint8_t screenIndex, lineIndex;
|
||||
if (k < ITEM_TELEMETRY_SCREEN_LABEL2) {
|
||||
screenIndex = 0;
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE1;
|
||||
}
|
||||
else {
|
||||
screenIndex = 1;
|
||||
lineIndex = k-ITEM_TELEMETRY_SCREEN_LINE5;
|
||||
}
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
lcdDrawTextAtIndex(TELEM_COL1, y, STR_VTELEMCHNS, barSource, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (barSource) {
|
||||
drawTelemetryValue(TELEM_BARS_COLMIN, y, barSource-1, convertBarTelemValue(barSource, bar.barMin), (menuHorizontalPosition==1 ? attr : 0) | LEFT);
|
||||
drawTelemetryValue(TELEM_BARS_COLMAX, y, barSource-1, convertBarTelemValue(barSource, 255-bar.barMax), (menuHorizontalPosition==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else if (attr && menuHorizontalPosition>0) {
|
||||
menuHorizontalPosition = 0;
|
||||
}
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
bar.source = CHECK_INCDEC_MODELVAR_ZERO(event, barSource, TELEM_DISPLAY_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
bar.barMin = 0;
|
||||
bar.barMax = 255 - maxBarTelemValue(bar.source);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bar.barMin = checkIncDec(event, bar.barMin, 0, 254-bar.barMax, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
case 2:
|
||||
bar.barMax = 255 - checkIncDec(event, 255-bar.barMax, bar.barMin+1, maxBarTelemValue(barSource), EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
for (uint8_t c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
uint8_t cellAttr = (menuHorizontalPosition==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
uint8_t pos[] = {INDENT_WIDTH, TELEM_COL2};
|
||||
lcdDrawTextAtIndex(pos[c], y, STR_VTELEMCHNS, value, cellAttr);
|
||||
if (cellAttr && (s_editMode>0 || p1valdiff)) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, (lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX, isTelemetrySourceAvailable);
|
||||
}
|
||||
}
|
||||
if (attr && menuHorizontalPosition == NUM_LINE_ITEMS) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif // !defined(CPUARM)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ int8_t checkIncDec_Ret;
|
||||
#define DBLKEYS_PRESSED_LFT_DWN(in) ((in & (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN)) == (KEYS_GPIO_PIN_LEFT + KEYS_GPIO_PIN_DOWN))
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
INIT_STOPS(stops100, 3, -100, 0, 100)
|
||||
INIT_STOPS(stops1000, 3, -1000, 0, 1000)
|
||||
INIT_STOPS(stopsSwitch, 15, SWSRC_FIRST, CATEGORY_END(-SWSRC_FIRST_LOGICAL_SWITCH), CATEGORY_END(-SWSRC_FIRST_TRIM), CATEGORY_END(-SWSRC_LAST_SWITCH+1), 0, CATEGORY_END(SWSRC_LAST_SWITCH), CATEGORY_END(SWSRC_FIRST_TRIM-1), CATEGORY_END(SWSRC_FIRST_LOGICAL_SWITCH-1), SWSRC_LAST)
|
||||
@@ -515,138 +514,17 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
return newval;
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
int16_t checkIncDec(event_t event, int16_t val, int16_t i_min, int16_t i_max, uint8_t i_flags)
|
||||
{
|
||||
int16_t newval = val;
|
||||
|
||||
#if defined(DBLKEYS)
|
||||
uint8_t in = KEYS_PRESSED();
|
||||
if (!(i_flags & NO_DBLKEYS) && (EVT_KEY_MASK(event))) {
|
||||
bool dblkey = true;
|
||||
if (DBLKEYS_PRESSED_RGT_LFT(in))
|
||||
newval = -val;
|
||||
else if (DBLKEYS_PRESSED_RGT_UP(in)) {
|
||||
newval = (i_max > 100 ? 100 : i_max);
|
||||
}
|
||||
else if (DBLKEYS_PRESSED_LFT_DWN(in)) {
|
||||
newval = (i_min < -100 ? -100 : i_min);
|
||||
}
|
||||
else if (DBLKEYS_PRESSED_UP_DWN(in)) {
|
||||
newval = 0;
|
||||
}
|
||||
else {
|
||||
dblkey = false;
|
||||
}
|
||||
|
||||
if (dblkey) {
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
killEvents(KEY_RIGHT);
|
||||
killEvents(KEY_LEFT);
|
||||
event = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (event==EVT_KEY_FIRST(KEY_RIGHT) || event==EVT_KEY_REPT(KEY_RIGHT) || (s_editMode>0 && (IS_ROTARY_RIGHT(event) || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)))) {
|
||||
newval++;
|
||||
}
|
||||
else if (event==EVT_KEY_FIRST(KEY_LEFT) || event==EVT_KEY_REPT(KEY_LEFT) || (s_editMode>0 && (IS_ROTARY_LEFT(event) || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)))) {
|
||||
newval--;
|
||||
}
|
||||
|
||||
if (!READ_ONLY() && i_min==0 && i_max==1 && (event==EVT_KEY_BREAK(KEY_ENTER) || IS_ROTARY_BREAK(event))) {
|
||||
s_editMode = 0;
|
||||
newval = !val;
|
||||
}
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
// change values based on P1
|
||||
newval -= p1valdiff;
|
||||
p1valdiff = 0;
|
||||
#endif
|
||||
|
||||
#if defined(AUTOSWITCH)
|
||||
if (i_flags & INCDEC_SWITCH) {
|
||||
newval = checkIncDecMovedSwitch(newval);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(AUTOSOURCE)
|
||||
if (i_flags & INCDEC_SOURCE) {
|
||||
if (s_editMode>0) {
|
||||
int8_t source = GET_MOVED_SOURCE(i_min, i_max);
|
||||
if (source) {
|
||||
newval = source;
|
||||
}
|
||||
#if defined(AUTOSWITCH)
|
||||
else {
|
||||
uint8_t swtch = abs(getMovedSwitch());
|
||||
if (swtch) {
|
||||
newval = switchToMix(swtch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (newval > i_max || newval < i_min) {
|
||||
newval = (newval > i_max ? i_max : i_min);
|
||||
killEvents(event);
|
||||
AUDIO_KEY_ERROR();
|
||||
}
|
||||
|
||||
if (newval != val) {
|
||||
if (!(i_flags & NO_INCDEC_MARKS) && (newval != i_max) && (newval != i_min) && (newval==0 || newval==-100 || newval==+100) && !IS_ROTARY_EVENT(event)) {
|
||||
pauseEvents(event); // delay before auto-repeat continues
|
||||
}
|
||||
if (!IS_KEY_REPT(event)) {
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
storageDirty(i_flags & (EE_GENERAL|EE_MODEL));
|
||||
checkIncDec_Ret = (newval > val ? 1 : -1);
|
||||
}
|
||||
else {
|
||||
checkIncDec_Ret = 0;
|
||||
}
|
||||
return newval;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUM64)
|
||||
int8_t checkIncDecModel(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
{
|
||||
return checkIncDec(event, i_val, i_min, i_max, EE_MODEL);
|
||||
}
|
||||
|
||||
int8_t checkIncDecModelZero(event_t event, int8_t i_val, int8_t i_max)
|
||||
{
|
||||
return checkIncDecModel(event, i_val, 0, i_max);
|
||||
}
|
||||
|
||||
int8_t checkIncDecGen(event_t event, int8_t i_val, int8_t i_min, int8_t i_max)
|
||||
{
|
||||
return checkIncDec(event, i_val, i_min, i_max, EE_GENERAL);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SCROLL_TH 64
|
||||
#define SCROLL_POT1_TH 32
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) ((int8_t)MAXCOL(row) < 0)
|
||||
#else
|
||||
#define CURSOR_NOT_ALLOWED_IN_ROW(row) (MAXCOL(row) == TITLE_ROW)
|
||||
#endif
|
||||
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
#if defined(CPUARM)
|
||||
tmr10ms_t menuEntryTime;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#define MAXCOL_RAW(row) (horTab ? pgm_read_byte(horTab+min(row, (vertpos_t)horTabMax)) : (const uint8_t)0)
|
||||
@@ -1024,9 +902,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
switch (event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
#if defined(CPUARM)
|
||||
menuEntryTime = get_tmr10ms();
|
||||
#endif
|
||||
l_posVert = 0;
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
@@ -1185,7 +1061,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
|
||||
uint8_t maxLines = menuTab ? LCD_LINES-1 : LCD_LINES-2;
|
||||
|
||||
#if defined(CPUARM)
|
||||
int linesCount = maxrow;
|
||||
if (l_posVert == 0 || (l_posVert==1 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW) || (l_posVert==2 && MAXCOL(vertpos_t(0)) >= HIDDEN_ROW && MAXCOL(vertpos_t(1)) >= HIDDEN_ROW)) {
|
||||
menuVerticalOffset = 0;
|
||||
@@ -1233,11 +1108,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (l_posVert<1) {
|
||||
menuVerticalOffset=0;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
if (l_posVert>maxLines+menuVerticalOffset) {
|
||||
menuVerticalOffset = l_posVert-maxLines;
|
||||
@@ -1249,7 +1119,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
|
||||
menuVerticalPosition = l_posVert;
|
||||
menuHorizontalPosition = l_posHorz;
|
||||
#if !defined(CPUM64)
|
||||
// cosmetics on 9x
|
||||
if (menuVerticalOffset > 0) {
|
||||
l_posVert--;
|
||||
@@ -1257,7 +1126,6 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
menuVerticalOffset = l_posVert-1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,22 +26,16 @@ uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
#endif
|
||||
|
||||
void drawMessageBox()
|
||||
{
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN);
|
||||
#else
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y, warningText);
|
||||
#endif
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
@@ -114,13 +108,11 @@ void runPopupWarning(event_t event)
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
#if defined(CPUARM)
|
||||
default:
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,11 @@ void runPopupWarning(event_t event);
|
||||
|
||||
#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL)
|
||||
|
||||
#if defined(CPUARM)
|
||||
extern void (*popupFunc)(event_t event);
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
#endif
|
||||
|
||||
#if !defined(GUI)
|
||||
#define DISPLAY_WARNING(...)
|
||||
@@ -49,19 +47,13 @@ extern uint8_t warningInfoFlags;
|
||||
#define POPUP_INPUT(...)
|
||||
#define WARNING_INFO_FLAGS 0
|
||||
#define SET_WARNING_INFO(...)
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
#else
|
||||
#define DISPLAY_WARNING runPopupWarning
|
||||
#define POPUP_WARNING(s) warningText = s
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM)
|
||||
#define WARNING_INFO_FLAGS ZCHAR
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len)
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
@@ -70,7 +62,6 @@ extern uint8_t warningInfoFlags;
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s)
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuNoItems ? s : popupMenuNoItems) : 0)
|
||||
@@ -86,19 +77,6 @@ extern uint8_t warningInfoFlags;
|
||||
};
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
extern uint8_t s_menu_item;
|
||||
#elif defined(SDCARD) || (defined(ROTARY_ENCODER_NAVIGATION) && !defined(CPUM64))
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 6
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+1)
|
||||
#define POPUP_MENU_SET_BSS_FLAG() (popupMenuFlags = BSS)
|
||||
#define POPUP_MENU_UNSET_BSS_FLAG() (popupMenuFlags = 0)
|
||||
extern uint8_t popupMenuFlags;
|
||||
#else
|
||||
#define popupMenuNoItems 0
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
extern uint16_t popupMenuOffset;
|
||||
|
||||
@@ -49,11 +49,7 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
lcdDrawChar(lcdNextPos, y, ':');
|
||||
#endif
|
||||
lcdDrawHexNumber(x+3*FW-1, y, anaIn(i));
|
||||
#if defined(CPUARM)
|
||||
lcdDrawNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256, RIGHT);
|
||||
#else
|
||||
lcdDraw8bitsNumber(x+10*FW-1, y, (int16_t)calibratedAnalogs[CONVERT_MODE(i)]*25/256);
|
||||
#endif
|
||||
}
|
||||
|
||||
// RAS
|
||||
@@ -63,7 +59,7 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
lcdDrawText(1, y, "RAS:");
|
||||
lcdDrawNumber(1 + 4*FW, y, telemetryData.swr.value, LEFT);
|
||||
}
|
||||
#elif defined(CPUARM)
|
||||
#else
|
||||
if (IS_MODULE_XJT(EXTERNAL_MODULE)) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + ((NUM_STICKS+NUM_POTS+NUM_SLIDERS)/2)*FH;
|
||||
uint8_t x = ((NUM_STICKS+NUM_POTS+NUM_SLIDERS) & 1) ? (LCD_W/2)+FW : 0;
|
||||
@@ -73,11 +69,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
// Display raw BandGap result (debug)
|
||||
lcdDrawText(64+5, MENU_HEADER_HEIGHT+1+3*FH, STR_BG);
|
||||
lcdDrawNumber(64+5+6*FW-3, 1+4*FH, BandGap, RIGHT);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH + 2, STR_BATT_CALIB);
|
||||
@@ -90,14 +81,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
lcdDrawTextAlignedLeft(6*FH-2, STR_BATT_CALIB);
|
||||
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
|
||||
// TODO board.cpp
|
||||
static uint16_t adcBatt;
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8; // running average, sourced directly (to avoid unending debate :P)
|
||||
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.txVoltageCalibration)/8) / BandGap;
|
||||
lcdDrawNumber(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, g_vbat100mV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
|
||||
@@ -30,21 +30,11 @@ const pm_uchar sticks[] PROGMEM = {
|
||||
#define RADIO_SETUP_DATE_COLUMN (FW*15+7)
|
||||
#define RADIO_SETUP_TIME_COLUMN (FW*15+9)
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
drawSlider(RADIO_SETUP_2ND_COLUMN, y, 2+tmp, 4, attr); \
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
#elif defined(GRAPHICS)
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
display5posSlider(RADIO_SETUP_2ND_COLUMN, y, tmp, attr); \
|
||||
value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, NULL, tmp, -2, +2, attr, event); \
|
||||
}
|
||||
#else
|
||||
#define SLIDER_5POS(y, value, label, event, attr) value = editChoice(RADIO_SETUP_2ND_COLUMN, y, label, STR_VBEEPLEN, value, -2, +2, attr, event)
|
||||
#endif
|
||||
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
#define CASE_SPLASH_PARAM(x) x,
|
||||
@@ -270,16 +260,12 @@ void menuRadioSetup(event_t event)
|
||||
CHECK_INCDEC_GENVAR(event, b, 0, VOLUME_LEVEL_MAX);
|
||||
if (checkIncDec_Ret) {
|
||||
g_eeGeneral.speakerVolume = (int8_t)b-VOLUME_LEVEL_DEF;
|
||||
#if !defined(CPUARM)
|
||||
setScaledVolume(b);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_BEEP_VOLUME:
|
||||
SLIDER_5POS(y, g_eeGeneral.beepVolume, STR_BEEP_VOLUME, event, attr);
|
||||
break;
|
||||
@@ -289,7 +275,6 @@ void menuRadioSetup(event_t event)
|
||||
case ITEM_SETUP_BACKGROUND_VOLUME:
|
||||
SLIDER_5POS(y, g_eeGeneral.backgroundVolume, STR_BG_VOLUME, event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_BEEP_LENGTH:
|
||||
SLIDER_5POS(y, g_eeGeneral.beepLength, STR_BEEP_LENGTH, event, attr);
|
||||
@@ -298,13 +283,9 @@ void menuRadioSetup(event_t event)
|
||||
#if defined(AUDIO)
|
||||
case ITEM_SETUP_SPEAKER_PITCH:
|
||||
lcdDrawTextAlignedLeft( y, STR_SPKRPITCH);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawChar(RADIO_SETUP_2ND_COLUMN, y, '+', attr);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN+FW, y, g_eeGeneral.speakerPitch*15, attr|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, "Hz", attr);
|
||||
#else
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.speakerPitch, attr|LEFT);
|
||||
#endif
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.speakerPitch, 0, 20);
|
||||
}
|
||||
@@ -389,14 +370,12 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_RSSI_POWEROFF_ALARM:
|
||||
{
|
||||
uint8_t b = 1 - g_eeGeneral.disableRssiPoweroffAlarm;
|
||||
g_eeGeneral.disableRssiPoweroffAlarm = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_RSSISHUTDOWNALARM, attr, event);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
case ITEM_SETUP_CAPACITY_WARNING:
|
||||
@@ -449,7 +428,6 @@ void menuRadioSetup(event_t event)
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.lightAutoOff, 0, 600/5);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_BRIGHTNESS:
|
||||
lcdDrawTextAlignedLeft(y, STR_BRIGHTNESS);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 100-g_eeGeneral.backlightBright, attr|LEFT) ;
|
||||
@@ -459,7 +437,6 @@ void menuRadioSetup(event_t event)
|
||||
g_eeGeneral.backlightBright = 100 - b;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PWM_BACKLIGHT)
|
||||
case ITEM_SETUP_BACKLIGHT_BRIGHTNESS_OFF:
|
||||
@@ -478,7 +455,6 @@ void menuRadioSetup(event_t event)
|
||||
#if defined(SPLASH) && !defined(FSPLASH)
|
||||
case ITEM_SETUP_DISABLE_SPLASH:
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(y, STR_SPLASHSCREEN);
|
||||
if (SPLASH_NEEDED()) {
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, SPLASH_TIMEOUT/100, attr|LEFT);
|
||||
@@ -489,11 +465,6 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
if (attr) g_eeGeneral.splashMode = -checkIncDecGen(event, -g_eeGeneral.splashMode, -3, 4);
|
||||
break;
|
||||
#else
|
||||
uint8_t b = 1-g_eeGeneral.splashMode;
|
||||
g_eeGeneral.splashMode = 1 - editCheckBox(b, RADIO_SETUP_2ND_COLUMN, y, STR_SPLASHSCREEN, attr, event);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -504,11 +475,9 @@ void menuRadioSetup(event_t event)
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.timezone, -12, 12);
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_ADJUST_RTC:
|
||||
g_eeGeneral.adjustRTC = editCheckBox(g_eeGeneral.adjustRTC, RADIO_SETUP_2ND_COLUMN, y, STR_ADJUST_RTC, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_GPSFORMAT:
|
||||
g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSCOORD, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
|
||||
@@ -521,7 +490,6 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_LANGUAGE:
|
||||
lcdDrawTextAlignedLeft(y, STR_VOICELANG);
|
||||
lcdDrawText(RADIO_SETUP_2ND_COLUMN, y, currentLanguagePack->name, attr);
|
||||
@@ -537,7 +505,6 @@ void menuRadioSetup(event_t event)
|
||||
case ITEM_SETUP_IMPERIAL:
|
||||
g_eeGeneral.imperial = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_UNITSSYSTEM, STR_VUNITSSYSTEM, g_eeGeneral.imperial, 0, 1, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(FAI_CHOICE)
|
||||
case ITEM_SETUP_FAI:
|
||||
@@ -557,14 +524,12 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
case ITEM_SETUP_SWITCHES_DELAY:
|
||||
lcdDrawTextAlignedLeft(y, STR_SWITCHES_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 10*SWITCHES_DELAY(), attr|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, STR_MS, attr);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, 100-15);
|
||||
break;
|
||||
#endif
|
||||
#if defined(STM32)
|
||||
case ITEM_SETUP_USB_MODE:
|
||||
g_eeGeneral.USBMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_USBMODE, STR_USBMODES, g_eeGeneral.USBMode, USB_UNSELECTED_MODE, USB_MAX_MODE, attr, event);
|
||||
|
||||
@@ -51,11 +51,7 @@ const pm_uchar * const splash_lbm = splashdata+4;
|
||||
void drawSplash()
|
||||
{
|
||||
lcdClear();
|
||||
#if defined(PCBMEGA2560) && !defined(SIMU)
|
||||
lcd_imgfar(0, 0, (GET_FAR_ADDRESS(splashdata)+4), 0, 0); // use progmem "far" for splash working with all other options enabled
|
||||
#else
|
||||
lcdDraw1bitBitmap(0, 0, splash_lbm, 0, 0);
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK == 1
|
||||
if (readonly == false) {
|
||||
|
||||
@@ -105,18 +105,14 @@ void displayTrims(uint8_t phase)
|
||||
uint8_t att = ROUND;
|
||||
int16_t val = getTrimValue(phase, i);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if(getRawTrimValue(phase, i).mode == TRIM_MODE_NONE)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
int16_t dir = val;
|
||||
bool exttrim = false;
|
||||
if (val < TRIM_MIN || val > TRIM_MAX) {
|
||||
exttrim = true;
|
||||
}
|
||||
#endif
|
||||
if (val < -(TRIM_LEN+1)*4) {
|
||||
val = -(TRIM_LEN+1);
|
||||
}
|
||||
@@ -135,7 +131,6 @@ void displayTrims(uint8_t phase)
|
||||
lcdDrawSolidVerticalLine(xm+1, ym-1, 3);
|
||||
}
|
||||
ym -= val;
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3);
|
||||
@@ -146,14 +141,11 @@ void displayTrims(uint8_t phase)
|
||||
if (exttrim) {
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym, 3);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber(dir>0 ? 12 : 40, xm-2, -abs(dir/5), TINSIZE|VERTICAL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
ym = 60;
|
||||
@@ -161,7 +153,6 @@ void displayTrims(uint8_t phase)
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym-1, 3);
|
||||
lcdDrawSolidHorizontalLine(xm-1, ym+1, 3);
|
||||
xm += val;
|
||||
#if !defined(CPUM64) || !defined(TELEMETRY_FRSKY)
|
||||
lcdDrawFilledRect(xm-3, ym-3, 7, 7, SOLID, att|ERASE);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidVerticalLine(xm+1, ym-1, 3);
|
||||
@@ -172,14 +163,11 @@ void displayTrims(uint8_t phase)
|
||||
if (exttrim) {
|
||||
lcdDrawSolidVerticalLine(xm, ym-1, 3);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? (dir>0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir>0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym-2, -abs(dir/5), TINSIZE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
lcdDrawSquare(xm-3, ym-3, 7, att);
|
||||
}
|
||||
@@ -193,7 +181,6 @@ FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
||||
const uint8_t negative = (timerState.val<0 ? BLINK | INVERS : 0);
|
||||
LcdFlags att = RIGHT | DBLSIZE | negative;
|
||||
drawTimer(x, y, timerState.val, att, att);
|
||||
#if defined(CPUARM)
|
||||
uint8_t xLabel = (negative ? x-56 : x-49);
|
||||
uint8_t len = zlen(timer.name, LEN_TIMER_NAME);
|
||||
if (len > 0) {
|
||||
@@ -202,10 +189,6 @@ FORCEINLINE void drawTimerWithMode(coord_t x, coord_t y, uint8_t index)
|
||||
else {
|
||||
drawTimerMode(xLabel, y+FH, timer.mode, RIGHT);
|
||||
}
|
||||
#else
|
||||
uint8_t xLabel = (negative ? x-76 : x-69);
|
||||
drawTimerMode(xLabel, y+FH, timer.mode);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +272,6 @@ void onMainViewMenu(const char *result)
|
||||
timerReset(2);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_VIEW_NOTES) {
|
||||
pushModelNotes();
|
||||
}
|
||||
@@ -302,7 +284,6 @@ void onMainViewMenu(const char *result)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
@@ -314,11 +295,9 @@ void onMainViewMenu(const char *result)
|
||||
else if (result == STR_STATISTICS) {
|
||||
chainMenu(menuStatisticsView);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_ABOUT_US) {
|
||||
chainMenu(menuAboutView);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -348,14 +327,10 @@ void menuMainView(event_t event)
|
||||
case EVT_KEY_NEXT_PAGE:
|
||||
case EVT_KEY_PREVIOUS_PAGE:
|
||||
if (view_base <= VIEW_INPUTS) {
|
||||
#if defined(CPUARM)
|
||||
if (view_base == VIEW_INPUTS)
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
else
|
||||
g_eeGeneral.view = (g_eeGeneral.view + (4*ALTERNATE_VIEW) + ((event==EVT_KEY_PREVIOUS_PAGE) ? -ALTERNATE_VIEW : ALTERNATE_VIEW)) % (4*ALTERNATE_VIEW);
|
||||
#else
|
||||
g_eeGeneral.view ^= ALTERNATE_VIEW;
|
||||
#endif
|
||||
storageDirty(EE_GENERAL);
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
@@ -365,27 +340,14 @@ void menuMainView(event_t event)
|
||||
case EVT_KEY_CONTEXT_MENU:
|
||||
killEvents(event);
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (modelHasNotes()) {
|
||||
POPUP_MENU_ADD_ITEM(STR_VIEW_NOTES);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_SUBMENU);
|
||||
#else
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
#endif
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
#endif
|
||||
|
||||
POPUP_MENU_ADD_ITEM(STR_STATISTICS);
|
||||
#if defined(CPUARM)
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
#endif
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
break;
|
||||
#endif
|
||||
@@ -501,19 +463,11 @@ void menuMainView(event_t event)
|
||||
if (view_base < VIEW_INPUTS) {
|
||||
// scroll bar
|
||||
lcdDrawHorizontalLine(38, 34, 54, DOTTED);
|
||||
#if defined(CPUARM)
|
||||
lcdDrawSolidHorizontalLine(38 + (g_eeGeneral.view / ALTERNATE_VIEW) * 13, 34, 13, SOLID);
|
||||
#else
|
||||
lcdDrawSolidHorizontalLine((g_eeGeneral.view & ALTERNATE_VIEW) ? 64 : 38, 34, 26, SOLID);
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
uint8_t x0,y0;
|
||||
#if defined(CPUARM)
|
||||
uint8_t chan = 8*(g_eeGeneral.view / ALTERNATE_VIEW) + i;
|
||||
#else
|
||||
uint8_t chan = (g_eeGeneral.view & ALTERNATE_VIEW) ? 8+i : i;
|
||||
#endif
|
||||
|
||||
int16_t val = channelOutputs[chan];
|
||||
|
||||
@@ -585,22 +539,8 @@ void menuMainView(event_t event)
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if defined(PCBMEGA2560) && defined(ROTARY_ENCODERS)
|
||||
for (uint8_t i=0; i<NUM_ROTARY_ENCODERS; i++) {
|
||||
int16_t val = getRotaryEncoder(i);
|
||||
int8_t len = limit((int16_t)0, (int16_t)(((val+1024) * BAR_HEIGHT) / 2048), (int16_t)BAR_HEIGHT);
|
||||
#if ROTARY_ENCODERS > 2
|
||||
#define V_BAR_W 5
|
||||
V_BAR(LCD_W/2-8+V_BAR_W*i, LCD_H-8, len);
|
||||
#else
|
||||
#define V_BAR_W 5
|
||||
V_BAR(LCD_W/2-3+V_BAR_W*i, LCD_H-8, len);
|
||||
#endif
|
||||
}
|
||||
#endif // PCBGRUVIN9X && ROTARY_ENCODERS
|
||||
|
||||
// Logical Switches
|
||||
#if defined(CPUARM)
|
||||
uint8_t index = 0;
|
||||
uint8_t y = LCD_H-20;
|
||||
for (uint8_t line=0; line<2; line++) {
|
||||
@@ -613,19 +553,6 @@ void menuMainView(event_t event)
|
||||
}
|
||||
y += 12;
|
||||
}
|
||||
#elif defined(CPUM2560)
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-3 + (i/3)*(i/3>2 ? 3*FW+2 : (3*FW-1)) + (i/3>2 ? 2*FW : 0), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#elif !defined(PCBSTD)
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-2 + (i/3)*(4*FW-1), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#else
|
||||
for (uint8_t i=0; i<MAX_LOGICAL_SWITCHES; i++) {
|
||||
drawSwitch(2*FW-3 + (i/3)*(4*FW), 4*FH+1 + (i%3)*FH, SWSRC_SW1+i, getSwitch(SWSRC_SW1+i) ? INVERS : 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -649,14 +576,10 @@ void menuMainView(event_t event)
|
||||
drawMessageBox();
|
||||
lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
|
||||
lcdDrawText(16+6*FW, 5*FH, PSTR("["), BOLD);
|
||||
#if defined(CPUARM)
|
||||
drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD);
|
||||
if (g_model.gvars[gvarLastChanged].unit) {
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, "%", BOLD);
|
||||
}
|
||||
#else
|
||||
lcdDrawNumber(lcdLastRightPos, 5*FH, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), BOLD);
|
||||
#endif
|
||||
lcdDrawText(lcdLastRightPos, 5*FH, PSTR("]"), BOLD);
|
||||
warningText = NULL;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ void menuStatisticsView(event_t event)
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_LONG(KEY_MENU): // historical
|
||||
#endif
|
||||
@@ -58,13 +57,11 @@ void menuStatisticsView(event_t event)
|
||||
storageDirty(EE_GENERAL);
|
||||
sessionTimer = 0;
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
chainMenu(menuMainView);
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
// Session and Total timers
|
||||
lcdDrawText(STATS_1ST_COLUMN, FH*1+1, "SES", BOLD);
|
||||
drawTimer(STATS_1ST_COLUMN + STATS_LABEL_WIDTH, FH*1+1, sessionTimer, 0, 0);
|
||||
@@ -85,17 +82,6 @@ void menuStatisticsView(event_t event)
|
||||
else
|
||||
drawTimer(STATS_3RD_COLUMN + STATS_LABEL_WIDTH, FH*i+1, timersStates[i].val, 0, 0);
|
||||
}
|
||||
#else
|
||||
lcdDrawText( 1*FW, FH*0, STR_TOTTM1TM2THRTHP);
|
||||
|
||||
drawTimer( 5*FW+5*FWNUM+1, FH*1, timersStates[0].val, RIGHT, 0);
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*1, timersStates[1].val, RIGHT, 0);
|
||||
|
||||
drawTimer( 5*FW+5*FWNUM+1, FH*2, s_timeCumThr, RIGHT, 0);
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*2, s_timeCum16ThrP/16, RIGHT, 0);
|
||||
|
||||
drawTimer( 12*FW+5*FWNUM+1, FH*0, sessionTimer, RIGHT, 0);
|
||||
#endif
|
||||
|
||||
#if defined(THRTRACE)
|
||||
const coord_t x = 5;
|
||||
@@ -114,7 +100,6 @@ void menuStatisticsView(event_t event)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define MENU_DEBUG_COL1_OFS (11*FW-3)
|
||||
#define MENU_DEBUG_COL2_OFS (17*FW)
|
||||
#define MENU_DEBUG_Y_CURRENT (1*FH)
|
||||
@@ -128,16 +113,12 @@ void menuStatisticsView(event_t event)
|
||||
#define MENU_DEBUG_Y_USB (2*FH)
|
||||
#define MENU_DEBUG_Y_LUA (3*FH)
|
||||
#define MENU_DEBUG_Y_FREE_RAM (4*FH)
|
||||
#else
|
||||
#define MENU_DEBUG_COL1_OFS (14*FW)
|
||||
#endif
|
||||
|
||||
void menuStatisticsDebug(event_t event)
|
||||
{
|
||||
TITLE(STR_MENUDEBUG);
|
||||
|
||||
switch (event) {
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
#if defined(PCBSKY9X)
|
||||
g_eeGeneral.mAhUsed = 0;
|
||||
@@ -148,13 +129,8 @@ void menuStatisticsDebug(event_t event)
|
||||
storageDirty(EE_GENERAL);
|
||||
killEvents(event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
#if !defined(CPUARM)
|
||||
g_tmr1Latency_min = 0xff;
|
||||
g_tmr1Latency_max = 0;
|
||||
#endif
|
||||
maxMixerDuration = 0;
|
||||
break;
|
||||
|
||||
@@ -248,31 +224,16 @@ void menuStatisticsDebug(event_t event)
|
||||
#endif // LUA
|
||||
#endif // PCBTARANIS
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_MIXMAX, STR_TMIXMAXMS);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_MIXMAX, DURATION_MS_PREC2(maxMixerDuration), PREC2|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_MIXMAX, "ms");
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
lcdDrawTextAlignedLeft(MENU_DEBUG_Y_RTOS, STR_FREESTACKMINB);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, MENU_DEBUG_Y_RTOS, menusStack.available(), UNSIGN|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcdDrawNumber(lcdLastRightPos+1, MENU_DEBUG_Y_RTOS, mixerStack.available(), UNSIGN|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, MENU_DEBUG_Y_RTOS, "/");
|
||||
lcdDrawNumber(lcdLastRightPos+1, MENU_DEBUG_Y_RTOS, audioStack.available(), UNSIGN|LEFT);
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(1*FH, STR_TMR1LATMAXUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 1*FH, g_tmr1Latency_max/2 );
|
||||
lcdDrawTextAlignedLeft(2*FH, STR_TMR1LATMINUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 2*FH, g_tmr1Latency_min/2 );
|
||||
lcdDrawTextAlignedLeft(3*FH, STR_TMR1JITTERUS);
|
||||
lcdDraw8bitsNumber(MENU_DEBUG_COL1_OFS , 3*FH, (g_tmr1Latency_max - g_tmr1Latency_min) /2 );
|
||||
lcdDrawTextAlignedLeft(4*FH, STR_TMIXMAXMS);
|
||||
lcdDrawNumber(MENU_DEBUG_COL1_OFS, 4*FH, DURATION_MS_PREC2(maxMixerDuration), PREC2);
|
||||
lcdDrawTextAlignedLeft(5*FH, STR_FREESTACKMINB);
|
||||
lcdDrawNumber(14*FW, 5*FH, stackAvailable(), UNSIGN) ;
|
||||
#endif
|
||||
|
||||
lcdDrawText(4*FW, 7*FH+1, STR_MENUTORESET);
|
||||
lcdInvertLastLine();
|
||||
|
||||
@@ -37,25 +37,12 @@ void displayRssiLine()
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
lcdDrawSolidHorizontalLine(0, 55, 128, 0); // separator
|
||||
uint8_t rssi;
|
||||
#if defined(CPUARM)
|
||||
rssi = min((uint8_t)99, TELEMETRY_RSSI());
|
||||
lcdDrawNumber(LCD_W/2 -2, STATUS_BAR_Y, rssi, LEADING0 | RIGHT | SMLSIZE, 2);
|
||||
lcdDrawText(lcdLastLeftPos,STATUS_BAR_Y, "RSSI : ", RIGHT | SMLSIZE);
|
||||
lcdDrawRect(65, 57, 38, 7);
|
||||
uint8_t v = 4*rssi/11;
|
||||
lcdDrawFilledRect(66+36-v, 58, v, 5, (rssi < g_model.rssiAlarms.getWarningRssi()) ? DOTTED : SOLID);
|
||||
#else
|
||||
rssi = min((uint8_t)99, telemetryData.rssi[1].value);
|
||||
lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_TX); lcdDrawNumber(4*FW+1, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcdDrawRect(BAR_LEFT+1, 57, 38, 7);
|
||||
lcdDrawFilledRect(BAR_LEFT+1, 58, 4*rssi/11, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
|
||||
rssi = min((uint8_t)99, TELEMETRY_RSSI());
|
||||
lcdDrawText(104, STATUS_BAR_Y, STR_RX); lcdDrawNumber(105+4*FW, STATUS_BAR_Y, rssi, LEADING0, 2);
|
||||
lcdDrawRect(65, 57, 38, 7);
|
||||
uint8_t v = 4*rssi/11;
|
||||
lcdDrawFilledRect(66+36-v, 58, v, 5, (rssi < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
lcdDrawText(7*FW, STATUS_BAR_Y, STR_NODATA, BLINK);
|
||||
@@ -63,165 +50,18 @@ void displayRssiLine()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(FRSKY_HUB) && defined(GPS) && !defined(CPUARM)
|
||||
void displayGpsTime()
|
||||
{
|
||||
uint8_t att = (TELEMETRY_STREAMING() ? LEFT|LEADING0 : LEFT|LEADING0|BLINK);
|
||||
lcdDrawNumber(CENTER_OFS+6*FW+7, STATUS_BAR_Y, telemetryData.hub.hour, att, 2);
|
||||
lcdDrawChar(CENTER_OFS+8*FW+4, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawNumber(CENTER_OFS+9*FW+2, STATUS_BAR_Y, telemetryData.hub.min, att, 2);
|
||||
lcdDrawChar(CENTER_OFS+11*FW-1, STATUS_BAR_Y, ':', att);
|
||||
lcdDrawNumber(CENTER_OFS+12*FW-3, STATUS_BAR_Y, telemetryData.hub.sec, att, 2);
|
||||
lcdInvertLastLine();
|
||||
}
|
||||
|
||||
void drawGPSCoord(uint8_t y, char direction, int16_t bp, int16_t ap)
|
||||
{
|
||||
if (telemetryData.hub.gpsFix >= 0) {
|
||||
if (!direction) direction = '-';
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN, y, bp / 100, LEFT); // ddd before '.'
|
||||
lcdDrawChar(lcdLastRightPos, y, '@');
|
||||
uint8_t mn = bp % 100; // TODO div_t
|
||||
if (g_eeGeneral.gpsFormat == 0) {
|
||||
lcdDrawChar(lcdLastRightPos+FWNUM, y, direction);
|
||||
lcdDrawNumber(lcdLastRightPos+FW+FW+1, y, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos, y, 2);
|
||||
uint16_t ss = ap * 6;
|
||||
lcdDrawNumber(lcdLastRightPos+3, y, ss / 1000, LEFT|LEADING0, 2); // ''
|
||||
lcdDrawPoint(lcdLastRightPos, y+FH-2, 0); // small decimal point
|
||||
lcdDrawNumber(lcdLastRightPos+2, y, ss % 1000, LEFT|LEADING0, 3); // ''
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos, y, 2);
|
||||
lcdDrawSolidVerticalLine(lcdLastRightPos+2, y, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(lcdLastRightPos+FW, y, mn, LEFT|LEADING0, 2); // mm before '.'
|
||||
lcdDrawPoint(lcdLastRightPos, y+FH-2, 0); // small decimal point
|
||||
lcdDrawNumber(lcdLastRightPos+2, y, ap, LEFT|UNSIGN|LEADING0, 4); // after '.'
|
||||
lcdDrawChar(lcdLastRightPos+1, y, direction);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no fix
|
||||
lcdDrawText(TELEM_2ND_COLUMN, y, STR_VCSWFUNC+1/*----*/);
|
||||
}
|
||||
}
|
||||
#elif !defined(CPUARM)
|
||||
#define displayGpsTime()
|
||||
#define drawGPSCoord(...)
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void displayVoltageScreenLine(uint8_t y, uint8_t index)
|
||||
{
|
||||
drawStringWithIndex(0, y, STR_A, index+1, 0);
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
drawTelemetryValue(3*FW+6*FW+4, y-FH, index+TELEM_A1-1, telemetryData.analog[index].value, DBLSIZE);
|
||||
lcdDrawChar(12*FW-1, y-FH, '<'); drawTelemetryValue(17*FW, y-FH, index+TELEM_A1-1, telemetryData.analog[index].min, NO_UNIT);
|
||||
lcdDrawChar(12*FW, y, '>'); drawTelemetryValue(17*FW, y, index+TELEM_A1-1, telemetryData.analog[index].max, NO_UNIT);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t barCoord(int16_t value, int16_t min, int16_t max)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
if (value <= min)
|
||||
return 0;
|
||||
else if (value >= max)
|
||||
return BAR_WIDTH-1;
|
||||
else
|
||||
return ((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min);
|
||||
#else
|
||||
return limit((uint8_t)0, (uint8_t)(((int32_t)(BAR_WIDTH-1) * (value - min)) / (max - min)), (uint8_t)BAR_WIDTH);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
void displayVoltagesScreen()
|
||||
{
|
||||
// Volts / Amps / Watts / mAh
|
||||
uint8_t analog = 0;
|
||||
lcdDrawTextAtIndex(0, 2*FH, STR_AMPSRC, g_model.frsky.voltsSource+1, 0);
|
||||
switch (g_model.frsky.voltsSource) {
|
||||
case FRSKY_VOLTS_SOURCE_A1:
|
||||
case FRSKY_VOLTS_SOURCE_A2:
|
||||
displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource);
|
||||
analog = 1+g_model.frsky.voltsSource;
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case FRSKY_VOLTS_SOURCE_FAS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, FH, TELEM_VFAS-1, telemetryData.hub.vfas, DBLSIZE);
|
||||
break;
|
||||
case FRSKY_VOLTS_SOURCE_CELLS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, FH, TELEM_CELLS_SUM-1, telemetryData.hub.cellsSum, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (g_model.frsky.currentSource) {
|
||||
lcdDrawTextAtIndex(0, 4*FH, STR_AMPSRC, g_model.frsky.currentSource, 0);
|
||||
switch(g_model.frsky.currentSource) {
|
||||
case FRSKY_CURRENT_SOURCE_A1:
|
||||
case FRSKY_CURRENT_SOURCE_A2:
|
||||
displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1);
|
||||
break;
|
||||
#if defined(FRSKY_HUB)
|
||||
case FRSKY_CURRENT_SOURCE_FAS:
|
||||
drawTelemetryValue(3*FW+6*FW+4, 3*FH, TELEM_CURRENT-1, telemetryData.hub.current, DBLSIZE);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
drawTelemetryValue(4, 5*FH, TELEM_POWER-1, telemetryData.hub.power, LEFT|DBLSIZE);
|
||||
drawTelemetryValue(3*FW+4+4*FW+6*FW+FW, 5*FH, TELEM_CONSUMPTION-1, telemetryData.hub.currentConsumption, DBLSIZE);
|
||||
}
|
||||
else {
|
||||
displayVoltageScreenLine(analog > 0 ? 5*FH : 4*FH, analog ? 2-analog : 0);
|
||||
if (analog == 0) displayVoltageScreenLine(6*FH, 1);
|
||||
}
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
// Cells voltage
|
||||
if (telemetryData.hub.cellsCount > 0) {
|
||||
uint8_t y = 1*FH;
|
||||
for (uint8_t k=0; k<telemetryData.hub.cellsCount && k<6; k++) {
|
||||
#if defined(GAUGES)
|
||||
uint8_t attr = (barsThresholds[THLD_CELL] && telemetryData.hub.cellVolts[k] < barsThresholds[THLD_CELL]) ? BLINK|PREC2 : PREC2;
|
||||
#else
|
||||
uint8_t attr = PREC2;
|
||||
#endif
|
||||
lcdDrawNumber(LCD_W, y, TELEMETRY_CELL_VOLTAGE(k), attr, 4);
|
||||
y += 1*FH;
|
||||
}
|
||||
lcdDrawSolidVerticalLine(LCD_W-3*FW-2, 8, 47);
|
||||
}
|
||||
#endif
|
||||
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
void displayAfterFlightScreen()
|
||||
{
|
||||
uint8_t line=1*FH+1;
|
||||
if (IS_GPS_AVAILABLE()) {
|
||||
// Latitude
|
||||
lcdDrawTextAlignedLeft(line, STR_LATITUDE);
|
||||
drawGPSCoord(line, telemetryData.hub.gpsLatitudeNS, telemetryData.hub.gpsLatitude_bp, telemetryData.hub.gpsLatitude_ap);
|
||||
// Longitude
|
||||
line+=1*FH+1;
|
||||
lcdDrawTextAlignedLeft(line, STR_LONGITUDE);
|
||||
drawGPSCoord(line, telemetryData.hub.gpsLongitudeEW, telemetryData.hub.gpsLongitude_bp, telemetryData.hub.gpsLongitude_ap);
|
||||
displayGpsTime();
|
||||
line+=1*FH+1;
|
||||
}
|
||||
// Rssi
|
||||
lcdDrawTextAlignedLeft(line, STR_MINRSSI);
|
||||
lcdDrawText(TELEM_2ND_COLUMN, line, STR_TX);
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN+3*FW, line, telemetryData.rssi[1].min, LEFT|LEADING0, 2);
|
||||
lcdDrawText(TELEM_2ND_COLUMN+6*FW, line, STR_RX);
|
||||
lcdDrawNumber(TELEM_2ND_COLUMN+9*FW, line, telemetryData.rssi[0].min, LEFT|LEADING0, 2);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
@@ -230,67 +70,24 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
for (int8_t i=3; i>=0; i--) {
|
||||
FrSkyBarData & bar = screen.bars[i];
|
||||
source_t source = bar.source;
|
||||
#if defined(CPUARM)
|
||||
getvalue_t barMin = bar.barMin;
|
||||
getvalue_t barMax = bar.barMax;
|
||||
if (source <= MIXSRC_LAST_CH) {
|
||||
barMin = calc100toRESX(barMin);
|
||||
barMax = calc100toRESX(barMax);
|
||||
}
|
||||
#else
|
||||
getvalue_t barMin = convertBarTelemValue(source, bar.barMin);
|
||||
getvalue_t barMax = convertBarTelemValue(source, 255-bar.barMax);
|
||||
#endif
|
||||
if (source && barMax > barMin) {
|
||||
uint8_t y = barHeight+6+i*(barHeight+6);
|
||||
#if defined(CPUARM)
|
||||
drawSource(0, y+barHeight/2-3, source, SMLSIZE);
|
||||
#else
|
||||
lcdDrawTextAtIndex(0, y+barHeight-5, STR_VTELEMCHNS, source, 0);
|
||||
#endif
|
||||
lcdDrawRect(BAR_LEFT, y, BAR_WIDTH+1, barHeight+2);
|
||||
#if defined(CPUARM)
|
||||
getvalue_t value = getValue(source);
|
||||
#else
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+source-1);
|
||||
#endif
|
||||
|
||||
uint8_t thresholdX = 0;
|
||||
|
||||
#if !defined(CPUARM)
|
||||
getvalue_t threshold = 0;
|
||||
if (source <= TELEM_TIMER_MAX)
|
||||
threshold = 0;
|
||||
else if (source <= TELEM_RSSI_RX)
|
||||
threshold = getRssiAlarmValue(source-TELEM_RSSI_TX);
|
||||
else if (source <= TELEM_A2)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
#if defined(FRSKY_HUB)
|
||||
else {
|
||||
#if defined(GAUGES)
|
||||
threshold = convertBarTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (threshold) {
|
||||
thresholdX = barCoord(threshold, barMin, barMax);
|
||||
if (thresholdX == 100)
|
||||
thresholdX = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t barShade = SOLID;
|
||||
#else
|
||||
// reversed barshade for T1/T2
|
||||
uint8_t barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
if (source == TELEM_T1 || source == TELEM_T2) {
|
||||
barShade = -barShade;
|
||||
}
|
||||
#endif
|
||||
|
||||
lcdDrawFilledRect(BAR_LEFT+1, y+1, width, barHeight, barShade);
|
||||
|
||||
@@ -313,7 +110,6 @@ bool displayGaugesTelemetryScreen(FrSkyScreenData & screen)
|
||||
return barHeight < 13;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with numbers
|
||||
@@ -367,62 +163,7 @@ bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
||||
lcdInvertLastLine();
|
||||
return fields_count;
|
||||
}
|
||||
#else
|
||||
bool displayNumbersTelemetryScreen(FrSkyScreenData & screen)
|
||||
{
|
||||
// Custom Screen with numbers
|
||||
uint8_t fields_count = 0;
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
for (uint8_t j=0; j<NUM_LINE_ITEMS; j++) {
|
||||
uint8_t field = screen.lines[i].sources[j];
|
||||
if (field > 0) {
|
||||
fields_count++;
|
||||
}
|
||||
if (i==3) {
|
||||
lcdDrawSolidVerticalLine(63, 8, 48);
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
#if defined(FRSKY_HUB)
|
||||
if (field == TELEM_ACC) {
|
||||
lcdDrawTextAlignedLeft(STATUS_BAR_Y, STR_ACCEL);
|
||||
lcdDrawNumber(4*FW, STATUS_BAR_Y, telemetryData.hub.accelX, LEFT|PREC2);
|
||||
lcdDrawNumber(10*FW, STATUS_BAR_Y, telemetryData.hub.accelY, LEFT|PREC2);
|
||||
lcdDrawNumber(16*FW, STATUS_BAR_Y, telemetryData.hub.accelZ, LEFT|PREC2);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#if defined(FRSKY_HUB) && defined(GPS)
|
||||
else if (field == TELEM_GPS_TIME) {
|
||||
displayGpsTime();
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
displayRssiLine();
|
||||
return fields_count;
|
||||
}
|
||||
}
|
||||
if (field) {
|
||||
getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-1);
|
||||
uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT);
|
||||
coord_t pos[] = {0, 65, 130};
|
||||
drawTelemetryValue(pos[j+1]-2, FH+2*FH*i, field-1, value, att);
|
||||
|
||||
if (field >= TELEM_TIMER1 && field <= TELEM_TIMER_MAX && i!=3) {
|
||||
// there is not enough space on LCD for displaying "Tmr1" or "Tmr2" and still see the - sign, we write "T1" or "T2" instead
|
||||
field = field-TELEM_TIMER1+TELEM_T1;
|
||||
}
|
||||
|
||||
lcdDrawTextAtIndex(pos[j], 1+FH+2*FH*i, STR_VTELEMCHNS, field, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
lcdInvertLastLine();
|
||||
return fields_count;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
bool displayCustomTelemetryScreen(uint8_t index)
|
||||
{
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[index];
|
||||
@@ -437,20 +178,6 @@ bool displayCustomTelemetryScreen(uint8_t index)
|
||||
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
bool displayCustomTelemetryScreen(uint8_t index)
|
||||
{
|
||||
FrSkyScreenData & screen = g_model.frsky.screens[index];
|
||||
|
||||
#if defined(GAUGES)
|
||||
if (IS_BARS_SCREEN(s_frsky_view)) {
|
||||
return displayGaugesTelemetryScreen(screen);
|
||||
}
|
||||
#endif
|
||||
|
||||
return displayNumbersTelemetryScreen(screen);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool displayTelemetryScreen()
|
||||
{
|
||||
@@ -472,11 +199,9 @@ bool displayTelemetryScreen()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
if (TELEMETRY_SCREEN_TYPE(s_frsky_view) == TELEMETRY_SCREEN_TYPE_NONE) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
drawTelemetryTopBar();
|
||||
|
||||
@@ -484,22 +209,11 @@ bool displayTelemetryScreen()
|
||||
return displayCustomTelemetryScreen(s_frsky_view);
|
||||
}
|
||||
|
||||
#if !defined(CPUARM)
|
||||
if (s_frsky_view == TELEMETRY_VOLTAGES_SCREEN) {
|
||||
displayVoltagesScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(CPUARM) && defined(FRSKY_HUB)
|
||||
else {
|
||||
displayAfterFlightScreen();
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
enum NavigationDirection {
|
||||
none,
|
||||
up,
|
||||
@@ -507,18 +221,6 @@ enum NavigationDirection {
|
||||
};
|
||||
#define decrTelemetryScreen() direction = up
|
||||
#define incrTelemetryScreen() direction = down
|
||||
#else
|
||||
void decrTelemetryScreen()
|
||||
{
|
||||
if (s_frsky_view-- == 0)
|
||||
s_frsky_view = TELEMETRY_VIEW_MAX;
|
||||
}
|
||||
void incrTelemetryScreen()
|
||||
{
|
||||
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
|
||||
s_frsky_view = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#define EVT_KEY_PREVIOUS_VIEW EVT_KEY_LONG(KEY_LEFT)
|
||||
@@ -533,9 +235,7 @@ void incrTelemetryScreen()
|
||||
|
||||
void menuViewTelemetryFrsky(event_t event)
|
||||
{
|
||||
#if defined(CPUARM)
|
||||
enum NavigationDirection direction = none;
|
||||
#endif
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
@@ -569,20 +269,14 @@ void menuViewTelemetryFrsky(event_t event)
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if defined(CPUARM)
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
#else
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
telemetryReset();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
|
||||
if (direction == up) {
|
||||
if (s_frsky_view-- == 0)
|
||||
@@ -603,11 +297,6 @@ void menuViewTelemetryFrsky(event_t event)
|
||||
drawTelemetryTopBar();
|
||||
lcdDrawText(2*FW, 3*FH, "No Telemetry Screens");
|
||||
displayRssiLine();
|
||||
#else
|
||||
if (!displayTelemetryScreen()) {
|
||||
putEvent(event == EVT_KEY_FIRST(KEY_UP) ? event : EVT_KEY_FIRST(KEY_DOWN));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef EVT_KEY_PREVIOUS_VIEW
|
||||
|
||||
@@ -55,7 +55,6 @@ void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
lcdDrawNumber(x, 0, index+1, RIGHT | attr);
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, DOTTED);
|
||||
@@ -65,7 +64,6 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
|
||||
yhgt = h - yofs;
|
||||
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void title(const pm_char * s)
|
||||
{
|
||||
@@ -98,21 +96,12 @@ int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t eve
|
||||
return value;
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
|
||||
{
|
||||
lcdDrawChar(x+(value*4*FW)/max, y, '$');
|
||||
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, FORCE);
|
||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
|
||||
}
|
||||
#elif defined(GRAPHICS)
|
||||
void display5posSlider(coord_t x, coord_t y, uint8_t value, uint8_t attr)
|
||||
{
|
||||
lcdDrawChar(x+2*FW+(value*FW), y, '$');
|
||||
lcdDrawSolidHorizontalLine(x, y+3, 5*FW-1, SOLID);
|
||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE)) lcdDrawSolidFilledRect(x, y, 5*FW-1, FH-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(GVARS) && defined(CPUARM)
|
||||
@@ -257,7 +246,6 @@ void drawProgressBar(const char * label, int num, int den)
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
#if defined(CPUARM) || defined(CPUM2560)
|
||||
const pm_uchar SLEEP_BITMAP[] PROGMEM = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
@@ -271,4 +259,3 @@ void drawSleepBitmap()
|
||||
lcdDraw1bitBitmap((LCD_W-SLEEP_BITMAP_WIDTH)/2, (LCD_H-SLEEP_BITMAP_HEIGHT)/2, SLEEP_BITMAP, 0);
|
||||
lcdRefresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -83,13 +83,11 @@ void menuModelCurvesAll(event_t event)
|
||||
#endif
|
||||
{
|
||||
drawStringWithIndex(0, y, STR_CV, k+1, attr);
|
||||
#if defined(CPUARM)
|
||||
CurveData & crv = g_model.curves[k];
|
||||
editName(4*FW, y, crv.name, sizeof(crv.name), 0, 0);
|
||||
#if LCD_W >= 212
|
||||
lcdDrawNumber(11*FW, y, 5+crv.points, LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, STR_PTS, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -104,7 +102,6 @@ void menuModelCurvesAll(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags)
|
||||
{
|
||||
coord_t x1 = x;
|
||||
@@ -155,4 +152,3 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -20,10 +20,8 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
#if defined(CPUARM)
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupFunc)(event_t event) = NULL;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
@@ -43,11 +41,7 @@ const char * runPopupMenu(event_t event)
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
#if defined(CPUARM)
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i+(popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)], 0);
|
||||
#else
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i], popupMenuFlags);
|
||||
#endif
|
||||
if (i == s_menu_item) lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
|
||||
}
|
||||
|
||||
@@ -71,11 +65,7 @@ const char * runPopupMenu(event_t event)
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
#if defined(CPUARM)
|
||||
s_menu_item = min<uint8_t>(display_count, MENU_MAX_DISPLAY_LINES) - 1;
|
||||
#else
|
||||
s_menu_item = display_count - 1;
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
if (popupMenuNoItems > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - display_count;
|
||||
@@ -114,11 +104,7 @@ const char * runPopupMenu(event_t event)
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
#if defined(CPUARM)
|
||||
result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)];
|
||||
#else
|
||||
result = popupMenuItems[s_menu_item];
|
||||
#endif
|
||||
// no break
|
||||
|
||||
#if defined(CASE_EVT_ROTARY_LONG)
|
||||
|
||||
@@ -83,7 +83,6 @@ void onSdManagerMenu(const char * result)
|
||||
else if (result == STR_SD_FORMAT) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRM_FORMAT);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_COPY_FILE) {
|
||||
clipboard.type = CLIPBOARD_TYPE_SD_FILE;
|
||||
f_getcwd(clipboard.data.sd.directory, CLIPBOARD_PATH_LEN);
|
||||
@@ -111,7 +110,6 @@ void onSdManagerMenu(const char * result)
|
||||
s_editMode = EDIT_MODIFY_STRING;
|
||||
editNameCursorPos = 0;
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_DELETE_FILE) {
|
||||
getSelectionFullPath(lfn);
|
||||
f_unlink(lfn);
|
||||
@@ -120,13 +118,11 @@ void onSdManagerMenu(const char * result)
|
||||
showStatusLine();
|
||||
REFRESH_FILES();
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
getSelectionFullPath(lfn);
|
||||
audioQueue.stopAll();
|
||||
audioQueue.playFile(lfn, 0, ID_PLAY_FROM_SD_MANAGER);
|
||||
}
|
||||
#endif
|
||||
#if LCD_DEPTH > 1
|
||||
else if (result == STR_ASSIGN_BITMAP) {
|
||||
strAppendFilename(g_model.header.bitmap, line, sizeof(g_model.header.bitmap));
|
||||
@@ -134,12 +130,10 @@ void onSdManagerMenu(const char * result)
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
else if (result == STR_VIEW_TEXT) {
|
||||
getSelectionFullPath(lfn);
|
||||
pushMenuTextView(lfn);
|
||||
}
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
else if (result == STR_FLASH_BOOTLOADER) {
|
||||
getSelectionFullPath(lfn);
|
||||
@@ -176,9 +170,7 @@ void menuRadioSdManager(event_t _event)
|
||||
#if defined(PCBSKY9X)
|
||||
Card_state = SD_ST_DATA;
|
||||
#endif
|
||||
#if defined(CPUARM)
|
||||
audioQueue.stopSD();
|
||||
#endif
|
||||
if(sdCardFormat()) {
|
||||
f_chdir("/");
|
||||
REFRESH_FILES();
|
||||
@@ -258,7 +250,6 @@ void menuRadioSdManager(event_t _event)
|
||||
if (!strcmp(line, "..")) {
|
||||
break; // no menu for parent dir
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
const char * ext = getFileExtension(line);
|
||||
if (ext) {
|
||||
if (!strcasecmp(ext, SOUNDS_EXT)) {
|
||||
@@ -295,15 +286,12 @@ void menuRadioSdManager(event_t _event)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!READ_ONLY()) {
|
||||
#if defined(CPUARM)
|
||||
if (IS_FILE(line))
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_FILE);
|
||||
if (clipboard.type == CLIPBOARD_TYPE_SD_FILE)
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RENAME_FILE);
|
||||
#endif
|
||||
if (IS_FILE(line))
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE_FILE);
|
||||
}
|
||||
@@ -404,7 +392,6 @@ void menuRadioSdManager(event_t _event)
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) {
|
||||
lcdDrawChar(0, y, '[', s_editMode == EDIT_MODIFY_STRING ? 0 : attr);
|
||||
}
|
||||
#if defined(CPUARM)
|
||||
if (s_editMode == EDIT_MODIFY_STRING && attr) {
|
||||
uint8_t extlen, efflen;
|
||||
const char * ext = getFileExtension(reusableBuffer.sdmanager.originalName, 0, 0, NULL, &extlen);
|
||||
@@ -424,9 +411,6 @@ void menuRadioSdManager(event_t _event)
|
||||
else {
|
||||
lcdDrawText(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
}
|
||||
#else
|
||||
lcdDrawText(lcdNextPos, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
#endif
|
||||
if (IS_DIRECTORY(reusableBuffer.sdmanager.lines[i])) {
|
||||
lcdDrawChar(lcdNextPos, y, ']', s_editMode == EDIT_MODIFY_STRING ? 0 : attr);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx,
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
int posHorz = menuHorizontalPosition;
|
||||
@@ -60,9 +59,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr)
|
||||
{
|
||||
uint8_t mode = 0;
|
||||
@@ -176,7 +173,6 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
lcdNextPos = backupNextPos;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event)
|
||||
{
|
||||
@@ -186,11 +182,9 @@ void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t e
|
||||
MD_UNION_TO_WEIGHT(weight, md);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t idx, LcdFlags flags)
|
||||
{
|
||||
char s[8];
|
||||
getGVarString(s, idx);
|
||||
lcdDrawText(x, y, s, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#define CASE_EVT_ROTARY_RIGHT
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
typedef bool (*IsValueAvailable)(int);
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
@@ -70,7 +69,6 @@ bool isTelemetryFieldComparisonAvailable(int index);
|
||||
bool isSensorAvailable(int sensor);
|
||||
|
||||
bool modelHasNotes();
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
bool isSwitch2POSWarningStateAvailable(int state);
|
||||
@@ -88,7 +86,6 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "telemetry/telemetry_sensors.h"
|
||||
void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags flags);
|
||||
void drawCurveRef(coord_t x, coord_t y, CurveRef & curve, LcdFlags flags=0);
|
||||
@@ -99,7 +96,6 @@ void drawGPSSensorValue(coord_t x, coord_t y, TelemetryItem & telemetryItem, Lcd
|
||||
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t sensor, int32_t value, LcdFlags flags=0);
|
||||
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags flags=0);
|
||||
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
|
||||
#endif
|
||||
|
||||
void drawCurve(coord_t offset=0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user