<div dir="ltr"><div>MSVC++ is C++ but with .NET bindings so it's managed code. You'll be able to pull primitive snippets out of it but will run into trouble when they start initializing .NET objects as you'll have to pull layers of .NET code out to get it to compile in another OS.</div><div><br></div><div>-C<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Dec 15, 2019 at 2:08 PM Rick Hornsby <<a href="mailto:richardjhornsby@gmail.com">richardjhornsby@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Dec 14, 2019, at 13:35, Mike Schoenborn <<a href="mailto:rtfm@columbus.rr.com" target="_blank">rtfm@columbus.rr.com</a>> wrote:<br>
> <br>
> On Thu, 12 Dec 2019 21:23:32 -0800<br>
> Rick Hornsby <<a href="mailto:richardjhornsby@gmail.com" target="_blank">richardjhornsby@gmail.com</a>> wrote:<br>
> <br>
>> There’s no way the code should be this primitive … or better put,<br>
>> dumb?<br>
> <br>
> Something less "primitive" and something you may have experience<br>
> using with Python/Ruby is JSON, or for this case "ArduinoJson".<br>
<br>
Sorry, I didn’t mean to imply C++ was primitive. It is a lower level (closer to the metal) language for sure, but the _implementation_ stub I included in the OP seems caveman primitive and ugly to me.<br>
<br>
> Your processor may experience a small performance hit, but your<br>
> programming efforts will likely experience a performance benefit.<br>
> <br>
> Based on the "3*RGB" in your code comments I'm guessing this application<br>
> (or part thereof) isn't going to suffer from the time hit (Blinking<br>
> Christmas lights, are we?).<br>
<br>
Similar, yep. I’m building decorative stage lights using WS2812 strips.<br>
<br>
For the moment, I have two predefined/hardcoded 3-color schemes. Along with some other “writable” config, I’m trying to use the ESP32’s EEPROM to store a third, custom, color scheme. The “preferences” library itself seems easy enough to use. You can read and write primitive types - various size ints, byte arrays, etc. Pretty much what’d you expect.<br>
<br>
How to get from a struct that holds all the settings to an array of bytes, and array of bytes back to struct is where I’m having a hard time. While there might be architecture specific things to work out, I don’t think this is an ESP32 specific problem. I think if I can understand the general (x86?) case, I can work out the specifics.<br>
<br>
Serializing the struct seems like the right way to do it. But there are other approaches, like explicitly storing each setting contained in the struct one at a time. That doesn’t scale, obviously.<br>
<br>
> On the other hand if your structure had to<br>
> do with ESP32 transmit/receive registers and time critical code then the<br>
> link Chris provided would be a good way to get down into the<br>
> nitty-gritty.<br>
<br>
Nah, it’s not at all time critical. In this case, the settings are only read from EEPROM on startup and only written when a message comes in over the network changing something.<br>
<br>
Eventually I’ll drive the fixtures with DMX/ArtNet and keep no state on the ESP32 controller. For now, a semi-static approach is a compromise. This whole thing is also a learning exercise where I’m trying to figure how to do it right, rather than bludgeoning my way to a solution :)<br>
<br>
One of the frustrations I’m running into is that I keep finding search results for MSFT C++ or C# - the latter of which is completely wrong (being more or less Java), and the former I’m not really sure, but seems Windows-specific.<br>
_______________________________________________<br>
colug-432 mailing list<br>
<a href="mailto:colug-432@colug.net" target="_blank">colug-432@colug.net</a><br>
<a href="http://lists.colug.net/mailman/listinfo/colug-432" rel="noreferrer" target="_blank">http://lists.colug.net/mailman/listinfo/colug-432</a><br>
</blockquote></div>