File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 57
57
#include "supervisor/shared/status_leds.h"
58
58
#include "supervisor/shared/stack.h"
59
59
#include "supervisor/serial.h"
60
+ #include "supervisor/usb.h"
61
+
62
+ #include "shared-bindings/microcontroller/__init__.h"
60
63
61
64
#include "boards/board.h"
62
65
@@ -300,6 +303,19 @@ bool run_code_py(safe_mode_t safe_mode) {
300
303
}
301
304
}
302
305
306
+ for (uint8_t i = 0 ; i <=100 ; i ++ ) {
307
+ if (!usb_msc_ejected ()) {
308
+ //Go into light sleep
309
+ break ;
310
+ }
311
+ mp_hal_delay_ms (10 );
312
+ }
313
+
314
+ if (usb_msc_ejected ()) {
315
+ //Go into deep sleep
316
+ common_hal_mcu_deep_sleep ();
317
+ }
318
+
303
319
// Display a different completion message if the user has no USB attached (cannot save files)
304
320
if (!serial_connected_at_start ) {
305
321
serial_write_compressed (translate ("\nCode done running. Waiting for reload.\n" ));
You can’t perform that action at this time.
0 commit comments