switch from rf24 to espnow
This commit is contained in:
@@ -15,9 +15,13 @@
|
||||
#include <iostream>
|
||||
#include <WiFi.h>
|
||||
#include <PubSubClient.h>
|
||||
#include <esp_now.h>
|
||||
|
||||
#include "networkConfig.h"
|
||||
|
||||
typedef void (*recieveCallbackPtr) (const uint8_t * mac, const uint8_t *incomingData, int len);
|
||||
typedef void (*sendCallbackPtr) (const uint8_t *mac_addr, esp_now_send_status_t status);
|
||||
|
||||
/**
|
||||
* @brief This class handles all network stuff
|
||||
*
|
||||
@@ -39,6 +43,7 @@ class Network {
|
||||
* @return false Timeout
|
||||
*/
|
||||
static bool connectWifi();
|
||||
static bool connectEspNow(recieveCallbackPtr reci, sendCallbackPtr send);
|
||||
|
||||
/**
|
||||
* @brief Set all general settings to connect to a broker.
|
||||
@@ -71,6 +76,7 @@ class Network {
|
||||
* @return PubSubClient*
|
||||
*/
|
||||
static PubSubClient* getMqttClient();
|
||||
static const uint8_t * getBroadcastAddress() { return broadcastAddress; }
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -80,6 +86,10 @@ class Network {
|
||||
* @return false if the connect attemp was unsuccessful
|
||||
*/
|
||||
static bool connectMQTT();
|
||||
static int32_t getWiFiChannel(const char *ssid);
|
||||
|
||||
static esp_now_peer_info_t peerInfo;
|
||||
static uint8_t broadcastAddress[6];
|
||||
|
||||
static IPAddress local_IP;
|
||||
static IPAddress gateway;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
*/
|
||||
#define WLAN_CONNECT_LOOP_TIME 500
|
||||
#define WLAN_DNS_SERVER "8.8.8.8"
|
||||
#define ESP_NOW_CONTROLER_MAC {0xC8, 0xC9, 0xA3, 0xC8, 0x57, 0x10}
|
||||
|
||||
#define NTRIP_RTK2GO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user