File tree Expand file tree Collapse file tree 10 files changed +31
-61
lines changed Expand file tree Collapse file tree 10 files changed +31
-61
lines changed Original file line number Diff line number Diff line change @@ -361,14 +361,6 @@ ostime_t LMICas923_nextJoinState(void) {
361
361
}
362
362
#endif // !DISABLE_JOIN
363
363
364
- // txDone handling for FSK.
365
- void
366
- LMICas923_txDoneFSK (ostime_t delay , osjobcb_t func ) {
367
- LMIC .rxtime = LMIC .txend + delay - PRERX_FSK * us2osticksRound (160 );
368
- LMIC .rxsyms = RXLEN_FSK ;
369
- os_setTimedCallback (& LMIC .osjob , LMIC .rxtime - RX_RAMPUP , func );
370
- }
371
-
372
364
void
373
365
LMICas923_initJoinLoop (void ) {
374
366
// LMIC.txParam is set to 0xFF by the central code at init time.
Original file line number Diff line number Diff line change @@ -74,13 +74,6 @@ void LMICas923_init(void);
74
74
#undef LMICbandplan_isFSK
75
75
#define LMICbandplan_isFSK () (/* RX datarate */ LMIC .dndr == AS923_DR_FSK)
76
76
77
- // txDone handling for FSK.
78
- void
79
- LMICas923_txDoneFSK (ostime_t delay , osjobcb_t func );
80
-
81
- #undef LMICbandplan_txDoneFSK
82
- #define LMICbandplan_txDoneFSK (delay , func ) LMICas923_txDoneFSK(delay, func)
83
-
84
77
#define LMICbandplan_getInitialDrJoin () (AS923_DR_SF10)
85
78
86
79
void LMICas923_setBcnRxParams (void );
Original file line number Diff line number Diff line change @@ -61,13 +61,6 @@ LMICeu868_isValidBeacon1(const uint8_t *d) {
61
61
#undef LMICbandplan_isFSK
62
62
#define LMICbandplan_isFSK () (/* RX datarate */ LMIC .dndr == EU868_DR_FSK)
63
63
64
- // txDone handling for FSK.
65
- void
66
- LMICeu868_txDoneFSK (ostime_t delay , osjobcb_t func );
67
-
68
- #undef LMICbandplan_txDoneFSK
69
- #define LMICbandplan_txDoneFSK (delay , func ) LMICeu868_txDoneFSK(delay, func)
70
-
71
64
#define LMICbandplan_getInitialDrJoin () (EU868_DR_SF7)
72
65
73
66
void LMICeu868_setBcnRxParams (void );
Original file line number Diff line number Diff line change @@ -58,13 +58,6 @@ LMICin866_isValidBeacon1(const uint8_t *d) {
58
58
#undef LMICbandplan_isFSK
59
59
#define LMICbandplan_isFSK () (/* TX datarate */ LMIC .dndr == IN866_DR_FSK)
60
60
61
- // txDone handling for FSK.
62
- void
63
- LMICin866_txDoneFSK (ostime_t delay , osjobcb_t func );
64
-
65
- #undef LMICbandplan_txDoneFSK
66
- #define LMICbandplan_txDoneFSK (delay , func ) LMICin866_txDoneFSK(delay, func)
67
-
68
61
#define LMICbandplan_getInitialDrJoin () (IN866_DR_SF7)
69
62
70
63
void LMICin866_setBcnRxParams (void );
Original file line number Diff line number Diff line change @@ -61,13 +61,6 @@ LMICkr920_isValidBeacon1(const uint8_t *d) {
61
61
#undef LMICbandplan_isFSK
62
62
#define LMICbandplan_isFSK () (/* always false */ 0 )
63
63
64
- // txDone handling for FSK.
65
- void
66
- LMICkr920_txDoneFSK (ostime_t delay , osjobcb_t func );
67
-
68
- #undef LMICbandplan_txDoneFSK
69
- #define LMICbandplan_txDoneFSK (delay , func ) LMICkr920_txDoneFSK(delay, func)
70
-
71
64
#define LMICbandplan_getInitialDrJoin () (KR920_DR_SF7)
72
65
73
66
void LMICkr920_setBcnRxParams (void );
Original file line number Diff line number Diff line change @@ -247,14 +247,6 @@ ostime_t LMICeu868_nextJoinState(void) {
247
247
}
248
248
#endif // !DISABLE_JOIN
249
249
250
- // Class A txDone handling for FSK.
251
- void
252
- LMICeu868_txDoneFSK (ostime_t delay , osjobcb_t func ) {
253
- LMIC .rxtime = LMIC .txend + delay - PRERX_FSK * us2osticksRound (160 );
254
- LMIC .rxsyms = RXLEN_FSK ;
255
- os_setTimedCallback (& LMIC .osjob , LMIC .rxtime - RX_RAMPUP , func );
256
- }
257
-
258
250
// set the Rx1 dndr, rps.
259
251
void LMICeu868_setRx1Params (void ) {
260
252
u1_t const txdr = LMIC .dndr ;
Original file line number Diff line number Diff line change @@ -250,4 +250,33 @@ void LMICeulike_setRx1Freq(void) {
250
250
LMIC .freq = dlFreq ;
251
251
#endif // !DISABLE_MCMD_DlChannelReq
252
252
}
253
+
254
+ // Class A txDone handling for FSK.
255
+ void
256
+ LMICeulike_txDoneFSK (ostime_t delay , osjobcb_t func ) {
257
+ LMIC .rxsyms = RXLEN_FSK ;
258
+
259
+ // If a clock error is specified, compensate for it by extending the
260
+ // receive window
261
+ delay -= PRERX_FSK * us2osticksRound (160 );
262
+
263
+ if (LMIC .client .clockError != 0 ) {
264
+ // Calculate how much the clock will drift maximally after delay has
265
+ // passed. This indicates the amount of time we can be early
266
+ // _or_ late.
267
+ ostime_t drift = (int64_t )delay * LMIC .client .clockError / MAX_CLOCK_ERROR ;
268
+
269
+ // Increase the receive window by twice the maximum drift (to
270
+ // compensate for a slow or a fast clock).
271
+ // decrease the rxtime to compensate for. Note that hsym is a
272
+ // *half* symbol time, so the factor 2 is hidden. First check if
273
+ // this would overflow (which can happen if the drift is very
274
+ // high, or the symbol time is low at high datarates).
275
+ delay -= drift ;
276
+ }
277
+
278
+ LMIC .rxtime = LMIC .txend + delay ;
279
+ os_setTimedCallback (& LMIC .osjob , LMIC .rxtime - RX_RAMPUP , func );
280
+ }
281
+
253
282
#endif // CFG_LMIC_EU_like
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ LMICeulike_isValidBeacon1(const uint8_t *d) {
56
56
#define LMICbandplan_isFSK () (0)
57
57
58
58
// provide a default LMICbandplan_txDoneDoFSK()
59
- #define LMICbandplan_txDoneFSK (delay , func ) do { } while (0)
59
+ void LMICeulike_txDoneFSK (ostime_t delay , osjobcb_t func );
60
+ #define LMICbandplan_txDoneFSK (delay , func ) LMICeulike_txDoneFSK(delay, func)
60
61
61
62
#define LMICbandplan_joinAcceptChannelClear () LMICbandplan_initDefaultChannels(/* normal, not join */ 0 )
62
63
Original file line number Diff line number Diff line change @@ -212,14 +212,6 @@ ostime_t LMICin866_nextJoinState(void) {
212
212
}
213
213
#endif // !DISABLE_JOIN
214
214
215
- // Class A txDone handling for FSK.
216
- void
217
- LMICin866_txDoneFSK (ostime_t delay , osjobcb_t func ) {
218
- LMIC .rxtime = LMIC .txend + delay - PRERX_FSK * us2osticksRound (160 );
219
- LMIC .rxsyms = RXLEN_FSK ;
220
- os_setTimedCallback (& LMIC .osjob , LMIC .rxtime - RX_RAMPUP , func );
221
- }
222
-
223
215
// set the Rx1 dndr, rps.
224
216
void LMICin866_setRx1Params (void ) {
225
217
u1_t const txdr = LMIC .dndr ;
Original file line number Diff line number Diff line change @@ -223,14 +223,6 @@ ostime_t LMICkr920_nextJoinState(void) {
223
223
}
224
224
#endif // !DISABLE_JOIN
225
225
226
- // // txDone handling for FSK.
227
- // void
228
- // LMICkr920_txDoneFSK(ostime_t delay, osjobcb_t func) {
229
- // LMIC.rxtime = LMIC.txend + delay - PRERX_FSK*us2osticksRound(160);
230
- // LMIC.rxsyms = RXLEN_FSK;
231
- // os_setTimedCallback(&LMIC.osjob, LMIC.rxtime - RX_RAMPUP, func);
232
- // }
233
-
234
226
// set the Rx1 dndr, rps.
235
227
void LMICkr920_setRx1Params (void ) {
236
228
u1_t const txdr = LMIC .dndr ;
You can’t perform that action at this time.
0 commit comments