fix(legacy): refactor oledInvertPixel

to not use static bool variable, but ifdef constant

[no changelog]
pull/2314/head
Pavol Rusnak 2 years ago committed by matejcik
parent 2663801108
commit 17963a2837

@ -43,6 +43,9 @@ CPUFLAGS ?= -mcpu=cortex-m3 -mthumb
FPUFLAGS ?= -msoft-float
endif
DEBUG_LINK ?= 0
DEBUG_LOG ?= 0
CFLAGS += $(OPTFLAGS) \
$(DBGFLAGS) \
$(SANFLAGS) \
@ -75,6 +78,8 @@ CFLAGS += $(OPTFLAGS) \
$(FPUFLAGS) \
$(CONFFLAG) \
-DSTM32F2 \
-DDEBUG_LINK=$(DEBUG_LINK) \
-DDEBUG_LOG=$(DEBUG_LOG) \
-I$(TOOLCHAIN_DIR)/include \
-I$(TOP_DIR) \
-I$(TOP_DIR)gen \

@ -153,13 +153,9 @@ OPTFLAGS ?= -Os
include ../Makefile.include
DEBUG_LINK ?= 0
DEBUG_LOG ?= 0
CFLAGS += -Wno-sequence-point
CFLAGS += -I../vendor/nanopb -Iprotob -DPB_FIELD_16BIT=1 -DPB_ENCODE_ARRAYS_UNPACKED=1 -DPB_VALIDATE_UTF8=1
CFLAGS += -DDEBUG_LINK=$(DEBUG_LINK)
CFLAGS += -DDEBUG_LOG=$(DEBUG_LOG)
CFLAGS += -DSCM_REVISION='"$(shell git rev-parse HEAD | sed 's:\(..\):\\x\1:g')"'
CFLAGS += -DUSE_MONERO=0
ifneq ($(BITCOIN_ONLY),1)

@ -165,7 +165,6 @@ int main(void) {
#endif
#if DEBUG_LINK
oledSetDebugLink(1);
#if !EMULATOR
config_wipe();
#endif

@ -65,7 +65,6 @@
*/
static uint8_t _oledbuffer[OLED_BUFSIZE];
static bool is_debug_link = 0;
/*
* macros to convert coordinate to bit position
@ -181,23 +180,23 @@ void oledInit() {
void oledClear() { memzero(_oledbuffer, sizeof(_oledbuffer)); }
void oledInvertDebugLink() {
if (is_debug_link) {
oledInvertPixel(OLED_WIDTH - 5, 0);
oledInvertPixel(OLED_WIDTH - 4, 0);
oledInvertPixel(OLED_WIDTH - 3, 0);
oledInvertPixel(OLED_WIDTH - 2, 0);
oledInvertPixel(OLED_WIDTH - 1, 0);
oledInvertPixel(OLED_WIDTH - 4, 1);
oledInvertPixel(OLED_WIDTH - 3, 1);
oledInvertPixel(OLED_WIDTH - 2, 1);
oledInvertPixel(OLED_WIDTH - 1, 1);
oledInvertPixel(OLED_WIDTH - 3, 2);
oledInvertPixel(OLED_WIDTH - 2, 2);
oledInvertPixel(OLED_WIDTH - 1, 2);
oledInvertPixel(OLED_WIDTH - 2, 3);
oledInvertPixel(OLED_WIDTH - 1, 3);
oledInvertPixel(OLED_WIDTH - 1, 4);
}
#if DEBUG_LINK
oledInvertPixel(OLED_WIDTH - 5, 0);
oledInvertPixel(OLED_WIDTH - 4, 0);
oledInvertPixel(OLED_WIDTH - 3, 0);
oledInvertPixel(OLED_WIDTH - 2, 0);
oledInvertPixel(OLED_WIDTH - 1, 0);
oledInvertPixel(OLED_WIDTH - 4, 1);
oledInvertPixel(OLED_WIDTH - 3, 1);
oledInvertPixel(OLED_WIDTH - 2, 1);
oledInvertPixel(OLED_WIDTH - 1, 1);
oledInvertPixel(OLED_WIDTH - 3, 2);
oledInvertPixel(OLED_WIDTH - 2, 2);
oledInvertPixel(OLED_WIDTH - 1, 2);
oledInvertPixel(OLED_WIDTH - 2, 3);
oledInvertPixel(OLED_WIDTH - 1, 3);
oledInvertPixel(OLED_WIDTH - 1, 4);
#endif
}
/*
@ -232,11 +231,6 @@ void oledRefresh() {
const uint8_t *oledGetBuffer() { return _oledbuffer; }
void oledSetDebugLink(bool set) {
is_debug_link = set;
oledRefresh();
}
void oledSetBuffer(uint8_t *buf) {
memcpy(_oledbuffer, buf, sizeof(_oledbuffer));
}

@ -34,7 +34,6 @@ void oledInit(void);
void oledClear(void);
void oledRefresh(void);
void oledSetDebugLink(bool set);
void oledInvertDebugLink(void);
void oledSetBuffer(uint8_t *buf);

Loading…
Cancel
Save