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

Function sendChannelPower

ESP32_AP-Flasher/src/serialap.cpp:322–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320 return false;
321}
322bool sendChannelPower(struct espSetChannelPower* scp) {
323 if (apInfo.state == AP_STATE_NORADIO) return true;
324 if ((apInfo.state != AP_STATE_ONLINE) && (apInfo.state != AP_STATE_COMING_ONLINE)) return false;
325 if (!txStart()) return false;
326 addCRC(scp, sizeof(struct espSetChannelPower));
327 for (uint8_t attempt = 0; attempt < 5; attempt++) {
328 cmdReplyValue = CMD_REPLY_WAIT;
329 AP_SERIAL_PORT.print("SCP>");
330 for (uint8_t c = 0; c < sizeof(struct espSetChannelPower); c++) {
331 AP_SERIAL_PORT.write(((uint8_t*)scp)[c]);
332 }
333 if (waitCmdReply()) {
334 txEnd();
335 apInfo.channel = scp->channel;
336 apInfo.power = scp->power;
337 return true;
338 }
339 Serial.printf("SCP send failed in try %d\r\n", attempt);
340 }
341 Serial.print("SCP failed to send...\r\n");
342 txEnd();
343 return false;
344}
345bool sendPing() {
346 if (apInfo.state == AP_STATE_NORADIO) return true;
347 if (apInfo.state == AP_STATE_FLASHING) return false;

Callers 4

rxCmdProcessorFunction · 0.85
bringAPOnlineFunction · 0.85
autoselectFunction · 0.85
setAPchannelFunction · 0.85

Calls 7

txStartFunction · 0.85
waitCmdReplyFunction · 0.85
txEndFunction · 0.85
printfMethod · 0.80
addCRCFunction · 0.70
printMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected