summaryrefslogtreecommitdiff
path: root/lora_pkt_fwd
diff options
context:
space:
mode:
authorJason Reiss <jreiss@multitech.com>2020-03-20 09:32:56 -0500
committerJason Reiss <jreiss@multitech.com>2020-03-20 09:32:56 -0500
commit1fe52d9a835104f6baf020a0fb5281e3570c420c (patch)
tree10584ba4ce07d8474ccafe7e71d1f69bb421892c /lora_pkt_fwd
parentf259785d46443c4e7d2f71faa9314abfd9187e15 (diff)
downloadpacket_forwarder_mtac_full-1fe52d9a835104f6baf020a0fb5281e3570c420c.tar.gz
packet_forwarder_mtac_full-1fe52d9a835104f6baf020a0fb5281e3570c420c.tar.bz2
packet_forwarder_mtac_full-1fe52d9a835104f6baf020a0fb5281e3570c420c.zip
Add periodic LBT restart and lgw sx1301 page monitor
Diffstat (limited to 'lora_pkt_fwd')
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 0a3680e..a7214ae 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -1695,15 +1695,37 @@ int main(int argc, char** argv)
printf("# BEACON sent so far: %u\n", cp_nb_beacon_sent);
printf("# BEACON rejected: %u\n", cp_nb_beacon_rejected);
printf("### [JIT] ###\n");
+
/* get timestamp captured on PPM pulse */
pthread_mutex_lock(&mx_concent);
i = lgw_get_trigcnt(&trig_tstamp);
+
+ uint8_t page = 0;
+ lgw_get_cur_page(&page);
+
+ if (page != 2) {
+ //quit rather than reset the page. We don't know if this was on purpose or not.
+ exit_sig = true;
+ MSG("WARNING: lgw page was unexpectedly changed, process is exiting.\n");
+ break;
+ }
+
pthread_mutex_unlock(&mx_concent);
if (i != LGW_HAL_SUCCESS) {
printf("# SX1301 time (PPS): unknown\n");
} else {
- printf("# SX1301 time (PPS): %u\n", trig_tstamp);
+ printf("# SX1301 time (PPS): %u %u\n", trig_tstamp, page);
+ }
+
+ static uint32_t last_tstamp = 0;
+ if (lbt_enabled && trig_tstamp < last_tstamp) {
+ printf("# Restarting LBT\n");
+ lgw_fpga_reg_w(LGW_FPGA_CTRL_FEATURE_START, 0);
+ wait_ms(5);
+ lgw_fpga_reg_w(LGW_FPGA_CTRL_FEATURE_START, 1);
}
+ last_tstamp = trig_tstamp;
+
jit_print_queue (&jit_queue, false, DEBUG_LOG);
printf("### [GPS] ###\n");
if (gps_enabled == true) {