src/lmic/lmic_in866.c
///
/// \brief change the TX channel given the desired tx time.
///
/// \param [in] now is the time at which we want to transmit. In fact, it's always
///     the current time.
///
/// \returns the actual time at which we can transmit. \c LMIC.txChnl is set to the
///     selected channel.
///
/// \details
///     We scan all the bands, creating a mask of all enabled channels that are
///     feasible at the earliest possible time. We then randomly choose one from
///     that, updating the shuffle mask.
///
///     Since there's no duty cycle limitation, and no dwell limitation,
///     we just choose a channel from the shuffle and return the current time.
///
\brief change the TX channel given the desired tx time.
\param [in] now is the time at which we want to transmit. In fact, it's always
the current time.

\returns the actual time at which we can transmit. \c LMIC.txChnl is set to the
selected channel.

\details
We scan all the bands, creating a mask of all enabled channels that are
feasible at the earliest possible time. We then randomly choose one from
that, updating the shuffle mask.

Since there's no duty cycle limitation, and no dwell limitation,
we just choose a channel from the shuffle and return the current time.
\ brief change the TX channel given the desired tx time . \ param [ in ] now is the time at which we want to transmit . In fact it ' s always the current time . \ returns the actual time at which we can transmit . \ c LMIC . txChnl is set to the selected channel . \ details We scan all the bands creating a mask of all enabled channels that are feasible at the earliest possible time . We then randomly choose one from that updating the shuffle mask . Since there ' s no duty cycle limitation and no dwell limitation we just choose a channel from the shuffle and return the current time .
ostime_t LMICin866_nextTx(ostime_t now) {
        uint16_t availmask;
        availmask = 0;
        for (u1_t chnl = 0; chnl < MAX_CHANNELS; ++chnl) {
                if ((LMIC.channelMap & (1 << chnl)) == 0)
                        continue;
                if ((LMIC.channelDrMap[chnl] & (1 << (LMIC.datarate & 0xF))) == 0)
                        continue;
                availmask |= 1 << chnl;
        }
        int candidateCh = LMIC_findNextChannel(&LMIC.channelShuffleMap, &availmask, 1, LMIC.txChnl == 0xFF ? -1 : LMIC.txChnl);
        if (candidateCh >= 0) {
                LMIC.txChnl = candidateCh;
        }
        return now;
}
ostime_t LMICin866_nextTx ( ostime_t now ) { uint16_t availmask ; availmask = 0 ; for ( u1_t chnl = 0 ; chnl < MAX_CHANNELS ; ++ chnl ) { if ( ( LMIC . channelMap & ( 1 << chnl ) ) == 0 ) continue ; if ( ( LMIC . channelDrMap [ chnl ] & ( 1 << ( LMIC . datarate & 0xF ) ) ) == 0 ) continue ; availmask |= 1 << chnl ; } int candidateCh = LMIC_findNextChannel ( & LMIC . channelShuffleMap , & availmask , 1 , LMIC . txChnl == 0xFF ? -1 : LMIC . txChnl ) ; if ( candidateCh >= 0 ) { LMIC . txChnl = candidateCh ; } return now ; }
\brief change the TX channel given the desired tx time.
\ brief change the TX channel given the desired tx time .
// scan all the enabled channels and make a mask of candidates // not enabled? // not feasible? // now: calculate the mask // update the channel.