MCPcopy Create free account
hub / github.com/OpenEPaperLink/OpenEPaperLink / drawTimestamp

Function drawTimestamp

ESP32_AP-Flasher/src/contentmanager.cpp:2491–2641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2489
2490#ifdef CONTENT_TIMESTAMP
2491void drawTimestamp(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams) {
2492 Serial.println("make Timestamp");
2493 time_t now;
2494 time(&now);
2495 struct tm timeinfo;
2496
2497 JsonDocument loc;
2498 getTemplate(loc, 1, taginfo->hwType);
2499
2500 TFT_eSprite spr = TFT_eSprite(&tft);
2501 initSprite(spr, imageParams.width, imageParams.height, imageParams);
2502
2503 if (!cfgobj["#init"]) {
2504 Serial.println("init");
2505 // init preload images
2506
2507 char hexmac[17];
2508 mac2hex(taginfo->mac, hexmac);
2509
2510 String filename2 = "/temp/" + String(hexmac) + "-2.raw";
2511 drawString(spr, cfgobj["button1"].as<String>(), spr.width() / 2, 40, "calibrib30.vlw", TC_DATUM, TFT_BLACK);
2512 drawString(spr, "Well done!", spr.width() / 2, 90, "calibrib30.vlw", TC_DATUM, TFT_BLACK);
2513 spr2buffer(spr, filename2, imageParams);
2514
2515 if (imageParams.zlib) {
2516 imageParams.dataType = DATATYPE_IMG_ZLIB;
2517 } else if (imageParams.g5) {
2518 imageParams.dataType = DATATYPE_IMG_G5;
2519 }
2520
2521 struct imageDataTypeArgStruct arg = {0};
2522 arg.preloadImage = 1;
2523 arg.specialType = 17; // button 2
2524 arg.lut = 0;
2525
2526 prepareDataAvail(filename2, imageParams.dataType, *((uint8_t *)&arg), taginfo->mac, 5 | 0x8000);
2527
2528 spr.fillRect(0, 0, spr.width(), spr.height(), TFT_WHITE);
2529
2530 filename2 = "/temp/" + String(hexmac) + "-3.raw";
2531 drawString(spr, cfgobj["button2"].as<String>(), spr.width() / 2, 40, "calibrib30.vlw", TC_DATUM, TFT_BLACK);
2532 drawString(spr, "Well done!", spr.width() / 2, 90, "calibrib30.vlw", TC_DATUM, TFT_BLACK);
2533 spr2buffer(spr, filename2, imageParams);
2534
2535 arg.preloadImage = 1;
2536 arg.specialType = 16; // button 1
2537 arg.lut = 0;
2538 prepareDataAvail(filename2, imageParams.dataType, *((uint8_t *)&arg), taginfo->mac, 5 | 0x8000);
2539
2540 cfgobj["#init"] = "1";
2541 }
2542 uint8_t offsety = 0;
2543 uint8_t buttony = 145;
2544 spr.fillRect(0, 0, spr.width(), spr.height(), TFT_WHITE);
2545 if (imageParams.rotate == 2) {
2546 offsety = 25;
2547 buttony = 10;
2548 spr.fillTriangle(spr.width() - 27, spr.height() - 160, spr.width() - 37, spr.height() - 160, spr.width() - 32, spr.height() - 165, TFT_BLACK);

Callers 1

drawNewFunction · 0.85

Calls 13

getTemplateFunction · 0.85
initSpriteFunction · 0.85
mac2hexFunction · 0.85
drawStringFunction · 0.85
spr2bufferFunction · 0.85
prepareDataAvailFunction · 0.85
strcpyFunction · 0.85
printlnMethod · 0.80
widthMethod · 0.80
fillRectMethod · 0.80
heightMethod · 0.80
fillTriangleMethod · 0.80

Tested by

no test coverage detected