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

Function doForcedAPFlash

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

Source from the content-addressed store, hash-verified

537}
538
539bool doForcedAPFlash() {
540 class flasher *f = new flasher();
541 if (!f->connectTag(AP_PROCESS_PORT)) {
542 delete f;
543 return false;
544 }
545
546 // we're going to overwrite the contents of the tag, so if we haven't set the mac already, we can forget about it. We'll set the mac to the wifi mac
547 if (!f->getInfoBlockMac()) {
548 f->readInfoBlock();
549 f->getMacFromWiFi();
550 f->prepareInfoBlock();
551 f->writeInfoBlock();
552 }
553
554 fs::File readfile = contentFS->open("/AP_force_flash.bin", "r");
555 bool res = f->writeFlashFromPackOffset(&readfile, readfile.size());
556#ifdef HAS_RGB_LED
557 if (res) addFadeColor(CRGB::Green);
558 if (!res) addFadeColor(CRGB::Red);
559#endif
560 readfile.close();
561 if (res) contentFS->remove("/AP_force_flash.bin");
562 f->zbs->reset();
563 delete f;
564 return res;
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.

Callers 1

APTaskFunction · 0.85

Calls 12

openMethod · 0.80
closeMethod · 0.80
addFadeColorFunction · 0.70
connectTagMethod · 0.45
getInfoBlockMacMethod · 0.45
readInfoBlockMethod · 0.45
getMacFromWiFiMethod · 0.45
prepareInfoBlockMethod · 0.45
writeInfoBlockMethod · 0.45
sizeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected