This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Mesh 2.0.1 on/off more than 2 servers

Hello.

  I try to modify ligh_switch_demo to switch state of 4 servers. I prepared 4 custom boards (server), one client and one provisioner. Provisioning was successful. I modified client code to switch 4 servers separatelly, but works only two of them (button1 and button2). Btn3 and btn4 turn on servers in group mode only one time (instead of singly many times). In next case, btn3 and btn4 return "Can not send. Device is busy." in case of btn3 and btn4.

Client modification:

static void button_event_handler(uint32_t button_number)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Button %u pressed\n", button_number);

    if (client_publication_configured())
    {
        uint32_t status = NRF_SUCCESS;
        switch (button_number)
        {
            case 0:
            case 1:
            case 2:
            case 3:
                /* send unicast message, with inverted GPIO pin value */
                status = simple_on_off_client_set(&m_clients[button_number], !hal_led_pin_get(BSP_LED_0 + button_number));
                __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "CLICK_!!\n");
            break;

//            case 2:
//            case 3:
//                /* send a group message to the ODD group, with inverted GPIO pin value */
//                status = simple_on_off_client_set_unreliable(&m_clients[button_number], !hal_led_pin_get(BSP_LED_0 + button_number), GROUP_MSG_REPEAT_COUNT);
//                hal_led_pin_set(BSP_LED_0 + button_number, !hal_led_pin_get(BSP_LED_0 + button_number));
//                break;
            default:
            break;

        }

        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Err:%u \n", status);

        if (status == NRF_ERROR_INVALID_STATE || status == NRF_ERROR_NO_MEM || status == NRF_ERROR_BUSY)
        {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Cannot send. Device is busy.\n");
            hal_led_blink_ms(LEDS_MASK, LED_BLINK_SHORT_INTERVAL_MS, LED_BLINK_CNT_NO_REPLY);
        }
        else
        {
            ERROR_CHECK(status);
        }
    }
    else
    {
        __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Ignored. Node is not configured.\n");
    }
}

What did I missed? Should I modified provisioning in somehow? 

Best regards.

PW

  

Related