diff --git a/src/ApplicationManager.cpp b/src/ApplicationManager.cpp index 8d167ae..69aeb1d 100644 --- a/src/ApplicationManager.cpp +++ b/src/ApplicationManager.cpp @@ -356,6 +356,7 @@ void ApplicationManager::handleSpoolDetected(const AppMessage& msg) { if (strcmp(s.tag_format, "OpenPrintTag") == 0) spool.tagType = 1; else if (strcmp(s.tag_format, "TigerTag") == 0) spool.tagType = 2; else if (strcmp(s.tag_format, "OpenTag3D") == 0) spool.tagType = 3; + else if (strcmp(s.tag_format, "BambuTag") == 0) spool.tagType = 4; else spool.tagType = 0; display_->showSpool(spool); } else if (display_) { diff --git a/src/TFTManager.cpp b/src/TFTManager.cpp index d47a274..f9d29dc 100644 --- a/src/TFTManager.cpp +++ b/src/TFTManager.cpp @@ -12,84 +12,6 @@ // --------------------------------------------------------------------------- // Generic NFC icon (concentric arcs suggesting radio waves) -static const uint8_t ICON_NFC_PLAIN[32][32] PROGMEM = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, - {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0}, - {0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,0,0,0,0}, - {0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0}, - {0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -}; - -// OpenPrintTag icon: "OPT" text in a rounded box -// (placeholder — same structure, you can replace with a proper design) -static const uint8_t ICON_OPENPRINTTAG[32][32] PROGMEM = { - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, - {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,1,1,1,0,0,0,1,0,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,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0}, - {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0}, - {0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0}, - {0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, -}; - -// Reuse NFC_PLAIN icon for TigerTag, OpenTag3D, Bambu for now. -// Replace with distinct designs as desired. -#define ICON_TIGERTAG ICON_NFC_PLAIN -#define ICON_OPENTAG3D ICON_NFC_PLAIN -#define ICON_BAMBU ICON_NFC_PLAIN - // --------------------------------------------------------------------------- // Color constants // --------------------------------------------------------------------------- @@ -612,46 +534,38 @@ void TFTManager::drawWeightBar(int x, int y, int w, int h, } void TFTManager::drawTagIcon(uint8_t tagType, int x, int y) { - const uint8_t (*icon)[32] = nullptr; - uint32_t fgColor = COLOR_ACCENT; + const char* label = nullptr; + uint32_t color = COLOR_SUBTEXT; switch (tagType) { case TAG_TYPE_OPENPRINTTAG: - icon = ICON_OPENPRINTTAG; - fgColor = 0x00BFFF; + label = "OPT"; + color = 0x4FC3F7; break; case TAG_TYPE_TIGERTAG: - icon = ICON_TIGERTAG; - fgColor = 0xFF8C00; + label = "TT"; + color = 0xFF9800; break; case TAG_TYPE_OPENTAG3D: - icon = ICON_OPENTAG3D; - fgColor = 0x00CC66; + label = "OT3D"; + color = 0x4CAF50; break; case TAG_TYPE_BAMBU: - icon = ICON_BAMBU; - fgColor = 0x1DB954; + label = "Bambu"; + color = 0x1DB954; break; case TAG_TYPE_NFC_PLAIN: - default: - icon = ICON_NFC_PLAIN; - fgColor = COLOR_SUBTEXT; + label = "NFC+"; + color = 0x00BCD4; break; + default: + return; } - if (!icon) return; - - // Draw 32x32 bitmap from PROGMEM — scale to 22x22 by skipping every ~3rd pixel - for (int row = 0; row < 22; row++) { - int srcRow = (row * 32) / 22; - for (int col = 0; col < 22; col++) { - int srcCol = (col * 32) / 22; - uint8_t pixel = pgm_read_byte(&icon[srcRow][srcCol]); - if (pixel) { - _sprite.drawPixel(x + col, y + row, fgColor); - } - } - } + _sprite.setTextColor(color); + _sprite.setTextSize(1); + _sprite.setTextDatum(TR_DATUM); + _sprite.drawString(label, x + 22, y); } uint32_t TFTManager::hexToRgb(const char* hex) {