From abaab31bba4188d83bba860d389ce2b98722af92 Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Fri, 28 Feb 2025 16:02:37 +0800 Subject: [PATCH] merge upstream changes --- meshtastic/admin.proto | 36 +++++ meshtastic/config.proto | 37 +++++- meshtastic/device_only/deviceonly.options | 3 +- meshtastic/device_only/deviceonly.proto | 74 +++++++++-- meshtastic/device_ui.options | 4 + meshtastic/device_ui.proto | 59 ++++++++ meshtastic/mesh.options | 9 +- meshtastic/mesh.proto | 155 +++++++++++++++++++++- meshtastic/module_config.options | 2 +- meshtastic/module_config.proto | 10 +- meshtastic/portnums.proto | 5 + meshtastic/storeforward.options | 2 +- meshtastic/telemetry.proto | 32 +++++ 13 files changed, 405 insertions(+), 23 deletions(-) diff --git a/meshtastic/admin.proto b/meshtastic/admin.proto index a536e6f..3bfba3e 100644 --- a/meshtastic/admin.proto +++ b/meshtastic/admin.proto @@ -154,6 +154,18 @@ message AdminMessage { PAXCOUNTER_CONFIG = 12; } + enum BackupLocation { + /* + * Backup to the internal flash + */ + FLASH = 0; + + /* + * Backup to the SD card + */ + SD = 1; + } + /* * TODO: REPLACE */ @@ -270,6 +282,20 @@ message AdminMessage { */ uint32 set_scale = 23; + /* + * Backup the node's preferences + */ + BackupLocation backup_preferences = 24; + + /* + * Restore the node's preferences + */ + BackupLocation restore_preferences = 25; + + /* + * Remove backups of the node's preferences + */ + BackupLocation remove_backup_preferences = 26; /* * Set the owner for this node */ @@ -350,6 +376,16 @@ message AdminMessage { */ DeviceUIConfig store_ui_config = 46; + /* + * Set specified node-num to be ignored on the NodeDB on the device + */ + uint32 set_ignored_node = 47; + + /* + * Set specified node-num to be un-ignored on the NodeDB on the device + */ + uint32 remove_ignored_node = 48; + /* * Begins an edit transaction for config, module config, owner, and channel settings changes * This will delay the standard *implicit* save to the file system and subsequent reboot behavior until committed (commit_edit_settings) diff --git a/meshtastic/config.proto b/meshtastic/config.proto index 528f7d4..5ac2b42 100644 --- a/meshtastic/config.proto +++ b/meshtastic/config.proto @@ -99,6 +99,15 @@ message Config { * Uses position module configuration to determine TAK PLI broadcast interval. */ TAK_TRACKER = 10; + + /* + * Description: Will always rebroadcast packets, but will do so after all other modes. + * Technical Details: Used for router nodes that are intended to provide additional coverage + * in areas not already covered by other routers, or to bridge around problematic terrain, + * but should not be given priority over other routers in order to avoid unnecessaraily + * consuming hops. + */ + ROUTER_LATE = 11; } /* @@ -506,6 +515,26 @@ message Config { * rsyslog Server and Port */ string rsyslog_server = 9; + + /* + * Flags for enabling/disabling network protocols + */ + uint32 enabled_protocols = 10; + + /* + * Available flags auxiliary network protocols + */ + enum ProtocolFlags { + /* + * Do not broadcast packets over any network protocol + */ + NO_BROADCAST = 0x0000; + + /* + * Enable broadcasting packets via UDP over the local network + */ + UDP_BROADCAST = 0x0001; + } } /* @@ -714,6 +743,12 @@ message Config { * Indicates how to rotate or invert the compass output to accurate display on the display. */ CompassOrientation compass_orientation = 11; + + /* + * If false (default), the device will display the time in 24-hour format on screen. + * If true, the device will display the time in 12-hour format on screen. + */ + bool use_12h_clock = 12; } /* @@ -1104,4 +1139,4 @@ message Config { SessionkeyConfig sessionkey = 9; DeviceUIConfig device_ui = 10; } -} +} \ No newline at end of file diff --git a/meshtastic/device_only/deviceonly.options b/meshtastic/device_only/deviceonly.options index 82dffcf..d6aae0c 100644 --- a/meshtastic/device_only/deviceonly.options +++ b/meshtastic/device_only/deviceonly.options @@ -10,8 +10,9 @@ *NodeInfoLite.channel int_size:8 *NodeInfoLite.hops_away int_size:8 +*NodeInfoLite.next_hop int_size:8 *UserLite.long_name max_size:40 *UserLite.short_name max_size:5 *UserLite.public_key max_size:32 # public key -*UserLite.macaddr max_size:6 fixed_length:true +*UserLite.macaddr max_size:6 fixed_length:true \ No newline at end of file diff --git a/meshtastic/device_only/deviceonly.proto b/meshtastic/device_only/deviceonly.proto index 3aab61f..481bfba 100644 --- a/meshtastic/device_only/deviceonly.proto +++ b/meshtastic/device_only/deviceonly.proto @@ -2,11 +2,11 @@ syntax = "proto3"; package meshtastic; -import "channel.proto"; -import "localonly.proto"; -import "mesh.proto"; -import "telemetry.proto"; -import "config.proto"; +import "meshtastic/channel.proto"; +import "meshtastic/mesh.proto"; +import "meshtastic/telemetry.proto"; +import "meshtastic/config.proto"; +import "meshtastic/localonly.proto"; import "nanopb.proto"; option csharp_namespace = "Meshtastic.Protobufs"; @@ -139,7 +139,7 @@ message NodeInfoLite { bool via_mqtt = 8; /* - * Number of hops away from us this node is (0 if adjacent) + * Number of hops away from us this node is (0 if direct neighbor) */ optional uint32 hops_away = 9; @@ -148,6 +148,17 @@ message NodeInfoLite { * Persists between NodeDB internal clean ups */ bool is_favorite = 10; + + /* + * True if node is in our ignored list + * Persists between NodeDB internal clean ups + */ + bool is_ignored = 11; + + /* + * Last byte of the node number of the node that should be used as the next hop to reach this node. + */ + uint32 next_hop = 12; } /* @@ -195,9 +206,10 @@ message DeviceState { bool no_save = 9 [deprecated = true]; /* - * Some GPS receivers seem to have bogus settings from the factory, so we always do one factory reset. + * Previously used to manage GPS factory resets. + * Deprecated in 2.5.23 */ - bool did_gps_reset = 11; + bool did_gps_reset = 11 [deprecated = true]; /* * We keep the last received waypoint stored in the device flash, @@ -210,11 +222,20 @@ message DeviceState { * The mesh's nodes with their available gpio pins for RemoteHardware module */ repeated NodeRemoteHardwarePin node_remote_hardware_pins = 13; +} + +message NodeDatabase { + /* + * A version integer used to invalidate old save files when we make + * incompatible changes This integer is set at build time and is private to + * NodeDB.cpp in the device code. + */ + uint32 version = 1; /* * New lite version of NodeDB to decrease memory footprint */ - repeated NodeInfoLite node_db_lite = 14 [(nanopb).callback_datatype = "std::vector"]; + repeated NodeInfoLite nodes = 2 [(nanopb).callback_datatype = "std::vector"]; } /* @@ -233,3 +254,38 @@ message ChannelFile { */ uint32 version = 2; } + +/* + * The on-disk backup of the node's preferences + */ + message BackupPreferences { + /* + * The version of the backup + */ + uint32 version = 1; + + /* + * The timestamp of the backup (if node has time) + */ + fixed32 timestamp = 2; + + /* + * The node's configuration + */ + LocalConfig config = 3; + + /* + * The node's module configuration + */ + LocalModuleConfig module_config = 4; + + /* + * The node's channels + */ + ChannelFile channels = 5; + + /* + * The node's user (owner) information + */ + User owner = 6; +} \ No newline at end of file diff --git a/meshtastic/device_ui.options b/meshtastic/device_ui.options index 65be467..5aa61d0 100644 --- a/meshtastic/device_ui.options +++ b/meshtastic/device_ui.options @@ -1,6 +1,10 @@ *DeviceUIConfig.screen_brightness int_size:8 *DeviceUIConfig.screen_timeout int_size:16 *DeviceUIConfig.ring_tone_id int_size:8 +*DeviceUIConfig.calibration_data max_size:16 *NodeFilter.node_name max_size:16 *NodeFilter.hops_away int_size:8 +*NodeFilter.channel int_size:8 *NodeHighlight.node_name max_size:16 +*GeoPoint.zoom int_size:8 +*Map.style max_size:20 diff --git a/meshtastic/device_ui.proto b/meshtastic/device_ui.proto index 38481d2..9ac40a3 100644 --- a/meshtastic/device_ui.proto +++ b/meshtastic/device_ui.proto @@ -61,6 +61,16 @@ message DeviceUIConfig { * Node list highlightening */ NodeHighlight node_highlight = 13; + + /* + * 8 integers for screen calibration data + */ + bytes calibration_data = 14; + + /* + * Map related data + */ + Map map_data = 15; } @@ -95,6 +105,11 @@ message NodeFilter { */ string node_name = 6; + /* + * Filter based on channel + */ + int32 channel = 7; + } message NodeHighlight { @@ -125,6 +140,40 @@ message NodeHighlight { } +message GeoPoint { + /* + * Zoom level + */ + int32 zoom = 1; + + /* + * Coordinate: latitude + */ + int32 latitude = 2; + + /* + * Coordinate: longitude + */ + int32 longitude = 3; +} + +message Map { + /* + * Home coordinates + */ + GeoPoint home = 1; + + /* + * Map tile style + */ + string style = 2; + + /* + * Map scroll follows GPS + */ + bool follow_gps = 3; +} + enum Theme { /* * Dark @@ -215,6 +264,16 @@ enum Language { GREEK = 13; /* + * Norwegian + */ + NORWEGIAN = 14; + + /* + * Slovenian + */ + SLOVENIAN = 15; + + /* * Simplified Chinese (experimental) */ SIMPLIFIED_CHINESE = 30; diff --git a/meshtastic/mesh.options b/meshtastic/mesh.options index 4e335d2..e2c905d 100644 --- a/meshtastic/mesh.options +++ b/meshtastic/mesh.options @@ -17,7 +17,7 @@ # note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is # outside of this envelope -*Data.payload max_size:237 +*Data.payload max_size:233 *Data.bitfield int_size:8 *NodeInfo.channel int_size:8 @@ -26,6 +26,7 @@ # Big enough for 1.2.28.568032c-d *MyNodeInfo.firmware_version max_size:18 *MyNodeInfo.device_id max_size:16 +*MyNodeInfo.pio_env max_size:40 *MyNodeInfo.air_period_tx max_count:8 *MyNodeInfo.air_period_rx max_count:8 @@ -37,6 +38,8 @@ *MeshPacket.hop_limit int_size:8 *MeshPacket.hop_start int_size:8 *MeshPacket.channel int_size:8 +*MeshPacket.next_hop int_size:8 +*MeshPacket.relay_node int_size:8 *QueueStatus.res int_size:8 *QueueStatus.free int_size:8 @@ -59,7 +62,7 @@ # or fixed_length or fixed_count, or max_count #This value may want to be a few bytes smaller to compensate for the parent fields. -*Compressed.data max_size:237 +*Compressed.data max_size:233 *Waypoint.name max_size:30 *Waypoint.description max_size:100 @@ -74,4 +77,4 @@ *ChunkedPayload.chunk_count int_size:16 *ChunkedPayload.chunk_index int_size:16 -*ChunkedPayload.payload_chunk max_size:228 +*ChunkedPayload.payload_chunk max_size:228 \ No newline at end of file diff --git a/meshtastic/mesh.proto b/meshtastic/mesh.proto index b7b9e90..c377db8 100644 --- a/meshtastic/mesh.proto +++ b/meshtastic/mesh.proto @@ -17,7 +17,7 @@ option java_package = "com.geeksville.mesh"; option swift_prefix = ""; /* - * a gps position + * A GPS Position */ message Position { /* @@ -650,6 +650,33 @@ enum HardwareModel { */ TLORA_C6 = 83; + /* + * WisMesh Tap + * RAK-4631 w/ TFT in injection modled case + */ + WISMESH_TAP = 84; + + /* + * Similar to PORTDUINO but used by Routastic devices, this is not any + * particular device and does not run Meshtastic's code but supports + * the same frame format. + * Runs on linux, see https://github.com/Jorropo/routastic + */ + ROUTASTIC = 85; + + /* + * Mesh-Tab, esp32 based + * https://github.com/valzzu/Mesh-Tab + */ + MESH_TAB = 86; + + /* + * MeshLink board developed by LoraItalia. NRF52840, eByte E22900M22S (Will also come with other frequencies), 25w MPPT solar charger (5v,12v,18v selectable), support for gps, buzzer, oled or e-ink display, 10 gpios, hardware watchdog + * https://www.loraitalia.it + */ + MESHLINK = 87; + + /* * ------------------------------------------------------------------------------------------------------------------------------------------ * Reserved ID For developing private Ports. These will show up in live traffic sparsely, so we can use a high number. Keep it within 8 bits. @@ -1073,6 +1100,11 @@ message MeshPacket { */ HIGH = 100; + /* + * Higher priority alert message used for critical alerts which take priority over other reliable packets. + */ + ALERT = 110; + /* * Ack/naks are sent with very high priority to ensure that retransmission * stops as soon as possible @@ -1177,7 +1209,7 @@ message MeshPacket { float rx_snr = 8; /* - * If unset treated as zero (no forwarding, send to adjacent nodes only) + * If unset treated as zero (no forwarding, send to direct neighbor nodes only) * if 1, allow hopping through one node, etc... * For our usecase real world topologies probably have a max of about 3. * This field is normally placed into a few of bits in the header. @@ -1233,6 +1265,25 @@ message MeshPacket { * Indicates whether the packet was en/decrypted using PKI */ bool pki_encrypted = 17; + + /* + * Last byte of the node number of the node that should be used as the next hop in routing. + * Set by the firmware internally, clients are not supposed to set this. + */ + uint32 next_hop = 18; + + /* + * Last byte of the node number of the node that will relay/relayed this packet. + * Set by the firmware internally, clients are not supposed to set this. + */ + uint32 relay_node = 19; + + /* + * *Never* sent over the radio links. + * Timestamp after which this packet may be sent. + * Set by the firmware internally, clients are not supposed to set this. + */ + uint32 tx_after = 20; } /* @@ -1250,7 +1301,7 @@ enum Constants { * note: this payload length is ONLY the bytes that are sent inside of the Data protobuf (excluding protobuf overhead). The 16 byte header is * outside of this envelope */ - DATA_PAYLOAD_LEN = 237; + DATA_PAYLOAD_LEN = 233; } /* @@ -1317,7 +1368,7 @@ message NodeInfo { /* * TODO: REMOVE/INTEGRATE * Not currently used (till full DSR deployment?) Our current preferred node node for routing - might be the same as num if - * we are adjacent Or zero if we don't yet know a route to this node. + * we are direct neighbor or zero if we don't yet know a route to this node. * fixed32 next_hop = 5; */ @@ -1341,7 +1392,7 @@ message NodeInfo { bool via_mqtt = 8; /* - * Number of hops away from us this node is (0 if adjacent) + * Number of hops away from us this node is (0 if direct neighbor) */ optional uint32 hops_away = 9; @@ -1350,6 +1401,12 @@ message NodeInfo { * Persists between NodeDB internal clean ups */ bool is_favorite = 10; + + /* + * True if node is in our ignored list + * Persists between NodeDB internal clean ups + */ + bool is_ignored = 11; } /* @@ -1462,6 +1519,11 @@ message MyNodeInfo { * Unique hardware identifier for this device */ bytes device_id = 12; + + /* + * The PlatformIO environment used to build this firmware + */ + string pio_env = 13; } /* @@ -1870,6 +1932,89 @@ message DeviceMetadata { * Has PKC capabilities */ bool hasPKC = 11; + + /* + * Bit field of boolean for excluded modules + * (bitwise OR of ExcludedModules) + */ + uint32 excluded_modules = 12; +} + +/* + * Enum for modules excluded from a device's configuration. + * Each value represents a ModuleConfigType that can be toggled as excluded + * by setting its corresponding bit in the `excluded_modules` bitmask field. + */ +enum ExcludedModules { + /* + * Default value of 0 indicates no modules are excluded. + */ + EXCLUDED_NONE = 0x0000; + + /* + * MQTT module + */ + MQTT_CONFIG = 0x0001; + + /* + * Serial module + */ + SERIAL_CONFIG = 0x0002; + + /* + * External Notification module + */ + EXTNOTIF_CONFIG = 0x0004; + + /* + * Store and Forward module + */ + STOREFORWARD_CONFIG = 0x0008; + + /* + * Range Test module + */ + RANGETEST_CONFIG = 0x0010; + + /* + * Telemetry module + */ + TELEMETRY_CONFIG = 0x0020; + + /* + * Canned Message module + */ + CANNEDMSG_CONFIG = 0x0040; + + /* + * Audio module + */ + AUDIO_CONFIG = 0x0080; + + /* + * Remote Hardware module + */ + REMOTEHARDWARE_CONFIG = 0x0100; + + /* + * Neighbor Info module + */ + NEIGHBORINFO_CONFIG = 0x0200; + + /* + * Ambient Lighting module + */ + AMBIENTLIGHTING_CONFIG = 0x0400; + + /* + * Detection Sensor module + */ + DETECTIONSENSOR_CONFIG = 0x0800; + + /* + * Paxcounter module + */ + PAXCOUNTER_CONFIG = 0x1000; } /* diff --git a/meshtastic/module_config.options b/meshtastic/module_config.options index fdde1b3..bf2a5f4 100644 --- a/meshtastic/module_config.options +++ b/meshtastic/module_config.options @@ -2,7 +2,7 @@ *MQTTConfig.address max_size:64 *MQTTConfig.username max_size:64 -*MQTTConfig.password max_size:64 +*MQTTConfig.password max_size:32 *MQTTConfig.root max_size:32 *AudioConfig.ptt_pin int_size:8 diff --git a/meshtastic/module_config.proto b/meshtastic/module_config.proto index 933d142..aa30abc 100644 --- a/meshtastic/module_config.proto +++ b/meshtastic/module_config.proto @@ -128,9 +128,15 @@ message ModuleConfig { /* * Interval in seconds of how often we should try to send our - * Neighbor Info to the mesh + * Neighbor Info (minimum is 14400, i.e., 4 hours) */ uint32 update_interval = 2; + + /* + * Whether in addition to sending it to MQTT and the PhoneAPI, our NeighborInfo should be transmitted over LoRa. + * Note that this is not available on a channel with default key and name. + */ + bool transmit_over_lora = 3; } /* @@ -597,7 +603,7 @@ message ModuleConfig { } /* - * TODO: REPLACE + * Canned Messages Module Config */ message CannedMessageConfig { /* diff --git a/meshtastic/portnums.proto b/meshtastic/portnums.proto index 1f8cdb9..a4b55e5 100644 --- a/meshtastic/portnums.proto +++ b/meshtastic/portnums.proto @@ -105,6 +105,11 @@ enum PortNum { */ DETECTION_SENSOR_APP = 10; + /* + * Same as Text Message but used for critical alerts. + */ + ALERT_APP = 11; + /* * Provides a 'ping' service that replies to any packet it receives. * Also serves as a small example module. diff --git a/meshtastic/storeforward.options b/meshtastic/storeforward.options index 8580aab..57a122c 100644 --- a/meshtastic/storeforward.options +++ b/meshtastic/storeforward.options @@ -1 +1 @@ -*StoreAndForward.text max_size:237 \ No newline at end of file +*StoreAndForward.text max_size:233 \ No newline at end of file diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 5dd810b..4b5b3f2 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -128,6 +128,22 @@ message EnvironmentMetrics { * Wind lull in m/s */ optional float wind_lull = 17; + + /* + * Radiation in µR/h + */ + optional float radiation = 18; + + /* + * Rainfall in the last hour in mm + */ + optional float rainfall_1h = 19; + + /* + * Rainfall in the last 24 hours in mm + */ + optional float rainfall_24h = 20; + } /* @@ -525,6 +541,22 @@ enum TelemetrySensorType { * SCD40/SCD41 CO2, humidity, temperature sensor */ SCD4X = 32; + + /* + * ClimateGuard RadSens, radiation, Geiger-Muller Tube + */ + RADSENS = 33; + + /* + * High accuracy current and voltage + */ + INA226 = 34; + + /* + * DFRobot Gravity tipping bucket rain gauge + */ + DFROBOT_RAIN = 35; + } /*