@@ -2076,13 +2076,16 @@ static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t comm
20762076 chParam .Rx1Frequency = 0 ;
20772077 chParam .DrRange .Value = payload [macIndex ++ ];
20782078
2079- status = RegionNewChannelReq ( MacCtx .NvmCtx -> Region , & newChannelReq );
2079+ status = ( uint8_t ) RegionNewChannelReq ( MacCtx .NvmCtx -> Region , & newChannelReq );
20802080
2081- macCmdPayload [0 ] = status ;
2082- LoRaMacCommandsAddCmd ( MOTE_MAC_NEW_CHANNEL_ANS , macCmdPayload , 1 );
2083- if ( status == 0x03 )
2081+ if ( ( int8_t )status >= 0 )
20842082 {
2085- EventRegionNvmCtxChanged ( );
2083+ macCmdPayload [0 ] = status ;
2084+ LoRaMacCommandsAddCmd ( MOTE_MAC_NEW_CHANNEL_ANS , macCmdPayload , 1 );
2085+ if ( status == 0x03 )
2086+ {
2087+ EventRegionNvmCtxChanged ( );
2088+ }
20862089 }
20872090 break ;
20882091 }
@@ -2152,14 +2155,18 @@ static void ProcessMacCommands( uint8_t *payload, uint8_t macIndex, uint8_t comm
21522155 dlChannelReq .Rx1Frequency |= ( uint32_t ) payload [macIndex ++ ] << 16 ;
21532156 dlChannelReq .Rx1Frequency *= 100 ;
21542157
2155- status = RegionDlChannelReq ( MacCtx .NvmCtx -> Region , & dlChannelReq );
2156- macCmdPayload [0 ] = status ;
2157- LoRaMacCommandsAddCmd ( MOTE_MAC_DL_CHANNEL_ANS , macCmdPayload , 1 );
2158- // Setup indication to inform the application
2159- SetMlmeScheduleUplinkIndication ( );
2160- if ( status == 0x03 )
2158+ status = ( uint8_t )RegionDlChannelReq ( MacCtx .NvmCtx -> Region , & dlChannelReq );
2159+
2160+ if ( ( int8_t )status >= 0 )
21612161 {
2162- EventRegionNvmCtxChanged ( );
2162+ macCmdPayload [0 ] = status ;
2163+ LoRaMacCommandsAddCmd ( MOTE_MAC_DL_CHANNEL_ANS , macCmdPayload , 1 );
2164+ // Setup indication to inform the application
2165+ SetMlmeScheduleUplinkIndication ( );
2166+ if ( status == 0x03 )
2167+ {
2168+ EventRegionNvmCtxChanged ( );
2169+ }
21632170 }
21642171 break ;
21652172 }
0 commit comments