mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
modules/omv: Move debug mode flag to omv module.
This commit is contained in:
parent
4b95fe18a2
commit
6850fc1cc7
@ -666,7 +666,7 @@ class rpc_usb_vcp_master(rpc_master):
|
||||
def __init__(self): # private
|
||||
import pyb
|
||||
self.__usb_vcp = pyb.USB_VCP()
|
||||
if self.__usb_vcp.debug_mode_enabled():
|
||||
if omv.debug_mode():
|
||||
raise OSError("You cannot use the USB VCP while the IDE is connected!")
|
||||
self.__usb_vcp.setinterrupt(-1)
|
||||
rpc_master.__init__(self)
|
||||
@ -687,7 +687,7 @@ class rpc_usb_vcp_slave(rpc_slave):
|
||||
def __init__(self): # private
|
||||
import pyb
|
||||
self.__usb_vcp = pyb.USB_VCP()
|
||||
if self.__usb_vcp.debug_mode_enabled():
|
||||
if omv.debug_mode():
|
||||
raise OSError("You cannot use the USB VCP while the IDE is connected!")
|
||||
self.__usb_vcp.setinterrupt(-1)
|
||||
rpc_slave.__init__(self)
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "usbdbg.h"
|
||||
#include "framebuffer.h"
|
||||
#include "omv_boardconfig.h"
|
||||
#include "tinyusb_debug.h"
|
||||
|
||||
static mp_obj_t py_omv_version_string() {
|
||||
char str[12];
|
||||
@ -63,6 +64,16 @@ static mp_obj_t py_omv_board_id() {
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_board_id_obj, py_omv_board_id);
|
||||
|
||||
static mp_obj_t py_omv_debug_mode() {
|
||||
#if (OMV_TUSBDBG_ENABLE == 1)
|
||||
return mp_obj_new_bool(tinyusb_debug_enabled());
|
||||
#else
|
||||
extern int usb_cdc_debug_mode_enabled();
|
||||
return mp_obj_new_bool(usb_cdc_debug_mode_enabled());
|
||||
#endif
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_0(py_omv_debug_mode_obj, py_omv_debug_mode);
|
||||
|
||||
static mp_obj_t py_omv_disable_fb(uint n_args, const mp_obj_t *args) {
|
||||
if (!n_args) {
|
||||
return mp_obj_new_bool(!fb_get_streaming_enabled());
|
||||
@ -81,6 +92,7 @@ static const mp_rom_map_elem_t globals_dict_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR_arch), MP_ROM_PTR(&py_omv_arch_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_board_type), MP_ROM_PTR(&py_omv_board_type_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_board_id), MP_ROM_PTR(&py_omv_board_id_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_debug_mode), MP_ROM_PTR(&py_omv_debug_mode_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_disable_fb), MP_ROM_PTR(&py_omv_disable_fb_obj) }
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user