mirror of
https://github.com/meshtastic/firmware.git
synced 2026-10-31 12:31:02 -04:00
* feat(beacon): per-target and offered frequency slots Implements the slot fields from meshtastic/protobufs#1059 on top of the broadcast_targets scheme from #11646: - BroadcastTarget.frequency_slot pins a target's slot. Unset derives it the way a node on that channel would: the target region's override slot, else the hash of the target channel's name on the target preset. A target on the home radio keeps the home slot. A pin the target region does not hold skips the target. The deprecated ChannelSettings.channel_num is no longer read, and the home node's channel_num no longer leaks into other presets. - broadcast_offer_frequency_slot is advertised as MeshBeacon.offer_frequency_slot only when a receiver could not derive it. An offer pinned to a slot its region lacks is withheld; the text still goes out. - The listener keeps a received offer's slot. - Admin clears slot 0, and a slot past an explicit region and preset. - userPrefs: USERPREFS_MESH_BEACON_OFFER_FREQUENCY_SLOT and USERPREFS_MESH_BEACON_TARGET_<N>_FREQUENCY_SLOT. Also from #11662: - A beacon is addressed at its target's channel index, so perhapsEncode() keys it like any other packet; the primary channel is never overwritten. The TX hook writes the target preset's channel hash for a blank-named channel on another preset. - A beacon whose send() did not queue releases its target entry on every failure, not only ERRNO_SHOULD_RELEASE. - A beacon still queued a broadcast interval after it was armed, or whose entry was evicted from a full table, is dropped at TX instead of going out on the home radio. Supersedes #11662. Co-authored-by: Tom <116762865+NomDeTom@users.noreply.github.com> * fix(beacon): address review of frequency slots - TX gate checks the target preset against its region or EU sibling, not the home slot - Targets and offers run an EU sibling's preset in that sibling, as the switch does - Switch clears override_frequency and restores tx_power; restore keeps fields edited mid-switch - An unusable channel_index skips the target instead of falling back to the primary - Beacon config validation moved to MeshBeaconModule::sanitizeConfig(), also run on load; message cap no longer ends mid-character - Evicted-id ring sized to the TX queue * fix(radio): frequencySlotCount() reports no slots for UNSET UNSET's table span is a placeholder; an unknown region code resolves to it too. * fix(beacon): slot count and restore for custom bandwidth - frequencySlotCount() counts a custom bandwidth wider than the region at the region default, as the clamp runs it - resolveFrequencySlot() falls back to the hash when the region override slot exceeds the count - The beacon switch restores a custom bandwidth applyModemConfig() clamped for the target region * fix(beacon): run a target's named preset on a node with custom modem params The switch sets use_preset for a target that names a preset and restores it after TX. A target naming no preset keeps the custom params. * fix(beacon): keep an out-of-range target channel_index sanitizeConfig() cleared has_channel_index for an index past the channel table. That turns the entry into an unset-index target, and sendBeacon() sends those on the primary channel - under a name and key the operator never named. sanitizeConfig() now also runs from loadFromDisk(), so a stored or userPrefs index did that at every boot, not only on the write that set it. Keep the index and only warn. sendBeacon() already bounds-checks it against channels.getNumChannels(), which is tighter than MAX_NUM_CHANNELS, before getByIndex(), and skips the target - so nothing can index out of bounds, which is what the clear was there for. test_adminValidation_targetChannelIndexOutOfRange_isCleared becomes _isKeptAndSkipped: the index survives the write, and the stored config emits no beacon rather than one on the primary. Reported by NomDeTom on #12126. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SwNPp17REf1c9je42aWyJa --------- Co-authored-by: Tom <116762865+NomDeTom@users.noreply.github.com> Co-authored-by: Jonathan Bennett <jbennett@incomsystems.biz> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
126 lines
11 KiB
JSON
126 lines
11 KiB
JSON
{
|
|
// A value here is a FACTORY DEFAULT. It is applied on first boot and on factory reset, and never
|
|
// again - once the device has a saved config, that config wins. There is no per-field lock. To
|
|
// stop a user changing a setting, ship USERPREFS_USE_ADMIN_KEY_0 and set
|
|
// USERPREFS_CONFIG_SECURITY_IS_MANAGED.
|
|
//
|
|
// Numbers must be plain decimal or 0x-prefixed hex; a shift expression such as "(1 << 15)" is
|
|
// passed to the compiler as a string, not evaluated.
|
|
//
|
|
// Channels: indices 0 to 7 are all supported. Setting any USERPREFS_CHANNEL_<n>_* key configures
|
|
// index <n>; the fields you leave out keep the values the firmware would have used anyway (default
|
|
// PSK, empty name, precision 0, not muted, no uplink or downlink). USERPREFS_CHANNELS_TO_WRITE is
|
|
// how many indices are written on first boot and cannot exceed 8.
|
|
// "USERPREFS_BUTTON_PIN": "36",
|
|
// "USERPREFS_CHANNELS_TO_WRITE": "3",
|
|
// "USERPREFS_CHANNEL_0_DOWNLINK_ENABLED": "false",
|
|
// "USERPREFS_CHANNEL_0_IS_MUTED": "false",
|
|
// "USERPREFS_CHANNEL_0_NAME": "REPLACEME",
|
|
// "USERPREFS_CHANNEL_0_PRECISION": "14",
|
|
// "USERPREFS_CHANNEL_0_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa1 }",
|
|
// "USERPREFS_CHANNEL_0_UPLINK_ENABLED": "true",
|
|
// "USERPREFS_CHANNEL_1_DOWNLINK_ENABLED": "false",
|
|
// "USERPREFS_CHANNEL_1_IS_MUTED": "false",
|
|
// "USERPREFS_CHANNEL_1_NAME": "NodeChat",
|
|
// "USERPREFS_CHANNEL_1_PRECISION": "14",
|
|
// "USERPREFS_CHANNEL_1_PSK": "{ 0x4e, 0x22, 0x1d, 0x8b, 0xc3, 0x09, 0x1b, 0xe2, 0x11, 0x9c, 0x89, 0x12, 0xf2, 0x25, 0x19, 0x5d, 0x15, 0x3e, 0x30, 0x7b, 0x86, 0xb6, 0xec, 0xc4, 0x6a, 0xc3, 0x96, 0x5e, 0x9e, 0x10, 0x9d, 0xd5 }",
|
|
// "USERPREFS_CHANNEL_1_UPLINK_ENABLED": "false",
|
|
// "USERPREFS_CHANNEL_2_DOWNLINK_ENABLED": "false",
|
|
// "USERPREFS_CHANNEL_2_IS_MUTED": "false",
|
|
// "USERPREFS_CHANNEL_2_NAME": "YardSale",
|
|
// "USERPREFS_CHANNEL_2_PRECISION": "14",
|
|
// "USERPREFS_CHANNEL_2_PSK": "{ 0x15, 0x6f, 0xfe, 0x46, 0xd4, 0x56, 0x63, 0x8a, 0x54, 0x43, 0x13, 0xf2, 0xef, 0x6c, 0x63, 0x89, 0xf0, 0x06, 0x30, 0x52, 0xce, 0x36, 0x5e, 0xb1, 0xe8, 0xbb, 0x86, 0xe6, 0x26, 0x5b, 0x1d, 0x58 }",
|
|
// "USERPREFS_CHANNEL_2_UPLINK_ENABLED": "false",
|
|
// "USERPREFS_CHANNEL_3_NAME": "Ops",
|
|
// "USERPREFS_CHANNEL_3_PSK": "{ 0x01 }",
|
|
// "USERPREFS_CONFIG_GPS_MODE": "meshtastic_Config_PositionConfig_GpsMode_ENABLED",
|
|
// "USERPREFS_CONFIG_LORA_IGNORE_MQTT": "true",
|
|
// "USERPREFS_CONFIG_LORA_CONFIG_OK_TO_MQTT": "false",
|
|
// "USERPREFS_LORA_TX_DISABLED": "1", // If set, forces config.lora.tx_enabled=false during lora bootstrap
|
|
// "USERPREFS_CONFIG_LORA_REGION": "meshtastic_Config_LoRaConfig_RegionCode_US",
|
|
// "USERPREFS_CONFIG_OWNER_LONG_NAME": "My Long Name",
|
|
// "USERPREFS_CONFIG_OWNER_SHORT_NAME": "MLN",
|
|
// "USERPREFS_CONFIG_DEVICE_ROLE": "meshtastic_Config_DeviceConfig_Role_CLIENT", // Defaults to CLIENT. ROUTER*, and LOST AND FOUND roles are restricted.
|
|
// "USERPREFS_CONFIG_DEVICE_REBROADCAST_MODE": "meshtastic_Config_DeviceConfig_RebroadcastMode_LOCAL_ONLY", // NONE falls back to ALL on a router role
|
|
// "USERPREFS_CONFIG_DEVICE_NODE_INFO_BROADCAST_SECS": "10800", // Clamped to 3600 .. INT32_MAX
|
|
// "USERPREFS_CANNED_MESSAGES": "Hi|Bye|Yes|No|Ok",
|
|
// "USERPREFS_EVENT_MODE": "1",
|
|
// "USERPREFS_EVENT_MODE_HOP_LIMIT": "3", // Event-mode default and firmware-generated/relay hop cap (0-7; default 3)
|
|
// "USERPREFS_BLOCK_POSITION_ON_EVENT_CHANNEL": "1", // Block location TX + discard inbound location on channels keyed with USERPREFS_CHANNEL_0_PSK. Defaults off, and must be set explicitly.
|
|
// "USERPREFS_FIRMWARE_EDITION": "meshtastic_FirmwareEdition_BURNING_MAN",
|
|
// "USERPREFS_FIXED_BLUETOOTH": "121212",
|
|
// "USERPREFS_FIXED_GPS": "",
|
|
// "USERPREFS_FIXED_GPS_ALT": "0",
|
|
// "USERPREFS_FIXED_GPS_LAT": "48.85873920",
|
|
// "USERPREFS_FIXED_GPS_LON": "2.294508368",
|
|
// "USERPREFS_CONFIG_SMART_POSITION_ENABLED": "false",
|
|
// "USERPREFS_CONFIG_GPS_UPDATE_INTERVAL": "600",
|
|
// "USERPREFS_CONFIG_POSITION_BROADCAST_INTERVAL": "1800",
|
|
// "USERPREFS_CONFIG_DEVICE_TELEM_UPDATE_INTERVAL": "900", // Device telemetry update interval in seconds
|
|
// "USERPREFS_CONFIG_ENV_TELEM_UPDATE_INTERVAL": "900", // Environment telemetry update interval in seconds
|
|
// "USERPREFS_CONFIG_ENVIRONMENT_MEASUREMENT_ENABLED": "1", // Force BMP280/sensor reads + LoRa broadcast on first boot
|
|
// "USERPREFS_CONFIG_ENV_SCREEN_SCREEN_ENABLED": "1", // Environment telemetry enable on screen
|
|
// "USERPREFS_CONFIG_AQ_TELEM_UPDATE_INTERVAL": "900", // AQ telemetry update interval in seconds
|
|
// "USERPREFS_CONFIG_AQ_MEASUREMENT_ENABLED": "1", // AQ telemetry enable
|
|
// "USERPREFS_CONFIG_AQ_SCREEN_ENABLED": "1", // AQ telemetry enable on screen
|
|
// "USERPREFS_LORACONFIG_CHANNEL_NUM": "31",
|
|
// "USERPREFS_LORACONFIG_TX_POWER": "0",
|
|
// "USERPREFS_LORACONFIG_MODEM_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST",
|
|
// "USERPREFS_CONFIG_SECURITY_PACKET_SIGNATURE_POLICY": "meshtastic_Config_SecurityConfig_PacketSignaturePolicy_PACKET_SIGNATURE_POLICY_BALANCED", // Authenticity policy applied to remotely received packets.
|
|
// "USERPREFS_USE_ADMIN_KEY_0": "{ 0xcd, 0xc0, 0xb4, 0x3c, 0x53, 0x24, 0xdf, 0x13, 0xca, 0x5a, 0xa6, 0x0c, 0x0d, 0xec, 0x85, 0x5a, 0x4c, 0xf6, 0x1a, 0x96, 0x04, 0x1a, 0x3e, 0xfc, 0xbb, 0x8e, 0x33, 0x71, 0xe5, 0xfc, 0xff, 0x3c }",
|
|
// "USERPREFS_USE_ADMIN_KEY_1": "{}",
|
|
// "USERPREFS_USE_ADMIN_KEY_2": "{}",
|
|
// "USERPREFS_CONFIG_SECURITY_IS_MANAGED": "true", // Ignored unless an admin key is also set
|
|
// "USERPREFS_OEM_TEXT": "Caterham Car Club",
|
|
// "USERPREFS_OEM_FONT_SIZE": "0",
|
|
// "USERPREFS_OEM_IMAGE_WIDTH": "50",
|
|
// "USERPREFS_OEM_IMAGE_HEIGHT": "28",
|
|
// "USERPREFS_OEM_IMAGE_DATA": "{ 0x00, 0x00, 0xF0, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xC0, 0x07, 0x80, 0x0F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x61, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x0C, 0xFF, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x18, 0xFF, 0xFF, 0x67, 0x00, 0x00, 0x00, 0x18, 0x1F, 0xF0, 0x67, 0x00, 0x00, 0x00, 0x30, 0x1F, 0xF8, 0x33, 0x00, 0x00, 0x00, 0x30, 0x00, 0xFC, 0x31, 0x00, 0x00, 0x00, 0x60, 0x00, 0xFE, 0x18, 0x00, 0x00, 0x00, 0x60, 0x00, 0x7E, 0x18, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x3F, 0x0C, 0x00, 0x00, 0x00, 0xC0, 0x80, 0x1F, 0x0C, 0x00, 0x00, 0x00, 0x80, 0x81, 0x1F, 0x06, 0x00, 0x00, 0x00, 0x80, 0xC1, 0x0F, 0x06, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x0F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xE6, 0x8F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xEE, 0xC7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00}",
|
|
// "USERPREFS_NETWORK_ENABLED_PROTOCOLS": "1", // Enable UDP mesh
|
|
// "USERPREFS_NETWORK_WIFI_ENABLED": "true",
|
|
// "USERPREFS_NETWORK_WIFI_SSID": "wifi_ssid",
|
|
// "USERPREFS_NETWORK_WIFI_PSK": "wifi_psk",
|
|
// "USERPREFS_MQTT_ENABLED": "1",
|
|
// "USERPREFS_MQTT_ADDRESS": "'mqtt.meshtastic.org'",
|
|
// "USERPREFS_MQTT_USERNAME": "meshdev",
|
|
// "USERPREFS_MQTT_PASSWORD": "large4cats",
|
|
// "USERPREFS_MQTT_ENCRYPTION_ENABLED": "true",
|
|
// "USERPREFS_MQTT_TLS_ENABLED": "false",
|
|
// "USERPREFS_MQTT_ROOT_TOPIC": "event/REPLACEME",
|
|
// "USERPREFS_MESH_BEACON_LISTEN_ENABLED": "true", // Accept incoming beacons (default: on)
|
|
// "USERPREFS_MESH_BEACON_BROADCAST_ENABLED": "true", // Periodically broadcast beacons from this node
|
|
// "USERPREFS_MESH_BEACON_MESSAGE": "Join us on NarrowSlow!!!", // Text payload included in every beacon broadcast
|
|
// "USERPREFS_MESH_BEACON_INTERVAL_SECS": "3600", // Broadcast interval in seconds (min 3600 = 1 hour)
|
|
// "USERPREFS_MESH_BEACON_OFFER_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_NARROW_SLOW", // Modem preset advertised in the beacon payload (listeners can adopt this)
|
|
// "USERPREFS_MESH_BEACON_OFFER_REGION": "meshtastic_Config_LoRaConfig_RegionCode_EU_N_868", // Region advertised in the beacon payload
|
|
// "USERPREFS_MESH_BEACON_OFFER_CHANNEL_NAME": "'MyChannel'", // Channel name advertised in the beacon payload
|
|
// "USERPREFS_MESH_BEACON_OFFER_CHANNEL_PSK": "{ 0x38, 0x4b, 0xbc, 0xc0, 0x1d, 0xc0, 0x22, 0xd1, 0x81, 0xbf, 0x36, 0xb8, 0x61, 0x21, 0xe1, 0xfb, 0x96, 0xb7, 0x2e, 0x55, 0xbf, 0x74, 0x22, 0x7e, 0x9d, 0x6a, 0xfb, 0x48, 0xd6, 0x4c, 0xb1, 0xa1 }", // PSK for the offered channel (32-byte AES-256)
|
|
// "USERPREFS_MESH_BEACON_OFFER_FREQUENCY_SLOT": "48", // 1-based slot advertised; only set when the mesh pins a non-default slot
|
|
// "USERPREFS_MESH_BEACON_LEGACY_SPLIT": "true", // When both text and offer are present, split into a separate MESH_BEACON_APP (offer) and TEXT_MESSAGE_APP (text) for legacy client compatibility
|
|
// Broadcast targets: every beacon destination is a TARGET_<N>_* entry. With none set, the node
|
|
// beacons once on its running preset and region over the primary channel. Up to 4 targets (0-3);
|
|
// only TARGET_0 is used here, uncomment TARGET_1 to add a second preset. Targets that resolve to
|
|
// the same preset, region and channel are deduplicated.
|
|
// CHANNEL_INDEX references a slot in the device's channel table (0..MAX_NUM_CHANNELS-1); that
|
|
// channel must already be configured on the node (its key is needed to encrypt the beacon).
|
|
// "USERPREFS_MESH_BEACON_TARGET_0_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_LONG_FAST",
|
|
// "USERPREFS_MESH_BEACON_TARGET_0_REGION": "meshtastic_Config_LoRaConfig_RegionCode_EU_868",
|
|
// "USERPREFS_MESH_BEACON_TARGET_0_CHANNEL_INDEX": "0", // device channel-table slot to transmit on
|
|
// "USERPREFS_MESH_BEACON_TARGET_0_FREQUENCY_SLOT": "48", // 1-based slot to transmit on; unset derives it from the channel
|
|
// "USERPREFS_MESH_BEACON_TARGET_1_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_NARROW_SLOW",
|
|
// "USERPREFS_MESH_BEACON_TARGET_1_REGION": "meshtastic_Config_LoRaConfig_RegionCode_EU_N_868",
|
|
// "USERPREFS_MESH_BEACON_TARGET_1_CHANNEL_INDEX": "1",
|
|
// "USERPREFS_MESH_BEACON_TARGET_2_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_MEDIUM_FAST",
|
|
// "USERPREFS_MESH_BEACON_TARGET_2_REGION": "meshtastic_Config_LoRaConfig_RegionCode_EU_868",
|
|
// "USERPREFS_MESH_BEACON_TARGET_2_CHANNEL_INDEX": "2",
|
|
// "USERPREFS_MESH_BEACON_TARGET_3_PRESET": "meshtastic_Config_LoRaConfig_ModemPreset_SHORT_FAST",
|
|
// "USERPREFS_MESH_BEACON_TARGET_3_REGION": "meshtastic_Config_LoRaConfig_RegionCode_EU_868",
|
|
// "USERPREFS_MESH_BEACON_TARGET_3_CHANNEL_INDEX": "3",
|
|
// "USERPREFS_RINGTONE_NAG_SECS": "60",
|
|
// "USERPREFS_NODEINFO_REPLY_SUPPRESS_SECS": "43200",
|
|
// "USERPREFS_UI_TEST_LOG": "true", // Test-only: emits `Screen: frame N/M name=... reason=...` log per UI transition (for the meshtastic-mcp ui test tier); off in release builds.
|
|
"USERPREFS_RINGTONE_RTTTL": "24:d=32,o=5,b=565:f6,p,f6,4p,p,f6,p,f6,2p,p,b6,p,b6,p,b6,p,b6,p,b,p,b,p,b,p,b,p,b,p,b,p,b,p,b,1p.,2p.,p",
|
|
// "USERPREFS_NETWORK_IPV6_ENABLED": "1",
|
|
"USERPREFS_TZ_STRING": "tzplaceholder "
|
|
}
|