summaryrefslogtreecommitdiff
path: root/loragw_hal/src/loragw_hal.c
diff options
context:
space:
mode:
authorSylvain Miermont <smiermont@semtech.com>2013-08-08 15:49:31 +0200
committerSylvain Miermont <smiermont@semtech.com>2013-10-23 11:03:07 +0200
commitddac0aa483dd5f7bca31b0c042949eca370a8fdc (patch)
tree339b16655dbb9b6cca0e972454a8591256330900 /loragw_hal/src/loragw_hal.c
parente588fccf2b13065c25c95c70be191614cd23b005 (diff)
downloadlora_gateway-ddac0aa483dd5f7bca31b0c042949eca370a8fdc.tar.gz
lora_gateway-ddac0aa483dd5f7bca31b0c042949eca370a8fdc.tar.bz2
lora_gateway-ddac0aa483dd5f7bca31b0c042949eca370a8fdc.zip
Beta 3v1.b3
- modified 'native' SPI module to align with the way resource pointers are managed in 'ftdi' variant (void pointers) - better check of channel frequency + bandwidth vs. authorized band - improved Makefile
Diffstat (limited to 'loragw_hal/src/loragw_hal.c')
-rw-r--r--loragw_hal/src/loragw_hal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/loragw_hal/src/loragw_hal.c b/loragw_hal/src/loragw_hal.c
index 9f9bf8a..fc9e293 100644
--- a/loragw_hal/src/loragw_hal.c
+++ b/loragw_hal/src/loragw_hal.c
@@ -440,7 +440,6 @@ int lgw_rxif_setconf(uint8_t if_chain, struct lgw_conf_rxif_s conf) {
}
/* check 'general' parameters */
- /* ? add checks to stay in band (ie. radio_freq+if+BW/2 < fmax) ? */
if (if_chain > LGW_IF_CHAIN_NB) {
DEBUG_PRINTF("ERROR: %d NOT A VALID IF_CHAIN NUMBER\n", if_chain);
return LGW_HAL_ERROR;
@@ -448,13 +447,14 @@ int lgw_rxif_setconf(uint8_t if_chain, struct lgw_conf_rxif_s conf) {
if (ifmod_config[if_chain] == IF_UNDEFINED) {
DEBUG_PRINTF("ERROR: IF CHAIN %d NOT CONFIGURABLE\n", if_chain);
}
- if (conf.freq_hz > LGW_RF_BANDWIDTH/2) {
+ if ((conf.freq_hz + LGW_REF_BW/2) > LGW_RADIO_BW/2) {
DEBUG_PRINTF("ERROR: IF FREQUENCY %d TOO HIGH\n", conf.freq_hz);
return LGW_HAL_ERROR;
- } else if (conf.freq_hz < -LGW_RF_BANDWIDTH/2) {
+ } else if ((conf.freq_hz - LGW_REF_BW/2) < -LGW_RADIO_BW/2) {
DEBUG_PRINTF("ERROR: IF FREQUENCY %d TOO LOW\n", conf.freq_hz);
return LGW_HAL_ERROR;
}
+ /* WARNING: if the channel is 250 or 500kHz wide, that check is insufficient */
/* check parameters according to the type of IF chain + modem,
fill default if necessary, and commit configuration if everything is OK */