Skip to content

Commit

Permalink
v3.0.2
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
mcoracin committed Jun 12, 2015
1 parent 7c02f48 commit 519d088
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.0.2
10 changes: 6 additions & 4 deletions libloragw/src/loragw_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,6 +1188,9 @@ int lgw_receive(uint8_t max_pkt, struct lgw_pkt_rx_s *pkt_data) {
}
CHECK_NULL(pkt_data);

/* Initialize buffer */
memset (buff, 0, sizeof buff);

/* iterate max_pkt times at most */
for (nb_pkt_fetch = 0; nb_pkt_fetch < max_pkt; ++nb_pkt_fetch) {

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

/* get back info from configuration so that application doesn't have to keep track of it */
p->rf_chain = (uint8_t)if_rf_chain[p->if_chain];
p->freq_hz = (uint32_t)((int32_t)rf_rx_freq[p->rf_chain] + if_freq[p->if_chain]);

/* process metadata */
p->if_chain = buff[sz+0];
ifmod = ifmod_config[p->if_chain];
DEBUG_PRINTF("[%d %d]\n", p->if_chain, ifmod);

p->rf_chain = (uint8_t)if_rf_chain[p->if_chain];
p->freq_hz = (uint32_t)((int32_t)rf_rx_freq[p->rf_chain] + if_freq[p->if_chain]);
p->rssi = (float)buff[sz+5] + rf_rssi_offset[p->rf_chain];

if ((ifmod == IF_LORA_MULTI) || (ifmod == IF_LORA_STD)) {
Expand Down
10 changes: 10 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ for spectral measurement.
3. Changelog
-------------

### 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

### v3.0.1 ###

* Bufgix: Fixed util_tx_continuous compilation issue, by adding empty obj directory
* Bugfix: Fixed HAL compilation issue for CFG_SPI=ftdi, removed dependency on loragw_gpio in this case

### v3.0.0 ###

* 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.
Expand Down
16 changes: 10 additions & 6 deletions util_pkt_logger/src/util_pkt_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,9 @@ int parse_gateway_configuration(const char * conf_file) {
JSON_Value *root_val;
JSON_Object *root = NULL;
JSON_Object *conf = NULL;
const char *str; /* pointer to sub-strings in the JSON data */
unsigned long long ull = 0;

/* try to parse JSON */
root_val = json_parse_file_with_comments(conf_file);
root = json_value_get_object(root_val);
Expand All @@ -316,12 +317,15 @@ int parse_gateway_configuration(const char * conf_file) {
} else {
MSG("INFO: %s does contain a JSON object named %s, parsing gateway parameters\n", conf_file, conf_obj);
}

/* getting network parameters (only those necessary for the packet logger) */
sscanf(json_object_dotget_string(conf, "gateway_ID"), "%llx", &ull);
lgwm = ull;
MSG("INFO: gateway MAC address is configured to %016llX\n", ull);

str = json_object_get_string(conf, "gateway_ID");
if (str != NULL) {
sscanf(str, "%llx", &ull);
lgwm = ull;
MSG("INFO: gateway MAC address is configured to %016llX\n", ull);
}

json_value_free(root_val);
return 0;
}
Expand Down

0 comments on commit 519d088

Please sign in to comment.