diff --git a/platformio.ini b/platformio.ini index 23102e00..2929ce09 100644 --- a/platformio.ini +++ b/platformio.ini @@ -65,7 +65,7 @@ framework = arduino lib_deps = ${env.lib_deps} ; Portduino is using meshtastic fork for now - https://github.com/jgromes/RadioLib.git@5.3.0 + https://github.com/jgromes/RadioLib.git@5.4.0 build_flags = ${env.build_flags} -Os # -DRADIOLIB_GODMODE diff --git a/protobufs b/protobufs index dabfdfb9..d3375fe5 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit dabfdfb90c62bd862536157431083f99c8fde003 +Subproject commit d3375fe599da1dd48572354325d3186eccf6f449 diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 59c8b49d..da32af9f 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -423,7 +423,7 @@ void RadioInterface::applyModemConfig() // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name const char *channelName = channels.getName(channels.getPrimaryIndex()); - int channel_num = channelSettings.channel_num ? channelSettings.channel_num - 1 : hash(channelName) % numChannels; + int channel_num = loraConfig.channel_num ? loraConfig.channel_num - 1 : hash(channelName) % numChannels; // Old frequency selection formula // float freq = myRegion->freqStart + ((((myRegion->freqEnd - myRegion->freqStart) / numChannels) / 2) * channel_num); diff --git a/src/mesh/generated/apponly.pb.h b/src/mesh/generated/apponly.pb.h index 8aa0f174..36bff5ad 100644 --- a/src/mesh/generated/apponly.pb.h +++ b/src/mesh/generated/apponly.pb.h @@ -54,7 +54,7 @@ extern const pb_msgdesc_t ChannelSet_msg; #define ChannelSet_fields &ChannelSet_msg /* Maximum encoded size of messages (where known) */ -#define ChannelSet_size 559 +#define ChannelSet_size 581 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/channel.pb.h b/src/mesh/generated/channel.pb.h index 7112ecac..cdb29c55 100644 --- a/src/mesh/generated/channel.pb.h +++ b/src/mesh/generated/channel.pb.h @@ -38,25 +38,8 @@ typedef PB_BYTES_ARRAY_T(32) ChannelSettings_psk_t; FIXME: explain how apps use channels for security. explain how remote settings and remote gpio are managed as an example */ typedef struct _ChannelSettings { - /* NOTE: this field is _independent_ and unrelated to the concepts in channel.proto. - this is controlling the actual hardware frequency the radio is transmitting on. - In a perfect world we would have called it something else (band?) but I forgot to make this change during the big 1.2 renaming. - Most users should never need to be exposed to this field/concept. - A channel number between 1 and 13 (or whatever the max is in the current - region). If ZERO then the rule is "use the old channel name hash based - algorithm to derive the channel number") - If using the hash algorithm the channel number will be: hash(channel_name) % - NUM_CHANNELS (Where num channels depends on the regulatory region). - NUM_CHANNELS_US is 13, for other values see MeshRadio.h in the device code. - hash a string into an integer - djb2 by Dan Bernstein. - - http://www.cse.yorku.ca/~oz/hash.html - unsigned long hash(char *str) { - unsigned long hash = 5381; int c; - while ((c = *str++) != 0) - hash = ((hash << 5) + hash) + (unsigned char) c; - return hash; - } */ - uint8_t channel_num; + /* Deprecated in favor of LoraConfig.channel_num */ + uint32_t channel_num; /* A simple pre-shared key for now for crypto. Must be either 0 bytes (no crypto), 16 bytes (AES128), or 32 bytes (AES256). A special shorthand is used for 1 byte long psks. @@ -163,8 +146,8 @@ extern const pb_msgdesc_t Channel_msg; #define Channel_fields &Channel_msg /* Maximum encoded size of messages (where known) */ -#define ChannelSettings_size 59 -#define Channel_size 74 +#define ChannelSettings_size 62 +#define Channel_size 77 #ifdef __cplusplus } /* extern "C" */ diff --git a/src/mesh/generated/config.pb.h b/src/mesh/generated/config.pb.h index cd83defa..bc06b53e 100644 --- a/src/mesh/generated/config.pb.h +++ b/src/mesh/generated/config.pb.h @@ -108,14 +108,15 @@ typedef struct _Config_DisplayConfig { typedef struct _Config_LoRaConfig { bool use_preset; Config_LoRaConfig_ModemPreset modem_preset; - uint32_t bandwidth; + uint16_t bandwidth; uint32_t spread_factor; - uint32_t coding_rate; + uint8_t coding_rate; float frequency_offset; Config_LoRaConfig_RegionCode region; uint32_t hop_limit; bool tx_enabled; - int32_t tx_power; + int8_t tx_power; + uint8_t channel_num; pb_size_t ignore_incoming_count; uint32_t ignore_incoming[3]; } Config_LoRaConfig; @@ -208,7 +209,7 @@ extern "C" { #define Config_PowerConfig_init_default {0, 0, 0, 0, 0, 0, 0, 0} #define Config_NetworkConfig_init_default {0, _Config_NetworkConfig_WiFiMode_MIN, "", "", ""} #define Config_DisplayConfig_init_default {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN} -#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, {0, 0, 0}} +#define Config_LoRaConfig_init_default {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, {0, 0, 0}} #define Config_BluetoothConfig_init_default {0, _Config_BluetoothConfig_PairingMode_MIN, 0} #define Config_init_zero {0, {Config_DeviceConfig_init_zero}} #define Config_DeviceConfig_init_zero {_Config_DeviceConfig_Role_MIN, 0, 0} @@ -216,7 +217,7 @@ extern "C" { #define Config_PowerConfig_init_zero {0, 0, 0, 0, 0, 0, 0, 0} #define Config_NetworkConfig_init_zero {0, _Config_NetworkConfig_WiFiMode_MIN, "", "", ""} #define Config_DisplayConfig_init_zero {0, _Config_DisplayConfig_GpsCoordinateFormat_MIN, 0, 0, 0, _Config_DisplayConfig_DisplayUnits_MIN} -#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, {0, 0, 0}} +#define Config_LoRaConfig_init_zero {0, _Config_LoRaConfig_ModemPreset_MIN, 0, 0, 0, 0, _Config_LoRaConfig_RegionCode_MIN, 0, 0, 0, 0, 0, {0, 0, 0}} #define Config_BluetoothConfig_init_zero {0, _Config_BluetoothConfig_PairingMode_MIN, 0} /* Field tags (for use in manual encoding/decoding) */ @@ -242,6 +243,7 @@ extern "C" { #define Config_LoRaConfig_hop_limit_tag 8 #define Config_LoRaConfig_tx_enabled_tag 9 #define Config_LoRaConfig_tx_power_tag 10 +#define Config_LoRaConfig_channel_num_tag 11 #define Config_LoRaConfig_ignore_incoming_tag 103 #define Config_NetworkConfig_wifi_enabled_tag 1 #define Config_NetworkConfig_wifi_mode_tag 2 @@ -350,6 +352,7 @@ X(a, STATIC, SINGULAR, UENUM, region, 7) \ X(a, STATIC, SINGULAR, UINT32, hop_limit, 8) \ X(a, STATIC, SINGULAR, BOOL, tx_enabled, 9) \ X(a, STATIC, SINGULAR, INT32, tx_power, 10) \ +X(a, STATIC, SINGULAR, UINT32, channel_num, 11) \ X(a, STATIC, REPEATED, UINT32, ignore_incoming, 103) #define Config_LoRaConfig_CALLBACK NULL #define Config_LoRaConfig_DEFAULT NULL @@ -384,7 +387,7 @@ extern const pb_msgdesc_t Config_BluetoothConfig_msg; #define Config_BluetoothConfig_size 10 #define Config_DeviceConfig_size 6 #define Config_DisplayConfig_size 20 -#define Config_LoRaConfig_size 69 +#define Config_LoRaConfig_size 67 #define Config_NetworkConfig_size 137 #define Config_PositionConfig_size 30 #define Config_PowerConfig_size 43 diff --git a/src/mesh/generated/deviceonly.pb.h b/src/mesh/generated/deviceonly.pb.h index 3b1e17b6..e7ee26e8 100644 --- a/src/mesh/generated/deviceonly.pb.h +++ b/src/mesh/generated/deviceonly.pb.h @@ -164,7 +164,7 @@ extern const pb_msgdesc_t OEMStore_msg; #define OEMStore_fields &OEMStore_msg /* Maximum encoded size of messages (where known) */ -#define ChannelFile_size 614 +#define ChannelFile_size 638 #define DeviceState_size 21800 #define OEMStore_size 2106 diff --git a/src/mesh/generated/localonly.pb.h b/src/mesh/generated/localonly.pb.h index 901e8c13..afbe06af 100644 --- a/src/mesh/generated/localonly.pb.h +++ b/src/mesh/generated/localonly.pb.h @@ -144,7 +144,7 @@ extern const pb_msgdesc_t LocalModuleConfig_msg; #define LocalModuleConfig_fields &LocalModuleConfig_msg /* Maximum encoded size of messages (where known) */ -#define LocalConfig_size 336 +#define LocalConfig_size 334 #define LocalModuleConfig_size 270 #ifdef __cplusplus