kopia lustrzana https://github.com/jgromes/RadioLib
[SX128x] Added -1 as alias for lowest supported frequency deviation
rodzic
ed4d6e8897
commit
f4b2b6d257
|
@ -802,17 +802,23 @@ int16_t SX128x::setFrequencyDeviation(float freqDev) {
|
|||
return(ERR_WRONG_MODEM);
|
||||
}
|
||||
|
||||
RADIOLIB_CHECK_RANGE(freqDev, 0.0, 3200.0, ERR_INVALID_FREQUENCY_DEVIATION);
|
||||
// set frequency deviation to lowest available setting (required for digimodes)
|
||||
float newFreqDev = freqDev;
|
||||
if(freqDev < 0.0) {
|
||||
newFreqDev = 62.5;
|
||||
}
|
||||
|
||||
RADIOLIB_CHECK_RANGE(newFreqDev, 62.5, 1000.0, ERR_INVALID_FREQUENCY_DEVIATION);
|
||||
|
||||
// override for the lowest possible frequency deviation - required for some PhysicalLayer protocols
|
||||
if(freqDev == 0.0) {
|
||||
if(newFreqDev == 0.0) {
|
||||
_modIndex = SX128X_BLE_GFSK_MOD_IND_0_35;
|
||||
_br = SX128X_BLE_GFSK_BR_0_125_BW_0_3;
|
||||
return(setModulationParams(_br, _modIndex, _shaping));
|
||||
}
|
||||
|
||||
// update modulation parameters
|
||||
uint8_t modIndex = (uint8_t)((8.0 * (freqDev / (float)_brKbps)) - 1.0);
|
||||
uint8_t modIndex = (uint8_t)((8.0 * (newFreqDev / (float)_brKbps)) - 1.0);
|
||||
if(modIndex > SX128X_BLE_GFSK_MOD_IND_4_00) {
|
||||
return(ERR_INVALID_MODULATION_PARAMETERS);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue