I just lost hours of work. After diligently making periodic saves, especially when i got something to work, i did final saves and exited the IDE.
Later, when i re-opened the file, none of the changes i had made were there. i looked all over the place including back up locations. same thing. gone.
then it occurred to me that i may have outsmarted myself. i am working on RF, and so i have a transmitter sketch on a Nano, and a receiver sketch on a Mega. it is a pain to keep changing the board and the port. whenever i make a change to one, it also changes the other.
i remembered some guy on a youtube video showing how he solved this problem. first he opened one file the normal way, invoking the IDE from the desktop icon and selecting a file.
but for the second file, he went into windows file explorer, found the file, and right clicked. he picked 'open with' and chose arduino IDE, and it opened in another instance.
This i did too and was very smug about not have to mess with boards and ports anymore. just have two cables hooked up simultaneously.
But, looking back and trying to figure out why my saves didn't take, i think it might be a two instances problem. i thought i was saving, and maybe i was, but where it was saving i don't know.
so this thread is an attempt to warn people about the possibility of a two instances problem.
Hmm, I use multiple instances routinely (doing exactly what you are, for exactly the same reason, except the boards are usually attiny boards of my own design), and haven't had this issue. It could definitely happen if you had the same sketch open in both, saved one with changes, then went to the other one, uploaded/compiled the old version open in that, as that saves the sketch... I suspect that that somehow happened here...
I safeguard against accidental file loss by putting everything that matters into github, though ofc that doesn't save you from forgetting to commit the changes.
after i wrote that, i went back in and fixed everything, just having the one instance opened, saved and exited.
and it did the same god damned thing again. on my laptop (which is my work computer), no changes saved. but i had also saved the sketch while i was still in it to a folder on my desktop. it was there, so i didn't end up having to recreate the wheel a third time.
but it is very dis-concerting to not be able to count on save.
so i was wrong about two instances. good. that is a neat trick that i like using. i'll just have to troubleshoot the saving issue.
I've just noticed that i always X out instead of using 'quit'.
i am going to use 'quit' only from now on, and see if that helps.
One thing that trips me up frequently is, when using 'save as', i often get the message that the name isn't right and it changed it for me. it's aggravating. i have been using the arduino ide for years and still run afoul of properly naming/saving. it has to do with putting the .ino file in a folder, and only a folder it likes.
pratto:
I've just noticed that i always X out instead of using 'quit'.
i am going to use 'quit' only from now on, and see if that helps.
One thing that trips me up frequently is, when using 'save as', i often get the message that the name isn't right and it changed it for me. it's aggravating. i have been using the arduino ide for years and still run afoul of properly naming/saving. it has to do with putting the .ino file in a folder, and only a folder it likes.
I doubt x-ing out vs quit makes a difference.
I am also inclined to suspect this is some sort of weird file permissions/access issue. Windows at this point has multiple overlapping ways that permissions can be denied, ranging from the obvious to the truly arcane.
The folder that the sketch is located in must have the same name as the sketch; this is because it is possible to have multiple files in a folder (including multiple .ino files, but I think the .ino file that has the same name as the folder is treated differently, because it's the one that is considered "the" sketch), and they are treated specially by virtue of being in that folder: The folder associated with the sketch has a special meaning. So there is a reason for that behavior - when you do save as, you specify the name of the folder, rather than the .ino file for this reason. I can't think of an alternative that wouldn't either break support for multiple files per sketch (which would break a huge number of sketches, including all the most complicated ones) or be more awkward and brittle.
a couple of weeks ago, when i first started noticing unexpected saving results, i was googling around and i read that a guy had noticed some relationship between saving...
no it was about undo in the arduino IDE. I had noticed that i could undo past my last save, but some times i could only undo a few steps. He said that he had found he could undo back to the last time he had moved his mouse, but not beyond. i haven't tested that, and it isn't germane to what we were discussing. i don't think.
thanks for the words about folders and files. i can't say that i now understand, but it is reassuring to me that someone with your experience also thinks it's a quirky setup.
i have had the saving problem once more in the last few days. i noticed that i had chrome going also with about 10 tabs going. so i now close chrome when using the IDE. maybe it's a question of my little laptop just trying to think of too many things at once.
I cannot replicate on win 7 x64 pro with IDE's 1.8.12, 1.8.11, 1.8.10, 1.8.8, 1.8.5
Do you have any more info on them all closing out if you close one instance ?
hmmm... i take it that that is not normal behavior. i am using W10 64b IDE 1.8.2
i checked a couple more times. i can individually X out of open sketches, but if i use file - quit, goodbye to everything, tho it does ask if i want to save before quitting.
if this is a malfunction, i can do an .mp4 screen grab for you.
Another weird thing. I have a sketch that gathers sensor inputs every second for 59 seconds (and shows them on the monitor as Serial.println as they are collected), then displays the results on the TFT screen. the TFT holds these displayed numbers while the sketch starts thru the 59 seconds of collecting new data and analyzing it (showing the new data on the serial monitor as it goes), then refreshes the display with new results. and so on.
it works fine, except that i just noticed that, if i X out of the serial monitor in mid flight, then start it again, it doesn't show on the serial monitor where the sketch should be, it stops the entire sketch from processing, the display goes blank and data collection starts all over again from scratch (old previous data gone).
that doesn't seem right. how can a monitor control the sketch ? is this a 1.8.2 IDE bug ?
pratto:
i take it that that is not normal behavior.
It depends on whether we are talking about multiple instances of the IDE, or multiple sketch windows opened from the same instance of the IDE. In the former case, that is not normal behavior. In the latter case, it is normal and expected for all sketch windows opened of that instance of the IDE to close when you do File > Quit on any of the sketch windows.
pratto:
should closing and re-opening the monitor restart the sketch ?
It depends on which Arduino board you are using. On the boards with native USB (e.g., Leonardo, Micro, MKR, Nano 33 IoT, Nano 33 BLE), it will not happen. The boards without native USB (e.g., Uno, Nano, Mega) will reset whenever you open a serial connection. They are specifically designed this way because the board needs to be reset to activate the bootloader when you start an upload.
If you don't like this behavior, the auto-reset can be disabled. The ways to accomplish this depend on which board you are using. If you disable auto-reset, you will need to manually reset the board at just the right time during the upload to be able to upload new sketches to the board.
pert -
thanks. Now i feel better about the quitting behavior and the serial monitor behavior. I use a mega.
My IDE is probably fine. I had been worried about it being corrupted.
Have you heard of any issues using save when skipping between multiple open sketches (windows), with only one instance open ?
And the same question for multiple instances with multiple sketches open ?
Any problems using X to quit a sketch ?
pratto:
Have you heard of any issues using save when skipping between multiple open sketches (windows), with only one instance open ?
And the same question for multiple instances with multiple sketches open ?
Any problems using X to quit a sketch ?
I don't remember any reports of save not working in the way you describe (changes to the sketch are not saved).
I like to use Git for version control. There is a bit of a learning curve, but it really is worth the effort if you're doing any reasonably involved programming projects. If you are making commits as you code, it would be very obvious if the Arduino IDE's save was misbehaving. You can use Git from the command line if that's your thing, but there are also some nice Git clients that provide a GUI for Git. When I last used it some years ago, GitHub Desktop was a very beginner friendly option. I now use Git Extensions, which provides a more full featured Git interface than GitHub Desktop did when I last used it, but would also be a bit more intimidating for a beginner.
thanks. I took a look. if i was at the beginning of this project and knew about it i might have given it a try. i just looked and i have more than 180 sketches with all kinds of version names for this one project. but i am nearing the end, with only a few issues left to solve. plus i'm 68 and retired and i believe that this will be my last involved project.