From 178958c1657d6d31b7e8446adfcc13014ebe7391 Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 12 Aug 2020 10:46:44 -0700 Subject: [PATCH] allow advanced users to specify channel numbers if they wish --- src/mesh/RadioInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesh/RadioInterface.cpp b/src/mesh/RadioInterface.cpp index 4967954e..69e335ed 100644 --- a/src/mesh/RadioInterface.cpp +++ b/src/mesh/RadioInterface.cpp @@ -129,8 +129,8 @@ void RadioInterface::applyModemConfig() if (power == 0) power = POWER_DEFAULT; - // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM - int channel_num = hash(channelSettings.name) % NUM_CHANNELS; + // If user has manually specified a channel num, then use that, otherwise generate one by hashing the name + int channel_num = (channelSettings.channel_num ? channelSettings.channel_num - 1 : hash(channelSettings.name)) % NUM_CHANNELS; freq = CH0 + CH_SPACING * channel_num; DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelSettings.name, channelSettings.modem_config, channel_num,