Skip to content

Commit 519d088

Browse files
committed
v3.0.2
- Bugfix: Fixed frequency calculation on uplinks: lgw_receive() function was using a variable to calculate the frequency before it was initialized with correct value. - Bugfix: util_pkt_logger crashed when no gateway_ID is not defined in global_conf.json
1 parent 7c02f48 commit 519d088

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.1
1+
3.0.2

libloragw/src/loragw_hal.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,9 @@ int lgw_receive(uint8_t max_pkt, struct lgw_pkt_rx_s *pkt_data) {
11881188
}
11891189
CHECK_NULL(pkt_data);
11901190

1191+
/* Initialize buffer */
1192+
memset (buff, 0, sizeof buff);
1193+
11911194
/* iterate max_pkt times at most */
11921195
for (nb_pkt_fetch = 0; nb_pkt_fetch < max_pkt; ++nb_pkt_fetch) {
11931196

@@ -1214,14 +1217,13 @@ int lgw_receive(uint8_t max_pkt, struct lgw_pkt_rx_s *pkt_data) {
12141217
/* copy payload to result struct */
12151218
memcpy((void *)p->payload, (void *)buff, sz);
12161219

1217-
/* get back info from configuration so that application doesn't have to keep track of it */
1218-
p->rf_chain = (uint8_t)if_rf_chain[p->if_chain];
1219-
p->freq_hz = (uint32_t)((int32_t)rf_rx_freq[p->rf_chain] + if_freq[p->if_chain]);
1220-
12211220
/* process metadata */
12221221
p->if_chain = buff[sz+0];
12231222
ifmod = ifmod_config[p->if_chain];
12241223
DEBUG_PRINTF("[%d %d]\n", p->if_chain, ifmod);
1224+
1225+
p->rf_chain = (uint8_t)if_rf_chain[p->if_chain];
1226+
p->freq_hz = (uint32_t)((int32_t)rf_rx_freq[p->rf_chain] + if_freq[p->if_chain]);
12251227
p->rssi = (float)buff[sz+5] + rf_rssi_offset[p->rf_chain];
12261228

12271229
if ((ifmod == IF_LORA_MULTI) || (ifmod == IF_LORA_STD)) {

readme.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ for spectral measurement.
5656
3. Changelog
5757
-------------
5858

59+
### v3.0.2 ###
60+
61+
* Bugfix: Fixed frequency calculation on uplinks: lgw_receive() function was using a variable to calculate the frequency before it was initialized with correct value.
62+
* Bugfix: util_pkt_logger crashed when no gateway_ID is not defined in global_conf.json
63+
64+
### v3.0.1 ###
65+
66+
* Bufgix: Fixed util_tx_continuous compilation issue, by adding empty obj directory
67+
* Bugfix: Fixed HAL compilation issue for CFG_SPI=ftdi, removed dependency on loragw_gpio in this case
68+
5969
### v3.0.0 ###
6070

6171
* Added new HAL function lgw_board_setconf() to configure board/concentrator specific parameters: network type (LoRa public or private), concentrator clock source. Note: those parameters are not any more set from the library.cfg file configuration (CFG_NET, CFG_BRD), and should be passed at initialization by the application.

util_pkt_logger/src/util_pkt_logger.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,9 @@ int parse_gateway_configuration(const char * conf_file) {
300300
JSON_Value *root_val;
301301
JSON_Object *root = NULL;
302302
JSON_Object *conf = NULL;
303+
const char *str; /* pointer to sub-strings in the JSON data */
303304
unsigned long long ull = 0;
304-
305+
305306
/* try to parse JSON */
306307
root_val = json_parse_file_with_comments(conf_file);
307308
root = json_value_get_object(root_val);
@@ -316,12 +317,15 @@ int parse_gateway_configuration(const char * conf_file) {
316317
} else {
317318
MSG("INFO: %s does contain a JSON object named %s, parsing gateway parameters\n", conf_file, conf_obj);
318319
}
319-
320+
320321
/* getting network parameters (only those necessary for the packet logger) */
321-
sscanf(json_object_dotget_string(conf, "gateway_ID"), "%llx", &ull);
322-
lgwm = ull;
323-
MSG("INFO: gateway MAC address is configured to %016llX\n", ull);
324-
322+
str = json_object_get_string(conf, "gateway_ID");
323+
if (str != NULL) {
324+
sscanf(str, "%llx", &ull);
325+
lgwm = ull;
326+
MSG("INFO: gateway MAC address is configured to %016llX\n", ull);
327+
}
328+
325329
json_value_free(root_val);
326330
return 0;
327331
}

0 commit comments

Comments
 (0)