From cdd93df117dc1fb1af84a1e29bc48fa46ac0f63c Mon Sep 17 00:00:00 2001 From: Jelmer Date: Thu, 2 Feb 2023 00:49:49 +0100 Subject: [PATCH] fixed offset... (finally) --- tag_fw/drawing.c | 10 ++++++++-- tag_fw/main.c | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tag_fw/drawing.c b/tag_fw/drawing.c index 641199a1..e752395a 100644 --- a/tag_fw/drawing.c +++ b/tag_fw/drawing.c @@ -1,8 +1,10 @@ +#include "drawing.h" + #include + #include "asmUtil.h" #include "board.h" #include "cpu.h" -#include "drawing.h" #include "eeprom.h" #include "epd.h" #include "printf.h" @@ -318,9 +320,9 @@ static void drawPrvDecodeImageOnce(void) { } } +static uint8_t __xdata prev, step = 0; void ByteDecode(uint8_t byte) { - static uint8_t __xdata prev, step = 0; prev <<= 2; prev |= (mColorMap[mPassNo][byte >> 4] << 1) | mColorMap[mPassNo][byte & 0x0f]; if (++step == 4) { @@ -344,11 +346,15 @@ void drawImageAtAddress(uint32_t addr) { mPassNo = 0; beginFullscreenImage(); beginWriteFramebuffer(EPD_COLOR_BLACK); + prev = 0; + step = 0; drawPrvDecodeImageOnce(); endWriteFramebuffer(); mPassNo++; beginFullscreenImage(); beginWriteFramebuffer(EPD_COLOR_RED); + prev = 0; + step = 0; drawPrvDecodeImageOnce(); endWriteFramebuffer(); diff --git a/tag_fw/main.c b/tag_fw/main.c index d85410d7..920d94d6 100644 --- a/tag_fw/main.c +++ b/tag_fw/main.c @@ -18,6 +18,8 @@ #include "userinterface.h" #include "wdt.h" +//#define DEBUG_MODE + uint8_t showChannelSelect() { uint8_t __xdata result[16]; memset(result, 0, sizeof(result)); @@ -79,7 +81,7 @@ void mainProtocolLoop(void) { eepromDeepPowerDown(); // initialize Powers-saving-attempt-array with the default value; initPowerSaving(); - +#ifndef DEBUG_MODE // show the splashscreen showSplashScreen(); @@ -91,10 +93,15 @@ void mainProtocolLoop(void) { // couldn't find an AP :() showNoAP(); } else { + radioSetChannel(currentChannel); // Found an AP. showAPFound(); } - +#endif +#ifdef DEBUG_MODE + initRadio(); + currentChannel = 11; +#endif epdEnterSleep(); P1CHSTA &= ~(1 << 0);