Make wifi optional and exclude from nrf52 builds

1.2-legacy
geeksville 2020-09-18 10:48:39 -07:00
rodzic 9624cc3798
commit 6e5e5822aa
8 zmienionych plików z 117 dodań i 102 usunięć

Wyświetl plik

@ -160,7 +160,7 @@ build_flags =
-Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
;-DCFG_DEBUG=3
src_filter =
${env.src_filter} -<esp32/> -<nimble/>
${env.src_filter} -<esp32/> -<nimble/> -<meshwifi/>
lib_ignore =
BluetoothOTA
monitor_port = /dev/ttyACM1

Wyświetl plik

@ -101,6 +101,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Standard definitions for ESP32 targets
//
#define HAS_WIFI
#define GPS_SERIAL_NUM 1
#define GPS_RX_PIN 34
#ifdef USE_JTAG

Wyświetl plik

@ -32,7 +32,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "main.h"
#include "mesh-pb-constants.h"
#include "utils.h"
#include <WiFi.h>
#include "meshwifi/meshwifi.h"
using namespace meshtastic; /** @todo remove */
@ -842,6 +841,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
// Jm
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
{
#ifdef HAS_WIFI
const char *wifiName = radioConfig.preferences.wifi_ssid;
const char *wifiPsw = radioConfig.preferences.wifi_password;
@ -869,6 +869,7 @@ void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, i
display->setPixel(0, 0);
heartbeat = !heartbeat;
#endif
#endif
}

Wyświetl plik

@ -17,7 +17,6 @@
#include "concurrency/PeriodicTask.h"
#include "power.h"
#include <string>
#include <WiFi.h>
namespace graphics
{

Wyświetl plik

@ -2,7 +2,6 @@
#include <Arduino.h>
#include <functional>
#include <WiFi.h>
void initWebServer();

Wyświetl plik

@ -1,9 +1,11 @@
#include "meshwifi.h"
#include <WiFi.h>
#include "NodeDB.h"
#include "configuration.h"
#include "main.h"
#include "NodeDB.h"
#include "meshwifi/meshhttp.h"
#include <WiFi.h>
static void WiFiEvent(WiFiEvent_t event);
bool isWifiAvailable()
{
@ -36,11 +38,9 @@ void deinitWifi()
WiFi.printDiag(Serial);
}
// Startup WiFi
void initWifi()
{
if (isWifiAvailable() == 0) {
return;
}
@ -59,7 +59,6 @@ void initWifi()
WiFi.onEvent(WiFiEvent);
// esp_wifi_set_ps(WIFI_PS_NONE); // Disable power saving
DEBUG_MSG("JOINING WIFI: ssid=%s\n", wifiName);
if (WiFi.begin(wifiName, wifiPsw) == WL_CONNECTED) {
DEBUG_MSG("MY IP ADDRESS: %s\n", WiFi.localIP().toString().c_str());
@ -72,8 +71,7 @@ void initWifi()
DEBUG_MSG("Not using WIFI\n");
}
void WiFiEvent(WiFiEvent_t event)
static void WiFiEvent(WiFiEvent_t event)
{
DEBUG_MSG("************ [WiFi-event] event: %d ************\n", event);
@ -161,6 +159,7 @@ void WiFiEvent(WiFiEvent_t event)
case SYSTEM_EVENT_ETH_GOT_IP:
DEBUG_MSG("Obtained IP address\n");
break;
default: break;
default:
break;
}
}

Wyświetl plik

@ -1,13 +1,15 @@
#pragma once
#include "configuration.h"
#include <Arduino.h>
#include <functional>
#ifdef HAS_WIFI
#include <WiFi.h>
#endif
void initWifi();
void deinitWifi();
void WiFiEvent(WiFiEvent_t event);
bool isWifiAvailable();

Wyświetl plik

@ -0,0 +1,13 @@
#include "meshwifi/meshhttp.h"
#include "meshwifi/meshwifi.h"
void initWifi() {}
void deinitWifi() {}
bool isWifiAvailable()
{
return false;
}
void handleWebResponse() {}