Go Down

Topic: Saving Stupidity (Read 334 times) previous topic - next topic

pratto

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.

DrAzzy

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.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

pratto

#2
Feb 12, 2020, 08:26 am Last Edit: Feb 12, 2020, 09:07 am by pratto
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.

Riva

Sounds like you might be running into access control issues with the folder your trying to save to on the laptop.
Don't PM me for help as I will ignore it.

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.

DrAzzy

#5
Feb 14, 2020, 11:19 pm Last Edit: Feb 14, 2020, 11:26 pm by DrAzzy
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.
ATTinyCore for x4/x5/x61/x7/x8/x41/1634/828/x313 megaTinyCore for the megaavr ATtinies - Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

pratto

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.

pratto

Quote
I doubt x-ing out vs quit makes a difference.
I did find one difference. if i have multiple sketches open and i use 'quit' on one, they all close.

ballscrewbob

@pratto

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 ?

Maybe its a win 8 or 10 issue ?

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

pratto

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.

pratto

#10
Feb 15, 2020, 03:39 pm Last Edit: Feb 15, 2020, 03:41 pm by pratto
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 ?

i have re-booted. that did not fix it.

pratto

here is a sketch that does the same thing.

Code: [Select]
void setup() {
 
  Serial.begin(9600);
}


void loop() {

  for (int i = 1; i < 600; i = i + 1) { 
    delay(500);                                   
    Serial.println(i);
  }
}


at this point, i don't know what is normal behavior. should closing and re-opening the monitor restart the sketch ?

pert

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.

pert

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.

Patrick34

#14
Feb 15, 2020, 05:25 pm Last Edit: Feb 18, 2020, 04:20 pm by Patrick34
Thanks for the tips! Luckily nothing similar ever happened to me, cause' I rarely have multiple instances open.

Go Up