<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71645/how-with-nrf52840-to-send-a-request-on-power-on</link><description>Greetings! Сould you help me to solve the difficulty with your DK? I have an idea to connect two boards with Mesh Light Control and Mesh Light Switch, and have the Client board send a request to turn on the LED on the Server board when power is applied</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 08 Mar 2021 10:15:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71645/how-with-nrf52840-to-send-a-request-on-power-on" /><item><title>RE: How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/thread/298310?ContentTypeID=1</link><pubDate>Mon, 08 Mar 2021 10:15:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a0fd950-050d-46ba-89b3-f680529fee0e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;When you call an API please always check for the return error value.&amp;nbsp;&lt;br /&gt;Note that the provisioning setting and the model configuration is loaded via&amp;nbsp;settings_load() call. By doing that the value of buttons[] array inside model_handler.c is restored. You should use the buttons[] array that declared in model_handler.c instead of declare your own buttons array in main.c which has no value at all.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What you can do is to make a function inside model_handler.c that call the function&amp;nbsp;bt_mesh_onoff_cli_set_unack() and use the buttons[].clients inside that. Then in main.c you call that function after settings_load().&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/thread/297971?ContentTypeID=1</link><pubDate>Fri, 05 Mar 2021 08:34:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf56359d-c2af-4b78-a987-bade1a67a8db</guid><dc:creator>Neutrino</dc:creator><description>&lt;p&gt;Good afternoon!&lt;br /&gt;&lt;br /&gt;I apologize for the long answer, it was a business trip. I using a standard nrf52840DK, and version nrf connect SDK 1.4.2.&lt;/p&gt;
&lt;p&gt;So far I have not been able to solve the problem, so I tried to attach files with projects for both boards, perhaps you could help me.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mesh.zip"&gt;devzone.nordicsemi.com/.../mesh.zip&lt;/a&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/thread/296220?ContentTypeID=1</link><pubDate>Thu, 25 Feb 2021 11:20:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c458dde5-4e3b-4d21-aac3-72bbbc4a7e01</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which hardware are you using to test ? Please try to test using on our DK. It&amp;#39;s preferred to test mesh with nRF52 board as the nRF53 may not fully supported with mesh.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Please show how you called it inside bt_ready(). You should call it after&amp;nbsp;bt_mesh_prov_enable() function.&amp;nbsp;&lt;br /&gt;Please try to send a fix dummy data first , you don&amp;#39;t need to read the button inside that.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/thread/296071?ContentTypeID=1</link><pubDate>Wed, 24 Feb 2021 14:56:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88f2a7f5-cf0c-4016-9b38-28dfecde2ef3</guid><dc:creator>Neutrino</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;I tried to do it according to your advice. In &lt;strong&gt;model_handler.c&lt;/strong&gt; I added code like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;if (!bt_mesh_is_provisioned()) {
struct bt_mesh_onoff_set set = {
.on_off = !buttons[0].status,
};
int err;

err = bt_mesh_onoff_cli_set_unack(&amp;amp;buttons[0].client,
NULL, &amp;amp;set.on_off);
}

for (int i = 0; i &amp;lt; 4; ++i) {
if (!(pressed &amp;amp; changed &amp;amp; BIT(i))) {
continue;
}

struct bt_mesh_onoff_set set = {
.on_off = !buttons[i].status,
};
int err;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;After that I called that function in &lt;strong&gt;main.c,&amp;nbsp;&lt;/strong&gt;inside&amp;nbsp;&lt;strong&gt;bt_ready(),&amp;nbsp;&lt;/strong&gt;and nothing has changed.&amp;nbsp;I understand that there may be an error somewhere here, but I also had problems with the boards, which sometimes, without changes in the code, stop connecting to each other and the phone. So I would like to ask you what could be the reason for the boards to disconnect spontaneously, and how I can fix the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How with NRF52840 to send a request on power-on</title><link>https://devzone.nordicsemi.com/thread/294794?ContentTypeID=1</link><pubDate>Wed, 17 Feb 2021 10:29:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6d0931d-27bb-4036-abbe-d9c2ef11006d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Denisov,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you got a look at the description of the function in gen_onoff.h :&amp;nbsp;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;/** @brief Set the OnOff state in the srv without requesting a response.
 *
 * @param[in] cli Client model to send on.
 * @param[in] ctx Message context, or NULL to use the configured publish
 * parameters.
 * @param[in] set New OnOff parameters to set. @p set::transition can either
 * point to a transition structure, or be left to NULL to use the default
 * transition parameters on the server.
 *
 * @retval 0 Successfully sent the message.
 * @retval -ENOTSUP A message context was not provided and publishing is not
 * supported.
 * @retval -EADDRNOTAVAIL A message context was not provided and publishing is
 * not configured.
 * @retval -EAGAIN The device has not been provisioned.
 */
int bt_mesh_onoff_cli_set_unack(struct bt_mesh_onoff_cli *cli,
				struct bt_mesh_msg_ctx *ctx,
				const struct bt_mesh_onoff_set *set);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So what you need to provide to the function is the client that you want to use to send the command. And the third parameter is the Generic on off command.&amp;nbsp;&lt;br /&gt;If you want to call this function when it&amp;#39;s turned on, you can add an extra function to call it in side model_handler.c and then call the function inside bt_ready() for example , right before the printing of &amp;quot;Mesh initialized&amp;quot; . You may need to check if the device is provisioned or not,&amp;nbsp;similar to what inside the button_handler_cb().&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>