mirror of
https://github.com/meshtastic/firmware.git
synced 2025-02-26 22:33:24 +00:00
Pico W: Wi-Fi improvements (#2989)
* Pico W: Initial WiFi support: connects, but freezes after a while * Update arduino-pico core to fix hang with Wi-Fi * Add `picow` to workflow since it's different from `pico` now * Show Wi-Fi frame on screen for all devices with Wi-Fi * Pico W: Disable mDNS as it's unsupported with FreeRTOS * Fix printing IP address * Fix Raspbian build
This commit is contained in:
parent
62329ad11f
commit
46d02affe8
src
@ -43,9 +43,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include "sleep.h"
|
||||
#include "target_specific.h"
|
||||
|
||||
#if HAS_WIFI && !defined(ARCH_RASPBERRY_PI)
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#endif
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#include "esp_task_wdt.h"
|
||||
#include "mesh/wifi/WiFiAPClient.h"
|
||||
#include "modules/esp32/StoreForwardModule.h"
|
||||
#endif
|
||||
|
||||
@ -1294,7 +1297,7 @@ void Screen::setFrames()
|
||||
// call a method on debugInfoScreen object (for more details)
|
||||
normalFrames[numframes++] = &Screen::drawDebugInfoSettingsTrampoline;
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
#if HAS_WIFI && !defined(ARCH_RASPBERRY_PI)
|
||||
if (isWifiAvailable()) {
|
||||
// call a method on debugInfoScreen object (for more details)
|
||||
normalFrames[numframes++] = &Screen::drawDebugInfoWiFiTrampoline;
|
||||
|
@ -9,13 +9,11 @@
|
||||
#include "target_specific.h"
|
||||
#include <WiFi.h>
|
||||
#include <WiFiUdp.h>
|
||||
#ifndef ARCH_RP2040
|
||||
#ifdef ARCH_ESP32
|
||||
#include "mesh/http/WebServer.h"
|
||||
#include <ESPmDNS.h>
|
||||
#include <esp_wifi.h>
|
||||
static void WiFiEvent(WiFiEvent_t event);
|
||||
#else
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
@ -53,6 +51,7 @@ static void onNetworkConnected()
|
||||
// Start web server
|
||||
LOG_INFO("Starting network services\n");
|
||||
|
||||
#ifdef ARCH_ESP32
|
||||
// start mdns
|
||||
if (!MDNS.begin("Meshtastic")) {
|
||||
LOG_ERROR("Error setting up MDNS responder!\n");
|
||||
@ -62,6 +61,9 @@ static void onNetworkConnected()
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
MDNS.addService("https", "tcp", 443);
|
||||
}
|
||||
#else // ESP32 handles this in WiFiEvent
|
||||
LOG_INFO("Obtained IP address: %s\n", WiFi.localIP().toString().c_str());
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_NTP
|
||||
LOG_INFO("Starting NTP time client\n");
|
||||
@ -89,7 +91,7 @@ static void onNetworkConnected()
|
||||
syslog.enable();
|
||||
}
|
||||
|
||||
#ifndef ARCH_RP2040
|
||||
#ifdef ARCH_ESP32
|
||||
initWebServer();
|
||||
#endif
|
||||
initApiServer();
|
||||
@ -245,7 +247,7 @@ bool initWifi()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef ARCH_RP2040
|
||||
#ifdef ARCH_ESP32
|
||||
// Called by the Espressif SDK to
|
||||
static void WiFiEvent(WiFiEvent_t event)
|
||||
{
|
||||
@ -279,11 +281,11 @@ static void WiFiEvent(WiFiEvent_t event)
|
||||
LOG_INFO("Authentication mode of access point has changed\n");
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP:
|
||||
LOG_INFO("Obtained IP address: ", WiFi.localIPv6());
|
||||
LOG_INFO("Obtained IP address: %s\n", WiFi.localIP().toString().c_str());
|
||||
onNetworkConnected();
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_GOT_IP6:
|
||||
LOG_INFO("Obtained IP6 address: %s", WiFi.localIPv6());
|
||||
LOG_INFO("Obtained IP6 address: %s\n", WiFi.localIPv6().toString().c_str());
|
||||
break;
|
||||
case ARDUINO_EVENT_WIFI_STA_LOST_IP:
|
||||
LOG_INFO("Lost IP address and IP address is reset to 0\n");
|
||||
@ -391,4 +393,4 @@ static void WiFiEvent(WiFiEvent_t event)
|
||||
uint8_t getWifiDisconnectReason()
|
||||
{
|
||||
return wifiDisconnectReason;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user