NCS CAF leds modules can not receive power down event?

Hi,

    I use CAF leds modules in NCS. After click the button and led lights for 3.6 seconds, I submit power down event when double click button. As show in the following figure, led modules can receive power down event and set leds state to off.

case CLICK_SHORT:
    send_led_event(LED_ID_BLUE, &m_led_effect[LED_EFFECT_ID_DEVICE_ON]);
    break;

case CLICK_DOUBLE: {
    struct power_down_event *event = new_power_down_event();

    event->error = false;
    EVENT_SUBMIT(event);
}
break;

    Another situation, I submit led event and power dowen event after long press the button, I find led modules can't receive power down event.

case CLICK_LONG: {
    send_led_event(LED_ID_RED, &m_led_effect[LED_EFFECT_ID_DEVICE_ON]);

    struct power_down_event *event = new_power_down_event();
    event->error = false;
    EVENT_SUBMIT(event);
}
break;

Parents Reply
  • Hi Magdalena, 
    I got the feedback from the developer, it seems that new_force_power_down_event() is needed, instead of the new_power_down_event(). If you have a look here you can find that power_down_event should not be used in a module that not controls the power management and it's the final subscriber to the power down event. 

    * Only the module that controls the power management in the application can submit the power down event. It is also the final subscriber for the power down event. When it receives the power down event, it's ensured that all other application modules that handle power down event are already suspended. Then it can continue the power down procedure.

    I tried with the new_force_power_down_event() for CLICK_LONG and it seems to work. You need to include : 
    CONFIG_PM_POLICY_APP=y
    CONFIG_CAF_POWER_MANAGER=y

Children
Related