summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--VERSION2
-rw-r--r--lora_pkt_fwd/src/lora_pkt_fwd.c12
2 files changed, 13 insertions, 1 deletions
diff --git a/VERSION b/VERSION
index b33ec60..8f9b697 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.0.1-mts-2
+4.0.1-mts-4
diff --git a/lora_pkt_fwd/src/lora_pkt_fwd.c b/lora_pkt_fwd/src/lora_pkt_fwd.c
index 5aae335..5b2da71 100644
--- a/lora_pkt_fwd/src/lora_pkt_fwd.c
+++ b/lora_pkt_fwd/src/lora_pkt_fwd.c
@@ -3098,6 +3098,7 @@ void thread_jit(void) {
enum jit_error_e jit_result;
enum jit_pkt_type_e pkt_type;
uint8_t tx_status;
+ uint32_t time_on_air = 0;
while (!exit_sig && !quit_sig) {
wait_ms(10);
@@ -3124,6 +3125,17 @@ void thread_jit(void) {
pthread_mutex_unlock(&mx_meas_dw);
MSG("INFO: Beacon dequeued (count_us=%u)\n", pkt.count_us);
}
+
+ if (duty_cycle_enabled) {
+ time_on_air = (uint32_t)lgw_time_on_air(packet); /* in ms */
+
+ if (duty_cycle_time_avail >= time_on_air) {
+ duty_cycle_time_avail -= time_on_air;
+ } else {
+ printf( "WARNING: DUTY-CYCLE-LIMIT | Not enough time-on-air available to allow transmission PKT: %lu ms AVAILABLE: %lu ms\n", time_on_air, duty_cycle_time_avail);
+ continue;
+ }
+ }
/* check if concentrator is free for sending new packet */
pthread_mutex_lock(&mx_concent); /* may have to wait for a fetch to finish */