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 FPUFLAGS ?= -msoft-float
endif endif
DEBUG_LINK ?= 0
DEBUG_LOG ?= 0
CFLAGS += $(OPTFLAGS) \ CFLAGS += $(OPTFLAGS) \
$(DBGFLAGS) \ $(DBGFLAGS) \
$(SANFLAGS) \ $(SANFLAGS) \
@ -75,6 +78,8 @@ CFLAGS += $(OPTFLAGS) \
$(FPUFLAGS) \ $(FPUFLAGS) \
$(CONFFLAG) \ $(CONFFLAG) \
-DSTM32F2 \ -DSTM32F2 \
-DDEBUG_LINK=$(DEBUG_LINK) \
-DDEBUG_LOG=$(DEBUG_LOG) \
-I$(TOOLCHAIN_DIR)/include \ -I$(TOOLCHAIN_DIR)/include \
-I$(TOP_DIR) \ -I$(TOP_DIR) \
-I$(TOP_DIR)gen \ -I$(TOP_DIR)gen \

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

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

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

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

Loading…
Cancel
Save