File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -51,8 +51,17 @@ void samd_main(void) {
51
51
pyexec_frozen_module ("_boot.py" );
52
52
53
53
// Execute user scripts.
54
- pyexec_file_if_exists ("boot.py" );
55
- pyexec_file_if_exists ("main.py" );
54
+ int ret = pyexec_file_if_exists ("boot.py" );
55
+ if (ret & PYEXEC_FORCED_EXIT ) {
56
+ goto soft_reset_exit ;
57
+ }
58
+ // Do not execute main.py if boot.py failed
59
+ if (pyexec_mode_kind == PYEXEC_MODE_FRIENDLY_REPL && ret != 0 ) {
60
+ ret = pyexec_file_if_exists ("main.py" );
61
+ if (ret & PYEXEC_FORCED_EXIT ) {
62
+ goto soft_reset_exit ;
63
+ }
64
+ }
56
65
57
66
for (;;) {
58
67
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL ) {
@@ -66,6 +75,7 @@ void samd_main(void) {
66
75
}
67
76
}
68
77
78
+ soft_reset_exit :
69
79
mp_printf (MP_PYTHON_PRINTER , "MPY: soft reboot\n" );
70
80
adc_deinit_all ();
71
81
pin_irq_deinit_all ();
You can’t perform that action at this time.
0 commit comments