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

Function doAPUpdate

ESP32_AP-Flasher/src/flasher.cpp:601–633  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601bool doAPUpdate(uint8_t type) {
602 // this function expects the tag to be already flashed with some version of the OpenEpaperLink Firmware, and that it correctly reported its type
603 class flasher *f = new flasher();
604 if (!f->connectTag(AP_PROCESS_PORT)) {
605 Serial.printf("Sorry, failed to connect to this tag...\r\n");
606 delete f;
607 return false;
608 }
609
610 f->readInfoBlock();
611 if (f->getInfoBlockMD5() && f->findTagByMD5()) {
612 // header (MD5) was correctly set. We'll use the type set there, instead of the provided 'type' in the argument
613 type = f->tagtype;
614 } else {
615 f->readInfoBlock();
616 // Couldn't recognize the firmware, maybe it was already used for OpenEPaperLink?
617 if (!f->getInfoBlockMac()) {
618 // infoblock mac was incorrectly configured, we skipped it in an earlier version. We'll consider it lost, and overwrite it with the wifi mac.
619 f->getMacFromWiFi();
620 }
621 // we'll try to update the MD5, searching for it by type.
622 f->findTagByType(type);
623 f->writeInfoBlock();
624 }
625 bool res = f->writeFlashFromPack("/AP_FW_Pack.bin", f->tagtype);
626#ifdef HAS_RGB_LED
627 if (res) addFadeColor(CRGB::Green);
628 if (!res) addFadeColor(CRGB::Red);
629#endif
630 if (res) f->zbs->reset();
631 delete f;
632 return res;
633}
634#endif
635
636void flashCountDown(uint8_t c) {

Callers 1

APTaskFunction · 0.85

Calls 12

printfMethod · 0.80
addFadeColorFunction · 0.70
connectTagMethod · 0.45
readInfoBlockMethod · 0.45
getInfoBlockMD5Method · 0.45
findTagByMD5Method · 0.45
getInfoBlockMacMethod · 0.45
getMacFromWiFiMethod · 0.45
findTagByTypeMethod · 0.45
writeInfoBlockMethod · 0.45
writeFlashFromPackMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected