<?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>Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51743/mesh-set-ttl-per-message</link><description>As in another post , I was looking for a way to change the TTL per message. Is there a reason that it can only be changed per model? I can imagine the TTL being part of the access_message_tx_t , or as optional arg in access_model_publish() , as at some</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 04 Sep 2019 12:58:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51743/mesh-set-ttl-per-message" /><item><title>RE: Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/thread/207974?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 12:58:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bd0863b-114c-4631-9943-c4b551ab8aa5</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Another way I to implement, is by overiding the &lt;em&gt;nrf_mesh_relay_check_cb_t&lt;/em&gt; and stop relaying before TTL reaches 0, for certain message types. Does that have any downsides?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/thread/207970?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 12:50:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52f04d98-53b0-44ad-9c6a-50cb216d3476</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Aha, didn&amp;#39;t know that the ACCESS_INTERNAL_STATE_IS_OUTDATED() means it gets stored to flash.&lt;/p&gt;
&lt;p&gt;Thanks for the tip, will give it a try :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/thread/207964?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 12:47:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c9e4de4-4816-499b-8533-3e0d29c12111</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Just check what&amp;nbsp;&lt;em&gt;access_model_publish_ttl_set()&lt;/em&gt; returns. You can see what the return values mean &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.meshsdk.v3.2.0%2Fgroup__ACCESS__CONFIG__MODEL.html&amp;amp;anchor=gabdfc114b03f0ca6744fbb8892f3ee725" rel="noopener noreferrer" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It looks like it does store these changes using the&amp;nbsp;ACCESS_INTERNAL_STATE_IS_OUTDATED() and&amp;nbsp;element_store() in&amp;nbsp;access_flash_config_store().&lt;/p&gt;
&lt;p&gt;This means that every time you change this, it will store this in flash. If you do this many (!) times, it will wear out the flash. The number of guaranteed flash write cycles is 10000, which you can see &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fabs_max_ratings.html&amp;amp;anchor=abs_max_ratings"&gt;here&lt;/a&gt;(nRF52832)&amp;nbsp;or &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Fnvmc.html&amp;amp;anchor=unique_156661312" rel="noopener noreferrer" target="_blank"&gt;here&lt;/a&gt;(nRF52840).&lt;/p&gt;
&lt;p&gt;Note that one write is not one cycle. The Mesh SDK uses the flash manager which will write to a free space in the flash, and when it is full, it will erase all outdated entries, and this counts as one cycle.&lt;/p&gt;
&lt;p&gt;If you want to change the TTL temporary without saving this setting in flash, you may look into implementing a function that changes m_default_ttl,&amp;nbsp;and doesn&amp;#39;t save this to flash. Note that changing m_default_ttl will change the ttl for all models that uses ttl =&amp;nbsp;ACCESS_TTL_USE_DEFAULT.&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/thread/207942?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 12:20:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac425ab5-e16d-4a21-84c4-9589ae7614bb</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;Went a bit through the code, and indeed noticed the TTL is added pretty far from the &lt;em&gt;access_model_publish&lt;/em&gt;() call.&lt;/p&gt;
&lt;p&gt;So calling &lt;em&gt;access_model_publish_ttl_set&lt;/em&gt;() a lot doesn&amp;#39;t hurt? It looks like it invalidates some cache or so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Mesh set TTL per message.</title><link>https://devzone.nordicsemi.com/thread/207920?ContentTypeID=1</link><pubDate>Wed, 04 Sep 2019 11:42:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a31e78e-8629-4f2f-880e-a0f96b75c67f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Yes. You can set the TTL for a model by using access_model_publish_ttl_set(). Remember that this will set it for all messages in this model, so if you just want to send one message with a specific TTL, then you need to set it back after this.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""] Is there a reason that it can only be changed per model?[/quote]
&lt;p&gt;&amp;nbsp;The reason is that packet_tx() uses&amp;nbsp;TTL&amp;nbsp;fetched from the model handle, if it is not set to&amp;nbsp;ACCESS_TTL_USE_DEFAULT. If the TTL is set to ACCES_TTL_USE_DEFAULT, it uses the m_default_ttl, which is set to&amp;nbsp;ACCESS_DEFAULT_TTL. You can set this to something else than 4 if you want to. Or if you want to change the TTL of all models, then you can implement&amp;nbsp;some API that changes m_default_ttl.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>