From 8fa20d8d0d1d3f51f575454838695bf46f18ca1b Mon Sep 17 00:00:00 2001 From: andrekir Date: Fri, 30 Sep 2022 16:39:21 -0300 Subject: [PATCH] move channel_num to LoRaConfig --- channel.proto | 21 ++------------------- config.proto | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/channel.proto b/channel.proto index 19afc19..eaa7f15 100644 --- a/channel.proto +++ b/channel.proto @@ -31,26 +31,9 @@ option java_outer_classname = "ChannelProtos"; message 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; - * } + * Deprecated in favor of LoraConfig.channel_num */ - uint32 channel_num = 1; + uint32 channel_num = 1 [deprecated = true]; /* * A simple pre-shared key for now for crypto. diff --git a/config.proto b/config.proto index f9b8a51..c4c5db9 100644 --- a/config.proto +++ b/config.proto @@ -572,6 +572,25 @@ message Config { */ int32 tx_power = 10; + /* + * This is controlling the actual hardware frequency the radio is transmitting on. + * Most users should never need to be exposed to this field/concept. + * A channel number between 1 and N (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). + * 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; + * } + */ + uint32 channel_num = 11; + /* * 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