Merge branch 'master' into loodydo-Compass-Fix
This commit is contained in:
@@ -17,7 +17,7 @@ Import("projenv")
|
|||||||
|
|
||||||
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
|
||||||
verObj = readProps(prefsLoc)
|
verObj = readProps(prefsLoc)
|
||||||
print("Using meshtastic platformio-custom.py, firmare version " + verObj['long'])
|
print("Using meshtastic platformio-custom.py, firmware version " + verObj['long'])
|
||||||
# print("path is" + ','.join(sys.path))
|
# print("path is" + ','.join(sys.path))
|
||||||
|
|
||||||
# General options that are passed to the C and C++ compilers
|
# General options that are passed to the C and C++ compilers
|
||||||
|
|||||||
+1
-1
@@ -32,6 +32,6 @@ def readProps(prefsLoc):
|
|||||||
# traceback.print_exc()
|
# traceback.print_exc()
|
||||||
verObj['long'] = verObj['short']
|
verObj['long'] = verObj['short']
|
||||||
|
|
||||||
# print("firmare version " + verStr)
|
# print("firmware version " + verStr)
|
||||||
return verObj
|
return verObj
|
||||||
# print("path is" + ','.join(sys.path))
|
# print("path is" + ','.join(sys.path))
|
||||||
|
|||||||
+3
-3
@@ -78,10 +78,10 @@ lib_deps =
|
|||||||
[environmental_base]
|
[environmental_base]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
adafruit/Adafruit BusIO@^1.11.4
|
adafruit/Adafruit BusIO@^1.11.4
|
||||||
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
|
||||||
robtillaart/DS18B20@^0.1.11
|
robtillaart/DS18B20@^0.1.11
|
||||||
|
adafruit/Adafruit BMP280 Library@^2.6.3
|
||||||
adafruit/Adafruit BME280 Library@^2.2.2
|
adafruit/Adafruit BME280 Library@^2.2.2
|
||||||
adafruit/Adafruit BME680 Library@^2.0.1
|
adafruit/Adafruit BME680 Library@^2.0.1
|
||||||
adafruit/Adafruit MCP9808 Library@^2.0.0
|
adafruit/Adafruit MCP9808 Library@^2.0.0
|
||||||
@@ -92,7 +92,7 @@ lib_deps =
|
|||||||
extends = arduino_base
|
extends = arduino_base
|
||||||
platform = espressif32@3.5.0
|
platform = espressif32@3.5.0
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<nrf52/>
|
${arduino_base.build_src_filter} -<nrf52/> -<stm32wl>
|
||||||
upload_speed = 115200
|
upload_speed = 115200
|
||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ build_flags =
|
|||||||
${arduino_base.build_flags} -Wno-unused-variable
|
${arduino_base.build_flags} -Wno-unused-variable
|
||||||
-Isrc/nrf52
|
-Isrc/nrf52
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
${arduino_base.build_src_filter} -<esp32/> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/>
|
${arduino_base.build_src_filter} -<esp32/> -<stm32wl> -<nimble/> -<mesh/wifi/> -<mesh/http/> -<modules/esp32> -<mqtt/>
|
||||||
lib_ignore =
|
lib_ignore =
|
||||||
BluetoothOTA
|
BluetoothOTA
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule protobufs updated: c63a16c32f...11d94c9b15
+7
-7
@@ -7,7 +7,7 @@
|
|||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include <OneButton.h>
|
#include <OneButton.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "nimble/BluetoothUtil.h"
|
#include "nimble/BluetoothUtil.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
static void userButtonPressedLong()
|
static void userButtonPressedLong()
|
||||||
{
|
{
|
||||||
// DEBUG_MSG("Long press!\n");
|
// DEBUG_MSG("Long press!\n");
|
||||||
#ifndef NRF52_SERIES
|
#ifdef ARCH_ESP32
|
||||||
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.
|
||||||
@@ -137,7 +137,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
setLed(false);
|
setLed(false);
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
#elif NRF52_SERIES
|
#elif defined(ARCH_NRF52)
|
||||||
// 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) && (millis() > 30 * 1000)) {
|
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
||||||
@@ -156,19 +156,19 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
|
|
||||||
static void userButtonDoublePressed()
|
static void userButtonDoublePressed()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
disablePin();
|
disablePin();
|
||||||
#elif defined(HAS_EINK)
|
#elif defined(USE_EINK)
|
||||||
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
digitalWrite(PIN_EINK_EN, digitalRead(PIN_EINK_EN) == LOW);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void userButtonMultiPressed()
|
static void userButtonMultiPressed()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
clearNVS();
|
clearNVS();
|
||||||
#endif
|
#endif
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
clearBonds();
|
clearBonds();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,29 +17,6 @@
|
|||||||
|
|
||||||
#define DEBUG_PORT (*console) // Serial debug port
|
#define DEBUG_PORT (*console) // Serial debug port
|
||||||
|
|
||||||
// What platforms should use SEGGER?
|
|
||||||
#ifdef NRF52_SERIES
|
|
||||||
|
|
||||||
// Always include the SEGGER code on NRF52 - because useful for debugging
|
|
||||||
#include "SEGGER_RTT.h"
|
|
||||||
|
|
||||||
// The channel we send stdout data to
|
|
||||||
#define SEGGER_STDOUT_CH 0
|
|
||||||
|
|
||||||
// Debug printing to segger console
|
|
||||||
#define SEGGER_MSG(...) SEGGER_RTT_printf(SEGGER_STDOUT_CH, __VA_ARGS__)
|
|
||||||
|
|
||||||
// If we are not on a NRF52840 (which has built in USB-ACM serial support) and we don't have serial pins hooked up, then we MUST
|
|
||||||
// use SEGGER for debug output
|
|
||||||
#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA)
|
|
||||||
// No serial ports on this board - ONLY use segger in memory console
|
|
||||||
#define USE_SEGGER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_SEGGER
|
#ifdef USE_SEGGER
|
||||||
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
#define DEBUG_MSG(...) SEGGER_RTT_printf(0, __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
|||||||
+7
-3
@@ -4,21 +4,25 @@
|
|||||||
|
|
||||||
// Cross platform filesystem API
|
// Cross platform filesystem API
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#if defined(ARCH_PORTDUINO)
|
||||||
// Portduino version
|
// Portduino version
|
||||||
#include "PortduinoFS.h"
|
#include "PortduinoFS.h"
|
||||||
#define FSCom PortduinoFS
|
#define FSCom PortduinoFS
|
||||||
#define FSBegin() true
|
#define FSBegin() true
|
||||||
#define FILE_O_WRITE "w"
|
#define FILE_O_WRITE "w"
|
||||||
#define FILE_O_READ "r"
|
#define FILE_O_READ "r"
|
||||||
#elif !defined(NO_ESP32)
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARCH_ESP32)
|
||||||
// ESP32 version
|
// ESP32 version
|
||||||
#include "LITTLEFS.h"
|
#include "LITTLEFS.h"
|
||||||
#define FSCom LITTLEFS
|
#define FSCom LITTLEFS
|
||||||
#define FSBegin() FSCom.begin(true)
|
#define FSBegin() FSCom.begin(true)
|
||||||
#define FILE_O_WRITE "w"
|
#define FILE_O_WRITE "w"
|
||||||
#define FILE_O_READ "r"
|
#define FILE_O_READ "r"
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
|
#if defined(ARCH_NRF52)
|
||||||
// NRF52 version
|
// NRF52 version
|
||||||
#include "InternalFileSystem.h"
|
#include "InternalFileSystem.h"
|
||||||
#define FSCom InternalFS
|
#define FSCom InternalFS
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ bool scheduleOSCallback(PendableFunction callback, void *param1, uint32_t param2
|
|||||||
return xTimerPendFunctionCall(callback, param1, param2, pdMS_TO_TICKS(delayMsec));
|
return xTimerPendFunctionCall(callback, param1, param2, pdMS_TO_TICKS(delayMsec));
|
||||||
} */
|
} */
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
// Super skanky quick hack to use hardware timers of the ESP32
|
// Super skanky quick hack to use hardware timers of the ESP32
|
||||||
static hw_timer_t *timer;
|
static hw_timer_t *timer;
|
||||||
|
|||||||
+17
-6
@@ -46,7 +46,7 @@ Power *power;
|
|||||||
using namespace meshtastic;
|
using namespace meshtastic;
|
||||||
|
|
||||||
#ifndef AREF_VOLTAGE
|
#ifndef AREF_VOLTAGE
|
||||||
#if defined(NRF52_SERIES)
|
#if defined(ARCH_NRF52)
|
||||||
/*
|
/*
|
||||||
* Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4,
|
* Internal Reference is +/-0.6V, with an adjustable gain of 1/6, 1/5, 1/4,
|
||||||
* 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels.
|
* 1/3, 1/2 or 1, meaning 3.6, 3.0, 2.4, 1.8, 1.2 or 0.6V for the ADC levels.
|
||||||
@@ -84,7 +84,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
if (v < noBatVolt)
|
if (v < noBatVolt)
|
||||||
return -1; // If voltage is super low assume no battery installed
|
return -1; // If voltage is super low assume no battery installed
|
||||||
|
|
||||||
#ifndef NRF52_SERIES
|
#ifdef ARCH_ESP32
|
||||||
// This does not work on a RAK4631 with battery connected
|
// This does not work on a RAK4631 with battery connected
|
||||||
if (v > chargingVolt)
|
if (v > chargingVolt)
|
||||||
return 0; // While charging we can't report % full on the battery
|
return 0; // While charging we can't report % full on the battery
|
||||||
@@ -112,7 +112,18 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
|||||||
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) {
|
||||||
last_read_time_ms = millis();
|
last_read_time_ms = millis();
|
||||||
|
|
||||||
|
#ifdef BATTERY_SENSE_SAMPLES
|
||||||
|
//Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic environment.
|
||||||
|
uint32_t raw = 0;
|
||||||
|
for(uint32_t i=0; i<BATTERY_SENSE_SAMPLES;i++){
|
||||||
|
raw += analogRead(BATTERY_PIN);
|
||||||
|
}
|
||||||
|
raw = raw/BATTERY_SENSE_SAMPLES;
|
||||||
|
#else
|
||||||
uint32_t raw = analogRead(BATTERY_PIN);
|
uint32_t raw = analogRead(BATTERY_PIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
float scaled;
|
float scaled;
|
||||||
#ifndef VBAT_RAW_TO_SCALED
|
#ifndef VBAT_RAW_TO_SCALED
|
||||||
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
scaled = 1000.0 * operativeAdcMultiplier * (AREF_VOLTAGE / 1024.0) * raw;
|
||||||
@@ -169,11 +180,11 @@ bool Power::analogInit()
|
|||||||
// disable any internal pullups
|
// disable any internal pullups
|
||||||
pinMode(BATTERY_PIN, INPUT);
|
pinMode(BATTERY_PIN, INPUT);
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// ESP32 needs special analog stuff
|
// ESP32 needs special analog stuff
|
||||||
adcAttachPin(BATTERY_PIN);
|
adcAttachPin(BATTERY_PIN);
|
||||||
#endif
|
#endif
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
#ifdef VBAT_AR_INTERNAL
|
#ifdef VBAT_AR_INTERNAL
|
||||||
analogReference(VBAT_AR_INTERNAL);
|
analogReference(VBAT_AR_INTERNAL);
|
||||||
#else
|
#else
|
||||||
@@ -214,7 +225,7 @@ void Power::shutdown()
|
|||||||
DEBUG_MSG("Shutting down\n");
|
DEBUG_MSG("Shutting down\n");
|
||||||
axp.setChgLEDMode(AXP20X_LED_OFF);
|
axp.setChgLEDMode(AXP20X_LED_OFF);
|
||||||
axp.shutdown();
|
axp.shutdown();
|
||||||
#elif NRF52_SERIES
|
#elif defined(ARCH_NRF52)
|
||||||
playBeep();
|
playBeep();
|
||||||
ledOff(PIN_LED1);
|
ledOff(PIN_LED1);
|
||||||
ledOff(PIN_LED2);
|
ledOff(PIN_LED2);
|
||||||
@@ -256,7 +267,7 @@ void Power::readPowerStatus()
|
|||||||
|
|
||||||
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row
|
// If we have a battery at all and it is less than 10% full, force deep sleep if we have more than 3 low readings in a row
|
||||||
// Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days
|
// Supect fluctuating voltage on the RAK4631 to force it to deep sleep even if battery is at 85% after only a few days
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
if (powerStatus2.getHasBattery() && !powerStatus2.getHasUSB()) {
|
||||||
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
if (batteryLevel->getBattVoltage() < MIN_BAT_MILLIVOLTS) {
|
||||||
low_voltage_counter++;
|
low_voltage_counter++;
|
||||||
|
|||||||
+2
-2
@@ -63,7 +63,7 @@ static void lsIdle()
|
|||||||
{
|
{
|
||||||
// DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
|
// DEBUG_MSG("lsIdle begin ls_secs=%u\n", getPref_ls_secs());
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
// Do we have more sleeping to do?
|
// Do we have more sleeping to do?
|
||||||
if (secsSlept < config.power.ls_secs ? config.power.ls_secs : default_ls_secs * 1000) {
|
if (secsSlept < config.power.ls_secs ? config.power.ls_secs : default_ls_secs * 1000) {
|
||||||
@@ -343,7 +343,7 @@ void PowerFSM_setup()
|
|||||||
|
|
||||||
uint32_t meshSds = 0;
|
uint32_t meshSds = 0;
|
||||||
|
|
||||||
#ifndef NRF52_SERIES
|
#ifdef ARCH_ESP32
|
||||||
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)
|
// We never enter light-sleep or NB states on NRF52 (because the CPU uses so little power normally)
|
||||||
|
|
||||||
// See: https://github.com/meshtastic/Meshtastic-device/issues/1071
|
// See: https://github.com/meshtastic/Meshtastic-device/issues/1071
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ SerialConsole::SerialConsole() : StreamAPI(&Port), RedirectablePrint(&Port)
|
|||||||
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
|
// setDestination(&noopPrint); for testing, try turning off 'all' debug output and see what leaks
|
||||||
|
|
||||||
Port.begin(SERIAL_BAUD);
|
Port.begin(SERIAL_BAUD);
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
time_t timeout = millis();
|
time_t timeout = millis();
|
||||||
while (!Port) {
|
while (!Port) {
|
||||||
if ((millis() - timeout) < 5000) {
|
if ((millis() - timeout) < 5000) {
|
||||||
|
|||||||
+44
-174
@@ -62,79 +62,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
/// Convert a preprocessor name into a quoted string and if that string is empty use "unset"
|
/// Convert a preprocessor name into a quoted string and if that string is empty use "unset"
|
||||||
#define optstr(s) (xstr(s)[0] ? xstr(s) : "unset")
|
#define optstr(s) (xstr(s)[0] ? xstr(s) : "unset")
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
// Nop definition for these attributes that are specific to ESP32
|
||||||
|
#ifndef EXT_RAM_ATTR
|
||||||
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
|
#define EXT_RAM_ATTR
|
||||||
|
|
||||||
#elif defined(NRF52_SERIES) // All of the NRF52 targets are configured using variant.h, so this section shouldn't need to be
|
|
||||||
// board specific
|
|
||||||
|
|
||||||
//
|
|
||||||
// Standard definitions for NRF52 targets
|
|
||||||
//
|
|
||||||
|
|
||||||
#define NO_ESP32 // Don't use ESP32 libs (mainly bluetooth)
|
|
||||||
|
|
||||||
// We bind to the GPS using variant.h instead for this platform (Serial1)
|
|
||||||
|
|
||||||
#define LED_PIN PIN_LED1 // LED1 on nrf52840-DK
|
|
||||||
|
|
||||||
// If the variant filed defines as standard button
|
|
||||||
#ifdef PIN_BUTTON1
|
|
||||||
#define BUTTON_PIN PIN_BUTTON1
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef IRAM_ATTR
|
||||||
#ifdef PIN_BUTTON2
|
#define IRAM_ATTR
|
||||||
#define BUTTON_PIN_ALT PIN_BUTTON2
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef RTC_DATA_ATTR
|
||||||
#ifdef PIN_BUTTON_TOUCH
|
#define RTC_DATA_ATTR
|
||||||
#define BUTTON_PIN_TOUCH PIN_BUTTON_TOUCH
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
//
|
|
||||||
// Standard definitions for ESP32 targets
|
|
||||||
//
|
|
||||||
|
|
||||||
#define HAS_WIFI
|
|
||||||
|
|
||||||
#define GPS_SERIAL_NUM 1
|
|
||||||
#define GPS_RX_PIN 34
|
|
||||||
#ifdef USE_JTAG
|
|
||||||
#define GPS_TX_PIN -1
|
|
||||||
#else
|
|
||||||
#define GPS_TX_PIN 12
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
// LoRa SPI
|
|
||||||
// -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// NRF52 boards will define this in variant.h
|
|
||||||
#ifndef RF95_SCK
|
|
||||||
#define RF95_SCK 5
|
|
||||||
#define RF95_MISO 19
|
|
||||||
#define RF95_MOSI 27
|
|
||||||
#define RF95_NSS 18
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TTGO_T_ECHO
|
|
||||||
#define GPS_UBLOX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
|
||||||
// Standard definitions for !ESP32 targets
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifdef NO_ESP32
|
|
||||||
// Nop definition for these attributes - not used on NRF52
|
|
||||||
#define EXT_RAM_ATTR
|
|
||||||
#define IRAM_ATTR
|
|
||||||
#define RTC_DATA_ATTR
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -190,109 +126,43 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define GPS_THREAD_INTERVAL 100
|
#define GPS_THREAD_INTERVAL 100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(TBEAM_V10)
|
/* Step #1: offer chance for variant-specific defines */
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_TBEAM
|
|
||||||
|
|
||||||
#elif defined(TBEAM_V07)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_TBEAM0p7
|
|
||||||
|
|
||||||
#elif defined(DIY_V1)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_DIY_V1
|
|
||||||
|
|
||||||
#elif defined(RAK_11200)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_RAK11200
|
|
||||||
|
|
||||||
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
|
||||||
|
|
||||||
#ifdef HELTEC_V2_0
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_HELTEC_V2_0
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HELTEC_V2_1
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_HELTEC_V2_1
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_HELTEC_V1
|
|
||||||
|
|
||||||
#elif defined(TLORA_V1)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_TLORA_V1
|
|
||||||
|
|
||||||
#elif defined(TLORA_V2)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_TLORA_V2
|
|
||||||
|
|
||||||
#elif defined(TLORA_V1_3)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_TLORA_V1_1p3
|
|
||||||
|
|
||||||
#elif defined(TLORA_V2_1_16)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_TLORA_V2_1_1p6
|
|
||||||
|
|
||||||
#elif defined(GENIEBLOCKS)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_GENIEBLOCKS
|
|
||||||
|
|
||||||
#elif defined(PRIVATE_HW)
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_PRIVATE_HW
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ARDUINO_NRF52840_PCA10056
|
|
||||||
|
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
|
||||||
#define HW_VENDOR HardwareModel_NRF52840DK
|
|
||||||
|
|
||||||
// This board uses 0 to be mean LED on
|
|
||||||
#undef LED_INVERTED
|
|
||||||
#define LED_INVERTED 1
|
|
||||||
|
|
||||||
#elif defined(ARDUINO_NRF52840_PPR)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_PPR
|
|
||||||
|
|
||||||
#elif defined(RAK4630)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_RAK4631
|
|
||||||
|
|
||||||
#elif defined(TTGO_T_ECHO)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_T_ECHO
|
|
||||||
|
|
||||||
#elif defined(NANO_G1)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_NANO_G1
|
|
||||||
|
|
||||||
#elif defined(NORDIC_PCA10059)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_NRF52840_PCA10059
|
|
||||||
|
|
||||||
#elif defined(M5STACK)
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_M5STACK
|
|
||||||
|
|
||||||
#elif NRF52_SERIES
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN
|
|
||||||
|
|
||||||
#elif PORTDUINO
|
|
||||||
|
|
||||||
#define HW_VENDOR HardwareModel_PORTDUINO
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "variant.h"
|
#include "variant.h"
|
||||||
|
|
||||||
|
/* Step #2: follow with defines common to the architecture;
|
||||||
|
also enable HAS_ option not specifically disabled by variant.h */
|
||||||
|
#include "architecture.h"
|
||||||
|
|
||||||
|
/* Step #3: mop up with disabled values for HAS_ options not handled by the above two */
|
||||||
|
|
||||||
|
#ifndef HAS_WIFI
|
||||||
|
#define HAS_WIFI 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_SCREEN
|
||||||
|
#define HAS_SCREEN 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_WIRE
|
||||||
|
#define HAS_WIRE 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GPS
|
||||||
|
#define HAS_GPS 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_BUTTON
|
||||||
|
#define HAS_BUTTON 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_TELEMETRY
|
||||||
|
#define HAS_TELEMETRY 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_RADIO
|
||||||
|
#define HAS_RADIO 0
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_RTC
|
||||||
|
#define HAS_RTC 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "RF95Configuration.h"
|
#include "RF95Configuration.h"
|
||||||
#include "DebugConfiguration.h"
|
#include "DebugConfiguration.h"
|
||||||
|
|
||||||
|
#ifndef HW_VENDOR
|
||||||
|
#error HW_VENDOR must be defined
|
||||||
|
#endif
|
||||||
|
|||||||
+4
-1
@@ -3,7 +3,7 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include "mesh/generated/telemetry.pb.h"
|
#include "mesh/generated/telemetry.pb.h"
|
||||||
|
|
||||||
#ifndef NO_WIRE
|
#if HAS_WIRE
|
||||||
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length) {
|
uint16_t getRegisterValue(uint8_t address, uint8_t reg, uint8_t length) {
|
||||||
uint16_t value = 0x00;
|
uint16_t value = 0x00;
|
||||||
Wire.beginTransmission(address);
|
Wire.beginTransmission(address);
|
||||||
@@ -124,6 +124,9 @@ void scanI2Cdevice(void)
|
|||||||
} else if (registerValue == 0x60) {
|
} else if (registerValue == 0x60) {
|
||||||
DEBUG_MSG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
|
DEBUG_MSG("BME-280 sensor found at address 0x%x\n", (uint8_t)addr);
|
||||||
nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
|
nodeTelemetrySensorsMap[TelemetrySensorType_BME280] = addr;
|
||||||
|
} else {
|
||||||
|
DEBUG_MSG("BMP-280 sensor found at address 0x%x\n", (uint8_t)addr);
|
||||||
|
nodeTelemetrySensorsMap[TelemetrySensorType_BMP280] = addr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (addr == INA_ADDR || addr == INA_ADDR_ALTERNATE) {
|
if (addr == INA_ADDR || addr == INA_ADDR_ALTERNATE) {
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ARCH_ESP32
|
||||||
|
|
||||||
|
//
|
||||||
|
// defaults for ESP32 architecture
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HAS_WIFI
|
||||||
|
#define HAS_WIFI 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_SCREEN
|
||||||
|
#define HAS_SCREEN 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_WIRE
|
||||||
|
#define HAS_WIRE 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GPS
|
||||||
|
#define HAS_GPS 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_BUTTON
|
||||||
|
#define HAS_BUTTON 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_TELEMETRY
|
||||||
|
#define HAS_TELEMETRY 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_RADIO
|
||||||
|
#define HAS_RADIO 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_RTC
|
||||||
|
#define HAS_RTC 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// set HW_VENDOR
|
||||||
|
//
|
||||||
|
|
||||||
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
|
|
||||||
|
#if defined(TBEAM_V10)
|
||||||
|
#define HW_VENDOR HardwareModel_TBEAM
|
||||||
|
#elif defined(TBEAM_V07)
|
||||||
|
#define HW_VENDOR HardwareModel_TBEAM0p7
|
||||||
|
#elif defined(DIY_V1)
|
||||||
|
#define HW_VENDOR HardwareModel_DIY_V1
|
||||||
|
#elif defined(RAK_11200)
|
||||||
|
#define HW_VENDOR HardwareModel_RAK11200
|
||||||
|
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
||||||
|
#ifdef HELTEC_V2_0
|
||||||
|
#define HW_VENDOR HardwareModel_HELTEC_V2_0
|
||||||
|
#endif
|
||||||
|
#ifdef HELTEC_V2_1
|
||||||
|
#define HW_VENDOR HardwareModel_HELTEC_V2_1
|
||||||
|
#endif
|
||||||
|
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32)
|
||||||
|
#define HW_VENDOR HardwareModel_HELTEC_V1
|
||||||
|
#elif defined(TLORA_V1)
|
||||||
|
#define HW_VENDOR HardwareModel_TLORA_V1
|
||||||
|
#elif defined(TLORA_V2)
|
||||||
|
#define HW_VENDOR HardwareModel_TLORA_V2
|
||||||
|
#elif defined(TLORA_V1_3)
|
||||||
|
#define HW_VENDOR HardwareModel_TLORA_V1_1p3
|
||||||
|
#elif defined(TLORA_V2_1_16)
|
||||||
|
#define HW_VENDOR HardwareModel_TLORA_V2_1_1p6
|
||||||
|
#elif defined(GENIEBLOCKS)
|
||||||
|
#define HW_VENDOR HardwareModel_GENIEBLOCKS
|
||||||
|
#elif defined(PRIVATE_HW)
|
||||||
|
#define HW_VENDOR HardwareModel_PRIVATE_HW
|
||||||
|
#elif defined(NANO_G1)
|
||||||
|
#define HW_VENDOR HardwareModel_NANO_G1
|
||||||
|
#elif defined(M5STACK)
|
||||||
|
#define HW_VENDOR HardwareModel_M5STACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Standard definitions for ESP32 targets
|
||||||
|
//
|
||||||
|
|
||||||
|
#define GPS_SERIAL_NUM 1
|
||||||
|
#ifndef GPS_RX_PIN
|
||||||
|
#define GPS_RX_PIN 34
|
||||||
|
#endif
|
||||||
|
#ifndef GPS_TX_PIN
|
||||||
|
#ifdef USE_JTAG
|
||||||
|
#define GPS_TX_PIN -1
|
||||||
|
#else
|
||||||
|
#define GPS_TX_PIN 12
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// LoRa SPI
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// NRF52 boards will define this in variant.h
|
||||||
|
#ifndef RF95_SCK
|
||||||
|
#define RF95_SCK 5
|
||||||
|
#define RF95_MISO 19
|
||||||
|
#define RF95_MOSI 27
|
||||||
|
#define RF95_NSS 18
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
||||||
+4
-4
@@ -65,12 +65,12 @@ bool GPS::setupGPS()
|
|||||||
didSerialInit = true;
|
didSerialInit = true;
|
||||||
|
|
||||||
// ESP32 has a special set of parameters vs other arduino ports
|
// ESP32 has a special set of parameters vs other arduino ports
|
||||||
#if defined(GPS_RX_PIN) && !defined(NO_ESP32)
|
#if defined(GPS_RX_PIN) && defined(ARCH_ESP32)
|
||||||
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
_serial_gps->begin(GPS_BAUDRATE, SERIAL_8N1, GPS_RX_PIN, GPS_TX_PIN);
|
||||||
#else
|
#else
|
||||||
_serial_gps->begin(GPS_BAUDRATE);
|
_serial_gps->begin(GPS_BAUDRATE);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
_serial_gps->setRxBufferSize(2048); // the default is 256
|
_serial_gps->setRxBufferSize(2048); // the default is 256
|
||||||
#endif
|
#endif
|
||||||
#ifdef TTGO_T_ECHO
|
#ifdef TTGO_T_ECHO
|
||||||
@@ -432,14 +432,14 @@ int GPS::prepareDeepSleep(void *unused)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_GPS
|
#if HAS_GPS
|
||||||
#include "NMEAGPS.h"
|
#include "NMEAGPS.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GPS *createGps()
|
GPS *createGps()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef NO_GPS
|
#if !HAS_GPS
|
||||||
return nullptr;
|
return nullptr;
|
||||||
#else
|
#else
|
||||||
if (!config.position.gps_disabled) {
|
if (!config.position.gps_disabled) {
|
||||||
|
|||||||
+2
-2
@@ -115,12 +115,12 @@ bool perhapsSetRTC(RTCQuality q, const struct timeval *tv)
|
|||||||
rtc.setDateTime(t->tm_year + 1900, t->tm_mon + 1, t->tm_wday, t->tm_hour, t->tm_min, t->tm_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);
|
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)
|
#elif defined(ARCH_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) || defined(RV3028_RTC) || defined(PCF8563_RTC)
|
#ifdef HAS_RTC
|
||||||
readFromRTC();
|
readFromRTC();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifdef HAS_EINK
|
#ifdef USE_EINK
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "EInkDisplay2.h"
|
#include "EInkDisplay2.h"
|
||||||
#include "SPILock.h"
|
#include "SPILock.h"
|
||||||
|
|||||||
+14
-13
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
|
|
||||||
#include "GPS.h"
|
#include "GPS.h"
|
||||||
@@ -39,7 +39,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -99,7 +99,7 @@ static uint16_t displayWidth, displayHeight;
|
|||||||
#define SCREEN_WIDTH displayWidth
|
#define SCREEN_WIDTH displayWidth
|
||||||
#define SCREEN_HEIGHT displayHeight
|
#define SCREEN_HEIGHT displayHeight
|
||||||
|
|
||||||
#if defined(HAS_EINK) || defined(ILI9341_DRIVER)
|
#if defined(USE_EINK) || defined(ILI9341_DRIVER)
|
||||||
// The screen is bigger so use bigger fonts
|
// The screen is bigger so use bigger fonts
|
||||||
#define FONT_SMALL ArialMT_Plain_16
|
#define FONT_SMALL ArialMT_Plain_16
|
||||||
#define FONT_MEDIUM ArialMT_Plain_24
|
#define FONT_MEDIUM ArialMT_Plain_24
|
||||||
@@ -217,7 +217,7 @@ static void drawSSLScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
display->setFont(FONT_SMALL);
|
display->setFont(FONT_SMALL);
|
||||||
display->drawString(64 + x, y, "Creating SSL certificate");
|
display->drawString(64 + x, y, "Creating SSL certificate");
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
yield();
|
yield();
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
#endif
|
#endif
|
||||||
@@ -258,13 +258,13 @@ static void drawWelcomeScreen(OLEDDisplay *display, OLEDDisplayUiState *state, i
|
|||||||
display->drawString(x, y + FONT_HEIGHT_SMALL * 4 - 3, "");
|
display->drawString(x, y + FONT_HEIGHT_SMALL * 4 - 3, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
yield();
|
yield();
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_EINK
|
#ifdef USE_EINK
|
||||||
/// Used on eink displays while in deep sleep
|
/// Used on eink displays while in deep sleep
|
||||||
static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
static void drawSleepScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
@@ -856,7 +856,7 @@ Screen::Screen(uint8_t address, int sda, int scl) : OSThread("Screen"), cmdQueue
|
|||||||
*/
|
*/
|
||||||
void Screen::doDeepSleep()
|
void Screen::doDeepSleep()
|
||||||
{
|
{
|
||||||
#ifdef HAS_EINK
|
#ifdef USE_EINK
|
||||||
static FrameCallback sleepFrames[] = {drawSleepScreen};
|
static FrameCallback sleepFrames[] = {drawSleepScreen};
|
||||||
static const int sleepFrameCount = sizeof(sleepFrames) / sizeof(sleepFrames[0]);
|
static const int sleepFrameCount = sizeof(sleepFrames) / sizeof(sleepFrames[0]);
|
||||||
ui.setFrames(sleepFrames, sleepFrameCount);
|
ui.setFrames(sleepFrames, sleepFrameCount);
|
||||||
@@ -967,7 +967,7 @@ void Screen::setup()
|
|||||||
void Screen::forceDisplay()
|
void Screen::forceDisplay()
|
||||||
{
|
{
|
||||||
// Nasty hack to force epaper updates for 'key' frames. FIXME, cleanup.
|
// Nasty hack to force epaper updates for 'key' frames. FIXME, cleanup.
|
||||||
#ifdef HAS_EINK
|
#ifdef USE_EINK
|
||||||
dispdev.forceDisplay();
|
dispdev.forceDisplay();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1068,7 @@ int32_t Screen::runOnce()
|
|||||||
DEBUG_MSG("Setting idle framerate\n");
|
DEBUG_MSG("Setting idle framerate\n");
|
||||||
targetFramerate = IDLE_FRAMERATE;
|
targetFramerate = IDLE_FRAMERATE;
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
setCPUFast(false); // Turn up the CPU to improve screen animations
|
setCPUFast(false); // Turn up the CPU to improve screen animations
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1193,7 +1193,7 @@ void Screen::setFrames()
|
|||||||
// call a method on debugInfoScreen object (for more details)
|
// call a method on debugInfoScreen object (for more details)
|
||||||
normalFrames[numframes++] = &Screen::drawDebugInfoSettingsTrampoline;
|
normalFrames[numframes++] = &Screen::drawDebugInfoSettingsTrampoline;
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (isWifiAvailable()) {
|
if (isWifiAvailable()) {
|
||||||
// call a method on debugInfoScreen object (for more details)
|
// call a method on debugInfoScreen object (for more details)
|
||||||
normalFrames[numframes++] = &Screen::drawDebugInfoWiFiTrampoline;
|
normalFrames[numframes++] = &Screen::drawDebugInfoWiFiTrampoline;
|
||||||
@@ -1300,7 +1300,7 @@ void Screen::setFastFramerate()
|
|||||||
// We are about to start a transition so speed up fps
|
// We are about to start a transition so speed up fps
|
||||||
targetFramerate = SCREEN_TRANSITION_FRAMERATE;
|
targetFramerate = SCREEN_TRANSITION_FRAMERATE;
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
setCPUFast(true); // Turn up the CPU to improve screen animations
|
setCPUFast(true); // Turn up the CPU to improve screen animations
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1355,7 +1355,7 @@ void DebugInfo::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
// Jm
|
// Jm
|
||||||
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
void DebugInfo::drawFrameWiFi(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
#ifdef HAS_WIFI
|
#if HAS_WIFI
|
||||||
const char *wifiName = config.wifi.ssid;
|
const char *wifiName = config.wifi.ssid;
|
||||||
const char *wifiPsw = config.wifi.psk;
|
const char *wifiPsw = config.wifi.psk;
|
||||||
|
|
||||||
@@ -1678,4 +1678,5 @@ int Screen::handleUIFrameEvent(const UIFrameEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace graphics
|
} // namespace graphics
|
||||||
#endif // NO_SCREEN
|
|
||||||
|
#endif // HAS_SCREEN
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef NO_SCREEN
|
#include "configuration.h"
|
||||||
|
|
||||||
|
#if !HAS_SCREEN
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
namespace graphics
|
namespace graphics
|
||||||
{
|
{
|
||||||
@@ -315,7 +317,7 @@ class Screen : public concurrency::OSThread
|
|||||||
SSD1306Wire dispdev;
|
SSD1306Wire dispdev;
|
||||||
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER)
|
#elif defined(ST7735_CS) || defined(ILI9341_DRIVER)
|
||||||
TFTDisplay dispdev;
|
TFTDisplay dispdev;
|
||||||
#elif defined(HAS_EINK)
|
#elif defined(USE_EINK)
|
||||||
EInkDisplay dispdev;
|
EInkDisplay dispdev;
|
||||||
#elif defined(USE_ST7567)
|
#elif defined(USE_ST7567)
|
||||||
ST7567Wire dispdev;
|
ST7567Wire dispdev;
|
||||||
|
|||||||
+23
-15
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "mesh/http/WebServer.h"
|
#include "mesh/http/WebServer.h"
|
||||||
|
|
||||||
#ifdef USE_NEW_ESP32_BLUETOOTH
|
#ifdef USE_NEW_ESP32_BLUETOOTH
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAS_WIFI) || defined(PORTDUINO)
|
#if HAS_WIFI
|
||||||
#include "mesh/wifi/WiFiServerAPI.h"
|
#include "mesh/wifi/WiFiServerAPI.h"
|
||||||
#include "mqtt/MQTT.h"
|
#include "mqtt/MQTT.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -52,7 +52,9 @@
|
|||||||
#include "SX1262Interface.h"
|
#include "SX1262Interface.h"
|
||||||
#include "SX1268Interface.h"
|
#include "SX1268Interface.h"
|
||||||
|
|
||||||
|
#if HAS_BUTTON
|
||||||
#include "ButtonThread.h"
|
#include "ButtonThread.h"
|
||||||
|
#endif
|
||||||
#include "PowerFSMThread.h"
|
#include "PowerFSMThread.h"
|
||||||
|
|
||||||
using namespace concurrency;
|
using namespace concurrency;
|
||||||
@@ -91,7 +93,7 @@ uint32_t serialSinceMsec;
|
|||||||
bool axp192_found;
|
bool axp192_found;
|
||||||
|
|
||||||
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
// Array map of sensor types (as array index) and i2c address as value we'll find in the i2c scan
|
||||||
uint8_t nodeTelemetrySensorsMap[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
uint8_t nodeTelemetrySensorsMap[7] = { 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
Router *router = NULL; // Users of router don't care what sort of subclass implements that API
|
||||||
|
|
||||||
@@ -126,11 +128,15 @@ static int32_t ledBlinker()
|
|||||||
|
|
||||||
uint32_t timeLastPowered = 0;
|
uint32_t timeLastPowered = 0;
|
||||||
|
|
||||||
|
#if HAS_BUTTON
|
||||||
bool ButtonThread::shutdown_on_long_stop = false;
|
bool ButtonThread::shutdown_on_long_stop = false;
|
||||||
|
#endif
|
||||||
|
|
||||||
static Periodic *ledPeriodic;
|
static Periodic *ledPeriodic;
|
||||||
static OSThread *powerFSMthread, *buttonThread;
|
static OSThread *powerFSMthread, *buttonThread;
|
||||||
|
#if HAS_BUTTON
|
||||||
uint32_t ButtonThread::longPressTime = 0;
|
uint32_t ButtonThread::longPressTime = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
RadioInterface *rIf = NULL;
|
RadioInterface *rIf = NULL;
|
||||||
|
|
||||||
@@ -187,7 +193,7 @@ void setup()
|
|||||||
bool forceSoftAP = 0;
|
bool forceSoftAP = 0;
|
||||||
|
|
||||||
#ifdef BUTTON_PIN
|
#ifdef BUTTON_PIN
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
// If the button is connected to GPIO 12, don't enable the ability to use
|
// If the button is connected to GPIO 12, don't enable the ability to use
|
||||||
// meshtasticAdmin on the device.
|
// meshtasticAdmin on the device.
|
||||||
@@ -218,7 +224,7 @@ void setup()
|
|||||||
|
|
||||||
#ifdef I2C_SDA
|
#ifdef I2C_SDA
|
||||||
Wire.begin(I2C_SDA, I2C_SCL);
|
Wire.begin(I2C_SDA, I2C_SCL);
|
||||||
#elif !defined(NO_WIRE)
|
#elif HAS_WIRE
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -236,8 +242,10 @@ void setup()
|
|||||||
// scanEInkDevice();
|
// scanEInkDevice();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if HAS_BUTTON
|
||||||
// Buttons & LED
|
// Buttons & LED
|
||||||
buttonThread = new ButtonThread();
|
buttonThread = new ButtonThread();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LED_PIN
|
#ifdef LED_PIN
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
@@ -247,7 +255,7 @@ void setup()
|
|||||||
// Hello
|
// Hello
|
||||||
DEBUG_MSG("Meshtastic hwvendor=%d, swver=%s\n", HW_VENDOR, optstr(APP_VERSION));
|
DEBUG_MSG("Meshtastic hwvendor=%d, swver=%s\n", HW_VENDOR, optstr(APP_VERSION));
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Don't init display if we don't have one or we are waking headless due to a timer event
|
// Don't init display if we don't have one or we are waking headless due to a timer event
|
||||||
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
|
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
|
||||||
screen_found = 0; // forget we even have the hardware
|
screen_found = 0; // forget we even have the hardware
|
||||||
@@ -255,7 +263,7 @@ void setup()
|
|||||||
esp32Setup();
|
esp32Setup();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
nrf52Setup();
|
nrf52Setup();
|
||||||
#endif
|
#endif
|
||||||
playStartMelody();
|
playStartMelody();
|
||||||
@@ -271,7 +279,7 @@ void setup()
|
|||||||
|
|
||||||
// Init our SPI controller (must be before screen and lora)
|
// Init our SPI controller (must be before screen and lora)
|
||||||
initSPI();
|
initSPI();
|
||||||
#ifdef NO_ESP32
|
#ifndef ARCH_ESP32
|
||||||
SPI.begin();
|
SPI.begin();
|
||||||
#else
|
#else
|
||||||
// ESP32
|
// ESP32
|
||||||
@@ -306,7 +314,7 @@ void setup()
|
|||||||
|
|
||||||
// Don't call screen setup until after nodedb is setup (because we need
|
// Don't call screen setup until after nodedb is setup (because we need
|
||||||
// the current region name)
|
// the current region name)
|
||||||
#if defined(ST7735_CS) || defined(HAS_EINK) || defined(ILI9341_DRIVER)
|
#if defined(ST7735_CS) || defined(USE_EINK) || defined(ILI9341_DRIVER)
|
||||||
screen->setup();
|
screen->setup();
|
||||||
#else
|
#else
|
||||||
if (screen_found)
|
if (screen_found)
|
||||||
@@ -386,7 +394,7 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SIM_RADIO
|
#if !HAS_RADIO
|
||||||
if (!rIf) {
|
if (!rIf) {
|
||||||
rIf = new SimRadio;
|
rIf = new SimRadio;
|
||||||
if (!rIf->init()) {
|
if (!rIf->init()) {
|
||||||
@@ -399,19 +407,19 @@ void setup()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PORTDUINO) || defined(HAS_WIFI)
|
#if HAS_WIFI
|
||||||
mqttInit();
|
mqttInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Initialize Wifi
|
// Initialize Wifi
|
||||||
initWifi(forceSoftAP);
|
initWifi(forceSoftAP);
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Start web server thread.
|
// Start web server thread.
|
||||||
webServerThread = new WebServerThread();
|
webServerThread = new WebServerThread();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
initApiServer();
|
initApiServer();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -452,10 +460,10 @@ void loop()
|
|||||||
|
|
||||||
// heap_caps_check_integrity_all(true); // FIXME - disable this expensive check
|
// heap_caps_check_integrity_all(true); // FIXME - disable this expensive check
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
esp32Loop();
|
esp32Loop();
|
||||||
#endif
|
#endif
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
nrf52Loop();
|
nrf52Loop();
|
||||||
#endif
|
#endif
|
||||||
powerCommandsCheck();
|
powerCommandsCheck();
|
||||||
|
|||||||
+1
-1
@@ -19,7 +19,7 @@ extern bool axp192_found;
|
|||||||
extern bool isCharging;
|
extern bool isCharging;
|
||||||
extern bool isUSBPowered;
|
extern bool isUSBPowered;
|
||||||
|
|
||||||
extern uint8_t nodeTelemetrySensorsMap[12];
|
extern uint8_t nodeTelemetrySensorsMap[7];
|
||||||
|
|
||||||
// Global Screen singleton.
|
// Global Screen singleton.
|
||||||
extern graphics::Screen *screen;
|
extern graphics::Screen *screen;
|
||||||
|
|||||||
@@ -29,8 +29,12 @@ bool FloodingRouter::shouldFilterReceived(MeshPacket *p)
|
|||||||
|
|
||||||
void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
void FloodingRouter::sniffReceived(const MeshPacket *p, const Routing *c)
|
||||||
{
|
{
|
||||||
|
PacketId ackId = ((c && c->error_reason == Routing_Error_NONE) || !c) ? p->decoded.request_id : 0;
|
||||||
if ((p->to == NODENUM_BROADCAST) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
if (ackId && p->to != getNodeNum()) {
|
||||||
|
// do not flood direct message that is ACKed
|
||||||
|
DEBUG_MSG("Receiving an ACK not for me, but don't need to rebroadcast this direct message anymore.\n");
|
||||||
|
Router::cancelSending(p->to, p->decoded.request_id); // cancel rebroadcast for this DM
|
||||||
|
} else if ((p->to != getNodeNum()) && (p->hop_limit > 0) && (getFrom(p) != getNodeNum())) {
|
||||||
if (p->id != 0) {
|
if (p->id != 0) {
|
||||||
if (config.device.role != Config_DeviceConfig_Role_ClientMute) {
|
if (config.device.role != Config_DeviceConfig_Role_ClientMute) {
|
||||||
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
MeshPacket *tosend = packetPool.allocCopy(*p); // keep a copy because we will be sending it
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include "mesh/MeshTypes.h"
|
#include "mesh/MeshTypes.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
#include <OLEDDisplay.h>
|
#include <OLEDDisplay.h>
|
||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -72,7 +72,7 @@ class MeshModule
|
|||||||
static void observeUIEvents(Observer<const UIFrameEvent *> *observer);
|
static void observeUIEvents(Observer<const UIFrameEvent *> *observer);
|
||||||
static AdminMessageHandleResult handleAdminMessageForAllPlugins(
|
static AdminMessageHandleResult handleAdminMessageForAllPlugins(
|
||||||
const MeshPacket &mp, AdminMessage *request, AdminMessage *response);
|
const MeshPacket &mp, AdminMessage *request, AdminMessage *response);
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { return; }
|
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) { return; }
|
||||||
#endif
|
#endif
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+8
-8
@@ -17,14 +17,14 @@
|
|||||||
#include <pb_decode.h>
|
#include <pb_decode.h>
|
||||||
#include <pb_encode.h>
|
#include <pb_encode.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include "modules/esp32/StoreForwardModule.h"
|
#include "modules/esp32/StoreForwardModule.h"
|
||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
#include <nvs_flash.h>
|
#include <nvs_flash.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
#include <bluefruit.h>
|
#include <bluefruit.h>
|
||||||
#include <utility/bonding.h>
|
#include <utility/bonding.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -132,11 +132,11 @@ bool NodeDB::factoryReset()
|
|||||||
installDefaultDeviceState();
|
installDefaultDeviceState();
|
||||||
// third, write to disk
|
// third, write to disk
|
||||||
saveToDisk();
|
saveToDisk();
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
Bluefruit.begin();
|
Bluefruit.begin();
|
||||||
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
||||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||||
@@ -248,7 +248,7 @@ void NodeDB::init()
|
|||||||
|
|
||||||
strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
strncpy(myNodeInfo.firmware_version, optstr(APP_VERSION), sizeof(myNodeInfo.firmware_version));
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
preferences.begin("meshtastic", false);
|
preferences.begin("meshtastic", false);
|
||||||
myNodeInfo.reboot_count = preferences.getUInt("rebootCounter", 0);
|
myNodeInfo.reboot_count = preferences.getUInt("rebootCounter", 0);
|
||||||
@@ -339,11 +339,11 @@ void NodeDB::loadFromDisk()
|
|||||||
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
if (devicestate.version < DEVICESTATE_MIN_VER) {
|
||||||
DEBUG_MSG("Warn: devicestate %d is old, discarding\n", devicestate.version);
|
DEBUG_MSG("Warn: devicestate %d is old, discarding\n", devicestate.version);
|
||||||
installDefaultDeviceState();
|
installDefaultDeviceState();
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
// This will erase what's in NVS including ssl keys, persistant variables and ble pairing
|
||||||
nvs_flash_erase();
|
nvs_flash_erase();
|
||||||
#endif
|
#endif
|
||||||
#ifdef NRF52_SERIES
|
#ifdef ARCH_NRF52
|
||||||
Bluefruit.begin();
|
Bluefruit.begin();
|
||||||
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
DEBUG_MSG("Clearing bluetooth bonds!\n");
|
||||||
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
bond_print_list(BLE_GAP_ROLE_PERIPH);
|
||||||
@@ -669,7 +669,7 @@ void recordCriticalError(CriticalErrorCode code, uint32_t address, const char *f
|
|||||||
myNodeInfo.error_count++;
|
myNodeInfo.error_count++;
|
||||||
|
|
||||||
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
// Currently portuino is mostly used for simulation. Make sue the user notices something really bad happend
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
DEBUG_MSG("A critical failure occurred, portduino is exiting...");
|
DEBUG_MSG("A critical failure occurred, portduino is exiting...");
|
||||||
exit(2);
|
exit(2);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
// FIXME, we default to 4MHz SPI, SPI mode 0, check if the datasheet says it can really do that
|
||||||
static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
static SPISettings spiSettings(4000000, MSBFIRST, SPI_MODE0);
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
|
|
||||||
void LockingModule::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes)
|
void LockingModule::SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes)
|
||||||
{
|
{
|
||||||
@@ -45,7 +45,7 @@ RadioLibInterface::RadioLibInterface(RADIOLIB_PIN_TYPE cs, RADIOLIB_PIN_TYPE irq
|
|||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// ESP32 doesn't use that flag
|
// ESP32 doesn't use that flag
|
||||||
#define YIELD_FROM_ISR(x) portYIELD_FROM_ISR()
|
#define YIELD_FROM_ISR(x) portYIELD_FROM_ISR()
|
||||||
#else
|
#else
|
||||||
@@ -96,7 +96,7 @@ bool RadioLibInterface::canSendImmediately()
|
|||||||
if (busyTx && (millis() - lastTxStart > 60000)) {
|
if (busyTx && (millis() - lastTxStart > 60000)) {
|
||||||
DEBUG_MSG("Hardware Failure! busyTx for more than 60s\n");
|
DEBUG_MSG("Hardware Failure! busyTx for more than 60s\n");
|
||||||
RECORD_CRITICALERROR(CriticalErrorCode_TransmitFailed);
|
RECORD_CRITICALERROR(CriticalErrorCode_TransmitFailed);
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (busyTx && (millis() - lastTxStart > 65000)) // After 5s more, reboot
|
if (busyTx && (millis() - lastTxStart > 65000)) // After 5s more, reboot
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class LockingModule : public Module
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override;
|
void SPItransfer(uint8_t cmd, uint8_t reg, uint8_t *dataOut, uint8_t *dataIn, uint8_t numBytes) override;
|
||||||
#else
|
#else
|
||||||
void SPIbeginTransaction() override;
|
void SPIbeginTransaction() override;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
|
|||||||
// If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our
|
// If someone asks for acks on broadcast, we need the hop limit to be at least one, so that first node that receives our
|
||||||
// message will rebroadcast. But asking for hop_limit 0 in that context means the client app has no preference on hop
|
// message will rebroadcast. But asking for hop_limit 0 in that context means the client app has no preference on hop
|
||||||
// counts and we want this message to get through the whole mesh, so use the default.
|
// counts and we want this message to get through the whole mesh, so use the default.
|
||||||
if (p->to == NODENUM_BROADCAST && p->hop_limit == 0) {
|
if (p->hop_limit == 0) {
|
||||||
if (config.lora.hop_limit && config.lora.hop_limit <= HOP_MAX) {
|
if (config.lora.hop_limit && config.lora.hop_limit <= HOP_MAX) {
|
||||||
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
|
p->hop_limit = (config.lora.hop_limit >= HOP_MAX) ? HOP_MAX : config.lora.hop_limit;
|
||||||
} else {
|
} else {
|
||||||
@@ -34,7 +34,7 @@ ErrorCode ReliableRouter::send(MeshPacket *p)
|
|||||||
bool ReliableRouter::shouldFilterReceived(MeshPacket *p)
|
bool ReliableRouter::shouldFilterReceived(MeshPacket *p)
|
||||||
{
|
{
|
||||||
// Note: do not use getFrom() here, because we want to ignore messages sent from phone
|
// Note: do not use getFrom() here, because we want to ignore messages sent from phone
|
||||||
if (p->to == NODENUM_BROADCAST && p->from == getNodeNum()) {
|
if (p->from == getNodeNum()) {
|
||||||
printPacket("Rx someone rebroadcasting for us", p);
|
printPacket("Rx someone rebroadcasting for us", p);
|
||||||
|
|
||||||
// We are seeing someone rebroadcast one of our broadcast attempts.
|
// We are seeing someone rebroadcast one of our broadcast attempts.
|
||||||
@@ -231,4 +231,4 @@ void ReliableRouter::setNextTx(PendingPacket *pending)
|
|||||||
DEBUG_MSG("Setting next retransmission in %u msecs: ", d);
|
DEBUG_MSG("Setting next retransmission in %u msecs: ", d);
|
||||||
printPacket("", pending->packet);
|
printPacket("", pending->packet);
|
||||||
setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time
|
setReceivedMessage(); // Run ASAP, so we can figure out our correct sleep time
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -11,7 +11,7 @@ extern "C" {
|
|||||||
#include "mesh/compression/unishox2.h"
|
#include "mesh/compression/unishox2.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAS_WIFI) || defined(PORTDUINO)
|
#if HAS_WIFI
|
||||||
#include "mqtt/MQTT.h"
|
#include "mqtt/MQTT.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -213,7 +213,7 @@ ErrorCode Router::send(MeshPacket *p)
|
|||||||
if (p->which_payloadVariant == MeshPacket_decoded_tag) {
|
if (p->which_payloadVariant == MeshPacket_decoded_tag) {
|
||||||
ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it
|
ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it
|
||||||
|
|
||||||
#if defined(HAS_WIFI) || defined(PORTDUINO)
|
#if HAS_WIFI
|
||||||
// check if we should send decrypted packets to mqtt
|
// check if we should send decrypted packets to mqtt
|
||||||
|
|
||||||
// truth table:
|
// truth table:
|
||||||
@@ -244,7 +244,7 @@ ErrorCode Router::send(MeshPacket *p)
|
|||||||
return encodeResult; // FIXME - this isn't a valid ErrorCode
|
return encodeResult; // FIXME - this isn't a valid ErrorCode
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAS_WIFI) || defined(PORTDUINO)
|
#if HAS_WIFI
|
||||||
// the packet is now encrypted.
|
// the packet is now encrypted.
|
||||||
// check if we should send encrypted packets to mqtt
|
// check if we should send encrypted packets to mqtt
|
||||||
if (mqtt && shouldActuallyEncrypt)
|
if (mqtt && shouldActuallyEncrypt)
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define LocalConfig_size 319
|
#define LocalConfig_size 319
|
||||||
#define LocalModuleConfig_size 288
|
#define LocalModuleConfig_size 268
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
|||||||
@@ -108,11 +108,7 @@ typedef struct _ModuleConfig_TelemetryConfig {
|
|||||||
uint32_t environment_update_interval;
|
uint32_t environment_update_interval;
|
||||||
bool environment_measurement_enabled;
|
bool environment_measurement_enabled;
|
||||||
bool environment_screen_enabled;
|
bool environment_screen_enabled;
|
||||||
uint32_t environment_read_error_count_threshold;
|
|
||||||
uint32_t environment_recovery_interval;
|
|
||||||
bool environment_display_fahrenheit;
|
bool environment_display_fahrenheit;
|
||||||
TelemetrySensorType environment_sensor_type;
|
|
||||||
uint32_t environment_sensor_pin;
|
|
||||||
} ModuleConfig_TelemetryConfig;
|
} ModuleConfig_TelemetryConfig;
|
||||||
|
|
||||||
/* Module Config */
|
/* Module Config */
|
||||||
@@ -162,7 +158,7 @@ extern "C" {
|
|||||||
#define ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0}
|
#define ModuleConfig_ExternalNotificationConfig_init_default {0, 0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
#define ModuleConfig_StoreForwardConfig_init_default {0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
#define ModuleConfig_RangeTestConfig_init_default {0, 0, 0}
|
||||||
#define ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0, 0, 0, _TelemetrySensorType_MIN, 0}
|
#define ModuleConfig_TelemetryConfig_init_default {0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define ModuleConfig_CannedMessageConfig_init_default {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
#define ModuleConfig_init_zero {0, {ModuleConfig_MQTTConfig_init_zero}}
|
#define ModuleConfig_init_zero {0, {ModuleConfig_MQTTConfig_init_zero}}
|
||||||
#define ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0}
|
#define ModuleConfig_MQTTConfig_init_zero {0, "", "", "", 0}
|
||||||
@@ -170,7 +166,7 @@ extern "C" {
|
|||||||
#define ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0}
|
#define ModuleConfig_ExternalNotificationConfig_init_zero {0, 0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
#define ModuleConfig_StoreForwardConfig_init_zero {0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
#define ModuleConfig_RangeTestConfig_init_zero {0, 0, 0}
|
||||||
#define ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0, 0, 0, _TelemetrySensorType_MIN, 0}
|
#define ModuleConfig_TelemetryConfig_init_zero {0, 0, 0, 0, 0}
|
||||||
#define ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
#define ModuleConfig_CannedMessageConfig_init_zero {0, 0, 0, 0, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, _ModuleConfig_CannedMessageConfig_InputEventChar_MIN, 0, 0, "", 0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@@ -215,11 +211,7 @@ extern "C" {
|
|||||||
#define ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
|
#define ModuleConfig_TelemetryConfig_environment_update_interval_tag 2
|
||||||
#define ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
|
#define ModuleConfig_TelemetryConfig_environment_measurement_enabled_tag 3
|
||||||
#define ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
|
#define ModuleConfig_TelemetryConfig_environment_screen_enabled_tag 4
|
||||||
#define ModuleConfig_TelemetryConfig_environment_read_error_count_threshold_tag 5
|
|
||||||
#define ModuleConfig_TelemetryConfig_environment_recovery_interval_tag 6
|
|
||||||
#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 7
|
#define ModuleConfig_TelemetryConfig_environment_display_fahrenheit_tag 7
|
||||||
#define ModuleConfig_TelemetryConfig_environment_sensor_type_tag 8
|
|
||||||
#define ModuleConfig_TelemetryConfig_environment_sensor_pin_tag 9
|
|
||||||
#define ModuleConfig_mqtt_tag 1
|
#define ModuleConfig_mqtt_tag 1
|
||||||
#define ModuleConfig_serial_tag 2
|
#define ModuleConfig_serial_tag 2
|
||||||
#define ModuleConfig_external_notification_tag 3
|
#define ModuleConfig_external_notification_tag 3
|
||||||
@@ -298,11 +290,7 @@ X(a, STATIC, SINGULAR, UINT32, device_update_interval, 1) \
|
|||||||
X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \
|
X(a, STATIC, SINGULAR, UINT32, environment_update_interval, 2) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \
|
X(a, STATIC, SINGULAR, BOOL, environment_measurement_enabled, 3) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \
|
X(a, STATIC, SINGULAR, BOOL, environment_screen_enabled, 4) \
|
||||||
X(a, STATIC, SINGULAR, UINT32, environment_read_error_count_threshold, 5) \
|
X(a, STATIC, SINGULAR, BOOL, environment_display_fahrenheit, 7)
|
||||||
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 ModuleConfig_TelemetryConfig_CALLBACK NULL
|
#define ModuleConfig_TelemetryConfig_CALLBACK NULL
|
||||||
#define ModuleConfig_TelemetryConfig_DEFAULT NULL
|
#define ModuleConfig_TelemetryConfig_DEFAULT NULL
|
||||||
|
|
||||||
@@ -347,7 +335,7 @@ extern const pb_msgdesc_t ModuleConfig_CannedMessageConfig_msg;
|
|||||||
#define ModuleConfig_RangeTestConfig_size 10
|
#define ModuleConfig_RangeTestConfig_size 10
|
||||||
#define ModuleConfig_SerialConfig_size 26
|
#define ModuleConfig_SerialConfig_size 26
|
||||||
#define ModuleConfig_StoreForwardConfig_size 22
|
#define ModuleConfig_StoreForwardConfig_size 22
|
||||||
#define ModuleConfig_TelemetryConfig_size 38
|
#define ModuleConfig_TelemetryConfig_size 18
|
||||||
#define ModuleConfig_size 105
|
#define ModuleConfig_size 105
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -14,28 +14,18 @@
|
|||||||
typedef enum _TelemetrySensorType {
|
typedef enum _TelemetrySensorType {
|
||||||
/* No external telemetry sensor explicitly set */
|
/* No external telemetry sensor explicitly set */
|
||||||
TelemetrySensorType_NotSet = 0,
|
TelemetrySensorType_NotSet = 0,
|
||||||
/* Moderate accuracy temperature */
|
|
||||||
TelemetrySensorType_DHT11 = 1,
|
|
||||||
/* High accuracy temperature */
|
|
||||||
TelemetrySensorType_DS18B20 = 2,
|
|
||||||
/* Moderate accuracy temperature and humidity */
|
|
||||||
TelemetrySensorType_DHT12 = 3,
|
|
||||||
/* Moderate accuracy temperature and humidity */
|
|
||||||
TelemetrySensorType_DHT21 = 4,
|
|
||||||
/* Moderate accuracy temperature and humidity */
|
|
||||||
TelemetrySensorType_DHT22 = 5,
|
|
||||||
/* High accuracy temperature, pressure, humidity */
|
/* High accuracy temperature, pressure, humidity */
|
||||||
TelemetrySensorType_BME280 = 6,
|
TelemetrySensorType_BME280 = 1,
|
||||||
/* High accuracy temperature, pressure, humidity, and air resistance */
|
/* High accuracy temperature, pressure, humidity, and air resistance */
|
||||||
TelemetrySensorType_BME680 = 7,
|
TelemetrySensorType_BME680 = 2,
|
||||||
/* Very high accuracy temperature */
|
/* Very high accuracy temperature */
|
||||||
TelemetrySensorType_MCP9808 = 8,
|
TelemetrySensorType_MCP9808 = 3,
|
||||||
/* Moderate accuracy temperature and humidity */
|
|
||||||
TelemetrySensorType_SHTC3 = 9,
|
|
||||||
/* Moderate accuracy current and voltage */
|
/* Moderate accuracy current and voltage */
|
||||||
TelemetrySensorType_INA260 = 10,
|
TelemetrySensorType_INA260 = 4,
|
||||||
/* Moderate accuracy current and voltage */
|
/* Moderate accuracy current and voltage */
|
||||||
TelemetrySensorType_INA219 = 11
|
TelemetrySensorType_INA219 = 5,
|
||||||
|
/* High accuracy temperature and pressure */
|
||||||
|
TelemetrySensorType_BMP280 = 6
|
||||||
} TelemetrySensorType;
|
} TelemetrySensorType;
|
||||||
|
|
||||||
/* Struct definitions */
|
/* Struct definitions */
|
||||||
@@ -87,8 +77,8 @@ typedef struct _Telemetry {
|
|||||||
|
|
||||||
/* Helper constants for enums */
|
/* Helper constants for enums */
|
||||||
#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
|
#define _TelemetrySensorType_MIN TelemetrySensorType_NotSet
|
||||||
#define _TelemetrySensorType_MAX TelemetrySensorType_INA219
|
#define _TelemetrySensorType_MAX TelemetrySensorType_BMP280
|
||||||
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_INA219+1))
|
#define _TelemetrySensorType_ARRAYSIZE ((TelemetrySensorType)(TelemetrySensorType_BMP280+1))
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include <HTTPURLEncodedBodyParser.hpp>
|
#include <HTTPURLEncodedBodyParser.hpp>
|
||||||
#include <json11.hpp>
|
#include <json11.hpp>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -787,7 +787,7 @@ void handleBlinkLED(HTTPRequest *req, HTTPResponse *res)
|
|||||||
count = count - 1;
|
count = count - 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
screen->blink();
|
screen->blink();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
#include <WebServer.h>
|
#include <WebServer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp_task_wdt.h"
|
#include "esp_task_wdt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ void createSSLCert()
|
|||||||
|
|
||||||
yield();
|
yield();
|
||||||
esp_task_wdt_reset();
|
esp_task_wdt_reset();
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
if (millis() / 1000 >= 3) {
|
if (millis() / 1000 >= 3) {
|
||||||
screen->setSSLFrames();
|
screen->setSSLFrames();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#ifdef HAS_WIFI
|
#ifdef ARCH_ESP32
|
||||||
#include <DNSServer.h>
|
#include <DNSServer.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ bool pb_decode_from_bytes(const uint8_t *srcbuf, size_t srcbufsize, const pb_msg
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef FSCom
|
||||||
/// Read from an Arduino File
|
/// Read from an Arduino File
|
||||||
bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count)
|
bool readcb(pb_istream_t *stream, uint8_t *buf, size_t count)
|
||||||
{
|
{
|
||||||
@@ -59,6 +60,7 @@ bool writecb(pb_ostream_t *stream, const uint8_t *buf, size_t count)
|
|||||||
// DEBUG_MSG("writing %d bytes to protobuf file\n", count);
|
// DEBUG_MSG("writing %d bytes to protobuf file\n", count);
|
||||||
return file->write(buf, count) == count;
|
return file->write(buf, count) == count;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool is_in_helper(uint32_t n, const uint32_t *array, pb_size_t count)
|
bool is_in_helper(uint32_t n, const uint32_t *array, pb_size_t count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
#include "unistd.h"
|
#include "unistd.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ bool AdminModule::handleReceivedProtobuf(const MeshPacket &mp, AdminMessage *r)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PORTDUINO
|
#ifdef ARCH_PORTDUINO
|
||||||
case AdminMessage_exit_simulator_tag:
|
case AdminMessage_exit_simulator_tag:
|
||||||
DEBUG_MSG("Exiting simulator\n");
|
DEBUG_MSG("Exiting simulator\n");
|
||||||
_exit(0);
|
_exit(0);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#ifndef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
#include "CannedMessageModule.h"
|
#include "CannedMessageModule.h"
|
||||||
#include "FSCommon.h"
|
#include "FSCommon.h"
|
||||||
#include "MeshService.h"
|
#include "MeshService.h"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifdef NO_SCREEN
|
#if HAS_SCREEN
|
||||||
#else
|
|
||||||
#include "ProtobufModule.h"
|
#include "ProtobufModule.h"
|
||||||
#include "input/InputBroker.h"
|
#include "input/InputBroker.h"
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
// restrict to the admin channel for rx
|
// restrict to the admin channel for rx
|
||||||
boundChannel = Channels::gpioChannel;
|
boundChannel = Channels::gpioChannel;
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#ifdef EXT_NOTIFY_OUT
|
#ifdef EXT_NOTIFY_OUT
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -154,7 +154,7 @@ ExternalNotificationModule::ExternalNotificationModule()
|
|||||||
|
|
||||||
ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
ProcessMessage ExternalNotificationModule::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#ifdef EXT_NOTIFY_OUT
|
#ifdef EXT_NOTIFY_OUT
|
||||||
|
|
||||||
if (moduleConfig.external_notification.enabled) {
|
if (moduleConfig.external_notification.enabled) {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
#include "modules/RoutingModule.h"
|
#include "modules/RoutingModule.h"
|
||||||
#include "modules/TextMessageModule.h"
|
#include "modules/TextMessageModule.h"
|
||||||
#include "modules/Telemetry/DeviceTelemetry.h"
|
#include "modules/Telemetry/DeviceTelemetry.h"
|
||||||
#ifndef PORTDUINO
|
#if HAS_TELEMETRY
|
||||||
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
#include "modules/Telemetry/EnvironmentTelemetry.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "modules/esp32/RangeTestModule.h"
|
#include "modules/esp32/RangeTestModule.h"
|
||||||
#include "modules/esp32/SerialModule.h"
|
#include "modules/esp32/SerialModule.h"
|
||||||
#include "modules/esp32/StoreForwardModule.h"
|
#include "modules/esp32/StoreForwardModule.h"
|
||||||
@@ -28,7 +28,9 @@
|
|||||||
*/
|
*/
|
||||||
void setupModules()
|
void setupModules()
|
||||||
{
|
{
|
||||||
|
#if HAS_BUTTON
|
||||||
inputBroker = new InputBroker();
|
inputBroker = new InputBroker();
|
||||||
|
#endif
|
||||||
adminModule = new AdminModule();
|
adminModule = new AdminModule();
|
||||||
nodeInfoModule = new NodeInfoModule();
|
nodeInfoModule = new NodeInfoModule();
|
||||||
positionModule = new PositionModule();
|
positionModule = new PositionModule();
|
||||||
@@ -39,6 +41,7 @@ void setupModules()
|
|||||||
|
|
||||||
new RemoteHardwareModule();
|
new RemoteHardwareModule();
|
||||||
new ReplyModule();
|
new ReplyModule();
|
||||||
|
#if HAS_BUTTON
|
||||||
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
rotaryEncoderInterruptImpl1 = new RotaryEncoderInterruptImpl1();
|
||||||
rotaryEncoderInterruptImpl1->init();
|
rotaryEncoderInterruptImpl1->init();
|
||||||
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
upDownInterruptImpl1 = new UpDownInterruptImpl1();
|
||||||
@@ -47,14 +50,15 @@ void setupModules()
|
|||||||
cardKbI2cImpl->init();
|
cardKbI2cImpl->init();
|
||||||
facesKbI2cImpl = new FacesKbI2cImpl();
|
facesKbI2cImpl = new FacesKbI2cImpl();
|
||||||
facesKbI2cImpl->init();
|
facesKbI2cImpl->init();
|
||||||
#ifndef NO_SCREEN
|
#endif
|
||||||
|
#if HAS_SCREEN
|
||||||
cannedMessageModule = new CannedMessageModule();
|
cannedMessageModule = new CannedMessageModule();
|
||||||
#endif
|
#endif
|
||||||
#ifndef PORTDUINO
|
#if HAS_TELEMETRY
|
||||||
new DeviceTelemetryModule();
|
new DeviceTelemetryModule();
|
||||||
new EnvironmentTelemetryModule();
|
new EnvironmentTelemetryModule();
|
||||||
#endif
|
#endif
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// Only run on an esp32 based device.
|
// Only run on an esp32 based device.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -133,22 +133,22 @@ int32_t PositionModule::runOnce()
|
|||||||
|
|
||||||
// Only send packets if the channel is less than 40% utilized.
|
// Only send packets if the channel is less than 40% utilized.
|
||||||
if (airTime->channelUtilizationPercent() < 40) {
|
if (airTime->channelUtilizationPercent() < 40) {
|
||||||
|
if (node->has_position && (node->position.latitude_i != 0 || node->position.longitude_i != 0)) {
|
||||||
|
lastGpsSend = now;
|
||||||
|
|
||||||
lastGpsSend = now;
|
lastGpsLatitude = node->position.latitude_i;
|
||||||
|
lastGpsLongitude = node->position.longitude_i;
|
||||||
|
|
||||||
lastGpsLatitude = node->position.latitude_i;
|
// If we changed channels, ask everyone else for their latest info
|
||||||
lastGpsLongitude = node->position.longitude_i;
|
bool requestReplies = currentGeneration != radioGeneration;
|
||||||
|
currentGeneration = radioGeneration;
|
||||||
|
|
||||||
// If we changed channels, ask everyone else for their latest info
|
DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
|
||||||
bool requestReplies = currentGeneration != radioGeneration;
|
|
||||||
currentGeneration = radioGeneration;
|
|
||||||
|
|
||||||
DEBUG_MSG("Sending pos@%x:6 to mesh (wantReplies=%d)\n", node->position.pos_timestamp, requestReplies);
|
|
||||||
|
|
||||||
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
|
||||||
|
|
||||||
|
sendOurPosition(NODENUM_BROADCAST, requestReplies);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Channel utilization is >50 percent. Skipping this opportunity to send.\n");
|
DEBUG_MSG("Channel utilization is >40 percent. Skipping this opportunity to send.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (!config.position.position_broadcast_smart_disabled) {
|
} else if (!config.position.position_broadcast_smart_disabled) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
int32_t DeviceTelemetryModule::runOnce()
|
int32_t DeviceTelemetryModule::runOnce()
|
||||||
{
|
{
|
||||||
#ifndef PORTDUINO
|
#ifndef ARCH_PORTDUINO
|
||||||
if (firstTime) {
|
if (firstTime) {
|
||||||
// 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;
|
||||||
@@ -72,7 +72,7 @@ bool DeviceTelemetryModule::sendOurTelemetry(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||||
DEBUG_MSG("Device Telemetry: Sending packet to mesh\n");
|
DEBUG_MSG("Device Telemetry: Sending packet to mesh\n");
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL);
|
nodeDB.updateTelemetry(nodeDB.getNodeNum(), t, RX_SRC_LOCAL);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,16 @@
|
|||||||
#include <OLEDDisplayUi.h>
|
#include <OLEDDisplayUi.h>
|
||||||
|
|
||||||
// Sensors
|
// Sensors
|
||||||
|
#include "Sensor/BMP280Sensor.h"
|
||||||
#include "Sensor/BME280Sensor.h"
|
#include "Sensor/BME280Sensor.h"
|
||||||
#include "Sensor/BME680Sensor.h"
|
#include "Sensor/BME680Sensor.h"
|
||||||
#include "Sensor/DHTSensor.h"
|
|
||||||
#include "Sensor/DallasSensor.h"
|
|
||||||
#include "Sensor/MCP9808Sensor.h"
|
#include "Sensor/MCP9808Sensor.h"
|
||||||
#include "Sensor/INA260Sensor.h"
|
#include "Sensor/INA260Sensor.h"
|
||||||
#include "Sensor/INA219Sensor.h"
|
#include "Sensor/INA219Sensor.h"
|
||||||
|
|
||||||
|
BMP280Sensor bmp280Sensor;
|
||||||
BME280Sensor bme280Sensor;
|
BME280Sensor bme280Sensor;
|
||||||
BME680Sensor bme680Sensor;
|
BME680Sensor bme680Sensor;
|
||||||
DHTSensor dhtSensor;
|
|
||||||
DallasSensor dallasSensor;
|
|
||||||
MCP9808Sensor mcp9808Sensor;
|
MCP9808Sensor mcp9808Sensor;
|
||||||
INA260Sensor ina260Sensor;
|
INA260Sensor ina260Sensor;
|
||||||
INA219Sensor ina219Sensor;
|
INA219Sensor ina219Sensor;
|
||||||
@@ -31,7 +28,7 @@ INA219Sensor ina219Sensor;
|
|||||||
#define FAILED_STATE_SENSOR_READ_MULTIPLIER 10
|
#define FAILED_STATE_SENSOR_READ_MULTIPLIER 10
|
||||||
#define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true
|
#define DISPLAY_RECEIVEID_MEASUREMENTS_ON_SCREEN true
|
||||||
|
|
||||||
#ifdef HAS_EINK
|
#ifdef USE_EINK
|
||||||
// The screen is bigger so use bigger fonts
|
// The screen is bigger so use bigger fonts
|
||||||
#define FONT_SMALL ArialMT_Plain_16
|
#define FONT_SMALL ArialMT_Plain_16
|
||||||
#define FONT_MEDIUM ArialMT_Plain_24
|
#define FONT_MEDIUM ArialMT_Plain_24
|
||||||
@@ -49,22 +46,16 @@ INA219Sensor ina219Sensor;
|
|||||||
|
|
||||||
int32_t EnvironmentTelemetryModule::runOnce()
|
int32_t EnvironmentTelemetryModule::runOnce()
|
||||||
{
|
{
|
||||||
#ifndef PORTDUINO
|
#ifndef ARCH_PORTDUINO
|
||||||
int32_t result = INT32_MAX;
|
int32_t result = INT32_MAX;
|
||||||
/*
|
/*
|
||||||
Uncomment the preferences below if you want to use the module
|
Uncomment the preferences below if you want to use the module
|
||||||
without having to configure it from the PythonAPI or WebUI.
|
without having to configure it from the PythonAPI or WebUI.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
// moduleConfig.telemetry.environment_measurement_enabled = 1;
|
||||||
moduleConfig.telemetry.environment_measurement_enabled = 1;
|
// moduleConfig.telemetry.environment_screen_enabled = 1;
|
||||||
moduleConfig.telemetry.environment_screen_enabled = 1;
|
// moduleConfig.telemetry.environment_update_interval = 45;
|
||||||
moduleConfig.telemetry.environment_read_error_count_threshold = 5;
|
|
||||||
moduleConfig.telemetry.environment_update_interval = 600;
|
|
||||||
moduleConfig.telemetry.environment_recovery_interval = 60;
|
|
||||||
moduleConfig.telemetry.environment_sensor_pin = 13; // If one-wire
|
|
||||||
moduleConfig.telemetry.environment_sensor_type = TelemetrySensorType::TelemetrySensorType_BME280;
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!(moduleConfig.telemetry.environment_measurement_enabled ||
|
if (!(moduleConfig.telemetry.environment_measurement_enabled ||
|
||||||
moduleConfig.telemetry.environment_screen_enabled)) {
|
moduleConfig.telemetry.environment_screen_enabled)) {
|
||||||
@@ -80,25 +71,12 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
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
|
||||||
|
if (bmp280Sensor.hasSensor())
|
||||||
switch (moduleConfig.telemetry.environment_sensor_type) {
|
result = bmp280Sensor.runOnce();
|
||||||
case TelemetrySensorType_DHT11:
|
|
||||||
case TelemetrySensorType_DHT12:
|
|
||||||
case TelemetrySensorType_DHT21:
|
|
||||||
case TelemetrySensorType_DHT22:
|
|
||||||
result = dhtSensor.runOnce();
|
|
||||||
break;
|
|
||||||
case TelemetrySensorType_DS18B20:
|
|
||||||
result = dallasSensor.runOnce();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DEBUG_MSG("Environment Telemetry: No sensor type specified; Checking for detected i2c sensors\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (bme680Sensor.hasSensor())
|
|
||||||
result = bme680Sensor.runOnce();
|
|
||||||
if (bme280Sensor.hasSensor())
|
if (bme280Sensor.hasSensor())
|
||||||
result = bme280Sensor.runOnce();
|
result = bme280Sensor.runOnce();
|
||||||
|
if (bme680Sensor.hasSensor())
|
||||||
|
result = bme680Sensor.runOnce();
|
||||||
if (mcp9808Sensor.hasSensor())
|
if (mcp9808Sensor.hasSensor())
|
||||||
result = mcp9808Sensor.runOnce();
|
result = mcp9808Sensor.runOnce();
|
||||||
if (ina260Sensor.hasSensor())
|
if (ina260Sensor.hasSensor())
|
||||||
@@ -113,26 +91,6 @@ int32_t EnvironmentTelemetryModule::runOnce()
|
|||||||
return result;
|
return result;
|
||||||
// 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 > moduleConfig.telemetry.environment_read_error_count_threshold) {
|
|
||||||
if (moduleConfig.telemetry.environment_recovery_interval > 0) {
|
|
||||||
DEBUG_MSG("Environment Telemetry: TEMPORARILY DISABLED; The "
|
|
||||||
"telemetry_module_environment_read_error_count_threshold has been exceed: %d. Will retry reads in "
|
|
||||||
"%d seconds\n",
|
|
||||||
moduleConfig.telemetry.environment_read_error_count_threshold,
|
|
||||||
moduleConfig.telemetry.environment_recovery_interval);
|
|
||||||
sensor_read_error_count = 0;
|
|
||||||
return (moduleConfig.telemetry.environment_recovery_interval * 1000);
|
|
||||||
}
|
|
||||||
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",
|
|
||||||
moduleConfig.telemetry.environment_read_error_count_threshold);
|
|
||||||
return result;
|
|
||||||
|
|
||||||
} else if (sensor_read_error_count > 0) {
|
|
||||||
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,
|
|
||||||
moduleConfig.telemetry.environment_read_error_count_threshold - 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
|
||||||
@@ -242,21 +200,8 @@ 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 (moduleConfig.telemetry.environment_sensor_type) {
|
if (bmp280Sensor.hasSensor())
|
||||||
case TelemetrySensorType_DS18B20:
|
bmp280Sensor.getMetrics(&m);
|
||||||
if (!dallasSensor.getMetrics(&m))
|
|
||||||
sensor_read_error_count++;
|
|
||||||
break;
|
|
||||||
case TelemetrySensorType_DHT11:
|
|
||||||
case TelemetrySensorType_DHT12:
|
|
||||||
case TelemetrySensorType_DHT21:
|
|
||||||
case TelemetrySensorType_DHT22:
|
|
||||||
if (!dhtSensor.getMetrics(&m))
|
|
||||||
sensor_read_error_count++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DEBUG_MSG("Environment Telemetry: No specified sensor type; Trying any detected i2c sensors\n");
|
|
||||||
}
|
|
||||||
if (bme280Sensor.hasSensor())
|
if (bme280Sensor.hasSensor())
|
||||||
bme280Sensor.getMetrics(&m);
|
bme280Sensor.getMetrics(&m);
|
||||||
if (bme680Sensor.hasSensor())
|
if (bme680Sensor.hasSensor())
|
||||||
@@ -284,6 +229,6 @@ bool EnvironmentTelemetryModule::sendOurTelemetry(NodeNum dest, bool wantReplies
|
|||||||
|
|
||||||
lastMeasurementPacket = packetPool.allocCopy(*p);
|
lastMeasurementPacket = packetPool.allocCopy(*p);
|
||||||
DEBUG_MSG("Environment Telemetry: Sending packet to mesh");
|
DEBUG_MSG("Environment Telemetry: Sending packet to mesh");
|
||||||
service.sendToMesh(p);
|
service.sendToMesh(p, RX_SRC_LOCAL, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class EnvironmentTelemetryModule : private concurrency::OSThread, public Protobu
|
|||||||
lastMeasurementPacket = nullptr;
|
lastMeasurementPacket = nullptr;
|
||||||
}
|
}
|
||||||
virtual bool wantUIFrame() override;
|
virtual bool wantUIFrame() override;
|
||||||
#ifdef NO_SCREEN
|
#if !HAS_SCREEN
|
||||||
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||||
#else
|
#else
|
||||||
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
virtual void drawFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y) override;
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#include "../mesh/generated/telemetry.pb.h"
|
||||||
|
#include "configuration.h"
|
||||||
|
#include "TelemetrySensor.h"
|
||||||
|
#include "BMP280Sensor.h"
|
||||||
|
#include <Adafruit_BMP280.h>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
|
BMP280Sensor::BMP280Sensor() :
|
||||||
|
TelemetrySensor(TelemetrySensorType_BME280, "BMP280")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t BMP280Sensor::runOnce() {
|
||||||
|
DEBUG_MSG("Init sensor: %s\n", sensorName);
|
||||||
|
if (!hasSensor()) {
|
||||||
|
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
||||||
|
}
|
||||||
|
status = bmp280.begin(nodeTelemetrySensorsMap[sensorType]);
|
||||||
|
return initI2CSensor();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BMP280Sensor::setup() { }
|
||||||
|
|
||||||
|
bool BMP280Sensor::getMetrics(Telemetry *measurement) {
|
||||||
|
DEBUG_MSG("BMP280Sensor::getMetrics\n");
|
||||||
|
measurement->variant.environment_metrics.temperature = bmp280.readTemperature();
|
||||||
|
measurement->variant.environment_metrics.barometric_pressure = bmp280.readPressure() / 100.0F;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
+4
-4
@@ -1,16 +1,16 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
#include "../mesh/generated/telemetry.pb.h"
|
||||||
#include "TelemetrySensor.h"
|
#include "TelemetrySensor.h"
|
||||||
#include <DHT.h>
|
#include <Adafruit_BMP280.h>
|
||||||
|
|
||||||
class DHTSensor : virtual public TelemetrySensor {
|
class BMP280Sensor : virtual public TelemetrySensor {
|
||||||
private:
|
private:
|
||||||
DHT *dht = NULL;
|
Adafruit_BMP280 bmp280;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void setup() override;
|
virtual void setup() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DHTSensor();
|
BMP280Sensor();
|
||||||
virtual int32_t runOnce() override;
|
virtual int32_t runOnce() override;
|
||||||
virtual bool getMetrics(Telemetry *measurement) override;
|
virtual bool getMetrics(Telemetry *measurement) override;
|
||||||
};
|
};
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
#include "DHTSensor.h"
|
|
||||||
#include "./mesh/generated/telemetry.pb.h"
|
|
||||||
#include "MeshService.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include <DHT.h>
|
|
||||||
|
|
||||||
DHTSensor::DHTSensor() :
|
|
||||||
TelemetrySensor(TelemetrySensorType_NotSet, "DHT")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t DHTSensor::runOnce() {
|
|
||||||
if (moduleConfig.telemetry.environment_sensor_type == TelemetrySensorType_DHT11 ||
|
|
||||||
moduleConfig.telemetry.environment_sensor_type == TelemetrySensorType_DHT12) {
|
|
||||||
dht = new DHT(moduleConfig.telemetry.environment_sensor_pin, DHT11);
|
|
||||||
} else {
|
|
||||||
dht = new DHT(moduleConfig.telemetry.environment_sensor_pin, DHT22);
|
|
||||||
}
|
|
||||||
|
|
||||||
dht->begin();
|
|
||||||
dht->read();
|
|
||||||
DEBUG_MSG("Opened DHT11/DHT12 on pin: %d\n", moduleConfig.telemetry.environment_sensor_pin);
|
|
||||||
|
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DHTSensor::setup() { }
|
|
||||||
|
|
||||||
bool DHTSensor::getMetrics(Telemetry *measurement) {
|
|
||||||
DEBUG_MSG("DHTSensor::getMetrics\n");
|
|
||||||
if (!dht->read(true)) {
|
|
||||||
DEBUG_MSG("Telemetry: FAILED TO READ DATA\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
measurement->variant.environment_metrics.relative_humidity = dht->readHumidity();
|
|
||||||
measurement->variant.environment_metrics.temperature = dht->readTemperature();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
#include "DallasSensor.h"
|
|
||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "MeshService.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include "configuration.h"
|
|
||||||
#include <DS18B20.h>
|
|
||||||
#include <OneWire.h>
|
|
||||||
|
|
||||||
DallasSensor::DallasSensor() :
|
|
||||||
TelemetrySensor(TelemetrySensorType_DS18B20, "DS18B20")
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t DallasSensor::runOnce() {
|
|
||||||
oneWire = new OneWire(moduleConfig.telemetry.environment_sensor_pin);
|
|
||||||
ds18b20 = new DS18B20(oneWire);
|
|
||||||
ds18b20->begin();
|
|
||||||
ds18b20->setResolution(12);
|
|
||||||
ds18b20->requestTemperatures();
|
|
||||||
DEBUG_MSG("Opened DS18B20 on pin: %d\n", moduleConfig.telemetry.environment_sensor_pin);
|
|
||||||
return DEFAULT_SENSOR_MINIMUM_WAIT_TIME_BETWEEN_READS;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DallasSensor::setup() {}
|
|
||||||
|
|
||||||
bool DallasSensor::getMetrics(Telemetry *measurement){
|
|
||||||
DEBUG_MSG("DallasSensor::getMetrics\n");
|
|
||||||
if (ds18b20->isConversionComplete()) {
|
|
||||||
measurement->variant.environment_metrics.temperature = ds18b20->getTempC();
|
|
||||||
measurement->variant.environment_metrics.relative_humidity = 0;
|
|
||||||
ds18b20->requestTemperatures();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#include "../mesh/generated/telemetry.pb.h"
|
|
||||||
#include "TelemetrySensor.h"
|
|
||||||
#include <DS18B20.h>
|
|
||||||
#include <OneWire.h>
|
|
||||||
|
|
||||||
class DallasSensor : virtual public TelemetrySensor {
|
|
||||||
private:
|
|
||||||
OneWire *oneWire = NULL;
|
|
||||||
DS18B20 *ds18b20 = NULL;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void setup() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DallasSensor();
|
|
||||||
virtual int32_t runOnce() override;
|
|
||||||
virtual bool getMetrics(Telemetry *measurement) override;
|
|
||||||
};
|
|
||||||
@@ -29,7 +29,7 @@ uint32_t packetSequence = 0;
|
|||||||
|
|
||||||
int32_t RangeTestModule::runOnce()
|
int32_t RangeTestModule::runOnce()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Uncomment the preferences below if you want to use the module
|
Uncomment the preferences below if you want to use the module
|
||||||
@@ -129,7 +129,7 @@ void RangeTestModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
|
ProcessMessage RangeTestModuleRadio::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
if (moduleConfig.range_test.enabled) {
|
if (moduleConfig.range_test.enabled) {
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ SerialModuleRadio::SerialModuleRadio() : SinglePortModule("SerialModuleRadio", P
|
|||||||
|
|
||||||
int32_t SerialModule::runOnce()
|
int32_t SerialModule::runOnce()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Uncomment the preferences below if you want to use the module
|
Uncomment the preferences below if you want to use the module
|
||||||
@@ -209,7 +209,7 @@ void SerialModuleRadio::sendPayload(NodeNum dest, bool wantReplies)
|
|||||||
|
|
||||||
ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
|
ProcessMessage SerialModuleRadio::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
if (moduleConfig.serial.enabled) {
|
if (moduleConfig.serial.enabled) {
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ StoreForwardModule *storeForwardModule;
|
|||||||
int32_t StoreForwardModule::runOnce()
|
int32_t StoreForwardModule::runOnce()
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
if (moduleConfig.store_forward.enabled) {
|
if (moduleConfig.store_forward.enabled) {
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ void StoreForwardModule::sendMessage(NodeNum dest, char *str)
|
|||||||
|
|
||||||
ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
|
ProcessMessage StoreForwardModule::handleReceived(const MeshPacket &mp)
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
if (moduleConfig.store_forward.enabled) {
|
if (moduleConfig.store_forward.enabled) {
|
||||||
|
|
||||||
DEBUG_MSG("--- S&F Received something\n");
|
DEBUG_MSG("--- S&F Received something\n");
|
||||||
@@ -381,7 +381,7 @@ StoreForwardModule::StoreForwardModule()
|
|||||||
: SinglePortModule("StoreForwardModule", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("StoreForwardModule")
|
: SinglePortModule("StoreForwardModule", PortNum_TEXT_MESSAGE_APP), concurrency::OSThread("StoreForwardModule")
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
isPromiscuous = true; // Brown chicken brown cow
|
isPromiscuous = true; // Brown chicken brown cow
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
#include "sleep.h"
|
#include "sleep.h"
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
#include <nvs_flash.h>
|
#include <nvs_flash.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -508,7 +508,7 @@ void disablePin()
|
|||||||
// This should go somewhere else.
|
// This should go somewhere else.
|
||||||
void clearNVS()
|
void clearNVS()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
// As soon as the LED flashing from double click is done, immediately do a tripple click to
|
// As soon as the LED flashing from double click is done, immediately do a tripple click to
|
||||||
// erase nvs memory.
|
// erase nvs memory.
|
||||||
|
|||||||
@@ -0,0 +1,91 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ARCH_NRF52
|
||||||
|
|
||||||
|
//
|
||||||
|
// defaults for NRF52 architecture
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HAS_SCREEN
|
||||||
|
#define HAS_SCREEN 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_WIRE
|
||||||
|
#define HAS_WIRE 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GPS
|
||||||
|
#define HAS_GPS 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_BUTTON
|
||||||
|
#define HAS_BUTTON 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_TELEMETRY
|
||||||
|
#define HAS_TELEMETRY 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_RADIO
|
||||||
|
#define HAS_RADIO 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// set HW_VENDOR
|
||||||
|
//
|
||||||
|
|
||||||
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
|
#ifdef ARDUINO_NRF52840_PCA10056
|
||||||
|
#define HW_VENDOR HardwareModel_NRF52840DK
|
||||||
|
#elif defined(ARDUINO_NRF52840_PPR)
|
||||||
|
#define HW_VENDOR HardwareModel_PPR
|
||||||
|
#elif defined(RAK4630)
|
||||||
|
#define HW_VENDOR HardwareModel_RAK4631
|
||||||
|
#elif defined(TTGO_T_ECHO)
|
||||||
|
#define HW_VENDOR HardwareModel_T_ECHO
|
||||||
|
#elif defined(NORDIC_PCA10059)
|
||||||
|
#define HW_VENDOR HardwareModel_NRF52840_PCA10059
|
||||||
|
#else
|
||||||
|
#define HW_VENDOR HardwareModel_NRF52_UNKNOWN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// Standard definitions for NRF52 targets
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef ARDUINO_NRF52840_PCA10056
|
||||||
|
|
||||||
|
// This board uses 0 to be mean LED on
|
||||||
|
#undef LED_INVERTED
|
||||||
|
#define LED_INVERTED 1
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef TTGO_T_ECHO
|
||||||
|
#define GPS_UBLOX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define LED_PIN PIN_LED1 // LED1 on nrf52840-DK
|
||||||
|
|
||||||
|
#ifdef PIN_BUTTON1
|
||||||
|
#define BUTTON_PIN PIN_BUTTON1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PIN_BUTTON2
|
||||||
|
#define BUTTON_PIN_ALT PIN_BUTTON2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PIN_BUTTON_TOUCH
|
||||||
|
#define BUTTON_PIN_TOUCH PIN_BUTTON_TOUCH
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Always include the SEGGER code on NRF52 - because useful for debugging
|
||||||
|
#include "SEGGER_RTT.h"
|
||||||
|
|
||||||
|
// The channel we send stdout data to
|
||||||
|
#define SEGGER_STDOUT_CH 0
|
||||||
|
|
||||||
|
// Debug printing to segger console
|
||||||
|
#define SEGGER_MSG(...) SEGGER_RTT_printf(SEGGER_STDOUT_CH, __VA_ARGS__)
|
||||||
|
|
||||||
|
// If we are not on a NRF52840 (which has built in USB-ACM serial support) and we don't have serial pins hooked up, then we MUST
|
||||||
|
// use SEGGER for debug output
|
||||||
|
#if !defined(PIN_SERIAL_RX) && !defined(NRF52840_XXAA)
|
||||||
|
// No serial ports on this board - ONLY use segger in memory console
|
||||||
|
#define USE_SEGGER
|
||||||
|
#endif
|
||||||
@@ -161,7 +161,7 @@ void cpuDeepSleep(uint64_t msecToWake)
|
|||||||
{
|
{
|
||||||
// FIXME, configure RTC or button press to wake us
|
// FIXME, configure RTC or button press to wake us
|
||||||
// FIXME, power down SPI, I2C, RAMs
|
// FIXME, power down SPI, I2C, RAMs
|
||||||
#ifndef NO_WIRE
|
#if HAS_WIRE
|
||||||
Wire.end();
|
Wire.end();
|
||||||
#endif
|
#endif
|
||||||
SPI.end();
|
SPI.end();
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ARCH_PORTDUINO
|
||||||
|
|
||||||
|
//
|
||||||
|
// defaults for NRF52 architecture
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// set HW_VENDOR
|
||||||
|
//
|
||||||
|
|
||||||
|
#define HW_VENDOR HardwareModel_PORTDUINO
|
||||||
|
|
||||||
|
#define HAS_RTC 1
|
||||||
|
#define HAS_WIFI 1
|
||||||
+4
-4
@@ -8,16 +8,16 @@ void powerCommandsCheck()
|
|||||||
{
|
{
|
||||||
if (rebootAtMsec && millis() > rebootAtMsec) {
|
if (rebootAtMsec && millis() > rebootAtMsec) {
|
||||||
DEBUG_MSG("Rebooting\n");
|
DEBUG_MSG("Rebooting\n");
|
||||||
#ifndef NO_ESP32
|
#if defined(ARCH_ESP32)
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
#elif NRF52_SERIES
|
#elif defined(ARCH_NRF52)
|
||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
#else
|
#else
|
||||||
DEBUG_MSG("FIXME implement reboot for this platform");
|
DEBUG_MSG("FIXME implement reboot for this platform");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NRF52_SERIES
|
#if defined(ARCH_NRF52)
|
||||||
if (shutdownAtMsec) {
|
if (shutdownAtMsec) {
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
playBeep();
|
playBeep();
|
||||||
@@ -33,7 +33,7 @@ void powerCommandsCheck()
|
|||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
}
|
}
|
||||||
#elif NRF52_SERIES
|
#elif defined(ARCH_NRF52)
|
||||||
playShutdownMelody();
|
playShutdownMelody();
|
||||||
power->shutdown();
|
power->shutdown();
|
||||||
#else
|
#else
|
||||||
|
|||||||
+4
-4
@@ -8,7 +8,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "target_specific.h"
|
#include "target_specific.h"
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp32/pm.h"
|
#include "esp32/pm.h"
|
||||||
#include "esp_pm.h"
|
#include "esp_pm.h"
|
||||||
#include "mesh/http/WiFiAPClient.h"
|
#include "mesh/http/WiFiAPClient.h"
|
||||||
@@ -48,7 +48,7 @@ RTC_DATA_ATTR int bootCount = 0;
|
|||||||
*/
|
*/
|
||||||
void setCPUFast(bool on)
|
void setCPUFast(bool on)
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
|
|
||||||
if (isWifiAvailable()) {
|
if (isWifiAvailable()) {
|
||||||
/*
|
/*
|
||||||
@@ -101,7 +101,7 @@ void setGPSPower(bool on)
|
|||||||
// Perform power on init that we do on each wake from deep sleep
|
// Perform power on init that we do on each wake from deep sleep
|
||||||
void initDeepSleep()
|
void initDeepSleep()
|
||||||
{
|
{
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
bootCount++;
|
bootCount++;
|
||||||
wakeCause = esp_sleep_get_wakeup_cause();
|
wakeCause = esp_sleep_get_wakeup_cause();
|
||||||
/*
|
/*
|
||||||
@@ -207,7 +207,7 @@ void doDeepSleep(uint64_t msecToWake)
|
|||||||
cpuDeepSleep(msecToWake);
|
cpuDeepSleep(msecToWake);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
/**
|
/**
|
||||||
* enter light sleep (preserves ram but stops everything about CPU).
|
* enter light sleep (preserves ram but stops everything about CPU).
|
||||||
*
|
*
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
void doDeepSleep(uint64_t msecToWake), cpuDeepSleep(uint64_t msecToWake);
|
void doDeepSleep(uint64_t msecToWake), cpuDeepSleep(uint64_t msecToWake);
|
||||||
|
|
||||||
#ifndef NO_ESP32
|
#ifdef ARCH_ESP32
|
||||||
#include "esp_sleep.h"
|
#include "esp_sleep.h"
|
||||||
esp_sleep_wakeup_cause_t doLightSleep(uint64_t msecToWake);
|
esp_sleep_wakeup_cause_t doLightSleep(uint64_t msecToWake);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
//#include "mesh/wifi/WebServer.h"
|
//#include "mesh/wifi/WebServer.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifdef NO_ESP32
|
#ifndef ARCH_ESP32
|
||||||
|
|
||||||
//#include "mesh/wifi/WiFiAPClient.h"
|
//#include "mesh/wifi/WiFiAPClient.h"
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define PIN_EINK_SCLK (9) // EPD_SCLK
|
#define PIN_EINK_SCLK (9) // EPD_SCLK
|
||||||
#define PIN_EINK_MOSI (10) // EPD_MOSI
|
#define PIN_EINK_MOSI (10) // EPD_MOSI
|
||||||
|
|
||||||
#define HAS_EINK
|
#define USE_EINK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wire Interfaces
|
* Wire Interfaces
|
||||||
|
|||||||
@@ -90,7 +90,4 @@
|
|||||||
|
|
||||||
#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control
|
#define SX126X_E22 // Not really an E22 but this board clones using DIO3 for tcxo control
|
||||||
|
|
||||||
#define NO_WIRE
|
|
||||||
#define NO_GPS
|
|
||||||
#define NO_SCREEN
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,12 +32,11 @@
|
|||||||
#define LORA_DIO1 RADIOLIB_NC
|
#define LORA_DIO1 RADIOLIB_NC
|
||||||
#define LORA_DIO2 RADIOLIB_NC
|
#define LORA_DIO2 RADIOLIB_NC
|
||||||
|
|
||||||
#define NO_GPS
|
|
||||||
// This board has no GPS for now
|
// This board has no GPS for now
|
||||||
#undef GPS_RX_PIN
|
#undef GPS_RX_PIN
|
||||||
#undef GPS_TX_PIN
|
#undef GPS_TX_PIN
|
||||||
|
|
||||||
#define HAS_EINK
|
#define USE_EINK
|
||||||
//https://docs.m5stack.com/en/core/coreink
|
//https://docs.m5stack.com/en/core/coreink
|
||||||
//https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/coreink/coreink_sch.pdf
|
//https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/docs/schematic/Core/coreink/coreink_sch.pdf
|
||||||
#define PIN_EINK_EN -1
|
#define PIN_EINK_EN -1
|
||||||
@@ -47,3 +46,5 @@
|
|||||||
#define PIN_EINK_RES -1 // Connected to GPIO0 but no needed !!!! maybe causing issue ?
|
#define PIN_EINK_RES -1 // Connected to GPIO0 but no needed !!!! maybe causing issue ?
|
||||||
#define PIN_EINK_SCLK 18 // EPD_SCLK
|
#define PIN_EINK_SCLK 18 // EPD_SCLK
|
||||||
#define PIN_EINK_MOSI 23 // EPD_MOSI
|
#define PIN_EINK_MOSI 23 // EPD_MOSI
|
||||||
|
|
||||||
|
#define HAS_RTC 1
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ build_src_filter =
|
|||||||
-<esp32/>
|
-<esp32/>
|
||||||
-<nimble/>
|
-<nimble/>
|
||||||
-<nrf52/>
|
-<nrf52/>
|
||||||
|
-<stm32wl/>
|
||||||
-<mesh/http/>
|
-<mesh/http/>
|
||||||
-<modules/esp32>
|
-<modules/esp32>
|
||||||
-<modules/Telemetry>
|
-<modules/Telemetry>
|
||||||
@@ -14,10 +15,11 @@ lib_deps =
|
|||||||
${networking_base.lib_deps}
|
${networking_base.lib_deps}
|
||||||
rweather/Crypto
|
rweather/Crypto
|
||||||
https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74
|
https://github.com/meshtastic/RadioLib.git#5582ac30578ff3f53f20630a00b2a8a4b8f92c74
|
||||||
|
build_flags = ${arduino_base.build_flags} -Isrc/portduino
|
||||||
|
|
||||||
[env:native]
|
[env:native]
|
||||||
platform = https://github.com/meshtastic/platform-native.git
|
platform = https://github.com/meshtastic/platform-native.git
|
||||||
build_flags = ${arduino_base.build_flags} -O0 -I variants/portduino
|
build_flags = ${portduino_base.build_flags} -O0 -I variants/portduino
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = cross_platform
|
board = cross_platform
|
||||||
lib_deps = ${portduino_base.lib_deps}
|
lib_deps = ${portduino_base.lib_deps}
|
||||||
@@ -26,8 +28,8 @@ build_src_filter = ${portduino_base.build_src_filter}
|
|||||||
; The Portduino based sim environment on top of a linux OS and touching linux hardware devices
|
; The Portduino based sim environment on top of a linux OS and touching linux hardware devices
|
||||||
[env:linux]
|
[env:linux]
|
||||||
platform = https://github.com/meshtastic/platform-native.git
|
platform = https://github.com/meshtastic/platform-native.git
|
||||||
build_flags = ${arduino_base.build_flags} -O0 -lgpiod -I variants/portduino
|
build_flags = ${portduino_base.build_flags} -O0 -lgpiod -I variants/portduino
|
||||||
framework = arduino
|
framework = arduino
|
||||||
board = linux_hardware
|
board = linux_hardware
|
||||||
lib_deps = ${portduino_base.lib_deps}
|
lib_deps = ${portduino_base.lib_deps}
|
||||||
build_src_filter = ${portduino_base.build_src_filter}
|
build_src_filter = ${portduino_base.build_src_filter}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
#define USE_SIM_RADIO
|
|
||||||
|
|
||||||
// Pine64 uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
|
// Pine64 uses a common pinout for their SX1262 vs RF95 modules - both can be enabled and we will probe at runtime for RF95 and if
|
||||||
// not found then probe for SX1262. Currently the RF95 code is disabled because I think the RF95 module won't need to ship.
|
// not found then probe for SX1262. Currently the RF95 code is disabled because I think the RF95 module won't need to ship.
|
||||||
// #define USE_RF95
|
// #define USE_RF95
|
||||||
@@ -37,4 +35,4 @@
|
|||||||
#define RADIOLIB_SX127X_REG_TCXO SX127X_REG_TCXO
|
#define RADIOLIB_SX127X_REG_TCXO SX127X_REG_TCXO
|
||||||
#define RADIOLIB_SX127X_REG_MODEM_STAT SX127X_REG_MODEM_STAT
|
#define RADIOLIB_SX127X_REG_MODEM_STAT SX127X_REG_MODEM_STAT
|
||||||
#define RADIOLIB_SX127X_SYNC_WORD SX127X_SYNC_WORD
|
#define RADIOLIB_SX127X_SYNC_WORD SX127X_SYNC_WORD
|
||||||
#define RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER SX127X_MASK_IRQ_FLAG_VALID_HEADER
|
#define RADIOLIB_SX127X_MASK_IRQ_FLAG_VALID_HEADER SX127X_MASK_IRQ_FLAG_VALID_HEADER
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmare for 5005/19003, with or without OLED RAK 1921
|
; The very slick RAK wireless RAK 4631 / 4630 board - Unified firmware for 5005/19003, with or without OLED RAK 1921
|
||||||
[env:rak4631]
|
[env:rak4631]
|
||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = wiscore_rak4631
|
board = wiscore_rak4631
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
||||||
//#define PIN_EINK_PWR_ON (-1)
|
//#define PIN_EINK_PWR_ON (-1)
|
||||||
|
|
||||||
// #define HAS_EINK
|
// #define USE_EINK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wire Interfaces
|
* Wire Interfaces
|
||||||
@@ -224,6 +224,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP //REAL_VBAT_MV_PER_LSB
|
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP //REAL_VBAT_MV_PER_LSB
|
||||||
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
||||||
|
|
||||||
|
#define HAS_RTC 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
||||||
//#define PIN_EINK_PWR_ON (-1)
|
//#define PIN_EINK_PWR_ON (-1)
|
||||||
|
|
||||||
#define HAS_EINK
|
#define USE_EINK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wire Interfaces
|
* Wire Interfaces
|
||||||
@@ -221,6 +221,8 @@ static const uint8_t SCK = PIN_SPI_SCK;
|
|||||||
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP //REAL_VBAT_MV_PER_LSB
|
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP //REAL_VBAT_MV_PER_LSB
|
||||||
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
||||||
|
|
||||||
|
#define HAS_RTC 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ External serial flash WP25R1635FZUIL0
|
|||||||
// #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...)
|
// #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...)
|
||||||
|
|
||||||
// #undef SX126X_CS
|
// #undef SX126X_CS
|
||||||
// #define USE_SIM_RADIO // define to not use the lora radio hardware at all
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* eink display pins
|
* eink display pins
|
||||||
@@ -157,7 +156,7 @@ External serial flash WP25R1635FZUIL0
|
|||||||
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
// FIXME - I think this is actually just the board power enable - it enables power to the CPU also
|
||||||
#define PIN_EINK_PWR_ON (0 + 12)
|
#define PIN_EINK_PWR_ON (0 + 12)
|
||||||
|
|
||||||
#define HAS_EINK
|
#define USE_EINK
|
||||||
|
|
||||||
// No screen wipes on eink
|
// No screen wipes on eink
|
||||||
#define SCREEN_TRANSITION_MSECS 0
|
#define SCREEN_TRANSITION_MSECS 0
|
||||||
@@ -220,6 +219,8 @@ External serial flash WP25R1635FZUIL0
|
|||||||
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP
|
#define ADC_MULTIPLIER VBAT_DIVIDER_COMP
|
||||||
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
#define VBAT_RAW_TO_SCALED(x) (REAL_VBAT_MV_PER_LSB * x)
|
||||||
|
|
||||||
|
#define HAS_RTC 1
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
[VERSION]
|
[VERSION]
|
||||||
major = 1
|
major = 1
|
||||||
minor = 3
|
minor = 3
|
||||||
build = 27
|
build = 28
|
||||||
|
|||||||
Reference in New Issue
Block a user