<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Using the F macro in the presentation function]]></title><description><![CDATA[<p dir="auto">Since version 2.2 it has become possible to use the F( ) macro in a few more places. For example this would give an error in 2.1:</p>
<pre><code>void presentation()
{
  sendSketchInfo(F("SMS receiver"), F("1.6"));
}
</code></pre>
<p dir="auto">Arduino's compiler says this saves a bit of memory. Does it? Or is all the memory returned anyway once the presentation function is done?</p>
<p dir="auto">If not, then it would rock if it also becomes possible to use the macro in the present lines. This currently gives an error:</p>
<pre><code>  present(SMS_CHILD_ID, S_INFO, F("received sms"));
</code></pre>
<p dir="auto">Before I make a feature request I thought I'd ask here if this would actually save memory or not.</p>
]]></description><link>https://forum.mysensors.org/topic/9653/using-the-f-macro-in-the-presentation-function</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 23:43:51 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/9653.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Aug 2018 09:31:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Using the F macro in the presentation function on Tue, 28 Aug 2018 15:43:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alowhum" aria-label="Profile: alowhum">@<bdi>alowhum</bdi></a> yes that is correct</p>
]]></description><link>https://forum.mysensors.org/post/93011</link><guid isPermaLink="true">https://forum.mysensors.org/post/93011</guid><dc:creator><![CDATA[mfalkvidd]]></dc:creator><pubDate>Tue, 28 Aug 2018 15:43:21 GMT</pubDate></item><item><title><![CDATA[Reply to Using the F macro in the presentation function on Tue, 28 Aug 2018 13:16:37 GMT]]></title><description><![CDATA[<p dir="auto">I thought the F( ) macro told Arduino to not load the variable into ram permanently? That it would just re-load it from the flash whenever it needed it?</p>
]]></description><link>https://forum.mysensors.org/post/93004</link><guid isPermaLink="true">https://forum.mysensors.org/post/93004</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Tue, 28 Aug 2018 13:16:37 GMT</pubDate></item><item><title><![CDATA[Reply to Using the F macro in the presentation function on Tue, 28 Aug 2018 15:43:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alowhum" aria-label="Profile: alowhum">@<bdi>alowhum</bdi></a> when using the F macro, I think the (temporary) ram for the string will be allocated on the stack, so there will be no fragmentation. When not using the F macro, the string will be placed permanently in ram, so there will be no fragmentation.</p>
<p dir="auto">It could be that using the F macro for presentation causes problems inside the library, but it could also be as simple as nobody thought of adding support (or had enough time/energy to do it).</p>
]]></description><link>https://forum.mysensors.org/post/92969</link><guid isPermaLink="true">https://forum.mysensors.org/post/92969</guid><dc:creator><![CDATA[mfalkvidd]]></dc:creator><pubDate>Tue, 28 Aug 2018 15:43:55 GMT</pubDate></item><item><title><![CDATA[Reply to Using the F macro in the presentation function on Mon, 27 Aug 2018 19:59:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mfalkvidd" aria-label="Profile: mfalkvidd">@<bdi>mfalkvidd</bdi></a> thanks, I understand that. That's why I like using F( ) as much as possible, to save ram.</p>
<p dir="auto">That's why I would like to use it on the child descriptions too.</p>
<p dir="auto">But I suspected that the creators of MySensors to have already thought about this problem, and that I was just missing the obvious because of my limited knowledge. All I could think up though, was that the ram used by the child description strings is released.</p>
<p dir="auto">But I also remember how people don't like strings. And as far as I understand these child descriptions would be turned into strings at runtime? So they could (still) have a memory fragmenting effect?</p>
]]></description><link>https://forum.mysensors.org/post/92965</link><guid isPermaLink="true">https://forum.mysensors.org/post/92965</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Mon, 27 Aug 2018 19:59:40 GMT</pubDate></item><item><title><![CDATA[Reply to Using the F macro in the presentation function on Mon, 27 Aug 2018 10:44:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alowhum" aria-label="Profile: alowhum">@<bdi>alowhum</bdi></a> yes it saves ram (but not flash, to be clear - the term memory is often used for flash as well)</p>
<p dir="auto">When a sketch is executed on the microcontroller, all variables are normally loaded into ram, "locking" them there. The F macro prevents this, and only loads the text to ram temporarily when needed.</p>
<p dir="auto">More information: <a href="https://www.arduino.cc/reference/en/language/variables/utilities/progmem/" rel="nofollow ugc">https://www.arduino.cc/reference/en/language/variables/utilities/progmem/</a></p>
]]></description><link>https://forum.mysensors.org/post/92951</link><guid isPermaLink="true">https://forum.mysensors.org/post/92951</guid><dc:creator><![CDATA[mfalkvidd]]></dc:creator><pubDate>Mon, 27 Aug 2018 10:44:23 GMT</pubDate></item></channel></rss>