File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -370,15 +370,28 @@ LMICas923_initJoinLoop(void) {
370
370
void
371
371
LMICas923_updateTx (ostime_t txbeg ) {
372
372
u4_t freq = LMIC .channelFreq [LMIC .txChnl ];
373
+ u4_t dwellDelay ;
374
+ u4_t globalDutyDelay ;
375
+
373
376
// Update global/band specific duty cycle stats
374
377
ostime_t airtime = calcAirTime (LMIC .rps , LMIC .dataLen );
375
378
// Update channel/global duty cycle stats
376
379
xref2band_t band = & LMIC .bands [freq & 0x3 ];
377
380
LMIC .freq = freq & ~(u4_t )3 ;
378
381
LMIC .txpow = LMICas923_getMaxEIRP (LMIC .txParam );
379
382
band -> avail = txbeg + airtime * band -> txcap ;
380
- if (LMIC .globalDutyRate != 0 )
381
- LMIC .globalDutyAvail = txbeg + (airtime << LMIC .globalDutyRate );
383
+ dwellDelay = globalDutyDelay = 0 ;
384
+ if (LMIC .globalDutyRate != 0 ) {
385
+ globalDutyDelay = (airtime << LMIC .globalDutyRate );
386
+ }
387
+ if (LMICas923_getUplinkDwellBit (LMIC .txParam )) {
388
+ dwellDelay = AS923_UPLINK_DWELL_TIME_osticks ;
389
+ }
390
+ if (dwellDelay > globalDutyDelay ) {
391
+ globalDutyDelay = dwellDelay ;
392
+ }
393
+ if (globalDutyDelay != 0 )
394
+ LMIC .globalDutyAvail = txbeg + globalDutyDelay ;
382
395
}
383
396
384
397
Original file line number Diff line number Diff line change @@ -239,10 +239,23 @@ void LMICau921_updateTx(ostime_t txbeg) {
239
239
LMIC .freq = AU921_500kHz_UPFBASE + (chnl - 64 )* AU921_500kHz_UPFSTEP ;
240
240
}
241
241
242
- // Update global duty cycle stats
242
+ // Update global duty cycle stat and deal with dwell time.
243
+ u4_t dwellDelay ;
244
+ u4_t globalDutyDelay ;
245
+ dwellDelay = globalDutyDelay = 0 ;
246
+
243
247
if (LMIC .globalDutyRate != 0 ) {
244
248
ostime_t airtime = calcAirTime (LMIC .rps , LMIC .dataLen );
245
- LMIC .globalDutyAvail = txbeg + (airtime << LMIC .globalDutyRate );
249
+ globalDutyDelay = txbeg + (airtime << LMIC .globalDutyRate );
250
+ }
251
+ if (LMICau921_getUplinkDwellBit (LMIC .txParam )) {
252
+ dwellDelay = AS923_UPLINK_DWELL_TIME_osticks ;
253
+ }
254
+ if (dwellDelay > globalDutyDelay ) {
255
+ globalDutyDelay = dwellDelay ;
256
+ }
257
+ if (globalDutyDelay != 0 ) {
258
+ LMIC .globalDutyAvail = txbeg + globalDutyDelay ;
246
259
}
247
260
}
248
261
You can’t perform that action at this time.
0 commit comments