mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-21 18:22:32 +00:00
Compare commits
9 Commits
v2.0.23.7b
...
v2.1.0.331
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
331a1afc37 | ||
|
|
321e41a3aa | ||
|
|
3ca1e62b1f | ||
|
|
5044169e8d | ||
|
|
8e197fc35b | ||
|
|
f63505038f | ||
|
|
4a0dfb5401 | ||
|
|
eb4ab26e1f | ||
|
|
8c059a8a9e |
@@ -9,7 +9,8 @@
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_USB_MODE=0",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=1",
|
||||
"-DBOARD_HAS_PSRAM"
|
||||
],
|
||||
"f_cpu": "240000000L",
|
||||
"f_flash": "80000000L",
|
||||
|
||||
@@ -66,8 +66,7 @@ lib_deps =
|
||||
https://github.com/meshtastic/ArduinoThread.git#72921ac222eed6f526ba1682023cee290d9aa1b3
|
||||
nanopb/Nanopb@^0.4.6
|
||||
erriez/ErriezCRC32@^1.0.1
|
||||
; jgromes/RadioLib@^5.5.1
|
||||
https://github.com/jgromes/RadioLib.git#1afa947030c5637f71f6563bc22aa75032e53a57
|
||||
jgromes/RadioLib@^5.7.0
|
||||
|
||||
; Used for the code analysis in PIO Home / Inspect
|
||||
check_tool = cppcheck
|
||||
|
||||
Submodule protobufs updated: b3d05ec995...19d49ec528
@@ -44,7 +44,8 @@ void FloodingRouter::sniffReceived(const meshtastic_MeshPacket *p, const meshtas
|
||||
tosend->hop_limit--; // bump down the hop count
|
||||
|
||||
// If it is a traceRoute request, update the route that it went via me
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && traceRouteModule->wantPacket(p)) {
|
||||
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag && traceRouteModule &&
|
||||
traceRouteModule->wantPacket(p)) {
|
||||
traceRouteModule->updateRoute(tosend);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ int MeshService::handleFromRadio(const meshtastic_MeshPacket *mp)
|
||||
powerFSM.trigger(EVENT_PACKET_FOR_PHONE); // Possibly keep the node from sleeping
|
||||
|
||||
nodeDB.updateFrom(*mp); // update our DB state based off sniffing every RX packet from the radio
|
||||
if (!nodeDB.getNode(mp->from)->has_user && nodeInfoModule) {
|
||||
if (mp->which_payload_variant == meshtastic_MeshPacket_decoded_tag && !nodeDB.getNode(mp->from)->has_user && nodeInfoModule) {
|
||||
LOG_INFO("Heard a node we don't know, sending NodeInfo and asking for a response.\n");
|
||||
nodeInfoModule->sendOurNodeInfo(mp->from, true);
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ void printPacket(const char *prefix, const meshtastic_MeshPacket *p)
|
||||
if (p->priority != 0)
|
||||
out += DEBUG_PORT.mt_sprintf(" priority=%d", p->priority);
|
||||
|
||||
out + ")\n";
|
||||
out += ")\n";
|
||||
LOG_DEBUG("%s", out.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -212,9 +212,10 @@ template <typename T> void SX126xInterface<T>::startReceive()
|
||||
|
||||
setStandby();
|
||||
|
||||
// int err = lora.startReceive();
|
||||
int err = lora.startReceiveDutyCycleAuto(); // We use a 32 bit preamble so this should save some power by letting radio sit in
|
||||
// standby mostly.
|
||||
// We use a 16 bit preamble so this should save some power by letting radio sit in standby mostly.
|
||||
// Furthermore, we need the HEADER_VALID IRQ flag to detect whether we are actively receiving
|
||||
int err =
|
||||
lora.startReceiveDutyCycleAuto(preambleLength, 8, RADIOLIB_SX126X_IRQ_RX_DEFAULT | RADIOLIB_SX126X_IRQ_HEADER_VALID);
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
isReceiving = true;
|
||||
@@ -224,7 +225,7 @@ template <typename T> void SX126xInterface<T>::startReceive()
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
/** Is the channel currently active? */
|
||||
template <typename T> bool SX126xInterface<T>::isChannelActive()
|
||||
{
|
||||
// check if we can detect a LoRa preamble on the current channel
|
||||
@@ -245,17 +246,12 @@ template <typename T> bool SX126xInterface<T>::isActivelyReceiving()
|
||||
{
|
||||
// The IRQ status will be cleared when we start our read operation. Check if we've started a header, but haven't yet
|
||||
// received and handled the interrupt for reading the packet/handling errors.
|
||||
// FIXME: it would be better to check for preamble, but we currently have our ISR not set to fire for packets that
|
||||
// never even get a valid header, so we don't want preamble to get set and stay set due to noise on the network.
|
||||
|
||||
uint16_t irq = lora.getIrqStatus();
|
||||
bool hasPreamble = (irq & RADIOLIB_SX126X_IRQ_HEADER_VALID);
|
||||
bool headerValid = (irq & RADIOLIB_SX126X_IRQ_HEADER_VALID);
|
||||
|
||||
// this is not correct - often always true - need to add an extra conditional
|
||||
// size_t bytesPending = lora.getPacketLength();
|
||||
|
||||
// if (hasPreamble) LOG_DEBUG("rx hasPreamble\n");
|
||||
return hasPreamble;
|
||||
// if (headerValid) LOG_DEBUG("rx headerValid\n");
|
||||
return headerValid;
|
||||
}
|
||||
|
||||
template <typename T> bool SX126xInterface<T>::sleep()
|
||||
|
||||
@@ -203,7 +203,9 @@ template <typename T> void SX128xInterface<T>::startReceive()
|
||||
digitalWrite(SX128X_TXEN, LOW);
|
||||
#endif
|
||||
|
||||
int err = lora.startReceive();
|
||||
// We use the HEADER_VALID IRQ flag to detect whether we are actively receiving
|
||||
int err =
|
||||
lora.startReceive(RADIOLIB_SX128X_RX_TIMEOUT_INF, RADIOLIB_SX128X_IRQ_RX_DEFAULT | RADIOLIB_SX128X_IRQ_HEADER_VALID);
|
||||
|
||||
assert(err == RADIOLIB_ERR_NONE);
|
||||
|
||||
@@ -214,7 +216,7 @@ template <typename T> void SX128xInterface<T>::startReceive()
|
||||
#endif
|
||||
}
|
||||
|
||||
/** Could we send right now (i.e. either not actively receving or transmitting)? */
|
||||
/** Is the channel currently active? */
|
||||
template <typename T> bool SX128xInterface<T>::isChannelActive()
|
||||
{
|
||||
// check if we can detect a LoRa preamble on the current channel
|
||||
@@ -234,8 +236,8 @@ template <typename T> bool SX128xInterface<T>::isChannelActive()
|
||||
template <typename T> bool SX128xInterface<T>::isActivelyReceiving()
|
||||
{
|
||||
uint16_t irq = lora.getIrqStatus();
|
||||
bool hasPreamble = (irq & RADIOLIB_SX128X_IRQ_HEADER_VALID);
|
||||
return hasPreamble;
|
||||
bool hasHeader = (irq & RADIOLIB_SX128X_IRQ_HEADER_VALID);
|
||||
return hasHeader;
|
||||
}
|
||||
|
||||
template <typename T> bool SX128xInterface<T>::sleep()
|
||||
|
||||
@@ -135,7 +135,7 @@ typedef struct _meshtastic_AdminMessage {
|
||||
/* Tell the node to reboot into the OTA Firmware in this many seconds (or <0 to cancel reboot)
|
||||
Only Implemented for ESP32 Devices. This needs to be issued to send a new main firmware via bluetooth. */
|
||||
int32_t reboot_ota_seconds;
|
||||
/* This message is only supported for the simulator porduino build.
|
||||
/* This message is only supported for the simulator Portduino build.
|
||||
If received the simulator will exit successfully. */
|
||||
bool exit_simulator;
|
||||
/* Tell the node to reboot in this many seconds (or <0 to cancel reboot) */
|
||||
|
||||
@@ -152,7 +152,7 @@ typedef enum _meshtastic_Config_LoRaConfig_RegionCode {
|
||||
meshtastic_Config_LoRaConfig_RegionCode_US = 1,
|
||||
/* European Union 433mhz */
|
||||
meshtastic_Config_LoRaConfig_RegionCode_EU_433 = 2,
|
||||
/* European Union 433mhz */
|
||||
/* European Union 868mhz */
|
||||
meshtastic_Config_LoRaConfig_RegionCode_EU_868 = 3,
|
||||
/* China */
|
||||
meshtastic_Config_LoRaConfig_RegionCode_CN = 4,
|
||||
@@ -202,11 +202,11 @@ typedef enum _meshtastic_Config_LoRaConfig_ModemPreset {
|
||||
} meshtastic_Config_LoRaConfig_ModemPreset;
|
||||
|
||||
typedef enum _meshtastic_Config_BluetoothConfig_PairingMode {
|
||||
/* Device generates a random pin that will be shown on the screen of the device for pairing */
|
||||
/* Device generates a random PIN that will be shown on the screen of the device for pairing */
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_RANDOM_PIN = 0,
|
||||
/* Device requires a specified fixed pin for pairing */
|
||||
/* Device requires a specified fixed PIN for pairing */
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_FIXED_PIN = 1,
|
||||
/* Device requires no pin for pairing */
|
||||
/* Device requires no PIN for pairing */
|
||||
meshtastic_Config_BluetoothConfig_PairingMode_NO_PIN = 2
|
||||
} meshtastic_Config_BluetoothConfig_PairingMode;
|
||||
|
||||
@@ -364,7 +364,7 @@ typedef struct _meshtastic_Config_DisplayConfig {
|
||||
|
||||
/* Lora Config */
|
||||
typedef struct _meshtastic_Config_LoRaConfig {
|
||||
/* When enabled, the `modem_preset` fields will be adheared to, else the `bandwidth`/`spread_factor`/`coding_rate`
|
||||
/* When enabled, the `modem_preset` fields will be adhered to, else the `bandwidth`/`spread_factor`/`coding_rate`
|
||||
will be taked from their respective manually defined fields */
|
||||
bool use_preset;
|
||||
/* Either modem_config or bandwidth/spreading/coding will be specified - NOT BOTH.
|
||||
@@ -395,12 +395,12 @@ typedef struct _meshtastic_Config_LoRaConfig {
|
||||
/* Disable TX from the LoRa radio. Useful for hot-swapping antennas and other tests.
|
||||
Defaults to false */
|
||||
bool tx_enabled;
|
||||
/* If zero then, use default max legal continuous power (ie. something that won't
|
||||
/* If zero, then use default max legal continuous power (ie. something that won't
|
||||
burn out the radio hardware)
|
||||
In most cases you should use zero here.
|
||||
Units are in dBm. */
|
||||
int8_t tx_power;
|
||||
/* This is controlling the actual hardware frequency the radio is transmitting on.
|
||||
/* This controls the actual hardware frequency the radio transmits on.
|
||||
Most users should never need to be exposed to this field/concept.
|
||||
A channel number between 1 and NUM_CHANNELS (whatever the max is in the current region).
|
||||
If ZERO then the rule is "use the old channel name hash based
|
||||
@@ -422,7 +422,7 @@ typedef struct _meshtastic_Config_LoRaConfig {
|
||||
float override_frequency;
|
||||
/* For testing it is useful sometimes to force a node to never listen to
|
||||
particular other nodes (simulating radio out of range). All nodenums listed
|
||||
in ignore_incoming will have packets they send droped on receive (by router.cpp) */
|
||||
in ignore_incoming will have packets they send dropped on receive (by router.cpp) */
|
||||
pb_size_t ignore_incoming_count;
|
||||
uint32_t ignore_incoming[3];
|
||||
} meshtastic_Config_LoRaConfig;
|
||||
@@ -432,7 +432,7 @@ typedef struct _meshtastic_Config_BluetoothConfig {
|
||||
bool enabled;
|
||||
/* Determines the pairing strategy for the device */
|
||||
meshtastic_Config_BluetoothConfig_PairingMode mode;
|
||||
/* Specified pin for PairingMode.FixedPin */
|
||||
/* Specified PIN for PairingMode.FixedPin */
|
||||
uint32_t fixed_pin;
|
||||
} meshtastic_Config_BluetoothConfig;
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ typedef struct _meshtastic_WifiConnectionStatus {
|
||||
/* Connection status */
|
||||
bool has_status;
|
||||
meshtastic_NetworkConnectionStatus status;
|
||||
/* WiFi access point ssid */
|
||||
/* WiFi access point SSID */
|
||||
char ssid[33];
|
||||
/* Rssi of wireless connection */
|
||||
/* RSSI of wireless connection */
|
||||
int32_t rssi;
|
||||
} meshtastic_WifiConnectionStatus;
|
||||
|
||||
@@ -42,9 +42,9 @@ typedef struct _meshtastic_EthernetConnectionStatus {
|
||||
|
||||
/* Bluetooth connection status */
|
||||
typedef struct _meshtastic_BluetoothConnectionStatus {
|
||||
/* The pairing pin for bluetooth */
|
||||
/* The pairing PIN for bluetooth */
|
||||
uint32_t pin;
|
||||
/* Rssi of bluetooth connection */
|
||||
/* RSSI of bluetooth connection */
|
||||
int32_t rssi;
|
||||
/* Whether the device has an active connection or not */
|
||||
bool is_connected;
|
||||
@@ -52,7 +52,7 @@ typedef struct _meshtastic_BluetoothConnectionStatus {
|
||||
|
||||
/* Serial connection status */
|
||||
typedef struct _meshtastic_SerialConnectionStatus {
|
||||
/* The serial baud rate */
|
||||
/* Serial baud rate */
|
||||
uint32_t baud;
|
||||
/* Whether the device has an active connection or not */
|
||||
bool is_connected;
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef struct _meshtastic_DeviceState {
|
||||
/* Used only during development.
|
||||
Indicates developer is testing and changes should never be saved to flash. */
|
||||
bool no_save;
|
||||
/* Some GPSes seem to have bogus settings from the factory, so we always do one factory reset. */
|
||||
/* Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. */
|
||||
bool did_gps_reset;
|
||||
} meshtastic_DeviceState;
|
||||
|
||||
@@ -72,13 +72,13 @@ typedef struct _meshtastic_ChannelFile {
|
||||
typedef PB_BYTES_ARRAY_T(2048) meshtastic_OEMStore_oem_icon_bits_t;
|
||||
typedef PB_BYTES_ARRAY_T(32) meshtastic_OEMStore_oem_aes_key_t;
|
||||
/* This can be used for customizing the firmware distribution. If populated,
|
||||
show a secondary bootup screen with cuatom logo and text for 2.5 seconds. */
|
||||
show a secondary bootup screen with custom logo and text for 2.5 seconds. */
|
||||
typedef struct _meshtastic_OEMStore {
|
||||
/* The Logo width in Px */
|
||||
uint32_t oem_icon_width;
|
||||
/* The Logo height in Px */
|
||||
uint32_t oem_icon_height;
|
||||
/* The Logo in xbm bytechar format */
|
||||
/* The Logo in XBM bytechar format */
|
||||
meshtastic_OEMStore_oem_icon_bits_t oem_icon_bits;
|
||||
/* Use this font for the OEM text. */
|
||||
meshtastic_ScreenFonts oem_font;
|
||||
|
||||
@@ -30,12 +30,14 @@ class MQTT : private concurrency::OSThread
|
||||
#if HAS_ETHERNET
|
||||
EthernetClient mqttClient;
|
||||
#endif
|
||||
#if !defined(DEBUG_HEAP_MQTT)
|
||||
PubSubClient pubSub;
|
||||
|
||||
// instead we supress sleep from our runOnce() callback
|
||||
// CallbackObserver<MQTT, void *> preflightSleepObserver = CallbackObserver<MQTT, void *>(this, &MQTT::preflightSleepCb);
|
||||
|
||||
public:
|
||||
#else
|
||||
public:
|
||||
PubSubClient pubSub;
|
||||
#endif
|
||||
MQTT();
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,26 +28,30 @@
|
||||
#define RF95_MISO 3
|
||||
#define RF95_MOSI 6
|
||||
#define RF95_NSS 7
|
||||
|
||||
#define LORA_RESET 8
|
||||
#define LORA_DIO0 9
|
||||
#define LORA_DIO1 9
|
||||
#define LORA_DIO2 33 // SX1262 BUSY
|
||||
#define LORA_DIO3 34 // Not connected on PCB, but internally on the TTGO SX1262, if DIO3 is high the TXCO is enabled
|
||||
|
||||
// per SX1276_Receive_Interrupt/utilities.h
|
||||
#define LORA_DIO0 9
|
||||
#define LORA_DIO1 33 // TCXO_EN ?
|
||||
#define LORA_DIO2 34
|
||||
#define LORA_RXEN 21
|
||||
#define LORA_TXEN 10
|
||||
|
||||
// per SX1262_Receive_Interrupt/utilities.h
|
||||
#ifdef USE_SX1262
|
||||
#define SX126X_CS RF95_NSS // FIXME - we really should define LORA_CS instead
|
||||
#define SX126X_CS RF95_NSS
|
||||
#define SX126X_DIO1 33
|
||||
#define SX126X_BUSY 34
|
||||
#define SX126X_RESET LORA_RESET
|
||||
//#define SX126X_RXEN 21
|
||||
//#define SX126X_TXEN 10
|
||||
#define SX126X_E22
|
||||
#endif
|
||||
|
||||
// per SX128x_Receive_Interrupt/utilities.h
|
||||
#ifdef USE_SX1280
|
||||
#define SX128X_CS RF95_NSS
|
||||
#define SX128X_DIO1 LORA_DIO1
|
||||
#define SX128X_DIO1 9
|
||||
#define SX128X_DIO2 33
|
||||
#define SX128X_DIO3 34
|
||||
#define SX128X_BUSY 36
|
||||
#define SX128X_RESET LORA_RESET
|
||||
#define SX128X_RXEN 21
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[VERSION]
|
||||
major = 2
|
||||
minor = 0
|
||||
build = 23
|
||||
minor = 1
|
||||
build = 0
|
||||
|
||||
Reference in New Issue
Block a user