Skip to content

Commit 4681b86

Browse files
committed
esp8266/esp_mphal: Handle Ctrl+C from dupterm (e.g. WebREPL).
1 parent 116eeee commit 4681b86

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

esp8266/esp_mphal.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ static int call_dupterm_read(void) {
176176
mp_uos_deactivate("dupterm: EOF received, deactivating\n", MP_OBJ_NULL);
177177
return -1;
178178
}
179+
if (*(byte*)bufinfo.buf == interrupt_char) {
180+
mp_keyboard_interrupt();
181+
return -2;
182+
}
179183
return *(byte*)bufinfo.buf;
180184
} else {
181185
mp_uos_deactivate("dupterm: Exception in read() method, deactivating: ", nlr.ret_val);

esp8266/esp_mphal.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
#include "py/ringbuf.h"
3131

32+
void mp_keyboard_interrupt(void);
33+
extern int interrupt_char;
34+
3235
struct _mp_print_t;
3336
// Structure for UART-only output via mp_printf()
3437
extern const struct _mp_print_t mp_debug_print;

0 commit comments

Comments
 (0)