mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-06 05:21:22 +03:00
Add/unify comments for target and source sites of async scheduling via delay()/esp_yield()/esp_schedule() (#6780)
This commit is contained in:
parent
05454df164
commit
240ae5ef26
@ -623,6 +623,7 @@ int ESP8266WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResul
|
||||
} else if(err == ERR_INPROGRESS) {
|
||||
_dns_lookup_pending = true;
|
||||
delay(timeout_ms);
|
||||
// will resume on timeout or when wifi_dns_found_callback fires
|
||||
_dns_lookup_pending = false;
|
||||
// will return here when dns_found_callback fires
|
||||
if(aResult.isSet()) {
|
||||
@ -654,7 +655,7 @@ void wifi_dns_found_callback(const char *name, CONST ip_addr_t *ipaddr, void *ca
|
||||
if(ipaddr) {
|
||||
(*reinterpret_cast<IPAddress*>(callback_arg)) = IPAddress(ipaddr);
|
||||
}
|
||||
esp_schedule(); // resume the hostByName function
|
||||
esp_schedule(); // break delay in hostByName
|
||||
}
|
||||
|
||||
uint32_t ESP8266WiFiGenericClass::shutdownCRC (const WiFiState* state)
|
||||
|
@ -71,7 +71,7 @@ bool ESP8266WiFiSTAClass::beginWPSConfig(void) {
|
||||
}
|
||||
|
||||
esp_yield();
|
||||
// will return here when wifi_wps_status_cb fires
|
||||
// will resume when wifi_wps_status_cb fires
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -107,5 +107,5 @@ void wifi_wps_status_cb(wps_cb_status status) {
|
||||
}
|
||||
// TODO user function to get status
|
||||
|
||||
esp_schedule(); // resume the beginWPSConfig function
|
||||
esp_schedule(); // resume beginWPSConfig
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ int8_t ESP8266WiFiScanClass::scanNetworks(bool async, bool show_hidden, uint8 ch
|
||||
return WIFI_SCAN_RUNNING;
|
||||
}
|
||||
|
||||
esp_yield();
|
||||
esp_yield(); // will resume when _scanDone fires
|
||||
return ESP8266WiFiScanClass::_scanCount;
|
||||
} else {
|
||||
return WIFI_SCAN_FAILED;
|
||||
@ -323,7 +323,7 @@ void ESP8266WiFiScanClass::_scanDone(void* result, int status) {
|
||||
ESP8266WiFiScanClass::_scanComplete = true;
|
||||
|
||||
if(!ESP8266WiFiScanClass::_scanAsync) {
|
||||
esp_schedule();
|
||||
esp_schedule(); // resume scanNetworks
|
||||
} else if (ESP8266WiFiScanClass::_onComplete) {
|
||||
ESP8266WiFiScanClass::_onComplete(ESP8266WiFiScanClass::_scanCount);
|
||||
ESP8266WiFiScanClass::_onComplete = nullptr;
|
||||
|
@ -130,10 +130,10 @@ public:
|
||||
}
|
||||
_connect_pending = true;
|
||||
_op_start_time = millis();
|
||||
// Following delay will be interrupted by connect callback
|
||||
for (decltype(_timeout_ms) i = 0; _connect_pending && i < _timeout_ms; i++) {
|
||||
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
||||
delay(1);
|
||||
// will resume on timeout or when _connected or _notify_error fires
|
||||
}
|
||||
_connect_pending = false;
|
||||
if (!_pcb) {
|
||||
@ -435,7 +435,7 @@ protected:
|
||||
if (_connect_pending || _send_waiting) {
|
||||
_send_waiting = false;
|
||||
_connect_pending = false;
|
||||
esp_schedule(); // break current delay()
|
||||
esp_schedule(); // break delay in connect or _write_from_source
|
||||
}
|
||||
}
|
||||
|
||||
@ -461,10 +461,11 @@ protected:
|
||||
}
|
||||
|
||||
_send_waiting = true;
|
||||
// Following delay will be interrupted by on next received ack
|
||||
for (decltype(_timeout_ms) i = 0; _send_waiting && i < _timeout_ms; i++) {
|
||||
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
|
||||
delay(1);
|
||||
// will resume on timeout or when _write_some_from_cb or _notify_error fires
|
||||
|
||||
}
|
||||
_send_waiting = false;
|
||||
} while(true);
|
||||
@ -536,7 +537,7 @@ protected:
|
||||
{
|
||||
if (_send_waiting) {
|
||||
_send_waiting = false;
|
||||
esp_schedule(); // break current delay()
|
||||
esp_schedule(); // break delay in _write_from_source
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +613,7 @@ protected:
|
||||
assert(pcb == _pcb);
|
||||
if (_connect_pending) {
|
||||
_connect_pending = false;
|
||||
esp_schedule(); // break current delay()
|
||||
esp_schedule(); // break delay in connect
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user