Skip to content

Commit 689ec86

Browse files
authored
Merge pull request #4754 from dhalbert/fix-endpoint-checking
Fix endpoint checking; Clean up safe mode printing
2 parents 274b2bf + c65986f commit 689ec86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+269
-187
lines changed

locale/ID.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4581,7 +4581,7 @@ msgstr ""
45814581
#~ msgstr "Berjalan di mode aman(safe mode)! Auto-reload tidak aktif.\n"
45824582

45834583
#~ msgid "Running in safe mode! Not running saved code.\n"
4584-
#~ msgstr ""
4584+
#~ msgstr "Berjalan di mode aman(safe mode)! Tidak menjalankan kode yang disimpan.\n"
45854585
#~ "Berjalan di mode aman(safe mode)! tidak menjalankan kode yang tersimpan.\n"
45864586

45874587
#~ msgid "'async for' or 'async with' outside async function"

locale/circuitpython.pot

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -710,13 +710,7 @@ msgid "CircuitPython core code crashed hard. Whoops!\n"
710710
msgstr ""
711711

712712
#: supervisor/shared/safe_mode.c
713-
msgid ""
714-
"CircuitPython is in safe mode because you pressed the reset button during "
715-
"boot. Press again to exit safe mode.\n"
716-
msgstr ""
717-
718-
#: supervisor/shared/safe_mode.c
719-
msgid "CircuitPython was unable to allocate the heap.\n"
713+
msgid "CircuitPython was unable to allocate the heap."
720714
msgstr ""
721715

722716
#: shared-module/bitbangio/SPI.c
@@ -1638,10 +1632,6 @@ msgstr ""
16381632
msgid "Not playing"
16391633
msgstr ""
16401634

1641-
#: main.c
1642-
msgid "Not running saved code.\n"
1643-
msgstr ""
1644-
16451635
#: shared-bindings/_bleio/__init__.c
16461636
msgid "Not settable"
16471637
msgstr ""
@@ -1964,7 +1954,7 @@ msgid "Row entry must be digitalio.DigitalInOut"
19641954
msgstr ""
19651955

19661956
#: main.c
1967-
msgid "Running in safe mode! "
1957+
msgid "Running in safe mode! Not running saved code.\n"
19681958
msgstr ""
19691959

19701960
#: shared-module/sdcardio/SDCard.c
@@ -2089,13 +2079,13 @@ msgstr ""
20892079
#: supervisor/shared/safe_mode.c
20902080
msgid ""
20912081
"The CircuitPython heap was corrupted because the stack was too small.\n"
2092-
"Please increase the stack size if you know how, or if not:"
2082+
"Increase the stack size if you know how. If not:"
20932083
msgstr ""
20942084

20952085
#: supervisor/shared/safe_mode.c
20962086
msgid ""
20972087
"The `microcontroller` module was used to boot into safe mode. Press reset to "
2098-
"exit safe mode.\n"
2088+
"exit safe mode."
20992089
msgstr ""
21002090

21012091
#: shared-bindings/rgbmatrix/RGBMatrix.c
@@ -2106,7 +2096,7 @@ msgstr ""
21062096
msgid ""
21072097
"The microcontroller's power dipped. Make sure your power supply provides\n"
21082098
"enough power for the whole circuit and press reset (after ejecting "
2109-
"CIRCUITPY).\n"
2099+
"CIRCUITPY)."
21102100
msgstr ""
21112101

21122102
#: shared-module/audiomixer/MixerVoice.c
@@ -2404,7 +2394,12 @@ msgid "Writes not supported on Characteristic"
24042394
msgstr ""
24052395

24062396
#: supervisor/shared/safe_mode.c
2407-
msgid "You are in safe mode: something unanticipated happened.\n"
2397+
msgid "You are in safe mode because:\n"
2398+
msgstr ""
2399+
2400+
#: supervisor/shared/safe_mode.c
2401+
msgid ""
2402+
"You pressed the reset button during boot. Press again to exit safe mode."
24082403
msgstr ""
24092404

24102405
#: supervisor/shared/safe_mode.c

locale/de_DE.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ msgstr ""
732732
"zu verlassen.\n"
733733

734734
#: supervisor/shared/safe_mode.c
735-
msgid "CircuitPython was unable to allocate the heap.\n"
736-
msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren.\n"
735+
msgid "CircuitPython was unable to allocate the heap."
736+
msgstr "CircuitPython war es nicht möglich heap-Speicher zu allozieren."
737737

738738
#: shared-module/bitbangio/SPI.c
739739
msgid "Clock pin init failed."

locale/en_GB.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,8 @@ msgstr ""
729729
"boot. Press again to exit safe mode.\n"
730730

731731
#: supervisor/shared/safe_mode.c
732-
msgid "CircuitPython was unable to allocate the heap.\n"
733-
msgstr "CircuitPython was unable to allocate the heap.\n"
732+
msgid "CircuitPython was unable to allocate the heap."
733+
msgstr "CircuitPython was unable to allocate the heap."
734734

735735
#: shared-module/bitbangio/SPI.c
736736
msgid "Clock pin init failed."

locale/es.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,8 @@ msgstr ""
738738
"durante el arranque. Presione nuevamente para salir del modo seguro.\n"
739739

740740
#: supervisor/shared/safe_mode.c
741-
msgid "CircuitPython was unable to allocate the heap.\n"
742-
msgstr "CircuitPython no puedo encontrar el montículo.\n"
741+
msgid "CircuitPython was unable to allocate the heap."
742+
msgstr "CircuitPython no puedo encontrar el montículo."
743743

744744
#: shared-module/bitbangio/SPI.c
745745
msgid "Clock pin init failed."
@@ -4820,7 +4820,7 @@ msgstr "zi debe ser una forma (n_section,2)"
48204820
#~ msgstr "Ejecutando en modo seguro! La auto-recarga esta deshabilitada.\n"
48214821

48224822
#~ msgid "Running in safe mode! Not running saved code.\n"
4823-
#~ msgstr ""
4823+
#~ msgstr "Ejecutando en modo seguro! No ejecutando el código almacenado.\n"
48244824
#~ "Ejecutando en modo seguro! No se esta ejecutando el código guardado.\n"
48254825

48264826
#~ msgid "__init__() should return None, not '%s'"

locale/fr.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,8 @@ msgstr ""
745745
"mode sans échec.\n"
746746

747747
#: supervisor/shared/safe_mode.c
748-
msgid "CircuitPython was unable to allocate the heap.\n"
749-
msgstr "CircuitPython n'as pu faire l'allocation de la pile.\n"
748+
msgid "CircuitPython was unable to allocate the heap."
749+
msgstr "CircuitPython n'as pu faire l'allocation de la pile."
750750

751751
#: shared-module/bitbangio/SPI.c
752752
msgid "Clock pin init failed."

locale/hi.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ msgid ""
716716
msgstr ""
717717

718718
#: supervisor/shared/safe_mode.c
719-
msgid "CircuitPython was unable to allocate the heap.\n"
719+
msgid "CircuitPython was unable to allocate the heap."
720720
msgstr ""
721721

722722
#: shared-module/bitbangio/SPI.c

locale/ja.po

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ msgstr ""
727727
"度押すとセーフモードを終了します。\n"
728728

729729
#: supervisor/shared/safe_mode.c
730-
msgid "CircuitPython was unable to allocate the heap.\n"
731-
msgstr "CircuitPythonはヒープを確保できませんでした\n"
730+
msgid "CircuitPython was unable to allocate the heap."
731+
msgstr "CircuitPythonはヒープを確保できませんでした"
732732

733733
#: shared-module/bitbangio/SPI.c
734734
msgid "Clock pin init failed."
@@ -1980,8 +1980,8 @@ msgid "Row entry must be digitalio.DigitalInOut"
19801980
msgstr "Rowの各要素は digitalio.DigitalInOut でなければなりません"
19811981

19821982
#: main.c
1983-
msgid "Running in safe mode! "
1984-
msgstr "セーフモードで実行中! "
1983+
msgid "Running in safe mode! Not running saved code.\n"
1984+
msgstr "セーフモードで実行中! 保存されたコードは実行していません。\n"
19851985

19861986
#: shared-module/sdcardio/SDCard.c
19871987
msgid "SD card CSD format not supported"

locale/nl.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ msgstr ""
725725
"het opstarten. Druk nogmaals om veilige modus te verlaten\n"
726726

727727
#: supervisor/shared/safe_mode.c
728-
msgid "CircuitPython was unable to allocate the heap.\n"
729-
msgstr "CircuitPython kon het heap geheugen niet toewijzen.\n"
728+
msgid "CircuitPython was unable to allocate the heap."
729+
msgstr "CircuitPython kon het heap geheugen niet toewijzen."
730730

731731
#: shared-module/bitbangio/SPI.c
732732
msgid "Clock pin init failed."

locale/pl.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,8 @@ msgstr ""
725725
"przycisk resetowania. Naciśnij ponownie, aby wyjść z trybu awaryjnego.\n"
726726

727727
#: supervisor/shared/safe_mode.c
728-
msgid "CircuitPython was unable to allocate the heap.\n"
729-
msgstr "CircuitPython nie mógł przydzielić sterty.\n"
728+
msgid "CircuitPython was unable to allocate the heap."
729+
msgstr "CircuitPython nie mógł przydzielić sterty."
730730

731731
#: shared-module/bitbangio/SPI.c
732732
msgid "Clock pin init failed."

locale/pt_BR.po

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,8 @@ msgstr ""
743743
"de segurança.\n"
744744

745745
#: supervisor/shared/safe_mode.c
746-
msgid "CircuitPython was unable to allocate the heap.\n"
747-
msgstr "O CircuitPython não conseguiu alocar o heap.\n"
746+
msgid "CircuitPython was unable to allocate the heap."
747+
msgstr "O CircuitPython não conseguiu alocar o heap."
748748

749749
#: shared-module/bitbangio/SPI.c
750750
msgid "Clock pin init failed."
@@ -4861,7 +4861,7 @@ msgstr "zi deve estar na forma (n_section, 2)"
48614861
#~ msgstr "Rodando em modo seguro! Atualização automática está desligada.\n"
48624862

48634863
#~ msgid "Running in safe mode! Not running saved code.\n"
4864-
#~ msgstr "Rodando em modo seguro! Não está executando o código salvo.\n"
4864+
#~ msgstr "Rodando em modo seguro! O código salvo não está em execução.\n"
48654865

48664866
#~ msgid "__init__() should return None, not '%s'"
48674867
#~ msgstr "O __init__() deve retornar Nenhum, não '%s'"

locale/sv.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,8 @@ msgstr ""
731731
"under start. Tryck igen för att lämna säkert läge.\n"
732732

733733
#: supervisor/shared/safe_mode.c
734-
msgid "CircuitPython was unable to allocate the heap.\n"
735-
msgstr "CircuitPython kunde inte allokera heap.\n"
734+
msgid "CircuitPython was unable to allocate the heap."
735+
msgstr "CircuitPython kunde inte allokera heap."
736736

737737
#: shared-module/bitbangio/SPI.c
738738
msgid "Clock pin init failed."

locale/zh_Latn_pinyin.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ msgstr ""
732732
"chóng zhì ànniǔ. Zài àn yīcì tuìchū ānquán móshì.\n"
733733

734734
#: supervisor/shared/safe_mode.c
735-
msgid "CircuitPython was unable to allocate the heap.\n"
736-
msgstr "CircuitPython wúfǎ fēnpèi duī.\n"
735+
msgid "CircuitPython was unable to allocate the heap."
736+
msgstr "CircuitPython wúfǎ fēnpèi duī."
737737

738738
#: shared-module/bitbangio/SPI.c
739739
msgid "Clock pin init failed."

main.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,20 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) {
261261
serial_write_compressed(translate("Auto-reload is off.\n"));
262262
}
263263
if (safe_mode != NO_SAFE_MODE) {
264-
serial_write_compressed(translate("Running in safe mode! "));
265-
serial_write_compressed(translate("Not running saved code.\n"));
264+
serial_write_compressed(translate("Running in safe mode! Not running saved code.\n"));
266265
}
267266
}
268267

269268
STATIC bool run_code_py(safe_mode_t safe_mode) {
270269
bool serial_connected_at_start = serial_connected();
270+
bool printed_safe_mode_message = false;
271271
#if CIRCUITPY_AUTORELOAD_DELAY_MS > 0
272-
serial_write("\n");
273-
print_code_py_status_message(safe_mode);
274-
print_safe_mode_message(safe_mode);
275-
serial_write("\n");
272+
if (serial_connected_at_start) {
273+
serial_write("\r\n");
274+
print_code_py_status_message(safe_mode);
275+
print_safe_mode_message(safe_mode);
276+
printed_safe_mode_message = true;
277+
}
276278
#endif
277279

278280
pyexec_result_t result;
@@ -388,8 +390,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
388390
print_code_py_status_message(safe_mode);
389391
}
390392

391-
print_safe_mode_message(safe_mode);
392-
serial_write("\n");
393+
if (!printed_safe_mode_message) {
394+
print_safe_mode_message(safe_mode);
395+
printed_safe_mode_message = true;
396+
}
397+
serial_write("\r\n");
393398
serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.\n"));
394399
printed_press_any_key = true;
395400
}
@@ -526,7 +531,6 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
526531
usb_set_defaults();
527532
#endif
528533

