I was hesitant about moving to Arduino 2.X but thought I'd give it a try.
I don't like it. In particular it's reliance on internet resources.
I can be writing a program. It could be a huge creation. I go and make a coffee. My laptop goes to sleep & when i return my work is lost!
I believe this has been on a bug list for a long time?
Hi @myiot23 .
That is correct. The bug is tracked here:
opened 11:50AM - 10 Apr 25 UTC
type: imperfection
topic: theia
### Describe the problem
When the operative system re-activate from sleep mode,โฆ the IDE seems to perform a reload (loading logo is shown) and current changes in the code, logs in output view and serial monitor are lost.
### To reproduce
1. Select **File > Preferences...** (or **Arduino > Settings...** for macOS users) from the Arduino IDE menus.
The "**Preferences**" dialog will open.
1. Uncheck the box next to "**Auto save**" in the "**Preferences**" dialog.
1. Click the "**OK**" button.
The "**Preferences**" dialog will close.
1. Write some text in any file of the sketch.
1. OPTIONAL: to verify that this affects also output view and serial logs, perform any action that would write some logs in output and serial monitor.
1. Put your computer into sleep mode.
- On MacOS: Apple logo > Sleep)
- On Windows: Start menu > Power > Sleep
1. Wake the computer.
๐ The IDE reloads and all unsaved changes to the sketch are lost.
๐ The content of the output view and serial monitor is cleared.
### Expected behavior
The IDE should maintain the current state through sleep/wake cycles.
### Arduino IDE version
2.3.6
### Operating system
- macOS
- Linux
- Windows
### Operating system version
- macOS 15.3.2
- Ubuntu 24.04.2
- Windows 11
### Additional context
I bisected the regression to 859d29d41af2146537abedb42c9798011b452983 / https://github.com/arduino/arduino-ide/pull/2654 (does not occur when using the build at the previous commit d298b3ffc94008e89066cd999d891e84190da18f).
---
Originally reported at https://forum.arduino.cc/t/arduino-ide-2-3-5-problem/1371263 / https://forum.arduino.cc/t/ide-2-3-5-problem/1371404
<a name="workaround"></a>
#### Workaround
In order to avoid the loss of work, enable Arduino IDE's "Auto save" preference:
1. Select **File > Preferences...** (or **Arduino IDE > Settings...** for macOS users) from the Arduino IDE menus.
The "**Preferences**" dialog will open.
1. Check the box next to "**Auto save**" in the "**Preferences**" dialog.
1. Click the "**OK**" button.
The "**Preferences**" dialog will close.
Arduino IDE will now continuously save your work.
#### Additional reports
- https://forum.arduino.cc/t/arduino-ide-2-3-6-arbitrarily-clears-the-output-and-serial-monitor/1371986
- https://forum.arduino.cc/t/arduino-ide-no-perserving-state-when-go-into-energy-saving-mac/1378108
- https://forum.arduino.cc/t/arduino-ide-2-3-5-problem/1371263/17
- https://forum.arduino.cc/t/reload-after-sleep/1421103
- https://forum.arduino.cc/t/ide-2-3-7-problem/1430947
- https://forum.arduino.cc/t/my-work-is-disapearing/1436193
- https://github.com/arduino/arduino-ide/issues/2704#issuecomment-2839407418
- https://github.com/arduino/arduino-ide/issues/2704#issuecomment-2944801189
---
<details>
<summary><b>Keywords</b></summary>
<p>
- "hibernate"
- "lock screen"
</p>
</details>
### Issue checklist
- [x] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [x] I verified the problem still occurs when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [x] My report contains all necessary details
The workaround is to make sure to save your sketch before your computer sleeps. You can ensure this by checking the "Auto save " checkbox in the Arduino IDE preferences (File > Preferences ). This will cause Arduino IDE to automatically save your sketch after every change.
myiot23:
My laptop goes to sleep
What happens when it hibernates ?
'Sleep' is anyway a setting that does not fully stop power consumption (also not from peripherals) and can damage your battery by over discharging.
myiot23:
I go and make a coffee
Clearly the computer needs the coffee, not you.