diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2020-12-02 13:10:39 -0800 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2020-12-02 13:10:39 -0800 |
| commit | 608c98501bb90e02a480b2d84032a46f9a4d0737 (patch) | |
| tree | adea018a0c0e714ef33b79a306b69885568b6ad0 /lib/utils | |
| parent | 34bbcc4910014c3b4646d8005baf8244bac51f03 (diff) | |
| parent | d7ba641ff646b48e5ad38ff72a2dcfe17bb54624 (diff) | |
Merge remote-tracking branch 'adafruit/main' into msgpack
Diffstat (limited to 'lib/utils')
| -rwxr-xr-x | lib/utils/pyexec.c | 6 | ||||
| -rw-r--r-- | lib/utils/pyexec.h | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/utils/pyexec.c b/lib/utils/pyexec.c index 378fb6267..68a3710ce 100755 --- a/lib/utils/pyexec.c +++ b/lib/utils/pyexec.c @@ -101,7 +101,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input #endif } - // If the code was loaded from a file its likely to be running for a while so we'll long + // If the code was loaded from a file it's likely to be running for a while so we'll long // live it and collect any garbage before running. if (input_kind == MP_PARSE_FILE_INPUT) { module_fun = make_obj_long_lived(module_fun, 6); @@ -132,6 +132,10 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_SystemExit)) { // at the moment, the value of SystemExit is unused ret = pyexec_system_exit; +#if CIRCUITPY_ALARM + } else if (mp_obj_is_subclass_fast(mp_obj_get_type((mp_obj_t)nlr.ret_val), &mp_type_DeepSleepRequest)) { + ret = PYEXEC_DEEP_SLEEP; +#endif } else { if ((mp_obj_t) nlr.ret_val != MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception))) { mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); diff --git a/lib/utils/pyexec.h b/lib/utils/pyexec.h index cef72a76c..4c773cd64 100644 --- a/lib/utils/pyexec.h +++ b/lib/utils/pyexec.h @@ -49,6 +49,7 @@ extern int pyexec_system_exit; #define PYEXEC_FORCED_EXIT (0x100) #define PYEXEC_SWITCH_MODE (0x200) #define PYEXEC_EXCEPTION (0x400) +#define PYEXEC_DEEP_SLEEP (0x800) int pyexec_raw_repl(void); int pyexec_friendly_repl(void); |
