46
46
#include "usb_serial_jtag.h"
47
47
#include "uart.h"
48
48
49
- #include "py/mpprint.h"
50
- //#define PWM_DBG(...)
51
- #define PWM_DBG (...) mp_printf(MP_PYTHON_PRINTER, __VA_ARGS__); mp_printf(&mp_plat_print, "\n");
52
-
53
49
TaskHandle_t mp_main_task_handle ;
54
50
55
51
STATIC uint8_t stdin_ringbuf_array [260 ];
56
52
ringbuf_t stdin_ringbuf = {stdin_ringbuf_array , sizeof (stdin_ringbuf_array ), 0 , 0 };
57
53
58
54
// Check the ESP-IDF error code and raise an OSError if it's not ESP_OK.
59
- //void check_esp_err(esp_err_t code) {
60
- void _check_esp_err (esp_err_t code , const char * func , const int line , const char * file ) {
55
+ void check_esp_err (esp_err_t code ) {
61
56
if (code != ESP_OK ) {
62
57
// map esp-idf error code to posix error code
63
58
uint32_t pcode = - code ;
@@ -83,11 +78,8 @@ void _check_esp_err(esp_err_t code, const char* func, const int line, const char
83
78
o_str -> len = strlen ((char * )o_str -> data );
84
79
o_str -> hash = qstr_compute_hash (o_str -> data , o_str -> len );
85
80
// raise
86
- PWM_DBG ("Exception in function '%s' at line %d in file '%s'" , func , line , file )
87
- // mp_obj_t args[2] = { MP_OBJ_NEW_SMALL_INT(pcode), MP_OBJ_FROM_PTR(o_str) };
88
- // nlr_raise(mp_obj_exception_make_new(&mp_type_OSError, 2, 0, args));
89
- mp_obj_t args [5 ] = { MP_OBJ_NEW_SMALL_INT (pcode ), MP_OBJ_FROM_PTR (o_str ), mp_obj_new_str (func , strlen (func )), mp_obj_new_int (line ), mp_obj_new_str (file , strlen (file )) };
90
- nlr_raise (mp_obj_exception_make_new (& mp_type_OSError , 5 , 0 , args ));
81
+ mp_obj_t args [2 ] = { MP_OBJ_NEW_SMALL_INT (pcode ), MP_OBJ_FROM_PTR (o_str )};
82
+ nlr_raise (mp_obj_exception_make_new (& mp_type_OSError , 2 , 0 , args ));
91
83
}
92
84
}
93
85
0 commit comments