Merge pull request #5 from meshtastic/dev-wifi

Dev wifi
This commit is contained in:
Jm Casler 2020-09-18 18:06:13 -07:00 committed by GitHub
commit b1643e6036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 121 additions and 104 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,10 +1,12 @@
#include "meshwifi.h" #include "meshwifi.h"
#include <WiFi.h> #include "NodeDB.h"
#include <DNSServer.h>
#include "configuration.h" #include "configuration.h"
#include "main.h" #include "main.h"
#include "NodeDB.h"
#include "meshwifi/meshhttp.h" #include "meshwifi/meshhttp.h"
#include <WiFi.h>
#include <DNSServer.h>
static void WiFiEvent(WiFiEvent_t event);
DNSServer dnsServer; DNSServer dnsServer;
@ -39,11 +41,9 @@ void deinitWifi()
WiFi.printDiag(Serial); WiFi.printDiag(Serial);
} }
// Startup WiFi // Startup WiFi
void initWifi() void initWifi()
{ {
if (isWifiAvailable() == 0) { if (isWifiAvailable() == 0) {
return; return;
} }
@ -93,8 +93,7 @@ void initWifi()
DEBUG_MSG("Not using WIFI\n"); DEBUG_MSG("Not using WIFI\n");
} }
static void WiFiEvent(WiFiEvent_t event)
void WiFiEvent(WiFiEvent_t event)
{ {
DEBUG_MSG("************ [WiFi-event] event: %d ************\n", event); DEBUG_MSG("************ [WiFi-event] event: %d ************\n", event);
@ -187,7 +186,9 @@ void WiFiEvent(WiFiEvent_t event)
case SYSTEM_EVENT_ETH_GOT_IP: case SYSTEM_EVENT_ETH_GOT_IP:
DEBUG_MSG("Obtained IP address\n"); DEBUG_MSG("Obtained IP address\n");
break; break;
default: break; default:
break;
} }
} }

View File

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

13
src/nrf52/wifi-nrf52.cpp Normal file
View File

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