Skip to content

Commit 59b4353

Browse files
authored
Merge pull request #6713 from tannewt/exception_filename
Add exception filename to title bar
2 parents 5040e1b + ce1273b commit 59b4353

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ void supervisor_execution_status(void) {
213213
if (_current_executing_filename != NULL) {
214214
serial_write(_current_executing_filename);
215215
} else if ((_exec_result.return_code & PYEXEC_EXCEPTION) != 0 &&
216+
_exec_result.exception_line > 0 &&
216217
exception != NULL) {
217-
mp_printf(&mp_plat_print, "@%d %q", _exec_result.exception_line, exception->base.type->name);
218+
mp_printf(&mp_plat_print, "%d@%s %q", _exec_result.exception_line, _exec_result.exception_filename, exception->base.type->name);
218219
} else {
219220
serial_write_compressed(translate("Done"));
220221
}

ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) {
144144
gpio_set_level(21, true);
145145
return true;
146146
}
147+
// Pull LED down on reset rather than the default up
148+
if (pin_number == 13) {
149+
gpio_config_t cfg = {
150+
.pin_bit_mask = BIT64(pin_number),
151+
.mode = GPIO_MODE_DISABLE,
152+
.pull_up_en = false,
153+
.pull_down_en = true,
154+
.intr_type = GPIO_INTR_DISABLE,
155+
};
156+
gpio_config(&cfg);
157+
return true;
158+
}
147159
return false;
148160
}
149161

shared/runtime/pyexec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
199199
size_t n, *values;
200200
mp_obj_exception_get_traceback(return_value, &n, &values);
201201
if (values != NULL) {
202-
result->exception_line = values[n - 2];
202+
result->exception_line = values[1];
203+
result->exception_filename[sizeof(result->exception_filename) - 1] = '\0';
204+
strncpy(result->exception_filename, qstr_str(values[0]), sizeof(result->exception_filename) - 1);
203205
}
204206
}
205207
}

shared/runtime/pyexec.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ typedef struct {
3737
int return_code;
3838
mp_obj_t exception;
3939
int exception_line;
40+
// Only store the first 32 characters of the filename. It is very unlikely that they can all be
41+
// seen.
42+
char exception_filename[33];
4043
} pyexec_result_t;
4144

4245
extern pyexec_mode_kind_t pyexec_mode_kind;

0 commit comments

Comments
 (0)