Issue 157 fixed
[stock] Flash saving (around 100bytes)
This commit is contained in:
+3
-5
@@ -1217,7 +1217,7 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
att = (s_timerState[0]==TMR_BEEPING ? BLINK : 0);
|
||||
putsTime(17*FW, 0, s_timerVal[0], att, att);
|
||||
}
|
||||
lcd_filled_rect(0, 0, DISPLAY_W, 8);
|
||||
lcd_invert_line(0);
|
||||
|
||||
if (frskyStreaming >= 0) {
|
||||
if (s_frsky_view < MAX_FRSKY_SCREENS) {
|
||||
@@ -1257,11 +1257,9 @@ void menuTelemetryFrsky(uint8_t event)
|
||||
uint8_t width = barCoord(value, barMin, barMax);
|
||||
|
||||
// reversed barshade for T1/T2
|
||||
uint8_t barShade;
|
||||
uint8_t barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
if (source == TELEM_T1 || source == TELEM_T2)
|
||||
barShade = ((threshold < value) ? DOTTED : SOLID);
|
||||
else
|
||||
barShade = ((threshold > value) ? DOTTED : SOLID);
|
||||
barShade = -barShade;
|
||||
|
||||
lcd_filled_rect(26, y+1, width, barHeight, barShade);
|
||||
|
||||
|
||||
+14
-4
@@ -510,7 +510,7 @@ void menuGeneralSdManager(uint8_t event)
|
||||
|
||||
switch(event) {
|
||||
case EVT_ENTRY:
|
||||
f_chdir("/");
|
||||
f_chdir(ROOT_PATH);
|
||||
reusableBuffer.sd.offset = 65535;
|
||||
break;
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
@@ -551,8 +551,12 @@ void menuGeneralSdManager(uint8_t event)
|
||||
else {
|
||||
#if defined(PCBSKY9X)
|
||||
uint8_t index = m_posVert-1-s_pgOfs;
|
||||
char * line = reusableBuffer.sd.lines[index];
|
||||
if (!strcmp(line+strlen(line)-4, SOUNDS_EXT)) {
|
||||
char * ext = reusableBuffer.sd.lines[index];
|
||||
ext += strlen(ext) - 4;
|
||||
/* TODO if (!strcmp(ext, MODELS_EXT)) {
|
||||
s_menu[s_menu_count++] = STR_LOAD_FILE;
|
||||
}
|
||||
else */ if (!strcmp(ext, SOUNDS_EXT)) {
|
||||
s_menu[s_menu_count++] = STR_PLAY_FILE;
|
||||
}
|
||||
#endif
|
||||
@@ -690,7 +694,13 @@ void menuGeneralSdManager(uint8_t event)
|
||||
reusableBuffer.sd.offset = s_pgOfs-1;
|
||||
}
|
||||
#if defined(PCBSKY9X)
|
||||
else if (result == STR_PLAY_FILE) {
|
||||
/* TODO else if (result == STR_LOAD_FILE) {
|
||||
f_getcwd(lfn, SD_SCREEN_FILE_LENGTH);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sd.lines[index]);
|
||||
s_warning = eeLoadModelSD(lfn);
|
||||
}
|
||||
else */ if (result == STR_PLAY_FILE) {
|
||||
f_getcwd(lfn, SD_SCREEN_FILE_LENGTH);
|
||||
strcat(lfn, "/");
|
||||
strcat(lfn, reusableBuffer.sd.lines[index]);
|
||||
|
||||
@@ -463,6 +463,15 @@ void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat, u
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_invert_line(int8_t y)
|
||||
{
|
||||
uint8_t *p = &displayBuf[y * DISPLAY_W];
|
||||
for (xcoord_t x=0; x<DISPLAY_W; x++) {
|
||||
ASSERT_IN_DISPLAY(p);
|
||||
*p++ ^= 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
void putsTime(xcoord_t x, uint8_t y, putstime_t tme, uint8_t att, uint8_t att2)
|
||||
{
|
||||
div_t qr;
|
||||
|
||||
@@ -168,7 +168,8 @@ extern void lcd_vlineStip(xcoord_t x, int8_t y, int8_t h, uint8_t pat, uint8_t a
|
||||
|
||||
extern void lcd_rect(xcoord_t x, uint8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, uint8_t att=0);
|
||||
extern void lcd_filled_rect(xcoord_t x, int8_t y, xcoord_t w, uint8_t h, uint8_t pat=SOLID, uint8_t att=0);
|
||||
#define lcd_status_line() lcd_filled_rect(0, 7*FH, DISPLAY_W, 8)
|
||||
extern void lcd_invert_line(int8_t y);
|
||||
#define lcd_status_line() lcd_invert_line(7)
|
||||
inline void lcd_square(xcoord_t x, uint8_t y, xcoord_t w, uint8_t att=0) { lcd_rect(x, y, w, w, SOLID, att); }
|
||||
|
||||
#define DO_CROSS(xx,yy,ww) \
|
||||
|
||||
+33
-30
@@ -247,12 +247,14 @@ 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)
|
||||
{
|
||||
int8_t maxcol = MAXCOL(m_posVert);
|
||||
maxrow_t l_posVert = m_posVert;
|
||||
|
||||
int8_t maxcol = MAXCOL(l_posVert);
|
||||
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
if (!(s_warning || s_menu_count))
|
||||
check_rotary_encoder();
|
||||
if (m_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(BTN_REb) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||
if (l_posVert < 0 && (event==EVT_KEY_FIRST(BTN_REa) || event==EVT_KEY_FIRST(BTN_REb) || event==EVT_KEY_FIRST(KEY_MENU))) {
|
||||
popMenu();
|
||||
killEvents(event);
|
||||
return false;
|
||||
@@ -269,7 +271,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
else {
|
||||
scrollRE = 0;
|
||||
if (s_editMode++ > 0) s_editMode = 0;
|
||||
if (s_editMode > 0 && m_posVert == 0 && menuTab) s_editMode = -1;
|
||||
if (s_editMode > 0 && l_posVert == 0 && menuTab) s_editMode = -1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -306,7 +308,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
if (menuTab) {
|
||||
uint8_t attr = 0;
|
||||
|
||||
if (m_posVert==0 && !s_noScroll) {
|
||||
if (l_posVert==0 && !s_noScroll) {
|
||||
attr = INVERS;
|
||||
|
||||
int8_t cc = curr;
|
||||
@@ -351,7 +353,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
#endif
|
||||
}
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
else if (m_posVert < 0) {
|
||||
else if (l_posVert < 0) {
|
||||
lcd_putsAtt(DISPLAY_W-LEN_BACK*FW, 0, STR_BACK, INVERS);
|
||||
}
|
||||
#endif
|
||||
@@ -360,12 +362,12 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
|
||||
if (s_editMode<=0) {
|
||||
if (scrollUD) {
|
||||
m_posVert = limit((int8_t)0, (int8_t)(m_posVert - scrollUD), (int8_t)maxrow);
|
||||
m_posHorz = min(m_posHorz, MAXCOL(m_posVert));
|
||||
l_posVert = limit((int8_t)0, (int8_t)(l_posVert - scrollUD), (int8_t)maxrow);
|
||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
||||
BLINK_SYNC;
|
||||
}
|
||||
|
||||
if (scrollLR && m_posVert>0) {
|
||||
if (scrollLR && l_posVert>0) {
|
||||
m_posHorz = limit((int8_t)0, (int8_t)(m_posHorz - scrollLR), (int8_t)maxcol);
|
||||
BLINK_SYNC;
|
||||
}
|
||||
@@ -374,14 +376,14 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
while (!s_editMode && scrollRE) {
|
||||
if (scrollRE > 0) {
|
||||
--scrollRE;
|
||||
maxcol = MAXCOL(m_posVert);
|
||||
maxcol = MAXCOL(l_posVert);
|
||||
if (maxcol & ZCHAR) maxcol = 0;
|
||||
if (++m_posHorz > maxcol) {
|
||||
if (m_posVert < maxrow) {
|
||||
++m_posVert;
|
||||
maxcol = MAXCOL(m_posVert);
|
||||
if (l_posVert < maxrow) {
|
||||
++l_posVert;
|
||||
maxcol = MAXCOL(l_posVert);
|
||||
if (maxcol & ZCHAR) maxcol = 0;
|
||||
if (maxcol < 0) m_posVert++;
|
||||
if (maxcol < 0) l_posVert++;
|
||||
m_posHorz = 0;
|
||||
}
|
||||
else {
|
||||
@@ -393,15 +395,15 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
else {
|
||||
++scrollRE;
|
||||
if (m_posHorz-- == 0) {
|
||||
if (m_posVert-- <= 0) {
|
||||
m_posVert = menuTab ? 0 : -1;
|
||||
if (l_posVert-- <= 0) {
|
||||
l_posVert = menuTab ? 0 : -1;
|
||||
m_posHorz = 0;
|
||||
scrollRE = 0;
|
||||
}
|
||||
else {
|
||||
maxcol = MAXCOL(m_posVert);
|
||||
maxcol = MAXCOL(l_posVert);
|
||||
if (maxcol & ZCHAR) maxcol = 0;
|
||||
if (maxcol < 0) { --m_posVert; maxcol = MAXCOL(m_posVert); if (maxcol & ZCHAR) maxcol = 0; }
|
||||
if (maxcol < 0) { --l_posVert; maxcol = MAXCOL(l_posVert); if (maxcol & ZCHAR) maxcol = 0; }
|
||||
m_posHorz = maxcol;
|
||||
}
|
||||
}
|
||||
@@ -431,7 +433,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
break;
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_MENU):
|
||||
if (!menuTab || m_posVert>0)
|
||||
if (!menuTab || l_posVert>0)
|
||||
s_editMode = (s_editMode<=0);
|
||||
break;
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
@@ -443,7 +445,7 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
s_editMode = 0;
|
||||
break;
|
||||
}
|
||||
if (m_posVert==0 || !menuTab) {
|
||||
if (l_posVert==0 || !menuTab) {
|
||||
popMenu(); // beeps itself
|
||||
return false;
|
||||
}
|
||||
@@ -470,36 +472,37 @@ bool check(uint8_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTa
|
||||
BLINK_SYNC;
|
||||
break;
|
||||
case EVT_KEY_REPT(KEY_DOWN): //inc
|
||||
if (m_posVert==maxrow) break;
|
||||
if (l_posVert==maxrow) break;
|
||||
// no break
|
||||
case EVT_KEY_FIRST(KEY_DOWN): //inc
|
||||
if (s_editMode>0) break;
|
||||
do {
|
||||
INC(m_posVert, maxrow);
|
||||
} while(MAXCOL(m_posVert) == (uint8_t)-1);
|
||||
INC(l_posVert, maxrow);
|
||||
} while(MAXCOL(l_posVert) == (uint8_t)-1);
|
||||
#if defined(ROTARY_ENCODERS)
|
||||
s_editMode = 0;
|
||||
#endif
|
||||
m_posHorz = min(m_posHorz, MAXCOL(m_posVert));
|
||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
||||
BLINK_SYNC;
|
||||
break;
|
||||
case EVT_KEY_REPT(KEY_UP): //dec
|
||||
if (m_posVert==0) break;
|
||||
if (l_posVert==0) break;
|
||||
// no break
|
||||
case EVT_KEY_FIRST(KEY_UP): //dec
|
||||
if(s_editMode>0)break;
|
||||
do {
|
||||
DEC(m_posVert,maxrow);
|
||||
} while(MAXCOL(m_posVert) == (uint8_t)-1);
|
||||
m_posHorz = min(m_posHorz, MAXCOL(m_posVert));
|
||||
DEC(l_posVert,maxrow);
|
||||
} while(MAXCOL(l_posVert) == (uint8_t)-1);
|
||||
m_posHorz = min(m_posHorz, MAXCOL(l_posVert));
|
||||
BLINK_SYNC;
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t max = menuTab ? 7 : 6;
|
||||
if (m_posVert<1) s_pgOfs=0;
|
||||
else if (m_posVert-s_pgOfs>max) s_pgOfs = m_posVert-max;
|
||||
else if (m_posVert-s_pgOfs<1) s_pgOfs = m_posVert-1;
|
||||
if (l_posVert<1) s_pgOfs=0;
|
||||
else if (l_posVert-s_pgOfs>max) s_pgOfs = l_posVert-max;
|
||||
else if (l_posVert-s_pgOfs<1) s_pgOfs = l_posVert-1;
|
||||
m_posVert = l_posVert;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+5
-9
@@ -92,20 +92,18 @@ enum BeeperMode {
|
||||
};
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define EXTRA_SKY9X_FIELDS \
|
||||
uint8_t speakerVolume; \
|
||||
uint8_t backlightBright; \
|
||||
int8_t currentCalib
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
uint8_t speakerVolume; \
|
||||
uint8_t backlightBright; \
|
||||
int8_t currentCalib; \
|
||||
int8_t temperatureWarn; \
|
||||
uint8_t mAhWarn; \
|
||||
uint16_t mAhUsed; \
|
||||
uint32_t globalTimer; \
|
||||
int8_t temperatureCalib; \
|
||||
uint8_t btBaudrate; \
|
||||
uint8_t optrexDisplay
|
||||
uint8_t optrexDisplay;
|
||||
#else
|
||||
#define EXTRA_SKY9X_FIELDS
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
int8_t speakerVolume
|
||||
#endif
|
||||
@@ -139,7 +137,7 @@ PACK(typedef struct t_EEGeneral {
|
||||
int16_t calibSpanNeg[7];
|
||||
int16_t calibSpanPos[7];
|
||||
uint16_t chkSum;
|
||||
uint8_t currModel; //0..15
|
||||
int8_t currModel;
|
||||
uint8_t contrast;
|
||||
uint8_t vBatWarn;
|
||||
int8_t vBatCalib;
|
||||
@@ -172,8 +170,6 @@ PACK(typedef struct t_EEGeneral {
|
||||
uint8_t unexpectedShutdown:1;
|
||||
uint8_t speakerPitch;
|
||||
|
||||
EXTRA_SKY9X_FIELDS;
|
||||
|
||||
EXTRA_GENERAL_FIELDS;
|
||||
|
||||
}) EEGeneral;
|
||||
|
||||
@@ -37,11 +37,13 @@
|
||||
#include "FatFs/ff.h"
|
||||
|
||||
#ifdef SIMU
|
||||
#define ROOT_PATH "."
|
||||
#define MODELS_PATH "."
|
||||
#define LOGS_PATH "."
|
||||
#define SOUNDS_PATH "."
|
||||
#define SYSTEM_SOUNDS_PATH "."
|
||||
#else
|
||||
#define ROOT_PATH "/"
|
||||
#define MODELS_PATH "/9XMODELS"
|
||||
#define LOGS_PATH "/9XLOGS" // no trailing slash = important
|
||||
#define SOUNDS_PATH "/9XSOUNDS" // no trailing slash = important
|
||||
|
||||
+7
-5
@@ -309,10 +309,12 @@ FRESULT f_mount (BYTE, FATFS*)
|
||||
|
||||
FRESULT f_open (FIL * fil, const TCHAR *name, BYTE flag)
|
||||
{
|
||||
struct stat tmp;
|
||||
if (stat(name, &tmp))
|
||||
return FR_INVALID_NAME;
|
||||
fil->fsize = tmp.st_size;
|
||||
if (!(flag & FA_WRITE)) {
|
||||
struct stat tmp;
|
||||
if (stat(name, &tmp))
|
||||
return FR_INVALID_NAME;
|
||||
fil->fsize = tmp.st_size;
|
||||
}
|
||||
fil->fs = (FATFS*)fopen(name, (flag & FA_WRITE) ? "w+" : "r+");
|
||||
return FR_OK;
|
||||
}
|
||||
@@ -421,7 +423,7 @@ int f_printf (FIL *f, const TCHAR * format, ...)
|
||||
|
||||
FRESULT f_getcwd (TCHAR *path, UINT sz_path)
|
||||
{
|
||||
getcwd(path, sz_path);
|
||||
strcpy(path, ".");
|
||||
return FR_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user