mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-22 04:54:47 +00:00
Merge branch 'meshtastic:master' into compression
This commit is contained in:
commit
d6b20ea623
2
.github/workflows/main_matrix.yml
vendored
2
.github/workflows/main_matrix.yml
vendored
@ -37,6 +37,7 @@ jobs:
|
|||||||
- board: rak4631
|
- board: rak4631
|
||||||
- board: rak4631_eink
|
- board: rak4631_eink
|
||||||
- board: t-echo
|
- board: t-echo
|
||||||
|
- board: nano-g1
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -91,6 +92,7 @@ jobs:
|
|||||||
- board: heltec-v2.1
|
- board: heltec-v2.1
|
||||||
- board: tbeam0.7
|
- board: tbeam0.7
|
||||||
- board: meshtastic-diy-v1
|
- board: meshtastic-diy-v1
|
||||||
|
- board: nano-g1
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -5,7 +5,7 @@ set -e
|
|||||||
VERSION=`bin/buildinfo.py long`
|
VERSION=`bin/buildinfo.py long`
|
||||||
SHORT_VERSION=`bin/buildinfo.py short`
|
SHORT_VERSION=`bin/buildinfo.py short`
|
||||||
|
|
||||||
BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1"
|
BOARDS_ESP32="rak11200 tlora-v2 tlora-v1 tlora_v1_3 tlora-v2-1-1.6 tbeam heltec-v1 heltec-v2.0 heltec-v2.1 tbeam0.7 meshtastic-diy-v1 nano-g1"
|
||||||
#BOARDS_ESP32=tbeam
|
#BOARDS_ESP32=tbeam
|
||||||
|
|
||||||
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
|
||||||
|
@ -70,6 +70,7 @@ src_filter = ${env.src_filter} -<portduino/>
|
|||||||
; Common libs for environmental measurements (not included in native / portduino)
|
; Common libs for environmental measurements (not included in native / portduino)
|
||||||
[environmental]
|
[environmental]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
adafruit/Adafruit BusIO@^1.11.4
|
||||||
adafruit/DHT sensor library@^1.4.1
|
adafruit/DHT sensor library@^1.4.1
|
||||||
adafruit/Adafruit Unified Sensor@^1.1.4
|
adafruit/Adafruit Unified Sensor@^1.1.4
|
||||||
paulstoffregen/OneWire@^2.3.5
|
paulstoffregen/OneWire@^2.3.5
|
||||||
|
2
proto
2
proto
@ -1 +1 @@
|
|||||||
Subproject commit a578453b3c17794b61fb6cf4470ecaac8287d6d2
|
Subproject commit 79d24080ff83b0a54bc1619f07f41f17ffedfb99
|
@ -135,7 +135,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
screen->adjustBrightness();
|
screen->adjustBrightness();
|
||||||
#endif
|
#endif
|
||||||
// If user button is held down for 5 seconds, shutdown the device.
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
if (millis() - longPressTime > 5 * 1000) {
|
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
||||||
#ifdef TBEAM_V10
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found == true) {
|
if (axp192_found == true) {
|
||||||
setLed(false);
|
setLed(false);
|
||||||
@ -144,7 +144,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
#elif NRF52_SERIES
|
#elif NRF52_SERIES
|
||||||
// Do actual shutdown when button released, otherwise the button release
|
// Do actual shutdown when button released, otherwise the button release
|
||||||
// may wake the board immediatedly.
|
// may wake the board immediatedly.
|
||||||
if (!shutdown_on_long_stop) {
|
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
DEBUG_MSG("Shutdown from long press");
|
DEBUG_MSG("Shutdown from long press");
|
||||||
playBeep();
|
playBeep();
|
||||||
@ -180,18 +180,22 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
|
|
||||||
static void userButtonPressedLongStart()
|
static void userButtonPressedLongStart()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Long press start!\n");
|
if (millis() > 30 * 1000) {
|
||||||
longPressTime = millis();
|
DEBUG_MSG("Long press start!\n");
|
||||||
|
longPressTime = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void userButtonPressedLongStop()
|
static void userButtonPressedLongStop()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Long press stop!\n");
|
if (millis() > 30 * 1000){
|
||||||
longPressTime = 0;
|
DEBUG_MSG("Long press stop!\n");
|
||||||
if (shutdown_on_long_stop) {
|
longPressTime = 0;
|
||||||
playShutdownMelody();
|
if (shutdown_on_long_stop) {
|
||||||
delay(3000);
|
playShutdownMelody();
|
||||||
power->shutdown();
|
delay(3000);
|
||||||
|
power->shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -63,7 +63,7 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
int32_t getLatitude() const {
|
int32_t getLatitude() const {
|
||||||
if (radioConfig.preferences.fixed_position){
|
if (radioConfig.preferences.fixed_position){
|
||||||
#if GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
DEBUG_MSG("WARNING: Using fixed latitude\n");
|
DEBUG_MSG("WARNING: Using fixed latitude\n");
|
||||||
#endif
|
#endif
|
||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
@ -75,7 +75,7 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
int32_t getLongitude() const {
|
int32_t getLongitude() const {
|
||||||
if (radioConfig.preferences.fixed_position){
|
if (radioConfig.preferences.fixed_position){
|
||||||
#if GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
DEBUG_MSG("WARNING: Using fixed longitude\n");
|
DEBUG_MSG("WARNING: Using fixed longitude\n");
|
||||||
#endif
|
#endif
|
||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
@ -87,7 +87,7 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
int32_t getAltitude() const {
|
int32_t getAltitude() const {
|
||||||
if (radioConfig.preferences.fixed_position){
|
if (radioConfig.preferences.fixed_position){
|
||||||
#if GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
DEBUG_MSG("WARNING: Using fixed altitude\n");
|
DEBUG_MSG("WARNING: Using fixed altitude\n");
|
||||||
#endif
|
#endif
|
||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
@ -105,7 +105,7 @@ class GPSStatus : public Status
|
|||||||
|
|
||||||
bool matches(const GPSStatus *newStatus) const
|
bool matches(const GPSStatus *newStatus) const
|
||||||
{
|
{
|
||||||
#if GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
DEBUG_MSG("GPSStatus.match() new pos@%x to old pos@%x\n",
|
DEBUG_MSG("GPSStatus.match() new pos@%x to old pos@%x\n",
|
||||||
newStatus->p.pos_timestamp, p.pos_timestamp);
|
newStatus->p.pos_timestamp, p.pos_timestamp);
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,12 +100,11 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
#ifndef ADC_MULTIPLIER
|
#ifndef ADC_MULTIPLIER
|
||||||
#define ADC_MULTIPLIER 2.0
|
#define ADC_MULTIPLIER 2.0
|
||||||
#endif
|
#endif
|
||||||
// Override variant or default ADC_MULTIPLIER if we have the override pref
|
|
||||||
float operativeAdcMultiplier = radioConfig.preferences.adc_multiplier_override > 0 ?
|
|
||||||
radioConfig.preferences.adc_multiplier_override :
|
|
||||||
ADC_MULTIPLIER;
|
|
||||||
|
|
||||||
#ifdef BATTERY_PIN
|
#ifdef BATTERY_PIN
|
||||||
|
// Override variant or default ADC_MULTIPLIER if we have the override pref
|
||||||
|
float operativeAdcMultiplier = radioConfig.preferences.adc_multiplier_override > 0 ?
|
||||||
|
radioConfig.preferences.adc_multiplier_override : ADC_MULTIPLIER;
|
||||||
// Do not call analogRead() often.
|
// Do not call analogRead() often.
|
||||||
const uint32_t min_read_interval = 5000;
|
const uint32_t min_read_interval = 5000;
|
||||||
if (millis() - last_read_time_ms > min_read_interval) {
|
if (millis() - last_read_time_ms > min_read_interval) {
|
||||||
|
@ -72,7 +72,7 @@ size_t RedirectablePrint::logDebug(const char *format, ...)
|
|||||||
|
|
||||||
// If we are the first message on a report, include the header
|
// If we are the first message on a report, include the header
|
||||||
if (!isContinuationMessage) {
|
if (!isContinuationMessage) {
|
||||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityFromNet);
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
||||||
if (rtc_sec > 0) {
|
if (rtc_sec > 0) {
|
||||||
long hms = rtc_sec % SEC_PER_DAY;
|
long hms = rtc_sec % SEC_PER_DAY;
|
||||||
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
||||||
|
@ -25,6 +25,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
#ifdef RV3028_RTC
|
||||||
|
#include "Melopero_RV3028.h"
|
||||||
|
#endif
|
||||||
|
#ifdef PCF8563_RTC
|
||||||
|
#include "pcf8563.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Version
|
// Version
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@ -100,6 +107,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define GPS_TX_PIN 12
|
#define GPS_TX_PIN 12
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TTGO_T_ECHO
|
||||||
|
#define GPS_UBLOX
|
||||||
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// LoRa SPI
|
// LoRa SPI
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
@ -54,7 +54,22 @@ void scanI2Cdevice(void)
|
|||||||
DEBUG_MSG("unknown display found\n");
|
DEBUG_MSG("unknown display found\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef RV3028_RTC
|
||||||
|
if (addr == RV3028_RTC){
|
||||||
|
rtc_found = addr;
|
||||||
|
DEBUG_MSG("RV3028 RTC found\n");
|
||||||
|
Melopero_RV3028 rtc;
|
||||||
|
rtc.initI2C();
|
||||||
|
rtc.writeToRegister(0x35,0x07); // no Clkout
|
||||||
|
rtc.writeToRegister(0x37,0xB4);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef PCF8563_RTC
|
||||||
|
if (addr == PCF8563_RTC){
|
||||||
|
rtc_found = addr;
|
||||||
|
DEBUG_MSG("PCF8563 RTC found\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (addr == CARDKB_ADDR) {
|
if (addr == CARDKB_ADDR) {
|
||||||
cardkb_found = addr;
|
cardkb_found = addr;
|
||||||
DEBUG_MSG("m5 cardKB found\n");
|
DEBUG_MSG("m5 cardKB found\n");
|
||||||
@ -81,7 +96,7 @@ void scanI2Cdevice(void)
|
|||||||
if (nDevices == 0)
|
if (nDevices == 0)
|
||||||
DEBUG_MSG("No I2C devices found\n");
|
DEBUG_MSG("No I2C devices found\n");
|
||||||
else
|
else
|
||||||
DEBUG_MSG("done\n");
|
DEBUG_MSG("%i I2C devices found\n",nDevices);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void scanI2Cdevice(void) {}
|
void scanI2Cdevice(void) {}
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
// proccess at once
|
// proccess at once
|
||||||
// static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
|
// static uint8_t trBytes[_max(_max(_max(_max(ToRadio_size, RadioConfig_size), User_size), MyNodeInfo_size), FromRadio_size)];
|
||||||
static uint8_t fromRadioBytes[FromRadio_size];
|
static uint8_t fromRadioBytes[FromRadio_size];
|
||||||
static uint8_t toRadioBytes[ToRadio_size];
|
|
||||||
|
|
||||||
static bool bleConnected;
|
|
||||||
|
|
||||||
NimBLECharacteristic *FromNumCharacteristic;
|
NimBLECharacteristic *FromNumCharacteristic;
|
||||||
NimBLEServer *bleServer;
|
NimBLEServer *bleServer;
|
||||||
|
@ -54,6 +54,56 @@ bool GPS::setupGPS()
|
|||||||
_serial_gps->write("$PCAS11,3*1E\r\n");
|
_serial_gps->write("$PCAS11,3*1E\r\n");
|
||||||
delay(250);
|
delay(250);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#ifdef GPS_UBLOX
|
||||||
|
// Set the UART port to output NMEA only
|
||||||
|
byte _message_nmea[] = {0xB5, 0x62, 0x06, 0x00, 0x14, 0x00,
|
||||||
|
0x01, 0x00, 0x00, 0x00, 0xC0, 0x08, 0x00, 0x00, 0x80, 0x25, 0x00, 0x00, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x91, 0xAF};
|
||||||
|
_serial_gps->write(_message_nmea,sizeof(_message_nmea));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// disable GGL
|
||||||
|
byte _message_GGL[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x05,0x3A};
|
||||||
|
_serial_gps->write(_message_GGL,sizeof(_message_GGL));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// disable GSA
|
||||||
|
byte _message_GSA[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x02, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x06,0x41};
|
||||||
|
_serial_gps->write(_message_GSA,sizeof(_message_GSA));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// disable GSV
|
||||||
|
byte _message_GSV[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x03, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x07,0x48};
|
||||||
|
_serial_gps->write(_message_GSV,sizeof(_message_GSV));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// disable VTG
|
||||||
|
byte _message_VTG[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x05, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x09,0x56};
|
||||||
|
_serial_gps->write(_message_VTG,sizeof(_message_VTG));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// enable RMC
|
||||||
|
byte _message_RMC[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x04, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x09,0x54};
|
||||||
|
_serial_gps->write(_message_RMC,sizeof(_message_RMC));
|
||||||
|
delay(250);
|
||||||
|
|
||||||
|
// enable GGA
|
||||||
|
byte _message_GGA[] = {0xB5, 0x62, 0x06, 0x01, 0x08, 0x00,
|
||||||
|
0xF0, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||||
|
0x05, 0x38};
|
||||||
|
_serial_gps->write(_message_GGA,sizeof(_message_GGA));
|
||||||
|
delay(250);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
|||||||
t.tm_year = d.year() - 1900;
|
t.tm_year = d.year() - 1900;
|
||||||
t.tm_isdst = false;
|
t.tm_isdst = false;
|
||||||
if (t.tm_mon > -1){
|
if (t.tm_mon > -1){
|
||||||
DEBUG_MSG("NMEA GPS time %d-%d-%d %d:%d:%d\n", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
|
DEBUG_MSG("NMEA GPS time %02d-%02d-%02d %02d:%02d:%02d\n", d.year(), d.month(), t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
|
||||||
perhapsSetRTC(RTCQualityGPS, t);
|
perhapsSetRTC(RTCQualityGPS, t);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
@ -129,10 +129,16 @@ bool NMEAGPS::lookForLocation()
|
|||||||
auto loc = reader.location.value();
|
auto loc = reader.location.value();
|
||||||
|
|
||||||
// Bail out EARLY to avoid overwriting previous good data (like #857)
|
// Bail out EARLY to avoid overwriting previous good data (like #857)
|
||||||
if((toDegInt(loc.lat) == 0) || (toDegInt(loc.lat) > 90)) {
|
if (toDegInt(loc.lat) > 900000000) {
|
||||||
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
|
DEBUG_MSG("Bail out EARLY on LAT %i\n",toDegInt(loc.lat));
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if((toDegInt(loc.lng) == 0) || (toDegInt(loc.lng) > 180)) {
|
if (toDegInt(loc.lng) > 1800000000) {
|
||||||
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
|
DEBUG_MSG("Bail out EARLY on LNG %i\n",toDegInt(loc.lng));
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "RTC.h"
|
#include "RTC.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
#include "main.h"
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
@ -18,14 +19,57 @@ static uint64_t zeroOffsetSecs; // GPS based time in secs since 1970 - only upda
|
|||||||
void readFromRTC()
|
void readFromRTC()
|
||||||
{
|
{
|
||||||
struct timeval tv; /* btw settimeofday() is helpfull here too*/
|
struct timeval tv; /* btw settimeofday() is helpfull here too*/
|
||||||
|
#ifdef RV3028_RTC
|
||||||
|
if(rtc_found == RV3028_RTC) {
|
||||||
|
uint32_t now = millis();
|
||||||
|
Melopero_RV3028 rtc;
|
||||||
|
rtc.initI2C();
|
||||||
|
tm t;
|
||||||
|
t.tm_year = rtc.getYear() - 1900;
|
||||||
|
t.tm_mon = rtc.getMonth() - 1;
|
||||||
|
t.tm_mday = rtc.getDate();
|
||||||
|
t.tm_hour = rtc.getHour();
|
||||||
|
t.tm_min = rtc.getMinute();
|
||||||
|
t.tm_sec = rtc.getSecond();
|
||||||
|
tv.tv_sec = mktime(&t);
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
DEBUG_MSG("Read RTC time from RV3028 as %ld\n", tv.tv_sec);
|
||||||
|
timeStartMsec = now;
|
||||||
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
|
if (currentQuality == RTCQualityNone) {
|
||||||
|
currentQuality = RTCQualityDevice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#elif defined(PCF8563_RTC)
|
||||||
|
if(rtc_found == PCF8563_RTC) {
|
||||||
|
uint32_t now = millis();
|
||||||
|
PCF8563_Class rtc;
|
||||||
|
rtc.begin();
|
||||||
|
auto tc = rtc.getDateTime();
|
||||||
|
tm t;
|
||||||
|
t.tm_year = tc.year;
|
||||||
|
t.tm_mon = tc.month;
|
||||||
|
t.tm_mday = tc.day;
|
||||||
|
t.tm_hour = tc.hour;
|
||||||
|
t.tm_min = tc.minute;
|
||||||
|
t.tm_sec = tc.second;
|
||||||
|
tv.tv_sec = mktime(&t);
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
DEBUG_MSG("Read RTC time from PCF8563 as %ld\n", tv.tv_sec);
|
||||||
|
timeStartMsec = now;
|
||||||
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
|
if (currentQuality == RTCQualityNone) {
|
||||||
|
currentQuality = RTCQualityDevice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!gettimeofday(&tv, NULL)) {
|
if (!gettimeofday(&tv, NULL)) {
|
||||||
uint32_t now = millis();
|
uint32_t now = millis();
|
||||||
|
DEBUG_MSG("Read RTC time as %ld\n", tv.tv_sec);
|
||||||
DEBUG_MSG("Read RTC time as %ld (cur millis %u) quality=%d\n", tv.tv_sec, now, currentQuality);
|
|
||||||
timeStartMsec = now;
|
timeStartMsec = now;
|
||||||
zeroOffsetSecs = tv.tv_sec;
|
zeroOffsetSecs = tv.tv_sec;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If we haven't yet set our RTC this boot, set it from a GPS derived time
|
/// If we haven't yet set our RTC this boot, set it from a GPS derived time
|
||||||
@ -55,12 +99,28 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
|
|||||||
zeroOffsetSecs = tv->tv_sec;
|
zeroOffsetSecs = tv->tv_sec;
|
||||||
|
|
||||||
// If this platform has a setable RTC, set it
|
// If this platform has a setable RTC, set it
|
||||||
#ifndef NO_ESP32
|
#ifdef RV3028_RTC
|
||||||
|
if(rtc_found == RV3028_RTC) {
|
||||||
|
Melopero_RV3028 rtc;
|
||||||
|
rtc.initI2C();
|
||||||
|
tm *t = localtime(&tv->tv_sec);
|
||||||
|
rtc.setTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
|
DEBUG_MSG("RV3028_RTC setTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);
|
||||||
|
}
|
||||||
|
#elif defined(PCF8563_RTC)
|
||||||
|
if(rtc_found == PCF8563_RTC) {
|
||||||
|
PCF8563_Class rtc;
|
||||||
|
rtc.begin();
|
||||||
|
tm *t = localtime(&tv->tv_sec);
|
||||||
|
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_hour, t->tm_min, t->tm_sec);
|
||||||
|
DEBUG_MSG("PCF8563_RTC setDateTime %02d-%02d-%02d %02d:%02d:%02d %ld\n", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec, tv->tv_sec);
|
||||||
|
}
|
||||||
|
#elif !defined(NO_ESP32)
|
||||||
settimeofday(tv, NULL);
|
settimeofday(tv, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// nrf52 doesn't have a readable RTC (yet - software not written)
|
// nrf52 doesn't have a readable RTC (yet - software not written)
|
||||||
#if defined(PORTDUINO) || !defined(NO_ESP32)
|
#if defined(PORTDUINO) || !defined(NO_ESP32) || defined(RV3028_RTC)
|
||||||
readFromRTC();
|
readFromRTC();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5,17 +5,21 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
enum RTCQuality {
|
enum RTCQuality {
|
||||||
|
|
||||||
/// We haven't had our RTC set yet
|
/// We haven't had our RTC set yet
|
||||||
RTCQualityNone = 0,
|
RTCQualityNone = 0,
|
||||||
|
|
||||||
|
/// We got time from an onboard peripheral after boot.
|
||||||
|
RTCQualityDevice = 1,
|
||||||
|
|
||||||
/// Some other node gave us a time we can use
|
/// Some other node gave us a time we can use
|
||||||
RTCQualityFromNet = 1,
|
RTCQualityFromNet = 2,
|
||||||
|
|
||||||
/// Our time is based on NTP
|
/// Our time is based on NTP
|
||||||
RTCQualityNTP= 2,
|
RTCQualityNTP= 3,
|
||||||
|
|
||||||
/// Our time is based on our own GPS
|
/// Our time is based on our own GPS
|
||||||
RTCQualityGPS = 3
|
RTCQualityGPS = 4
|
||||||
};
|
};
|
||||||
|
|
||||||
RTCQuality getRTCQuality();
|
RTCQuality getRTCQuality();
|
||||||
|
@ -1557,7 +1557,7 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat
|
|||||||
else
|
else
|
||||||
uptime += String(seconds) + "s ";
|
uptime += String(seconds) + "s ";
|
||||||
|
|
||||||
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityFromNet);
|
uint32_t rtc_sec = getValidTime(RTCQuality::RTCQualityDevice);
|
||||||
if (rtc_sec > 0) {
|
if (rtc_sec > 0) {
|
||||||
long hms = rtc_sec % SEC_PER_DAY;
|
long hms = rtc_sec % SEC_PER_DAY;
|
||||||
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
// hms += tz.tz_dsttime * SEC_PER_HOUR;
|
||||||
|
@ -79,6 +79,9 @@ uint8_t cardkb_found;
|
|||||||
// The I2C address of the Faces Keyboard (if found)
|
// The I2C address of the Faces Keyboard (if found)
|
||||||
uint8_t faceskb_found;
|
uint8_t faceskb_found;
|
||||||
|
|
||||||
|
// The I2C address of the RTC Module (if found)
|
||||||
|
uint8_t rtc_found;
|
||||||
|
|
||||||
bool eink_found = true;
|
bool eink_found = true;
|
||||||
|
|
||||||
uint32_t serialSinceMsec;
|
uint32_t serialSinceMsec;
|
||||||
@ -153,6 +156,12 @@ void setup()
|
|||||||
|
|
||||||
initDeepSleep();
|
initDeepSleep();
|
||||||
|
|
||||||
|
// Testing this fix für erratic T-Echo boot behaviour
|
||||||
|
#if defined(TTGO_T_ECHO) && defined(PIN_EINK_PWR_ON)
|
||||||
|
pinMode(PIN_EINK_PWR_ON, OUTPUT);
|
||||||
|
digitalWrite(PIN_EINK_PWR_ON, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VEXT_ENABLE
|
#ifdef VEXT_ENABLE
|
||||||
pinMode(VEXT_ENABLE, OUTPUT);
|
pinMode(VEXT_ENABLE, OUTPUT);
|
||||||
digitalWrite(VEXT_ENABLE, 0); // turn on the display power
|
digitalWrite(VEXT_ENABLE, 0); // turn on the display power
|
||||||
|
@ -9,6 +9,7 @@ extern uint8_t screen_found;
|
|||||||
extern uint8_t screen_model;
|
extern uint8_t screen_model;
|
||||||
extern uint8_t cardkb_found;
|
extern uint8_t cardkb_found;
|
||||||
extern uint8_t faceskb_found;
|
extern uint8_t faceskb_found;
|
||||||
|
extern uint8_t rtc_found;
|
||||||
|
|
||||||
extern bool eink_found;
|
extern bool eink_found;
|
||||||
extern bool axp192_found;
|
extern bool axp192_found;
|
||||||
|
@ -71,17 +71,7 @@ int MeshService::handleFromRadio(const MeshPacket *mp)
|
|||||||
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
|
||||||
|
|
||||||
fromNum++;
|
sendToPhone((MeshPacket *)mp);
|
||||||
|
|
||||||
if (toPhoneQueue.numFree() == 0) {
|
|
||||||
DEBUG_MSG("NOTE: tophone queue is full, discarding oldest\n");
|
|
||||||
MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
|
||||||
if (d)
|
|
||||||
releaseToPool(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
MeshPacket *copied = packetPool.allocCopy(*mp);
|
|
||||||
assert(toPhoneQueue.enqueue(copied, 0)); // FIXME, instead of failing for full queue, delete the oldest mssages
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -161,12 +151,16 @@ bool MeshService::cancelSending(PacketId id)
|
|||||||
return router->cancelSending(nodeDB.getNodeNum(), id);
|
return router->cancelSending(nodeDB.getNodeNum(), id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshService::sendToMesh(MeshPacket *p, RxSource src)
|
void MeshService::sendToMesh(MeshPacket *p, RxSource src, bool ccToPhone)
|
||||||
{
|
{
|
||||||
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
nodeDB.updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
||||||
|
|
||||||
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
|
// Note: We might return !OK if our fifo was full, at that point the only option we have is to drop it
|
||||||
router->sendLocal(p, src);
|
router->sendLocal(p, src);
|
||||||
|
|
||||||
|
if (ccToPhone) {
|
||||||
|
sendToPhone(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
||||||
@ -187,6 +181,20 @@ void MeshService::sendNetworkPing(NodeNum dest, bool wantReplies)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MeshService::sendToPhone(MeshPacket *p) {
|
||||||
|
if (toPhoneQueue.numFree() == 0) {
|
||||||
|
DEBUG_MSG("NOTE: tophone queue is full, discarding oldest\n");
|
||||||
|
MeshPacket *d = toPhoneQueue.dequeuePtr(0);
|
||||||
|
if (d)
|
||||||
|
releaseToPool(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
MeshPacket *copied = packetPool.allocCopy(*p);
|
||||||
|
perhapsDecode(copied);
|
||||||
|
assert(toPhoneQueue.enqueue(copied, 0)); // FIXME, instead of failing for full queue, delete the oldest mssages
|
||||||
|
fromNum++;
|
||||||
|
}
|
||||||
|
|
||||||
NodeInfo *MeshService::refreshMyNodeInfo()
|
NodeInfo *MeshService::refreshMyNodeInfo()
|
||||||
{
|
{
|
||||||
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum());
|
||||||
@ -224,7 +232,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *newStatus)
|
|||||||
} else {
|
} else {
|
||||||
// The GPS has lost lock, if we are fixed position we should just keep using
|
// The GPS has lost lock, if we are fixed position we should just keep using
|
||||||
// the old position
|
// the old position
|
||||||
#if GPS_EXTRAVERBOSE
|
#ifdef GPS_EXTRAVERBOSE
|
||||||
DEBUG_MSG("onGPSchanged() - lost validLocation\n");
|
DEBUG_MSG("onGPSchanged() - lost validLocation\n");
|
||||||
#endif
|
#endif
|
||||||
if (radioConfig.preferences.fixed_position) {
|
if (radioConfig.preferences.fixed_position) {
|
||||||
|
@ -75,7 +75,7 @@ class MeshService
|
|||||||
/// Send a packet into the mesh - note p must have been allocated from packetPool. We will return it to that pool after
|
/// Send a packet into the mesh - note p must have been allocated from packetPool. We will return it to that pool after
|
||||||
/// sending. This is the ONLY function you should use for sending messages into the mesh, because it also updates the nodedb
|
/// sending. This is the ONLY function you should use for sending messages into the mesh, because it also updates the nodedb
|
||||||
/// cache
|
/// cache
|
||||||
void sendToMesh(MeshPacket *p, RxSource src = RX_SRC_LOCAL);
|
void sendToMesh(MeshPacket *p, RxSource src = RX_SRC_LOCAL, bool ccToPhone = false);
|
||||||
|
|
||||||
/** Attempt to cancel a previously sent packet from this _local_ node. Returns true if a packet was found we could cancel */
|
/** Attempt to cancel a previously sent packet from this _local_ node. Returns true if a packet was found we could cancel */
|
||||||
bool cancelSending(PacketId id);
|
bool cancelSending(PacketId id);
|
||||||
@ -83,6 +83,9 @@ class MeshService
|
|||||||
/// Pull the latest power and time info into my nodeinfo
|
/// Pull the latest power and time info into my nodeinfo
|
||||||
NodeInfo *refreshMyNodeInfo();
|
NodeInfo *refreshMyNodeInfo();
|
||||||
|
|
||||||
|
/// Send a packet to the phone
|
||||||
|
void sendToPhone(MeshPacket *p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Called when our gps position has changed - updates nodedb and sends Location message out into the mesh
|
/// Called when our gps position has changed - updates nodedb and sends Location message out into the mesh
|
||||||
/// returns 0 to allow futher processing
|
/// returns 0 to allow futher processing
|
||||||
|
@ -35,6 +35,7 @@ NodeDB nodeDB;
|
|||||||
EXT_RAM_ATTR DeviceState devicestate;
|
EXT_RAM_ATTR DeviceState devicestate;
|
||||||
MyNodeInfo &myNodeInfo = devicestate.my_node;
|
MyNodeInfo &myNodeInfo = devicestate.my_node;
|
||||||
RadioConfig radioConfig;
|
RadioConfig radioConfig;
|
||||||
|
Config config;
|
||||||
ChannelFile channelFile;
|
ChannelFile channelFile;
|
||||||
|
|
||||||
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
|
/** The current change # for radio settings. Starts at 0 on boot and any time the radio settings
|
||||||
@ -142,6 +143,11 @@ bool NodeDB::resetRadioConfig()
|
|||||||
return didFactoryReset;
|
return didFactoryReset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeDB::installDefaultConfig()
|
||||||
|
{
|
||||||
|
memset(&config, 0, sizeof(config));
|
||||||
|
}
|
||||||
|
|
||||||
void NodeDB::installDefaultRadioConfig()
|
void NodeDB::installDefaultRadioConfig()
|
||||||
{
|
{
|
||||||
memset(&radioConfig, 0, sizeof(radioConfig));
|
memset(&radioConfig, 0, sizeof(radioConfig));
|
||||||
@ -280,6 +286,7 @@ void NodeDB::pickNewNodeNum()
|
|||||||
|
|
||||||
static const char *preffile = "/prefs/db.proto";
|
static const char *preffile = "/prefs/db.proto";
|
||||||
static const char *radiofile = "/prefs/radio.proto";
|
static const char *radiofile = "/prefs/radio.proto";
|
||||||
|
static const char *configfile = "/prefs/config.proto";
|
||||||
static const char *channelfile = "/prefs/channels.proto";
|
static const char *channelfile = "/prefs/channels.proto";
|
||||||
|
|
||||||
/** Load a protobuf from a file, return true for success */
|
/** Load a protobuf from a file, return true for success */
|
||||||
@ -332,6 +339,10 @@ void NodeDB::loadFromDisk()
|
|||||||
installDefaultRadioConfig(); // Our in RAM copy might now be corrupt
|
installDefaultRadioConfig(); // Our in RAM copy might now be corrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!loadProto(configfile, Config_size, sizeof(Config), Config_fields, &config)) {
|
||||||
|
installDefaultConfig(); // Our in RAM copy might now be corrupt
|
||||||
|
}
|
||||||
|
|
||||||
if (!loadProto(channelfile, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile)) {
|
if (!loadProto(channelfile, ChannelFile_size, sizeof(ChannelFile), ChannelFile_fields, &channelFile)) {
|
||||||
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
installDefaultChannels(); // Our in RAM copy might now be corrupt
|
||||||
}
|
}
|
||||||
@ -390,6 +401,7 @@ void NodeDB::saveToDisk()
|
|||||||
#endif
|
#endif
|
||||||
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
saveProto(preffile, DeviceState_size, sizeof(devicestate), DeviceState_fields, &devicestate);
|
||||||
saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
saveProto(radiofile, RadioConfig_size, sizeof(RadioConfig), RadioConfig_fields, &radioConfig);
|
||||||
|
saveProto(configfile, Config_size, sizeof(Config), Config_fields, &config);
|
||||||
saveChannelsToDisk();
|
saveChannelsToDisk();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,6 +12,7 @@ extern DeviceState devicestate;
|
|||||||
extern ChannelFile channelFile;
|
extern ChannelFile channelFile;
|
||||||
extern MyNodeInfo &myNodeInfo;
|
extern MyNodeInfo &myNodeInfo;
|
||||||
extern RadioConfig radioConfig;
|
extern RadioConfig radioConfig;
|
||||||
|
extern Config config;
|
||||||
extern User &owner;
|
extern User &owner;
|
||||||
|
|
||||||
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
/// Given a node, return how many seconds in the past (vs now) that we last heard from it
|
||||||
@ -122,7 +123,7 @@ class NodeDB
|
|||||||
void loadFromDisk();
|
void loadFromDisk();
|
||||||
|
|
||||||
/// Reinit device state from scratch (not loading from disk)
|
/// Reinit device state from scratch (not loading from disk)
|
||||||
void installDefaultDeviceState(), installDefaultRadioConfig(), installDefaultChannels();
|
void installDefaultDeviceState(), installDefaultRadioConfig(), installDefaultChannels(), installDefaultConfig();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,13 +162,17 @@ extern NodeDB nodeDB;
|
|||||||
|
|
||||||
#define IF_ROUTER(routerVal, normalVal) ((radioConfig.preferences.role == Role_Router) ? (routerVal) : (normalVal))
|
#define IF_ROUTER(routerVal, normalVal) ((radioConfig.preferences.role == Role_Router) ? (routerVal) : (normalVal))
|
||||||
|
|
||||||
|
#define default_broadcast_interval_secs IF_ROUTER(12 * 60 * 60, 15 * 60)
|
||||||
|
|
||||||
|
inline uint32_t getIntervalOrDefaultMs(uint32_t interval) {
|
||||||
|
if (interval > 0) return interval * 1000;
|
||||||
|
return default_broadcast_interval_secs * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
#define PREF_GET(name, defaultVal) \
|
#define PREF_GET(name, defaultVal) \
|
||||||
inline uint32_t getPref_##name() { return radioConfig.preferences.name ? radioConfig.preferences.name : (defaultVal); }
|
inline uint32_t getPref_##name() { return radioConfig.preferences.name ? radioConfig.preferences.name : (defaultVal); }
|
||||||
|
|
||||||
PREF_GET(position_broadcast_secs, IF_ROUTER(12 * 60 * 60, 15 * 60))
|
PREF_GET(position_broadcast_secs, IF_ROUTER(12 * 60 * 60, 15 * 60))
|
||||||
// Defaulting Telemetry to the same as position interval for now
|
|
||||||
PREF_GET(telemetry_module_device_update_interval, IF_ROUTER(12 * 60 * 60, 15 * 60))
|
|
||||||
PREF_GET(telemetry_module_environment_update_interval, IF_ROUTER(12 * 60 * 60, 15 * 60))
|
|
||||||
|
|
||||||
|
|
||||||
// Each time we wake into the DARK state allow 1 minute to send and receive BLE packets to the phone
|
// Each time we wake into the DARK state allow 1 minute to send and receive BLE packets to the phone
|
||||||
@ -189,3 +194,5 @@ PREF_GET(min_wake_secs, 10)
|
|||||||
*/
|
*/
|
||||||
extern uint32_t radioGeneration;
|
extern uint32_t radioGeneration;
|
||||||
|
|
||||||
|
// Config doesn't have a nanopb generated full size constant
|
||||||
|
#define Config_size (Config_DeviceConfig_size + Config_DisplayConfig_size + Config_GpsConfig_size + Config_LoRaConfig_size + Config_ModuleConfig_CannedMessageConfig_size + Config_ModuleConfig_ExternalNotificationConfig_size + Config_ModuleConfig_MQTTConfig_size + Config_ModuleConfig_RangeTestConfig_size + Config_ModuleConfig_SerialConfig_size + Config_ModuleConfig_StoreForwardConfig_size + Config_ModuleConfig_TelemetryConfig_size + Config_ModuleConfig_size + Config_PowerConfig_size)
|
@ -65,7 +65,7 @@ bool SX126xInterface<T>::init()
|
|||||||
#ifdef SX126X_TXEN
|
#ifdef SX126X_TXEN
|
||||||
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
// lora.begin sets Dio2 as RF switch control, which is not true if we are manually controlling RX and TX
|
||||||
if (res == ERR_NONE)
|
if (res == ERR_NONE)
|
||||||
res = lora.setDio2AsRfSwitch(false);
|
res = lora.setDio2AsRfSwitch(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -194,6 +194,9 @@ void SX126xInterface<T>::configHardwareForSend()
|
|||||||
#ifdef SX126X_TXEN // we have RXEN/TXEN control - turn on TX power / off RX power
|
#ifdef SX126X_TXEN // we have RXEN/TXEN control - turn on TX power / off RX power
|
||||||
digitalWrite(SX126X_TXEN, HIGH);
|
digitalWrite(SX126X_TXEN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SX126X_RXEN
|
||||||
|
digitalWrite(SX126X_RXEN, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
RadioLibInterface::configHardwareForSend();
|
RadioLibInterface::configHardwareForSend();
|
||||||
}
|
}
|
||||||
@ -213,7 +216,10 @@ void SX126xInterface<T>::startReceive()
|
|||||||
#ifdef SX126X_RXEN // we have RXEN/TXEN control - turn on RX power / off TX power
|
#ifdef SX126X_RXEN // we have RXEN/TXEN control - turn on RX power / off TX power
|
||||||
digitalWrite(SX126X_RXEN, HIGH);
|
digitalWrite(SX126X_RXEN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SX126X_TXEN
|
||||||
|
digitalWrite(SX126X_TXEN, LOW);
|
||||||
|
#endif
|
||||||
|
|
||||||
// int err = lora.startReceive();
|
// int err = lora.startReceive();
|
||||||
int err = lora.startReceiveDutyCycleAuto(); // We use a 32 bit preamble so this should save some power by letting radio sit in
|
int err = lora.startReceiveDutyCycleAuto(); // We use a 32 bit preamble so this should save some power by letting radio sit in
|
||||||
// standby mostly.
|
// standby mostly.
|
||||||
@ -283,4 +289,4 @@ bool SX126xInterface<T>::sleep()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,4 @@ PB_BIND(AdminMessage, AdminMessage, 2)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#define PB_ADMIN_PB_H_INCLUDED
|
#define PB_ADMIN_PB_H_INCLUDED
|
||||||
#include <pb.h>
|
#include <pb.h>
|
||||||
#include "channel.pb.h"
|
#include "channel.pb.h"
|
||||||
|
#include "config.pb.h"
|
||||||
#include "mesh.pb.h"
|
#include "mesh.pb.h"
|
||||||
#include "radioconfig.pb.h"
|
#include "radioconfig.pb.h"
|
||||||
|
|
||||||
@ -12,6 +13,26 @@
|
|||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Enum definitions */
|
||||||
|
typedef enum _AdminMessage_ConfigType {
|
||||||
|
AdminMessage_ConfigType_ALL = 0,
|
||||||
|
AdminMessage_ConfigType_CORE_ONLY = 1,
|
||||||
|
AdminMessage_ConfigType_MODULE_ONLY = 2,
|
||||||
|
AdminMessage_ConfigType_DEVICE_CONFIG = 3,
|
||||||
|
AdminMessage_ConfigType_GPS_CONFIG = 4,
|
||||||
|
AdminMessage_ConfigType_POWER_CONFIG = 5,
|
||||||
|
AdminMessage_ConfigType_WIFI_CONFIG = 6,
|
||||||
|
AdminMessage_ConfigType_DISPLAY_CONFIG = 7,
|
||||||
|
AdminMessage_ConfigType_LORA_CONFIG = 8,
|
||||||
|
AdminMessage_ConfigType_MODULE_MQTT_CONFIG = 9,
|
||||||
|
AdminMessage_ConfigType_MODULE_SERIAL_CONFIG = 10,
|
||||||
|
AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG = 11,
|
||||||
|
AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG = 12,
|
||||||
|
AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG = 13,
|
||||||
|
AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG = 14,
|
||||||
|
AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG = 15
|
||||||
|
} AdminMessage_ConfigType;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
/* This message is handled by the Admin module and is responsible for all settings/channel read/write operations.
|
||||||
This message is used to do settings operations to both remote AND local nodes.
|
This message is used to do settings operations to both remote AND local nodes.
|
||||||
@ -29,6 +50,10 @@ typedef struct _AdminMessage {
|
|||||||
Channel get_channel_response;
|
Channel get_channel_response;
|
||||||
bool get_owner_request;
|
bool get_owner_request;
|
||||||
User get_owner_response;
|
User get_owner_response;
|
||||||
|
AdminMessage_ConfigType get_config_request;
|
||||||
|
Config get_config_response;
|
||||||
|
Config set_config;
|
||||||
|
bool confirm_set_config;
|
||||||
bool confirm_set_channel;
|
bool confirm_set_channel;
|
||||||
bool confirm_set_radio;
|
bool confirm_set_radio;
|
||||||
bool exit_simulator;
|
bool exit_simulator;
|
||||||
@ -50,6 +75,12 @@ typedef struct _AdminMessage {
|
|||||||
} AdminMessage;
|
} AdminMessage;
|
||||||
|
|
||||||
|
|
||||||
|
/* Helper constants for enums */
|
||||||
|
#define _AdminMessage_ConfigType_MIN AdminMessage_ConfigType_ALL
|
||||||
|
#define _AdminMessage_ConfigType_MAX AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG
|
||||||
|
#define _AdminMessage_ConfigType_ARRAYSIZE ((AdminMessage_ConfigType)(AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG+1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -68,6 +99,10 @@ extern "C" {
|
|||||||
#define AdminMessage_get_channel_response_tag 7
|
#define AdminMessage_get_channel_response_tag 7
|
||||||
#define AdminMessage_get_owner_request_tag 8
|
#define AdminMessage_get_owner_request_tag 8
|
||||||
#define AdminMessage_get_owner_response_tag 9
|
#define AdminMessage_get_owner_response_tag 9
|
||||||
|
#define AdminMessage_get_config_request_tag 10
|
||||||
|
#define AdminMessage_get_config_response_tag 11
|
||||||
|
#define AdminMessage_set_config_tag 12
|
||||||
|
#define AdminMessage_confirm_set_config_tag 13
|
||||||
#define AdminMessage_confirm_set_channel_tag 32
|
#define AdminMessage_confirm_set_channel_tag 32
|
||||||
#define AdminMessage_confirm_set_radio_tag 33
|
#define AdminMessage_confirm_set_radio_tag 33
|
||||||
#define AdminMessage_exit_simulator_tag 34
|
#define AdminMessage_exit_simulator_tag 34
|
||||||
@ -97,6 +132,10 @@ X(a, STATIC, ONEOF, UINT32, (variant,get_channel_request,get_channel_requ
|
|||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_channel_response,get_channel_response), 7) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \
|
X(a, STATIC, ONEOF, BOOL, (variant,get_owner_request,get_owner_request), 8) \
|
||||||
X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_owner_response,get_owner_response), 9) \
|
||||||
|
X(a, STATIC, ONEOF, UENUM, (variant,get_config_request,get_config_request), 10) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (variant,get_config_response,get_config_response), 11) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (variant,set_config,set_config), 12) \
|
||||||
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_config,confirm_set_config), 13) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_channel,confirm_set_channel), 32) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
|
X(a, STATIC, ONEOF, BOOL, (variant,confirm_set_radio,confirm_set_radio), 33) \
|
||||||
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
|
X(a, STATIC, ONEOF, BOOL, (variant,exit_simulator,exit_simulator), 34) \
|
||||||
@ -122,6 +161,8 @@ X(a, STATIC, ONEOF, INT32, (variant,shutdown_seconds,shutdown_seconds),
|
|||||||
#define AdminMessage_variant_get_radio_response_MSGTYPE RadioConfig
|
#define AdminMessage_variant_get_radio_response_MSGTYPE RadioConfig
|
||||||
#define AdminMessage_variant_get_channel_response_MSGTYPE Channel
|
#define AdminMessage_variant_get_channel_response_MSGTYPE Channel
|
||||||
#define AdminMessage_variant_get_owner_response_MSGTYPE User
|
#define AdminMessage_variant_get_owner_response_MSGTYPE User
|
||||||
|
#define AdminMessage_variant_get_config_response_MSGTYPE Config
|
||||||
|
#define AdminMessage_variant_set_config_MSGTYPE Config
|
||||||
|
|
||||||
extern const pb_msgdesc_t AdminMessage_msg;
|
extern const pb_msgdesc_t AdminMessage_msg;
|
||||||
|
|
||||||
@ -129,7 +170,10 @@ extern const pb_msgdesc_t AdminMessage_msg;
|
|||||||
#define AdminMessage_fields &AdminMessage_msg
|
#define AdminMessage_fields &AdminMessage_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define AdminMessage_size 598
|
#if defined(Config_size) && defined(Config_size)
|
||||||
|
#define AdminMessage_size (0 + sizeof(union AdminMessage_variant_size_union))
|
||||||
|
union AdminMessage_variant_size_union {char f0[551]; char f11[(6 + Config_size)]; char f12[(6 + Config_size)];};
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
54
src/mesh/generated/config.pb.c
Normal file
54
src/mesh/generated/config.pb.c
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/* Automatically generated nanopb constant definitions */
|
||||||
|
/* Generated by nanopb-0.4.5 */
|
||||||
|
|
||||||
|
#include "config.pb.h"
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
PB_BIND(Config, Config, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_DeviceConfig, Config_DeviceConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_GpsConfig, Config_GpsConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_PowerConfig, Config_PowerConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_WiFiConfig, Config_WiFiConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_DisplayConfig, Config_DisplayConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_LoRaConfig, Config_LoRaConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig, Config_ModuleConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_MQTTConfig, Config_ModuleConfig_MQTTConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_SerialConfig, Config_ModuleConfig_SerialConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_ExternalNotificationConfig, Config_ModuleConfig_ExternalNotificationConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_StoreForwardConfig, Config_ModuleConfig_StoreForwardConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_RangeTestConfig, Config_ModuleConfig_RangeTestConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_TelemetryConfig, Config_ModuleConfig_TelemetryConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
PB_BIND(Config_ModuleConfig_CannedMessageConfig, Config_ModuleConfig_CannedMessageConfig, AUTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
334
src/mesh/generated/config.pb.h
Normal file
334
src/mesh/generated/config.pb.h
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
/* Automatically generated nanopb header */
|
||||||
|
/* Generated by nanopb-0.4.5 */
|
||||||
|
|
||||||
|
#ifndef PB_CONFIG_PB_H_INCLUDED
|
||||||
|
#define PB_CONFIG_PB_H_INCLUDED
|
||||||
|
#include <pb.h>
|
||||||
|
#include "telemetry.pb.h"
|
||||||
|
|
||||||
|
#if PB_PROTO_HEADER_VERSION != 40
|
||||||
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Struct definitions */
|
||||||
|
typedef struct _Config_DeviceConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_DeviceConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_DisplayConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_DisplayConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_GpsConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_GpsConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_LoRaConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_LoRaConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_CannedMessageConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_CannedMessageConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_ExternalNotificationConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_ExternalNotificationConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_MQTTConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_MQTTConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_RangeTestConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_RangeTestConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_SerialConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_SerialConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_StoreForwardConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_ModuleConfig_StoreForwardConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_PowerConfig {
|
||||||
|
char dummy_field;
|
||||||
|
} Config_PowerConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig_TelemetryConfig {
|
||||||
|
uint32_t device_update_interval;
|
||||||
|
uint32_t environment_update_interval;
|
||||||
|
bool environment_measurement_enabled;
|
||||||
|
bool environment_screen_enabled;
|
||||||
|
uint32_t environment_read_error_count_threshold;
|
||||||
|
uint32_t environment_recovery_interval;
|
||||||
|
bool environment_display_fahrenheit;
|
||||||
|
TelemetrySensorType environment_sensor_type;
|
||||||
|
uint32_t environment_sensor_pin;
|
||||||
|
} Config_ModuleConfig_TelemetryConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_WiFiConfig {
|
||||||
|
pb_callback_t wifi_ssid;
|
||||||
|
pb_callback_t wifi_password;
|
||||||
|
bool wifi_ap_mode;
|
||||||
|
} Config_WiFiConfig;
|
||||||
|
|
||||||
|
typedef struct _Config_ModuleConfig {
|
||||||
|
pb_size_t which_payloadVariant;
|
||||||
|
union {
|
||||||
|
Config_ModuleConfig_MQTTConfig mqtt_config;
|
||||||
|
Config_ModuleConfig_SerialConfig serial_config;
|
||||||
|
Config_ModuleConfig_ExternalNotificationConfig external_notification_config;
|
||||||
|
Config_ModuleConfig_StoreForwardConfig store_forward_config;
|
||||||
|
Config_ModuleConfig_RangeTestConfig range_test_config;
|
||||||
|
Config_ModuleConfig_TelemetryConfig telemetry_config;
|
||||||
|
Config_ModuleConfig_CannedMessageConfig canned_message_config;
|
||||||
|
} payloadVariant;
|
||||||
|
} Config_ModuleConfig;
|
||||||
|
|
||||||
|
typedef struct _Config {
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
pb_size_t which_payloadVariant;
|
||||||
|
union {
|
||||||
|
Config_DeviceConfig device_config;
|
||||||
|
Config_GpsConfig gps_config;
|
||||||
|
Config_PowerConfig power_config;
|
||||||
|
Config_WiFiConfig wifi_config;
|
||||||
|
Config_DisplayConfig display_config;
|
||||||
|
Config_LoRaConfig lora_config;
|
||||||
|
Config_ModuleConfig module_config;
|
||||||
|
} payloadVariant;
|
||||||
|
} Config;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initializer values for message structs */
|
||||||
|
#define Config_init_default {0, {Config_DeviceConfig_init_default}}
|
||||||
|
#define Config_DeviceConfig_init_default {0}
|
||||||
|
#define Config_GpsConfig_init_default {0}
|
||||||
|
#define Config_PowerConfig_init_default {0}
|
||||||
|
#define Config_WiFiConfig_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0}
|
||||||
|
#define Config_DisplayConfig_init_default {0}
|
||||||
|
#define Config_LoRaConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_init_default {0, {Config_ModuleConfig_MQTTConfig_init_default}}
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_SerialConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_init_default {0}
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, _TelemetrySensorType_MIN, 0}
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_init_default {0}
|
||||||
|
#define Config_init_zero {0, {Config_DeviceConfig_init_zero}}
|
||||||
|
#define Config_DeviceConfig_init_zero {0}
|
||||||
|
#define Config_GpsConfig_init_zero {0}
|
||||||
|
#define Config_PowerConfig_init_zero {0}
|
||||||
|
#define Config_WiFiConfig_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0}
|
||||||
|
#define Config_DisplayConfig_init_zero {0}
|
||||||
|
#define Config_LoRaConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_init_zero {0, {Config_ModuleConfig_MQTTConfig_init_zero}}
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_SerialConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_init_zero {0}
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, _TelemetrySensorType_MIN, 0}
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_init_zero {0}
|
||||||
|
|
||||||
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_device_update_interval_tag 1
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_read_error_count_threshold_tag 5
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_recovery_interval_tag 6
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 7
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_sensor_type_tag 8
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_environment_sensor_pin_tag 9
|
||||||
|
#define Config_WiFiConfig_wifi_ssid_tag 1
|
||||||
|
#define Config_WiFiConfig_wifi_password_tag 2
|
||||||
|
#define Config_WiFiConfig_wifi_ap_mode_tag 3
|
||||||
|
#define Config_ModuleConfig_mqtt_config_tag 1
|
||||||
|
#define Config_ModuleConfig_serial_config_tag 2
|
||||||
|
#define Config_ModuleConfig_external_notification_config_tag 3
|
||||||
|
#define Config_ModuleConfig_store_forward_config_tag 4
|
||||||
|
#define Config_ModuleConfig_range_test_config_tag 5
|
||||||
|
#define Config_ModuleConfig_telemetry_config_tag 6
|
||||||
|
#define Config_ModuleConfig_canned_message_config_tag 7
|
||||||
|
#define Config_device_config_tag 1
|
||||||
|
#define Config_gps_config_tag 2
|
||||||
|
#define Config_power_config_tag 3
|
||||||
|
#define Config_wifi_config_tag 4
|
||||||
|
#define Config_display_config_tag 5
|
||||||
|
#define Config_lora_config_tag 6
|
||||||
|
#define Config_module_config_tag 7
|
||||||
|
|
||||||
|
/* Struct field encoding specification for nanopb */
|
||||||
|
#define Config_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,device_config,payloadVariant.device_config), 1) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,gps_config,payloadVariant.gps_config), 2) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,power_config,payloadVariant.power_config), 3) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,wifi_config,payloadVariant.wifi_config), 4) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,display_config,payloadVariant.display_config), 5) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,lora_config,payloadVariant.lora_config), 6) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,module_config,payloadVariant.module_config), 7)
|
||||||
|
#define Config_CALLBACK NULL
|
||||||
|
#define Config_DEFAULT NULL
|
||||||
|
#define Config_payloadVariant_device_config_MSGTYPE Config_DeviceConfig
|
||||||
|
#define Config_payloadVariant_gps_config_MSGTYPE Config_GpsConfig
|
||||||
|
#define Config_payloadVariant_power_config_MSGTYPE Config_PowerConfig
|
||||||
|
#define Config_payloadVariant_wifi_config_MSGTYPE Config_WiFiConfig
|
||||||
|
#define Config_payloadVariant_display_config_MSGTYPE Config_DisplayConfig
|
||||||
|
#define Config_payloadVariant_lora_config_MSGTYPE Config_LoRaConfig
|
||||||
|
#define Config_payloadVariant_module_config_MSGTYPE Config_ModuleConfig
|
||||||
|
|
||||||
|
#define Config_DeviceConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_DeviceConfig_CALLBACK NULL
|
||||||
|
#define Config_DeviceConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_GpsConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_GpsConfig_CALLBACK NULL
|
||||||
|
#define Config_GpsConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_PowerConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_PowerConfig_CALLBACK NULL
|
||||||
|
#define Config_PowerConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_WiFiConfig_FIELDLIST(X, a) \
|
||||||
|
X(a, CALLBACK, SINGULAR, STRING, wifi_ssid, 1) \
|
||||||
|
X(a, CALLBACK, SINGULAR, STRING, wifi_password, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, wifi_ap_mode, 3)
|
||||||
|
#define Config_WiFiConfig_CALLBACK pb_default_field_callback
|
||||||
|
#define Config_WiFiConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_DisplayConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_DisplayConfig_CALLBACK NULL
|
||||||
|
#define Config_DisplayConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_LoRaConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_LoRaConfig_CALLBACK NULL
|
||||||
|
#define Config_LoRaConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,mqtt_config,payloadVariant.mqtt_config), 1) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,serial_config,payloadVariant.serial_config), 2) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,external_notification_config,payloadVariant.external_notification_config), 3) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,store_forward_config,payloadVariant.store_forward_config), 4) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,range_test_config,payloadVariant.range_test_config), 5) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,telemetry_config,payloadVariant.telemetry_config), 6) \
|
||||||
|
X(a, STATIC, ONEOF, MESSAGE, (payloadVariant,canned_message_config,payloadVariant.canned_message_config), 7)
|
||||||
|
#define Config_ModuleConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_DEFAULT NULL
|
||||||
|
#define Config_ModuleConfig_payloadVariant_mqtt_config_MSGTYPE Config_ModuleConfig_MQTTConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_serial_config_MSGTYPE Config_ModuleConfig_SerialConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_external_notification_config_MSGTYPE Config_ModuleConfig_ExternalNotificationConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_store_forward_config_MSGTYPE Config_ModuleConfig_StoreForwardConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_range_test_config_MSGTYPE Config_ModuleConfig_RangeTestConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_telemetry_config_MSGTYPE Config_ModuleConfig_TelemetryConfig
|
||||||
|
#define Config_ModuleConfig_payloadVariant_canned_message_config_MSGTYPE Config_ModuleConfig_CannedMessageConfig
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_SerialConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_SerialConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_SerialConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_FIELDLIST(X, a) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, device_update_interval, 1) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, environment_read_error_count_threshold, 5) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, environment_recovery_interval, 6) \
|
||||||
|
X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 7) \
|
||||||
|
X(a, STATIC, SINGULAR, UENUM, environment_sensor_type, 8) \
|
||||||
|
X(a, STATIC, SINGULAR, UINT32, environment_sensor_pin, 9)
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_FIELDLIST(X, a) \
|
||||||
|
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_CALLBACK NULL
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_DEFAULT NULL
|
||||||
|
|
||||||
|
extern const pb_msgdesc_t Config_msg;
|
||||||
|
extern const pb_msgdesc_t Config_DeviceConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_GpsConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_PowerConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_WiFiConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_DisplayConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_LoRaConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_MQTTConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_SerialConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_ExternalNotificationConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_StoreForwardConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_RangeTestConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_TelemetryConfig_msg;
|
||||||
|
extern const pb_msgdesc_t Config_ModuleConfig_CannedMessageConfig_msg;
|
||||||
|
|
||||||
|
/* Defines for backwards compatibility with code written before nanopb-0.4.0 */
|
||||||
|
#define Config_fields &Config_msg
|
||||||
|
#define Config_DeviceConfig_fields &Config_DeviceConfig_msg
|
||||||
|
#define Config_GpsConfig_fields &Config_GpsConfig_msg
|
||||||
|
#define Config_PowerConfig_fields &Config_PowerConfig_msg
|
||||||
|
#define Config_WiFiConfig_fields &Config_WiFiConfig_msg
|
||||||
|
#define Config_DisplayConfig_fields &Config_DisplayConfig_msg
|
||||||
|
#define Config_LoRaConfig_fields &Config_LoRaConfig_msg
|
||||||
|
#define Config_ModuleConfig_fields &Config_ModuleConfig_msg
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_fields &Config_ModuleConfig_MQTTConfig_msg
|
||||||
|
#define Config_ModuleConfig_SerialConfig_fields &Config_ModuleConfig_SerialConfig_msg
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_fields &Config_ModuleConfig_ExternalNotificationConfig_msg
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_fields &Config_ModuleConfig_StoreForwardConfig_msg
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_fields &Config_ModuleConfig_RangeTestConfig_msg
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_fields &Config_ModuleConfig_TelemetryConfig_msg
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_fields &Config_ModuleConfig_CannedMessageConfig_msg
|
||||||
|
|
||||||
|
/* Maximum encoded size of messages (where known) */
|
||||||
|
/* Config_size depends on runtime parameters */
|
||||||
|
/* Config_WiFiConfig_size depends on runtime parameters */
|
||||||
|
#define Config_DeviceConfig_size 0
|
||||||
|
#define Config_DisplayConfig_size 0
|
||||||
|
#define Config_GpsConfig_size 0
|
||||||
|
#define Config_LoRaConfig_size 0
|
||||||
|
#define Config_ModuleConfig_CannedMessageConfig_size 0
|
||||||
|
#define Config_ModuleConfig_ExternalNotificationConfig_size 0
|
||||||
|
#define Config_ModuleConfig_MQTTConfig_size 0
|
||||||
|
#define Config_ModuleConfig_RangeTestConfig_size 0
|
||||||
|
#define Config_ModuleConfig_SerialConfig_size 0
|
||||||
|
#define Config_ModuleConfig_StoreForwardConfig_size 0
|
||||||
|
#define Config_ModuleConfig_TelemetryConfig_size 38
|
||||||
|
#define Config_ModuleConfig_size 40
|
||||||
|
#define Config_PowerConfig_size 0
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -159,7 +159,7 @@ extern const pb_msgdesc_t OEMStore_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define ChannelFile_size 832
|
#define ChannelFile_size 832
|
||||||
#define DeviceState_size 19327
|
#define DeviceState_size 19197
|
||||||
#define OEMStore_size 2106
|
#define OEMStore_size 2106
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -69,41 +69,6 @@ typedef enum _HardwareModel {
|
|||||||
HardwareModel_PRIVATE_HW = 255
|
HardwareModel_PRIVATE_HW = 255
|
||||||
} HardwareModel;
|
} HardwareModel;
|
||||||
|
|
||||||
/* The team colors are based on the names of "friendly teams" in ATAK:
|
|
||||||
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
|
|
||||||
typedef enum _Team {
|
|
||||||
/* the default (unset) is "achromatic" (unaffiliated) */
|
|
||||||
Team_CLEAR = 0,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_CYAN = 1,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_WHITE = 2,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_YELLOW = 3,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_ORANGE = 4,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_MAGENTA = 5,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_RED = 6,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_MAROON = 7,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_PURPLE = 8,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_DARK_BLUE = 9,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_BLUE = 10,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_TEAL = 11,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_GREEN = 12,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_DARK_GREEN = 13,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
Team_BROWN = 14
|
|
||||||
} Team;
|
|
||||||
|
|
||||||
/* Shared constants between device and phone */
|
/* Shared constants between device and phone */
|
||||||
typedef enum _Constants {
|
typedef enum _Constants {
|
||||||
/* First enum must be zero, and we are just using this enum to
|
/* First enum must be zero, and we are just using this enum to
|
||||||
@ -164,18 +129,17 @@ typedef enum _Position_LocSource {
|
|||||||
Position_LocSource_LOCSRC_GPS_EXTERNAL = 3
|
Position_LocSource_LOCSRC_GPS_EXTERNAL = 3
|
||||||
} Position_LocSource;
|
} Position_LocSource;
|
||||||
|
|
||||||
/* The team colors are based on the names of "friendly teams" in ATAK:
|
/* Shared constants between device and phone */
|
||||||
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
|
|
||||||
typedef enum _Position_AltSource {
|
typedef enum _Position_AltSource {
|
||||||
/* the default (unset) is "achromatic" (unaffiliated) */
|
/* First enum must be zero, and we are just using this enum to
|
||||||
|
pass int constants between two very different environments */
|
||||||
Position_AltSource_ALTSRC_UNSPECIFIED = 0,
|
Position_AltSource_ALTSRC_UNSPECIFIED = 0,
|
||||||
/* TODO: REPLACE */
|
/* From mesh.options
|
||||||
|
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
||||||
|
outside of this envelope */
|
||||||
Position_AltSource_ALTSRC_MANUAL_ENTRY = 1,
|
Position_AltSource_ALTSRC_MANUAL_ENTRY = 1,
|
||||||
/* TODO: REPLACE */
|
|
||||||
Position_AltSource_ALTSRC_GPS_INTERNAL = 2,
|
Position_AltSource_ALTSRC_GPS_INTERNAL = 2,
|
||||||
/* TODO: REPLACE */
|
|
||||||
Position_AltSource_ALTSRC_GPS_EXTERNAL = 3,
|
Position_AltSource_ALTSRC_GPS_EXTERNAL = 3,
|
||||||
/* TODO: REPLACE */
|
|
||||||
Position_AltSource_ALTSRC_BAROMETRIC = 4
|
Position_AltSource_ALTSRC_BAROMETRIC = 4
|
||||||
} Position_AltSource;
|
} Position_AltSource;
|
||||||
|
|
||||||
@ -232,14 +196,15 @@ typedef enum _MeshPacket_Priority {
|
|||||||
MeshPacket_Priority_MAX = 127
|
MeshPacket_Priority_MAX = 127
|
||||||
} MeshPacket_Priority;
|
} MeshPacket_Priority;
|
||||||
|
|
||||||
/* The team colors are based on the names of "friendly teams" in ATAK:
|
/* Shared constants between device and phone */
|
||||||
https://github.com/deptofdefense/AndroidTacticalAssaultKit-CIV/blob/master/atak/ATAK/app/src/main/assets/filters/team_filters.xml */
|
|
||||||
typedef enum _MeshPacket_Delayed {
|
typedef enum _MeshPacket_Delayed {
|
||||||
/* the default (unset) is "achromatic" (unaffiliated) */
|
/* First enum must be zero, and we are just using this enum to
|
||||||
|
pass int constants between two very different environments */
|
||||||
MeshPacket_Delayed_NO_DELAY = 0,
|
MeshPacket_Delayed_NO_DELAY = 0,
|
||||||
/* TODO: REPLACE */
|
/* From mesh.options
|
||||||
|
note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is
|
||||||
|
outside of this envelope */
|
||||||
MeshPacket_Delayed_DELAYED_BROADCAST = 1,
|
MeshPacket_Delayed_DELAYED_BROADCAST = 1,
|
||||||
/* TODO: REPLACE */
|
|
||||||
MeshPacket_Delayed_DELAYED_DIRECT = 2
|
MeshPacket_Delayed_DELAYED_DIRECT = 2
|
||||||
} MeshPacket_Delayed;
|
} MeshPacket_Delayed;
|
||||||
|
|
||||||
@ -480,12 +445,6 @@ typedef struct _User {
|
|||||||
If this user is a licensed operator, set this flag.
|
If this user is a licensed operator, set this flag.
|
||||||
Also, "long_name" should be their licence number. */
|
Also, "long_name" should be their licence number. */
|
||||||
bool is_licensed;
|
bool is_licensed;
|
||||||
/* Participants in the same network can self-group into different teams.
|
|
||||||
Short-term this can be used to visually differentiate them on the map;
|
|
||||||
in the longer term it could also help users to semi-automatically
|
|
||||||
select or ignore messages according to team affiliation.
|
|
||||||
In total, 14 teams are defined (encoded in 4 bits) */
|
|
||||||
Team team;
|
|
||||||
/* Transmit power at antenna connector, in decibel-milliwatt
|
/* Transmit power at antenna connector, in decibel-milliwatt
|
||||||
An optional self-reported value useful in network planning, discovery
|
An optional self-reported value useful in network planning, discovery
|
||||||
and positioning - along with ant_gain_dbi and ant_azimuth below */
|
and positioning - along with ant_gain_dbi and ant_azimuth below */
|
||||||
@ -697,10 +656,6 @@ typedef struct _ToRadio {
|
|||||||
#define _HardwareModel_MAX HardwareModel_PRIVATE_HW
|
#define _HardwareModel_MAX HardwareModel_PRIVATE_HW
|
||||||
#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1))
|
#define _HardwareModel_ARRAYSIZE ((HardwareModel)(HardwareModel_PRIVATE_HW+1))
|
||||||
|
|
||||||
#define _Team_MIN Team_CLEAR
|
|
||||||
#define _Team_MAX Team_BROWN
|
|
||||||
#define _Team_ARRAYSIZE ((Team)(Team_BROWN+1))
|
|
||||||
|
|
||||||
#define _Constants_MIN Constants_Unused
|
#define _Constants_MIN Constants_Unused
|
||||||
#define _Constants_MAX Constants_DATA_PAYLOAD_LEN
|
#define _Constants_MAX Constants_DATA_PAYLOAD_LEN
|
||||||
#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1))
|
#define _Constants_ARRAYSIZE ((Constants)(Constants_DATA_PAYLOAD_LEN+1))
|
||||||
@ -740,7 +695,7 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define Position_init_default {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Position_init_default {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
|
#define User_init_default {"", "", "", {0}, _HardwareModel_MIN, 0, 0, 0, 0}
|
||||||
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
#define RouteDiscovery_init_default {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define Routing_init_default {0, {RouteDiscovery_init_default}}
|
#define Routing_init_default {0, {RouteDiscovery_init_default}}
|
||||||
#define Data_init_default {_PortNum_MIN, 0, {{0, {0}}}, 0, 0, 0, 0, 0, 0, false, Location_init_default}
|
#define Data_init_default {_PortNum_MIN, 0, {{0, {0}}}, 0, 0, 0, 0, 0, 0, false, Location_init_default}
|
||||||
@ -753,7 +708,7 @@ extern "C" {
|
|||||||
#define ToRadio_init_default {0, {MeshPacket_init_default}}
|
#define ToRadio_init_default {0, {MeshPacket_init_default}}
|
||||||
#define ToRadio_PeerInfo_init_default {0, 0}
|
#define ToRadio_PeerInfo_init_default {0, 0}
|
||||||
#define Position_init_zero {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
#define Position_init_zero {0, 0, 0, 0, _Position_LocSource_MIN, _Position_AltSource_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||||
#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, _Team_MIN, 0, 0, 0}
|
#define User_init_zero {"", "", "", {0}, _HardwareModel_MIN, 0, 0, 0, 0}
|
||||||
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
#define RouteDiscovery_init_zero {0, {0, 0, 0, 0, 0, 0, 0, 0}}
|
||||||
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
|
#define Routing_init_zero {0, {RouteDiscovery_init_zero}}
|
||||||
#define Data_init_zero {_PortNum_MIN, 0, {{0, {0}}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero}
|
#define Data_init_zero {_PortNum_MIN, 0, {{0, {0}}}, 0, 0, 0, 0, 0, 0, false, Location_init_zero}
|
||||||
@ -824,7 +779,6 @@ extern "C" {
|
|||||||
#define User_macaddr_tag 4
|
#define User_macaddr_tag 4
|
||||||
#define User_hw_model_tag 6
|
#define User_hw_model_tag 6
|
||||||
#define User_is_licensed_tag 7
|
#define User_is_licensed_tag 7
|
||||||
#define User_team_tag 8
|
|
||||||
#define User_tx_power_dbm_tag 10
|
#define User_tx_power_dbm_tag 10
|
||||||
#define User_ant_gain_dbi_tag 11
|
#define User_ant_gain_dbi_tag 11
|
||||||
#define User_ant_azimuth_tag 12
|
#define User_ant_azimuth_tag 12
|
||||||
@ -906,7 +860,6 @@ X(a, STATIC, SINGULAR, STRING, short_name, 3) \
|
|||||||
X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \
|
X(a, STATIC, SINGULAR, FIXED_LENGTH_BYTES, macaddr, 4) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \
|
X(a, STATIC, SINGULAR, UENUM, hw_model, 6) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, is_licensed, 7) \
|
X(a, STATIC, SINGULAR, BOOL, is_licensed, 7) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, team, 8) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, tx_power_dbm, 10) \
|
X(a, STATIC, SINGULAR, UINT32, tx_power_dbm, 10) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, ant_gain_dbi, 11) \
|
X(a, STATIC, SINGULAR, UINT32, ant_gain_dbi, 11) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, ant_azimuth, 12)
|
X(a, STATIC, SINGULAR, UINT32, ant_azimuth, 12)
|
||||||
@ -1078,13 +1031,13 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg;
|
|||||||
#define LogRecord_size 81
|
#define LogRecord_size 81
|
||||||
#define MeshPacket_size 347
|
#define MeshPacket_size 347
|
||||||
#define MyNodeInfo_size 210
|
#define MyNodeInfo_size 210
|
||||||
#define NodeInfo_size 283
|
#define NodeInfo_size 281
|
||||||
#define Position_size 142
|
#define Position_size 142
|
||||||
#define RouteDiscovery_size 40
|
#define RouteDiscovery_size 40
|
||||||
#define Routing_size 42
|
#define Routing_size 42
|
||||||
#define ToRadio_PeerInfo_size 8
|
#define ToRadio_PeerInfo_size 8
|
||||||
#define ToRadio_size 350
|
#define ToRadio_size 350
|
||||||
#define User_size 97
|
#define User_size 95
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -21,4 +21,3 @@ PB_BIND(RadioConfig_UserPreferences, RadioConfig_UserPreferences, 2)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -237,31 +237,6 @@ typedef enum _RadioConfig_UserPreferences_Serial_Mode {
|
|||||||
RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO = 2
|
RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO = 2
|
||||||
} RadioConfig_UserPreferences_Serial_Mode;
|
} RadioConfig_UserPreferences_Serial_Mode;
|
||||||
|
|
||||||
/* Sets the charge control current of devices with a battery charger that can be
|
|
||||||
configured. This is passed into the axp power management chip like on the tbeam. */
|
|
||||||
typedef enum _RadioConfig_UserPreferences_TelemetrySensorType {
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_None = 0,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DHT11 = 1,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DS18B20 = 2,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DHT12 = 3,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DHT21 = 4,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DHT22 = 5,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_BME280 = 6,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_BME680 = 7,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_MCP9808 = 8,
|
|
||||||
/* TODO: REPLACE */
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_SHTC3 = 9
|
|
||||||
} RadioConfig_UserPreferences_TelemetrySensorType;
|
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
typedef struct _RadioConfig_UserPreferences {
|
typedef struct _RadioConfig_UserPreferences {
|
||||||
uint32_t position_broadcast_secs;
|
uint32_t position_broadcast_secs;
|
||||||
@ -314,14 +289,6 @@ typedef struct _RadioConfig_UserPreferences {
|
|||||||
uint32_t store_forward_module_records;
|
uint32_t store_forward_module_records;
|
||||||
uint32_t store_forward_module_history_return_max;
|
uint32_t store_forward_module_history_return_max;
|
||||||
uint32_t store_forward_module_history_return_window;
|
uint32_t store_forward_module_history_return_window;
|
||||||
bool telemetry_module_environment_measurement_enabled;
|
|
||||||
bool telemetry_module_environment_screen_enabled;
|
|
||||||
uint32_t telemetry_module_environment_read_error_count_threshold;
|
|
||||||
uint32_t telemetry_module_device_update_interval;
|
|
||||||
uint32_t telemetry_module_environment_recovery_interval;
|
|
||||||
bool telemetry_module_environment_display_fahrenheit;
|
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType telemetry_module_environment_sensor_type;
|
|
||||||
uint32_t telemetry_module_environment_sensor_pin;
|
|
||||||
bool store_forward_module_enabled;
|
bool store_forward_module_enabled;
|
||||||
bool store_forward_module_heartbeat;
|
bool store_forward_module_heartbeat;
|
||||||
uint32_t position_flags;
|
uint32_t position_flags;
|
||||||
@ -347,7 +314,6 @@ typedef struct _RadioConfig_UserPreferences {
|
|||||||
bool mqtt_encryption_enabled;
|
bool mqtt_encryption_enabled;
|
||||||
float adc_multiplier_override;
|
float adc_multiplier_override;
|
||||||
RadioConfig_UserPreferences_Serial_Baud serial_module_baud;
|
RadioConfig_UserPreferences_Serial_Baud serial_module_baud;
|
||||||
uint32_t telemetry_module_environment_update_interval;
|
|
||||||
} RadioConfig_UserPreferences;
|
} RadioConfig_UserPreferences;
|
||||||
|
|
||||||
/* The entire set of user settable/readable settings for our radio device.
|
/* The entire set of user settable/readable settings for our radio device.
|
||||||
@ -393,10 +359,6 @@ typedef struct _RadioConfig {
|
|||||||
#define _RadioConfig_UserPreferences_Serial_Mode_MAX RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO
|
#define _RadioConfig_UserPreferences_Serial_Mode_MAX RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO
|
||||||
#define _RadioConfig_UserPreferences_Serial_Mode_ARRAYSIZE ((RadioConfig_UserPreferences_Serial_Mode)(RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO+1))
|
#define _RadioConfig_UserPreferences_Serial_Mode_ARRAYSIZE ((RadioConfig_UserPreferences_Serial_Mode)(RadioConfig_UserPreferences_Serial_Mode_MODE_PROTO+1))
|
||||||
|
|
||||||
#define _RadioConfig_UserPreferences_TelemetrySensorType_MIN RadioConfig_UserPreferences_TelemetrySensorType_None
|
|
||||||
#define _RadioConfig_UserPreferences_TelemetrySensorType_MAX RadioConfig_UserPreferences_TelemetrySensorType_SHTC3
|
|
||||||
#define _RadioConfig_UserPreferences_TelemetrySensorType_ARRAYSIZE ((RadioConfig_UserPreferences_TelemetrySensorType)(RadioConfig_UserPreferences_TelemetrySensorType_SHTC3+1))
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -404,9 +366,9 @@ extern "C" {
|
|||||||
|
|
||||||
/* Initializer values for message structs */
|
/* Initializer values for message structs */
|
||||||
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default}
|
#define RadioConfig_init_default {false, RadioConfig_UserPreferences_init_default}
|
||||||
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _Role_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_Serial_Mode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, 0, "", 0, 0, 0, _RadioConfig_UserPreferences_Serial_Baud_MIN, 0}
|
#define RadioConfig_UserPreferences_init_default {0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _Role_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_Serial_Mode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, 0, "", 0, 0, 0, _RadioConfig_UserPreferences_Serial_Baud_MIN}
|
||||||
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero}
|
#define RadioConfig_init_zero {false, RadioConfig_UserPreferences_init_zero}
|
||||||
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _Role_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_Serial_Mode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_TelemetrySensorType_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, 0, "", 0, 0, 0, _RadioConfig_UserPreferences_Serial_Baud_MIN, 0}
|
#define RadioConfig_UserPreferences_init_zero {0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, _RegionCode_MIN, _ChargeCurrent_MIN, 0, _Role_MIN, 0, 0, 0, 0, 0, 0, 0, 0, "", 0, _GpsCoordinateFormat_MIN, 0, 0, 0, 0, 0, {0, 0, 0}, 0, 0, 0, 0, 0, _RadioConfig_UserPreferences_Serial_Mode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", "", 0, 0, 0, 0, 0, 0, _InputEventChar_MIN, _InputEventChar_MIN, _InputEventChar_MIN, 0, 0, "", 0, 0, 0, _RadioConfig_UserPreferences_Serial_Baud_MIN}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
#define RadioConfig_UserPreferences_position_broadcast_secs_tag 1
|
#define RadioConfig_UserPreferences_position_broadcast_secs_tag 1
|
||||||
@ -458,14 +420,6 @@ extern "C" {
|
|||||||
#define RadioConfig_UserPreferences_store_forward_module_records_tag 137
|
#define RadioConfig_UserPreferences_store_forward_module_records_tag 137
|
||||||
#define RadioConfig_UserPreferences_store_forward_module_history_return_max_tag 138
|
#define RadioConfig_UserPreferences_store_forward_module_history_return_max_tag 138
|
||||||
#define RadioConfig_UserPreferences_store_forward_module_history_return_window_tag 139
|
#define RadioConfig_UserPreferences_store_forward_module_history_return_window_tag 139
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_measurement_enabled_tag 140
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_screen_enabled_tag 141
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_read_error_count_threshold_tag 142
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_device_update_interval_tag 143
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_recovery_interval_tag 144
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_display_fahrenheit_tag 145
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_sensor_type_tag 146
|
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_sensor_pin_tag 147
|
|
||||||
#define RadioConfig_UserPreferences_store_forward_module_enabled_tag 148
|
#define RadioConfig_UserPreferences_store_forward_module_enabled_tag 148
|
||||||
#define RadioConfig_UserPreferences_store_forward_module_heartbeat_tag 149
|
#define RadioConfig_UserPreferences_store_forward_module_heartbeat_tag 149
|
||||||
#define RadioConfig_UserPreferences_position_flags_tag 150
|
#define RadioConfig_UserPreferences_position_flags_tag 150
|
||||||
@ -491,7 +445,6 @@ extern "C" {
|
|||||||
#define RadioConfig_UserPreferences_mqtt_encryption_enabled_tag 174
|
#define RadioConfig_UserPreferences_mqtt_encryption_enabled_tag 174
|
||||||
#define RadioConfig_UserPreferences_adc_multiplier_override_tag 175
|
#define RadioConfig_UserPreferences_adc_multiplier_override_tag 175
|
||||||
#define RadioConfig_UserPreferences_serial_module_baud_tag 176
|
#define RadioConfig_UserPreferences_serial_module_baud_tag 176
|
||||||
#define RadioConfig_UserPreferences_telemetry_module_environment_update_interval_tag 177
|
|
||||||
#define RadioConfig_preferences_tag 1
|
#define RadioConfig_preferences_tag 1
|
||||||
|
|
||||||
/* Struct field encoding specification for nanopb */
|
/* Struct field encoding specification for nanopb */
|
||||||
@ -551,14 +504,6 @@ X(a, STATIC, SINGULAR, BOOL, range_test_module_save, 134) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, store_forward_module_records, 137) \
|
X(a, STATIC, SINGULAR, UINT32, store_forward_module_records, 137) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, store_forward_module_history_return_max, 138) \
|
X(a, STATIC, SINGULAR, UINT32, store_forward_module_history_return_max, 138) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, store_forward_module_history_return_window, 139) \
|
X(a, STATIC, SINGULAR, UINT32, store_forward_module_history_return_window, 139) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, telemetry_module_environment_measurement_enabled, 140) \
|
|
||||||
X(a, STATIC, SINGULAR, BOOL, telemetry_module_environment_screen_enabled, 141) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, telemetry_module_environment_read_error_count_threshold, 142) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, telemetry_module_device_update_interval, 143) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, telemetry_module_environment_recovery_interval, 144) \
|
|
||||||
X(a, STATIC, SINGULAR, BOOL, telemetry_module_environment_display_fahrenheit, 145) \
|
|
||||||
X(a, STATIC, SINGULAR, UENUM, telemetry_module_environment_sensor_type, 146) \
|
|
||||||
X(a, STATIC, SINGULAR, UINT32, telemetry_module_environment_sensor_pin, 147) \
|
|
||||||
X(a, STATIC, SINGULAR, BOOL, store_forward_module_enabled, 148) \
|
X(a, STATIC, SINGULAR, BOOL, store_forward_module_enabled, 148) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, store_forward_module_heartbeat, 149) \
|
X(a, STATIC, SINGULAR, BOOL, store_forward_module_heartbeat, 149) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, position_flags, 150) \
|
X(a, STATIC, SINGULAR, UINT32, position_flags, 150) \
|
||||||
@ -583,8 +528,7 @@ X(a, STATIC, SINGULAR, STRING, canned_message_module_allow_input_source, 171
|
|||||||
X(a, STATIC, SINGULAR, BOOL, canned_message_module_send_bell, 173) \
|
X(a, STATIC, SINGULAR, BOOL, canned_message_module_send_bell, 173) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, mqtt_encryption_enabled, 174) \
|
X(a, STATIC, SINGULAR, BOOL, mqtt_encryption_enabled, 174) \
|
||||||
X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 175) \
|
X(a, STATIC, SINGULAR, FLOAT, adc_multiplier_override, 175) \
|
||||||
X(a, STATIC, SINGULAR, UENUM, serial_module_baud, 176) \
|
X(a, STATIC, SINGULAR, UENUM, serial_module_baud, 176)
|
||||||
X(a, STATIC, SINGULAR, UINT32, telemetry_module_environment_update_interval, 177)
|
|
||||||
#define RadioConfig_UserPreferences_CALLBACK NULL
|
#define RadioConfig_UserPreferences_CALLBACK NULL
|
||||||
#define RadioConfig_UserPreferences_DEFAULT NULL
|
#define RadioConfig_UserPreferences_DEFAULT NULL
|
||||||
|
|
||||||
@ -596,8 +540,8 @@ extern const pb_msgdesc_t RadioConfig_UserPreferences_msg;
|
|||||||
#define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg
|
#define RadioConfig_UserPreferences_fields &RadioConfig_UserPreferences_msg
|
||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define RadioConfig_UserPreferences_size 592
|
#define RadioConfig_UserPreferences_size 545
|
||||||
#define RadioConfig_size 595
|
#define RadioConfig_size 548
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -16,3 +16,4 @@ PB_BIND(Telemetry, Telemetry, AUTO)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,6 +9,31 @@
|
|||||||
#error Regenerate this file with the current version of nanopb generator.
|
#error Regenerate this file with the current version of nanopb generator.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Enum definitions */
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
typedef enum _TelemetrySensorType {
|
||||||
|
/* No external telemetry sensor */
|
||||||
|
TelemetrySensorType_NotSet = 0,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_DHT11 = 1,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_DS18B20 = 2,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_DHT12 = 3,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_DHT21 = 4,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_DHT22 = 5,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_BME280 = 6,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_BME680 = 7,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_MCP9808 = 8,
|
||||||
|
/* TODO: REPLACE */
|
||||||
|
TelemetrySensorType_SHTC3 = 9
|
||||||
|
} TelemetrySensorType;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
/* Key native device metrics such as battery level */
|
/* Key native device metrics such as battery level */
|
||||||
typedef struct _DeviceMetrics {
|
typedef struct _DeviceMetrics {
|
||||||
@ -55,6 +80,12 @@ typedef struct _Telemetry {
|
|||||||
} Telemetry;
|
} Telemetry;
|
||||||
|
|
||||||
|
|
||||||
|
/* Helper constants for enums */
|
||||||
|
#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
|
||||||
|
#define _TelemetrySensorType_MAX TelemetrySensorType_SHTC3
|
||||||
|
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_SHTC3+1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "configuration.h"
|
|
||||||
#include "AdminModule.h"
|
#include "AdminModule.h"
|
||||||
#include "Channels.h"
|
#include "Channels.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
#include "Router.h"
|
#include "Router.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef PORTDUINO
|
||||||
@ -13,19 +13,22 @@
|
|||||||
AdminModule *adminModule;
|
AdminModule *adminModule;
|
||||||
|
|
||||||
/// A special reserved string to indicate strings we can not share with external nodes. We will use this 'reserved' word instead.
|
/// 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.
|
/// 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";
|
static const char *secretReserved = "sekrit";
|
||||||
|
|
||||||
/// If buf is !empty, change it to secret
|
/// If buf is !empty, change it to secret
|
||||||
static void hideSecret(char *buf) {
|
static void hideSecret(char *buf)
|
||||||
if(*buf) {
|
{
|
||||||
|
if (*buf) {
|
||||||
strcpy(buf, secretReserved);
|
strcpy(buf, secretReserved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// If buf is the reserved secret word, replace the buffer with currentVal
|
/// If buf is the reserved secret word, replace the buffer with currentVal
|
||||||
static void writeSecret(char *buf, const char *currentVal) {
|
static void writeSecret(char *buf, const char *currentVal)
|
||||||
if(strcmp(buf, secretReserved) == 0) {
|
{
|
||||||
|
if (strcmp(buf, secretReserved) == 0) {
|
||||||
strcpy(buf, currentVal);
|
strcpy(buf, currentVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -53,7 +56,8 @@ void AdminModule::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_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);
|
hideSecret(r.get_radio_response.preferences.wifi_password);
|
||||||
|
|
||||||
r.which_variant = AdminMessage_get_radio_response_tag;
|
r.which_variant = AdminMessage_get_radio_response_tag;
|
||||||
@ -61,6 +65,97 @@ void AdminModule::handleGetRadio(const MeshPacket &req)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::handleGetConfig(const MeshPacket &req)
|
||||||
|
{
|
||||||
|
// We create the reply here
|
||||||
|
AdminMessage r = AdminMessage_init_default;
|
||||||
|
|
||||||
|
if (req.decoded.want_response) {
|
||||||
|
switch (r.get_config_request) {
|
||||||
|
case AdminMessage_ConfigType_ALL:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_ALL\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_ALL;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_CORE_ONLY:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_CORE_ONLY\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_CORE_ONLY;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_ONLY:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_ONLY\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_ONLY;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_DEVICE_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_DEVICE_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_GPS_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_GPS_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_GPS_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_POWER_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_POWER_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_POWER_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_WIFI_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_WIFI_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_POWER_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_DISPLAY_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_DISPLAY_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_LORA_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_LORA_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_LORA_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_MQTT_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_MQTT_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_MQTT_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_SERIAL_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_SERIAL_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_SERIAL_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG;
|
||||||
|
r.get_config_response.payloadVariant.module_config.which_payloadVariant = Config_ModuleConfig_telemetry_config_tag;
|
||||||
|
r.get_config_response.payloadVariant.module_config.payloadVariant.telemetry_config =
|
||||||
|
config.payloadVariant.module_config.payloadVariant.telemetry_config;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG:
|
||||||
|
DEBUG_MSG("Requesting config: AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG\n");
|
||||||
|
r.get_config_response.which_payloadVariant = AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: The phone app needs to know the ls_secs & phone_timeout value so it can properly expect sleep behavior.
|
||||||
|
// So even if we internally use 0 to represent 'use default' we still need to send the value we are
|
||||||
|
// 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.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_config_response_tag;
|
||||||
|
myReply = allocDataProtobuf(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AdminModule::handleGetOwner(const MeshPacket &req)
|
void AdminModule::handleGetOwner(const MeshPacket &req)
|
||||||
{
|
{
|
||||||
if (req.decoded.want_response) {
|
if (req.decoded.want_response) {
|
||||||
@ -113,6 +208,16 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
handleGetRadio(mp);
|
handleGetRadio(mp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case AdminMessage_get_config_request_tag:
|
||||||
|
DEBUG_MSG("Client is getting config\n");
|
||||||
|
handleGetConfig(mp);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case AdminMessage_set_config_tag:
|
||||||
|
DEBUG_MSG("Client is setting the config\n");
|
||||||
|
handleSetConfig(r->set_config);
|
||||||
|
break;
|
||||||
|
|
||||||
case AdminMessage_get_owner_request_tag:
|
case AdminMessage_get_owner_request_tag:
|
||||||
DEBUG_MSG("Client is getting owner\n");
|
DEBUG_MSG("Client is getting owner\n");
|
||||||
handleGetOwner(mp);
|
handleGetOwner(mp);
|
||||||
@ -142,16 +247,11 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
AdminMessage response = AdminMessage_init_default;
|
AdminMessage response = AdminMessage_init_default;
|
||||||
AdminMessageHandleResult handleResult = MeshModule::handleAdminMessageForAllPlugins(mp, r, &response);
|
AdminMessageHandleResult handleResult = MeshModule::handleAdminMessageForAllPlugins(mp, r, &response);
|
||||||
|
|
||||||
if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE)
|
if (handleResult == AdminMessageHandleResult::HANDLED_WITH_RESPONSE) {
|
||||||
{
|
|
||||||
myReply = allocDataProtobuf(response);
|
myReply = allocDataProtobuf(response);
|
||||||
}
|
} else if (mp.decoded.want_response) {
|
||||||
else if (mp.decoded.want_response)
|
|
||||||
{
|
|
||||||
DEBUG_MSG("We did not responded to a request that wanted a respond. req.variant=%d\n", r->which_variant);
|
DEBUG_MSG("We did not responded to a request that wanted a respond. req.variant=%d\n", r->which_variant);
|
||||||
}
|
} else if (handleResult != AdminMessageHandleResult::HANDLED) {
|
||||||
else if (handleResult != AdminMessageHandleResult::HANDLED)
|
|
||||||
{
|
|
||||||
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
// Probably a message sent by us or sent to our local node. FIXME, we should avoid scanning these messages
|
||||||
DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_variant);
|
DEBUG_MSG("Ignoring nonrelevant admin %d\n", r->which_variant);
|
||||||
}
|
}
|
||||||
@ -181,11 +281,6 @@ void AdminModule::handleSetOwner(const User &o)
|
|||||||
owner.is_licensed = o.is_licensed;
|
owner.is_licensed = o.is_licensed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!changed || o.team) && (owner.team != o.team)) {
|
|
||||||
changed = 1;
|
|
||||||
owner.team = o.team;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed) // If nothing really changed, don't broadcast on the network or write to flash
|
if (changed) // If nothing really changed, don't broadcast on the network or write to flash
|
||||||
service.reloadOwner();
|
service.reloadOwner();
|
||||||
}
|
}
|
||||||
@ -212,6 +307,66 @@ void AdminModule::handleSetRadio(RadioConfig &r)
|
|||||||
service.reloadConfig();
|
service.reloadConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdminModule::handleSetConfig(const Config &c)
|
||||||
|
{
|
||||||
|
switch (c.which_payloadVariant) {
|
||||||
|
case AdminMessage_ConfigType_ALL:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_ALL\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_CORE_ONLY:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_CORE_ONLY\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_ONLY:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_ONLY\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_DEVICE_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_DEVICE_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_GPS_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_GPS_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_POWER_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_POWER_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_WIFI_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_WIFI_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_DISPLAY_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_DISPLAY_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_LORA_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_LORA_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_MQTT_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_MQTT_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_SERIAL_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_SERIAL_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_EXTNOTIF_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_STOREFORWARD_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_RANGETEST_CONFIG\n");
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_TELEMETRY_CONFIG\n");
|
||||||
|
config.payloadVariant.module_config.payloadVariant.telemetry_config =
|
||||||
|
c.payloadVariant.module_config.payloadVariant.telemetry_config;
|
||||||
|
break;
|
||||||
|
case AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG:
|
||||||
|
DEBUG_MSG("Setting config: AdminMessage_ConfigType_MODULE_CANNEDMSG_CONFIG\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
service.reloadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, AdminMessage_fields)
|
AdminModule::AdminModule() : ProtobufModule("Admin", PortNum_ADMIN_APP, AdminMessage_fields)
|
||||||
{
|
{
|
||||||
// restrict to the admin channel for rx
|
// restrict to the admin channel for rx
|
||||||
|
@ -23,9 +23,11 @@ class AdminModule : public ProtobufModule<AdminMessage>
|
|||||||
void handleSetOwner(const User &o);
|
void handleSetOwner(const User &o);
|
||||||
void handleSetChannel(const Channel &cc);
|
void handleSetChannel(const Channel &cc);
|
||||||
void handleSetRadio(RadioConfig &r);
|
void handleSetRadio(RadioConfig &r);
|
||||||
|
void handleSetConfig(const Config &c);
|
||||||
|
|
||||||
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);
|
||||||
|
void handleGetConfig(const MeshPacket &req);
|
||||||
void handleGetOwner(const MeshPacket &req);
|
void handleGetOwner(const MeshPacket &req);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void PositionModule::sendOurPosition(NodeNum dest, bool wantReplies)
|
|||||||
p->priority = MeshPacket_Priority_BACKGROUND;
|
p->priority = MeshPacket_Priority_BACKGROUND;
|
||||||
prevPacketId = p->id;
|
prevPacketId = p->id;
|
||||||
|
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PositionModule::runOnce()
|
int32_t PositionModule::runOnce()
|
||||||
|
@ -20,7 +20,8 @@ int32_t DeviceTelemetryModule::runOnce()
|
|||||||
}
|
}
|
||||||
sendOurTelemetry();
|
sendOurTelemetry();
|
||||||
// OSThread library. Multiply the preference value by 1000 to convert seconds to miliseconds
|
// OSThread library. Multiply the preference value by 1000 to convert seconds to miliseconds
|
||||||
return (getPref_telemetry_module_device_update_interval() * 1000);
|
|
||||||
|
return getIntervalOrDefaultMs(moduleConfig.device_update_interval);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/telemetry.pb.h"
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ class DeviceTelemetryModule : private concurrency::OSThread, public ProtobufModu
|
|||||||
bool sendOurTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
bool sendOurTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Config_ModuleConfig_TelemetryConfig moduleConfig = config.payloadVariant.module_config.payloadVariant.telemetry_config;
|
||||||
bool firstTime = 1;
|
bool firstTime = 1;
|
||||||
const MeshPacket *lastMeasurementPacket;
|
const MeshPacket *lastMeasurementPacket;
|
||||||
};
|
};
|
||||||
|
@ -50,17 +50,17 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
without having to configure it from the PythonAPI or WebUI.
|
without having to configure it from the PythonAPI or WebUI.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
radioConfig.preferences.telemetry_module_environment_measurement_enabled = 1;
|
moduleConfig.environment_measurement_enabled = 1;
|
||||||
radioConfig.preferences.telemetry_module_environment_screen_enabled = 1;
|
moduleConfig.environment_screen_enabled = 1;
|
||||||
radioConfig.preferences.telemetry_module_environment_read_error_count_threshold = 5;
|
moduleConfig.environment_read_error_count_threshold = 5;
|
||||||
radioConfig.preferences.telemetry_module_environment_update_interval = 600;
|
moduleConfig.environment_update_interval = 600;
|
||||||
radioConfig.preferences.telemetry_module_environment_recovery_interval = 60;
|
moduleConfig.environment_recovery_interval = 60;
|
||||||
radioConfig.preferences.telemetry_module_environment_sensor_pin = 13; // If one-wire
|
moduleConfig.environment_sensor_pin = 13; // If one-wire
|
||||||
radioConfig.preferences.telemetry_module_environment_sensor_type = RadioConfig_UserPreferences_TelemetrySensorType::RadioConfig_UserPreferences_TelemetrySensorType_BME280;
|
moduleConfig.environment_sensor_type = TelemetrySensorType::TelemetrySensorType_BME280;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!(radioConfig.preferences.telemetry_module_environment_measurement_enabled ||
|
if (!(moduleConfig.environment_measurement_enabled ||
|
||||||
radioConfig.preferences.telemetry_module_environment_screen_enabled)) {
|
moduleConfig.environment_screen_enabled)) {
|
||||||
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
// If this module is not enabled, and the user doesn't want the display screen don't waste any OSThread time on it
|
||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
}
|
}
|
||||||
@ -69,24 +69,24 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
// This is the first time the OSThread library has called this function, so do some setup
|
// This is the first time the OSThread library has called this function, so do some setup
|
||||||
firstTime = 0;
|
firstTime = 0;
|
||||||
|
|
||||||
if (radioConfig.preferences.telemetry_module_environment_measurement_enabled) {
|
if (moduleConfig.environment_measurement_enabled) {
|
||||||
DEBUG_MSG("Environment Telemetry: Initializing\n");
|
DEBUG_MSG("Environment Telemetry: Initializing\n");
|
||||||
// it's possible to have this module enabled, only for displaying values on the screen.
|
// it's possible to have this module enabled, only for displaying values on the screen.
|
||||||
// therefore, we should only enable the sensor loop if measurement is also enabled
|
// therefore, we should only enable the sensor loop if measurement is also enabled
|
||||||
switch (radioConfig.preferences.telemetry_module_environment_sensor_type) {
|
switch (moduleConfig.environment_sensor_type) {
|
||||||
|
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT11:
|
case TelemetrySensorType_DHT11:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT12:
|
case TelemetrySensorType_DHT12:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT21:
|
case TelemetrySensorType_DHT21:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT22:
|
case TelemetrySensorType_DHT22:
|
||||||
return dhtSensor.runOnce();
|
return dhtSensor.runOnce();
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DS18B20:
|
case TelemetrySensorType_DS18B20:
|
||||||
return dallasSensor.runOnce();
|
return dallasSensor.runOnce();
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME280:
|
case TelemetrySensorType_BME280:
|
||||||
return bme280Sensor.runOnce();
|
return bme280Sensor.runOnce();
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME680:
|
case TelemetrySensorType_BME680:
|
||||||
return bme680Sensor.runOnce();
|
return bme680Sensor.runOnce();
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_MCP9808:
|
case TelemetrySensorType_MCP9808:
|
||||||
return mcp9808Sensor.runOnce();
|
return mcp9808Sensor.runOnce();
|
||||||
default:
|
default:
|
||||||
DEBUG_MSG("Environment Telemetry: Invalid sensor type selected; Disabling module");
|
DEBUG_MSG("Environment Telemetry: Invalid sensor type selected; Disabling module");
|
||||||
@ -97,55 +97,54 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
} else {
|
} else {
|
||||||
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
|
// if we somehow got to a second run of this module with measurement disabled, then just wait forever
|
||||||
if (!radioConfig.preferences.telemetry_module_environment_measurement_enabled)
|
if (!moduleConfig.environment_measurement_enabled)
|
||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
// this is not the first time OSThread library has called this function
|
// this is not the first time OSThread library has called this function
|
||||||
// so just do what we intend to do on the interval
|
// so just do what we intend to do on the interval
|
||||||
if (sensor_read_error_count > radioConfig.preferences.telemetry_module_environment_read_error_count_threshold) {
|
if (sensor_read_error_count > moduleConfig.environment_read_error_count_threshold) {
|
||||||
if (radioConfig.preferences.telemetry_module_environment_recovery_interval > 0) {
|
if (moduleConfig.environment_recovery_interval > 0) {
|
||||||
DEBUG_MSG("Environment Telemetry: TEMPORARILY DISABLED; The "
|
DEBUG_MSG("Environment Telemetry: TEMPORARILY DISABLED; The "
|
||||||
"telemetry_module_environment_read_error_count_threshold has been exceed: %d. Will retry reads in "
|
"telemetry_module_environment_read_error_count_threshold has been exceed: %d. Will retry reads in "
|
||||||
"%d seconds\n",
|
"%d seconds\n",
|
||||||
radioConfig.preferences.telemetry_module_environment_read_error_count_threshold,
|
moduleConfig.environment_read_error_count_threshold,
|
||||||
radioConfig.preferences.telemetry_module_environment_recovery_interval);
|
moduleConfig.environment_recovery_interval);
|
||||||
sensor_read_error_count = 0;
|
sensor_read_error_count = 0;
|
||||||
return (radioConfig.preferences.telemetry_module_environment_recovery_interval * 1000);
|
return (moduleConfig.environment_recovery_interval * 1000);
|
||||||
}
|
}
|
||||||
DEBUG_MSG("Environment Telemetry: DISABLED; The telemetry_module_environment_read_error_count_threshold has "
|
DEBUG_MSG("Environment Telemetry: DISABLED; The telemetry_module_environment_read_error_count_threshold has "
|
||||||
"been exceed: %d. Reads will not be retried until after device reset\n",
|
"been exceed: %d. Reads will not be retried until after device reset\n",
|
||||||
radioConfig.preferences.telemetry_module_environment_read_error_count_threshold);
|
moduleConfig.environment_read_error_count_threshold);
|
||||||
return (INT32_MAX);
|
return (INT32_MAX);
|
||||||
|
|
||||||
} else if (sensor_read_error_count > 0) {
|
} else if (sensor_read_error_count > 0) {
|
||||||
DEBUG_MSG("Environment Telemetry: There have been %d sensor read failures. Will retry %d more times\n",
|
DEBUG_MSG("Environment Telemetry: There have been %d sensor read failures. Will retry %d more times\n",
|
||||||
sensor_read_error_count, sensor_read_error_count, sensor_read_error_count,
|
sensor_read_error_count, sensor_read_error_count, sensor_read_error_count,
|
||||||
radioConfig.preferences.telemetry_module_environment_read_error_count_threshold -
|
moduleConfig.environment_read_error_count_threshold -
|
||||||
sensor_read_error_count);
|
sensor_read_error_count);
|
||||||
}
|
}
|
||||||
if (!sendOurTelemetry()) {
|
if (!sendOurTelemetry()) {
|
||||||
// if we failed to read the sensor, then try again
|
// if we failed to read the sensor, then try again
|
||||||
// as soon as we can according to the maximum polling frequency
|
// as soon as we can according to the maximum polling frequency
|
||||||
|
|
||||||
switch (radioConfig.preferences.telemetry_module_environment_sensor_type) {
|
switch (moduleConfig.environment_sensor_type) {
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT11:
|
case TelemetrySensorType_DHT11:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT12:
|
case TelemetrySensorType_DHT12:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT21:
|
case TelemetrySensorType_DHT21:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT22:
|
case TelemetrySensorType_DHT22:
|
||||||
return (DHT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (DHT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DS18B20:
|
case TelemetrySensorType_DS18B20:
|
||||||
return (DS18B20_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (DS18B20_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME280:
|
case TelemetrySensorType_BME280:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME680:
|
case TelemetrySensorType_BME680:
|
||||||
return (BME_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (BME_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_MCP9808:
|
case TelemetrySensorType_MCP9808:
|
||||||
return (MCP_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (MCP_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
default:
|
default:
|
||||||
return (DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// OSThread library. Multiply the preference value by 1000 to convert seconds to miliseconds
|
return getIntervalOrDefaultMs(moduleConfig.environment_update_interval);
|
||||||
return (getPref_telemetry_module_environment_update_interval() * 1000);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +162,7 @@ uint32_t GetTimeSinceMeshPacket(const MeshPacket *mp)
|
|||||||
|
|
||||||
bool EnvironmentTelemetryModule::wantUIFrame()
|
bool EnvironmentTelemetryModule::wantUIFrame()
|
||||||
{
|
{
|
||||||
return radioConfig.preferences.telemetry_module_environment_screen_enabled;
|
return moduleConfig.environment_screen_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
float EnvironmentTelemetryModule::CelsiusToFahrenheit(float c)
|
float EnvironmentTelemetryModule::CelsiusToFahrenheit(float c)
|
||||||
@ -197,7 +196,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
|
|||||||
|
|
||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
String last_temp = String(lastMeasurement.variant.environment_metrics.temperature, 0) + "°C";
|
String last_temp = String(lastMeasurement.variant.environment_metrics.temperature, 0) + "°C";
|
||||||
if (radioConfig.preferences.telemetry_module_environment_display_fahrenheit) {
|
if (moduleConfig.environment_display_fahrenheit) {
|
||||||
last_temp = String(CelsiusToFahrenheit(lastMeasurement.variant.environment_metrics.temperature), 0) + "°F";
|
last_temp = String(CelsiusToFahrenheit(lastMeasurement.variant.environment_metrics.temperature), 0) + "°F";
|
||||||
}
|
}
|
||||||
display->drawString(x, y += fontHeight(FONT_MEDIUM) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)");
|
display->drawString(x, y += fontHeight(FONT_MEDIUM) - 2, "From: " + String(lastSender) + "(" + String(agoSecs) + "s)");
|
||||||
@ -243,25 +242,25 @@ bool EnvironmentTelemetryModule::sendOurTelemetry(NodeNum dest, bool wantReplies
|
|||||||
DEBUG_MSG("-----------------------------------------\n");
|
DEBUG_MSG("-----------------------------------------\n");
|
||||||
DEBUG_MSG("Environment Telemetry: Read data\n");
|
DEBUG_MSG("Environment Telemetry: Read data\n");
|
||||||
|
|
||||||
switch (radioConfig.preferences.telemetry_module_environment_sensor_type) {
|
switch (moduleConfig.environment_sensor_type) {
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DS18B20:
|
case TelemetrySensorType_DS18B20:
|
||||||
if (!dallasSensor.getMeasurement(&m))
|
if (!dallasSensor.getMeasurement(&m))
|
||||||
sensor_read_error_count++;
|
sensor_read_error_count++;
|
||||||
break;
|
break;
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT11:
|
case TelemetrySensorType_DHT11:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT12:
|
case TelemetrySensorType_DHT12:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT21:
|
case TelemetrySensorType_DHT21:
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_DHT22:
|
case TelemetrySensorType_DHT22:
|
||||||
if (!dhtSensor.getMeasurement(&m))
|
if (!dhtSensor.getMeasurement(&m))
|
||||||
sensor_read_error_count++;
|
sensor_read_error_count++;
|
||||||
break;
|
break;
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME280:
|
case TelemetrySensorType_BME280:
|
||||||
bme280Sensor.getMeasurement(&m);
|
bme280Sensor.getMeasurement(&m);
|
||||||
break;
|
break;
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_BME680:
|
case TelemetrySensorType_BME680:
|
||||||
bme680Sensor.getMeasurement(&m);
|
bme680Sensor.getMeasurement(&m);
|
||||||
break;
|
break;
|
||||||
case RadioConfig_UserPreferences_TelemetrySensorType_MCP9808:
|
case TelemetrySensorType_MCP9808:
|
||||||
mcp9808Sensor.getMeasurement(&m);
|
mcp9808Sensor.getMeasurement(&m);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/telemetry.pb.h"
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu
|
|||||||
bool sendOurTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
bool sendOurTelemetry(NodeNum dest = NODENUM_BROADCAST, bool wantReplies = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Config_ModuleConfig_TelemetryConfig moduleConfig = config.payloadVariant.module_config.payloadVariant.telemetry_config;
|
||||||
float CelsiusToFahrenheit(float c);
|
float CelsiusToFahrenheit(float c);
|
||||||
bool firstTime = 1;
|
bool firstTime = 1;
|
||||||
const MeshPacket *lastMeasurementPacket;
|
const MeshPacket *lastMeasurementPacket;
|
||||||
|
@ -9,18 +9,18 @@ DHTSensor::DHTSensor() : TelemetrySensor {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t DHTSensor::runOnce() {
|
int32_t DHTSensor::runOnce() {
|
||||||
if (RadioConfig_UserPreferences_TelemetrySensorType_DHT11 ||
|
if (TelemetrySensorType_DHT11 ||
|
||||||
RadioConfig_UserPreferences_TelemetrySensorType_DHT12) {
|
TelemetrySensorType_DHT12) {
|
||||||
dht = new DHT(radioConfig.preferences.telemetry_module_environment_sensor_pin, DHT11);
|
dht = new DHT(moduleConfig.environment_sensor_pin, DHT11);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dht = new DHT(radioConfig.preferences.telemetry_module_environment_sensor_pin, DHT22);
|
dht = new DHT(moduleConfig.environment_sensor_pin, DHT22);
|
||||||
}
|
}
|
||||||
|
|
||||||
dht->begin();
|
dht->begin();
|
||||||
dht->read();
|
dht->read();
|
||||||
DEBUG_MSG("Telemetry: Opened DHT11/DHT12 on pin: %d\n",
|
DEBUG_MSG("Telemetry: Opened DHT11/DHT12 on pin: %d\n",
|
||||||
radioConfig.preferences.telemetry_module_environment_sensor_pin);
|
moduleConfig.environment_sensor_pin);
|
||||||
|
|
||||||
return (DHT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (DHT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@ DallasSensor::DallasSensor() : TelemetrySensor {} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t DallasSensor::runOnce() {
|
int32_t DallasSensor::runOnce() {
|
||||||
oneWire = new OneWire(radioConfig.preferences.telemetry_module_environment_sensor_pin);
|
oneWire = new OneWire(moduleConfig.environment_sensor_pin);
|
||||||
ds18b20 = new DS18B20(oneWire);
|
ds18b20 = new DS18B20(oneWire);
|
||||||
ds18b20->begin();
|
ds18b20->begin();
|
||||||
ds18b20->setResolution(12);
|
ds18b20->setResolution(12);
|
||||||
ds18b20->requestTemperatures();
|
ds18b20->requestTemperatures();
|
||||||
DEBUG_MSG("Telemetry: Opened DS18B20 on pin: %d\n",
|
DEBUG_MSG("Telemetry: Opened DS18B20 on pin: %d\n",
|
||||||
radioConfig.preferences.telemetry_module_environment_sensor_pin);
|
moduleConfig.environment_sensor_pin);
|
||||||
return (DS18B20_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
return (DS18B20_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/telemetry.pb.h"
|
||||||
|
#include "NodeDB.h"
|
||||||
#define DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS 1000
|
#define DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS 1000
|
||||||
|
|
||||||
class TelemetrySensor {
|
class TelemetrySensor {
|
||||||
protected:
|
protected:
|
||||||
TelemetrySensor() { }
|
TelemetrySensor() { }
|
||||||
|
Config_ModuleConfig_TelemetryConfig moduleConfig = config.payloadVariant.module_config.payloadVariant.telemetry_config;
|
||||||
public:
|
public:
|
||||||
virtual int32_t runOnce() = 0;
|
virtual int32_t runOnce() = 0;
|
||||||
virtual bool getMeasurement(Telemetry *measurement) = 0;
|
virtual bool getMeasurement(Telemetry *measurement) = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "CryptoEngine.h"
|
#include "CryptoEngine.h"
|
||||||
#include <Adafruit_nRFCrypto.h>
|
#include <Adafruit_nRFCrypto.h>
|
||||||
|
#include "aes-256/tiny-aes.h"
|
||||||
class NRF52CryptoEngine : public CryptoEngine
|
class NRF52CryptoEngine : public CryptoEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -18,7 +18,12 @@ class NRF52CryptoEngine : public CryptoEngine
|
|||||||
{
|
{
|
||||||
// DEBUG_MSG("NRF52 encrypt!\n");
|
// DEBUG_MSG("NRF52 encrypt!\n");
|
||||||
|
|
||||||
if (key.length > 0) {
|
if (key.length > 16) {
|
||||||
|
AES_ctx ctx;
|
||||||
|
initNonce(fromNode, packetId);
|
||||||
|
AES_init_ctx_iv(&ctx, key.bytes, nonce);
|
||||||
|
AES_CTR_xcrypt_buffer(&ctx, bytes, numBytes);
|
||||||
|
} else if (key.length > 0) {
|
||||||
nRFCrypto.begin();
|
nRFCrypto.begin();
|
||||||
nRFCrypto_AES ctx;
|
nRFCrypto_AES ctx;
|
||||||
uint8_t myLen = ctx.blockLen(numBytes);
|
uint8_t myLen = ctx.blockLen(numBytes);
|
||||||
@ -36,7 +41,12 @@ class NRF52CryptoEngine : public CryptoEngine
|
|||||||
{
|
{
|
||||||
// DEBUG_MSG("NRF52 decrypt!\n");
|
// DEBUG_MSG("NRF52 decrypt!\n");
|
||||||
|
|
||||||
if (key.length > 0) {
|
if (key.length > 16) {
|
||||||
|
AES_ctx ctx;
|
||||||
|
initNonce(fromNode, packetId);
|
||||||
|
AES_init_ctx_iv(&ctx, key.bytes, nonce);
|
||||||
|
AES_CTR_xcrypt_buffer(&ctx, bytes, numBytes);
|
||||||
|
} else if (key.length > 0) {
|
||||||
nRFCrypto.begin();
|
nRFCrypto.begin();
|
||||||
nRFCrypto_AES ctx;
|
nRFCrypto_AES ctx;
|
||||||
uint8_t myLen = ctx.blockLen(numBytes);
|
uint8_t myLen = ctx.blockLen(numBytes);
|
||||||
|
229
src/nrf52/aes-256/tiny-aes.cpp
Normal file
229
src/nrf52/aes-256/tiny-aes.cpp
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
/*
|
||||||
|
AES-256 Software Implementation
|
||||||
|
|
||||||
|
based on https://github.com/kokke/tiny-AES-C/ which is in public domain
|
||||||
|
|
||||||
|
NOTE: String length must be evenly divisible by 16byte (str_len % 16 == 0)
|
||||||
|
You should pad the end of the string with zeros if this is not the case.
|
||||||
|
For AES192/256 the key size is proportionally larger.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "tiny-aes.h"
|
||||||
|
|
||||||
|
#define Nb 4
|
||||||
|
#define Nk 8
|
||||||
|
#define Nr 14
|
||||||
|
|
||||||
|
typedef uint8_t state_t[4][4];
|
||||||
|
|
||||||
|
static const uint8_t sbox[256] = {
|
||||||
|
//0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||||
|
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
||||||
|
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
|
||||||
|
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
|
||||||
|
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
|
||||||
|
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
|
||||||
|
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
|
||||||
|
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
|
||||||
|
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
|
||||||
|
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
|
||||||
|
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
|
||||||
|
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
|
||||||
|
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
|
||||||
|
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
|
||||||
|
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
|
||||||
|
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||||||
|
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 };
|
||||||
|
|
||||||
|
static const uint8_t Rcon[11] = {
|
||||||
|
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36 };
|
||||||
|
|
||||||
|
#define getSBoxValue(num) (sbox[(num)])
|
||||||
|
|
||||||
|
static void KeyExpansion(uint8_t* RoundKey, const uint8_t* Key)
|
||||||
|
{
|
||||||
|
uint8_t tempa[4];
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < Nk; ++i)
|
||||||
|
{
|
||||||
|
RoundKey[(i * 4) + 0] = Key[(i * 4) + 0];
|
||||||
|
RoundKey[(i * 4) + 1] = Key[(i * 4) + 1];
|
||||||
|
RoundKey[(i * 4) + 2] = Key[(i * 4) + 2];
|
||||||
|
RoundKey[(i * 4) + 3] = Key[(i * 4) + 3];
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned i = Nk; i < Nb * (Nr + 1); ++i)
|
||||||
|
{
|
||||||
|
unsigned k = (i - 1) * 4;
|
||||||
|
tempa[0]=RoundKey[k + 0];
|
||||||
|
tempa[1]=RoundKey[k + 1];
|
||||||
|
tempa[2]=RoundKey[k + 2];
|
||||||
|
tempa[3]=RoundKey[k + 3];
|
||||||
|
|
||||||
|
if (i % Nk == 0)
|
||||||
|
{
|
||||||
|
const uint8_t u8tmp = tempa[0];
|
||||||
|
tempa[0] = tempa[1];
|
||||||
|
tempa[1] = tempa[2];
|
||||||
|
tempa[2] = tempa[3];
|
||||||
|
tempa[3] = u8tmp;
|
||||||
|
|
||||||
|
tempa[0] = getSBoxValue(tempa[0]);
|
||||||
|
tempa[1] = getSBoxValue(tempa[1]);
|
||||||
|
tempa[2] = getSBoxValue(tempa[2]);
|
||||||
|
tempa[3] = getSBoxValue(tempa[3]);
|
||||||
|
|
||||||
|
tempa[0] = tempa[0] ^ Rcon[i/Nk];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i % Nk == 4)
|
||||||
|
{
|
||||||
|
tempa[0] = getSBoxValue(tempa[0]);
|
||||||
|
tempa[1] = getSBoxValue(tempa[1]);
|
||||||
|
tempa[2] = getSBoxValue(tempa[2]);
|
||||||
|
tempa[3] = getSBoxValue(tempa[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned j = i * 4; k=(i - Nk) * 4;
|
||||||
|
RoundKey[j + 0] = RoundKey[k + 0] ^ tempa[0];
|
||||||
|
RoundKey[j + 1] = RoundKey[k + 1] ^ tempa[1];
|
||||||
|
RoundKey[j + 2] = RoundKey[k + 2] ^ tempa[2];
|
||||||
|
RoundKey[j + 3] = RoundKey[k + 3] ^ tempa[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key)
|
||||||
|
{
|
||||||
|
KeyExpansion(ctx->RoundKey, key);
|
||||||
|
}
|
||||||
|
void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv)
|
||||||
|
{
|
||||||
|
KeyExpansion(ctx->RoundKey, key);
|
||||||
|
memcpy (ctx->Iv, iv, AES_BLOCKLEN);
|
||||||
|
}
|
||||||
|
void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv)
|
||||||
|
{
|
||||||
|
memcpy (ctx->Iv, iv, AES_BLOCKLEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void AddRoundKey(uint8_t round, state_t* state, const uint8_t* RoundKey)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
for (uint8_t j = 0; j < 4; ++j)
|
||||||
|
{
|
||||||
|
(*state)[i][j] ^= RoundKey[(round * Nb * 4) + (i * Nb) + j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SubBytes(state_t* state)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
for (uint8_t j = 0; j < 4; ++j)
|
||||||
|
{
|
||||||
|
(*state)[j][i] = getSBoxValue((*state)[j][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ShiftRows(state_t* state)
|
||||||
|
{
|
||||||
|
uint8_t temp = (*state)[0][1];
|
||||||
|
(*state)[0][1] = (*state)[1][1];
|
||||||
|
(*state)[1][1] = (*state)[2][1];
|
||||||
|
(*state)[2][1] = (*state)[3][1];
|
||||||
|
(*state)[3][1] = temp;
|
||||||
|
|
||||||
|
temp = (*state)[0][2];
|
||||||
|
(*state)[0][2] = (*state)[2][2];
|
||||||
|
(*state)[2][2] = temp;
|
||||||
|
|
||||||
|
temp = (*state)[1][2];
|
||||||
|
(*state)[1][2] = (*state)[3][2];
|
||||||
|
(*state)[3][2] = temp;
|
||||||
|
|
||||||
|
temp = (*state)[0][3];
|
||||||
|
(*state)[0][3] = (*state)[3][3];
|
||||||
|
(*state)[3][3] = (*state)[2][3];
|
||||||
|
(*state)[2][3] = (*state)[1][3];
|
||||||
|
(*state)[1][3] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint8_t xtime(uint8_t x)
|
||||||
|
{
|
||||||
|
return ((x<<1) ^ (((x>>7) & 1) * 0x1b));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MixColumns(state_t* state)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
uint8_t t = (*state)[i][0];
|
||||||
|
uint8_t Tmp = (*state)[i][0] ^ (*state)[i][1] ^ (*state)[i][2] ^ (*state)[i][3] ;
|
||||||
|
uint8_t Tm = (*state)[i][0] ^ (*state)[i][1] ; Tm = xtime(Tm); (*state)[i][0] ^= Tm ^ Tmp ;
|
||||||
|
Tm = (*state)[i][1] ^ (*state)[i][2] ; Tm = xtime(Tm); (*state)[i][1] ^= Tm ^ Tmp ;
|
||||||
|
Tm = (*state)[i][2] ^ (*state)[i][3] ; Tm = xtime(Tm); (*state)[i][2] ^= Tm ^ Tmp ;
|
||||||
|
Tm = (*state)[i][3] ^ t ; Tm = xtime(Tm); (*state)[i][3] ^= Tm ^ Tmp ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define Multiply(x, y) \
|
||||||
|
( ((y & 1) * x) ^ \
|
||||||
|
((y>>1 & 1) * xtime(x)) ^ \
|
||||||
|
((y>>2 & 1) * xtime(xtime(x))) ^ \
|
||||||
|
((y>>3 & 1) * xtime(xtime(xtime(x)))) ^ \
|
||||||
|
((y>>4 & 1) * xtime(xtime(xtime(xtime(x)))))) \
|
||||||
|
|
||||||
|
|
||||||
|
static void Cipher(state_t* state, const uint8_t* RoundKey)
|
||||||
|
{
|
||||||
|
uint8_t round = 0;
|
||||||
|
|
||||||
|
AddRoundKey(0, state, RoundKey);
|
||||||
|
|
||||||
|
for (round = 1; ; ++round)
|
||||||
|
{
|
||||||
|
SubBytes(state);
|
||||||
|
ShiftRows(state);
|
||||||
|
if (round == Nr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
MixColumns(state);
|
||||||
|
AddRoundKey(round, state, RoundKey);
|
||||||
|
}
|
||||||
|
AddRoundKey(Nr, state, RoundKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length)
|
||||||
|
{
|
||||||
|
uint8_t buffer[AES_BLOCKLEN];
|
||||||
|
|
||||||
|
size_t i;
|
||||||
|
int bi;
|
||||||
|
for (i = 0, bi = AES_BLOCKLEN; i < length; ++i, ++bi)
|
||||||
|
{
|
||||||
|
if (bi == AES_BLOCKLEN)
|
||||||
|
{
|
||||||
|
|
||||||
|
memcpy(buffer, ctx->Iv, AES_BLOCKLEN);
|
||||||
|
Cipher((state_t*)buffer,ctx->RoundKey);
|
||||||
|
|
||||||
|
for (bi = (AES_BLOCKLEN - 1); bi >= 0; --bi)
|
||||||
|
{
|
||||||
|
if (ctx->Iv[bi] == 255)
|
||||||
|
{
|
||||||
|
ctx->Iv[bi] = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ctx->Iv[bi] += 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
bi = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf[i] = (buf[i] ^ buffer[bi]);
|
||||||
|
}
|
||||||
|
}
|
23
src/nrf52/aes-256/tiny-aes.h
Normal file
23
src/nrf52/aes-256/tiny-aes.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#ifndef _TINY_AES_H_
|
||||||
|
#define _TINY_AES_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#define AES_BLOCKLEN 16 // Block length in bytes - AES is 128b block only
|
||||||
|
// #define AES_KEYLEN 32
|
||||||
|
#define AES_keyExpSize 240
|
||||||
|
|
||||||
|
struct AES_ctx
|
||||||
|
{
|
||||||
|
uint8_t RoundKey[AES_keyExpSize];
|
||||||
|
uint8_t Iv[AES_BLOCKLEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
void AES_init_ctx(struct AES_ctx* ctx, const uint8_t* key);
|
||||||
|
void AES_init_ctx_iv(struct AES_ctx* ctx, const uint8_t* key, const uint8_t* iv);
|
||||||
|
void AES_ctx_set_iv(struct AES_ctx* ctx, const uint8_t* iv);
|
||||||
|
|
||||||
|
void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length);
|
||||||
|
|
||||||
|
#endif // _TINY_AES_H_
|
@ -33,8 +33,8 @@ void __attribute__((noreturn)) __assert_func(const char *file, int line, const c
|
|||||||
{
|
{
|
||||||
DEBUG_MSG("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr);
|
DEBUG_MSG("assert failed %s: %d, %s, test=%s\n", file, line, func, failedexpr);
|
||||||
// debugger_break(); FIXME doesn't work, possibly not for segger
|
// debugger_break(); FIXME doesn't work, possibly not for segger
|
||||||
while (1)
|
// Reboot cpu
|
||||||
; // FIXME, reboot!
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void getMacAddr(uint8_t *dmac)
|
void getMacAddr(uint8_t *dmac)
|
||||||
@ -196,4 +196,4 @@ void clearBonds() {
|
|||||||
nrf52Bluetooth->setup();
|
nrf52Bluetooth->setup();
|
||||||
}
|
}
|
||||||
nrf52Bluetooth->clearBonds();
|
nrf52Bluetooth->clearBonds();
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,11 @@
|
|||||||
void powerCommandsCheck()
|
void powerCommandsCheck()
|
||||||
{
|
{
|
||||||
if (rebootAtMsec && millis() > rebootAtMsec) {
|
if (rebootAtMsec && millis() > rebootAtMsec) {
|
||||||
|
DEBUG_MSG("Rebooting\n");
|
||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
DEBUG_MSG("Rebooting for update\n");
|
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
|
#elif NRF52_SERIES
|
||||||
|
NVIC_SystemReset();
|
||||||
#else
|
#else
|
||||||
DEBUG_MSG("FIXME implement reboot for this platform");
|
DEBUG_MSG("FIXME implement reboot for this platform");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "configuration.h"
|
|
||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include "GPS.h"
|
#include "GPS.h"
|
||||||
#include "MeshRadio.h"
|
#include "MeshRadio.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
#include "NodeDB.h"
|
#include "NodeDB.h"
|
||||||
|
#include "configuration.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
@ -11,10 +11,10 @@
|
|||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
#include "esp32/pm.h"
|
#include "esp32/pm.h"
|
||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "rom/rtc.h"
|
#include "rom/rtc.h"
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
#include <driver/uart.h>
|
#include <driver/uart.h>
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
|
||||||
|
|
||||||
#include "nimble/BluetoothUtil.h"
|
#include "nimble/BluetoothUtil.h"
|
||||||
|
|
||||||
@ -51,25 +51,25 @@ void setCPUFast(bool on)
|
|||||||
#ifndef NO_ESP32
|
#ifndef NO_ESP32
|
||||||
|
|
||||||
if (isWifiAvailable()) {
|
if (isWifiAvailable()) {
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* There's a newly introduced bug in the espressif framework where WiFi is
|
* There's a newly introduced bug in the espressif framework where WiFi is
|
||||||
* unstable when the frequency is less than 240mhz.
|
* unstable when the frequency is less than 240mhz.
|
||||||
*
|
*
|
||||||
* This mostly impacts WiFi AP mode but we'll bump the frequency for
|
* This mostly impacts WiFi AP mode but we'll bump the frequency for
|
||||||
* all WiFi use cases.
|
* all WiFi use cases.
|
||||||
* (Added: Dec 23, 2021 by Jm Casler)
|
* (Added: Dec 23, 2021 by Jm Casler)
|
||||||
*/
|
*/
|
||||||
DEBUG_MSG("Setting CPU to 240mhz because WiFi is in use.\n");
|
DEBUG_MSG("Setting CPU to 240mhz because WiFi is in use.\n");
|
||||||
setCpuFrequencyMhz(240);
|
setCpuFrequencyMhz(240);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Heltec LORA32 V1 runs at 26 MHz base frequency and doesn't react well to switching to 80 MHz...
|
// The Heltec LORA32 V1 runs at 26 MHz base frequency and doesn't react well to switching to 80 MHz...
|
||||||
#ifndef ARDUINO_HELTEC_WIFI_LORA_32
|
#ifndef ARDUINO_HELTEC_WIFI_LORA_32
|
||||||
setCpuFrequencyMhz(on ? 240 : 80);
|
setCpuFrequencyMhz(on ? 240 : 80);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,12 +284,12 @@ esp_sleep_wakeup_cause_t doLightSleep(uint64_t sleepMsec) // FIXME, use a more r
|
|||||||
*/
|
*/
|
||||||
void enableModemSleep()
|
void enableModemSleep()
|
||||||
{
|
{
|
||||||
static esp_pm_config_esp32_t config; // filled with zeros because bss
|
static esp_pm_config_esp32_t esp32_config; // filled with zeros because bss
|
||||||
|
|
||||||
config.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
|
esp32_config.max_freq_mhz = CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ;
|
||||||
config.min_freq_mhz = 20; // 10Mhz is minimum recommended
|
esp32_config.min_freq_mhz = 20; // 10Mhz is minimum recommended
|
||||||
config.light_sleep_enable = false;
|
esp32_config.light_sleep_enable = false;
|
||||||
int rv = esp_pm_configure(&config);
|
int rv = esp_pm_configure(&esp32_config);
|
||||||
DEBUG_MSG("Sleep request result %x\n", rv);
|
DEBUG_MSG("Sleep request result %x\n", rv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,8 +139,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define SX126X_DIO1 (0 + 29) // DIO1 P0.29
|
#define SX126X_DIO1 (0 + 29) // DIO1 P0.29
|
||||||
#define SX126X_BUSY (0 + 2) // LORA_BUSY P0.02
|
#define SX126X_BUSY (0 + 2) // LORA_BUSY P0.02
|
||||||
#define SX126X_RESET (32 + 15) // LORA_RESET P1.15
|
#define SX126X_RESET (32 + 15) // LORA_RESET P1.15
|
||||||
#define SX126X_TXEN (-1) // TXEN P1.13 NiceRF 868 dont use
|
#define SX126X_TXEN (32 + 13) // TXEN P1.13 NiceRF 868 dont use
|
||||||
#define SX126X_RXEN (-1) // RXEN P1.10 NiceRF 868 dont use
|
#define SX126X_RXEN (32 + 10) // RXEN P1.10 NiceRF 868 dont use
|
||||||
#define SX126X_E22
|
#define SX126X_E22
|
||||||
|
|
||||||
#define PIN_GPS_EN (-1)
|
#define PIN_GPS_EN (-1)
|
||||||
|
@ -6,6 +6,7 @@ build_flags = ${nrf52840_base.build_flags} -Ivariants/rak4631 -D RAK_4631
|
|||||||
src_filter = ${nrf52_base.src_filter} +<../variants/rak4631>
|
src_filter = ${nrf52_base.src_filter} +<../variants/rak4631>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${nrf52840_base.lib_deps}
|
${nrf52840_base.lib_deps}
|
||||||
|
melopero/Melopero RV3028@^1.1.0
|
||||||
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)
|
||||||
;upload_protocol = jlink
|
;upload_protocol = jlink
|
@ -198,6 +198,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||||
|
|
||||||
|
// RAK12002 RTC Module
|
||||||
|
#define RV3028_RTC (uint8_t) 0b1010010
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
// The battery sense is hooked to pin A0 (5)
|
// The battery sense is hooked to pin A0 (5)
|
||||||
#define BATTERY_PIN PIN_A0
|
#define BATTERY_PIN PIN_A0
|
||||||
|
@ -7,6 +7,7 @@ src_filter = ${nrf52_base.src_filter} +<../variants/rak4631_epaper>
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
${nrf52840_base.lib_deps}
|
${nrf52840_base.lib_deps}
|
||||||
https://github.com/ZinggJM/GxEPD2.git
|
https://github.com/ZinggJM/GxEPD2.git
|
||||||
|
melopero/Melopero RV3028@^1.1.0
|
||||||
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)
|
||||||
;upload_protocol = jlink
|
;upload_protocol = jlink
|
@ -198,6 +198,9 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define GPS_RX_PIN PIN_SERIAL1_RX
|
#define GPS_RX_PIN PIN_SERIAL1_RX
|
||||||
#define GPS_TX_PIN PIN_SERIAL1_TX
|
#define GPS_TX_PIN PIN_SERIAL1_TX
|
||||||
|
|
||||||
|
// RAK12002 RTC Module
|
||||||
|
#define RV3028_RTC (uint8_t) 0b1010010
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
// The battery sense is hooked to pin A0 (5)
|
// The battery sense is hooked to pin A0 (5)
|
||||||
#define BATTERY_PIN PIN_A0
|
#define BATTERY_PIN PIN_A0
|
||||||
|
@ -14,4 +14,5 @@ lib_deps =
|
|||||||
${nrf52840_base.lib_deps}
|
${nrf52840_base.lib_deps}
|
||||||
https://github.com/meshtastic/GxEPD2
|
https://github.com/meshtastic/GxEPD2
|
||||||
adafruit/Adafruit BusIO
|
adafruit/Adafruit BusIO
|
||||||
|
lewisxhe/PCF8563_Library@^0.0.1
|
||||||
;upload_protocol = fs
|
;upload_protocol = fs
|
||||||
|
@ -182,6 +182,9 @@ External serial flash WP25R1635FZUIL0
|
|||||||
#define PIN_SERIAL1_RX PIN_GPS_TX
|
#define PIN_SERIAL1_RX PIN_GPS_TX
|
||||||
#define PIN_SERIAL1_TX PIN_GPS_RX
|
#define PIN_SERIAL1_TX PIN_GPS_RX
|
||||||
|
|
||||||
|
// PCF8563 RTC Module
|
||||||
|
#define PCF8563_RTC 0x51
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SPI Interfaces
|
* SPI Interfaces
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 3
|
minor = 3
|
||||||
build = 8
|
build = 10
|
||||||
|
Loading…
Reference in New Issue
Block a user