<?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[Expanding the size of an existing array?]]></title><description><![CDATA[<p dir="auto">After a lot of pulling hairs, I realised that the SoftwareSerial library has a hard coded 64 byte RX buffer.</p>
<p dir="auto">I originally thought I could do something like:</p>
<pre><code>#define _SS_MAX_RX_BUFF 255                         // Override the define to increase the buffer size
#include &lt;SoftwareSerial.h&gt;                                // Load the library code
SoftwareSerial softSerial1(GSM_RECEIVE_PIN,GSM_TRANSMIT_PIN); // Create the software serial object, hopefully with a bigger than normal buffer
</code></pre>
<p dir="auto">(updated the code to reflect that the <code>#define</code> came first)</p>
<p dir="auto">I assumed that other libraries would work like MySensors, and I could override this value. But it seems this override doesn't work.</p>
<p dir="auto">Now I could hardcode the bigger size into the library. But I was wondering: is there a way to do this without modifying the library code itself? Can I, for example, increase the size of the buffer after it's been created somehow?</p>
]]></description><link>https://forum.mysensors.org/topic/10977/expanding-the-size-of-an-existing-array</link><generator>RSS for Node</generator><lastBuildDate>Thu, 13 Aug 2026 15:08:26 GMT</lastBuildDate><atom:link href="https://forum.mysensors.org/topic/10977.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 Feb 2020 10:57:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Expanding the size of an existing array? on Mon, 02 Mar 2020 16:24:33 GMT]]></title><description><![CDATA[<p dir="auto">I think - am not sure - because you only include mysensors.h, which is only a header file without cpp files.</p>
]]></description><link>https://forum.mysensors.org/post/104161</link><guid isPermaLink="true">https://forum.mysensors.org/post/104161</guid><dc:creator><![CDATA[electrik]]></dc:creator><pubDate>Mon, 02 Mar 2020 16:24:33 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Sat, 29 Feb 2020 22:11:41 GMT]]></title><description><![CDATA[<p dir="auto">Ah, so that's it!</p>
<p dir="auto">So then is MySensors a special case? How is it possible that #defines in the sketch work for MySensors?</p>
]]></description><link>https://forum.mysensors.org/post/104129</link><guid isPermaLink="true">https://forum.mysensors.org/post/104129</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Sat, 29 Feb 2020 22:11:41 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Fri, 28 Feb 2020 04:38:29 GMT]]></title><description><![CDATA[<p dir="auto">I think this is your issue.</p>
<p dir="auto">If your "libraries" are truly libraries (i.e. - they consist of a .h file and a .cpp file), then they get compiled separately from the .ino, so they will never see ANY #defines you put in the .ino.  The compiled libraries and compiled .ino file are joined only a link time, LONG after the #defines have been tossed away.  If you want both the sketch and one or more libraries to "see" #defines, then those #defines must be defined in a separate .h file that is #included into both the sketch AND the libraries.</p>
<p dir="auto">From:</p>
<p dir="auto"><a href="https://forum.arduino.cc/index.php?topic=445646.0" rel="nofollow ugc">https://forum.arduino.cc/index.php?topic=445646.0</a></p>
]]></description><link>https://forum.mysensors.org/post/104088</link><guid isPermaLink="true">https://forum.mysensors.org/post/104088</guid><dc:creator><![CDATA[electrik]]></dc:creator><pubDate>Fri, 28 Feb 2020 04:38:29 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Thu, 27 Feb 2020 20:36:19 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/electrik" aria-label="Profile: electrik">@<bdi>electrik</bdi></a> I'll have to test that. But there is only one file in my project, so..</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yveaux" aria-label="Profile: Yveaux">@<bdi>Yveaux</bdi></a> I tried that too (well, 256 and 128), but no effect.</p>
<p dir="auto">The full code (with built in software serial..) is now on Github:<br />
<a href="https://github.com/createcandle/Devices/blob/master/Smart_lock/Smart_lock.ino" rel="nofollow ugc">https://github.com/createcandle/Devices/blob/master/Smart_lock/Smart_lock.ino</a></p>
]]></description><link>https://forum.mysensors.org/post/104083</link><guid isPermaLink="true">https://forum.mysensors.org/post/104083</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Thu, 27 Feb 2020 20:36:19 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Thu, 27 Feb 2020 07:42:02 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> I didn't check the code, but could the value of 255 cause an issue? Eg does it work when set to 200, or even 127?</p>
]]></description><link>https://forum.mysensors.org/post/104056</link><guid isPermaLink="true">https://forum.mysensors.org/post/104056</guid><dc:creator><![CDATA[Yveaux]]></dc:creator><pubDate>Thu, 27 Feb 2020 07:42:02 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Thu, 27 Feb 2020 06:45:54 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> said in <a href="/post/104049">Expanding the size of an existing array?</a>:</p>
<blockquote>
<p dir="auto">It's all a one-file sketch.</p>
</blockquote>
<p dir="auto">Even it is only one file, the file can be included from other locations also. So is this <code>#include &lt;SoftwareSerial.h&gt;</code> also in other files inside your project?</p>
<p dir="auto">you can also check it by adding this before your define. If the compiler gives an error, this define is used somewhere already.</p>
<pre><code>#ifdef _SS_MAX_RX_BUFF
  #error "_SS_MAX_RX_BUFF defined already"
