From 85f7a85f98a8e090c078d87d6c9082e4bd5c42f1 Mon Sep 17 00:00:00 2001 From: bsongis Date: Sun, 1 Jul 2012 20:42:04 +0000 Subject: [PATCH] BOLD = YES / NO option Because this option costs around 400bytes --- src/Makefile | 7 ++++++- src/lcd.cpp | 2 ++ src/lcd.h | 4 ++++ src/open9x.cpp | 15 +++++++++++++++ src/open9x.h | 8 ++++++-- 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 353a6c79b..b88bd8804 100644 --- a/src/Makefile +++ b/src/Makefile @@ -62,8 +62,9 @@ HAPTIC = NO # SPLASH on START SPLASH = YES -# GRAPHICS (sliders / checkboxes) +# GRAPHICS (sliders / checkboxes / bold) GRAPHICS = YES +BOLD = YES # THR trace (in STATS screen) THR_TRACE = YES @@ -257,6 +258,10 @@ ifeq ($(GRAPHICS), YES) CPPDEFS += -DGRAPHICS endif +ifeq ($(BOLD), YES) + CPPDEFS += -DBOLD_FONT +endif + ifeq ($(THR_TRACE), YES) CPPDEFS += -DTHRTRACE endif diff --git a/src/lcd.cpp b/src/lcd.cpp index 98db03c6d..d45fc3dce 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -135,6 +135,7 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) if (p> (8-ym8)))) + (b >> (8-ym8)); } +#ifdef BOLD_FONT if (mode & BOLD) { if (inv) *(p+1) &= (b << ym8); @@ -142,6 +143,7 @@ void lcd_putcAtt(uint8_t x, uint8_t y, const unsigned char c, uint8_t mode) *(p+1) |= (b << ym8); } +#endif } p--; } diff --git a/src/lcd.h b/src/lcd.h index 567b099c4..923cffe6a 100644 --- a/src/lcd.h +++ b/src/lcd.h @@ -46,7 +46,11 @@ /* lcd text flags */ #define INVERS 0x02 #define DBLSIZE 0x04 +#ifdef BOLD_FONT #define BOLD 0x40 +#else +#define BOLD 0x00 +#endif /* lcd putc flags */ #define CONDENSED 0x08 diff --git a/src/open9x.cpp b/src/open9x.cpp index 20a21af52..708cb692a 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -354,7 +354,9 @@ int16_t Expo::expo(int16_t x) } #endif +#ifdef BOLD_FONT ACTIVE_EXPOS_TYPE activeExpos; +#endif void applyExpos(int16_t *anas) { @@ -363,7 +365,10 @@ void applyExpos(int16_t *anas) uint8_t phase = s_perout_flight_phase + 1; int8_t cur_chn = -1; + +#ifdef BOLD_FONT activeExpos = 0; +#endif for (uint8_t i=0; i=0 && ed.mode&2)) { cur_chn = ed.chn; @@ -1908,7 +1915,9 @@ void perOut(uint8_t tick10ms) } } +#ifdef BOLD_FONT activeMixes |= ((ACTIVE_MIXES_TYPE)1 << i); +#endif //========== OFFSET =============== if (apply_offset && md->sOffset) v += calc100toRESX(md->sOffset); @@ -1971,8 +1980,10 @@ void perOut(uint8_t tick10ms) switch(md->mltpx){ case MLTPX_REP: *ptr = dv; +#ifdef BOLD_FONT for (uint8_t m=i-1; m>=0 && mixaddress(m)->destCh == md->destCh; m--) activeMixes &= ~((ACTIVE_MIXES_TYPE)1 << m); +#endif break; case MLTPX_MUL: dv /= 100; @@ -1999,11 +2010,15 @@ char userDataDisplayBuf[TELEM_SCREEN_BUFFER_SIZE]; #define TIME_TO_WRITE s_eeDirtyMsk #endif +#ifdef BOLD_FONT ACTIVE_MIXES_TYPE activeMixes; +#endif int32_t sum_chans512[NUM_CHNOUT] = {0}; inline void doMixerCalculations(uint16_t tmr10ms, uint8_t tick10ms) { +#ifdef BOLD_FONT activeMixes = 0; +#endif if (g_eeGeneral.filterInput == 1) { getADC_filt() ; diff --git a/src/open9x.h b/src/open9x.h index 6f28286bf..b0080480b 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -796,10 +796,9 @@ extern void moveTrimsToOffsets(); #define ACTIVE_MIXES_TYPE uint32_t #endif +#ifdef BOLD_FONT extern ACTIVE_EXPOS_TYPE activeExpos; extern ACTIVE_MIXES_TYPE activeMixes; -extern uint16_t activeFunctions; - inline bool isExpoActive(uint8_t expo) { return activeExpos & ((ACTIVE_EXPOS_TYPE)1 << expo); @@ -809,7 +808,12 @@ inline bool isMixActive(uint8_t mix) { return activeMixes & ((ACTIVE_MIXES_TYPE)1 << mix); } +#else +#define isExpoActive(x) false +#define isMixActive(x) false +#endif +extern uint16_t activeFunctions; inline bool isFunctionActive(uint8_t func) { return activeFunctions & (1 << (func-FUNC_TRAINER));