mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-04 14:15:53 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
7d677d691b
@ -1 +1 @@
|
|||||||
Subproject commit 52cfa2c1c2cd5a1a714e1338d551d967f674fca8
|
Subproject commit 431291e673c1c7592ee64cb972d7845589f60138
|
@ -20,8 +20,9 @@ bool CompareMeshPacketFunc(const meshtastic_MeshPacket *p1, const meshtastic_Mes
|
|||||||
// If priorities differ, use that
|
// If priorities differ, use that
|
||||||
// for equal priorities, order by id (older packets have higher priority - this will briefly be wrong when IDs roll over but
|
// for equal priorities, order by id (older packets have higher priority - this will briefly be wrong when IDs roll over but
|
||||||
// no big deal)
|
// no big deal)
|
||||||
return (p1p != p2p) ? (p1p < p2p) // prefer bigger priorities
|
return (p1p != p2p)
|
||||||
: (p1->id >= p2->id); // prefer smaller packet ids
|
? (p1p < p2p) // prefer bigger priorities
|
||||||
|
: ((p1->id & ID_COUNTER_MASK) >= (p2->id & ID_COUNTER_MASK)); // Mask to counter portion, prefer smaller packet ids
|
||||||
}
|
}
|
||||||
|
|
||||||
MeshPacketQueue::MeshPacketQueue(size_t _maxLen) : maxLen(_maxLen) {}
|
MeshPacketQueue::MeshPacketQueue(size_t _maxLen) : maxLen(_maxLen) {}
|
||||||
@ -127,4 +128,4 @@ bool MeshPacketQueue::replaceLowerPriorityPacket(meshtastic_MeshPacket *p)
|
|||||||
|
|
||||||
std::make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc);
|
std::make_heap(queue.begin(), queue.end(), &CompareMeshPacketFunc);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
@ -14,8 +14,9 @@ typedef uint32_t PacketId; // A packet sequence number
|
|||||||
1 // Reserved to only deliver packets over high speed (non-lora) transports, such as MQTT or BLE mesh (not yet implemented)
|
1 // Reserved to only deliver packets over high speed (non-lora) transports, such as MQTT or BLE mesh (not yet implemented)
|
||||||
#define ERRNO_OK 0
|
#define ERRNO_OK 0
|
||||||
#define ERRNO_NO_INTERFACES 33
|
#define ERRNO_NO_INTERFACES 33
|
||||||
#define ERRNO_UNKNOWN 32 // pick something that doesn't conflict with RH_ROUTER_ERROR_UNABLE_TO_DELIVER
|
#define ERRNO_UNKNOWN 32 // pick something that doesn't conflict with RH_ROUTER_ERROR_UNABLE_TO_DELIVER
|
||||||
#define ERRNO_DISABLED 34 // the interface is disabled
|
#define ERRNO_DISABLED 34 // the interface is disabled
|
||||||
|
#define ID_COUNTER_MASK (UINT32_MAX >> 22) // mask to select the counter portion of the ID
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Source of a received message
|
* Source of a received message
|
||||||
|
@ -292,10 +292,10 @@ void NodeDB::installDefaultConfig()
|
|||||||
config.lora.ignore_mqtt = false;
|
config.lora.ignore_mqtt = false;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ADMIN_KEY_USERPREFS
|
#ifdef ADMIN_KEY_USERPREFS
|
||||||
memcpy(config.security.admin_key.bytes, admin_key_userprefs, 32);
|
memcpy(config.security.admin_key[0].bytes, admin_key_userprefs, 32);
|
||||||
config.security.admin_key.size = 32;
|
config.security.admin_key[0].size = 32;
|
||||||
#else
|
#else
|
||||||
config.security.admin_key.size = 0;
|
config.security.admin_key[0].size = 0;
|
||||||
#endif
|
#endif
|
||||||
config.security.public_key.size = 0;
|
config.security.public_key.size = 0;
|
||||||
config.security.private_key.size = 0;
|
config.security.private_key.size = 0;
|
||||||
|
@ -109,7 +109,7 @@ PacketId generatePacketId()
|
|||||||
|
|
||||||
rollingPacketId++;
|
rollingPacketId++;
|
||||||
|
|
||||||
rollingPacketId &= UINT32_MAX >> 22; // Mask out the top 22 bits
|
rollingPacketId &= ID_COUNTER_MASK; // Mask out the top 22 bits
|
||||||
PacketId id = rollingPacketId | random(UINT32_MAX & 0x7fffffff) << 10; // top 22 bits
|
PacketId id = rollingPacketId | random(UINT32_MAX & 0x7fffffff) << 10; // top 22 bits
|
||||||
LOG_DEBUG("Partially randomized packet id %u\n", id);
|
LOG_DEBUG("Partially randomized packet id %u\n", id);
|
||||||
return id;
|
return id;
|
||||||
|
@ -532,7 +532,8 @@ typedef struct _meshtastic_Config_SecurityConfig {
|
|||||||
Used to create a shared key with a remote device. */
|
Used to create a shared key with a remote device. */
|
||||||
meshtastic_Config_SecurityConfig_private_key_t private_key;
|
meshtastic_Config_SecurityConfig_private_key_t private_key;
|
||||||
/* The public key authorized to send admin messages to this node. */
|
/* The public key authorized to send admin messages to this node. */
|
||||||
meshtastic_Config_SecurityConfig_admin_key_t admin_key;
|
pb_size_t admin_key_count;
|
||||||
|
meshtastic_Config_SecurityConfig_admin_key_t admin_key[1];
|
||||||
/* If true, device is considered to be "managed" by a mesh administrator via admin messages
|
/* If true, device is considered to be "managed" by a mesh administrator via admin messages
|
||||||
Device is managed by a mesh administrator. */
|
Device is managed by a mesh administrator. */
|
||||||
bool is_managed;
|
bool is_managed;
|
||||||
@ -657,7 +658,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
#define meshtastic_Config_DisplayConfig_init_default {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
||||||
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
|
#define meshtastic_Config_LoRaConfig_init_default {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
|
||||||
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
#define meshtastic_Config_BluetoothConfig_init_default {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||||
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0}
|
#define meshtastic_Config_SecurityConfig_init_default {{0, {0}}, {0, {0}}, 0, {{0, {0}}}, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_SessionkeyConfig_init_default {0}
|
#define meshtastic_Config_SessionkeyConfig_init_default {0}
|
||||||
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
#define meshtastic_Config_init_zero {0, {meshtastic_Config_DeviceConfig_init_zero}}
|
||||||
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
#define meshtastic_Config_DeviceConfig_init_zero {_meshtastic_Config_DeviceConfig_Role_MIN, 0, 0, 0, _meshtastic_Config_DeviceConfig_RebroadcastMode_MIN, 0, 0, 0, 0, "", 0}
|
||||||
@ -668,7 +669,7 @@ extern "C" {
|
|||||||
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
#define meshtastic_Config_DisplayConfig_init_zero {0, _meshtastic_Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _meshtastic_Config_DisplayConfig_DisplayUnits_MIN, _meshtastic_Config_DisplayConfig_OledType_MIN, _meshtastic_Config_DisplayConfig_DisplayMode_MIN, 0, 0, _meshtastic_Config_DisplayConfig_CompassOrientation_MIN}
|
||||||
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
|
#define meshtastic_Config_LoRaConfig_init_zero {0, _meshtastic_Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _meshtastic_Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0}, 0}
|
||||||
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
#define meshtastic_Config_BluetoothConfig_init_zero {0, _meshtastic_Config_BluetoothConfig_PairingMode_MIN, 0}
|
||||||
#define meshtastic_Config_SecurityConfig_init_zero {{0, {0}}, {0, {0}}, {0, {0}}, 0, 0, 0, 0}
|
#define meshtastic_Config_SecurityConfig_init_zero {{0, {0}}, {0, {0}}, 0, {{0, {0}}}, 0, 0, 0, 0}
|
||||||
#define meshtastic_Config_SessionkeyConfig_init_zero {0}
|
#define meshtastic_Config_SessionkeyConfig_init_zero {0}
|
||||||
|
|
||||||
/* Field tags (for use in manual encoding/decoding) */
|
/* Field tags (for use in manual encoding/decoding) */
|
||||||
@ -900,7 +901,7 @@ X(a, STATIC, SINGULAR, UINT32, fixed_pin, 3)
|
|||||||
#define meshtastic_Config_SecurityConfig_FIELDLIST(X, a) \
|
#define meshtastic_Config_SecurityConfig_FIELDLIST(X, a) \
|
||||||
X(a, STATIC, SINGULAR, BYTES, public_key, 1) \
|
X(a, STATIC, SINGULAR, BYTES, public_key, 1) \
|
||||||
X(a, STATIC, SINGULAR, BYTES, private_key, 2) \
|
X(a, STATIC, SINGULAR, BYTES, private_key, 2) \
|
||||||
X(a, STATIC, SINGULAR, BYTES, admin_key, 3) \
|
X(a, STATIC, REPEATED, BYTES, admin_key, 3) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, is_managed, 4) \
|
X(a, STATIC, SINGULAR, BOOL, is_managed, 4) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, serial_enabled, 5) \
|
X(a, STATIC, SINGULAR, BOOL, serial_enabled, 5) \
|
||||||
X(a, STATIC, SINGULAR, BOOL, debug_log_api_enabled, 6) \
|
X(a, STATIC, SINGULAR, BOOL, debug_log_api_enabled, 6) \
|
||||||
@ -948,7 +949,7 @@ extern const pb_msgdesc_t meshtastic_Config_SessionkeyConfig_msg;
|
|||||||
#define meshtastic_Config_NetworkConfig_size 196
|
#define meshtastic_Config_NetworkConfig_size 196
|
||||||
#define meshtastic_Config_PositionConfig_size 62
|
#define meshtastic_Config_PositionConfig_size 62
|
||||||
#define meshtastic_Config_PowerConfig_size 52
|
#define meshtastic_Config_PowerConfig_size 52
|
||||||
#define meshtastic_Config_SecurityConfig_size 110
|
#define meshtastic_Config_SecurityConfig_size 111
|
||||||
#define meshtastic_Config_SessionkeyConfig_size 0
|
#define meshtastic_Config_SessionkeyConfig_size 0
|
||||||
#define meshtastic_Config_size 199
|
#define meshtastic_Config_size 199
|
||||||
|
|
||||||
|
@ -358,7 +358,7 @@ extern const pb_msgdesc_t meshtastic_OEMStore_msg;
|
|||||||
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size
|
#define MESHTASTIC_MESHTASTIC_DEVICEONLY_PB_H_MAX_SIZE meshtastic_OEMStore_size
|
||||||
#define meshtastic_ChannelFile_size 718
|
#define meshtastic_ChannelFile_size 718
|
||||||
#define meshtastic_NodeInfoLite_size 183
|
#define meshtastic_NodeInfoLite_size 183
|
||||||
#define meshtastic_OEMStore_size 3496
|
#define meshtastic_OEMStore_size 3497
|
||||||
#define meshtastic_PositionLite_size 28
|
#define meshtastic_PositionLite_size 28
|
||||||
#define meshtastic_UserLite_size 96
|
#define meshtastic_UserLite_size 96
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ extern const pb_msgdesc_t meshtastic_LocalModuleConfig_msg;
|
|||||||
|
|
||||||
/* Maximum encoded size of messages (where known) */
|
/* Maximum encoded size of messages (where known) */
|
||||||
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size
|
#define MESHTASTIC_MESHTASTIC_LOCALONLY_PB_H_MAX_SIZE meshtastic_LocalModuleConfig_size
|
||||||
#define meshtastic_LocalConfig_size 663
|
#define meshtastic_LocalConfig_size 664
|
||||||
#define meshtastic_LocalModuleConfig_size 687
|
#define meshtastic_LocalModuleConfig_size 687
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -75,7 +75,7 @@ bool AdminModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshta
|
|||||||
// and only allowing responses from that remote.
|
// and only allowing responses from that remote.
|
||||||
if (!((mp.from == 0 && !config.security.is_managed) || messageIsResponse(r) ||
|
if (!((mp.from == 0 && !config.security.is_managed) || messageIsResponse(r) ||
|
||||||
(strcasecmp(ch->settings.name, Channels::adminChannel) == 0 && config.security.admin_channel_enabled) ||
|
(strcasecmp(ch->settings.name, Channels::adminChannel) == 0 && config.security.admin_channel_enabled) ||
|
||||||
(mp.pki_encrypted && memcmp(mp.public_key.bytes, config.security.admin_key.bytes, 32) == 0))) {
|
(mp.pki_encrypted && memcmp(mp.public_key.bytes, config.security.admin_key[0].bytes, 32) == 0))) {
|
||||||
LOG_INFO("Ignoring admin payload %i\n", r->which_payload_variant);
|
LOG_INFO("Ignoring admin payload %i\n", r->which_payload_variant);
|
||||||
return handled;
|
return handled;
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,6 @@
|
|||||||
#define HW_VENDOR meshtastic_HardwareModel_SENSELORA_RP2040
|
#define HW_VENDOR meshtastic_HardwareModel_SENSELORA_RP2040
|
||||||
#elif defined(RP2040_LORA)
|
#elif defined(RP2040_LORA)
|
||||||
#define HW_VENDOR meshtastic_HardwareModel_RP2040_LORA
|
#define HW_VENDOR meshtastic_HardwareModel_RP2040_LORA
|
||||||
|
#elif defined(RP2040_FEATHER_RFM95)
|
||||||
|
#define HW_VENDOR meshtastic_HardwareModel_RP2040_FEATHER_RFM95
|
||||||
#endif
|
#endif
|
16
variants/feather_rp2040_rfm95/platformio.ini
Normal file
16
variants/feather_rp2040_rfm95/platformio.ini
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
[env:feather_rp2040_rfm95]
|
||||||
|
extends = rp2040_base
|
||||||
|
board = adafruit_feather
|
||||||
|
upload_protocol = picotool
|
||||||
|
|
||||||
|
# add our variants files to the include and src paths
|
||||||
|
build_flags = ${rp2040_base.build_flags}
|
||||||
|
-DRP2040_FEATHER_RFM95
|
||||||
|
-Ivariants/feather_rp2040_rfm95
|
||||||
|
-DDEBUG_RP2040_PORT=Serial
|
||||||
|
-DHW_SPI1_DEVICE
|
||||||
|
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m0plus"
|
||||||
|
lib_deps =
|
||||||
|
${rp2040_base.lib_deps}
|
||||||
|
debug_build_flags = ${rp2040_base.build_flags}
|
||||||
|
debug_tool = cmsis-dap ; for e.g. Picotool
|
61
variants/feather_rp2040_rfm95/variant.h
Normal file
61
variants/feather_rp2040_rfm95/variant.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// #define RADIOLIB_CUSTOM_ARDUINO 1
|
||||||
|
// #define RADIOLIB_TONE_UNSUPPORTED 1
|
||||||
|
// #define RADIOLIB_SOFTWARE_SERIAL_UNSUPPORTED 1
|
||||||
|
|
||||||
|
#define ARDUINO_ARCH_AVR
|
||||||
|
|
||||||
|
// #define USE_SSD1306
|
||||||
|
|
||||||
|
// #define USE_SH1106 1
|
||||||
|
|
||||||
|
// default I2C pins:
|
||||||
|
// SDA = 4
|
||||||
|
// SCL = 5
|
||||||
|
|
||||||
|
// Recommended pins for SerialModule:
|
||||||
|
// txd = 8
|
||||||
|
// rxd = 9
|
||||||
|
|
||||||
|
#define EXT_NOTIFY_OUT 22
|
||||||
|
#define BUTTON_PIN 7
|
||||||
|
// #define BUTTON_NEED_PULLUP
|
||||||
|
|
||||||
|
#define LED_PIN PIN_LED
|
||||||
|
|
||||||
|
// #define BATTERY_PIN 26
|
||||||
|
// ratio of voltage divider = 3.0 (R17=200k, R18=100k)
|
||||||
|
// #define ADC_MULTIPLIER 3.1 // 3.0 + a bit for being optimistic
|
||||||
|
|
||||||
|
#define USE_RF95 // RFM95/SX127x
|
||||||
|
|
||||||
|
#undef LORA_SCK
|
||||||
|
#undef LORA_MISO
|
||||||
|
#undef LORA_MOSI
|
||||||
|
#undef LORA_CS
|
||||||
|
|
||||||
|
// https://www.adafruit.com/product/5714
|
||||||
|
// https://learn.adafruit.com/feather-rp2040-rfm95
|
||||||
|
// https://learn.adafruit.com/assets/120283
|
||||||
|
// https://learn.adafruit.com/assets/120813
|
||||||
|
#define LORA_SCK 14 // 10 12P
|
||||||
|
#define LORA_MISO 8 // 12 10P
|
||||||
|
#define LORA_MOSI 15 // 11 11P
|
||||||
|
#define LORA_CS 16 // 3 13P
|
||||||
|
|
||||||
|
#define LORA_RESET 17 // 15 14P
|
||||||
|
|
||||||
|
#define LORA_DIO0 21 // ?? 6P
|
||||||
|
#define LORA_DIO1 22 // 20 7P
|
||||||
|
#define LORA_DIO2 23 // 2 8P
|
||||||
|
#define LORA_DIO3 19 // ?? 3P
|
||||||
|
#define LORA_DIO4 20 // ?? 4P
|
||||||
|
#define LORA_DIO5 18 // ?? 15P
|
||||||
|
|
||||||
|
#ifdef USE_SX1262
|
||||||
|
#define SX126X_CS LORA_CS
|
||||||
|
#define SX126X_DIO1 LORA_DIO1
|
||||||
|
#define SX126X_BUSY LORA_DIO2
|
||||||
|
#define SX126X_RESET LORA_RESET
|
||||||
|
#define SX126X_DIO2_AS_RF_SWITCH
|
||||||
|
// #define SX126X_DIO3_TCXO_VOLTAGE 1.8
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user