Hi The Things forum!
Im using:
LoRaWAN MAC Version: 1.0.2 (revB)
MCCI LoRaWAN LMIC Library, version 4.1.
A device that sends one unconfirmed uplink with data hourly.
Problem:
The time it takes for an end device to realise that the uplink messages are not seen by the gateway is too long. There are 2 constants called LINK_CHECK_DEAD = 32 and LINK_CHECK_UNJOIN = 56.
I’m wondering if I could decrease these values so that the device could detect that info is not going through.
So that if (LMIC.adrAckReq > LINK_CHECK_DEAD) the device is increasing SF etc in an earlier stage. Is this solution something you would recommend or is there a smarter way?
Thank you!
This logic is currently implemented:
if( LMIC.adrAckReq > LINK_CHECK_DEAD ) {
// We haven't heard from NWK for some time although we
// asked for a response for some time - assume we're disconnected. Lower DR one notch.
EV(devCond, ERR, (e_.reason = EV::devCond_t::LINK_DEAD,
e_.eui = MAIN::CDEV->getEui(),
e_.info = LMIC.adrAckReq));
dr_t newDr = decDR((dr_t)LMIC.datarate);
// newDr must be feasible; there must be at least
// one channel that supports the new datarate. If not, stay
// at current datarate (which finalizes things).
if (! LMICbandplan_isDataRateFeasible(newDr)) {
LMICOS_logEventUint32("LINK_CHECK_DEAD, new DR not feasible", (newDr << 8) | LMIC.datarate);
newDr = LMIC.datarate;
}
if( newDr == (dr_t)LMIC.datarate) {
// We are already at the minimum datarate
// if the link is already marked dead, we need to join.
#if !defined(DISABLE_JOIN)
if ( LMIC.adrAckReq > LINK_CHECK_UNJOIN ) {
LMIC.opmode |= OP_UNJOIN;
}
#endif // !defined(DISABLE_JOIN)
} else if (newDr == LORAWAN_DR0) {
// the spec says: the ADRACKReq shall not be set if
// the device uses its lowest available data rate.
// (1.0.3, 4.3.1.1, line 458)
// We let the count continue to increase.
} else {
// we successfully lowered the data rate...
// reset so that we'll lower again after the next
// 32 uplinks.
setAdrAckCount(LINK_CHECK_CONT);
}
// Decrease DataRate and restore fullpower.
setDrTxpow(DRCHG_NOADRACK, newDr, pow2dBm(0));
// be careful only to report EV_LINK_DEAD once.
u2_t old_opmode = LMIC.opmode;
LMIC.opmode = old_opmode | OP_LINKDEAD;
if (LMIC.opmode != old_opmode)
reportEventNoUpdate(EV_LINK_DEAD); // update?
}