mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-06 09:57:52 +00:00
Final checkin of WiFi and basic HTTP server
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
#include "configuration.h"
|
||||
#include "main.h"
|
||||
#include "NodeDB.h"
|
||||
#include "meshwifi.h"
|
||||
#include "meshhttp.h"
|
||||
#include "meshwifi/meshwifi.h"
|
||||
#include "meshwifi/meshhttp.h"
|
||||
|
||||
|
||||
WebServer webserver(80);
|
||||
@@ -14,6 +14,10 @@ String sender = "";
|
||||
|
||||
|
||||
void handleWebResponse() {
|
||||
if (isWifiAvailable() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
webserver.handleClient();
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,34 @@
|
||||
#include "NodeDB.h"
|
||||
#include "meshwifi/meshhttp.h"
|
||||
|
||||
bool isWifiAvailable()
|
||||
{
|
||||
const char *wifiName = radioConfig.preferences.wifi_ssid;
|
||||
const char *wifiPsw = radioConfig.preferences.wifi_password;
|
||||
|
||||
if (*wifiName && *wifiPsw) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Disable WiFi
|
||||
void deinitWifi()
|
||||
{
|
||||
WiFi.mode(WIFI_MODE_NULL);
|
||||
DEBUG_MSG("WiFi Turned Off\n");
|
||||
}
|
||||
|
||||
|
||||
// Startup WiFi
|
||||
void initWifi()
|
||||
{
|
||||
|
||||
if (isWifiAvailable() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//strcpy(radioConfig.preferences.wifi_ssid, WiFi_SSID_NAME);
|
||||
//strcpy(radioConfig.preferences.wifi_password, WiFi_SSID_PASSWORD);
|
||||
if (radioConfig.has_preferences) {
|
||||
|
||||
@@ -12,3 +12,4 @@ void deinitWifi();
|
||||
|
||||
void WiFiEvent(WiFiEvent_t event);
|
||||
|
||||
bool isWifiAvailable();
|
||||
Reference in New Issue
Block a user