This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BasicRF点对点控制LED灯开关例程中,增加light设备个数后传输距离降低很多。

Other Parts Discussed in Thread: CC2530, CC2420

在light_switch-srf05_cc2530的例程中。原本是一个switch控制一个light。

我尝试着增加了switch的个数和对应的light设备个数进行led开关控制。

发现传输距离短了很多。不知道是不是哪里的配置需要做出相应的调整?

下面给出修改后的appSwitch()函数,

static void appSwitch()
{
 //   halLcdWriteLine(HAL_LCD_LINE_1, "Switch");
  //  halLcdWriteLine(HAL_LCD_LINE_2, "Joystick Push");
  //  halLcdWriteLine(HAL_LCD_LINE_3, "Send Command");
  int a=0,b=0,c=0,d=0;
  InitKeyswi();
#ifdef ASSY_EXP4618_CC2420
    halLcdClearLine(1);
    halLcdWriteSymbol(HAL_LCD_SYMBOL_TX, 1);
#endif
    pTxData[0] = LIGHT_TOGGLE_CMD;
    // Initialize BasicRF
    basicRfConfig.myAddr = SWITCH_ADDR;
    if(basicRfInit(&basicRfConfig)==FAILED) {
      HAL_ASSERT(FALSE);
    }
    // Keep Receiver off when not needed to save power
    basicRfReceiveOff();
    // Main loop
    while (TRUE) {
      //  if( halJoystickPushed() ) {  //bu qiujie tech
      a=KeyScan1();
      b=KeyScan2();
      c=KeyScan3();
      d=KeyScan4();
      if(a){
            basicRfSendPacket(LIGHT_ADDR1, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
        }
       if(b){
            basicRfSendPacket(LIGHT_ADDR2, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
        }
       if(c){
            basicRfSendPacket(LIGHT_ADDR3, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
        }
      if(d){
basicRfSendPacket(LIGHT_ADDR1, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
           
            basicRfSendPacket(LIGHT_ADDR2, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
            basicRfSendPacket(LIGHT_ADDR3, pTxData, APP_PAYLOAD_LENGTH);
            // Put MCU to sleep. It will wake up on joystick interrupt
            halIntOff();
            halMcuSetLowPowerMode(HAL_MCU_LPM_3); // Will turn on global
            // interrupt enable
            halIntOn();
        }
    }
}