mirror of
https://github.com/BotChain-Robots/firmware.git
synced 2026-07-08 17:47:21 +02:00
Fix wireless restarts itself after intentionally disabled
This commit is contained in:
@@ -135,7 +135,6 @@ void UDPServer::shutdown() {
|
||||
auto buffer = std::make_unique<std::vector<uint8_t>>();
|
||||
buffer->resize(MAX_RX_BUFFER_SIZE + 4);
|
||||
|
||||
ESP_LOGI(TAG, "Before rx");
|
||||
if (int len = recvfrom(that->m_rx_server_sock, buffer->data(),
|
||||
MAX_RX_BUFFER_SIZE, 0, nullptr, nullptr);
|
||||
len < 0) {
|
||||
|
||||
@@ -21,7 +21,7 @@ int WifiManager::connect() {
|
||||
}
|
||||
|
||||
int WifiManager::disconnect() {
|
||||
this->update_state(wifi_state::disconnect);
|
||||
this->update_state(wifi_state::shutdown);
|
||||
vTaskResume(this->m_task);
|
||||
return 0;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ int WifiManager::disconnect() {
|
||||
handle_broadcasting(); // scans for known networks
|
||||
break;
|
||||
case wifi_state::disconnect:
|
||||
ESP_LOGI(TAG, "Shutting down wifi");
|
||||
ESP_LOGI(TAG, "Shutting down wifi (will restart)");
|
||||
handle_disconnect();
|
||||
update_state(wifi_state::disconnected);
|
||||
break;
|
||||
@@ -63,6 +63,10 @@ int WifiManager::disconnect() {
|
||||
ESP_LOGI(TAG, "Disconnected from wifi, starting back up");
|
||||
update_state(wifi_state::connect);
|
||||
break;
|
||||
case wifi_state::shutdown:
|
||||
ESP_LOGI(TAG, "Shutting down wifi (will not automatically restart)");
|
||||
handle_disconnect();
|
||||
update_state(wifi_state::disabled);
|
||||
default:
|
||||
vTaskSuspend(nullptr);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user