@@ -2155,13 +2155,16 @@ static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t comm
21552155 chParam .Rx1Frequency = 0 ;
21562156 chParam .DrRange .Value = payload [macIndex ++ ];
21572157
2158- status = RegionNewChannelReq ( MacCtx .NvmCtx -> Region , & newChannelReq );
2158+ status = ( uint8_t ) RegionNewChannelReq ( MacCtx .NvmCtx -> Region , & newChannelReq );
21592159
2160- macCmdPayload [0 ] = status ;
2161- LoRaMacCommandsAddCmd ( MOTE_MAC_NEW_CHANNEL_ANS , macCmdPayload , 1 );
2162- if ( status == 0x03 )
2160+ if ( ( int8_t )status >= 0 )
21632161 {
2164- EventRegionNvmCtxChanged ( );
2162+ macCmdPayload [0 ] = status ;
2163+ LoRaMacCommandsAddCmd ( MOTE_MAC_NEW_CHANNEL_ANS , macCmdPayload , 1 );
2164+ if ( status == 0x03 )
2165+ {
2166+ EventRegionNvmCtxChanged ( );
2167+ }
21652168 }
21662169 break ;
21672170 }
@@ -2231,14 +2234,18 @@ static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t comm
22312234 dlChannelReq .Rx1Frequency |= ( uint32_t ) payload [macIndex ++ ] << 16 ;
22322235 dlChannelReq .Rx1Frequency *= 100 ;
22332236
2234- status = RegionDlChannelReq ( MacCtx .NvmCtx -> Region , & dlChannelReq );
2235- macCmdPayload [0 ] = status ;
2236- LoRaMacCommandsAddCmd ( MOTE_MAC_DL_CHANNEL_ANS , macCmdPayload , 1 );
2237- // Setup indication to inform the application
2238- SetMlmeScheduleUplinkIndication ( );
2239- if ( status == 0x03 )
2237+ status = ( uint8_t )RegionDlChannelReq ( MacCtx .NvmCtx -> Region , & dlChannelReq );
2238+
2239+ if ( ( int8_t )status >= 0 )
22402240 {
2241- EventRegionNvmCtxChanged ( );
2241+ macCmdPayload [0 ] = status ;
2242+ LoRaMacCommandsAddCmd ( MOTE_MAC_DL_CHANNEL_ANS , macCmdPayload , 1 );
2243+ // Setup indication to inform the application
2244+ SetMlmeScheduleUplinkIndication ( );
2245+ if ( status == 0x03 )
2246+ {
2247+ EventRegionNvmCtxChanged ( );
2248+ }
22422249 }
22432250 break ;
22442251 }
0 commit comments