- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could anyone please suggest how to restore previous state of GPIO after power cycle in mesh OnOff server application code for CYW20706 based CYBT-343026 module. I have enabled this element .onpowerup_state = WICED_BT_MESH_ON_POWER_UP_STATE_RESTORE in the application code but it didn't work out for me.
State of GPIO (RELAY_GPIO_1), which I configured as output, should be switched by pressing On/Off button on the mobile application. I want to keep the same state (last status by mobile application) of RELAY_GPIO_1 after power goes off and comes back. In order to do that, I have used NVRAM function. Is there any other good way of doing this?
Please check the attachment for entire code written in Modustoolbox with 2.7 SDK release.
void mesh_onoff_server_process_status(uint8_t element_idx, wiced_bt_mesh_onoff_status_data_t *p_status)
{
wiced_result_t status;
uint8_t powerState = 0;
/* Write status change to NVRAM */
powerState = p_status->present_onoff;
wiced_hal_write_nvram( 0x05, 1, &powerState, &status );
/* Process relay with the status changed */
if(p_status->present_onoff)
{
wiced_hal_gpio_set_pin_output( RELAY_GPIO_1, GPIO_PIN_OUTPUT_HIGH);
}
else
{
wiced_hal_gpio_set_pin_output( RELAY_GPIO_1, GPIO_PIN_OUTPUT_LOW);
}
}
Regards,
NK
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The attached file seems to be empty.
Anyway, If it is for lighting application, I would suggest you to pick up more appropriate mesh application, something like mesh_light_lightness_server, where the generic power on/off server is already implemented. And then develop your functionality on top of it. You can try using light_dimmable demo app directly which is a complete demonstration (where the on board LED is being controlled from the mobile app) light_lightness_server mesh model.
Based on the other functionalities (e.g.color), you can try choosing other lighting mesh models as well (e.g. light_hsl_ctl_server) and develop on top of it..
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is for led lighting application, It should restore the last power state on/off after power cycle. Also, please let know whether present_onoff or target_onoff to be used in mesh_onoff_server_process_status.
Please check the attachment for entire code.
Regards,
NK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The attached file seems to be empty.
Anyway, If it is for lighting application, I would suggest you to pick up more appropriate mesh application, something like mesh_light_lightness_server, where the generic power on/off server is already implemented. And then develop your functionality on top of it. You can try using light_dimmable demo app directly which is a complete demonstration (where the on board LED is being controlled from the mobile app) light_lightness_server mesh model.
Based on the other functionalities (e.g.color), you can try choosing other lighting mesh models as well (e.g. light_hsl_ctl_server) and develop on top of it..
Thanks,
-Dheeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the suggestion.