@@ -168,6 +168,26 @@ STATIC mp_obj_t supervisor_runtime_get_ble_workflow(mp_obj_t self) {
168168}
169169MP_DEFINE_CONST_FUN_OBJ_1 (supervisor_runtime_get_ble_workflow_obj , supervisor_runtime_get_ble_workflow );
170170
171+ //| next_stack_limit: int
172+ //| """The size of the stack for the next vm run. If its too large, the default will be used."""
173+ //|
174+ STATIC mp_obj_t supervisor_runtime_get_next_stack_limit (mp_obj_t self ) {
175+ return mp_obj_new_int (get_next_stack_size ());
176+ }
177+ MP_DEFINE_CONST_FUN_OBJ_1 (supervisor_runtime_get_next_stack_limit_obj , supervisor_runtime_get_next_stack_limit );
178+
179+ STATIC mp_obj_t supervisor_runtime_set_next_stack_limit (mp_obj_t self , mp_obj_t size_obj ) {
180+ mp_int_t size = mp_obj_get_int (size_obj );
181+ mp_arg_validate_int_min (size , 256 , MP_QSTR_size );
182+ set_next_stack_size (size );
183+ return mp_const_none ;
184+ }
185+ MP_DEFINE_CONST_FUN_OBJ_2 (supervisor_runtime_set_next_stack_limit_obj , supervisor_runtime_set_next_stack_limit );
186+
187+ MP_PROPERTY_GETSET (supervisor_runtime_next_stack_limit_obj ,
188+ (mp_obj_t )& supervisor_runtime_get_next_stack_limit_obj ,
189+ (mp_obj_t )& supervisor_runtime_set_next_stack_limit_obj );
190+
171191STATIC mp_obj_t supervisor_runtime_set_ble_workflow (mp_obj_t self , mp_obj_t state_in ) {
172192 #if CIRCUITPY_BLE_FILE_SERVICE && CIRCUITPY_SERIAL_BLE
173193 if (mp_obj_is_true (state_in )) {
@@ -219,6 +239,7 @@ STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = {
219239 { MP_ROM_QSTR (MP_QSTR_safe_mode_reason ), MP_ROM_PTR (& supervisor_runtime_safe_mode_reason_obj ) },
220240 { MP_ROM_QSTR (MP_QSTR_autoreload ), MP_ROM_PTR (& supervisor_runtime_autoreload_obj ) },
221241 { MP_ROM_QSTR (MP_QSTR_ble_workflow ), MP_ROM_PTR (& supervisor_runtime_ble_workflow_obj ) },
242+ { MP_ROM_QSTR (MP_QSTR_next_stack_limit ), MP_ROM_PTR (& supervisor_runtime_next_stack_limit_obj ) },
222243 { MP_ROM_QSTR (MP_QSTR_rgb_status_brightness ), MP_ROM_PTR (& supervisor_runtime_rgb_status_brightness_obj ) },
223244};
224245
0 commit comments