From a3e4c71dcd97f2c5722b652ba7367cd9e247686b Mon Sep 17 00:00:00 2001 From: Rahix <rahix@rahix.de> Date: Sat, 25 Dec 2021 17:37:12 +0100 Subject: [PATCH] Revert "feat(micropython): Print exceptions to the screen" We want to rethink how to implement this. This reverts commit a4c05d3f1624325dd4a4976bc09a49feda6d6517. --- pycardium/mphalport.c | 73 ------------------------------------------- 1 file changed, 73 deletions(-) diff --git a/pycardium/mphalport.c b/pycardium/mphalport.c index f3b3348d..f8370ff1 100644 --- a/pycardium/mphalport.c +++ b/pycardium/mphalport.c @@ -17,7 +17,6 @@ #include "py/mpprint.h" #include <stdint.h> -#include <stdbool.h> #include <stdio.h> #include <string.h> @@ -87,68 +86,6 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) epic_uart_write_str(str, len); } -static char exception_lines[2][80]; -static bool exception; -static size_t exception_line_index; - -static void exception_feed(char c) -{ - if (c == '\n') { - exception_lines[1][exception_line_index] = 0; - if (exception_lines[1][0] == ' ') { - memcpy(exception_lines[0], - exception_lines[1], - sizeof(exception_lines[0])); - exception_line_index = 0; - } else { - exception = false; - epic_disp_open(); - epic_disp_clear(0); - epic_disp_print_adv( - 1, 0, 0, "Exception:", 0xF800, 0x0000 - ); - char buf = exception_lines[0][26]; - exception_lines[0][26] = 0; - epic_disp_print_adv( - 1, 0, 12, exception_lines[0], 0xFFFF, 0x0000 - ); - exception_lines[0][26] = buf; - if (strlen(exception_lines[0]) > 26) { - epic_disp_print_adv( - 1, - 0, - 24, - exception_lines[0] + 26, - 0xFFFF, - 0x0000 - ); - } - - buf = exception_lines[1][26]; - exception_lines[1][26] = 0; - epic_disp_print_adv( - 1, 0, 40, exception_lines[1], 0xF800, 0x0000 - ); - exception_lines[1][26] = buf; - if (strlen(exception_lines[1]) > 26) { - epic_disp_print_adv( - 1, - 0, - 52, - exception_lines[1] + 26, - 0xF800, - 0x0000 - ); - } - epic_disp_update(); - } - } else { - if (exception_line_index < sizeof(exception_lines[0]) - 1) { - exception_lines[1][exception_line_index++] = c; - } - } -} - /* Send a string, but replace \n with \n\r */ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) { @@ -156,16 +93,6 @@ void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) * Only print one line at a time. Insert `\r` between lines so * they are properly displayed on the serial console. */ - - if (strncmp(str, "Traceback (most recent call last):\n", len) == 0) { - exception = true; - exception_line_index = 0; - } else if (exception) { - for (size_t i = 0; i < len; i++) { - exception_feed(str[i]); - } - } - size_t i, last = 0; for (i = 0; i < len; i++) { if (str[i] == '\n') { -- GitLab