diff --git a/mesh.proto b/mesh.proto index 41c29bb..56c4d5e 100644 --- a/mesh.proto +++ b/mesh.proto @@ -430,6 +430,21 @@ message ChannelSettings { 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 algoritm 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; + } */ uint32 channel_num = 9;