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

Function doAPFlash

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

Source from the content-addressed store, hash-verified

565}
566
567bool doAPFlash() {
568 // This function expects a tag in stock configuration, to be used as an AP. It can also work with 'dead' AP's.
569 class flasher *f = new flasher();
570 if (!f->connectTag(AP_PROCESS_PORT)) {
571 Serial.printf("Sorry, failed to connect to this tag...\r\n");
572 delete f;
573 return false;
574 }
575
576 f->getFirmwareMD5();
577
578 if (f->findTagByMD5()) {
579 // fresh tag for AP
580 Serial.printf("Found an original fw tag, flashing it for use with OpenEPaperLink\r\n");
581 f->readInfoBlock();
582 f->getFirmwareMac();
583 f->prepareInfoBlock();
584 f->writeInfoBlock();
585 } else if (f->getInfoBlockMD5() && f->findTagByMD5()) {
586 // used tag, but recognized
587 } else {
588 // unknown tag, bailing out.
589 f->backupFlash();
590
591 Serial.printf("Found a tag, but don't know what to do with it. Consider flashing using a file called \"AP_force_flash.bin\"\r\n");
592 delete f;
593 return false;
594 }
595 bool res = f->writeFlashFromPack("/AP_FW_Pack.bin", f->tagtype);
596 f->zbs->reset();
597 delete f;
598 return res;
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

Callers 1

APTaskFunction · 0.85

Calls 12

printfMethod · 0.80
connectTagMethod · 0.45
getFirmwareMD5Method · 0.45
findTagByMD5Method · 0.45
readInfoBlockMethod · 0.45
getFirmwareMacMethod · 0.45
prepareInfoBlockMethod · 0.45
writeInfoBlockMethod · 0.45
getInfoBlockMD5Method · 0.45
backupFlashMethod · 0.45
writeFlashFromPackMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected