diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp index 7feac362..8ddfec1a 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/hal/Newton_M3_nRF52811/tagtype_db.cpp @@ -38,6 +38,7 @@ void identifyTagInfo() { AD BA FE CA 15 0A 1B 04 00 19 01 A0 02 C0 03 38 07 07 01 80 00 00 64 FF FF FF FF FF FF FF FF FF 9.7 type 2 92 C3 80 05 15 08 19 04 00 12 01 18 03 10 01 04 07 07 01 80 00 00 63 FF FF FF FF FF FF FF FF FF 5.85 BWR 22 F0 BF 05 15 0A 14 04 00 12 00 18 03 10 01 04 07 07 01 80 00 00 24 FF FF FF FF FF FF FF FF FF 5.85 BW + 99 78 B1 05 15 0A 06 04 00 0D 01 68 01 B8 00 38 07 07 01 80 00 00 43 FF FF FF FF FF FF FF FF FF 2.6" @@ -153,6 +154,12 @@ void identifyTagInfo() { tag.OEPLtype = SOLUM_M3_BWR_22; epd->XOffset = 8; break; + case STYPE_SIZE_026: + tag.macSuffix = 0xB3D0; + epd->drawDirectionRight = true; + tag.OEPLtype = SOLUM_M3_BWR_22; + epd->XOffset = 8; + break; case STYPE_SIZE_029: tag.OEPLtype = SOLUM_M3_BWR_29; if (tag.buttonCount == 2) { diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp index b22f7cb5..97609d2a 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/src/epd_driver/dualssd.cpp @@ -212,11 +212,7 @@ void dualssd::draw() { } void dualssd::drawNoWait() { epdWriteDisplayData(); - if(tag.hasThirdColor){ - epdWrite(CMD_DISP_UPDATE_CTRL2, 1, 0xF7); - }else{ - //epdWrite(CMD_DISP_UPDATE_CTRL2, 1, 0xF7); - } + epdWrite(CMD_DISP_UPDATE_CTRL2, 1, 0xF7); epdWrite(CMD_ACTIVATION, 0); } void dualssd::epdWaitRdy() { diff --git a/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp b/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp index a94e841b..a61023eb 100644 --- a/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp +++ b/ARM_Tag_FW/Newton_M3_nRF52811/src/userinterface.cpp @@ -26,12 +26,35 @@ bool lowBatteryShown = false; bool noAPShown = false; void addOverlay() { - if (currentChannel == 0) { + /*if (currentChannel == 0) { drawMask(epd->Xres - 27, 5, 22, 22, COLOR_BLACK); - drawMask(epd->Xres - 27, 5, 22, 22, COLOR_RED); - drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_RED); - addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); - addBufferedImage(epd->Xres - 16, 15, COLOR_RED, rotation::ROTATE_0, cross, DRAW_NORMAL); + if(tag.hasThirdColor){ + drawMask(epd->Xres - 27, 5, 22, 22, COLOR_RED); + drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_RED); + addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); + addBufferedImage(epd->Xres - 16, 15, COLOR_RED, rotation::ROTATE_0, cross, DRAW_NORMAL); + }else{ + drawMask(epd->Xres - 27, 5, 22, 22, COLOR_BLACK); + drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_BLACK); + addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); + addBufferedImage(epd->Xres - 16, 15, COLOR_BLACK, rotation::ROTATE_0, cross, DRAW_NORMAL); + } + noAPShown = true; + } else { + noAPShown = false; + }*/ + if (currentChannel == 0) { + drawMask(epd->Xres - 28, 4, 24, 24, COLOR_BLACK); + if(tag.hasThirdColor){ + drawMask(epd->Xres - 28, 4, 24, 24, COLOR_RED); + drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_RED); + addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); + addBufferedImage(epd->Xres - 16, 15, COLOR_RED, rotation::ROTATE_0, cross, DRAW_NORMAL); + }else{ + drawRoundedRectangle(epd->Xres - 28, 4, 24, 24, COLOR_BLACK); + addBufferedImage(epd->Xres - 24, 8, COLOR_BLACK, rotation::ROTATE_0, ant, DRAW_NORMAL); + addBufferedImage(epd->Xres - 16, 15, COLOR_BLACK, rotation::ROTATE_0, cross, DRAW_NORMAL); + } noAPShown = true; } else { noAPShown = false; @@ -39,8 +62,13 @@ void addOverlay() { if (lowBattery) { drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_BLACK); - drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_RED); - drawRoundedRectangle(epd->Xres - 28, epd->Yres - 26, 24, 24, COLOR_RED); + if(tag.hasThirdColor){ + drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_RED); + drawRoundedRectangle(epd->Xres - 28, epd->Yres - 26, 24, 24, COLOR_RED); + }else{ + drawMask(epd->Xres - 27, epd->Yres - 26, 22, 22, COLOR_BLACK); + drawRoundedRectangle(epd->Xres - 28, epd->Yres - 26, 24, 24, COLOR_BLACK); + } addBufferedImage(epd->Xres - 24, epd->Yres - 19, COLOR_BLACK, rotation::ROTATE_0, battery, DRAW_NORMAL); lowBatteryShown = true; } else { @@ -48,10 +76,16 @@ void addOverlay() { } #ifdef DEBUG_BUILD fontrender fr(&FreeSansBold18pt7b); - drawMask(15, epd->Yres - 53, 129, 33, COLOR_BLACK); - drawMask(15, epd->Yres - 53, 129, 33, COLOR_RED); - drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); - fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG"); + drawMask(15, epd->Yres - 53, 130, 33, COLOR_BLACK); + if(tag.hasThirdColor){ + drawMask(15, epd->Yres - 53, 140, 35, COLOR_RED); + drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); + fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG"); + }else{ + drawMask(15, epd->Yres - 53, 130, 33, COLOR_BLACK); + drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_BLACK); + fr.epdPrintf(17, epd->Yres - 50, COLOR_BLACK, rotation::ROTATE_0, "DEBUG"); + } #endif } @@ -81,6 +115,16 @@ void showSplashScreen() { fr.epdPrintf(5, epd->Yres - 20, 0, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); break; + case STYPE_SIZE_026: + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(2, 2, COLOR_BLACK, rotation::ROTATE_0, "OpenEPaperLink"); + fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(10, 38, COLOR_RED, rotation::ROTATE_0, "Newton M3 2.6\""); + // fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(5, epd->Yres - 40, 0, rotation::ROTATE_0, "FW: %04X-%s", fwVersion, fwVersionSuffix); + fr.epdPrintf(5, epd->Yres - 20, 0, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + break; case STYPE_SIZE_029: fr.setFont(&FreeSansBold18pt7b); fr.epdPrintf(2, 2, COLOR_BLACK, rotation::ROTATE_0, "OpenEPaperLink"); @@ -167,10 +211,17 @@ void showSplashScreen() { } #ifdef DEBUGBLOCKS drawMask(15, epd->Yres - 53, 129, 33, COLOR_BLACK); - drawMask(15, epd->Yres - 53, 129, 33, COLOR_RED); - drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); - fr.setFont(&FreeSansBold18pt7b); - fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG"); + if(tag.hasThirdColor){ + drawMask(15, epd->Yres - 53, 129, 33, COLOR_RED); + drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_RED); + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(17, epd->Yres - 50, COLOR_RED, rotation::ROTATE_0, "DEBUG"); + }else{ + drawMask(15, epd->Yres - 53, 129, 33, COLOR_BLACK); + drawRoundedRectangle(15, epd->Yres - 53, 129, 33, COLOR_BLACK); + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(17, epd->Yres - 50, COLOR_BLACK, rotation::ROTATE_0, "DEBUG"); + } #endif draw(); } @@ -218,6 +269,18 @@ void showAPFound() { fr.epdPrintf(10, epd->Yres - 25, 0, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); addQR(epd->Xres - 66, 47, 3, 2, "https://openepaperlink.eu/tag/1/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); break; + case STYPE_SIZE_026: + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "AP Found"); + fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(10, 53, COLOR_RED, rotation::ROTATE_0, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", APmac[7], APmac[6], APmac[5], APmac[4], APmac[3], APmac[2], APmac[1], APmac[0]); + fr.epdPrintf(10, 71, COLOR_RED, rotation::ROTATE_0, "RSSI: %ddBm LQI: %d", mLastRSSI, mLastLqi); + fr.epdPrintf(10, 89, COLOR_RED, rotation::ROTATE_0, "Ch %d", currentChannel); + fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(10, epd->Yres - 43, 0, rotation::ROTATE_0, "Battery: %d.%dV Temp: %d'C", batteryVoltage / 1000, batteryVoltage % 1000, temperature); + fr.epdPrintf(10, epd->Yres - 25, 0, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + addQR(epd->Xres - 66, 47, 3, 2, "https://openepaperlink.eu/tag/1/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + break; case STYPE_SIZE_029: fr.setFont(&FreeSansBold18pt7b); fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "AP Found"); @@ -267,6 +330,18 @@ void showAPFound() { fr.epdPrintf(10, epd->Yres - 25, 0, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); break; + case STYPE_SIZE_058_FREEZER: + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "AP Found"); + fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(10, 53, COLOR_BLACK, rotation::ROTATE_0, "%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", APmac[7], APmac[6], APmac[5], APmac[4], APmac[3], APmac[2], APmac[1], APmac[0]); + fr.epdPrintf(10, 71, COLOR_BLACK, rotation::ROTATE_0, "RSSI: %ddBm LQI: %d", mLastRSSI, mLastLqi); + fr.epdPrintf(10, 89, COLOR_BLACK, rotation::ROTATE_0, "Ch %d", currentChannel); + fr.setFont(&FreeSans9pt7b); + fr.epdPrintf(10, epd->Yres - 43, COLOR_BLACK, rotation::ROTATE_0, "Battery: %d.%dV Temp: %d'C", batteryVoltage / 1000, batteryVoltage % 1000, temperature); + fr.epdPrintf(10, epd->Yres - 25, COLOR_BLACK, rotation::ROTATE_0, "MAC: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X", mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + break; case STYPE_SIZE_060: fr.setFont(&FreeSansBold18pt7b); fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "AP Found - Waiting for data"); @@ -328,6 +403,16 @@ void showNoAP() { fr.epdPrintf(10, 89, COLOR_BLACK, rotation::ROTATE_0, "I'll try again in a little while, but you"); fr.epdPrintf(10, 109, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by pressing a button"); break; + case STYPE_SIZE_026: + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "No AP Found"); + fr.setFont(&FreeSans9pt7b); + addQR(epd->Xres - 66, 47, 3, 2, "https://openepaperlink.eu/tag/1/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + fr.epdPrintf(10, 69, COLOR_BLACK, rotation::ROTATE_0, "Couldn't find an AP :("); + fr.epdPrintf(10, 89, COLOR_BLACK, rotation::ROTATE_0, "I'll try again in a little while, but you"); + fr.epdPrintf(10, 109, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by scanning"); + fr.epdPrintf(10, 129, COLOR_BLACK, rotation::ROTATE_0, "the NFC-wake area with your phone"); + break; case STYPE_SIZE_029: fr.setFont(&FreeSansBold18pt7b); fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "No AP Found"); @@ -367,7 +452,18 @@ void showNoAP() { addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); fr.epdPrintf(10, 69, COLOR_BLACK, rotation::ROTATE_0, "Couldn't find an AP :("); fr.epdPrintf(10, 89, COLOR_BLACK, rotation::ROTATE_0, "I'll try again in a little while, but you"); - fr.epdPrintf(10, 109, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by pressing a button"); + fr.epdPrintf(152, 109, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by scanning"); + fr.epdPrintf(152, 129, COLOR_BLACK, rotation::ROTATE_0, "the NFC-wake area with your phone"); + break; + case STYPE_SIZE_058_FREEZER: + fr.setFont(&FreeSansBold18pt7b); + fr.epdPrintf(7, 7, COLOR_BLACK, rotation::ROTATE_0, "No AP Found"); + fr.setFont(&FreeSans9pt7b); + addQR(epd->Xres - 120, 42, 3, 3, "https://openepaperlink.eu/tag/0/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); + fr.epdPrintf(10, 69, COLOR_BLACK, rotation::ROTATE_0, "Couldn't find an AP :("); + fr.epdPrintf(10, 89, COLOR_BLACK, rotation::ROTATE_0, "I'll try again in a little while, but you"); + fr.epdPrintf(152, 109, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by scanning"); + fr.epdPrintf(152, 129, COLOR_BLACK, rotation::ROTATE_0, "the NFC-wake area with your phone"); break; case STYPE_SIZE_060: fr.setFont(&FreeSansBold18pt7b); @@ -398,7 +494,8 @@ void showNoAP() { addQR(epd->Xres - 66, 47, 3, 2, "https://openepaperlink.eu/tag/1/%02X/%02X%02X%02X%02X%02X%02X%02X%02X/", tag.OEPLtype, mSelfMac[7], mSelfMac[6], mSelfMac[5], mSelfMac[4], mSelfMac[3], mSelfMac[2], mSelfMac[1], mSelfMac[0]); fr.epdPrintf(10, 39, COLOR_BLACK, rotation::ROTATE_0, "Couldn't find an AP :("); fr.epdPrintf(10, 58, COLOR_BLACK, rotation::ROTATE_0, "I'll try again in a little while, but you"); - fr.epdPrintf(10, 77, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by pressing a button"); + fr.epdPrintf(10, 77, COLOR_BLACK, rotation::ROTATE_0, "can force a retry now by scanning"); + fr.epdPrintf(10, 98, COLOR_BLACK, rotation::ROTATE_0, "the NFC-wake area with your phone"); addFlashImage(200, 128, COLOR_BLACK, rotation::ROTATE_0, pandablack); addFlashImage(312, 274, COLOR_RED, rotation::ROTATE_0, pandared); break; diff --git a/ARM_Tag_FW/common/drawing.cpp b/ARM_Tag_FW/common/drawing.cpp index c772489b..4e3150f5 100644 --- a/ARM_Tag_FW/common/drawing.cpp +++ b/ARM_Tag_FW/common/drawing.cpp @@ -294,17 +294,19 @@ void drawImageAtAddress(uint32_t addr, uint8_t lut) { void drawRoundedRectangle(uint16_t xpos, uint16_t ypos, uint16_t width, uint16_t height, bool color) { uint16_t widthBytes = width / 8; if (width % 8) widthBytes++; - uint32_t framebufferSize = (widthBytes + 1) * height; + uint32_t framebufferSize = widthBytes * height; uint8_t *framebuffer = (uint8_t *)calloc(framebufferSize + 4, 1); if (framebuffer == NULL) { return; } - - ((uint16_t *)framebuffer)[0] = width + 1; + uint8_t frameBufferZerosize = width; + if((width % 8) != 0){ + frameBufferZerosize++; + } + ((uint16_t *)framebuffer)[0] = frameBufferZerosize; ((uint16_t *)framebuffer)[1] = height; framebuffer += 4; - uint16_t w = width - 1; uint16_t x = 1; while (w--) {