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

Function webFlasherTask

ESP32_AP-Flasher/src/webflasher.cpp:197–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197void 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

Callers

nothing calls this directly

Calls 15

wsSerialFunction · 0.85
infoDisplayFunction · 0.85
reportFunction · 0.85
doRunMethod · 0.80
printlnMethod · 0.80
printfMethod · 0.80
fillRectMethod · 0.80
widthMethod · 0.80
setCursorMethod · 0.80
fillScreenMethod · 0.80
extTagConnectedFunction · 0.70
powerControlFunction · 0.70

Tested by

no test coverage detected