Skip to content

Fix endpoint checking; Clean up safe mode printing #4754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion locale/ID.po
Original file line number Diff line number Diff line change
Expand Up @@ -4538,7 +4538,7 @@ msgstr ""
#~ msgstr "Berjalan di mode aman(safe mode)! Auto-reload tidak aktif.\n"

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

#~ msgid "'async for' or 'async with' outside async function"
Expand Down
27 changes: 11 additions & 16 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,7 @@ msgid "CircuitPython core code crashed hard. Whoops!\n"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid ""
"CircuitPython is in safe mode because you pressed the reset button during "
"boot. Press again to exit safe mode.\n"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgid "CircuitPython was unable to allocate the heap."
msgstr ""

#: shared-module/bitbangio/SPI.c
Expand Down Expand Up @@ -1634,10 +1628,6 @@ msgstr ""
msgid "Not playing"
msgstr ""

#: main.c
msgid "Not running saved code.\n"
msgstr ""

#: shared-bindings/_bleio/__init__.c
msgid "Not settable"
msgstr ""
Expand Down Expand Up @@ -1950,7 +1940,7 @@ msgid "Row entry must be digitalio.DigitalInOut"
msgstr ""

#: main.c
msgid "Running in safe mode! "
msgid "Running in safe mode! Not running saved code.\n"
msgstr ""

#: shared-module/sdcardio/SDCard.c
Expand Down Expand Up @@ -2071,13 +2061,13 @@ msgstr ""
#: supervisor/shared/safe_mode.c
msgid ""
"The CircuitPython heap was corrupted because the stack was too small.\n"
"Please increase the stack size if you know how, or if not:"
"Increase the stack size if you know how. If not:"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid ""
"The `microcontroller` module was used to boot into safe mode. Press reset to "
"exit safe mode.\n"
"exit safe mode."
msgstr ""

#: shared-bindings/rgbmatrix/RGBMatrix.c
Expand All @@ -2088,7 +2078,7 @@ msgstr ""
msgid ""
"The microcontroller's power dipped. Make sure your power supply provides\n"
"enough power for the whole circuit and press reset (after ejecting "
"CIRCUITPY).\n"
"CIRCUITPY)."
msgstr ""

#: shared-module/audiomixer/MixerVoice.c
Expand Down Expand Up @@ -2382,7 +2372,12 @@ msgid "Writes not supported on Characteristic"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "You are in safe mode: something unanticipated happened.\n"
msgid "You are in safe mode because:\n"
msgstr ""

#: supervisor/shared/safe_mode.c
msgid ""
"You pressed the reset button during boot. Press again to exit safe mode."
msgstr ""

#: supervisor/shared/safe_mode.c
Expand Down
4 changes: 2 additions & 2 deletions locale/de_DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,8 @@ msgstr ""
"zu verlassen.\n"

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

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
4 changes: 2 additions & 2 deletions locale/en_GB.po
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,8 @@ msgstr ""
"boot. Press again to exit safe mode.\n"

#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr "CircuitPython was unable to allocate the heap.\n"
msgid "CircuitPython was unable to allocate the heap."
msgstr "CircuitPython was unable to allocate the heap."

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
6 changes: 3 additions & 3 deletions locale/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ msgstr ""
"durante el arranque. Presione nuevamente para salir del modo seguro.\n"

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

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

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

#~ msgid "__init__() should return None, not '%s'"
Expand Down
4 changes: 2 additions & 2 deletions locale/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@ msgstr ""
"mode sans échec.\n"

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

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
2 changes: 1 addition & 1 deletion locale/hi.po
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ msgid ""
msgstr ""

#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgid "CircuitPython was unable to allocate the heap."
msgstr ""

#: shared-module/bitbangio/SPI.c
Expand Down
8 changes: 4 additions & 4 deletions locale/ja.po
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,8 @@ msgstr ""
"度押すとセーフモードを終了します。\n"

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

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

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

#: shared-module/sdcardio/SDCard.c
msgid "SD card CSD format not supported"
Expand Down
4 changes: 2 additions & 2 deletions locale/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@ msgstr ""
"het opstarten. Druk nogmaals om veilige modus te verlaten\n"

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

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
4 changes: 2 additions & 2 deletions locale/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,8 @@ msgstr ""
"przycisk resetowania. Naciśnij ponownie, aby wyjść z trybu awaryjnego.\n"

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

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
6 changes: 3 additions & 3 deletions locale/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -743,8 +743,8 @@ msgstr ""
"de segurança.\n"

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

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

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

#~ msgid "__init__() should return None, not '%s'"
#~ msgstr "O __init__() deve retornar Nenhum, não '%s'"
Expand Down
4 changes: 2 additions & 2 deletions locale/sv.po
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,8 @@ msgstr ""
"under start. Tryck igen för att lämna säkert läge.\n"

#: supervisor/shared/safe_mode.c
msgid "CircuitPython was unable to allocate the heap.\n"
msgstr "CircuitPython kunde inte allokera heap.\n"
msgid "CircuitPython was unable to allocate the heap."
msgstr "CircuitPython kunde inte allokera heap."

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
4 changes: 2 additions & 2 deletions locale/zh_Latn_pinyin.po
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,8 @@ msgstr ""
"chóng zhì ànniǔ. Zài àn yīcì tuìchū ānquán móshì.\n"

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

#: shared-module/bitbangio/SPI.c
msgid "Clock pin init failed."
Expand Down
22 changes: 13 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,20 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) {
serial_write_compressed(translate("Auto-reload is off.\n"));
}
if (safe_mode != NO_SAFE_MODE) {
serial_write_compressed(translate("Running in safe mode! "));
serial_write_compressed(translate("Not running saved code.\n"));
serial_write_compressed(translate("Running in safe mode! Not running saved code.\n"));
}
}