529-
// TODO(tannewt): Re-add support for flashing boot error output.
530534
if (ok_to_run) {
531535
bool found_boot = maybe_run_list(boot_py_filenames, NULL);
532536
(void) found_boot;

ports/atmel-samd/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif
2121
INTERNAL_LIBM = 1
2222

2323
# Number of USB endpoint pairs.
24-
USB_NUM_EP = 8
24+
USB_NUM_ENDPOINT_PAIRS = 8
2525

2626
CIRCUITPY_ROTARYIO_SOFTENCODER = 1
2727

ports/cxd56/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
USB_HIGHSPEED = 1
22

33
# Number of USB endpoint pairs.
4-
USB_NUM_EP = 6
4+
USB_NUM_ENDPOINT_PAIRS = 6
55

66
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
77
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.

ports/esp32s2/mpconfigport.mk

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,21 @@ CIRCUITPY_ROTARYIO = 1
2727
CIRCUITPY_NVM = 1
2828
CIRCUITPY_PS2IO ?= 1
2929
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
30-
# We don't have enough endpoints to include MIDI.
31-
CIRCUITPY_USB_MIDI ?= 0
32-
CIRCUITPY_USB_HID ?= 1
33-
# We have borrowed the VENDOR nomenclature from tinyusb. VENDOR AKA WEBUSB
34-
CIRCUITPY_USB_VENDOR ?= 0
3530
CIRCUITPY_WIFI = 1
3631
CIRCUITPY_WATCHDOG ?= 1
3732

3833
CIRCUITPY_ESPIDF = 1
3934

4035
CIRCUITPY_MODULE ?= none
4136

42-
USB_NUM_EP = 5
37+
# From the ESP32-S2 datasheet:
38+
#
39+
# Endpoint number 0 always present (bi-directional, consisting of EP0 IN and EP0 OUT)
40+
# Six additional endpoints (endpoint numbers 1 to 6), configurable as IN or OUT
41+
# Maximum of five IN endpoints concurrently active at any time (including EP0 IN)
42+
#
43+
# Due to the limited number of endpoints, some USB devices will be off by default.
44+
# For instance MIDI is available, but the device is turned off. It can be turned on
45+
# only if something else is turned off, such as HID.
46+
USB_NUM_ENDPOINT_PAIRS = 7
47+
USB_NUM_IN_ENDPOINTS = 5

ports/litex/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
77
INTERNAL_LIBM = 1
88

99
# Number of USB endpoint pairs.
10-
USB_NUM_EP = 16
10+
USB_NUM_ENDPOINT_PAIRS = 16
1111

1212
# Longints can be implemented as mpz, as longlong, or not
1313
LONGINT_IMPL = MPZ

ports/mimxrt10xx/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ INTERNAL_LIBM = 1
1717
USB_HIGHSPEED = 1
1818

1919
# Number of USB endpoint pairs.
20-
USB_NUM_EP = 8
20+
USB_NUM_ENDPOINT_PAIRS = 8
2121

2222
INTERNAL_FLASH_FILESYSTEM = 1
2323

ports/nrf/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
1010
INTERNAL_LIBM = 1
1111

1212
# Number of USB endpoint pairs.
13-
USB_NUM_EP = 8
13+
USB_NUM_ENDPOINT_PAIRS = 8
1414

1515
# All nRF ports have longints.
1616
LONGINT_IMPL = MPZ

ports/raspberrypi/mpconfigport.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ CIRCUITPY_AUDIOMIXER = 1
4949
INTERNAL_LIBM = 1
5050

5151
# Number of USB endpoint pairs.
52-
USB_NUM_EP = 8
52+
USB_NUM_ENDPOINT_PAIRS = 8
5353

5454
INTERNAL_FLASH_FILESYSTEM = 1

ports/stm/boards/espruino_pico/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ CIRCUITPY_AUDIOPWMIO = 0
2222
CIRCUITPY_BUSDEVICE = 0
2323
CIRCUITPY_BITMAPTOOLS = 0
2424
CIRCUITPY_FRAMEBUFFERIO = 0
25+
CIRCUITPY_MIDI = 0
26+
CIRCUITPY_MSGPACK = 0
2527
CIRCUITPY_ULAB = 0
2628
CIRCUITPY_VECTORIO = 0
2729

ports/stm/boards/pyb_nano_v2/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ LD_FILE = boards/STM32F411_fs.ld
1616
# Too big for the flash
1717
CIRCUITPY_AUDIOCORE = 0
1818
CIRCUITPY_AUDIOPWMIO = 0
19+
CIRCUITPY_MIDI = 0
20+
CIRCUITPY_MSGPACK = 0

ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ LD_FILE = boards/STM32F411_fs.ld
1515
# Too big for the flash
1616
CIRCUITPY_AUDIOCORE = 0
1717
CIRCUITPY_AUDIOPWMIO = 0
18+
CIRCUITPY_MIDI = 0
19+
CIRCUITPY_MSGPACK = 0

0 commit comments

Comments
 (0)