| 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. |
| 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 | |
| 601 | bool 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 |
no test coverage detected