Adding support for India ISM Band.
Fork of LoRaWAN-lib by
Diff: LoRaMac.cpp
- Revision:
- 5:77f44e83b37d
- Parent:
- 4:06708c793508
--- a/LoRaMac.cpp Thu Mar 31 16:05:20 2016 +0000 +++ b/LoRaMac.cpp Fri Apr 01 05:09:17 2016 +0000 @@ -282,7 +282,7 @@ /*! * Tx output powers table definition */ -const int8_t TxPowers[] = { 27, 20, 14, 11, 8, 5, 2 }; //Added by SP 31.03.2016 +const int8_t TxPowers[] = { /*27,*/ 20, 14, 11, 8, 5, 2 }; //Added by SP 31.03.2016 /*! * LoRaMac bands @@ -290,12 +290,6 @@ static Band_t Bands[LORA_MAX_NB_BANDS] = { BAND0, - /* - BAND1, - BAND2, - BAND3, - BAND4, -*/ }; /*! @@ -1417,7 +1411,7 @@ } else { -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) // Re-enable default channels LC1, LC2, LC3 ChannelsMask[0] = ChannelsMask[0] | ( LC( 1 ) + LC( 2 ) + LC( 3 ) ); #elif defined( USE_BAND_915 ) @@ -1508,7 +1502,7 @@ Radio.Standby( ); } -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined ( USE_BAND_865 ) datarate = ChannelsDatarate - Rx1DrOffset; if( datarate < 0 ) { @@ -1554,7 +1548,7 @@ TimerStop( &RxWindowTimer2 ); RxSlot = 1; -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) // For higher datarates, we increase the number of symbols generating a Rx Timeout if( Rx2Channel.Datarate >= DR_3 ) { // DR_6, DR_5, DR_4, DR_3 @@ -1756,7 +1750,7 @@ // Store downlink datarate McpsIndication.RxDatarate = ( uint8_t ) datarate; -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( datarate == DR_7 ) { modem = MODEM_FSK; @@ -1909,7 +1903,7 @@ { if( ( ( AdrAckCounter - ADR_ACK_DELAY ) % ADR_ACK_LIMIT ) == 0 ) { -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( datarate > LORAMAC_MIN_DATARATE ) { datarate--; @@ -2099,7 +2093,7 @@ { nbRep = 1; } -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( ( chMaskCntl == 0 ) && ( chMask == 0 ) ) { status &= 0xFE; // Channel mask KO @@ -2416,7 +2410,7 @@ // Set the default datarate ChannelsDatarate = ChannelsDefaultDatarate; -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) // Re-enable default channels LC1, LC2, LC3 ChannelsMask[0] = ChannelsMask[0] | ( LC( 1 ) + LC( 2 ) + LC( 3 ) ); #endif @@ -2601,7 +2595,7 @@ Radio.SetChannel( channel.Frequency ); -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( ChannelsDatarate == DR_7 ) { // High Speed FSK channel Radio.SetMaxPayloadLength( MODEM_FSK, LoRaMacBufferPktLen ); @@ -2687,6 +2681,8 @@ ChannelsMask[0] = LC( 1 ) + LC( 2 ) + LC( 3 ); #elif defined( USE_BAND_780 ) ChannelsMask[0] = LC( 1 ) + LC( 2 ) + LC( 3 ); +#elif defined( USE_BAND_865 ) + ChannelsMask[0] = LC( 1 ) + LC( 2 ) + LC( 3 ); #elif defined( USE_BAND_868 ) ChannelsMask[0] = LC( 1 ) + LC( 2 ) + LC( 3 ); #elif defined( USE_BAND_915 ) @@ -2742,6 +2738,8 @@ DutyCycleOn = false; #elif defined( USE_BAND_780 ) DutyCycleOn = false; +#elif defined( USE_BAND_865 ) + DutyCycleOn = true; #elif defined( USE_BAND_868 ) DutyCycleOn = true; #elif defined( USE_BAND_915 ) || defined( USE_BAND_915_HYBRID ) @@ -3208,7 +3206,7 @@ datarateInvalid = true; } -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( id < 3 ) { if( params.Frequency != Channels[id].Frequency ) @@ -3286,7 +3284,7 @@ LoRaMacStatus_t LoRaMacChannelRemove( uint8_t id ) { -#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) +#if defined( USE_BAND_433 ) || defined( USE_BAND_780 ) || defined( USE_BAND_868 ) || defined( USE_BAND_865 ) if( ( LoRaMacState & MAC_TX_RUNNING ) == MAC_TX_RUNNING ) { if( ( LoRaMacState & MAC_TX_CONFIG ) != MAC_TX_CONFIG )