Allow advanced users to set arbitrary spreadfactor/codingrate/bandwidth

This commit is contained in:
geeksville
2020-08-12 10:42:25 -07:00
parent fce8c16d52
commit d7cf7e2eb4
5 changed files with 51 additions and 41 deletions

View File

@@ -115,22 +115,26 @@ unsigned long hash(char *str)
return hash;
}
#define POWER_DEFAULT 17
/**
* Pull our channel settings etc... from protobufs to the dumb interface settings
*/
void RadioInterface::applyModemConfig()
{
// Set up default configuration
// No Sync Words in LORA mode.
modemConfig = (ModemConfigChoice)channelSettings.modem_config;
// No Sync Words in LORA mode
power = channelSettings.tx_power;
if (power == 0)
power = POWER_DEFAULT;
// Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
int channel_num = hash(channelSettings.name) % NUM_CHANNELS;
freq = CH0 + CH_SPACING * channel_num;
power = channelSettings.tx_power;
DEBUG_MSG("Set radio: name=%s, config=%u, ch=%d, power=%d\n", channelSettings.name, channelSettings.modem_config, channel_num,
channelSettings.tx_power);
power);
}
ErrorCode SimRadio::send(MeshPacket *p)