sforkowany z mirror/meshtastic-firmware
commit
4f11598112
|
@ -9,14 +9,14 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
default_envs = tbeam
|
;default_envs = tbeam
|
||||||
;default_envs = tbeam0.7
|
;default_envs = tbeam0.7
|
||||||
;default_envs = heltec-v2.0
|
;default_envs = heltec-v2.0
|
||||||
;default_envs = tlora-v1
|
;default_envs = tlora-v1
|
||||||
;default_envs = tlora_v1_3
|
;default_envs = tlora_v1_3
|
||||||
;default_envs = tlora-v2
|
;default_envs = tlora-v2
|
||||||
;default_envs = lora-relay-v1 # nrf board
|
;default_envs = lora-relay-v1 # nrf board
|
||||||
;default_envs = t-echo
|
default_envs = t-echo
|
||||||
;default_envs = nrf52840dk-geeksville
|
;default_envs = nrf52840dk-geeksville
|
||||||
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
|
||||||
;default_envs = rak4631
|
;default_envs = rak4631
|
||||||
|
@ -70,7 +70,7 @@ lib_deps =
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git#35d796226b853b0c0ff818b2f1aa3d35e7296a96 ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git#35d796226b853b0c0ff818b2f1aa3d35e7296a96 ; ESP8266_SSD1306
|
||||||
https://github.com/geeksville/OneButton.git ; OneButton library for non-blocking button debounce
|
https://github.com/geeksville/OneButton.git ; OneButton library for non-blocking button debounce
|
||||||
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
|
||||||
https://github.com/meshtastic/arduino-fsm.git#829e967b8a95c094f73c60ef8dacfe66eae38940
|
https://github.com/meshtastic/arduino-fsm.git
|
||||||
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad
|
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad
|
||||||
https://github.com/meshtastic/RadioLib.git#80ed10d689a0568782c5bd152906b0f97d2bce93
|
https://github.com/meshtastic/RadioLib.git#80ed10d689a0568782c5bd152906b0f97d2bce93
|
||||||
https://github.com/meshtastic/TinyGPSPlus.git#f0f47067ef2f67c856475933188251c1ef615e79
|
https://github.com/meshtastic/TinyGPSPlus.git#f0f47067ef2f67c856475933188251c1ef615e79
|
||||||
|
@ -218,7 +218,7 @@ src_filter =
|
||||||
${arduino_base.src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<plugins/esp32> -<mqtt/>
|
${arduino_base.src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<plugins/esp32> -<mqtt/>
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
monitor_port = /dev/ttyACM1
|
; monitor_port = /dev/ttyACM1
|
||||||
|
|
||||||
# we pass in options to jlink so it can understand freertos (note: we don't use "jlink" as the tool)
|
# we pass in options to jlink so it can understand freertos (note: we don't use "jlink" as the tool)
|
||||||
;debug_tool = jlink
|
;debug_tool = jlink
|
||||||
|
@ -255,9 +255,12 @@ debug_init_break =
|
||||||
[nrf52840_base]
|
[nrf52840_base]
|
||||||
; Common base class for all nrf52840 based targets
|
; Common base class for all nrf52840 based targets
|
||||||
extends = nrf52_base
|
extends = nrf52_base
|
||||||
|
; was -DTINY_USB
|
||||||
|
build_flags = ${nrf52_base.build_flags}
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${arduino_base.lib_deps}
|
${arduino_base.lib_deps}
|
||||||
Adafruit nRFCrypto
|
Adafruit nRFCrypto
|
||||||
|
# Adafruit TinyUSB Arduino
|
||||||
# add Adafruit nRFCrypto platform IO automated scan is broken
|
# add Adafruit nRFCrypto platform IO automated scan is broken
|
||||||
|
|
||||||
[env:lora_isp4520]
|
[env:lora_isp4520]
|
||||||
|
@ -315,7 +318,7 @@ extends = nrf52840_base
|
||||||
board = wiscore_rak4631
|
board = wiscore_rak4631
|
||||||
# add our variants files to the include and src paths
|
# add our variants files to the include and src paths
|
||||||
# define build flags for the TFT_eSPI library
|
# define build flags for the TFT_eSPI library
|
||||||
build_flags = ${nrf52_base.build_flags} -Ivariants/WisCore_RAK4631_Board
|
build_flags = ${nrf52840_base.build_flags} -Ivariants/WisCore_RAK4631_Board
|
||||||
src_filter = ${nrf52_base.src_filter} +<../variants/WisCore_RAK4631_Board>
|
src_filter = ${nrf52_base.src_filter} +<../variants/WisCore_RAK4631_Board>
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm)
|
||||||
|
@ -354,10 +357,12 @@ lib_deps =
|
||||||
[env:t-echo]
|
[env:t-echo]
|
||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = t-echo
|
board = t-echo
|
||||||
|
debug_tool = jlink
|
||||||
|
upload_protocol = jlink
|
||||||
# add our variants files to the include and src paths
|
# add our variants files to the include and src paths
|
||||||
# define build flags for the TFT_eSPI library - NOTE: WE NOT LONGER USE TFT_eSPI, it was for an earlier version of the TTGO eink screens
|
# define build flags for the TFT_eSPI library - NOTE: WE NOT LONGER USE TFT_eSPI, it was for an earlier version of the TTGO eink screens
|
||||||
# -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
|
# -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
|
||||||
build_flags = ${nrf52_base.build_flags} -Ivariants/t-echo
|
build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo
|
||||||
src_filter = ${nrf52_base.src_filter} +<../variants/t-echo>
|
src_filter = ${nrf52_base.src_filter} +<../variants/t-echo>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${nrf52840_base.lib_deps}
|
${nrf52840_base.lib_deps}
|
||||||
|
@ -385,7 +390,7 @@ extends = nrf52840_base
|
||||||
board = lora-relay-v1
|
board = lora-relay-v1
|
||||||
# add our variants files to the include and src paths
|
# add our variants files to the include and src paths
|
||||||
# define build flags for the TFT_eSPI library
|
# define build flags for the TFT_eSPI library
|
||||||
build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v1
|
build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v1
|
||||||
-DUSER_SETUP_LOADED
|
-DUSER_SETUP_LOADED
|
||||||
-DTFT_WIDTH=80
|
-DTFT_WIDTH=80
|
||||||
-DTFT_HEIGHT=160
|
-DTFT_HEIGHT=160
|
||||||
|
@ -407,7 +412,7 @@ extends = nrf52840_base
|
||||||
board = lora-relay-v2
|
board = lora-relay-v2
|
||||||
# add our variants files to the include and src paths
|
# add our variants files to the include and src paths
|
||||||
# define build flags for the TFT_eSPI library
|
# define build flags for the TFT_eSPI library
|
||||||
build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v2
|
build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v2
|
||||||
-DUSER_SETUP_LOADED
|
-DUSER_SETUP_LOADED
|
||||||
-DTFT_WIDTH=80
|
-DTFT_WIDTH=80
|
||||||
-DTFT_HEIGHT=160
|
-DTFT_HEIGHT=160
|
||||||
|
|
|
@ -27,6 +27,7 @@ static bool isPowered()
|
||||||
|
|
||||||
static void sdsEnter()
|
static void sdsEnter()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Enter state: SDS\n");
|
||||||
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
|
// FIXME - make sure GPS and LORA radio are off first - because we want close to zero current draw
|
||||||
doDeepSleep(getPref_sds_secs() * 1000LL);
|
doDeepSleep(getPref_sds_secs() * 1000LL);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +42,7 @@ static void lsEnter()
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
secsSlept = 0; // How long have we been sleeping this time
|
secsSlept = 0; // How long have we been sleeping this time
|
||||||
|
|
||||||
DEBUG_MSG("lsEnter end\n");
|
// DEBUG_MSG("lsEnter end\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lsIdle()
|
static void lsIdle()
|
||||||
|
@ -112,6 +113,7 @@ static void lsIdle()
|
||||||
|
|
||||||
static void lsExit()
|
static void lsExit()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Exit state: LS\n");
|
||||||
// setGPSPower(true); // restore GPS power
|
// setGPSPower(true); // restore GPS power
|
||||||
if (gps)
|
if (gps)
|
||||||
gps->forceWake(true);
|
gps->forceWake(true);
|
||||||
|
@ -119,6 +121,7 @@ static void lsExit()
|
||||||
|
|
||||||
static void nbEnter()
|
static void nbEnter()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Enter state: NB\n");
|
||||||
screen->setOn(false);
|
screen->setOn(false);
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
|
|
||||||
|
@ -133,6 +136,7 @@ static void darkEnter()
|
||||||
|
|
||||||
static void serialEnter()
|
static void serialEnter()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Enter state: SERIAL\n");
|
||||||
setBluetoothEnable(false);
|
setBluetoothEnable(false);
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
screen->print("Serial connected\n");
|
screen->print("Serial connected\n");
|
||||||
|
@ -145,6 +149,7 @@ static void serialExit()
|
||||||
|
|
||||||
static void powerEnter()
|
static void powerEnter()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Enter state: POWER\n");
|
||||||
if (!isPowered()) {
|
if (!isPowered()) {
|
||||||
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
// If we got here, we are in the wrong state - we should be in powered, let that state ahndle things
|
||||||
DEBUG_MSG("Loss of power in Powered\n");
|
DEBUG_MSG("Loss of power in Powered\n");
|
||||||
|
@ -174,6 +179,7 @@ static void powerExit()
|
||||||
|
|
||||||
static void onEnter()
|
static void onEnter()
|
||||||
{
|
{
|
||||||
|
DEBUG_MSG("Enter state: ON\n");
|
||||||
screen->setOn(true);
|
screen->setOn(true);
|
||||||
setBluetoothEnable(true);
|
setBluetoothEnable(true);
|
||||||
|
|
||||||
|
@ -202,7 +208,9 @@ static void screenPress()
|
||||||
screen->onPress();
|
screen->onPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bootEnter() {}
|
static void bootEnter() {
|
||||||
|
DEBUG_MSG("Enter state: BOOT\n");
|
||||||
|
}
|
||||||
|
|
||||||
State stateSDS(sdsEnter, NULL, NULL, "SDS");
|
State stateSDS(sdsEnter, NULL, NULL, "SDS");
|
||||||
State stateLS(lsEnter, lsIdle, lsExit, "LS");
|
State stateLS(lsEnter, lsIdle, lsExit, "LS");
|
||||||
|
@ -226,10 +234,9 @@ void PowerFSM_setup()
|
||||||
// if we are a router node, we go to NB (no need for bluetooth) otherwise we go to DARK (so we can send message to phone)
|
// if we are a router node, we go to NB (no need for bluetooth) otherwise we go to DARK (so we can send message to phone)
|
||||||
powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer");
|
powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_WAKE_TIMER, NULL, "Wake timer");
|
||||||
|
|
||||||
// Note we don't really use this transition, because when we wake from light sleep we _always_ transition to NB or dark and
|
// We need this transition, because we might not transition if we were waiting to enter light-sleep, because when we wake from light sleep we _always_ transition to NB or dark and
|
||||||
// then it handles things powerFSM.add_transition(&stateLS, &stateNB, EVENT_RECEIVED_PACKET, NULL, "Received packet");
|
powerFSM.add_transition(&stateLS, isRouter ? &stateNB : &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Received packet, exiting light sleep");
|
||||||
|
powerFSM.add_transition(&stateNB, &stateNB, EVENT_PACKET_FOR_PHONE, NULL, "Received packet, resetting win wake");
|
||||||
powerFSM.add_transition(&stateNB, &stateNB, EVENT_RECEIVED_PACKET, NULL, "Received packet, resetting win wake");
|
|
||||||
|
|
||||||
// Handle press events - note: we ignore button presses when in API mode
|
// Handle press events - note: we ignore button presses when in API mode
|
||||||
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
powerFSM.add_transition(&stateLS, &stateON, EVENT_PRESS, NULL, "Press");
|
||||||
|
@ -253,6 +260,9 @@ void PowerFSM_setup()
|
||||||
|
|
||||||
// if we are a router we don't turn the screen on for these things
|
// if we are a router we don't turn the screen on for these things
|
||||||
if (!isRouter) {
|
if (!isRouter) {
|
||||||
|
// if any packet destined for phone arrives, turn on bluetooth at least
|
||||||
|
powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone");
|
||||||
|
|
||||||
// show the latest node when we get a new node db update
|
// show the latest node when we get a new node db update
|
||||||
powerFSM.add_transition(&stateNB, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
powerFSM.add_transition(&stateNB, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
powerFSM.add_transition(&stateDARK, &stateON, EVENT_NODEDB_UPDATED, NULL, "NodeDB update");
|
||||||
|
@ -292,8 +302,6 @@ void PowerFSM_setup()
|
||||||
powerFSM.add_transition(&stateDARK, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update");
|
powerFSM.add_transition(&stateDARK, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update");
|
||||||
powerFSM.add_transition(&stateON, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update");
|
powerFSM.add_transition(&stateON, &stateON, EVENT_FIRMWARE_UPDATE, NULL, "Got firmware update");
|
||||||
|
|
||||||
powerFSM.add_transition(&stateNB, &stateDARK, EVENT_PACKET_FOR_PHONE, NULL, "Packet for phone");
|
|
||||||
|
|
||||||
powerFSM.add_timed_transition(&stateON, &stateDARK, getPref_screen_on_secs() * 1000, NULL, "Screen-on timeout");
|
powerFSM.add_timed_transition(&stateON, &stateDARK, getPref_screen_on_secs() * 1000, NULL, "Screen-on timeout");
|
||||||
|
|
||||||
// On most boards we use light-sleep to be our main state, but on NRF52 we just stay in DARK
|
// On most boards we use light-sleep to be our main state, but on NRF52 we just stay in DARK
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#define EVENT_PRESS 1
|
#define EVENT_PRESS 1
|
||||||
#define EVENT_WAKE_TIMER 2
|
#define EVENT_WAKE_TIMER 2
|
||||||
#define EVENT_RECEIVED_PACKET 3
|
// #define EVENT_RECEIVED_PACKET 3
|
||||||
#define EVENT_PACKET_FOR_PHONE 4
|
#define EVENT_PACKET_FOR_PHONE 4
|
||||||
#define EVENT_RECEIVED_TEXT_MSG 5
|
#define EVENT_RECEIVED_TEXT_MSG 5
|
||||||
// #define EVENT_BOOT 6 // now done with a timed transition
|
// #define EVENT_BOOT 6 // now done with a timed transition
|
||||||
|
|
|
@ -946,7 +946,9 @@ void Screen::setFrames()
|
||||||
normalFrames[numframes++] = drawTextMessageFrame;
|
normalFrames[numframes++] = drawTextMessageFrame;
|
||||||
|
|
||||||
// then all the nodes
|
// then all the nodes
|
||||||
for (size_t i = 0; i < numnodes; i++)
|
// We only show a few nodes in our scrolling list - because meshes with many nodes would have too many screens
|
||||||
|
size_t numToShow = min(numnodes, 4U);
|
||||||
|
for (size_t i = 0; i < numToShow; i++)
|
||||||
normalFrames[numframes++] = drawNodeInfo;
|
normalFrames[numframes++] = drawNodeInfo;
|
||||||
|
|
||||||
// then the debug info
|
// then the debug info
|
||||||
|
|
|
@ -32,6 +32,10 @@ void CryptoEngine::decrypt(uint32_t fromNode, uint64_t packetNum, size_t numByte
|
||||||
void CryptoEngine::initNonce(uint32_t fromNode, uint64_t packetNum)
|
void CryptoEngine::initNonce(uint32_t fromNode, uint64_t packetNum)
|
||||||
{
|
{
|
||||||
memset(nonce, 0, sizeof(nonce));
|
memset(nonce, 0, sizeof(nonce));
|
||||||
*((uint64_t *)&nonce[0]) = packetNum;
|
|
||||||
*((uint32_t *)&nonce[8]) = fromNode;
|
// use memcpy to avoid breaking strict-aliasing
|
||||||
|
memcpy(nonce, &packetNum, sizeof(uint64_t));
|
||||||
|
memcpy(nonce + sizeof(uint64_t), &fromNode, sizeof(uint32_t));
|
||||||
|
//*((uint64_t *)&nonce[0]) = packetNum;
|
||||||
|
//*((uint32_t *)&nonce[8]) = fromNode;
|
||||||
}
|
}
|
|
@ -66,7 +66,7 @@ void MeshService::init()
|
||||||
|
|
||||||
int MeshService::handleFromRadio(const MeshPacket *mp)
|
int MeshService::handleFromRadio(const MeshPacket *mp)
|
||||||
{
|
{
|
||||||
powerFSM.trigger(EVENT_RECEIVED_PACKET); // Possibly keep the node from sleeping
|
powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping
|
||||||
|
|
||||||
printPacket("Forwarding to phone", mp);
|
printPacket("Forwarding to phone", mp);
|
||||||
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
||||||
|
|
|
@ -28,7 +28,7 @@ template <class T> class ProtobufPlugin : protected SinglePortPlugin
|
||||||
* In general decoded will always be !NULL. But in some special applications (where you have handling packets
|
* In general decoded will always be !NULL. But in some special applications (where you have handling packets
|
||||||
* for multiple port numbers, decoding will ONLY be attempted for packets where the portnum matches our expected ourPortNum.
|
* for multiple port numbers, decoding will ONLY be attempted for packets where the portnum matches our expected ourPortNum.
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const T *decoded) = 0;
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, T *decoded) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a mesh packet which has been preinited with a particular protobuf data payload and port number.
|
* Return a mesh packet which has been preinited with a particular protobuf data payload and port number.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
|
#include "concurrency/Periodic.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
|
@ -9,6 +10,8 @@
|
||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
|
using namespace concurrency;
|
||||||
|
|
||||||
static void WiFiEvent(WiFiEvent_t event);
|
static void WiFiEvent(WiFiEvent_t event);
|
||||||
|
|
||||||
// DNS Server for the Captive Portal
|
// DNS Server for the Captive Portal
|
||||||
|
@ -23,6 +26,47 @@ bool forcedSoftAP = 0;
|
||||||
|
|
||||||
bool APStartupComplete = 0;
|
bool APStartupComplete = 0;
|
||||||
|
|
||||||
|
static bool needReconnect = true; // If we create our reconnector, run it once at the beginning
|
||||||
|
|
||||||
|
// FIXME, veto light sleep if we have a TCP server running
|
||||||
|
#if 0
|
||||||
|
class WifiSleepObserver : public Observer<uint32_t> {
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/// Return 0 if sleep is okay
|
||||||
|
virtual int onNotify(uint32_t newValue) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static WifiSleepObserver wifiSleepObserver;
|
||||||
|
//preflightSleepObserver.observe(&preflightSleep);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int32_t reconnectWiFi()
|
||||||
|
{
|
||||||
|
if (radioConfig.has_preferences && needReconnect) {
|
||||||
|
|
||||||
|
const char *wifiName = radioConfig.preferences.wifi_ssid;
|
||||||
|
const char *wifiPsw = radioConfig.preferences.wifi_password;
|
||||||
|
|
||||||
|
if (!*wifiPsw) // Treat empty password as no password
|
||||||
|
wifiPsw = NULL;
|
||||||
|
|
||||||
|
if (*wifiName) {
|
||||||
|
needReconnect = false;
|
||||||
|
|
||||||
|
DEBUG_MSG("... Reconnecting to WiFi access point");
|
||||||
|
WiFi.mode(WIFI_MODE_STA);
|
||||||
|
WiFi.begin(wifiName, wifiPsw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 30 * 1000; // every 30 seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
static Periodic *wifiReconnect;
|
||||||
|
|
||||||
bool isSoftAPForced()
|
bool isSoftAPForced()
|
||||||
{
|
{
|
||||||
return forcedSoftAP;
|
return forcedSoftAP;
|
||||||
|
@ -155,12 +199,8 @@ void initWifi(bool forceSoftAP)
|
||||||
},
|
},
|
||||||
WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
|
WiFiEvent_t::SYSTEM_EVENT_STA_DISCONNECTED);
|
||||||
|
|
||||||
DEBUG_MSG("JOINING WIFI: ssid=%s\n", wifiName);
|
DEBUG_MSG("JOINING WIFI soon: ssid=%s\n", wifiName);
|
||||||
if (WiFi.begin(wifiName, wifiPsw) == WL_CONNECTED) {
|
wifiReconnect = new Periodic("WifiConnect", reconnectWiFi);
|
||||||
DEBUG_MSG("MY IP ADDRESS: %s\n", WiFi.localIP().toString().c_str());
|
|
||||||
} else {
|
|
||||||
DEBUG_MSG("Started Joining WIFI\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,10 +233,10 @@ static void WiFiEvent(WiFiEvent_t event)
|
||||||
DEBUG_MSG("Completed scan for access points\n");
|
DEBUG_MSG("Completed scan for access points\n");
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_START:
|
case SYSTEM_EVENT_STA_START:
|
||||||
DEBUG_MSG("WiFi client started\n");
|
DEBUG_MSG("WiFi station started\n");
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_STOP:
|
case SYSTEM_EVENT_STA_STOP:
|
||||||
DEBUG_MSG("WiFi clients stopped\n");
|
DEBUG_MSG("WiFi station stopped\n");
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_CONNECTED:
|
case SYSTEM_EVENT_STA_CONNECTED:
|
||||||
DEBUG_MSG("Connected to access point\n");
|
DEBUG_MSG("Connected to access point\n");
|
||||||
|
@ -205,7 +245,7 @@ static void WiFiEvent(WiFiEvent_t event)
|
||||||
DEBUG_MSG("Disconnected from WiFi access point\n");
|
DEBUG_MSG("Disconnected from WiFi access point\n");
|
||||||
// Event 5
|
// Event 5
|
||||||
|
|
||||||
reconnectWiFi();
|
needReconnect = true;
|
||||||
break;
|
break;
|
||||||
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
|
case SYSTEM_EVENT_STA_AUTHMODE_CHANGE:
|
||||||
DEBUG_MSG("Authentication mode of access point has changed\n");
|
DEBUG_MSG("Authentication mode of access point has changed\n");
|
||||||
|
@ -302,26 +342,6 @@ void handleDNSResponse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconnectWiFi()
|
|
||||||
{
|
|
||||||
if (radioConfig.has_preferences) {
|
|
||||||
|
|
||||||
const char *wifiName = radioConfig.preferences.wifi_ssid;
|
|
||||||
const char *wifiPsw = radioConfig.preferences.wifi_password;
|
|
||||||
|
|
||||||
if (!*wifiPsw) // Treat empty password as no password
|
|
||||||
wifiPsw = NULL;
|
|
||||||
|
|
||||||
if (*wifiName) {
|
|
||||||
|
|
||||||
DEBUG_MSG("... Reconnecting to WiFi access point");
|
|
||||||
|
|
||||||
WiFi.mode(WIFI_MODE_STA);
|
|
||||||
WiFi.begin(wifiName, wifiPsw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t getWifiDisconnectReason()
|
uint8_t getWifiDisconnectReason()
|
||||||
{
|
{
|
||||||
return wifiDisconnectReason;
|
return wifiDisconnectReason;
|
||||||
|
|
|
@ -16,8 +16,6 @@ bool isWifiAvailable();
|
||||||
|
|
||||||
void handleDNSResponse();
|
void handleDNSResponse();
|
||||||
|
|
||||||
void reconnectWiFi();
|
|
||||||
|
|
||||||
bool isSoftAPForced();
|
bool isSoftAPForced();
|
||||||
|
|
||||||
uint8_t getWifiDisconnectReason();
|
uint8_t getWifiDisconnectReason();
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "mesh/Channels.h"
|
#include "mesh/Channels.h"
|
||||||
#include "mesh/Router.h"
|
#include "mesh/Router.h"
|
||||||
#include "mesh/generated/mqtt.pb.h"
|
#include "mesh/generated/mqtt.pb.h"
|
||||||
|
#include "PowerFSM.h"
|
||||||
|
#include "sleep.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
@ -57,12 +59,14 @@ MQTT::MQTT() : concurrency::OSThread("mqtt"), pubSub(mqttClient)
|
||||||
mqtt = this;
|
mqtt = this;
|
||||||
|
|
||||||
pubSub.setCallback(mqttCallback);
|
pubSub.setCallback(mqttCallback);
|
||||||
|
|
||||||
|
// preflightSleepObserver.observe(&preflightSleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MQTT::reconnect()
|
void MQTT::reconnect()
|
||||||
{
|
{
|
||||||
// pubSub.setServer("devsrv.ezdevice.net", 1883); or 192.168.10.188
|
const char *serverAddr = "mqtt.meshtastic.org"; // default hostname
|
||||||
const char *serverAddr = "mqtt.meshtastic.org:1883"; // default hostname
|
int serverPort = 1883; // default server port
|
||||||
|
|
||||||
if (*radioConfig.preferences.mqtt_server)
|
if (*radioConfig.preferences.mqtt_server)
|
||||||
serverAddr = radioConfig.preferences.mqtt_server; // Override the default
|
serverAddr = radioConfig.preferences.mqtt_server; // Override the default
|
||||||
|
@ -70,15 +74,14 @@ void MQTT::reconnect()
|
||||||
String server = String(serverAddr);
|
String server = String(serverAddr);
|
||||||
int delimIndex = server.indexOf(':');
|
int delimIndex = server.indexOf(':');
|
||||||
if (delimIndex > 0) {
|
if (delimIndex > 0) {
|
||||||
String host = server.substring(0, delimIndex);
|
|
||||||
String port = server.substring(delimIndex+1, server.length());
|
String port = server.substring(delimIndex+1, server.length());
|
||||||
pubSub.setServer(host.c_str(), port.toInt());
|
server[delimIndex] = 0;
|
||||||
}
|
serverPort = port.toInt();
|
||||||
else {
|
serverAddr = server.c_str();
|
||||||
pubSub.setServer(serverAddr, 1883);
|
|
||||||
}
|
}
|
||||||
|
pubSub.setServer(serverAddr, serverPort);
|
||||||
|
|
||||||
DEBUG_MSG("Connecting to MQTT server\n", serverAddr);
|
DEBUG_MSG("Connecting to MQTT server %s, port: %d\n", serverAddr, serverPort);
|
||||||
auto myStatus = (statusTopic + owner.id);
|
auto myStatus = (statusTopic + owner.id);
|
||||||
bool connected = pubSub.connect(owner.id, "meshdev", "large4cats", myStatus.c_str(), 1, true, "offline");
|
bool connected = pubSub.connect(owner.id, "meshdev", "large4cats", myStatus.c_str(), 1, true, "offline");
|
||||||
if (connected) {
|
if (connected) {
|
||||||
|
@ -149,6 +152,7 @@ int32_t MQTT::runOnce()
|
||||||
pubSub.disconnect();
|
pubSub.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
powerFSM.trigger(EVENT_CONTACT_FROM_PHONE); // Suppress entering light sleep (because that would turn off bluetooth)
|
||||||
return 20;
|
return 20;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@ class MQTT : private concurrency::OSThread
|
||||||
WiFiClient mqttClient;
|
WiFiClient mqttClient;
|
||||||
PubSubClient pubSub;
|
PubSubClient pubSub;
|
||||||
|
|
||||||
|
// instead we supress sleep from our runOnce() callback
|
||||||
|
// CallbackObserver<MQTT, void *> preflightSleepObserver = CallbackObserver<MQTT, void *>(this, &MQTT::preflightSleepCb);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MQTT();
|
MQTT();
|
||||||
|
|
||||||
|
@ -53,6 +56,9 @@ class MQTT : private concurrency::OSThread
|
||||||
|
|
||||||
/// Called when a new publish arrives from the MQTT server
|
/// Called when a new publish arrives from the MQTT server
|
||||||
void onPublish(char *topic, byte *payload, unsigned int length);
|
void onPublish(char *topic, byte *payload, unsigned int length);
|
||||||
|
|
||||||
|
/// Return 0 if sleep is okay, veto sleep if we are connected to pubsub server
|
||||||
|
// int preflightSleepCb(void *unused = NULL) { return pubSub.connected() ? 1 : 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void mqttInit();
|
void mqttInit();
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <ble_gap.h>
|
#include <ble_gap.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <Adafruit_USBD_Device.h>
|
||||||
|
|
||||||
#include "NRF52Bluetooth.h"
|
#include "NRF52Bluetooth.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
@ -20,7 +21,8 @@ static inline void debugger_break(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool loopCanSleep() {
|
bool loopCanSleep() {
|
||||||
return !tud_cdc_connected();
|
// turn off sleep only while connected via USB
|
||||||
|
return !(TinyUSBDevice.mounted() && !TinyUSBDevice.suspended());
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle standard gcc assert failures
|
// handle standard gcc assert failures
|
||||||
|
@ -37,7 +39,7 @@ void getMacAddr(uint8_t *dmac)
|
||||||
ble_gap_addr_t addr;
|
ble_gap_addr_t addr;
|
||||||
if (sd_ble_gap_addr_get(&addr) == NRF_SUCCESS) {
|
if (sd_ble_gap_addr_get(&addr) == NRF_SUCCESS) {
|
||||||
memcpy(dmac, addr.addr, 6);
|
memcpy(dmac, addr.addr, 6);
|
||||||
} else {
|
} else {
|
||||||
const uint8_t *src = (const uint8_t *)NRF_FICR->DEVICEADDR;
|
const uint8_t *src = (const uint8_t *)NRF_FICR->DEVICEADDR;
|
||||||
dmac[5] = src[0];
|
dmac[5] = src[0];
|
||||||
dmac[4] = src[1];
|
dmac[4] = src[1];
|
||||||
|
|
|
@ -12,6 +12,24 @@
|
||||||
|
|
||||||
AdminPlugin *adminPlugin;
|
AdminPlugin *adminPlugin;
|
||||||
|
|
||||||
|
/// A special reserved string to indicate strings we can not share with external nodes. We will use this 'reserved' word instead.
|
||||||
|
/// Also, to make setting work correctly, if someone tries to set a string to this reserved value we assume they don't really want a change.
|
||||||
|
static const char *secretReserved = "sekrit";
|
||||||
|
|
||||||
|
/// If buf is !empty, change it to secret
|
||||||
|
static void hideSecret(char *buf) {
|
||||||
|
if(*buf) {
|
||||||
|
strcpy(buf, secretReserved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// If buf is the reserved secret word, replace the buffer with currentVal
|
||||||
|
static void writeSecret(char *buf, const char *currentVal) {
|
||||||
|
if(strcmp(buf, secretReserved) == 0) {
|
||||||
|
strcpy(buf, currentVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
void AdminPlugin::handleGetChannel(const MeshPacket &req, uint32_t channelIndex)
|
||||||
{
|
{
|
||||||
if (req.decoded.want_response) {
|
if (req.decoded.want_response) {
|
||||||
|
@ -35,13 +53,15 @@ void AdminPlugin::handleGetRadio(const MeshPacket &req)
|
||||||
// using to the app (so that even old phone apps work with new device loads).
|
// using to the app (so that even old phone apps work with new device loads).
|
||||||
r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
|
r.get_radio_response.preferences.ls_secs = getPref_ls_secs();
|
||||||
r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs();
|
r.get_radio_response.preferences.phone_timeout_secs = getPref_phone_timeout_secs();
|
||||||
|
// hideSecret(r.get_radio_response.preferences.wifi_ssid); // hmm - leave public for now, because only minimally private and useful for users to know current provisioning)
|
||||||
|
hideSecret(r.get_radio_response.preferences.wifi_password);
|
||||||
|
|
||||||
r.which_variant = AdminMessage_get_radio_response_tag;
|
r.which_variant = AdminMessage_get_radio_response_tag;
|
||||||
myReply = allocDataProtobuf(r);
|
myReply = allocDataProtobuf(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AdminPlugin::handleReceivedProtobuf(const MeshPacket &mp, const AdminMessage *r)
|
bool AdminPlugin::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
||||||
{
|
{
|
||||||
assert(r);
|
assert(r);
|
||||||
switch (r->which_variant) {
|
switch (r->which_variant) {
|
||||||
|
@ -139,8 +159,9 @@ void AdminPlugin::handleSetChannel(const Channel &cc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdminPlugin::handleSetRadio(const RadioConfig &r)
|
void AdminPlugin::handleSetRadio(RadioConfig &r)
|
||||||
{
|
{
|
||||||
|
writeSecret(r.preferences.wifi_password, radioConfig.preferences.wifi_password);
|
||||||
radioConfig = r;
|
radioConfig = r;
|
||||||
|
|
||||||
service.reloadConfig();
|
service.reloadConfig();
|
||||||
|
|
|
@ -17,12 +17,12 @@ class AdminPlugin : public ProtobufPlugin<AdminMessage>
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const AdminMessage *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleSetOwner(const User &o);
|
void handleSetOwner(const User &o);
|
||||||
void handleSetChannel(const Channel &cc);
|
void handleSetChannel(const Channel &cc);
|
||||||
void handleSetRadio(const RadioConfig &r);
|
void handleSetRadio(RadioConfig &r);
|
||||||
|
|
||||||
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
|
void handleGetChannel(const MeshPacket &req, uint32_t channelIndex);
|
||||||
void handleGetRadio(const MeshPacket &req);
|
void handleGetRadio(const MeshPacket &req);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
NodeInfoPlugin *nodeInfoPlugin;
|
NodeInfoPlugin *nodeInfoPlugin;
|
||||||
|
|
||||||
bool NodeInfoPlugin::handleReceivedProtobuf(const MeshPacket &mp, const User *pptr)
|
bool NodeInfoPlugin::handleReceivedProtobuf(const MeshPacket &mp, User *pptr)
|
||||||
{
|
{
|
||||||
auto p = *pptr;
|
auto p = *pptr;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ class NodeInfoPlugin : public ProtobufPlugin<User>, private concurrency::OSThrea
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const User *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, User *p);
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
|
|
|
@ -14,7 +14,7 @@ PositionPlugin::PositionPlugin()
|
||||||
setIntervalFromNow(60 * 1000); // Send our initial position 60 seconds after we start (to give GPS time to setup)
|
setIntervalFromNow(60 * 1000); // Send our initial position 60 seconds after we start (to give GPS time to setup)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PositionPlugin::handleReceivedProtobuf(const MeshPacket &mp, const Position *pptr)
|
bool PositionPlugin::handleReceivedProtobuf(const MeshPacket &mp, Position *pptr)
|
||||||
{
|
{
|
||||||
auto p = *pptr;
|
auto p = *pptr;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class PositionPlugin : public ProtobufPlugin<Position>, private concurrency::OST
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const Position *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Position *p);
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
|
|
|
@ -48,7 +48,7 @@ RemoteHardwarePlugin::RemoteHardwarePlugin()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, const HardwareMessage *pptr)
|
bool RemoteHardwarePlugin::handleReceivedProtobuf(const MeshPacket &req, HardwareMessage *pptr)
|
||||||
{
|
{
|
||||||
auto p = *pptr;
|
auto p = *pptr;
|
||||||
DEBUG_MSG("Received RemoteHardware typ=%d\n", p.typ);
|
DEBUG_MSG("Received RemoteHardware typ=%d\n", p.typ);
|
||||||
|
|
|
@ -27,7 +27,7 @@ class RemoteHardwarePlugin : public ProtobufPlugin<HardwareMessage>, private con
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const HardwareMessage *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, HardwareMessage *p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Periodically read the gpios we have been asked to WATCH, if they have changed,
|
* Periodically read the gpios we have been asked to WATCH, if they have changed,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
RoutingPlugin *routingPlugin;
|
RoutingPlugin *routingPlugin;
|
||||||
|
|
||||||
bool RoutingPlugin::handleReceivedProtobuf(const MeshPacket &mp, const Routing *r)
|
bool RoutingPlugin::handleReceivedProtobuf(const MeshPacket &mp, Routing *r)
|
||||||
{
|
{
|
||||||
printPacket("Routing sniffing", &mp);
|
printPacket("Routing sniffing", &mp);
|
||||||
router->sniffReceived(&mp, r);
|
router->sniffReceived(&mp, r);
|
||||||
|
|
|
@ -22,7 +22,7 @@ class RoutingPlugin : public ProtobufPlugin<Routing>
|
||||||
|
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const Routing *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, Routing *p);
|
||||||
|
|
||||||
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
/** Messages can be received that have the want_response bit set. If set, this callback will be invoked
|
||||||
* so that subclasses can (optionally) send a response back to the original sender. */
|
* so that subclasses can (optionally) send a response back to the original sender. */
|
||||||
|
|
|
@ -204,7 +204,7 @@ void EnvironmentalMeasurementPlugin::drawFrame(OLEDDisplay *display, OLEDDisplay
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EnvironmentalMeasurementPlugin::handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement *p)
|
bool EnvironmentalMeasurementPlugin::handleReceivedProtobuf(const MeshPacket &mp, EnvironmentalMeasurement *p)
|
||||||
{
|
{
|
||||||
if (!(radioConfig.preferences.environmental_measurement_plugin_measurement_enabled || radioConfig.preferences.environmental_measurement_plugin_screen_enabled)){
|
if (!(radioConfig.preferences.environmental_measurement_plugin_measurement_enabled || radioConfig.preferences.environmental_measurement_plugin_screen_enabled)){
|
||||||
// If this plugin is not enabled in any capacity, don't handle the packet, and allow other plugins to consume
|
// If this plugin is not enabled in any capacity, don't handle the packet, and allow other plugins to consume
|
||||||
|
|
|
@ -18,7 +18,7 @@ class EnvironmentalMeasurementPlugin : private concurrency::OSThread, public Pro
|
||||||
/** Called to handle a particular incoming message
|
/** Called to handle a particular incoming message
|
||||||
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
@return true if you've guaranteed you've handled this message and no other handlers should be considered for it
|
||||||
*/
|
*/
|
||||||
virtual bool handleReceivedProtobuf(const MeshPacket &mp, const EnvironmentalMeasurement *p);
|
virtual bool handleReceivedProtobuf(const MeshPacket &mp, EnvironmentalMeasurement *p);
|
||||||
virtual int32_t runOnce();
|
virtual int32_t runOnce();
|
||||||
/**
|
/**
|
||||||
* Send our EnvironmentalMeasurement into the mesh
|
* Send our EnvironmentalMeasurement into the mesh
|
||||||
|
|
Ładowanie…
Reference in New Issue