| 195 | } |
| 196 | |
| 197 | void webFlasherTask(void* parameter) { |
| 198 | TCPserver.begin(); |
| 199 | TCPserver.onClient(&onClientConnect, NULL); |
| 200 | |
| 201 | static int32_t countDownTimer = 0; |
| 202 | while (1) { |
| 203 | switch (autoFlashStep) { |
| 204 | case AUTOFLASH_STEP_IDLE: { |
| 205 | if (webFlashMode != FLASHMODE_OFF && (tagConnectTimer.doRun() || webFlashMode == FLASHMODE_AUTO_FOCUS)) { |
| 206 | Serial.println("check pins"); |
| 207 | if (extTagConnected()) autoFlashStep = AUTOFLASH_STEP_CONNECT; |
| 208 | } |
| 209 | break; |
| 210 | } |
| 211 | |
| 212 | case AUTOFLASH_STEP_CONNECT: { |
| 213 | wsSerial("-", "clear"); |
| 214 | infoDisplay("Connecting", 0); |
| 215 | vTaskDelay(2000 / portTICK_PERIOD_MS); |
| 216 | |
| 217 | // pinMode(FLASHER_EXT_TEST, OUTPUT); |
| 218 | // digitalWrite(FLASHER_EXT_TEST, LOW); |
| 219 | |
| 220 | zbsflasherp = new flasher(); |
| 221 | errors = 0; |
| 222 | |
| 223 | if (!report(zbsflasherp->connectTag(FLASHER_EXT_PORT))) { |
| 224 | Seriallog.printf("Sorry, failed to connect to this tag...\r\n"); |
| 225 | break; |
| 226 | |
| 227 | } else { |
| 228 | infoDisplay("Get firmware md5", 0); |
| 229 | report(zbsflasherp->getFirmwareMD5()); |
| 230 | |
| 231 | infoDisplay("Find tag", 0); |
| 232 | if (zbsflasherp->findTagByMD5()) { |
| 233 | // this tag currently contains original firmware, found its fingerprint |
| 234 | Seriallog.printf("Found original firmware tag (fingerprint %s)\r\n", zbsflasherp->md5char); |
| 235 | |
| 236 | infoDisplay("Read info block", 0); |
| 237 | report(zbsflasherp->readInfoBlock()); |
| 238 | if (errors) break; |
| 239 | |
| 240 | infoDisplay("Get firmware mac", 0); |
| 241 | report(zbsflasherp->getFirmwareMac()); |
| 242 | if (errors) break; |
| 243 | |
| 244 | infoDisplay("Prepare info block", 0); |
| 245 | report(zbsflasherp->prepareInfoBlock()); |
| 246 | if (errors) break; |
| 247 | |
| 248 | zbsflasherp->includeInfoBlock = true; |
| 249 | autoFlashStep = AUTOFLASH_STEP_COUNTDOWN; |
| 250 | break; |
| 251 | |
| 252 | } else if (report(zbsflasherp->getInfoBlockMD5())) { |
| 253 | infoDisplay("Find by md5", 0); |
| 254 | // did find an infoblock MD5 that looks valid |
nothing calls this directly
no test coverage detected