[sky9x] Popup on screen when Global Variables modified
[stock] Flash saving [gruvin9x] Inflight parameters modification feature removed (replaced by Global Variables, more powerful)
This commit is contained in:
+9
-38
@@ -214,12 +214,12 @@ void lcd_putsAtt(xcoord_t x,uint8_t y,const pm_char * s,uint8_t mode)
|
||||
|
||||
void lcd_puts(xcoord_t x,uint8_t y,const pm_char * s)
|
||||
{
|
||||
lcd_putsAtt( x, y, s, 0);
|
||||
lcd_putsAtt(x, y, s, 0);
|
||||
}
|
||||
|
||||
void lcd_putsLeft(uint8_t y, const pm_char * s)
|
||||
{
|
||||
lcd_putsAtt(0, y, s, 0);
|
||||
lcd_puts(0, y, s);
|
||||
}
|
||||
|
||||
void lcd_outhex4(xcoord_t x,uint8_t y,uint16_t val)
|
||||
@@ -244,19 +244,6 @@ void lcd_outdezAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags)
|
||||
lcd_outdezNAtt(x, y, val, flags);
|
||||
}
|
||||
|
||||
// TODO use doxygen style comments here
|
||||
|
||||
/*
|
||||
USAGE:
|
||||
lcd_outdezNAtt(x-coord, y-coord, (un)signed-value{0..65535|0..+/-32768},
|
||||
mode_flags, length)
|
||||
|
||||
Available mode_flas: PREC{1..3}, UNSIGN (for programmer selected signed numbers
|
||||
to allow for unsigned values up to the ful 65535 16-bit limt))
|
||||
|
||||
LEADING0 means pad 0 to the left of sig. digits up to 'len' total characters
|
||||
*/
|
||||
|
||||
void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
uint8_t fw = FWNUM;
|
||||
@@ -340,14 +327,6 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t
|
||||
}
|
||||
|
||||
if (neg) lcd_putcAtt(x, y, '-', flags);
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (flags & SURROUNDED) {
|
||||
xn = lcdLastPos - x + 2;
|
||||
if (!neg) { x+=FW; xn-=FW; }
|
||||
lcd_rect(x-1, y-1, xn, 9, BLINK_ON_PHASE ? DOTTED : ~DOTTED);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void lcd_mask(uint8_t *p, uint8_t mask, uint8_t att)
|
||||
@@ -469,13 +448,11 @@ void lcd_vline(xcoord_t x, int8_t y, int8_t h)
|
||||
|
||||
void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat, uint8_t att)
|
||||
{
|
||||
if (!((att & BLINK) && BLINK_ON_PHASE)) {
|
||||
lcd_vlineStip(x, y, h, pat);
|
||||
lcd_vlineStip(x+w-1, y, h, pat);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcd_hlineStip(x, y+h-1, w, pat);
|
||||
lcd_hlineStip(x, y, w, pat);
|
||||
}
|
||||
lcd_vlineStip(x, y, h, pat);
|
||||
lcd_vlineStip(x+w-1, y, h, pat);
|
||||
if (~att & ROUND) { x+=1; w-=2; }
|
||||
lcd_hlineStip(x, y+h-1, w, pat);
|
||||
lcd_hlineStip(x, y, w, pat);
|
||||
}
|
||||
|
||||
void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat, uint8_t att)
|
||||
@@ -528,9 +505,9 @@ void putsVBat(xcoord_t x, uint8_t y, uint8_t att)
|
||||
|
||||
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, uint8_t att)
|
||||
{
|
||||
lcd_putsAtt(x, y, str, att & ~BSS); // TODO use something else than BSS for LEADING0
|
||||
lcd_putsAtt(x, y, str, att);
|
||||
lcd_outdezNAtt(lcdLastPos, y, idx, att|LEFT, 2);
|
||||
lcd_putsAtt(x, y, str, att & ~BSS); // TODO use something else than BSS for LEADING0
|
||||
lcd_putsAtt(x, y, str, att);
|
||||
}
|
||||
|
||||
void putsChnRaw(xcoord_t x, uint8_t y, uint8_t idx, uint8_t att)
|
||||
@@ -547,12 +524,6 @@ void putsChnRaw(xcoord_t x, uint8_t y, uint8_t idx, uint8_t att)
|
||||
lcd_putsiAtt(x, y, STR_VTELEMCHNS, idx-(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2+NUM_CYC+NUM_PPM+NUM_CHNOUT), att);
|
||||
}
|
||||
|
||||
void putsChn(xcoord_t x, uint8_t y, uint8_t idx, uint8_t att)
|
||||
{
|
||||
if (idx > 0 && idx <= NUM_CHNOUT)
|
||||
putsChnRaw(x, y, idx+(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2+NUM_CYC+NUM_PPM), att);
|
||||
}
|
||||
|
||||
void putsMixerSource(xcoord_t x, uint8_t y, uint8_t idx, uint8_t att)
|
||||
{
|
||||
if (idx<=NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2)
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#define CONDENSED 0x08
|
||||
|
||||
/* lcd puts flags */
|
||||
#define BSS 0x10
|
||||
#define BSS 0x80 /* no 0x10 here to save flash as it is possible to have LEADING0 (putsStrIdx) */
|
||||
#define ZCHAR 0x20
|
||||
|
||||
/* lcd outdez flags */
|
||||
@@ -87,8 +87,6 @@
|
||||
/* telemetry flags */
|
||||
#define NO_UNIT 0x40
|
||||
|
||||
#define SURROUNDED 0x100
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define LcdFlags uint32_t
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
@@ -139,7 +137,7 @@ void putsRotaryEncoderMode(xcoord_t x, uint8_t y, uint8_t phase, uint8_t idx, ui
|
||||
#endif
|
||||
|
||||
extern void putsChnRaw(xcoord_t x,uint8_t y,uint8_t idx1,uint8_t att);
|
||||
extern void putsChn(xcoord_t x,uint8_t y,uint8_t idx1,uint8_t att);
|
||||
#define putsChn(x, y, idx, att) putsChnRaw(x, y, (idx)+(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS+NUM_STICKS+2+NUM_CYC+NUM_PPM), att)
|
||||
extern void putsChnLetter(xcoord_t x, uint8_t y, uint8_t idx, uint8_t attr);
|
||||
|
||||
extern void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, uint8_t att);
|
||||
|
||||
+12
-34
@@ -161,11 +161,6 @@ void menuMainView(uint8_t event)
|
||||
else if (s_global_warning) {
|
||||
s_global_warning = NULL;
|
||||
}
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (s_inflight_enable) {
|
||||
s_inflight_enable = false;
|
||||
}
|
||||
#endif
|
||||
else if (view == e_timer2) {
|
||||
resetTimer(1);
|
||||
}
|
||||
@@ -183,23 +178,6 @@ void menuMainView(uint8_t event)
|
||||
killEvents(KEY_UP);
|
||||
killEvents(KEY_DOWN);
|
||||
break;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
case EVT_KEY_LONG(BTN_REa):
|
||||
case EVT_KEY_LONG(BTN_REb):
|
||||
if (navigationRotaryEncoder(event)) {
|
||||
killEvents(event);
|
||||
if (s_inflight_value && !s_inflight_enable) {
|
||||
s_inflight_enable = true;
|
||||
s_editMode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// no break
|
||||
case EVT_KEY_BREAK(BTN_REa):
|
||||
case EVT_KEY_BREAK(BTN_REb):
|
||||
s_inflight_enable = false;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
@@ -403,25 +381,25 @@ void menuMainView(uint8_t event)
|
||||
// lcd_outdezNAtt(33+11*FW, FH*6, s_timerVal_10ms[1], LEADING0, 2); // 1/100s
|
||||
}
|
||||
|
||||
if (s_global_warning) {
|
||||
if (s_warning) {
|
||||
// Nothing here
|
||||
}
|
||||
else if (s_global_warning) {
|
||||
s_warning = s_global_warning;
|
||||
displayWarning(_event);
|
||||
if (!s_warning) s_global_warning = NULL;
|
||||
s_warning = NULL;
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
check_rotary_encoder();
|
||||
if (s_inflight_enable && !s_warning) {
|
||||
int8_t value = (((uint8_t)(*s_inflight_value)) >> s_inflight_bitshift) - s_inflight_shift;
|
||||
if (p1valdiff) {
|
||||
value = checkIncDecModel(event, value, s_inflight_min, s_inflight_max);
|
||||
*s_inflight_value = (((uint8_t)(*s_inflight_value)) & ((1 << s_inflight_bitshift) - 1)) + ((s_inflight_shift + value) << s_inflight_bitshift);
|
||||
}
|
||||
s_warning = s_inflight_label;
|
||||
#if defined(GVARS) && defined(PCBSKY9X)
|
||||
else if (s_gvar_timer > 0) {
|
||||
s_gvar_timer--;
|
||||
s_warning = PSTR("Global Variable");
|
||||
displayBox();
|
||||
s_warning = 0;
|
||||
lcd_outdezAtt(16, 4*FH, value, LEFT);
|
||||
lcd_putsnAtt(16, 5*FH, g_model.gvars[s_gvar_last].name, sizeof(g_model.gvars[s_gvar_last].name), ZCHAR);
|
||||
lcd_putsAtt(16+7*FW, 5*FH, PSTR("[\004]"), BOLD);
|
||||
lcd_outdezAtt(16+7*FW+4*FW+FW/2, 5*FH, g_model.gvars[s_gvar_last].value, BOLD);
|
||||
s_warning = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+7
-53
@@ -33,11 +33,7 @@
|
||||
|
||||
#include "open9x.h"
|
||||
|
||||
#if defined(SDCARD)
|
||||
uint16_t s_pgOfs;
|
||||
#else
|
||||
uint8_t s_pgOfs;
|
||||
#endif
|
||||
pgofs_t s_pgOfs;
|
||||
int8_t s_editMode;
|
||||
uint8_t s_noHi;
|
||||
uint8_t s_noScroll;
|
||||
@@ -206,24 +202,18 @@ bool check_submenu_simple(uint8_t event, uint8_t maxrow)
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY 4
|
||||
#else
|
||||
#define ROTARY_ENCODER_GRANULARITY 1
|
||||
#endif
|
||||
|
||||
void check_rotary_encoder()
|
||||
{
|
||||
// check rotary encoder 1 if changed -> cursor down/up
|
||||
static int16_t re1valprev;
|
||||
static int16_t rePreviousValue;
|
||||
|
||||
if (g_eeGeneral.reNavigation) {
|
||||
uint8_t re = g_eeGeneral.reNavigation - 1;
|
||||
p1valdiff = 0;
|
||||
scrollRE = re1valprev - (g_rotenc[re] / ROTARY_ENCODER_GRANULARITY);
|
||||
int16_t reNewValue = (g_rotenc[re] / ROTARY_ENCODER_GRANULARITY);
|
||||
scrollRE = rePreviousValue - reNewValue;
|
||||
if (scrollRE) {
|
||||
re1valprev = (g_rotenc[re] / ROTARY_ENCODER_GRANULARITY);
|
||||
rePreviousValue = reNewValue;
|
||||
if (s_editMode > 0) {
|
||||
p1valdiff = -scrollRE;
|
||||
scrollRE = 0;
|
||||
@@ -231,7 +221,7 @@ void check_rotary_encoder()
|
||||
}
|
||||
}
|
||||
else {
|
||||
re1valprev = 0;
|
||||
rePreviousValue = 0;
|
||||
p1valdiff = 0;
|
||||
scrollRE = 0;
|
||||
}
|
||||
@@ -519,9 +509,6 @@ void popMenu()
|
||||
|
||||
void chainMenu(MenuFuncP newMenu)
|
||||
{
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_inflight_enable = false;
|
||||
#endif
|
||||
g_menuStack[g_menuStackPtr] = newMenu;
|
||||
(*newMenu)(EVT_ENTRY);
|
||||
AUDIO_MENUS();
|
||||
@@ -529,10 +516,6 @@ void chainMenu(MenuFuncP newMenu)
|
||||
|
||||
void pushMenu(MenuFuncP newMenu)
|
||||
{
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_inflight_enable = false;
|
||||
#endif
|
||||
|
||||
if (g_menuStackPtr == 0) {
|
||||
if (newMenu == menuGeneralSetup)
|
||||
g_menuPos[0] = 1;
|
||||
@@ -635,7 +618,7 @@ int8_t gvarMenuItem(uint8_t x, uint8_t y, int8_t value, int8_t min, int8_t max,
|
||||
bool invers = attr&INVERS;
|
||||
if (invers && event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
s_editMode = !s_editMode;
|
||||
value = ((value >= 126 || value <= -126) ? REG(value, min, max) : 126);
|
||||
value = ((value >= 126 || value <= -126) ? GVAR(value, min, max) : 126);
|
||||
eeDirty(EE_MODEL);
|
||||
}
|
||||
if (value >= 126 || value <= -126) {
|
||||
@@ -744,34 +727,5 @@ void drawStatusLine()
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
bool s_inflight_enable = false;
|
||||
int8_t *s_inflight_value = NULL;
|
||||
int8_t s_inflight_min;
|
||||
int8_t s_inflight_max;
|
||||
int8_t s_inflight_shift;
|
||||
uint8_t s_inflight_bitshift;
|
||||
const pm_char *s_inflight_label;
|
||||
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift)
|
||||
{
|
||||
*value = (((uint8_t)(*value)) & ((1 << bitshift) - 1)) + ((i_shift + checkIncDecModel(event, (((uint8_t)(*value)) >> bitshift)-i_shift, i_min, i_max)) << bitshift);
|
||||
|
||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_LONG(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
||||
if (value == s_inflight_value) {
|
||||
s_inflight_value = NULL;
|
||||
}
|
||||
else {
|
||||
s_inflight_value = value;
|
||||
s_inflight_min = i_min;
|
||||
s_inflight_max = i_max;
|
||||
s_inflight_shift = i_shift;
|
||||
s_inflight_label = label;
|
||||
s_inflight_bitshift = bitshift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+4
-27
@@ -54,10 +54,12 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
#endif
|
||||
|
||||
#if defined(SDCARD)
|
||||
extern uint16_t s_pgOfs;
|
||||
typedef uint16_t pgofs_t;
|
||||
#else
|
||||
extern uint8_t s_pgOfs;
|
||||
typedef uint8_t pgofs_t;
|
||||
#endif
|
||||
|
||||
extern pgofs_t s_pgOfs;
|
||||
extern uint8_t s_noHi;
|
||||
extern uint8_t s_noScroll;
|
||||
|
||||
@@ -135,32 +137,7 @@ int8_t checkIncDecGen(uint8_t event, int8_t i_val, int8_t i_min, int8_t i_max);
|
||||
var = checkIncDecGen(event,var,min,max)
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern bool s_inflight_enable;
|
||||
extern int8_t *s_inflight_value;
|
||||
extern const pm_char *s_inflight_label;
|
||||
extern int8_t s_inflight_min;
|
||||
extern int8_t s_inflight_max;
|
||||
extern int8_t s_inflight_shift;
|
||||
extern uint8_t s_inflight_bitshift;
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define PREPARE_INFLIGHT_BITFIELD(a) int8_t *bitfield = (a)
|
||||
#endif
|
||||
#define INFLIGHT(val) (s_inflight_value==&val ? SURROUNDED : 0)
|
||||
void checkInFlightIncDecModel(uint8_t event, int8_t *value, int8_t i_min, int8_t i_max, int8_t i_shift, const pm_char *label, uint8_t bitshift=0);
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, imin, imax, ishift, label) \
|
||||
checkInFlightIncDecModel(event, &var, imin, imax, ishift, label)
|
||||
#if defined(PCBGRUVIN9X)
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, var, imin, imax, ishift, label, bitshift) \
|
||||
checkInFlightIncDecModel(event, bitfield, imin, imax, ishift, label, bitshift);
|
||||
#endif
|
||||
void check_rotary_encoder();
|
||||
#else
|
||||
#define PREPARE_INFLIGHT_BITFIELD(a)
|
||||
#define INFLIGHT(val) 0
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR(event, var, min, max, shift, label) \
|
||||
var = shift+checkIncDecModel(event,var-(shift),min,max)
|
||||
#define CHECK_INFLIGHT_INCDEC_MODELVAR_BITFIELD(event, var, min, max, shift, label, bitshift) \
|
||||
var = shift+checkIncDecModel(event,var-(shift),min,max)
|
||||
#endif
|
||||
|
||||
// Menus related stuff ...
|
||||
|
||||
+10
-14
@@ -456,10 +456,10 @@ void menuModelSelect(uint8_t event)
|
||||
putsModelName(4*FW, y, name, k, 0);
|
||||
lcd_outdezAtt(20*FW, y, size, 0);
|
||||
#endif
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+s_pgOfs!=sub)) lcd_putc(1, y, '*');
|
||||
if (k==g_eeGeneral.currModel && (s_copyMode!=COPY_MODE || s_copySrcRow<0 || i+s_pgOfs!=(pgofs_t)sub)) lcd_putc(1, y, '*');
|
||||
}
|
||||
|
||||
if (s_copyMode && sub==i+s_pgOfs) {
|
||||
if (s_copyMode && (pgofs_t)sub==i+s_pgOfs) {
|
||||
lcd_filled_rect(9, y, DISPLAY_W-1-9, 7);
|
||||
lcd_rect(8, y-1, DISPLAY_W-1-7, 9, s_copyMode == COPY_MODE ? SOLID : DOTTED);
|
||||
}
|
||||
@@ -2173,23 +2173,19 @@ void menuModelLimits(uint8_t event)
|
||||
break;
|
||||
case ITEM_LIMITS_MIN:
|
||||
#ifdef PPM_LIMITS_UNIT_US
|
||||
lcd_outdezAtt(12*FW+1, y, (((int16_t)ld->min-100)*128) / 25, attr | INFLIGHT(ld->min));
|
||||
lcd_outdezAtt(12*FW+1, y, (((int16_t)ld->min-100)*128) / 25, attr);
|
||||
#else
|
||||
lcd_outdezAtt(12*FW, y, (int8_t)(ld->min-100), attr | INFLIGHT(ld->min));
|
||||
lcd_outdezAtt(12*FW, y, (int8_t)(ld->min-100), attr);
|
||||
#endif
|
||||
if (active) {
|
||||
CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->min, -limit, 25, +100, STR_MINLIMIT);
|
||||
}
|
||||
if (active) ld->min = 100 + checkIncDec(event, ld->min-100, -limit, 25, EE_MODEL);
|
||||
break;
|
||||
case ITEM_LIMITS_MAX:
|
||||
#ifdef PPM_LIMITS_UNIT_US
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (((int16_t)ld->max+100)*128) / 25, attr | INFLIGHT(ld->max));
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (((int16_t)ld->max+100)*128) / 25, attr);
|
||||
#else
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (int8_t)(ld->max+100), attr | INFLIGHT(ld->max));
|
||||
lcd_outdezAtt(LIMITS_MAX_POS, y, (int8_t)(ld->max+100), attr);
|
||||
#endif
|
||||
if (active) {
|
||||
CHECK_INFLIGHT_INCDEC_MODELVAR(event, ld->max, -25, limit, -100, STR_MAXLIMIT);
|
||||
}
|
||||
if (active) ld->max = -100 + checkIncDec(event, ld->max+100, -25, limit, EE_MODEL);
|
||||
break;
|
||||
case ITEM_LIMITS_DIRECTION:
|
||||
#ifdef PPM_CENTER_ADJUSTABLE
|
||||
@@ -2306,14 +2302,14 @@ void menuModelCurvesAll(uint8_t event)
|
||||
#if defined(PCBSKY9X)
|
||||
putsStrIdx(0, y, STR_GV, k-MAX_CURVES+1, attr);
|
||||
if (sub >= MAX_CURVES) {
|
||||
lcd_outdezAtt(10*FW, y, REG_VALUE(k-MAX_CURVES));
|
||||
lcd_outdezAtt(10*FW, y, GVAR_VALUE(k-MAX_CURVES));
|
||||
lcd_putsnAtt(12*FW, y, g_model.gvars[k-MAX_CURVES].name, sizeof(g_model.gvars[k-MAX_CURVES].name), ZCHAR);
|
||||
}
|
||||
#else
|
||||
putsStrIdx(0, y, STR_GV, k-MAX_CURVES+1);
|
||||
if (sub >= MAX_CURVES) {
|
||||
if (attr && s_editMode>0) attr |= BLINK;
|
||||
lcd_outdezAtt(10*FW, y, REG_VALUE(k-MAX_CURVES), attr);
|
||||
lcd_outdezAtt(10*FW, y, GVAR_VALUE(k-MAX_CURVES), attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.gvars[k-MAX_CURVES], -125, 125);
|
||||
}
|
||||
#endif
|
||||
|
||||
+2
-2
@@ -729,10 +729,10 @@ PACK(typedef struct {
|
||||
int8_t value;
|
||||
char name[6];
|
||||
}) model_gvar_t;
|
||||
#define REG_VALUE(x) g_model.gvars[x].value
|
||||
#define GVAR_VALUE(x) g_model.gvars[x].value
|
||||
#else
|
||||
typedef int8_t model_gvar_t;
|
||||
#define REG_VALUE(x) g_model.gvars[x]
|
||||
#define GVAR_VALUE(x) g_model.gvars[x]
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
|
||||
+53
-17
@@ -447,9 +447,9 @@ void applyExpos(int16_t *anas)
|
||||
if (ed.curveMode == MODE_CURVE)
|
||||
v = applyCurve(v, curveParam);
|
||||
else
|
||||
v = expo(v, REG(curveParam, -100, 100));
|
||||
v = expo(v, GVAR(curveParam, -100, 100));
|
||||
}
|
||||
v = ((int32_t)v * REG(ed.weight, 0, 100)) / 100;
|
||||
v = ((int32_t)v * GVAR(ed.weight, 0, 100)) / 100;
|
||||
anas[cur_chn] = v;
|
||||
}
|
||||
}
|
||||
@@ -931,9 +931,26 @@ void incRotaryEncoder(uint8_t idx, int8_t inc)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
int8_t REG(int8_t x, int8_t min, int8_t max)
|
||||
int8_t GVAR(int8_t x, int8_t min, int8_t max)
|
||||
{
|
||||
return (x >= 126 || x <= -126) ? limit(min, REG_VALUE((uint8_t)x - 126), max) : x;
|
||||
return (x >= 126 || x <= -126) ? limit(min, GVAR_VALUE((uint8_t)x - 126), max) : x;
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t s_gvar_timer = 0;
|
||||
uint8_t s_gvar_last = 0;
|
||||
#endif
|
||||
|
||||
void setGVarValue(uint8_t x, int8_t value)
|
||||
{
|
||||
if (GVAR_VALUE(x) != value) {
|
||||
GVAR_VALUE(x) = value;
|
||||
eeDirty(EE_MODEL);
|
||||
#if defined(PCBSKY9X)
|
||||
s_gvar_last = x;
|
||||
s_gvar_timer = GVAR_DISPLAY_TIME;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1322,10 +1339,17 @@ void checkTrims()
|
||||
}
|
||||
|
||||
#if defined(GVARS)
|
||||
if (TRIM_REUSED())
|
||||
if (TRIM_REUSED()) {
|
||||
*trimPtr[idx] = after;
|
||||
else
|
||||
eeDirty(EE_MODEL);
|
||||
#if defined(PCBSKY9X)
|
||||
s_gvar_last = (trimPtr[idx] - &g_model.gvars[0].value) / sizeof(g_model.gvars[0]);
|
||||
s_gvar_timer = GVAR_DISPLAY_TIME;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
setTrimValue(phase, idx, after);
|
||||
}
|
||||
#else
|
||||
setTrimValue(phase, idx, after);
|
||||
#endif
|
||||
@@ -1930,6 +1954,10 @@ void evalFunctions()
|
||||
{
|
||||
MASK_FUNC_TYPE newActiveFunctions = 0;
|
||||
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS)
|
||||
static rotenc_t rePreviousValues[ROTARY_ENCODERS];
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<NUM_CHNOUT; i++)
|
||||
safetyCh[i] = -128; // not defined
|
||||
|
||||
@@ -2099,10 +2127,18 @@ void evalFunctions()
|
||||
#if defined(GVARS)
|
||||
else if (sd->func >= FUNC_ADJUST_GV1) {
|
||||
if (FSW_PARAM(sd) >= MIXSRC_TrimRud-1 && FSW_PARAM(sd) <= MIXSRC_TrimAil-1) {
|
||||
trimPtr[FSW_PARAM(sd)-MIXSRC_TrimRud+1] = ®_VALUE(sd->func-FUNC_ADJUST_GV1);
|
||||
trimPtr[FSW_PARAM(sd)-MIXSRC_TrimRud+1] = &GVAR_VALUE(sd->func-FUNC_ADJUST_GV1);
|
||||
}
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (FSW_PARAM(sd) >= MIXSRC_REa-1 && FSW_PARAM(sd) < MIXSRC_TrimRud-1) {
|
||||
int8_t scroll = rePreviousValues[FSW_PARAM(sd)-MIXSRC_REa+1] - (g_rotenc[FSW_PARAM(sd)-MIXSRC_REa+1] / ROTARY_ENCODER_GRANULARITY);
|
||||
if (scroll) {
|
||||
setGVarValue(sd->func-FUNC_ADJUST_GV1, GVAR_VALUE(sd->func-FUNC_ADJUST_GV1) + scroll);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
REG_VALUE(sd->func-FUNC_ADJUST_GV1) = limit((int16_t)-1250, getValue(FSW_PARAM(sd)), (int16_t)1250) / 10;
|
||||
setGVarValue(sd->func-FUNC_ADJUST_GV1, limit((int16_t)-1250, getValue(FSW_PARAM(sd)), (int16_t)1250) / 10);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -2141,6 +2177,11 @@ void evalFunctions()
|
||||
}
|
||||
|
||||
activeFunctions = newActiveFunctions;
|
||||
|
||||
#if defined(ROTARY_ENCODERS) && defined(GVARS)
|
||||
for (uint8_t i=0; i<ROTARY_ENCODERS; i++)
|
||||
rePreviousValues[i] = (g_rotenc[i] / ROTARY_ENCODER_GRANULARITY);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t s_perout_flight_phase;
|
||||
@@ -2328,7 +2369,7 @@ void perOut(uint8_t tick10ms)
|
||||
|
||||
//========== OFFSET ===============
|
||||
if (apply_offset) {
|
||||
int8_t offset = REG(md->sOffset, -125, 125);
|
||||
int8_t offset = GVAR(md->sOffset, -125, 125);
|
||||
if (offset) v += calc100toRESX(offset);
|
||||
}
|
||||
|
||||
@@ -2345,7 +2386,7 @@ void perOut(uint8_t tick10ms)
|
||||
v += trims[mix_trim];
|
||||
}
|
||||
|
||||
int8_t weight = REG(md->weight, -125, 125);
|
||||
int8_t weight = GVAR(md->weight, -125, 125);
|
||||
|
||||
//========== SPEED ===============
|
||||
if (s_perout_mode == e_perout_mode_normal && (md->speedUp || md->speedDown)) // there are delay values
|
||||
@@ -2385,7 +2426,7 @@ void perOut(uint8_t tick10ms)
|
||||
|
||||
//========== DIFFERENTIAL =========
|
||||
if (md->curveMode == MODE_DIFFERENTIAL) {
|
||||
int8_t curveParam = REG(md->curveParam, -100, 100);
|
||||
int8_t curveParam = GVAR(md->curveParam, -100, 100);
|
||||
if (curveParam>0 && dv<0)
|
||||
dv = (dv * (100-curveParam)) / 100;
|
||||
else if (curveParam<0 && dv>0)
|
||||
@@ -3247,12 +3288,7 @@ void saveTimers()
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
// Rotary encoder interrupts
|
||||
#if defined(PCBSKY9X)
|
||||
volatile uint32_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
#else
|
||||
volatile uint8_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
#endif
|
||||
volatile rotenc_t g_rotenc[ROTARY_ENCODERS] = {0};
|
||||
#endif
|
||||
|
||||
#ifndef SIMU
|
||||
|
||||
+16
-5
@@ -689,12 +689,22 @@ inline bool navigationRotaryEncoder(uint8_t event)
|
||||
{
|
||||
return g_eeGeneral.reNavigation == ((event & EVT_KEY_MASK) - BTN_REa + 1);
|
||||
}
|
||||
#if defined(PCBSKY9X)
|
||||
#define ROTARY_ENCODER_GRANULARITY 4
|
||||
#else
|
||||
#define ROTARY_ENCODER_GRANULARITY 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
int8_t REG(int8_t x, int8_t min, int8_t max);
|
||||
int8_t GVAR(int8_t x, int8_t min, int8_t max);
|
||||
#if defined(PCBSKY9X)
|
||||
#define GVAR_DISPLAY_TIME 100 /*1 second*/;
|
||||
extern uint8_t s_gvar_timer;
|
||||
extern uint8_t s_gvar_last;
|
||||
#endif
|
||||
#else
|
||||
#define REG(x, min, max) (x)
|
||||
#define GVAR(x, min, max) (x)
|
||||
#endif
|
||||
|
||||
extern uint16_t s_timeCumTot;
|
||||
@@ -1041,12 +1051,13 @@ inline bool isFunctionActive(uint8_t func)
|
||||
}
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
// Global rotary encoder registers -- 8-bit, 0-255
|
||||
// Global rotary encoder registers
|
||||
#if defined(PCBSKY9X)
|
||||
extern volatile uint32_t g_rotenc[ROTARY_ENCODERS];
|
||||
typedef uint32_t rotenc_t;
|
||||
#else
|
||||
extern volatile uint8_t g_rotenc[ROTARY_ENCODERS];
|
||||
typedef uint8_t rotenc_t;
|
||||
#endif
|
||||
extern volatile rotenc_t g_rotenc[ROTARY_ENCODERS];
|
||||
#endif
|
||||
|
||||
#ifdef JETI
|
||||
|
||||
+3
-11
@@ -264,11 +264,12 @@ const pm_char STR_MENUCUSTOMSWITCH[] PROGMEM = TR_MENUCUSTOMSWITCH;
|
||||
const pm_char STR_MENUCUSTOMSWITCHES[] PROGMEM = TR_MENUCUSTOMSWITCHES;
|
||||
const pm_char STR_MENUFUNCSWITCHES[] PROGMEM = TR_MENUFUNCSWITCHES;
|
||||
|
||||
#ifdef FRSKY
|
||||
#if defined(FRSKY)
|
||||
const pm_char STR_MENUTELEMETRY[] PROGMEM = TR_MENUTELEMETRY;
|
||||
const pm_char STR_LIMIT[] PROGMEM = TR_LIMIT;
|
||||
#endif
|
||||
|
||||
#ifdef TEMPLATES
|
||||
#if defined(TEMPLATES)
|
||||
const pm_char STR_MENUTEMPLATES[] PROGMEM = TR_MENUTEMPLATES;
|
||||
#endif
|
||||
|
||||
@@ -287,15 +288,6 @@ const pm_char STR_INVERT_THR[] PROGMEM = TR_INVERT_THR;
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
const pm_char STR_BACK[] PROGMEM = TR_BACK;
|
||||
const pm_char STR_MIXERWEIGHT[] PROGMEM = TR_MIXERWEIGHT; // TODO remove them
|
||||
const pm_char STR_MIXEROFFSET[] PROGMEM = TR_MIXEROFFSET;
|
||||
const pm_char STR_DRWEIGHT[] PROGMEM = TR_DRWEIGHT;
|
||||
const pm_char STR_DREXPO[] PROGMEM = TR_DREXPO;
|
||||
const pm_char STR_MAXLIMIT[] PROGMEM = TR_MAXLIMIT;
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS) || defined(FRSKY)
|
||||
const pm_char STR_MINLIMIT[] PROGMEM = TR_MINLIMIT;
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
|
||||
+2
-7
@@ -365,15 +365,10 @@ extern const pm_char STR_INVERT_THR[];
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
extern const pm_char STR_BACK[];
|
||||
#define LEN_BACK PSIZE(TR_BACK)
|
||||
extern const pm_char STR_MIXERWEIGHT[];
|
||||
extern const pm_char STR_MIXEROFFSET[];
|
||||
extern const pm_char STR_DRWEIGHT[];
|
||||
extern const pm_char STR_DREXPO[];
|
||||
extern const pm_char STR_MAXLIMIT[];
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODERS) || defined(FRSKY)
|
||||
extern const pm_char STR_MINLIMIT[];
|
||||
#if defined(FRSKY)
|
||||
extern const pm_char STR_LIMIT[];
|
||||
#endif
|
||||
|
||||
#ifdef FRSKY_HUB
|
||||
|
||||
@@ -266,12 +266,8 @@
|
||||
#define TR_WEIGHT "V\200ha"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Strana"
|
||||
#define TR_MIXERWEIGHT "V\200ha Mixu"
|
||||
#define TR_DIFFERENTIAL "Dif.V\212chylek"
|
||||
#define TR_OFFSET "Ofset"
|
||||
#define TR_MIXEROFFSET "Ofset Mixu"
|
||||
#define TR_DRWEIGHT "V\200ha DV"
|
||||
#define TR_DREXPO "Expo DV"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DVex"
|
||||
#define TR_CURVE "K\206ivka"
|
||||
@@ -393,9 +389,7 @@
|
||||
#define TR_RXNUM "RxNum"
|
||||
#define TR_SYNCMENU "Sync [MENU]"
|
||||
#define TR_BACK "Back"
|
||||
#define TR_MINLIMIT "Min Limit"
|
||||
#define STR_LIMIT (STR_MINLIMIT+4)
|
||||
#define TR_MAXLIMIT "Max Limit"
|
||||
#define TR_LIMIT "Limit"
|
||||
#define TR_MINRSSI "Min Rssi"
|
||||
#define TR_LATITUDE "Latitude"
|
||||
#define TR_LONGITUDE "Longitude"
|
||||
|
||||
@@ -266,12 +266,8 @@
|
||||
#define TR_WEIGHT "Gewicht"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Side"
|
||||
#define TR_MIXERWEIGHT "Mixer Weight"
|
||||
#define TR_DIFFERENTIAL "Differ"
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Mixer Offset"
|
||||
#define TR_DRWEIGHT "DR Weight"
|
||||
#define TR_DREXPO "DR Expo"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Kurve"
|
||||
@@ -393,9 +389,7 @@
|
||||
#define TR_RXNUM "RxNum"
|
||||
#define TR_SYNCMENU "Sync [MENU]"
|
||||
#define TR_BACK "Zur\205ck"
|
||||
#define TR_MINLIMIT "Min Limit"
|
||||
#define STR_LIMIT (STR_MINLIMIT+4)
|
||||
#define TR_MAXLIMIT "Max Limit"
|
||||
#define TR_LIMIT "Limit"
|
||||
#define TR_MINRSSI "Min Rssi"
|
||||
#define TR_LATITUDE "Latitude"
|
||||
#define TR_LONGITUDE "Longitude"
|
||||
|
||||
@@ -267,12 +267,8 @@
|
||||
#define TR_WEIGHT "Weight"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Side"
|
||||
#define TR_MIXERWEIGHT "Mixer Weight"
|
||||
#define TR_DIFFERENTIAL "Differ"
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Mixer Offset"
|
||||
#define TR_DRWEIGHT "DR Weight"
|
||||
#define TR_DREXPO "DR Expo"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curve"
|
||||
@@ -399,9 +395,7 @@
|
||||
#define TR_RXNUM "RxNum"
|
||||
#define TR_SYNCMENU "Sync [MENU]"
|
||||
#define TR_BACK "Back"
|
||||
#define TR_MINLIMIT "Min Limit"
|
||||
#define STR_LIMIT (STR_MINLIMIT+4)
|
||||
#define TR_MAXLIMIT "Max Limit"
|
||||
#define TR_LIMIT "Limit"
|
||||
#define TR_MINRSSI "Min Rssi"
|
||||
#define TR_LATITUDE "Latitude"
|
||||
#define TR_LONGITUDE "Longitude"
|
||||
|
||||
@@ -264,12 +264,8 @@
|
||||
#define TR_WEIGHT "Ratio"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Cot\200"
|
||||
#define TR_MIXERWEIGHT "Ratio Mixage"
|
||||
#define TR_DIFFERENTIAL "Diff\200rentiel"
|
||||
#define TR_OFFSET "D\200calage"
|
||||
#define TR_MIXEROFFSET "Offset Mixage"
|
||||
#define TR_DRWEIGHT "Ratio DR"
|
||||
#define TR_DREXPO "Expo DR"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Courbe"
|
||||
@@ -391,9 +387,7 @@
|
||||
#define TR_RXNUM "NumRx"
|
||||
#define TR_SYNCMENU "Sync [MENU]"
|
||||
#define TR_BACK "Ret."
|
||||
#define TR_MINLIMIT "Min Limit"
|
||||
#define TR_MAXLIMIT "Max Limit"
|
||||
#define STR_LIMIT (STR_MINLIMIT+4)
|
||||
#define TR_LIMIT "Limit"
|
||||
#define TR_MINRSSI "RSSI Min."
|
||||
#define TR_LATITUDE "Latitude"
|
||||
#define TR_LONGITUDE "Longitude"
|
||||
|
||||
@@ -266,12 +266,8 @@
|
||||
#define TR_WEIGHT "Peso"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Side"
|
||||
#define TR_MIXERWEIGHT "Peso Mixer"
|
||||
#define TR_DIFFERENTIAL "Differ"
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Offset Mixer"
|
||||
#define TR_DRWEIGHT "Peso DR "
|
||||
#define TR_DREXPO "Expo DR"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Curva"
|
||||
@@ -393,9 +389,7 @@
|
||||
#define TR_RXNUM "RxNum"
|
||||
#define TR_SYNCMENU "Sinc.[Men\200]"
|
||||
#define TR_BACK "Prec"
|
||||
#define TR_MINLIMIT "Min Limit"
|
||||
#define STR_LIMIT (STR_MINLIMIT+4)
|
||||
#define TR_MAXLIMIT "Max Limit"
|
||||
#define TR_LIMIT "Limit"
|
||||
#define TR_MINRSSI "Min Rssi"
|
||||
#define TR_LATITUDE "Latitud."
|
||||
#define TR_LONGITUDE "Longitud."
|
||||
|
||||
@@ -261,14 +261,10 @@
|
||||
#define TR_EDITMIX "EDITERA MIX"
|
||||
#define TR_SOURCE "K\201lla"
|
||||
#define TR_WEIGHT "Vikt"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Sida"
|
||||
#define TR_MIXERWEIGHT "Mixer-vikt"
|
||||
#define TR_EXPO "Expo"
|
||||
#define TR_SIDE "Sida"
|
||||
#define TR_DIFFERENTIAL "Diff."
|
||||
#define TR_OFFSET "Offset"
|
||||
#define TR_MIXEROFFSET "Mixer-offset"
|
||||
#define TR_DRWEIGHT "DR-vikt"
|
||||
#define TR_DREXPO "DR-expo"
|
||||
#define TR_TRIM "Trim"
|
||||
#define TR_DREX "DRex"
|
||||
#define TR_CURVE "Kurvor"
|
||||
@@ -390,9 +386,7 @@
|
||||
#define TR_RXNUM "RxNum"
|
||||
#define TR_SYNCMENU "Synk [MENU]"
|
||||
#define TR_BACK "EXIT"
|
||||
#define TR_MINLIMIT "MinNiv\200"
|
||||
#define STR_LIMIT (STR_MINLIMIT)
|
||||
#define TR_MAXLIMIT "MaxNiv\200"
|
||||
#define TR_LIMIT "MinNiv\200"
|
||||
#define TR_MINRSSI "Min Rssi"
|
||||
#define TR_LATITUDE "Breddgrad"
|
||||
#define TR_LONGITUDE "L\201ngdgrad"
|
||||
|
||||
Reference in New Issue
Block a user