[stock] Flash saving
This commit is contained in:
+22
-18
@@ -248,6 +248,7 @@ void title(const pm_char * s)
|
|||||||
bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, maxrow_t maxrow)
|
bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, maxrow_t maxrow)
|
||||||
{
|
{
|
||||||
maxrow_t l_posVert = m_posVert;
|
maxrow_t l_posVert = m_posVert;
|
||||||
|
maxrow_t l_posHorz = m_posHorz;
|
||||||
|
|
||||||
int8_t maxcol = MAXCOL(l_posVert);
|
int8_t maxcol = MAXCOL(l_posVert);
|
||||||
|
|
||||||
@@ -261,8 +262,8 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
}
|
}
|
||||||
if (g_eeGeneral.reNavigation && event == EVT_KEY_BREAK(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
if (g_eeGeneral.reNavigation && event == EVT_KEY_BREAK(BTN_REa+g_eeGeneral.reNavigation-1)) {
|
||||||
if (s_editMode > 0 && (maxcol & ZCHAR)) {
|
if (s_editMode > 0 && (maxcol & ZCHAR)) {
|
||||||
if (m_posHorz < (uint8_t)maxcol-ZCHAR) {
|
if (l_posHorz < (uint8_t)maxcol-ZCHAR) {
|
||||||
m_posHorz++;
|
l_posHorz++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
@@ -363,12 +364,12 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
if (s_editMode<=0) {
|
if (s_editMode<=0) {
|
||||||
if (scrollUD) {
|
if (scrollUD) {
|
||||||
l_posVert = limit((int8_t)0, (int8_t)(l_posVert - scrollUD), (int8_t)maxrow);
|
l_posVert = limit((int8_t)0, (int8_t)(l_posVert - scrollUD), (int8_t)maxrow);
|
||||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollLR && l_posVert>0) {
|
if (scrollLR && l_posVert>0) {
|
||||||
m_posHorz = limit((int8_t)0, (int8_t)(m_posHorz - scrollLR), (int8_t)maxcol);
|
l_posHorz = limit((int8_t)0, (int8_t)(l_posHorz - scrollLR), (int8_t)maxcol);
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,33 +379,33 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
--scrollRE;
|
--scrollRE;
|
||||||
maxcol = MAXCOL(l_posVert);
|
maxcol = MAXCOL(l_posVert);
|
||||||
if (maxcol & ZCHAR) maxcol = 0;
|
if (maxcol & ZCHAR) maxcol = 0;
|
||||||
if (++m_posHorz > maxcol) {
|
if (++l_posHorz > maxcol) {
|
||||||
if (l_posVert < maxrow) {
|
if (l_posVert < maxrow) {
|
||||||
++l_posVert;
|
++l_posVert;
|
||||||
maxcol = MAXCOL(l_posVert);
|
maxcol = MAXCOL(l_posVert);
|
||||||
if (maxcol & ZCHAR) maxcol = 0;
|
if (maxcol & ZCHAR) maxcol = 0;
|
||||||
if (maxcol < 0) l_posVert++;
|
if (maxcol < 0) l_posVert++;
|
||||||
m_posHorz = 0;
|
l_posHorz = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
--m_posHorz;
|
--l_posHorz;
|
||||||
scrollRE = 0;
|
scrollRE = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
++scrollRE;
|
++scrollRE;
|
||||||
if (m_posHorz-- == 0) {
|
if (l_posHorz-- == 0) {
|
||||||
if (l_posVert-- <= 0) {
|
if (l_posVert-- <= 0) {
|
||||||
l_posVert = menuTab ? 0 : -1;
|
l_posVert = menuTab ? 0 : -1;
|
||||||
m_posHorz = 0;
|
l_posHorz = 0;
|
||||||
scrollRE = 0;
|
scrollRE = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
maxcol = MAXCOL(l_posVert);
|
maxcol = MAXCOL(l_posVert);
|
||||||
if (maxcol & ZCHAR) maxcol = 0;
|
if (maxcol & ZCHAR) maxcol = 0;
|
||||||
if (maxcol < 0) { --l_posVert; maxcol = MAXCOL(l_posVert); if (maxcol & ZCHAR) maxcol = 0; }
|
if (maxcol < 0) { --l_posVert; maxcol = MAXCOL(l_posVert); if (maxcol & ZCHAR) maxcol = 0; }
|
||||||
m_posHorz = maxcol;
|
l_posHorz = maxcol;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,7 +417,8 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
case EVT_ENTRY:
|
case EVT_ENTRY:
|
||||||
minit();
|
l_posVert = 0;
|
||||||
|
l_posHorz = 0;
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
if (menuTab) {
|
if (menuTab) {
|
||||||
s_editMode = -1;
|
s_editMode = -1;
|
||||||
@@ -451,24 +453,25 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AUDIO_MENUS();
|
AUDIO_MENUS();
|
||||||
minit();
|
l_posVert = 0;
|
||||||
|
l_posHorz = 0;
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_REPT(KEY_RIGHT): //inc
|
case EVT_KEY_REPT(KEY_RIGHT): //inc
|
||||||
if (m_posHorz==maxcol) break;
|
if (l_posHorz==maxcol) break;
|
||||||
// no break
|
// no break
|
||||||
case EVT_KEY_FIRST(KEY_RIGHT)://inc
|
case EVT_KEY_FIRST(KEY_RIGHT)://inc
|
||||||
if (!horTab || s_editMode>0) break;
|
if (!horTab || s_editMode>0) break;
|
||||||
INC(m_posHorz,maxcol);
|
INC(l_posHorz,maxcol);
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_REPT(KEY_LEFT): //dec
|
case EVT_KEY_REPT(KEY_LEFT): //dec
|
||||||
if (m_posHorz==0) break;
|
if (l_posHorz==0) break;
|
||||||
// no break
|
// no break
|
||||||
case EVT_KEY_FIRST(KEY_LEFT)://dec
|
case EVT_KEY_FIRST(KEY_LEFT)://dec
|
||||||
if (!horTab || s_editMode>0) break;
|
if (!horTab || s_editMode>0) break;
|
||||||
DEC(m_posHorz,maxcol);
|
DEC(l_posHorz,maxcol);
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_REPT(KEY_DOWN): //inc
|
case EVT_KEY_REPT(KEY_DOWN): //inc
|
||||||
@@ -482,7 +485,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
s_editMode = 0;
|
s_editMode = 0;
|
||||||
#endif
|
#endif
|
||||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
break;
|
break;
|
||||||
case EVT_KEY_REPT(KEY_UP): //dec
|
case EVT_KEY_REPT(KEY_UP): //dec
|
||||||
@@ -493,7 +496,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
do {
|
do {
|
||||||
DEC(l_posVert,maxrow);
|
DEC(l_posVert,maxrow);
|
||||||
} while(MAXCOL(l_posVert) == (uint8_t)-1);
|
} while(MAXCOL(l_posVert) == (uint8_t)-1);
|
||||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
l_posHorz = min(l_posHorz, MAXCOL(l_posVert));
|
||||||
BLINK_SYNC;
|
BLINK_SYNC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -503,6 +506,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
|||||||
else if (l_posVert-s_pgOfs>max) s_pgOfs = l_posVert-max;
|
else if (l_posVert-s_pgOfs>max) s_pgOfs = l_posVert-max;
|
||||||
else if (l_posVert-s_pgOfs<1) s_pgOfs = l_posVert-1;
|
else if (l_posVert-s_pgOfs<1) s_pgOfs = l_posVert-1;
|
||||||
m_posVert = l_posVert;
|
m_posVert = l_posVert;
|
||||||
|
m_posHorz = l_posHorz;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ void check_rotary_encoder();
|
|||||||
extern maxrow_t m_posVert;
|
extern maxrow_t m_posVert;
|
||||||
extern uint8_t m_posHorz;
|
extern uint8_t m_posHorz;
|
||||||
|
|
||||||
inline void minit(){m_posVert=m_posHorz=0;}
|
|
||||||
bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *subTab, uint8_t subTabMax, maxrow_t maxrow);
|
bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *subTab, uint8_t subTabMax, maxrow_t maxrow);
|
||||||
bool check_simple(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, maxrow_t maxrow);
|
bool check_simple(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, maxrow_t maxrow);
|
||||||
bool check_submenu_simple(uint8_t event, uint8_t maxrow);
|
bool check_submenu_simple(uint8_t event, uint8_t maxrow);
|
||||||
|
|||||||
Reference in New Issue
Block a user