STATIC bool run_code_py(safe_mode_t safe_mode) {
bool serial_connected_at_start = serial_connected();
bool printed_safe_mode_message = false;
#if CIRCUITPY_AUTORELOAD_DELAY_MS > 0
serial_write("\n");
print_code_py_status_message(safe_mode);
print_safe_mode_message(safe_mode);
serial_write("\n");
if (serial_connected_at_start) {
serial_write("\r\n");
print_code_py_status_message(safe_mode);
print_safe_mode_message(safe_mode);
printed_safe_mode_message = true;
}
#endif

pyexec_result_t result;
Expand Down Expand Up @@ -383,8 +385,11 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
print_code_py_status_message(safe_mode);
}

print_safe_mode_message(safe_mode);
serial_write("\n");
if (!printed_safe_mode_message) {
print_safe_mode_message(safe_mode);
printed_safe_mode_message = true;
}
serial_write("\r\n");
serial_write_compressed(translate("Press any key to enter the REPL. Use CTRL-D to reload.\n"));
printed_press_any_key = true;
}
Expand Down Expand Up @@ -521,7 +526,6 @@ STATIC void __attribute__ ((noinline)) run_boot_py(safe_mode_t safe_mode) {
usb_set_defaults();
#endif

// TODO(tannewt): Re-add support for flashing boot error output.
if (ok_to_run) {
bool found_boot = maybe_run_list(boot_py_filenames, NULL);
(void) found_boot;
Expand Down
2 changes: 1 addition & 1 deletion ports/atmel-samd/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif
INTERNAL_LIBM = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 8
USB_NUM_ENDPOINT_PAIRS = 8

CIRCUITPY_ROTARYIO_SOFTENCODER = 1

Expand Down
2 changes: 1 addition & 1 deletion ports/cxd56/mpconfigport.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
USB_HIGHSPEED = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 6
USB_NUM_ENDPOINT_PAIRS = 6

# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
Expand Down
17 changes: 11 additions & 6 deletions ports/esp32s2/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@ CIRCUITPY_ROTARYIO = 1
CIRCUITPY_NVM = 1
CIRCUITPY_PS2IO ?= 1
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
# We don't have enough endpoints to include MIDI.
CIRCUITPY_USB_MIDI ?= 0
CIRCUITPY_USB_HID ?= 1
# We have borrowed the VENDOR nomenclature from tinyusb. VENDOR AKA WEBUSB
CIRCUITPY_USB_VENDOR ?= 0
CIRCUITPY_WIFI = 1
CIRCUITPY_WATCHDOG ?= 1

CIRCUITPY_ESPIDF = 1

CIRCUITPY_MODULE ?= none

USB_NUM_EP = 5
# From the ESP32-S2 datasheet:
#
# Endpoint number 0 always present (bi-directional, consisting of EP0 IN and EP0 OUT)
# Six additional endpoints (endpoint numbers 1 to 6), configurable as IN or OUT
# Maximum of five IN endpoints concurrently active at any time (including EP0 IN)
#
# Due to the limited number of endpoints, some USB devices will be off by default.
# For instance MIDI is available, but the device is turned off. It can be turned on
# only if something else is turned off, such as HID.
USB_NUM_ENDPOINT_PAIRS = 7
USB_NUM_IN_ENDPOINTS = 5
2 changes: 1 addition & 1 deletion ports/litex/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
INTERNAL_LIBM = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 16
USB_NUM_ENDPOINT_PAIRS = 16

# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ
Expand Down
2 changes: 1 addition & 1 deletion ports/mimxrt10xx/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ INTERNAL_LIBM = 1
USB_HIGHSPEED = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 8
USB_NUM_ENDPOINT_PAIRS = 8

INTERNAL_FLASH_FILESYSTEM = 1

Expand Down
2 changes: 1 addition & 1 deletion ports/nrf/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
INTERNAL_LIBM = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 8
USB_NUM_ENDPOINT_PAIRS = 8

# All nRF ports have longints.
LONGINT_IMPL = MPZ
Expand Down
2 changes: 1 addition & 1 deletion ports/raspberrypi/mpconfigport.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ CIRCUITPY_AUDIOMIXER = 1
INTERNAL_LIBM = 1

# Number of USB endpoint pairs.
USB_NUM_EP = 8
USB_NUM_ENDPOINT_PAIRS = 8

INTERNAL_FLASH_FILESYSTEM = 1
2 changes: 2 additions & 0 deletions ports/stm/boards/espruino_pico/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ CIRCUITPY_AUDIOPWMIO = 0
CIRCUITPY_BUSDEVICE = 0
CIRCUITPY_BITMAPTOOLS = 0
CIRCUITPY_FRAMEBUFFERIO = 0
CIRCUITPY_MIDI = 0
CIRCUITPY_MSGPACK = 0
CIRCUITPY_ULAB = 0
CIRCUITPY_VECTORIO = 0

Expand Down
2 changes: 2 additions & 0 deletions ports/stm/boards/pyb_nano_v2/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ LD_FILE = boards/STM32F411_fs.ld
# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
CIRCUITPY_MIDI = 0
CIRCUITPY_MSGPACK = 0
2 changes: 2 additions & 0 deletions ports/stm/boards/stm32f411ve_discovery/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ LD_FILE = boards/STM32F411_fs.ld
# Too big for the flash
CIRCUITPY_AUDIOCORE = 0
CIRCUITPY_AUDIOPWMIO = 0
CIRCUITPY_MIDI = 0
CIRCUITPY_MSGPACK = 0
Loading