diff options
Diffstat (limited to 'src/target/firmware/layer1/tpu_window.c')
-rw-r--r-- | src/target/firmware/layer1/tpu_window.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/target/firmware/layer1/tpu_window.c b/src/target/firmware/layer1/tpu_window.c index f4e76c16..abdad956 100644 --- a/src/target/firmware/layer1/tpu_window.c +++ b/src/target/firmware/layer1/tpu_window.c @@ -67,30 +67,26 @@ static const uint16_t tx_burst_duration[_NUM_L1_TXWIN] = { [L1_TXWIN_AB] = L1_TX_AB_DURATION_Q, }; - static int _win_setup(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3) { - uint8_t tn; - - rfch_get_params(&l1s.next_time, NULL, NULL, &tn); - - l1s.tpu_offset = (5000 + l1s.tpu_offset + l1s.tpu_offset_correction) % 5000; + l1s.tpu_offset = (l1s.tpu_offset + l1s.tpu_offset_correction + + l1s.tpu_offset_shift + L1_TDMA_LENGTH_Q + + L1_TDMA_LENGTH_Q) % L1_TDMA_LENGTH_Q; + l1s.tpu_offset_changed = l1s.tpu_offset_correction + + l1s.tpu_offset_shift; l1s.tpu_offset_correction = 0; + l1s.tpu_offset_shift = 0; tpu_enq_at(4740); - tpu_enq_sync((5000 + l1s.tpu_offset + (L1_BURST_LENGTH_Q * tn)) % 5000); + tpu_enq_sync(l1s.tpu_offset); return 0; } static int _win_cleanup(__unused uint8_t p1, __unused uint8_t p2, __unused uint16_t p3) { - uint8_t tn; - - rfch_get_params(&l1s.next_time, NULL, NULL, &tn); - /* restore offset */ - tpu_enq_offset((5000 + l1s.tpu_offset + (L1_BURST_LENGTH_Q * tn)) % 5000); + tpu_enq_offset(l1s.tpu_offset); return 0; } |