Ok, cut to the chase. I have an array of ints and I wish to be able to change either individual or multiple parts of the array. Such as
int vssp[4] = {100,200,300,400];
Say down the line I want to just change vssp[2] to 250 instead of 300. Would it be easier done if I save the array to eeprom and read/write there or keep it in the flash? The kicker is I don't want to have to recompile the entire code just for one little change.
As it is, in my hex editor it displays the hex digit for 1 then 0 then 0 then , then 2 then 0 then 0 etc. I save this file as a bin as well for modding it in a bin editor and it prints to the bin editor as an ASCii string instead of the actual int 100. Maybe im just not handling/structuring the data right for my needs. This is the only issue with my code so I felt no need to post it in its entirety.
Any insight is appreciated but smart ass comments will be noted and disregarded.
if the settings are something that you may change in the future, why don't you add a sd card to your project and then have the settings read from there? othwerwise any changes you make would be lost the next time the device restarts.
Say down the line I want to just change vssp[2] to 250 instead of 300. Would it be easier done if I save the array to eeprom and read/write there or keep it in the flash? The kicker is I don't want to have to recompile the entire code just for one little change.
Do you want go to the trouble of writing a function in your program that takes data from (say) the Serial Monitor to update the "permanent" data for the program? If so you could save that data in the EEPROM.
If you just want to update the permanent data directly from the PC then it seems as simple as anything else just to upload a complete revised program.
You could, perhaps, have the array data in a separate .ino or ,h file if you don't want to modify the main code file.
I'm thinking I will go the eeprom route using the eepromAnything library. The reason I don't want to have to upload the whole .ino is this will be a consumer product and don't want them to have easy access to the main program. I know it's impossible to block most code nerds from getting in and retrieving my code but for the average user, I need for them to be able to change the settings to suit their particular application and nothing more.
So, it looks like eeprom and serial comm to make the changes and leave the rest of the code intact. The size of the arrays will be bound and not changeable by the end user only the values of the array will be changed.
Robin2, I wasn't aware I could save multiple ino files into one mega. If I did that would I still be able to read that data with the main code?
Billdefish:
The reason I don't want to have to upload the whole .ino is this will be a consumer product and don't want them to have easy access to the main program.
Bill
If you use parts of the Arduino, unfortunately, to avoid legal action from Arduino or even consumers of your product, you must provide a way to rebuild the software should they choose to modify the LGPL content, like a bug fix or update to the Arduino core.
As the system is statically linked, you will need to provide the source to recompile the application.
If you want your code to be closed source, you can only use code you write, or source code you are licensed to use which does not state the requirement for end users to be able to modify it.
Billdefish:
So, it looks like eeprom and serial comm to make the changes and leave the rest of the code intact. The size of the arrays will be bound and not changeable by the end user only the values of the array will be changed.
I think that is the only way for a user to update things without the source code. But note @Pyro_65's comment about licensing.
I wasn't aware I could save multiple ino files into one mega. If I did that would I still be able to read that data with the main code?
You can have several .ino files as part of one project - extrat tabs in the Arduino IDE. They all get merged into one by the compiler.
Before this product hits the commercial market it will be on a new design board not actually the Arduino mega I am using for prototyping but I will be using the ATmega2560 for the processor. Does the liscene agreement also include use of the bootloader? If so I suppose I could write a custom bootloader if necessary but wasn't part of my original plan. Oh well all part of the fun right,
Robin2,
I will just store the requisite data in eeprom to make it easy. Add the code for read/upload via serial and hopefully get this thing going soon.
I want to thank you both for the insight and suggestions. Have a great day.
Your hardware can be whatever you like, its the Arduino core API ( software/code ) which is covered by LGPL. The bootloader source my be licensed the same, however you will have to look at the source/documentation.