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

Function bringAPOnline

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

Source from the content-addressed store, hash-verified

818}
819
820bool bringAPOnline(uint8_t newState) {
821#ifdef BLE_ONLY
822 apInfo.state = AP_STATE_NORADIO;
823#endif
824 if (apInfo.state == AP_STATE_NORADIO) return true;
825 if (apInfo.state == AP_STATE_FLASHING) return false;
826
827 if (gSerialTaskState != SERIAL_STATE_INITIALIZED) {
828#ifdef HAS_ELECROW_ADV_2_8
829 // Set GPIO45 low to connect the wireless interface to the multiplexed pins
830 pinMode(45, OUTPUT);
831 digitalWrite(45, LOW);
832#endif
833
834#if (AP_PROCESS_PORT == FLASHER_AP_PORT)
835 AP_SERIAL_PORT.begin(115200, SERIAL_8N1, FLASHER_AP_RXD, FLASHER_AP_TXD);
836#elif defined(HAS_EXT_FLASHER)
837#if (AP_PROCESS_PORT == FLASHER_EXT_PORT)
838 AP_SERIAL_PORT.begin(115200, SERIAL_8N1, FLASHER_EXT_RXD, FLASHER_EXT_TXD);
839#elif (AP_PROCESS_PORT == FLASHER_ALTRADIO_PORT)
840 AP_SERIAL_PORT.begin(115200, SERIAL_8N1, FLASHER_AP_RXD, FLASHER_AP_TXD);
841#endif
842#endif
843 gSerialTaskState = SERIAL_STATE_INITIALIZED;
844 }
845 if (gSerialTaskState != SERIAL_STATE_RUNNING) {
846 gSerialTaskState = SERIAL_STATE_STARTING;
847 xTaskCreate(rxSerialTask, "rxSerialTask", 1750, NULL, 11, NULL);
848 vTaskDelay(500 / portTICK_PERIOD_MS);
849 }
850 setAPstate(false, AP_STATE_OFFLINE);
851 // try without rebooting
852 AP_SERIAL_PORT.updateBaudRate(115200);
853 uint32_t bootTimeout = millis();
854 bool APrdy = sendPing();
855 if (!APrdy) {
856 if (apInfo.state == AP_STATE_FLASHING) return false;
857 APTagReset();
858 vTaskDelay(1000 / portTICK_PERIOD_MS);
859 bootTimeout = millis();
860 APrdy = false;
861 while ((!APrdy) && (millis() - bootTimeout < 10 * 1000) && (apInfo.state != AP_STATE_FLASHING)) {
862 APrdy = sendPing();
863 vTaskDelay(300 / portTICK_PERIOD_MS);
864 }
865 }
866 if (!APrdy) {
867 return false;
868 } else {
869 setAPstate(false, AP_STATE_COMING_ONLINE);
870 sendChannelPower(&curChannel);
871 vTaskDelay(200 / portTICK_PERIOD_MS);
872 if (!sendGetInfo()) {
873 setAPstate(false, AP_STATE_OFFLINE);
874 return false;
875 }
876 if (apInfo.type == ESP32_C6) {
877 if (sendHighspeed()) {

Callers 3

rxSerialTask2Function · 0.85
APTaskFunction · 0.85
C6firmwareUpdateTaskFunction · 0.85

Calls 9

setAPstateFunction · 0.85
APTagResetFunction · 0.85
sendChannelPowerFunction · 0.85
sendGetInfoFunction · 0.85
sendHighspeedFunction · 0.85
printlnMethod · 0.80
sendPingFunction · 0.70
beginMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected