mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 06:02:05 +00:00
lay groundwork for a possible future architecture (#1571)
* lay groundwork for a possible future architecture * switch from feature opt-out to feature opt-in * lay groundwork for a possible future architecture * switch from feature opt-out to feature opt-in * fix USE_RTC in variant.h for rak4631_epaper and t-echo * ensure Screen.h is not included without configuration.h Co-authored-by: Peter Lawrence <12226419+majbthrd@users.noreply.github.com> Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
parent
fd27a814b7
commit
ade32b1827
@ -91,7 +91,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
|
||||||
|
|
||||||
@ -143,7 +143,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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
@ -180,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
|
||||||
@ -225,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);
|
||||||
@ -267,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++;
|
||||||
|
@ -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) {
|
||||||
|
@ -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
|
||||||
|
@ -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);
|
||||||
|
99
src/esp32/architecture.h
Normal file
99
src/esp32/architecture.h
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#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
|
||||||
|
#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
|
||||||
|
|
||||||
|
#define SERIAL0_RX_GPIO 3 // Always GPIO3 on ESP32
|
@ -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) {
|
||||||
|
@ -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"
|
||||||
|
@ -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
|
||||||
@ -94,7 +94,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
|
||||||
@ -212,7 +212,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
|
||||||
@ -253,13 +253,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)
|
||||||
{
|
{
|
||||||
@ -843,7 +843,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);
|
||||||
@ -954,7 +954,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
|
||||||
}
|
}
|
||||||
@ -1055,7 +1055,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
|
||||||
|
|
||||||
@ -1180,7 +1180,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;
|
||||||
@ -1287,7 +1287,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
|
||||||
|
|
||||||
@ -1342,7 +1342,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;
|
||||||
|
|
||||||
@ -1665,4 +1665,4 @@ 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;
|
||||||
|
36
src/main.cpp
36
src/main.cpp
@ -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;
|
||||||
@ -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();
|
||||||
|
@ -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:
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
|
@ -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.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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;
|
||||||
|
@ -26,7 +26,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
|
||||||
@ -44,7 +44,7 @@ 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
|
||||||
|
@ -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;
|
||||||
|
@ -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.
|
||||||
|
91
src/nrf52/architecture.h
Normal file
91
src/nrf52/architecture.h
Normal file
@ -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();
|
||||||
|
16
src/portduino/architecture.h
Normal file
16
src/portduino/architecture.h
Normal file
@ -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
|
@ -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
|
||||||
|
@ -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).
|
||||||
*
|
*
|
||||||
|
@ -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,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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user