| 537 | } |
| 538 | |
| 539 | bool 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 | |
| 567 | bool doAPFlash() { |
| 568 | // This function expects a tag in stock configuration, to be used as an AP. It can also work with 'dead' AP's. |
no test coverage detected