#endif
</code></pre>
]]></description><link>https://forum.mysensors.org/post/104053</link><guid isPermaLink="true">https://forum.mysensors.org/post/104053</guid><dc:creator><![CDATA[electrik]]></dc:creator><pubDate>Thu, 27 Feb 2020 06:45:54 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 20:51:48 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Perhaps the define is used in another place somewhere in your project also</p>
</blockquote>
<p dir="auto">I explored that too, but it's really not. It's all a one-file sketch.</p>
<p dir="auto">I have now embedded the entire software serial code in my code. It works now, even though it's unsightly.</p>
<p dir="auto">This hasn't been cleaned, but it might be interesting. It's upgraded code for the <a href="https://www.candlesmarthome.com/smart-lock" rel="nofollow ugc">Candle Smart Lock</a>, which can also be triggered via SMS (and this feature can be toggled).</p>
<pre><code>Apparently the code is too long to post
</code></pre>
]]></description><link>https://forum.mysensors.org/post/104049</link><guid isPermaLink="true">https://forum.mysensors.org/post/104049</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Wed, 26 Feb 2020 20:51:48 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 18:11:12 GMT]]></title><description><![CDATA[<p dir="auto">Perhaps the define is used in another place somewhere in your project also, which overrides yours. You could force it in the header file, or find the other define and change that</p>
]]></description><link>https://forum.mysensors.org/post/104042</link><guid isPermaLink="true">https://forum.mysensors.org/post/104042</guid><dc:creator><![CDATA[electrik]]></dc:creator><pubDate>Wed, 26 Feb 2020 18:11:12 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 17:04: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>  oki.<br />
well I've no time to take a look, and not really a fan of softwareserial.. I just noticed the inversion in your 1st post<br />
So I guess you have few options if you can't find the solution:</p>
<ul>
<li>change in lib (define, or constructor)</li>
<li>handle your own buffer in your sketch if you don't want to make changes to the lib</li>
</ul>
]]></description><link>https://forum.mysensors.org/post/104038</link><guid isPermaLink="true">https://forum.mysensors.org/post/104038</guid><dc:creator><![CDATA[scalz]]></dc:creator><pubDate>Wed, 26 Feb 2020 17:04:23 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 15:40:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/scalz" aria-label="Profile: scalz">@<bdi>scalz</bdi></a> Yes, you're right. That was how I had it originally (similar to how it works with mySensors), but that also doesn't work.</p>
]]></description><link>https://forum.mysensors.org/post/104035</link><guid isPermaLink="true">https://forum.mysensors.org/post/104035</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Wed, 26 Feb 2020 15:40:18 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 15:38:49 GMT]]></title><description><![CDATA[<p dir="auto">I checked the IDE, and it also has the correct code:</p>
<pre><code>#ifndef _SS_MAX_RX_BUFF
#define _SS_MAX_RX_BUFF 64 // RX buffer size
#endif
</code></pre>
<p dir="auto">If I print out the value of <code>_SS_MAX_RX_BUFF</code> in the setup, then it shows the increased value.</p>
<p dir="auto">What could be causing this?</p>
]]></description><link>https://forum.mysensors.org/post/104034</link><guid isPermaLink="true">https://forum.mysensors.org/post/104034</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Wed, 26 Feb 2020 15:38:49 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 13:26:55 GMT]]></title><description><![CDATA[<p dir="auto">not tried, but this should work better with the define before the include</p>
<pre><code>#define _SS_MAX_RX_BUFF 255                         // Override the define to increase the buffer size
#include &lt;SoftwareSerial.h&gt;                                // Load the library code
SoftwareSerial softSerial1(GSM_RECEIVE_PIN,GSM_TRANSMIT_PIN); // Create the software serial object, hopefully with a bigger than normal buffer
</code></pre>
]]></description><link>https://forum.mysensors.org/post/104032</link><guid isPermaLink="true">https://forum.mysensors.org/post/104032</guid><dc:creator><![CDATA[scalz]]></dc:creator><pubDate>Wed, 26 Feb 2020 13:26:55 GMT</pubDate></item><item><title><![CDATA[Reply to Expanding the size of an existing array? on Wed, 26 Feb 2020 11:43:44 GMT]]></title><description><![CDATA[<p dir="auto">Trying some things.</p>
<pre><code>#include &lt;SoftwareSerial.h&gt;
char SoftwareSerial::_receive_buffer[255];
</code></pre>
<p dir="auto">Results in <code>error: conflicting declaration</code></p>
<p dir="auto">Strange, looking at the <a href="https://github.com/arduino/ArduinoCore-avr/blob/0e7fae85bdfbab43242374c0289cdd806d13b0bc/libraries/SoftwareSerial/src/SoftwareSerial.h#L42" rel="nofollow ugc">official code</a>, it <em>should</em> support user overrides of this value.</p>
]]></description><link>https://forum.mysensors.org/post/104030</link><guid isPermaLink="true">https://forum.mysensors.org/post/104030</guid><dc:creator><![CDATA[alowhum]]></dc:creator><pubDate>Wed, 26 Feb 2020 11:43:44 GMT</pubDate></item></channel></rss>