From 8857ecb66900f7e8dbb5383ae1061c26751b6228 Mon Sep 17 00:00:00 2001 From: Nic Limper Date: Sun, 8 Dec 2024 15:32:03 +0100 Subject: [PATCH] DATATYPE_IMG_G5 --- ESP32_AP-Flasher/src/contentmanager.cpp | 18 ++++-------------- ESP32_AP-Flasher/src/newproto.cpp | 7 +++---- oepl-definitions.h | 3 +-- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ESP32_AP-Flasher/src/contentmanager.cpp b/ESP32_AP-Flasher/src/contentmanager.cpp index 1aa1f8a8..03cba582 100644 --- a/ESP32_AP-Flasher/src/contentmanager.cpp +++ b/ESP32_AP-Flasher/src/contentmanager.cpp @@ -289,13 +289,8 @@ void drawNew(const uint8_t mac[8], tagRecord *&taginfo) { imageParams.dataType = DATATYPE_IMG_ZLIB; Serial.println("datatype: DATATYPE_IMG_ZLIB"); } else if (imageParams.g5) { - if (imageParams.hasRed) { - imageParams.dataType = DATATYPE_IMG_G5_2BPP; - Serial.println("datatype: DATATYPE_IMG_G5_2BPP"); - } else { - imageParams.dataType = DATATYPE_IMG_G5_1BPP; - Serial.println("datatype: DATATYPE_IMG_G5_1BPP"); - } + imageParams.dataType = DATATYPE_IMG_G5; + Serial.println("datatype: DATATYPE_IMG_G5"); } else if (imageParams.hasRed) { imageParams.dataType = DATATYPE_IMG_RAW_2BPP; Serial.println("datatype: DATATYPE_IMG_RAW_2BPP"); @@ -580,13 +575,8 @@ bool updateTagImage(String &filename, const uint8_t *dst, uint16_t nextCheckin, imageParams.dataType = DATATYPE_IMG_ZLIB; Serial.println("datatype: DATATYPE_IMG_ZLIB"); } else if (imageParams.g5) { - if (imageParams.hasRed) { - imageParams.dataType = DATATYPE_IMG_G5_2BPP; - Serial.println("datatype: DATATYPE_IMG_G5_2BPP"); - } else { - imageParams.dataType = DATATYPE_IMG_G5_1BPP; - Serial.println("datatype: DATATYPE_IMG_G5_1BPP"); - } + imageParams.dataType = DATATYPE_IMG_G5; + Serial.println("datatype: DATATYPE_IMG_G5"); } else if (imageParams.hasRed) { imageParams.dataType = DATATYPE_IMG_RAW_2BPP; Serial.println("datatype: DATATYPE_IMG_RAW_2BPP"); diff --git a/ESP32_AP-Flasher/src/newproto.cpp b/ESP32_AP-Flasher/src/newproto.cpp index b49f9901..ffade1f4 100644 --- a/ESP32_AP-Flasher/src/newproto.cpp +++ b/ESP32_AP-Flasher/src/newproto.cpp @@ -274,8 +274,7 @@ void prepareExternalDataAvail(struct pendingData* pending, IPAddress remoteIP) { case DATATYPE_IMG_ZLIB: case DATATYPE_IMG_RAW_1BPP: case DATATYPE_IMG_RAW_2BPP: - case DATATYPE_IMG_G5_1BPP: - case DATATYPE_IMG_G5_2BPP: + case DATATYPE_IMG_G5: case DATATYPE_IMG_RAW_3BPP: { char hexmac[17]; mac2hex(pending->targetMac, hexmac); @@ -448,7 +447,7 @@ void processXferComplete(struct espXferComplete* xfc, bool local) { contentFS->remove(dst_path); } if (contentFS->exists(queueItem->filename)) { - if (config.preview && (queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_3BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_2BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_G5_1BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_G5_2BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_ZLIB)) { + if (config.preview && (queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_3BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_2BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_G5 || queueItem->pendingdata.availdatainfo.dataType == DATATYPE_IMG_ZLIB)) { contentFS->rename(queueItem->filename, String(dst_path)); } else { if (queueItem->pendingdata.availdatainfo.dataType != DATATYPE_FW_UPDATE) contentFS->remove(queueItem->filename); @@ -969,7 +968,7 @@ bool queueDataAvail(struct pendingData* pending, bool local) { } newPending.len = taginfo->len; - if ((pending->availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP || pending->availdatainfo.dataType == DATATYPE_IMG_RAW_2BPP || pending->availdatainfo.dataType == DATATYPE_IMG_RAW_3BPP || pending->availdatainfo.dataType == DATATYPE_IMG_ZLIB || pending->availdatainfo.dataType == DATATYPE_IMG_G5_1BPP || pending->availdatainfo.dataType == DATATYPE_IMG_G5_2BPP) && (pending->availdatainfo.dataTypeArgument & 0xF8) == 0x00) { + if ((pending->availdatainfo.dataType == DATATYPE_IMG_RAW_1BPP || pending->availdatainfo.dataType == DATATYPE_IMG_RAW_2BPP || pending->availdatainfo.dataType == DATATYPE_IMG_RAW_3BPP || pending->availdatainfo.dataType == DATATYPE_IMG_ZLIB || pending->availdatainfo.dataType == DATATYPE_IMG_G5) && (pending->availdatainfo.dataTypeArgument & 0xF8) == 0x00) { // in case of an image (no preload), remove already queued images pendingQueue.erase(std::remove_if(pendingQueue.begin(), pendingQueue.end(), [pending](const PendingItem& item) { diff --git a/oepl-definitions.h b/oepl-definitions.h index e3cae105..2e663bbd 100755 --- a/oepl-definitions.h +++ b/oepl-definitions.h @@ -122,8 +122,7 @@ // [uint32_t uncompressed size][2 byte zlib header][zlib compressed image] // image format: [uint8_t header length][uint16_t width][uint16_t height][uint8_t bpp (lower 4)][img data] -#define DATATYPE_IMG_G5_1BPP 0x31 // G5 compressed 1BPP -#define DATATYPE_IMG_G5_2BPP 0x32 // G5 compressed 2BPP +#define DATATYPE_IMG_G5 0x31 // G5 compressed 1BPP #define DATATYPE_UK_SEGMENTED 0x51 // Segmented data for the UK Segmented display type (contained in availableData Reply) #define DATATYPE_EU_SEGMENTED 0x52 // Segmented data for the EU/DE Segmented display type (contained in availableData Reply)