@@ -1220,6 +1220,7 @@ void radio_irq_handler_v2 (u1_t dio, ostime_t now) {
1220
1220
if ( (readReg (RegOpMode ) & OPMODE_LORA ) != 0 ) { // LORA modem
1221
1221
u1_t flags = readReg (LORARegIrqFlags );
1222
1222
LMIC .saveIrqFlags = flags ;
1223
+ LMICOS_logEventUint32 ("radio_irq_handler_v2: LoRa" , flags );
1223
1224
LMIC_X_DEBUG_PRINTF ("IRQ=%02x\n" , flags );
1224
1225
if ( flags & IRQ_LORA_TXDONE_MASK ) {
1225
1226
// save exact tx time
@@ -1258,6 +1259,9 @@ void radio_irq_handler_v2 (u1_t dio, ostime_t now) {
1258
1259
} else { // FSK modem
1259
1260
u1_t flags1 = readReg (FSKRegIrqFlags1 );
1260
1261
u1_t flags2 = readReg (FSKRegIrqFlags2 );
1262
+
1263
+ LMICOS_logEventUint32 ("radio_irq_handler_v2: FSK" , (flags2 << UINT32_C (8 )) | flags1 );
1264
+
1261
1265
if ( flags2 & IRQ_FSK2_PACKETSENT_MASK ) {
1262
1266
// save exact tx time
1263
1267
LMIC .txend = now ;
@@ -1275,10 +1279,15 @@ void radio_irq_handler_v2 (u1_t dio, ostime_t now) {
1275
1279
// indicate timeout
1276
1280
LMIC .dataLen = 0 ;
1277
1281
} else {
1278
- ASSERT (0 );
1282
+ // ASSERT(0);
1283
+ // we're not sure why we're here... treat as timeout.
1284
+ LMIC .dataLen = 0 ;
1279
1285
}
1286
+
1287
+ // in FSK, we need to put the radio in standby first.
1288
+ opmode (OPMODE_STANDBY );
1280
1289
}
1281
- // go from stanby to sleep
1290
+ // go from standby to sleep
1282
1291
opmode (OPMODE_SLEEP );
1283
1292
// run os job (use preset func ptr)
1284
1293
os_setCallback (& LMIC .osjob , LMIC .osjob .func );
0 commit comments