[beken-72xx] Wait for init_thread to start TCP/IP

This commit is contained in:
Kuba Szczodrzyński
2022-07-01 18:49:14 +02:00
parent 4beaa79d02
commit 352a425c4f
3 changed files with 20 additions and 3 deletions

View File

@@ -16,6 +16,12 @@ bool WiFiClass::modePriv(WiFiMode mode, WiFiModeAction sta, WiFiModeAction ap) {
LT_D_WG("Initializing func&app");
func_init_extended();
app_pre_start();
// wait for the init_thread to finish its job
while (xTaskGetHandle("init_thread")) {
LT_V_WG("Waiting for init_thread");
delay(10);
}
LT_D_WG("Success");
__bk_rf_is_init = true;
}

View File

@@ -57,17 +57,26 @@ int16_t WiFiClass::scanNetworks(bool async, bool showHidden, bool passive, uint3
__wrap_bk_printf_disable();
mhdr_scanu_reg_cb(scanHandler, this);
bk_wlan_start_scan();
__wrap_bk_printf_enable();
LT_HEAP_I();
scan->running = true;
int16_t ret = WIFI_SCAN_RUNNING;
if (!async) {
LT_I("Waiting for results");
xSemaphoreTake(data.scanSem, 1); // reset the semaphore quickly
xSemaphoreTake(data.scanSem, pdMS_TO_TICKS(maxMsPerChannel * 20));
return scan->count;
if (scan->running) {
scanDelete();
ret = WIFI_SCAN_FAILED;
goto exit;
}
ret = scan->count;
goto exit;
}
return WIFI_SCAN_RUNNING;
exit:
__wrap_bk_printf_enable();
return ret;
}

View File

@@ -78,6 +78,8 @@ env.Append(
# LwIP options
("LWIP_SO_RCVBUF", "1"), # for ioctl(FIONREAD)
"MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED",
# FreeRTOS options
("INCLUDE_xTaskGetHandle", "1"),
],
ASFLAGS=[
"-mcpu=arm968e-s",