From 7589e53fea04d2bada44b7729432a3ee2a9237a4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 29 Jun 2022 16:31:55 -0700 Subject: [PATCH 01/35] WIP websocket accept and hashlib --- locale/circuitpython.pot | 4 + ports/espressif/common-hal/hashlib/Hash.c | 52 +++++++++ ports/espressif/common-hal/hashlib/Hash.h | 41 +++++++ ports/espressif/common-hal/hashlib/__init__.c | 40 +++++++ ports/espressif/mpconfigport.mk | 1 + py/circuitpy_defns.mk | 5 + shared-bindings/hashlib/Hash.c | 103 ++++++++++++++++++ shared-bindings/hashlib/Hash.h | 43 ++++++++ shared-bindings/hashlib/__init__.c | 90 +++++++++++++++ shared-bindings/hashlib/__init__.h | 36 ++++++ .../shared/web_workflow/static/serial.html | 16 +++ .../shared/web_workflow/static/serial.js | 43 ++++++++ .../shared/web_workflow/static/welcome.html | 2 +- supervisor/shared/web_workflow/web_workflow.c | 40 +++++++ 14 files changed, 515 insertions(+), 1 deletion(-) create mode 100644 ports/espressif/common-hal/hashlib/Hash.c create mode 100644 ports/espressif/common-hal/hashlib/Hash.h create mode 100644 ports/espressif/common-hal/hashlib/__init__.c create mode 100644 shared-bindings/hashlib/Hash.c create mode 100644 shared-bindings/hashlib/Hash.h create mode 100644 shared-bindings/hashlib/__init__.c create mode 100644 shared-bindings/hashlib/__init__.h create mode 100644 supervisor/shared/web_workflow/static/serial.html create mode 100644 supervisor/shared/web_workflow/static/serial.js diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5740e1e288..a66a386f1d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2199,6 +2199,10 @@ msgstr "" msgid "Unsupported format" msgstr "" +#: shared-bindings/hashlib/__init__.c +msgid "Unsupported hash algorithm" +msgstr "" + #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" msgstr "" diff --git a/ports/espressif/common-hal/hashlib/Hash.c b/ports/espressif/common-hal/hashlib/Hash.c new file mode 100644 index 0000000000..8e2ab02edb --- /dev/null +++ b/ports/espressif/common-hal/hashlib/Hash.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/hashlib/Hash.h" + +#include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" + +void common_hal_hashlib_hash_update(hashlib_hash_obj_t *self, const uint8_t *data, size_t datalen) { + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + mbedtls_sha1_update_ret(&self->sha1, data, datalen); + return; + } +} + +void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, size_t datalen) { + if (datalen < common_hal_hashlib_hash_get_digest_size(self)) { + return; + } + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + mbedtls_sha1_finish_ret(&self->sha1, data); + } +} + +size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self) { + if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + return 20; + } + return 0; +} diff --git a/ports/espressif/common-hal/hashlib/Hash.h b/ports/espressif/common-hal/hashlib/Hash.h new file mode 100644 index 0000000000..ece282833e --- /dev/null +++ b/ports/espressif/common-hal/hashlib/Hash.h @@ -0,0 +1,41 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H +#define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H + +#include "components/mbedtls/mbedtls/include/mbedtls/sha1.h" + +typedef struct { + mp_obj_base_t base; + union { + mbedtls_sha1_context sha1; + }; + // Of MBEDTLS_SSL_HASH_* + uint8_t hash_type; +} hashlib_hash_obj_t; + +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_HASHLIB_HASH_H diff --git a/ports/espressif/common-hal/hashlib/__init__.c b/ports/espressif/common-hal/hashlib/__init__.c new file mode 100644 index 0000000000..1e6b2a4802 --- /dev/null +++ b/ports/espressif/common-hal/hashlib/__init__.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/hashlib/__init__.h" + +#include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" + + +bool common_hal_hashlib_new(hashlib_hash_obj_t *self, const char *algorithm) { + if (strcmp(algorithm, "sha1") == 0) { + self->hash_type = MBEDTLS_SSL_HASH_SHA1; + mbedtls_sha1_init(&self->sha1); + mbedtls_sha1_starts_ret(&self->sha1); + return true; + } + return false; +} diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 2eeb86e49d..ddaa4836d3 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -19,6 +19,7 @@ CIRCUITPY_COUNTIO ?= 1 CIRCUITPY_DUALBANK ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 CIRCUITPY_FREQUENCYIO ?= 1 +CIRCUITPY_HASHLIB ?= 1 CIRCUITPY_IMAGECAPTURE ?= 1 CIRCUITPY_I2CPERIPHERAL ?= 1 CIRCUITPY_RGBMATRIX ?= 1 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index c5c89ab19f..af49c876ba 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -207,6 +207,9 @@ endif ifeq ($(CIRCUITPY_GNSS),1) SRC_PATTERNS += gnss/% endif +ifeq ($(CIRCUITPY_HASHLIB),1) +SRC_PATTERNS += hashlib/% +endif ifeq ($(CIRCUITPY_I2CPERIPHERAL),1) SRC_PATTERNS += i2cperipheral/% endif @@ -419,6 +422,8 @@ SRC_COMMON_HAL_ALL = \ gnss/GNSS.c \ gnss/PositionFix.c \ gnss/SatelliteSystem.c \ + hashlib/__init__.c \ + hashlib/Hash.c \ i2cperipheral/I2CPeripheral.c \ i2cperipheral/__init__.c \ microcontroller/Pin.c \ diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c new file mode 100644 index 0000000000..5dab05fa10 --- /dev/null +++ b/shared-bindings/hashlib/Hash.c @@ -0,0 +1,103 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "shared-bindings/hashlib/Hash.h" + +// #include "shared-bindings/util.h" + +// #include "shared/runtime/buffer_helper.h" +// #include "shared/runtime/interrupt_char.h" + +// #include "py/mperrno.h" +// #include "py/mphal.h" +#include "py/obj.h" +#include "py/objproperty.h" +#include "py/objstr.h" +#include "py/runtime.h" + +//| class Hash: +//| """In progress hash algorithm. This object is always created by a `hashlib.new()`. It has no +//| user-visible constructor.""" +//| + +//| digest_size: int +//| """Digest size in bytes""" +//| +STATIC mp_obj_t hashlib_hash_get_digest_size(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(common_hal_hashlib_hash_get_digest_size(self)); +} +MP_PROPERTY_GETTER(hashlib_hash_digest_size_obj, hashlib_hash_get_digest_size); + +//| def update(self, data: ReadableBuffer) -> None: +//| """Update the hash with the given bytes. +//| +//| :param ~circuitpython_typing.ReadableBuffer data: Update the hash from data in this buffer""" +//| ... +//| +mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + + common_hal_hashlib_hash_update(self, bufinfo.buf, bufinfo.len); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(hashlib_hash_update_obj, hashlib_hash_update); + +//| def digest(self) -> bytes: +//| """Returns the current digest as bytes() with a length of `hashlib.Hash.digest_size`.""" +//| ... +//| +STATIC mp_obj_t hashlib_hash_digest(mp_obj_t self_in) { + mp_check_self(mp_obj_is_type(self_in, &hashlib_hash_type)); + hashlib_hash_obj_t *self = MP_OBJ_TO_PTR(self_in); + + size_t size = common_hal_hashlib_hash_get_digest_size(self); + mp_obj_t obj = mp_obj_new_bytes_of_zeros(size); + mp_obj_str_t *o = MP_OBJ_TO_PTR(obj); + + common_hal_hashlib_hash_digest(self, (uint8_t *)o->data, size); + return obj; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(hashlib_hash_digest_obj, hashlib_hash_digest); + +STATIC const mp_rom_map_elem_t hashlib_hash_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_digest_size), MP_ROM_PTR(&hashlib_hash_digest_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_update), MP_ROM_PTR(&hashlib_hash_update_obj) }, + { MP_ROM_QSTR(MP_QSTR_digest), MP_ROM_PTR(&hashlib_hash_digest_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(hashlib_hash_locals_dict, hashlib_hash_locals_dict_table); + +const mp_obj_type_t hashlib_hash_type = { + { &mp_type_type }, + .name = MP_QSTR_Hash, + .locals_dict = (mp_obj_dict_t *)&hashlib_hash_locals_dict, +}; diff --git a/shared-bindings/hashlib/Hash.h b/shared-bindings/hashlib/Hash.h new file mode 100644 index 0000000000..f3845b02ff --- /dev/null +++ b/shared-bindings/hashlib/Hash.h @@ -0,0 +1,43 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB_HASH_H +#define MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB_HASH_H + +#include "py/obj.h" + +#include "common-hal/hashlib/Hash.h" + +extern const mp_obj_type_t hashlib_hash_type; + +// So that new can call it when given data. +mp_obj_t hashlib_hash_update(mp_obj_t self_in, mp_obj_t buf_in); + +void common_hal_hashlib_hash_update(hashlib_hash_obj_t *self, const uint8_t *data, size_t datalen); +void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, size_t datalen); +size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB_HASH_H diff --git a/shared-bindings/hashlib/__init__.c b/shared-bindings/hashlib/__init__.c new file mode 100644 index 0000000000..4b5be0165b --- /dev/null +++ b/shared-bindings/hashlib/__init__.c @@ -0,0 +1,90 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/obj.h" +#include "py/mpconfig.h" +#include "py/runtime.h" +#include "shared-bindings/hashlib/__init__.h" +#include "shared-bindings/hashlib/Hash.h" +#include "supervisor/shared/translate/translate.h" + +//| """Hashing related functions +//| +//| |see_cpython_module| :mod:`cpython:hashlib`. +//| """ +//| +//| def new(name, data=b"") -> hashlib.Hash: +//| """Returns a Hash object setup for the named algorithm. Raises ValueError when the named +//| algorithm is unsupported. +//| +//| :return: a hash object for the given algorithm +//| :rtype: hashlib.Hash""" +//| ... +//| +STATIC mp_obj_t hashlib_new(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_name, ARG_data }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_name, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_data, MP_ARG_OBJ, {.u_obj = mp_const_none} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const char *algorithm = mp_obj_str_get_str(args[ARG_name].u_obj); + + hashlib_hash_obj_t *self = m_new_obj(hashlib_hash_obj_t); + self->base.type = &hashlib_hash_type; + + if (!common_hal_hashlib_new(self, algorithm)) { + mp_raise_ValueError(translate("Unsupported hash algorithm")); + } + + if (args[ARG_data].u_obj != mp_const_none) { + hashlib_hash_update(self, args[ARG_data].u_obj); + } + return self; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(hashlib_new_obj, 1, hashlib_new); + +STATIC const mp_rom_map_elem_t hashlib_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hashlib) }, + + { MP_ROM_QSTR(MP_QSTR_new), MP_ROM_PTR(&hashlib_new_obj) }, + + // Hash is deliberately omitted here because CPython doesn't expose the + // object on `hashlib` only the internal `_hashlib`. +}; + +STATIC MP_DEFINE_CONST_DICT(hashlib_module_globals, hashlib_module_globals_table); + +const mp_obj_module_t hashlib_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&hashlib_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_hashlib, hashlib_module, CIRCUITPY_HASHLIB); diff --git a/shared-bindings/hashlib/__init__.h b/shared-bindings/hashlib/__init__.h new file mode 100644 index 0000000000..ae47b546a4 --- /dev/null +++ b/shared-bindings/hashlib/__init__.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB___INIT___H + +#include + +#include "shared-bindings/hashlib/Hash.h" + +bool common_hal_hashlib_new(hashlib_hash_obj_t *self, const char *algorithm); + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_HASHLIB___INIT___H diff --git a/supervisor/shared/web_workflow/static/serial.html b/supervisor/shared/web_workflow/static/serial.html new file mode 100644 index 0000000000..766a7a23e2 --- /dev/null +++ b/supervisor/shared/web_workflow/static/serial.html @@ -0,0 +1,16 @@ + + + + Simple client + + + + +

+  
+ + + +
+ + diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js new file mode 100644 index 0000000000..36c980dc08 --- /dev/null +++ b/supervisor/shared/web_workflow/static/serial.js @@ -0,0 +1,43 @@ + +var ws; + +function onSubmit() { + var input = document.getElementById("input"); + // You can send message to the Web Socket using ws.send. + ws.send(input.value); + output("send: " + input.value); + input.value = ""; + input.focus(); +} + +function onCloseClick() { + ws.close(); +} + +function output(str) { + var log = document.getElementById("log"); + log.innerHTML += str; +} + +// Connect to Web Socket +ws = new WebSocket("ws://cpy-f57ce8.local/cp/serial/"); +// ws = new WebSocket("ws://127.0.0.1:9001") + +// Set event handlers. +ws.onopen = function() { + output("onopen"); +}; + +ws.onmessage = function(e) { + // e.data contains received string. + output("onmessage: " + e.data); +}; + +ws.onclose = function() { + output("onclose"); +}; + +ws.onerror = function(e) { + output("onerror"); + console.log(e) +}; diff --git a/supervisor/shared/web_workflow/static/welcome.html b/supervisor/shared/web_workflow/static/welcome.html index 7fb68c302e..6ef1ccd767 100644 --- a/supervisor/shared/web_workflow/static/welcome.html +++ b/supervisor/shared/web_workflow/static/welcome.html @@ -3,8 +3,8 @@ CircuitPython + -

 Welcome!

Welcome to CircuitPython's Web API. Go to the file browser to work with files in the CIRCUITPY drive. Make sure you've set CIRCUITPY_WEB_API_PASSWORD='somepassword' in /.env. Provide the password when the browser prompts for it. Leave the username blank. diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index cbe1b24e86..b9a1de67f2 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -86,6 +86,10 @@ typedef struct { bool authenticated; bool expect; bool json; + bool websocket; + uint32_t websocket_version; + // RFC6455 for websockets says this header should be 24 base64 characters long. + char websocket_key[24 + 1]; } _request; static wifi_radio_error_t wifi_status = WIFI_RADIO_ERROR_NONE; @@ -519,6 +523,7 @@ static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request, "Location: http://", hostname, ".local", path, "\r\n", NULL); _cors_header(socket, request); _send_str(socket, "\r\n"); + ESP_LOGI(TAG, "redirect"); } static void _reply_directory_json(socketpool_socket_obj_t *socket, _request *request, FF_DIR *dir, const char *request_path, const char *path) { @@ -826,6 +831,8 @@ STATIC_FILE(directory_html); STATIC_FILE(directory_js); STATIC_FILE(welcome_html); STATIC_FILE(welcome_js); +STATIC_FILE(serial_html); +STATIC_FILE(serial_js); STATIC_FILE(blinka_16x16_ico); static void _reply_static(socketpool_socket_obj_t *socket, _request *request, const uint8_t *response, size_t response_len, const char *content_type) { @@ -844,6 +851,13 @@ static void _reply_static(socketpool_socket_obj_t *socket, _request *request, co #define _REPLY_STATIC(socket, request, filename) _reply_static(socket, request, filename, filename##_length, filename##_content_type) +static void _reply_websocket_upgrade(socketpool_socket_obj_t *socket, _request *request) { + ESP_LOGI(TAG, "websocket!"); + // Compute accept key + // Reply with upgrade + // Copy socket state into websocket and mark given socket as closed even though it isn't actually. +} + static bool _reply(socketpool_socket_obj_t *socket, _request *request) { if (request->redirect) { _reply_redirect(socket, request, request->path); @@ -980,6 +994,22 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { _reply_with_devices_json(socket, request); } else if (strcmp(path, "/version.json") == 0) { _reply_with_version_json(socket, request); + } else if (strcmp(path, "/serial/") == 0) { + if (!request->authenticated) { + if (_api_password[0] != '\0') { + _reply_unauthorized(socket, request); + } else { + _reply_forbidden(socket, request); + } + } else if (request->websocket) { + ESP_LOGI(TAG, "websocket!"); + _reply_websocket_upgrade(socket, request); + } else { + _REPLY_STATIC(socket, request, serial_html); + } + _reply_with_version_json(socket, request); + } else { + _reply_missing(socket, request); } } else if (strcmp(request->method, "GET") != 0) { _reply_method_not_allowed(socket, request); @@ -992,6 +1022,8 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { _REPLY_STATIC(socket, request, directory_js); } else if (strcmp(request->path, "/welcome.js") == 0) { _REPLY_STATIC(socket, request, welcome_js); + } else if (strcmp(request->path, "/serial.js") == 0) { + _REPLY_STATIC(socket, request, serial_js); } else if (strcmp(request->path, "/favicon.ico") == 0) { // TODO: Autogenerate this based on the blinka bitmap and change the // palette based on MAC address. @@ -1015,6 +1047,7 @@ static void _reset_request(_request *request) { request->authenticated = false; request->expect = false; request->json = false; + request->websocket = false; } static void _process_request(socketpool_socket_obj_t *socket, _request *request) { @@ -1111,6 +1144,13 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) strcpy(request->origin, request->header_value); } else if (strcmp(request->header_key, "X-Timestamp") == 0) { request->timestamp_ms = strtoull(request->header_value, NULL, 10); + } else if (strcmp(request->header_key, "Upgrade") == 0) { + request->websocket = strcmp(request->header_value, "websocket") == 0; + } else if (strcmp(request->header_key, "Sec-WebSocket-Version") == 0) { + request->websocket_version = strtoul(request->header_value, NULL, 10); + } else if (strcmp(request->header_key, "Sec-WebSocket-Key") == 0 && + strlen(request->header_value) == 24) { + strcpy(request->websocket_key, request->header_value); } ESP_LOGI(TAG, "Header %s %s", request->header_key, request->header_value); } else if (request->offset > sizeof(request->header_value) - 1) { From 07b2697ae387e3157616e606ed970291d487270c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 1 Jul 2022 16:57:10 -0700 Subject: [PATCH 02/35] WIP websocket to serial --- ports/espressif/common-hal/hashlib/Hash.c | 5 + py/circuitpy_mpconfig.mk | 3 + supervisor/shared/serial.c | 27 +++ supervisor/shared/web_workflow/web_workflow.c | 41 +++- supervisor/shared/web_workflow/websocket.c | 179 ++++++++++++++++++ supervisor/shared/web_workflow/websocket.h | 38 ++++ supervisor/supervisor.mk | 4 +- 7 files changed, 288 insertions(+), 9 deletions(-) create mode 100644 supervisor/shared/web_workflow/websocket.c create mode 100644 supervisor/shared/web_workflow/websocket.h diff --git a/ports/espressif/common-hal/hashlib/Hash.c b/ports/espressif/common-hal/hashlib/Hash.c index 8e2ab02edb..8090128acb 100644 --- a/ports/espressif/common-hal/hashlib/Hash.c +++ b/ports/espressif/common-hal/hashlib/Hash.c @@ -40,7 +40,12 @@ void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, siz return; } if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { + // We copy the sha1 state so we can continue to update if needed or get + // the digest a second time. + mbedtls_sha1_context copy; + mbedtls_sha1_clone(©, &self->sha1); mbedtls_sha1_finish_ret(&self->sha1, data); + mbedtls_sha1_clone(&self->sha1, ©); } } diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 8505fe1cb7..de88dcc727 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -242,6 +242,9 @@ CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO) CIRCUITPY_GNSS ?= 0 CFLAGS += -DCIRCUITPY_GNSS=$(CIRCUITPY_GNSS) +CIRCUITPY_HASHLIB ?= $(CIRCUITPY_WEB_WORKFLOW) +CFLAGS += -DCIRCUITPY_HASHLIB=$(CIRCUITPY_HASHLIB) + CIRCUITPY_I2CPERIPHERAL ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_I2CPERIPHERAL=$(CIRCUITPY_I2CPERIPHERAL) diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index af90fce4d7..04e974e4b5 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -45,6 +45,10 @@ #include "tusb.h" #endif +#if CIRCUITPY_WEB_WORKFLOW +#include "supervisor/shared/web_workflow/websocket.h" +#endif + /* * Note: DEBUG_UART currently only works on STM32 and nRF. * Enabling on another platform will cause a crash. @@ -165,6 +169,13 @@ bool serial_connected(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_connected()) { + return true; + } + #endif + + if (port_serial_connected()) { return true; } @@ -195,6 +206,12 @@ char serial_read(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_available()) { + return websocket_read_char(); + } + #endif + #if CIRCUITPY_USB_CDC if (!usb_cdc_console_enabled()) { return -1; @@ -229,6 +246,12 @@ bool serial_bytes_available(void) { } #endif + #if CIRCUITPY_WEB_WORKFLOW + if (websocket_available()) { + return true; + } + #endif + #if CIRCUITPY_USB_CDC if (usb_cdc_console_enabled() && tud_cdc_available() > 0) { return true; @@ -271,6 +294,10 @@ void serial_write_substring(const char *text, uint32_t length) { ble_serial_write(text, length); #endif + #if CIRCUITPY_WEB_WORKFLOW + websocket_write(text, length); + #endif + #if CIRCUITPY_USB_CDC if (!usb_cdc_console_enabled()) { return; diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index b9a1de67f2..07298c17e9 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -39,8 +39,11 @@ #include "supervisor/shared/reload.h" #include "supervisor/shared/translate/translate.h" #include "supervisor/shared/web_workflow/web_workflow.h" +#include "supervisor/shared/web_workflow/websocket.h" #include "supervisor/usb.h" +#include "shared-bindings/hashlib/__init__.h" +#include "shared-bindings/hashlib/Hash.h" #include "shared-bindings/mdns/RemoteService.h" #include "shared-bindings/mdns/Server.h" #include "shared-bindings/socketpool/__init__.h" @@ -260,20 +263,19 @@ void supervisor_start_web_workflow(void) { active.num = -1; active.connected = false; + websocket_init(); + // TODO: // GET /cp/serial.txt // - Most recent 1k of serial output. // GET /edit/ // - Super basic editor - // GET /ws/circuitpython - // GET /ws/user - // - WebSockets #endif } static void _send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { int sent = -EAGAIN; - while (sent == -EAGAIN) { + while (sent == -EAGAIN && common_hal_socketpool_socket_get_connected(socket)) { sent = socketpool_socket_send(socket, buf, len); } if (sent < len) { @@ -851,17 +853,39 @@ static void _reply_static(socketpool_socket_obj_t *socket, _request *request, co #define _REPLY_STATIC(socket, request, filename) _reply_static(socket, request, filename, filename##_length, filename##_content_type) + + static void _reply_websocket_upgrade(socketpool_socket_obj_t *socket, _request *request) { ESP_LOGI(TAG, "websocket!"); // Compute accept key + hashlib_hash_obj_t hash; + common_hal_hashlib_new(&hash, "sha1"); + common_hal_hashlib_hash_update(&hash, (const uint8_t *)request->websocket_key, strlen(request->websocket_key)); + const char *magic_string = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"; + common_hal_hashlib_hash_update(&hash, (const uint8_t *)magic_string, strlen(magic_string)); + size_t digest_size = common_hal_hashlib_hash_get_digest_size(&hash); + size_t encoded_size = (digest_size + 1) * 4 / 3 + 1; + uint8_t encoded_accept[encoded_size]; + common_hal_hashlib_hash_digest(&hash, encoded_accept, sizeof(encoded_accept)); + _base64_in_place((char *)encoded_accept, digest_size, encoded_size); + // Reply with upgrade - // Copy socket state into websocket and mark given socket as closed even though it isn't actually. + _send_strs(socket, "HTTP/1.1 101 Switching Protocols\r\n", + "Upgrade: websocket\r\n", + "Connection: Upgrade\r\n", + "Sec-WebSocket-Accept: ", encoded_accept, "\r\n", + "\r\n", NULL); + websocket_handoff(socket); + + ESP_LOGI(TAG, "socket upgrade done"); + // socket is now closed and "disconnected". } static bool _reply(socketpool_socket_obj_t *socket, _request *request) { if (request->redirect) { _reply_redirect(socket, request, request->path); } else if (strlen(request->origin) > 0 && !_origin_ok(request->origin)) { + ESP_LOGI(TAG, "bad origin %s", request->origin); _reply_forbidden(socket, request); } else if (memcmp(request->path, "/fs/", 4) == 0) { if (!request->authenticated) { @@ -995,7 +1019,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { } else if (strcmp(path, "/version.json") == 0) { _reply_with_version_json(socket, request); } else if (strcmp(path, "/serial/") == 0) { - if (!request->authenticated) { + if (false && !request->authenticated) { if (_api_password[0] != '\0') { _reply_unauthorized(socket, request); } else { @@ -1007,7 +1031,6 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { } else { _REPLY_STATIC(socket, request, serial_html); } - _reply_with_version_json(socket, request); } else { _reply_missing(socket, request); } @@ -1177,6 +1200,7 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) return; } bool reload = _reply(socket, request); + ESP_LOGI(TAG, "reply done"); _reset_request(request); autoreload_resume(AUTORELOAD_SUSPEND_WEB); if (reload) { @@ -1194,10 +1218,12 @@ void supervisor_web_workflow_background(void) { uint32_t port; int newsoc = socketpool_socket_accept(&listening, (uint8_t *)&ip, &port); if (newsoc == -EBADF) { + ESP_LOGI(TAG, "listen closed"); common_hal_socketpool_socket_close(&listening); return; } if (newsoc > 0) { + ESP_LOGI(TAG, "new socket %d", newsoc); // Close the active socket because we have another we accepted. if (!common_hal_socketpool_socket_get_closed(&active)) { common_hal_socketpool_socket_close(&active); @@ -1218,6 +1244,7 @@ void supervisor_web_workflow_background(void) { // If we have a request in progress, continue working on it. if (common_hal_socketpool_socket_get_connected(&active)) { + ESP_LOGI(TAG, "active connected"); _process_request(&active, &active_request); } } diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c new file mode 100644 index 0000000000..8aec9d206c --- /dev/null +++ b/supervisor/shared/web_workflow/websocket.c @@ -0,0 +1,179 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/shared/web_workflow/websocket.h" + +typedef struct { + socketpool_socket_obj_t socket; + uint8_t opcode; + uint8_t frame_len; + uint8_t payload_len_size; + bool masked; + uint32_t mask; + size_t frame_index; + size_t payload_remaining; +} _websocket; + +static _websocket cp_serial; + +static const char *TAG = "CP websocket"; + +void websocket_init(void) { + cp_serial.socket.num = -1; + cp_serial.socket.connected = false; +} + +void websocket_handoff(socketpool_socket_obj_t *socket) { + ESP_LOGI(TAG, "socket handed off"); + cp_serial.socket = *socket; + // Mark the original socket object as closed without telling the lower level. + socket->connected = false; + socket->num = -1; + ESP_LOGI(TAG, "socket hand off done"); +} + +bool websocket_connected(void) { + return common_hal_socketpool_socket_get_connected(&cp_serial.socket); +} + +static bool _read_byte(uint8_t *c) { + int len = socketpool_socket_recv_into(&cp_serial.socket, c, 1); + if (len != 1) { + if (len != -EAGAIN) { + ESP_LOGE(TAG, "recv error %d", len); + } + return false; + } + return true; +} + +static void _read_next_frame_header(void) { + uint8_t h; + if (cp_serial.frame_index == 0 && _read_byte(&h)) { + cp_serial.frame_index++; + cp_serial.opcode = h & 0xf; + ESP_LOGI(TAG, "fin %d opcode %x", h >> 7, cp_serial.opcode); + } + if (cp_serial.frame_index == 1 && _read_byte(&h)) { + cp_serial.frame_index++; + uint8_t len = h & 0xf; + cp_serial.masked = (h >> 7) == 1; + if (len <= 125) { + cp_serial.payload_remaining = len; + cp_serial.payload_len_size = 0; + } else if (len == 126) { // 16 bit length + cp_serial.payload_len_size = 2; + } else if (len == 127) { // 64 bit length + cp_serial.payload_len_size = 8; + } + cp_serial.frame_len = 2 + cp_serial.payload_len_size; + if (cp_serial.masked) { + cp_serial.frame_len += 4; + } + + ESP_LOGI(TAG, "mask %d length %x", cp_serial.masked, len); + } + while (cp_serial.frame_index > 1 && + cp_serial.frame_index < (cp_serial.payload_len_size + 2) && + _read_byte(&h)) { + cp_serial.frame_index++; + cp_serial.payload_remaining = cp_serial.payload_remaining << 8 | c; + } + while (cp_serial.frame_index > (cp_serial.payload_len_size + 2) && + cp_serial.frame_index < cp_serial.frame_len && + _read_byte(&h)) { + cp_serial.frame_index++; + cp_serial.mask = cp_serial.mask << 8 | c; + } +} + +static bool _read_next_payload_byte(uint8_t *c) { + _read_next_frame_header(); + if (cp_serial.frame_index > cp_serial.frame_len && + cp_serial.payload_remaining > 0) { + if (_read_byte(c)) { + cp_serial.frame_index++; + cp_serial.payload_remaining--; + return true; + } + } + return false; +} + +bool websocket_available(void) { + if (!websocket_connected()) { + return false; + } + _read_next_frame_header(); + return cp_serial.payload_remaining > 0 && cp_serial.frame_index >= cp_serial.frame_len; +} + +char websocket_read_char(void) { + return _read_next_payload_byte(); +} + +static void _send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { + int sent = -EAGAIN; + while (sent == -EAGAIN) { + sent = socketpool_socket_send(socket, buf, len); + } + if (sent < len) { + ESP_LOGE(TAG, "short send %d %d", sent, len); + } +} + +static void _websocket_send(_websocket *ws, const char *text, size_t len) { + if (!websocket_connected()) { + return; + } + uint32_t opcode = 1; + uint8_t frame_header[2]; + frame_header[0] = 1 << 7 | opcode; + uint8_t payload_len; + if (len <= 125) { + payload_len = len; + } else if (len < (1 << 16)) { + payload_len = 126; + } else { + payload_len = 127; + } + frame_header[1] = payload_len; + _send_raw(&ws->socket, (const uint8_t *)frame_header, 2); + if (payload_len == 126) { + _send_raw(&ws->socket, (const uint8_t *)&len, 2); + } else if (payload_len == 127) { + uint32_t zero = 0; + // 64 bits where top four bytes are zero. + _send_raw(&ws->socket, (const uint8_t *)&zero, 4); + _send_raw(&ws->socket, (const uint8_t *)&len, 4); + } + _send_raw(&ws->socket, (const uint8_t *)text, len); + ESP_LOGI(TAG, "sent over websocket: %s", text); +} + +void websocket_write(const char *text, size_t len) { + _websocket_send(&cp_serial, text, len); +} diff --git a/supervisor/shared/web_workflow/websocket.h b/supervisor/shared/web_workflow/websocket.h new file mode 100644 index 0000000000..c5c5114586 --- /dev/null +++ b/supervisor/shared/web_workflow/websocket.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include + +#include "shared-bindings/socketpool/Socket.h" + +void websocket_init(void); +void websocket_handoff(socketpool_socket_obj_t *socket); +bool websocket_connected(void); +bool websocket_available(void); +char websocket_read_char(void); +void websocket_write(const char *text, size_t len); diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 45df5f687f..5b8cb513a7 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -168,8 +168,8 @@ $(BUILD)/autogen_web_workflow_static.c: ../../tools/gen_web_workflow_static.py $ $(STATIC_RESOURCES) ifeq ($(CIRCUITPY_WEB_WORKFLOW),1) - SRC_SUPERVISOR += supervisor/shared/web_workflow/web_workflow.c - + SRC_SUPERVISOR += supervisor/shared/web_workflow/web_workflow.c \ + supervisor/shared/web_workflow/websocket.c SRC_SUPERVISOR += $(BUILD)/autogen_web_workflow_static.c endif From cd77517b2f95271a709bb9d6a2726256da7960e0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 5 Jul 2022 16:35:42 -0700 Subject: [PATCH 03/35] Add build for ESP32-S3 Box Lite --- .../boards/espressif_esp32s3_box_lite/board.c | 109 ++++++++++++++++++ .../mpconfigboard.h | 30 +++++ .../mpconfigboard.mk | 17 +++ .../boards/espressif_esp32s3_box_lite/pins.c | 67 +++++++++++ .../espressif_esp32s3_box_lite/sdkconfig | 37 ++++++ 5 files changed, 260 insertions(+) create mode 100644 ports/espressif/boards/espressif_esp32s3_box_lite/board.c create mode 100644 ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32s3_box_lite/pins.c create mode 100644 ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c new file mode 100644 index 0000000000..1f439e52fb --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -0,0 +1,109 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +uint8_t display_init_sequence[] = { + 0x01, 0x80, 0x96, // _SWRESET and Delay 150ms + 0x11, 0x80, 0xFF, // _SLPOUT and Delay 500ms + 0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms + 0x13, 0x80, 0x0A, // _NORON and Delay 10ms + 0x36, 0x01, 0xC8, // _MADCTL + 0x29, 0x80, 0xFF, // _DISPON and Delay 500ms +}; + +void board_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO4, // TFT_DC Command or data + &pin_GPIO5, // TFT_CS Chip select + &pin_GPIO48, // TFT_RST Reset + 60000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width + 240, // Height + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO45, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + false, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency + + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h new file mode 100644 index 0000000000..fddcddc7c3 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.h @@ -0,0 +1,30 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +// Micropython setup + +#define MICROPY_HW_BOARD_NAME "ESP32-S3-Box-Lite" +#define MICROPY_HW_MCU_NAME "ESP32S3" diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk new file mode 100644 index 0000000000..647ad3440a --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x303A +USB_PID = 0x7005 +USB_PRODUCT = "ESP32-S3-Box-Lite" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=16MB diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c b/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c new file mode 100644 index 0000000000..73ef15697c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/pins.c @@ -0,0 +1,67 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // First PMOD connector + { MP_ROM_QSTR(MP_QSTR_G9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_U0TXD), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_G43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_U0RXD), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_G44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_CS), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_G10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_G11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_CLK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_G12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_G14), MP_ROM_PTR(&pin_GPIO14) }, + + // Second PMOD connector + { MP_ROM_QSTR(MP_QSTR_G38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_G39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_G40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_G41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_G42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_G21), MP_ROM_PTR(&pin_GPIO21) }, + + // LCD & touchscreen + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_LCD_SCK), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CTRL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_GPIO3) }, + + // Audio + { MP_ROM_QSTR(MP_QSTR_I2S_ADC_SDOUT), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_MCLK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SCLK), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_I2S_LRCK), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_I2S_CODEC_DSDIN), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_PA_CTRL), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_MUTE_STATUS), MP_ROM_PTR(&pin_GPIO1) }, + + // Internal I2C bus + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + + // boot button, also usable as a software button + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig new file mode 100644 index 0000000000..7fcf8ef297 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -0,0 +1,37 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=-1 +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +# CONFIG_SPIRAM_USE_MEMMAP is not set +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP From d83720f6595c16df580acb67918f73bc2df8e721 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 5 Jul 2022 17:02:52 -0700 Subject: [PATCH 04/35] Tweak display init --- ports/espressif/boards/espressif_esp32s3_box_lite/board.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c index 1f439e52fb..dbd3c17313 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -37,8 +37,9 @@ uint8_t display_init_sequence[] = { 0x01, 0x80, 0x96, // _SWRESET and Delay 150ms 0x11, 0x80, 0xFF, // _SLPOUT and Delay 500ms 0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms + 0x21, 0x80, 10, // _INVON 0x13, 0x80, 0x0A, // _NORON and Delay 10ms - 0x36, 0x01, 0xC8, // _MADCTL + 0x36, 0x01, 0x80, // _MADCTL 0x29, 0x80, 0xFF, // _DISPON and Delay 500ms }; From a4035aa1f73ea1033743d918948d80a71b88dab5 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 6 Jul 2022 17:05:14 -0700 Subject: [PATCH 05/35] websocket serial kinda works --- .../shared/web_workflow/static/serial.js | 10 +++--- supervisor/shared/web_workflow/web_workflow.c | 3 +- supervisor/shared/web_workflow/websocket.c | 34 ++++++++++++++----- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js index 36c980dc08..5fb80b59fa 100644 --- a/supervisor/shared/web_workflow/static/serial.js +++ b/supervisor/shared/web_workflow/static/serial.js @@ -5,7 +5,7 @@ function onSubmit() { var input = document.getElementById("input"); // You can send message to the Web Socket using ws.send. ws.send(input.value); - output("send: " + input.value); + // output("send: " + input.value); input.value = ""; input.focus(); } @@ -25,19 +25,19 @@ ws = new WebSocket("ws://cpy-f57ce8.local/cp/serial/"); // Set event handlers. ws.onopen = function() { - output("onopen"); + console.log("onopen"); }; ws.onmessage = function(e) { // e.data contains received string. - output("onmessage: " + e.data); + output(e.data); }; ws.onclose = function() { - output("onclose"); + console.log("onclose"); }; ws.onerror = function(e) { - output("onerror"); + // output("onerror"); console.log(e) }; diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 07298c17e9..c7bf673fdc 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -1059,6 +1059,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { } static void _reset_request(_request *request) { + ESP_LOGI(TAG, "reset request"); request->state = STATE_METHOD; request->origin[0] = '\0'; request->content_length = 0; @@ -1244,7 +1245,7 @@ void supervisor_web_workflow_background(void) { // If we have a request in progress, continue working on it. if (common_hal_socketpool_socket_get_connected(&active)) { - ESP_LOGI(TAG, "active connected"); + // ESP_LOGI(TAG, "active connected %d", active_request.in_progress); _process_request(&active, &active_request); } } diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c index 8aec9d206c..446f2073c3 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -32,8 +32,8 @@ typedef struct { uint8_t frame_len; uint8_t payload_len_size; bool masked; - uint32_t mask; - size_t frame_index; + uint8_t mask[4]; + int frame_index; size_t payload_remaining; } _websocket; @@ -96,27 +96,38 @@ static void _read_next_frame_header(void) { ESP_LOGI(TAG, "mask %d length %x", cp_serial.masked, len); } - while (cp_serial.frame_index > 1 && + while (cp_serial.frame_index >= 2 && cp_serial.frame_index < (cp_serial.payload_len_size + 2) && _read_byte(&h)) { cp_serial.frame_index++; - cp_serial.payload_remaining = cp_serial.payload_remaining << 8 | c; + cp_serial.payload_remaining = cp_serial.payload_remaining << 8 | h; } - while (cp_serial.frame_index > (cp_serial.payload_len_size + 2) && + int mask_start = cp_serial.payload_len_size + 2; + while (cp_serial.frame_index >= mask_start && cp_serial.frame_index < cp_serial.frame_len && _read_byte(&h)) { + size_t mask_offset = cp_serial.frame_index - mask_start; + cp_serial.mask[mask_offset] = h; cp_serial.frame_index++; - cp_serial.mask = cp_serial.mask << 8 | c; + ESP_LOGI(TAG, "mask %08x", (uint32_t)*cp_serial.mask); } } static bool _read_next_payload_byte(uint8_t *c) { _read_next_frame_header(); - if (cp_serial.frame_index > cp_serial.frame_len && + if (cp_serial.frame_index >= cp_serial.frame_len && cp_serial.payload_remaining > 0) { if (_read_byte(c)) { + uint8_t mask_offset = (cp_serial.frame_index - cp_serial.frame_len) % 4; + ESP_LOGI(TAG, "payload byte read %02x mask offset %d", *c, mask_offset); + *c ^= cp_serial.mask[mask_offset]; + ESP_LOGI(TAG, "byte unmasked %02x", *c); cp_serial.frame_index++; cp_serial.payload_remaining--; + ESP_LOGI(TAG, "payload remaining %d", cp_serial.payload_remaining); + if (cp_serial.payload_remaining == 0) { + cp_serial.frame_index = 0; + } return true; } } @@ -132,7 +143,9 @@ bool websocket_available(void) { } char websocket_read_char(void) { - return _read_next_payload_byte(); + uint8_t c; + _read_next_payload_byte(&c); + return c; } static void _send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { @@ -171,7 +184,10 @@ static void _websocket_send(_websocket *ws, const char *text, size_t len) { _send_raw(&ws->socket, (const uint8_t *)&len, 4); } _send_raw(&ws->socket, (const uint8_t *)text, len); - ESP_LOGI(TAG, "sent over websocket: %s", text); + char copy[len]; + memcpy(copy, text, len); + copy[len] = '\0'; + ESP_LOGI(TAG, "sent over websocket: %s", copy); } void websocket_write(const char *text, size_t len) { From 432ea886e737c956fb83e7b7155ea45f64792b8f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 13:26:10 -0500 Subject: [PATCH 06/35] update ulab to 5.0.9 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 5d01882c41..308627c9aa 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 5d01882c41dbc4115bc94f0b61c093d5a6b812b6 +Subproject commit 308627c9aa862698725b2ba22fa2e8b2300e6803 From 1c3655c07b2e2345c8095be490f1cec00753f77a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 13:28:54 -0500 Subject: [PATCH 07/35] update translations --- locale/circuitpython.pot | 55 ++++++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5740e1e288..465eabe0e4 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2352,6 +2352,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2719,6 +2723,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2810,6 +2818,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2913,7 +2925,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3061,7 +3073,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3128,6 +3140,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3136,11 +3152,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3341,7 +3353,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3590,7 +3602,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3740,6 +3752,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4175,6 +4188,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4216,7 +4237,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4224,6 +4255,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" From 8d816db108892ffe592ff83adbe4c86caaf0de86 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 13:42:03 -0500 Subject: [PATCH 08/35] update expected results of help(modules) --- tests/unix/extra_coverage.py.exp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 98e56439ef..582d90e1bc 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -38,12 +38,12 @@ hashlib json math qrio rainbowio re sys termios traceback ubinascii uctypes uerrno uheapq uio ujson ulab -ulab.fft ulab.linalg ulab.numpy ulab.scipy -ulab.scipy.linalg ulab.scipy.optimize -ulab.scipy.signal ulab.scipy.special -ulab.utils uos urandom ure -uselect ustruct utime utimeq -uzlib zlib +ulab.numpy ulab.numpy.fft ulab.numpy.linalg +ulab.scipy ulab.scipy.linalg +ulab.scipy.optimize ulab.scipy.signal +ulab.scipy.special ulab.utils uos +urandom ure uselect ustruct +utime utimeq uzlib zlib ime utime utimeq From 601eb91b89b33806e1af78ed3ff7bb83a29cf1d3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 17:00:00 -0500 Subject: [PATCH 09/35] Disable gifio on matrixportal to reclaim flash space --- ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk index 8fccfa8f29..6db1a3c93a 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk @@ -13,6 +13,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_LTO_PARTITION = one CIRCUITPY_AESIO = 0 +CIRCUITPY_GIFIO = 0 CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_SDCARDIO = 0 From 989acab11ab904d822f6c1c49f897941e77e18bc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 17:16:48 -0500 Subject: [PATCH 10/35] Pull in a fix for ulab on REPR_A builds (some broadcom builds) --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 308627c9aa..346c936e14 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 308627c9aa862698725b2ba22fa2e8b2300e6803 +Subproject commit 346c936e14c6ea3a8d3d65cb1fa46202dc92999d From c4dfd8e30a50063db43a004c2cd6f2d0eba366a5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 17:17:15 -0500 Subject: [PATCH 11/35] Fix default BOARD setting & messages It's important that these lines NOT be indented with tabs, because that provokes Make to say that commands appear before a target. --- ports/broadcom/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index 9731f819eb..757e7f3450 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -1,12 +1,12 @@ # Select the board to build for. -BOARD=raspberrypi_pi4 +BOARD?=raspberrypi_pi4b ifeq ($(BOARD),) - $(error You must provide a BOARD parameter) + $(error You must provide a BOARD parameter) else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(error Invalid BOARD specified) - endif + ifeq ($(wildcard boards/$(BOARD)/.),) + $(error Invalid BOARD "$(BOARD)" specified) + endif endif # If the build directory is not given, make it reflect the board name. From 8d9c9952981d5c8eb10f7db2da587a8aabc360bd Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 7 Jul 2022 16:55:04 -0700 Subject: [PATCH 12/35] Support ping & close. Refine html and js for serial --- .../shared/web_workflow/static/serial.html | 8 +-- .../shared/web_workflow/static/serial.js | 36 +++++++++- supervisor/shared/web_workflow/websocket.c | 68 +++++++++++++++---- 3 files changed, 89 insertions(+), 23 deletions(-) diff --git a/supervisor/shared/web_workflow/static/serial.html b/supervisor/shared/web_workflow/static/serial.html index 766a7a23e2..d8ab86a7c8 100644 --- a/supervisor/shared/web_workflow/static/serial.html +++ b/supervisor/shared/web_workflow/static/serial.html @@ -7,10 +7,8 @@

-  
- - - -
+ + + diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js index 5fb80b59fa..ab0893ad08 100644 --- a/supervisor/shared/web_workflow/static/serial.js +++ b/supervisor/shared/web_workflow/static/serial.js @@ -1,8 +1,20 @@ var ws; +var input = document.getElementById("input"); +var title = document.querySelector("title"); + +function set_enabled(enabled) { + input.disabled = !enabled; + var buttons = document.querySelectorAll("button"); + for (button of buttons) { + button.disabled = !enabled; + } +} + +set_enabled(false); function onSubmit() { - var input = document.getElementById("input"); + console.log("submit"); // You can send message to the Web Socket using ws.send. ws.send(input.value); // output("send: " + input.value); @@ -11,6 +23,7 @@ function onSubmit() { } function onCloseClick() { + console.log("close clicked"); ws.close(); } @@ -26,18 +39,35 @@ ws = new WebSocket("ws://cpy-f57ce8.local/cp/serial/"); // Set event handlers. ws.onopen = function() { console.log("onopen"); + set_enabled(true); }; +var setting_title = false; ws.onmessage = function(e) { // e.data contains received string. - output(e.data); + if (e.data == "\x1b]0;") { + setting_title = true; + title.textContent = ""; + } else if (e.data == "\x1b\\") { + setting_title = false; + } else if (setting_title) { + title.textContent += e.data; + } else { + output(e.data); + } }; ws.onclose = function() { console.log("onclose"); + set_enabled(false); }; ws.onerror = function(e) { // output("onerror"); - console.log(e) + console.log(e); + set_enabled(false); }; + +input.onbeforeinput = function(e) { + console.log(e); +} diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c index 446f2073c3..0f4c4fc84c 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -32,6 +32,7 @@ typedef struct { uint8_t frame_len; uint8_t payload_len_size; bool masked; + bool closed; uint8_t mask[4]; int frame_index; size_t payload_remaining; @@ -49,6 +50,10 @@ void websocket_init(void) { void websocket_handoff(socketpool_socket_obj_t *socket) { ESP_LOGI(TAG, "socket handed off"); cp_serial.socket = *socket; + cp_serial.closed = false; + cp_serial.opcode = 0; + cp_serial.frame_index = 0; + cp_serial.frame_len = 2; // Mark the original socket object as closed without telling the lower level. socket->connected = false; socket->num = -1; @@ -56,7 +61,7 @@ void websocket_handoff(socketpool_socket_obj_t *socket) { } bool websocket_connected(void) { - return common_hal_socketpool_socket_get_connected(&cp_serial.socket); + return !cp_serial.closed && common_hal_socketpool_socket_get_connected(&cp_serial.socket); } static bool _read_byte(uint8_t *c) { @@ -70,6 +75,16 @@ static bool _read_byte(uint8_t *c) { return true; } +static void _send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { + int sent = -EAGAIN; + while (sent == -EAGAIN) { + sent = socketpool_socket_send(socket, buf, len); + } + if (sent < len) { + ESP_LOGE(TAG, "short send on %d err %d len %d", socket->num, sent, len); + } +} + static void _read_next_frame_header(void) { uint8_t h; if (cp_serial.frame_index == 0 && _read_byte(&h)) { @@ -111,20 +126,53 @@ static void _read_next_frame_header(void) { cp_serial.frame_index++; ESP_LOGI(TAG, "mask %08x", (uint32_t)*cp_serial.mask); } + // Reply to PINGs and CLOSE. + while ((cp_serial.opcode == 0x8 || + cp_serial.opcode == 0x9) && + cp_serial.frame_index >= cp_serial.frame_len) { + + if (cp_serial.frame_index == cp_serial.frame_len) { + uint8_t opcode = 0x8; // CLOSE + if (cp_serial.opcode == 0x9) { + ESP_LOGI(TAG, "websocket ping"); + opcode = 0xA; // PONG + } + uint8_t frame_header[2]; + frame_header[0] = 1 << 7 | opcode; + if (cp_serial.payload_remaining > 125) { + ESP_LOGE(TAG, "CLOSE or PING has long payload"); + } + frame_header[1] = cp_serial.payload_remaining; + _send_raw(&cp_serial.socket, (const uint8_t *)frame_header, 2); + } + + if (cp_serial.payload_remaining > 0 && _read_byte(&h)) { + // Send the payload back to the client. + cp_serial.frame_index++; + cp_serial.payload_remaining--; + _send_raw(&cp_serial.socket, &h, 1); + } + + if (cp_serial.payload_remaining == 0) { + cp_serial.frame_index = 0; + if (cp_serial.opcode == 0x8) { + ESP_LOGI(TAG, "websocket closed"); + cp_serial.closed = true; + } + } + } } static bool _read_next_payload_byte(uint8_t *c) { _read_next_frame_header(); - if (cp_serial.frame_index >= cp_serial.frame_len && + if (cp_serial.opcode == 0x1 && + cp_serial.frame_index >= cp_serial.frame_len && cp_serial.payload_remaining > 0) { if (_read_byte(c)) { uint8_t mask_offset = (cp_serial.frame_index - cp_serial.frame_len) % 4; - ESP_LOGI(TAG, "payload byte read %02x mask offset %d", *c, mask_offset); *c ^= cp_serial.mask[mask_offset]; - ESP_LOGI(TAG, "byte unmasked %02x", *c); cp_serial.frame_index++; cp_serial.payload_remaining--; - ESP_LOGI(TAG, "payload remaining %d", cp_serial.payload_remaining); if (cp_serial.payload_remaining == 0) { cp_serial.frame_index = 0; } @@ -148,16 +196,6 @@ char websocket_read_char(void) { return c; } -static void _send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { - int sent = -EAGAIN; - while (sent == -EAGAIN) { - sent = socketpool_socket_send(socket, buf, len); - } - if (sent < len) { - ESP_LOGE(TAG, "short send %d %d", sent, len); - } -} - static void _websocket_send(_websocket *ws, const char *text, size_t len) { if (!websocket_connected()) { return; From ab3e78661157c08b68d3290b5d84a3b1a2bc8c07 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jul 2022 20:00:12 -0500 Subject: [PATCH 13/35] disable additional module on matrixportal_m4 --- ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk index 6db1a3c93a..e502f6b569 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk @@ -13,6 +13,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_LTO_PARTITION = one CIRCUITPY_AESIO = 0 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_GIFIO = 0 CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PARALLELDISPLAY = 0 From d3e1d1b10406f096608191758de7bebfefdade44 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Thu, 7 Jul 2022 19:42:11 -0700 Subject: [PATCH 14/35] Fix #6559 --- ports/espressif/common-hal/wifi/Radio.c | 8 ++++---- shared-bindings/wifi/Radio.c | 6 +++--- shared-bindings/wifi/Radio.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 698da291e7..9715894f78 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -139,14 +139,14 @@ void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t esp_wifi_set_mac(ESP_IF_WIFI_STA, mac); } -uint8_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { +float common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { int8_t tx_power; esp_wifi_get_max_tx_power(&tx_power); - return tx_power / 4; + return tx_power / 4.0; } -void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const uint8_t tx_power) { - esp_wifi_set_max_tx_power(tx_power * 4); +void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const float tx_power) { + esp_wifi_set_max_tx_power(tx_power * 4.0); } mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self) { diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index a0a4df2548..bcd998d806 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -138,17 +138,17 @@ MP_PROPERTY_GETSET(wifi_radio_mac_address_obj, (mp_obj_t)&wifi_radio_get_mac_address_obj, (mp_obj_t)&wifi_radio_set_mac_address_obj); -//| tx_power: int +//| tx_power: float //| """Wifi transmission power, in dBm.""" //| STATIC mp_obj_t wifi_radio_get_tx_power(mp_obj_t self_in) { wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_int(common_hal_wifi_radio_get_tx_power(self)); + return mp_obj_new_float(common_hal_wifi_radio_get_tx_power(self)); } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_tx_power_obj, wifi_radio_get_tx_power); STATIC mp_obj_t wifi_radio_set_tx_power(mp_obj_t self_in, mp_obj_t tx_power_in) { - mp_int_t tx_power = mp_obj_get_int(tx_power_in); + mp_float_t tx_power = mp_obj_get_float(tx_power_in); wifi_radio_obj_t *self = MP_OBJ_TO_PTR(self_in); common_hal_wifi_radio_set_tx_power(self, tx_power); return mp_const_none; diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index e89e22ebe9..1e389b6c56 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -82,8 +82,8 @@ extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint8_t *mac); -extern uint8_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self); -extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const uint8_t power); +extern float common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const float power); extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self); From bc14b7ad47ccc1a32727f163d529ab271709ed1c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 8 Jul 2022 15:40:59 -0700 Subject: [PATCH 15/35] Fix the display on the esp box lite --- ports/espressif/boards/espressif_esp32s3_box_lite/board.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c index dbd3c17313..71659f4b0e 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -37,9 +37,9 @@ uint8_t display_init_sequence[] = { 0x01, 0x80, 0x96, // _SWRESET and Delay 150ms 0x11, 0x80, 0xFF, // _SLPOUT and Delay 500ms 0x3A, 0x81, 0x55, 0x0A, // _COLMOD and Delay 10ms - 0x21, 0x80, 10, // _INVON + 0x21, 0x80, 0x0A, // _INVON 0x13, 0x80, 0x0A, // _NORON and Delay 10ms - 0x36, 0x01, 0x80, // _MADCTL + 0x36, 0x01, 0xA0, // _MADCTL 0x29, 0x80, 0xFF, // _DISPON and Delay 500ms }; From 557e35469f7bece08c68a65a29dca82126c4b242 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 8 Jul 2022 16:57:19 -0700 Subject: [PATCH 16/35] Make serial page work ok including on mobile --- .../shared/web_workflow/static/serial.html | 22 +++++-- .../shared/web_workflow/static/serial.js | 60 +++++++++++-------- supervisor/shared/web_workflow/websocket.c | 9 ++- 3 files changed, 59 insertions(+), 32 deletions(-) diff --git a/supervisor/shared/web_workflow/static/serial.html b/supervisor/shared/web_workflow/static/serial.html index d8ab86a7c8..aaf416b8b3 100644 --- a/supervisor/shared/web_workflow/static/serial.html +++ b/supervisor/shared/web_workflow/static/serial.html @@ -1,14 +1,24 @@ - + + Simple client - -

-  
-  
-  
+
+  
+

+     
+  
+
+
+ Ctrl + + +
+ + +
diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js index ab0893ad08..595bbe6653 100644 --- a/supervisor/shared/web_workflow/static/serial.js +++ b/supervisor/shared/web_workflow/static/serial.js @@ -1,7 +1,9 @@ var ws; var input = document.getElementById("input"); +input.value = ""; var title = document.querySelector("title"); +var log = document.getElementById("log"); function set_enabled(enabled) { input.disabled = !enabled; @@ -14,35 +16,21 @@ function set_enabled(enabled) { set_enabled(false); function onSubmit() { - console.log("submit"); - // You can send message to the Web Socket using ws.send. - ws.send(input.value); - // output("send: " + input.value); - input.value = ""; - input.focus(); -} - -function onCloseClick() { - console.log("close clicked"); - ws.close(); -} - -function output(str) { - var log = document.getElementById("log"); - log.innerHTML += str; + ws.send("\r"); + input.value = ""; + input.focus(); } // Connect to Web Socket -ws = new WebSocket("ws://cpy-f57ce8.local/cp/serial/"); -// ws = new WebSocket("ws://127.0.0.1:9001") +ws = new WebSocket("ws://" + window.location.host + "/cp/serial/"); -// Set event handlers. ws.onopen = function() { - console.log("onopen"); set_enabled(true); }; var setting_title = false; +var encoder = new TextEncoder(); +var left_count = 0; ws.onmessage = function(e) { // e.data contains received string. if (e.data == "\x1b]0;") { @@ -52,22 +40,44 @@ ws.onmessage = function(e) { setting_title = false; } else if (setting_title) { title.textContent += e.data; + } else if (e.data == "\b") { + left_count += 1; + } else if (e.data == "\x1b[K") { // Clear line + log.textContent = log.textContent.slice(0, -left_count); + left_count = 0; } else { - output(e.data); + log.textContent += e.data; } + document.querySelector("span").scrollIntoView(); }; ws.onclose = function() { - console.log("onclose"); set_enabled(false); }; ws.onerror = function(e) { - // output("onerror"); - console.log(e); set_enabled(false); }; input.onbeforeinput = function(e) { - console.log(e); + if (e.inputType == "insertLineBreak") { + ws.send("\r"); + input.value = ""; + input.focus(); + e.preventDefault(); + } else if (e.inputType == "insertText") { + ws.send(e.data); + } else if (e.inputType == "deleteContentBackward") { + ws.send("\b"); + } +} + +let ctrl_c = document.querySelector("#c"); +ctrl_c.onclick = function() { + ws.send("\x03"); +} + +let ctrl_d = document.querySelector("#d"); +ctrl_d.onclick = function() { + ws.send("\x04"); } diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c index 0f4c4fc84c..7a2f37b168 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -124,7 +124,6 @@ static void _read_next_frame_header(void) { size_t mask_offset = cp_serial.frame_index - mask_start; cp_serial.mask[mask_offset] = h; cp_serial.frame_index++; - ESP_LOGI(TAG, "mask %08x", (uint32_t)*cp_serial.mask); } // Reply to PINGs and CLOSE. while ((cp_serial.opcode == 0x8 || @@ -136,6 +135,11 @@ static void _read_next_frame_header(void) { if (cp_serial.opcode == 0x9) { ESP_LOGI(TAG, "websocket ping"); opcode = 0xA; // PONG + } else { + // Set the TCP socket to send immediately so that we send the payload back before + // closing the connection. + int nodelay = 1; + lwip_setsockopt(cp_serial.socket.num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay)); } uint8_t frame_header[2]; frame_header[0] = 1 << 7 | opcode; @@ -158,6 +162,8 @@ static void _read_next_frame_header(void) { if (cp_serial.opcode == 0x8) { ESP_LOGI(TAG, "websocket closed"); cp_serial.closed = true; + + common_hal_socketpool_socket_close(&cp_serial.socket); } } } @@ -193,6 +199,7 @@ bool websocket_available(void) { char websocket_read_char(void) { uint8_t c; _read_next_payload_byte(&c); + ESP_LOGI(TAG, "read %c", c); return c; } From f464ec3047401de12748d811745a4a4f252a0f1f Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sat, 9 Jul 2022 22:17:02 -0700 Subject: [PATCH 17/35] Update ports/espressif/common-hal/wifi/Radio.c Co-authored-by: Dan Halbert --- ports/espressif/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 9715894f78..ac997cc0b7 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -139,7 +139,7 @@ void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t esp_wifi_set_mac(ESP_IF_WIFI_STA, mac); } -float common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { +mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { int8_t tx_power; esp_wifi_get_max_tx_power(&tx_power); return tx_power / 4.0; From 98692150ac890582b989bba2499f3ce330d35b53 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sat, 9 Jul 2022 22:17:12 -0700 Subject: [PATCH 18/35] Update ports/espressif/common-hal/wifi/Radio.c Co-authored-by: Dan Halbert --- ports/espressif/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index ac997cc0b7..9503d5ab36 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -142,7 +142,7 @@ void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const uint8_t mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { int8_t tx_power; esp_wifi_get_max_tx_power(&tx_power); - return tx_power / 4.0; + return tx_power / 4.0f; } void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const float tx_power) { From 22e061ba357282c6cd5f57926a3fc9edf4e8bd36 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sat, 9 Jul 2022 22:17:18 -0700 Subject: [PATCH 19/35] Update ports/espressif/common-hal/wifi/Radio.c Co-authored-by: Dan Halbert --- ports/espressif/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 9503d5ab36..c464ea21d8 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -145,7 +145,7 @@ mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { return tx_power / 4.0f; } -void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const float tx_power) { +void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t tx_power) { esp_wifi_set_max_tx_power(tx_power * 4.0); } From a6580076733d02017c90a23deccbe9ba34daa880 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sat, 9 Jul 2022 22:17:26 -0700 Subject: [PATCH 20/35] Update ports/espressif/common-hal/wifi/Radio.c Co-authored-by: Dan Halbert --- ports/espressif/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index c464ea21d8..545af1d6cb 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -146,7 +146,7 @@ mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t tx_power) { - esp_wifi_set_max_tx_power(tx_power * 4.0); + esp_wifi_set_max_tx_power(tx_power * 4.0f); } mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self) { From 5bf07d966210e809909066f12d8ef818920d57d3 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Sat, 9 Jul 2022 22:17:35 -0700 Subject: [PATCH 21/35] Update shared-bindings/wifi/Radio.h Co-authored-by: Dan Halbert --- shared-bindings/wifi/Radio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 1e389b6c56..312e9e5395 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -82,8 +82,8 @@ extern void common_hal_wifi_radio_set_mac_address(wifi_radio_obj_t *self, const extern mp_obj_t common_hal_wifi_radio_get_mac_address_ap(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_mac_address_ap(wifi_radio_obj_t *self, const uint8_t *mac); -extern float common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self); -extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const float power); +extern mp_float_t common_hal_wifi_radio_get_tx_power(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_set_tx_power(wifi_radio_obj_t *self, const mp_float_t power); extern mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self); From f22f4f896a461b2b6190ba48bffe79e374f17cea Mon Sep 17 00:00:00 2001 From: Nathan Young <77929198+NathanY3G@users.noreply.github.com> Date: Sun, 10 Jul 2022 21:34:07 +0200 Subject: [PATCH 22/35] stm: Make family IDs consistent with TinyUF2 This should allow UF2 images for STM32F405 boards to be flashed by TinyUF2. --- ports/stm/mpconfigport.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/stm/mpconfigport.mk b/ports/stm/mpconfigport.mk index 4f18637f13..dd83e0d7bc 100644 --- a/ports/stm/mpconfigport.mk +++ b/ports/stm/mpconfigport.mk @@ -8,6 +8,9 @@ ifeq ($(MCU_VARIANT),$(filter $(MCU_VARIANT),STM32F405xx STM32F407xx)) CIRCUITPY_SDIOIO ?= 1 # Number of USB endpoint pairs. USB_NUM_ENDPOINT_PAIRS = 4 +endif + +ifeq ($(MCU_VARIANT),STM32F407xx) UF2_FAMILY_ID ?= 0x6d0922fa endif From be3482ff05f9f50507dbba7a79732cff0070a7df Mon Sep 17 00:00:00 2001 From: Xu Hao Date: Mon, 11 Jul 2022 16:51:06 +0800 Subject: [PATCH 23/35] Set MICROPY_HW_LED_STATUS pin to the elecfreaks_picoed --- ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h index 0a73b3d73b..03d892091e 100644 --- a/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h +++ b/ports/raspberrypi/boards/elecfreaks_picoed/mpconfigboard.h @@ -1,2 +1,4 @@ #define MICROPY_HW_BOARD_NAME "ELECFREAKS PICO:ED" #define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO25) From 6b474b9e6e3bde394d4fdea10535f7bd207313d3 Mon Sep 17 00:00:00 2001 From: Xu Hao Date: Mon, 11 Jul 2022 21:33:58 +0800 Subject: [PATCH 24/35] Update circuitpython_picoed submodule --- frozen/circuitpython_picoed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frozen/circuitpython_picoed b/frozen/circuitpython_picoed index d890d23f42..53f1560246 160000 --- a/frozen/circuitpython_picoed +++ b/frozen/circuitpython_picoed @@ -1 +1 @@ -Subproject commit d890d23f4261722338280f284cc1640e22e50e14 +Subproject commit 53f15602460329f69fef95498e6b8293aebb513a From 08b4a64bd20ae2413cc55e04a283fc93d68c4b74 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 11 Jul 2022 08:39:10 -0700 Subject: [PATCH 25/35] Update the PID --- .../boards/espressif_esp32s3_box_lite/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index 647ad3440a..de3d4cd0ed 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x303A -USB_PID = 0x7005 +USB_PID = 0x700D USB_PRODUCT = "ESP32-S3-Box-Lite" USB_MANUFACTURER = "Espressif" From e92ac0caf4c7e92ba8e51c1dfd510eed9d7827cd Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 11 Jul 2022 11:04:06 -0500 Subject: [PATCH 26/35] adding links in docs --- shared-bindings/keypad/__init__.c | 3 +++ shared-bindings/msgpack/__init__.c | 3 +++ shared-bindings/sharpdisplay/__init__.c | 7 +++++-- shared-bindings/touchio/__init__.c | 5 ++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/shared-bindings/keypad/__init__.c b/shared-bindings/keypad/__init__.c index 97db750af7..3822b8ea53 100644 --- a/shared-bindings/keypad/__init__.c +++ b/shared-bindings/keypad/__init__.c @@ -86,6 +86,9 @@ const mp_obj_property_t keypad_generic_events_obj = { //| connected independently to individual pins, //| connected to a shift register, //| or connected in a row-and-column matrix. +//| +//| For more information about working with the `keypad` module in CircuitPython, +//| see `this Learn guide `_. //| """ //| diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 65374fb443..e13fb28819 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -41,6 +41,9 @@ //| //| Not implemented: 64-bit int, uint, float. //| +//| For more information about working with msgpack, +//| see `the CPython Library Documentation `_. +//| //| Example 1:: //| //| import msgpack diff --git a/shared-bindings/sharpdisplay/__init__.c b/shared-bindings/sharpdisplay/__init__.c index 8c01c8c98c..a7e0bff77d 100644 --- a/shared-bindings/sharpdisplay/__init__.c +++ b/shared-bindings/sharpdisplay/__init__.c @@ -31,9 +31,12 @@ #include "shared-bindings/sharpdisplay/SharpMemoryFramebuffer.h" -//| """Support for Sharp Memory Display framebuffers""" +//| """Support for Sharp Memory Display framebuffers +//| +//| For more information about working with Sharp Memory Displays, +//| see `this Learn guide `_. +//| """ //| - STATIC const mp_rom_map_elem_t sharpdisplay_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sharpdisplay) }, { MP_ROM_QSTR(MP_QSTR_SharpMemoryFramebuffer), MP_ROM_PTR(&sharpdisplay_framebuffer_type) }, diff --git a/shared-bindings/touchio/__init__.c b/shared-bindings/touchio/__init__.c index e2a6ad9317..2d6bf5f31c 100644 --- a/shared-bindings/touchio/__init__.c +++ b/shared-bindings/touchio/__init__.c @@ -45,7 +45,10 @@ //| call :py:meth:`!deinit` or use a context manager. See //| :ref:`lifetime-and-contextmanagers` for more info. //| -//| For example:: +//| For more information about working with the `touchio` module in CircuitPython, +//| see `this Learn guide page `_. +//| +//| Example:: //| //| import touchio //| from board import * From 69b84e0c8e752969a5f1f49b836c3e90ed76ff8f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 11 Jul 2022 22:05:49 +0200 Subject: [PATCH 27/35] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 55 +++++++++++++++++++++++++++------ locale/cs.po | 55 +++++++++++++++++++++++++++------ locale/de_DE.po | 66 +++++++++++++++++++++++++++++++--------- locale/el.po | 55 +++++++++++++++++++++++++++------ locale/en_GB.po | 63 +++++++++++++++++++++++++++++++------- locale/es.po | 66 +++++++++++++++++++++++++++++++--------- locale/fil.po | 55 +++++++++++++++++++++++++++------ locale/fr.po | 66 +++++++++++++++++++++++++++++++--------- locale/hi.po | 55 +++++++++++++++++++++++++++------ locale/it_IT.po | 55 +++++++++++++++++++++++++++------ locale/ja.po | 58 +++++++++++++++++++++++++++-------- locale/ko.po | 55 +++++++++++++++++++++++++++------ locale/nl.po | 66 +++++++++++++++++++++++++++++++--------- locale/pl.po | 58 +++++++++++++++++++++++++++-------- locale/pt_BR.po | 66 +++++++++++++++++++++++++++++++--------- locale/ru.po | 55 +++++++++++++++++++++++++++------ locale/sv.po | 66 +++++++++++++++++++++++++++++++--------- locale/tr.po | 55 +++++++++++++++++++++++++++------ locale/zh_Latn_pinyin.po | 66 +++++++++++++++++++++++++++++++--------- 19 files changed, 911 insertions(+), 225 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 16ba43395a..06ec3d9769 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2383,6 +2383,10 @@ msgstr "argumen harus berupa ndarrays" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2750,6 +2754,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2841,6 +2849,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap kosong" @@ -2944,7 +2956,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3092,7 +3104,7 @@ msgstr "" msgid "incorrect padding" msgstr "lapisan (padding) tidak benar" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3159,6 +3171,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3167,11 +3183,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3372,7 +3384,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3621,7 +3633,7 @@ msgstr "panjang data string memiliki keganjilan (odd-length)" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3772,6 +3784,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4207,6 +4220,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4248,7 +4269,17 @@ msgstr "indeks sumbu salah" msgid "wrong axis specified" msgstr "sumbu yang ditentukan salah" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipe input salah" @@ -4256,6 +4287,10 @@ msgstr "tipe input salah" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "jumlah argumen salah" diff --git a/locale/cs.po b/locale/cs.po index ee6688f185..cd5167bd28 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2370,6 +2370,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2737,6 +2741,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2828,6 +2836,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2931,7 +2943,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3079,7 +3091,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3146,6 +3158,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3154,11 +3170,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3359,7 +3371,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3608,7 +3620,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3758,6 +3770,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4193,6 +4206,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4234,7 +4255,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4242,6 +4273,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 2f31a32f02..faa220b622 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2422,6 +2422,10 @@ msgstr "Argumente müssen ndarrays sein" msgid "array and index length must be equal" msgstr "Array- und Indexlänge müssen gleich sein" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2799,6 +2803,10 @@ msgstr "Convolve-Argumente müssen ndarrays sein" msgid "convolve arguments must not be empty" msgstr "Convolve Argumente dürfen nicht leer sein" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "Vandermonde-Matrix konnte nicht invertiert werden" @@ -2892,6 +2900,10 @@ msgstr "dtype muss Float oder komplex sein" msgid "empty" msgstr "leer" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "leerer heap" @@ -2995,7 +3007,7 @@ msgstr "das erste Argument muss eine Funktion sein" msgid "first argument must be a tuple of ndarrays" msgstr "das erste Argument muss ein Tupel von ndarrays sein" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "Das erste Argument muss ein Ndarray sein" @@ -3145,7 +3157,7 @@ msgstr "unvollständiger Formatschlüssel" msgid "incorrect padding" msgstr "padding ist inkorrekt" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "Index ist außerhalb der Grenzen" @@ -3212,6 +3224,10 @@ msgstr "Eingabematrix ist asymmetrisch" msgid "input matrix is singular" msgstr "Eingabematrix ist singulär" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "Eingabe muss ein 1D ndarray sein" @@ -3220,11 +3236,7 @@ msgstr "Eingabe muss ein 1D ndarray sein" msgid "input must be a dense ndarray" msgstr "Eingabe muss ein dichtes ndarray sein" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "Eingabe muss ein Tensor von Rang 2 sein" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "Eingabe muss ein ndarray sein" @@ -3431,8 +3443,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length muss 0-%d sein, wenn fixed_length %s ist" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "die maximale Anzahl der Dimensionen beträgt 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3681,7 +3693,7 @@ msgstr "String mit ungerader Länge" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "Offset ist zu groß" @@ -3835,6 +3847,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() mit 3 Argumenten erfordert Integer" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "Drücken der Boot-Taste beim Start.\n" @@ -4275,6 +4288,14 @@ msgstr "nicht unterstützter Typ für Operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "nicht unterstützte Typen für %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4316,7 +4337,17 @@ msgstr "falscher Achsenindex" msgid "wrong axis specified" msgstr "falsche Achse gewählt" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "falscher Indextyp" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "falscher Eingabetyp" @@ -4324,6 +4355,10 @@ msgstr "falscher Eingabetyp" msgid "wrong length of condition array" msgstr "falsche Länge des Array von Bedingungen" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "falsche Anzahl an Argumenten" @@ -4368,6 +4403,12 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "Eingabe muss ein Tensor von Rang 2 sein" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "die maximale Anzahl der Dimensionen beträgt 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Watchdog timer abgelaufen." @@ -5131,9 +5172,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "wrong argument type" #~ msgstr "falscher Argumenttyp" -#~ msgid "wrong index type" -#~ msgstr "falscher Indextyp" - #~ msgid "" #~ "\n" #~ "To exit, please reset the board without " diff --git a/locale/el.po b/locale/el.po index 454be46f59..540dde009c 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2352,6 +2352,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2719,6 +2723,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2810,6 +2818,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2913,7 +2925,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3061,7 +3073,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3128,6 +3140,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3136,11 +3152,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3341,7 +3353,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3590,7 +3602,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3740,6 +3752,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4175,6 +4188,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4216,7 +4237,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4224,6 +4255,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 951b573b3b..9243e0c73b 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2386,6 +2386,10 @@ msgstr "arguments must be ndarrays" msgid "array and index length must be equal" msgstr "array and index length must be equal" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2755,6 +2759,10 @@ msgstr "convolve arguments must be ndarrays" msgid "convolve arguments must not be empty" msgstr "convolve arguments must not be empty" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "could not invert Vandermonde matrix" @@ -2847,6 +2855,10 @@ msgstr "" msgid "empty" msgstr "empty" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "empty heap" @@ -2950,7 +2962,7 @@ msgstr "first argument must be a function" msgid "first argument must be a tuple of ndarrays" msgstr "first argument must be a tuple of ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "first argument must be an ndarray" @@ -3098,7 +3110,7 @@ msgstr "incomplete format key" msgid "incorrect padding" msgstr "incorrect padding" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index is out of bounds" @@ -3165,6 +3177,10 @@ msgstr "input matrix is asymmetric" msgid "input matrix is singular" msgstr "input matrix is singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3173,11 +3189,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "input must be a dense ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "input must be a tensor of rank 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "input must be an ndarray" @@ -3378,8 +3390,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length must be 0-%d when fixed_length is %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3627,7 +3639,7 @@ msgstr "odd-length string" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset is too large" @@ -3777,6 +3789,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() with 3 arguments requires integers" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "pressing boot button at start up.\n" @@ -4214,6 +4227,14 @@ msgstr "unsupported type for operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "unsupported types for %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4255,7 +4276,17 @@ msgstr "wrong axis index" msgid "wrong axis specified" msgstr "wrong axis specified" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "wrong input type" @@ -4263,6 +4294,10 @@ msgstr "wrong input type" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "wrong number of arguments" @@ -4307,6 +4342,12 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "input must be a tensor of rank 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximum number of dimensions is 4" + #~ msgid "Watchdog timer expired." #~ msgstr "WatchDog timer expired." diff --git a/locale/es.po b/locale/es.po index 608f59ca29..05e913ae03 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2419,6 +2419,10 @@ msgstr "argumentos deben ser ndarrays" msgid "array and index length must be equal" msgstr "Longitud del array e índice tienen que ser iguales" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2791,6 +2795,10 @@ msgstr "los argumentos para convolve deben ser ndarrays" msgid "convolve arguments must not be empty" msgstr "los argumentos para convolve no deben estar vacíos" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "no se pudo invertir la matriz de Vandermonde" @@ -2884,6 +2892,10 @@ msgstr "" msgid "empty" msgstr "vacío" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap vacío" @@ -2987,7 +2999,7 @@ msgstr "el primer argumento debe ser una función" msgid "first argument must be a tuple of ndarrays" msgstr "Primer argumento tiene que ser una tupla de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "el primer argumento debe ser ndarray" @@ -3135,7 +3147,7 @@ msgstr "formato de llave incompleto" msgid "incorrect padding" msgstr "relleno (padding) incorrecto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "el índice está fuera de límites" @@ -3202,6 +3214,10 @@ msgstr "la matriz de entrada es asimétrica" msgid "input matrix is singular" msgstr "la matriz de entrada es singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3210,11 +3226,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "Entrada tiene que ser un ndarray denso" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "Entrada tiene que ser un tensor de rango 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "Entrada tiene que ser un ndarray" @@ -3418,8 +3430,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length debe ser 0-%d cuando fixed_length es %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "Máximo número de dimensiones es 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3671,7 +3683,7 @@ msgstr "string de longitud impar" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset es demasiado grande" @@ -3821,6 +3833,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argumentos requiere enteros" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "presionando botón de arranque al inicio.\n" @@ -4259,6 +4272,14 @@ msgstr "tipo de operador no soportado" msgid "unsupported types for %q: '%q', '%q'" msgstr "tipos no soportados para %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4300,7 +4321,17 @@ msgstr "indice de eje erróneo" msgid "wrong axis specified" msgstr "eje especificado erróneo" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "tipo de índice incorrecto" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipo de entrada incorrecta" @@ -4308,6 +4339,10 @@ msgstr "tipo de entrada incorrecta" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "numero erroneo de argumentos" @@ -4352,6 +4387,12 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "Entrada tiene que ser un tensor de rango 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "Máximo número de dimensiones es 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Temporizador de perro guardián expirado." @@ -5210,9 +5251,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "wrong argument type" #~ msgstr "tipo de argumento incorrecto" -#~ msgid "wrong index type" -#~ msgstr "tipo de índice incorrecto" - #~ msgid "specify size or data, but not both" #~ msgstr "especifique o tamaño o datos, pero no ambos" diff --git a/locale/fil.po b/locale/fil.po index 821bf45dbf..d2509b761f 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2372,6 +2372,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2746,6 +2750,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2841,6 +2849,10 @@ msgstr "" msgid "empty" msgstr "walang laman" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "walang laman ang heap" @@ -2945,7 +2957,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3094,7 +3106,7 @@ msgstr "hindi kumpleto ang format key" msgid "incorrect padding" msgstr "mali ang padding" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3161,6 +3173,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3169,11 +3185,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3378,7 +3390,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3627,7 +3639,7 @@ msgstr "odd-length string" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3779,6 +3791,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() na may 3 argumento kailangan ng integers" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4217,6 +4230,14 @@ msgstr "hindi sinusuportahang type para sa operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4258,7 +4279,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4266,6 +4297,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "mali ang bilang ng argumento" diff --git a/locale/fr.po b/locale/fr.po index 7e282a026c..9c892a7f11 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2453,6 +2453,10 @@ msgstr "les paramètres doivent être des ndarrays" msgid "array and index length must be equal" msgstr "la taille de la matrice et de l'index doivent être égaux" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2830,6 +2834,10 @@ msgstr "les paramêtres pour convolve doivent être des ndarrays" msgid "convolve arguments must not be empty" msgstr "les arguments convolve ne doivent pas être vides" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "n'a pas pu inverser la matrice Vandermonde" @@ -2924,6 +2932,10 @@ msgstr "le dtype doit être un flottant, ou un complexe" msgid "empty" msgstr "vide" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "tas vide" @@ -3027,7 +3039,7 @@ msgstr "le premier argument doit être une fonction" msgid "first argument must be a tuple of ndarrays" msgstr "le premier paramêtre doit être un tuple de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "le premier paramêtre doit être un ndarray" @@ -3175,7 +3187,7 @@ msgstr "clé de format incomplète" msgid "incorrect padding" msgstr "espacement incorrect" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "l'index est hors limites" @@ -3243,6 +3255,10 @@ msgstr "la matrice d'entrée est asymétrique" msgid "input matrix is singular" msgstr "la matrice d'entrée est singulière" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "l'entrée doit être un ndarray 1D" @@ -3251,11 +3267,7 @@ msgstr "l'entrée doit être un ndarray 1D" msgid "input must be a dense ndarray" msgstr "l'entrée doit être un ndarray dense" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "l'entrée doit être un tenseur de rang 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "l'entrée doit être un ndarray" @@ -3462,8 +3474,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length doit être 0-%d lorsque fixed_length est %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "nombre maximal de dimensions est 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3713,7 +3725,7 @@ msgstr "chaîne de longueur impaire" msgid "off" msgstr "inactif" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset est trop large" @@ -3866,6 +3878,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() avec 3 arguments nécessite des entiers" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "bouton boot appuyé lors du démarrage.\n" @@ -4304,6 +4317,14 @@ msgstr "type non supporté pour l'opérateur" msgid "unsupported types for %q: '%q', '%q'" msgstr "types non supportés pour %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4345,7 +4366,17 @@ msgstr "index d'axe incorrecte" msgid "wrong axis specified" msgstr "axe incorrecte spécifiée" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "type d'index incorrect" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "type d'entrée incorrect" @@ -4353,6 +4384,10 @@ msgstr "type d'entrée incorrect" msgid "wrong length of condition array" msgstr "mauvaise taille du tableau de condition" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "mauvais nombres d'arguments" @@ -4397,6 +4432,12 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "l'entrée doit être un tenseur de rang 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "nombre maximal de dimensions est 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Le minuteur Watchdog a expiré." @@ -5270,9 +5311,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "type d'argument incorrect" -#~ msgid "wrong index type" -#~ msgstr "type d'index incorrect" - #~ msgid "Must provide SCK pin" #~ msgstr "Vous devez fournir un code PIN SCK" diff --git a/locale/hi.po b/locale/hi.po index db817163af..1cd3603ccb 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2352,6 +2352,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2719,6 +2723,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2810,6 +2818,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2913,7 +2925,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3061,7 +3073,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3128,6 +3140,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3136,11 +3152,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3341,7 +3353,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3590,7 +3602,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3740,6 +3752,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4175,6 +4188,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4216,7 +4237,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4224,6 +4255,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index b58f3c963f..8c8ac6e551 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2382,6 +2382,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2755,6 +2759,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2849,6 +2857,10 @@ msgstr "" msgid "empty" msgstr "vuoto" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "heap vuoto" @@ -2953,7 +2965,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3102,7 +3114,7 @@ msgstr "" msgid "incorrect padding" msgstr "padding incorretto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3169,6 +3181,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3177,11 +3193,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3387,7 +3399,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3638,7 +3650,7 @@ msgstr "stringa di lunghezza dispari" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3792,6 +3804,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argomenti richiede interi" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4230,6 +4243,14 @@ msgstr "tipo non supportato per l'operando" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4271,7 +4292,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4279,6 +4310,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "numero di argomenti errato" diff --git a/locale/ja.po b/locale/ja.po index 466fbdd362..e45ac2ff0f 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2366,6 +2366,10 @@ msgstr "引数はndarrayでなければなりません" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2735,6 +2739,10 @@ msgstr "convolve引数はndarrayでなければなりません" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "ヴァンデルモンド行列の逆行列を求められません" @@ -2828,6 +2836,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2931,7 +2943,7 @@ msgstr "1つ目の引数は関数でなければなりません" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "1つ目の引数はndarrayでなければなりません" @@ -3079,7 +3091,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3147,6 +3159,10 @@ msgstr "入力行列が非対称" msgid "input matrix is singular" msgstr "入力が非正則行列" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3155,11 +3171,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3360,7 +3372,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3609,7 +3621,7 @@ msgstr "奇数長の文字列" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3761,6 +3773,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4197,6 +4210,14 @@ msgstr "演算子が対応していない型" msgid "unsupported types for %q: '%q', '%q'" msgstr "%q が対応していない型: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4238,7 +4259,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "インデクスの型が不正" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4246,6 +4277,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" @@ -4832,9 +4867,6 @@ msgstr "" #~ msgid "wrong argument type" #~ msgstr "引数の型が不正" -#~ msgid "wrong index type" -#~ msgstr "インデクスの型が不正" - #~ msgid "Must provide SCK pin" #~ msgstr "SCKピンが必要" diff --git a/locale/ko.po b/locale/ko.po index f01d690729..ec1f2371fc 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2356,6 +2356,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2723,6 +2727,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2814,6 +2822,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2917,7 +2929,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3065,7 +3077,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3132,6 +3144,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3140,11 +3156,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3345,7 +3357,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3594,7 +3606,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3744,6 +3756,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4179,6 +4192,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4220,7 +4241,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4228,6 +4259,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 7db50b2eea..4a1f3ab520 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2382,6 +2382,10 @@ msgstr "argumenten moeten ndarrays zijn" msgid "array and index length must be equal" msgstr "array en indexlengte moeten gelijk zijn" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2750,6 +2754,10 @@ msgstr "convolutie argumenten moeten ndarrays zijn" msgid "convolve arguments must not be empty" msgstr "convolutie argumenten mogen niet leeg zijn" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "kon de Vandermonde matrix niet omkeren" @@ -2843,6 +2851,10 @@ msgstr "" msgid "empty" msgstr "leeg" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "lege heap" @@ -2946,7 +2958,7 @@ msgstr "eerste argument moet een functie zijn" msgid "first argument must be a tuple of ndarrays" msgstr "eerste argument moet een tupel van ndarrays zijn" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "eerst argument moet een ndarray zijn" @@ -3095,7 +3107,7 @@ msgstr "incomplete formaatsleutel" msgid "incorrect padding" msgstr "vulling (padding) is onjuist" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index is buiten bereik" @@ -3162,6 +3174,10 @@ msgstr "invoermatrix is asymmetrisch" msgid "input matrix is singular" msgstr "invoermatrix is singulier" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3170,11 +3186,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "invoer moet een gesloten ndarray zijn" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "invoer moet een tensor van rang 2 zijn" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "invoer moet een ndarray zijn" @@ -3378,8 +3390,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length moet 0-%d zijn als fixed_length %s is" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximaal aantal dimensies is 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3627,7 +3639,7 @@ msgstr "string met oneven lengte" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "compensatie is te groot" @@ -3777,6 +3789,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "druk bootknop in bij opstarten.\n" @@ -4214,6 +4227,14 @@ msgstr "niet ondersteund type voor operator" msgid "unsupported types for %q: '%q', '%q'" msgstr "niet ondersteunde types voor %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4255,7 +4276,17 @@ msgstr "foute index voor as" msgid "wrong axis specified" msgstr "onjuiste as gespecificeerd" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "onjuist indextype" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "onjuist invoertype" @@ -4263,6 +4294,10 @@ msgstr "onjuist invoertype" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "onjuist aantal argumenten" @@ -4307,6 +4342,12 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "invoer moet een tensor van rang 2 zijn" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximaal aantal dimensies is 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Watchdog-timer verstreken." @@ -5037,9 +5078,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "wrong argument type" #~ msgstr "onjuist argumenttype" -#~ msgid "wrong index type" -#~ msgstr "onjuist indextype" - #~ msgid "Must provide SCK pin" #~ msgstr "SCK pin moet opgegeven worden" diff --git a/locale/pl.po b/locale/pl.po index 0e6137203e..fbf2283bfa 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2363,6 +2363,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2730,6 +2734,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2822,6 +2830,10 @@ msgstr "" msgid "empty" msgstr "puste" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "pusta sterta" @@ -2925,7 +2937,7 @@ msgstr "pierwszy argument musi być funkcją" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3073,7 +3085,7 @@ msgstr "niepełny klucz formatu" msgid "incorrect padding" msgstr "złe wypełnienie" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "indeks jest poza zakresem" @@ -3140,6 +3152,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3148,11 +3164,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3353,7 +3365,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3602,7 +3614,7 @@ msgstr "łańcuch o nieparzystej długości" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3753,6 +3765,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4189,6 +4202,14 @@ msgstr "zły typ dla operatora" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4230,7 +4251,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "zły typ indeksu" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "nieprawidłowy typ wejścia" @@ -4238,6 +4269,10 @@ msgstr "nieprawidłowy typ wejścia" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "zła liczba argumentów" @@ -4747,9 +4782,6 @@ msgstr "" #~ msgid "wrong argument type" #~ msgstr "zły typ argumentu" -#~ msgid "wrong index type" -#~ msgstr "zły typ indeksu" - #~ msgid "Must provide SCK pin" #~ msgstr "Należy podać pin SCK" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b89963bf8f..b447e8e7c7 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2435,6 +2435,10 @@ msgstr "os argumentos devem ser ndarrays" msgid "array and index length must be equal" msgstr "a matriz e comprimento do índice devem ser iguais" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2808,6 +2812,10 @@ msgstr "os argumentos convolutivos devem ser ndarrays" msgid "convolve arguments must not be empty" msgstr "os argumentos convolutivos não devem estar vazios" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "não foi possível inverter a matriz Vandermonde" @@ -2902,6 +2910,10 @@ msgstr "dtype deve ser flutuante ou complexo" msgid "empty" msgstr "vazio" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "a área de alocação dinâmica de variáveis (heap) está vazia" @@ -3005,7 +3017,7 @@ msgstr "o primeiro argumento deve ser uma função" msgid "first argument must be a tuple of ndarrays" msgstr "o primeiro argumento deve ser um tuple de ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "o primeiro argumento deve ser um ndarray" @@ -3153,7 +3165,7 @@ msgstr "a chave do formato está incompleto" msgid "incorrect padding" msgstr "preenchimento incorreto" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "o índice está fora dos limites" @@ -3221,6 +3233,10 @@ msgstr "a matriz da entrada é assimétrica" msgid "input matrix is singular" msgstr "a matriz da entrada é singular" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "a entrada deve ser um 1D ndarray" @@ -3229,11 +3245,7 @@ msgstr "a entrada deve ser um 1D ndarray" msgid "input must be a dense ndarray" msgstr "a entrada deve ser um ndarray denso" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "a entrada dos dados deve ser um tensor de nível 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "a entrada deve ser um ndarray" @@ -3437,8 +3449,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "O número máximo de dimensões são 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3688,7 +3700,7 @@ msgstr "sequência com comprimento ímpar" msgid "off" msgstr "desligado" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "o offset é muito grande" @@ -3843,6 +3855,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "o pow() com 3 argumentos requer números inteiros" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "pressionando o botão de boot na inicialização.\n" @@ -4280,6 +4293,14 @@ msgstr "tipo não compatível para o operador" msgid "unsupported types for %q: '%q', '%q'" msgstr "tipo sem suporte para %q: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4321,7 +4342,17 @@ msgstr "índice do eixo errado" msgid "wrong axis specified" msgstr "um eixo errado foi definido" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "tipo do índice errado" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "tipo da entrada incorreta" @@ -4329,6 +4360,10 @@ msgstr "tipo da entrada incorreta" msgid "wrong length of condition array" msgstr "comprimento errado na condição da matriz" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "quantidade errada dos argumentos" @@ -4373,6 +4408,12 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "a entrada dos dados deve ser um tensor de nível 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "O número máximo de dimensões são 4" + #~ msgid "Watchdog timer expired." #~ msgstr "O temporizador Watchdog expirou." @@ -5295,9 +5336,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "tipo do argumento errado" -#~ msgid "wrong index type" -#~ msgstr "tipo do índice errado" - #~ msgid "specify size or data, but not both" #~ msgstr "defina o tamanho ou os dados, porém não ambos" diff --git a/locale/ru.po b/locale/ru.po index bac9e97b7b..9625bd470c 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2401,6 +2401,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2768,6 +2772,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2859,6 +2867,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2962,7 +2974,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3110,7 +3122,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3177,6 +3189,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3185,11 +3201,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3390,7 +3402,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3639,7 +3651,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3789,6 +3801,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4224,6 +4237,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4265,7 +4286,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4273,6 +4304,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 683d5b380f..23f6013a74 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2405,6 +2405,10 @@ msgstr "argumenten måste vara ndarray" msgid "array and index length must be equal" msgstr "array och indexlängd måste vara lika" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2774,6 +2778,10 @@ msgstr "Argumenten convolve måste vara ndarray:er" msgid "convolve arguments must not be empty" msgstr "Argumenten convolve kan inte vara tomma" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "kan inte invertera Vandermonde-matris" @@ -2868,6 +2876,10 @@ msgstr "dtype måste vara float eller complex" msgid "empty" msgstr "tom" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "tom heap" @@ -2971,7 +2983,7 @@ msgstr "första argumentet måste vara en funktion" msgid "first argument must be a tuple of ndarrays" msgstr "första argumentet måste vara en tupel av ndarray" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "första argumentet måste vara en ndarray" @@ -3119,7 +3131,7 @@ msgstr "ofullständig formatnyckel" msgid "incorrect padding" msgstr "felaktig utfyllnad" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "index är utanför gränserna" @@ -3186,6 +3198,10 @@ msgstr "indatamatrisen är asymmetrisk" msgid "input matrix is singular" msgstr "indatamatrisen är singulär" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "indata måste vara en 1D ndarray" @@ -3194,11 +3210,7 @@ msgstr "indata måste vara en 1D ndarray" msgid "input must be a dense ndarray" msgstr "indata måste vara en dense ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "indata måste vara en tensor av rank 2" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "indata måste vara en ndarray" @@ -3402,8 +3414,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "max_length måste vara 0-%d när fixed_length är %s" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "maximalt antal dimensioner är 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3651,7 +3663,7 @@ msgstr "sträng har udda längd" msgid "off" msgstr "av" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "offset är för stor" @@ -3802,6 +3814,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() med 3 argument kräver heltal" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "trycka på startknappen vid start.\n" @@ -4239,6 +4252,14 @@ msgstr "typ stöds inte för operatören" msgid "unsupported types for %q: '%q', '%q'" msgstr "typen %q stöder inte '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4280,7 +4301,17 @@ msgstr "fel axelindex" msgid "wrong axis specified" msgstr "fel axel angiven" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "fel indextyp" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "fel indatatyp" @@ -4288,6 +4319,10 @@ msgstr "fel indatatyp" msgid "wrong length of condition array" msgstr "fel längd på villkorsmatrisen" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "fel antal argument" @@ -4332,6 +4367,12 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "indata måste vara en tensor av rank 2" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "maximalt antal dimensioner är 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Watchdog-timern har löpt ut." @@ -5236,9 +5277,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "wrong argument type" #~ msgstr "fel typ av argument" -#~ msgid "wrong index type" -#~ msgstr "fel indextyp" - #~ msgid "specify size or data, but not both" #~ msgstr "ange storlek eller data, men inte båda" diff --git a/locale/tr.po b/locale/tr.po index b303e6419a..529ecdbee9 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2372,6 +2372,10 @@ msgstr "" msgid "array and index length must be equal" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2739,6 +2743,10 @@ msgstr "" msgid "convolve arguments must not be empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "" @@ -2830,6 +2838,10 @@ msgstr "" msgid "empty" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "" @@ -2933,7 +2945,7 @@ msgstr "" msgid "first argument must be a tuple of ndarrays" msgstr "" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "" @@ -3081,7 +3093,7 @@ msgstr "" msgid "incorrect padding" msgstr "" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "" @@ -3148,6 +3160,10 @@ msgstr "" msgid "input matrix is singular" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "" @@ -3156,11 +3172,7 @@ msgstr "" msgid "input must be a dense ndarray" msgstr "" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "" @@ -3361,7 +3373,7 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" +msgid "maximum number of dimensions is " msgstr "" #: py/runtime.c @@ -3610,7 +3622,7 @@ msgstr "" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "" @@ -3760,6 +3772,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "" @@ -4195,6 +4208,14 @@ msgstr "" msgid "unsupported types for %q: '%q', '%q'" msgstr "" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4236,7 +4257,17 @@ msgstr "" msgid "wrong axis specified" msgstr "" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "" @@ -4244,6 +4275,10 @@ msgstr "" msgid "wrong length of condition array" msgstr "" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c6e7e7b364..186c640e3d 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2416,6 +2416,10 @@ msgstr "cānshù bìxū shì ndarrays" msgid "array and index length must be equal" msgstr "shù zǔ hé suǒ yǐn cháng dù bì xū xiāng děng" +#: extmod/ulab/code/numpy/io/io.c +msgid "array has too many dimensions" +msgstr "" + #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" @@ -2787,6 +2791,10 @@ msgstr "juàn jī cānshù bìxū shì ndarrays" msgid "convolve arguments must not be empty" msgstr "juàn jī cān shǔ bùnéng wéi kōng" +#: extmod/ulab/code/numpy/io/io.c +msgid "corrupted file" +msgstr "" + #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" msgstr "wúfǎ fǎn zhuǎn fàndéméng dé jǔzhèn" @@ -2880,6 +2888,10 @@ msgstr "dtype bì xū shì fú diǎn xíng huò fù shù" msgid "empty" msgstr "kòngxián" +#: extmod/ulab/code/numpy/io/io.c +msgid "empty file" +msgstr "" + #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" msgstr "kōng yīn yīnxiào" @@ -2983,7 +2995,7 @@ msgstr "dì yīgè cānshù bìxū shì yī gè hánshù" msgid "first argument must be a tuple of ndarrays" msgstr "dì yī gè cān shù bì xū shì yí gè yuán zǔ ndarrays" -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" msgstr "dì yī gè cānshù bìxū shì ndarray" @@ -3131,7 +3143,7 @@ msgstr "géshì bù wánzhěng de mì yào" msgid "incorrect padding" msgstr "bù zhèngquè de tiánchōng" -#: extmod/ulab/code/ndarray.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" msgstr "suǒyǐn chāochū fànwéi" @@ -3198,6 +3210,10 @@ msgstr "shūrù jǔzhèn bù duìchèn" msgid "input matrix is singular" msgstr "shūrù jǔzhèn shì qíyì de" +#: extmod/ulab/code/numpy/create.c +msgid "input must be 1- or 2-d" +msgstr "" + #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" msgstr "shū rù bì xū shì 1D ndarray" @@ -3206,11 +3222,7 @@ msgstr "shū rù bì xū shì 1D ndarray" msgid "input must be a dense ndarray" msgstr "shū rù bì xū shì mì jí de ndarray" -#: extmod/ulab/code/numpy/create.c -msgid "input must be a tensor of rank 2" -msgstr "shū rù bì xū shì děng jí 2 de zhāng liàng" - -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/user/user.c +#: extmod/ulab/code/user/user.c msgid "input must be an ndarray" msgstr "shū rù bì xū shì ndarray" @@ -3412,8 +3424,8 @@ msgid "max_length must be 0-%d when fixed_length is %s" msgstr "dāng fixed_length de zhí wéi %s shí, max_length bì xū wéi 0-%d" #: extmod/ulab/code/ndarray.c -msgid "maximum number of dimensions is 4" -msgstr "zuì dà chǐ cùn shù wéi 4" +msgid "maximum number of dimensions is " +msgstr "" #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -3661,7 +3673,7 @@ msgstr "jīshù zìfú chuàn" msgid "off" msgstr "" -#: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c +#: extmod/ulab/code/utils/utils.c msgid "offset is too large" msgstr "piān yí tài dà" @@ -3811,6 +3823,7 @@ msgid "pow() with 3 arguments requires integers" msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" #: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +#: ports/espressif/boards/lolin_c3_mini/mpconfigboard.h #: supervisor/shared/safe_mode.c msgid "pressing boot button at start up.\n" msgstr "Zài qǐdòng shí àn qǐdòng ànniǔ.\n" @@ -4251,6 +4264,14 @@ msgstr "bù zhīchí de cāozuò zhě lèixíng" msgid "unsupported types for %q: '%q', '%q'" msgstr "%q bù zhīchí de lèixíng: '%q', '%q'" +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols is too high" +msgstr "" + +#: extmod/ulab/code/numpy/io/io.c +msgid "usecols keyword must be specified" +msgstr "" + #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" @@ -4292,7 +4313,17 @@ msgstr "cuò wù de zhóu suǒ yǐn" msgid "wrong axis specified" msgstr "zhǐ dìng de zhóu cuò wù" -#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/numpy/io/io.c +msgid "wrong dtype" +msgstr "" + +#: extmod/ulab/code/numpy/transform.c +msgid "wrong index type" +msgstr "cuòwù de suǒyǐn lèixíng" + +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c +#: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c +#: extmod/ulab/code/numpy/vector.c msgid "wrong input type" msgstr "shūrù lèixíng cuòwù" @@ -4300,6 +4331,10 @@ msgstr "shūrù lèixíng cuòwù" msgid "wrong length of condition array" msgstr "tiáo jiàn shù zǔ de cháng dù cuò wù" +#: extmod/ulab/code/numpy/transform.c +msgid "wrong length of index array" +msgstr "" + #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" msgstr "cānshù shù cuòwù" @@ -4344,6 +4379,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "input must be a tensor of rank 2" +#~ msgstr "shū rù bì xū shì děng jí 2 de zhāng liàng" + +#~ msgid "maximum number of dimensions is 4" +#~ msgstr "zuì dà chǐ cùn shù wéi 4" + #~ msgid "Watchdog timer expired." #~ msgstr "Kān mén gǒu dìngshí qì yǐ guòqí." @@ -5214,9 +5255,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "wrong argument type" #~ msgstr "cuòwù de cānshù lèixíng" -#~ msgid "wrong index type" -#~ msgstr "cuòwù de suǒyǐn lèixíng" - #~ msgid "Must provide SCK pin" #~ msgstr "bì xū tí gòng SCK yǐn jiǎo" From d9f6e999422a1deedcc5c6f82d87171056e646d6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Jul 2022 13:36:44 -0700 Subject: [PATCH 28/35] Fix RP2040 UART It couldn't receive more than 32 bytes in while checking in_waiting because in_waiting didn't turn interrupts back on correctly. Fixes #6579 --- ports/raspberrypi/common-hal/busio/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index d1ed3ea27a..c06bb21903 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -311,7 +311,7 @@ uint32_t common_hal_busio_uart_rx_characters_available(busio_uart_obj_t *self) { // The UART only interrupts after a threshold so make sure to copy anything // out of its FIFO before measuring how many bytes we've received. _copy_into_ringbuf(&self->ringbuf, self->uart); - irq_set_enabled(self->uart_irq_id, false); + irq_set_enabled(self->uart_irq_id, true); return ringbuf_num_filled(&self->ringbuf); } From 8cfdfb95f78a8f5082fbdefcd0c8adbf5cb49cc6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Jul 2022 14:32:28 -0700 Subject: [PATCH 29/35] Remove extra logging, auth /cp/serial and add doc --- docs/workflows.md | 78 +++++++++++-------- .../shared/web_workflow/static/welcome.html | 3 +- supervisor/shared/web_workflow/web_workflow.c | 4 +- supervisor/shared/web_workflow/websocket.c | 9 --- 4 files changed, 50 insertions(+), 44 deletions(-) diff --git a/docs/workflows.md b/docs/workflows.md index 1b262011b2..b011acd01c 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -286,6 +286,44 @@ not protected by basic auth in case the device is someone elses. Only `GET` requests are supported and will return `405 Method Not Allowed` otherwise. +#### `/cp/devices.json` + +Returns information about other devices found on the network using MDNS. + +* `total`: Total MDNS response count. May be more than in `devices` if internal limits were hit. +* `devices`: List of discovered devices. + * `hostname`: MDNS hostname + * `instance_name`: MDNS instance name. Defaults to human readable board name. + * `port`: Port of CircuitPython Web API + * `ip`: IP address + +Example: +```sh +curl -v -L http://circuitpython.local/cp/devices.json +``` + +```json +{ + "total": 1, + "devices": [ + { + "hostname": "cpy-951032", + "instance_name": "Adafruit Feather ESP32-S2 TFT", + "port": 80, + "ip": "192.168.1.235" + } + ] +} +``` + +#### `/cp/serial/` + + +Serves a basic serial terminal program when a `GET` request is received without the +`Upgrade: websocket` header. Otherwise the socket is upgraded to a WebSocket. See WebSockets below for more detail. + +This is an authenticated endpoint in both modes. + #### `/cp/version.json` Returns information about the device. @@ -323,36 +361,6 @@ curl -v -L http://circuitpython.local/cp/version.json } ``` -#### `/cp/devices.json` - -Returns information about other devices found on the network using MDNS. - -* `total`: Total MDNS response count. May be more than in `devices` if internal limits were hit. -* `devices`: List of discovered devices. - * `hostname`: MDNS hostname - * `instance_name`: MDNS instance name. Defaults to human readable board name. - * `port`: Port of CircuitPython Web API - * `ip`: IP address - -Example: -```sh -curl -v -L http://circuitpython.local/cp/devices.json -``` - -```json -{ - "total": 1, - "devices": [ - { - "hostname": "cpy-951032", - "instance_name": "Adafruit Feather ESP32-S2 TFT", - "port": 80, - "ip": "192.168.1.235" - } - ] -} -``` - ### Static files * `/favicon.ico` - Blinka @@ -361,4 +369,12 @@ curl -v -L http://circuitpython.local/cp/devices.json ### WebSocket -Coming soon! +The CircuitPython serial interactions are available over a WebSocket. A WebSocket begins as a +special HTTP request that gets upgraded to a WebSocket. Authentication happens before upgrading. + +WebSockets are *not* bare sockets once upgraded. Instead they have their own framing format for data. +CircuitPython can handle PING and CLOSE opcodes. All others are treated as TEXT. Data to +CircuitPython is expected to be masked UTF-8, as the spec requires. Data from CircuitPython to the +client is unmasked. It is also unbuffered so the client will get a variety of frame sizes. + +Only one WebSocket at a time is supported. diff --git a/supervisor/shared/web_workflow/static/welcome.html b/supervisor/shared/web_workflow/static/welcome.html index 6ef1ccd767..139e9eba39 100644 --- a/supervisor/shared/web_workflow/static/welcome.html +++ b/supervisor/shared/web_workflow/static/welcome.html @@ -3,11 +3,12 @@ CircuitPython +

 Welcome!

- Welcome to CircuitPython's Web API. Go to the file browser to work with files in the CIRCUITPY drive. Make sure you've set CIRCUITPY_WEB_API_PASSWORD='somepassword' in /.env. Provide the password when the browser prompts for it. Leave the username blank. + Welcome to CircuitPython's Web API. Go to the file browser to work with files in the CIRCUITPY drive. Go to the serial terminal to see code output and interact with the REPL. Make sure you've set CIRCUITPY_WEB_API_PASSWORD='somepassword' in /.env. Provide the password when the browser prompts for it. Leave the username blank.

Device Info

Board:
Version:
diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index c7bf673fdc..3f9920d1c7 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -1019,14 +1019,13 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { } else if (strcmp(path, "/version.json") == 0) { _reply_with_version_json(socket, request); } else if (strcmp(path, "/serial/") == 0) { - if (false && !request->authenticated) { + if (!request->authenticated) { if (_api_password[0] != '\0') { _reply_unauthorized(socket, request); } else { _reply_forbidden(socket, request); } } else if (request->websocket) { - ESP_LOGI(TAG, "websocket!"); _reply_websocket_upgrade(socket, request); } else { _REPLY_STATIC(socket, request, serial_html); @@ -1059,7 +1058,6 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { } static void _reset_request(_request *request) { - ESP_LOGI(TAG, "reset request"); request->state = STATE_METHOD; request->origin[0] = '\0'; request->content_length = 0; diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c index 7a2f37b168..8d3941b434 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -48,7 +48,6 @@ void websocket_init(void) { } void websocket_handoff(socketpool_socket_obj_t *socket) { - ESP_LOGI(TAG, "socket handed off"); cp_serial.socket = *socket; cp_serial.closed = false; cp_serial.opcode = 0; @@ -57,7 +56,6 @@ void websocket_handoff(socketpool_socket_obj_t *socket) { // Mark the original socket object as closed without telling the lower level. socket->connected = false; socket->num = -1; - ESP_LOGI(TAG, "socket hand off done"); } bool websocket_connected(void) { @@ -90,7 +88,6 @@ static void _read_next_frame_header(void) { if (cp_serial.frame_index == 0 && _read_byte(&h)) { cp_serial.frame_index++; cp_serial.opcode = h & 0xf; - ESP_LOGI(TAG, "fin %d opcode %x", h >> 7, cp_serial.opcode); } if (cp_serial.frame_index == 1 && _read_byte(&h)) { cp_serial.frame_index++; @@ -108,8 +105,6 @@ static void _read_next_frame_header(void) { if (cp_serial.masked) { cp_serial.frame_len += 4; } - - ESP_LOGI(TAG, "mask %d length %x", cp_serial.masked, len); } while (cp_serial.frame_index >= 2 && cp_serial.frame_index < (cp_serial.payload_len_size + 2) && @@ -133,7 +128,6 @@ static void _read_next_frame_header(void) { if (cp_serial.frame_index == cp_serial.frame_len) { uint8_t opcode = 0x8; // CLOSE if (cp_serial.opcode == 0x9) { - ESP_LOGI(TAG, "websocket ping"); opcode = 0xA; // PONG } else { // Set the TCP socket to send immediately so that we send the payload back before @@ -160,7 +154,6 @@ static void _read_next_frame_header(void) { if (cp_serial.payload_remaining == 0) { cp_serial.frame_index = 0; if (cp_serial.opcode == 0x8) { - ESP_LOGI(TAG, "websocket closed"); cp_serial.closed = true; common_hal_socketpool_socket_close(&cp_serial.socket); @@ -199,7 +192,6 @@ bool websocket_available(void) { char websocket_read_char(void) { uint8_t c; _read_next_payload_byte(&c); - ESP_LOGI(TAG, "read %c", c); return c; } @@ -232,7 +224,6 @@ static void _websocket_send(_websocket *ws, const char *text, size_t len) { char copy[len]; memcpy(copy, text, len); copy[len] = '\0'; - ESP_LOGI(TAG, "sent over websocket: %s", copy); } void websocket_write(const char *text, size_t len) { From 425a0efeca5da563f981bc8dd271bf7f9421fb5d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Jul 2022 14:53:20 -0700 Subject: [PATCH 30/35] A bit more cleanup --- shared-bindings/hashlib/Hash.c | 7 ------- .../shared/web_workflow/static/serial.js | 2 -- supervisor/shared/web_workflow/web_workflow.c | 21 ++++++++----------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/shared-bindings/hashlib/Hash.c b/shared-bindings/hashlib/Hash.c index 5dab05fa10..e27b71ef78 100644 --- a/shared-bindings/hashlib/Hash.c +++ b/shared-bindings/hashlib/Hash.c @@ -26,13 +26,6 @@ #include "shared-bindings/hashlib/Hash.h" -// #include "shared-bindings/util.h" - -// #include "shared/runtime/buffer_helper.h" -// #include "shared/runtime/interrupt_char.h" - -// #include "py/mperrno.h" -// #include "py/mphal.h" #include "py/obj.h" #include "py/objproperty.h" #include "py/objstr.h" diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js index 595bbe6653..6ecc2b1659 100644 --- a/supervisor/shared/web_workflow/static/serial.js +++ b/supervisor/shared/web_workflow/static/serial.js @@ -21,7 +21,6 @@ function onSubmit() { input.focus(); } -// Connect to Web Socket ws = new WebSocket("ws://" + window.location.host + "/cp/serial/"); ws.onopen = function() { @@ -32,7 +31,6 @@ var setting_title = false; var encoder = new TextEncoder(); var left_count = 0; ws.onmessage = function(e) { - // e.data contains received string. if (e.data == "\x1b]0;") { setting_title = true; title.textContent = ""; diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 3f9920d1c7..6cf765b8f9 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -522,10 +522,16 @@ static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request, "HTTP/1.1 301 Moved Permanently\r\n", "Connection: close\r\n", "Content-Length: 0\r\n", - "Location: http://", hostname, ".local", path, "\r\n", NULL); + "Location: ", NULL); + if (request->websocket) { + _send_str(socket, "ws"); + } else { + _send_str(socket, "http"); + } + + _send_strs(socket, "://", hostname, ".local", path, "\r\n", NULL); _cors_header(socket, request); _send_str(socket, "\r\n"); - ESP_LOGI(TAG, "redirect"); } static void _reply_directory_json(socketpool_socket_obj_t *socket, _request *request, FF_DIR *dir, const char *request_path, const char *path) { @@ -853,10 +859,7 @@ static void _reply_static(socketpool_socket_obj_t *socket, _request *request, co #define _REPLY_STATIC(socket, request, filename) _reply_static(socket, request, filename, filename##_length, filename##_content_type) - - static void _reply_websocket_upgrade(socketpool_socket_obj_t *socket, _request *request) { - ESP_LOGI(TAG, "websocket!"); // Compute accept key hashlib_hash_obj_t hash; common_hal_hashlib_new(&hash, "sha1"); @@ -876,8 +879,6 @@ static void _reply_websocket_upgrade(socketpool_socket_obj_t *socket, _request * "Sec-WebSocket-Accept: ", encoded_accept, "\r\n", "\r\n", NULL); websocket_handoff(socket); - - ESP_LOGI(TAG, "socket upgrade done"); // socket is now closed and "disconnected". } @@ -885,7 +886,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { if (request->redirect) { _reply_redirect(socket, request, request->path); } else if (strlen(request->origin) > 0 && !_origin_ok(request->origin)) { - ESP_LOGI(TAG, "bad origin %s", request->origin); + ESP_LOGE(TAG, "bad origin %s", request->origin); _reply_forbidden(socket, request); } else if (memcmp(request->path, "/fs/", 4) == 0) { if (!request->authenticated) { @@ -1199,7 +1200,6 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) return; } bool reload = _reply(socket, request); - ESP_LOGI(TAG, "reply done"); _reset_request(request); autoreload_resume(AUTORELOAD_SUSPEND_WEB); if (reload) { @@ -1217,12 +1217,10 @@ void supervisor_web_workflow_background(void) { uint32_t port; int newsoc = socketpool_socket_accept(&listening, (uint8_t *)&ip, &port); if (newsoc == -EBADF) { - ESP_LOGI(TAG, "listen closed"); common_hal_socketpool_socket_close(&listening); return; } if (newsoc > 0) { - ESP_LOGI(TAG, "new socket %d", newsoc); // Close the active socket because we have another we accepted. if (!common_hal_socketpool_socket_get_closed(&active)) { common_hal_socketpool_socket_close(&active); @@ -1243,7 +1241,6 @@ void supervisor_web_workflow_background(void) { // If we have a request in progress, continue working on it. if (common_hal_socketpool_socket_get_connected(&active)) { - // ESP_LOGI(TAG, "active connected %d", active_request.in_progress); _process_request(&active, &active_request); } } From 83b62567d2f61fa747f8ba0abcdb03e606d7f5c7 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 12 Jul 2022 01:36:08 +0000 Subject: [PATCH 31/35] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b447e8e7c7..2f8c578292 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-07-03 00:22+0000\n" +"PO-Revision-Date: 2022-07-12 13:10+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 4.13.1-dev\n" +"X-Generator: Weblate 4.14-dev\n" #: main.c msgid "" @@ -2437,7 +2437,7 @@ msgstr "a matriz e comprimento do índice devem ser iguais" #: extmod/ulab/code/numpy/io/io.c msgid "array has too many dimensions" -msgstr "" +msgstr "a matriz possui muitas dimensões" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2814,7 +2814,7 @@ msgstr "os argumentos convolutivos não devem estar vazios" #: extmod/ulab/code/numpy/io/io.c msgid "corrupted file" -msgstr "" +msgstr "arquivo corrompido" #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" @@ -2912,7 +2912,7 @@ msgstr "vazio" #: extmod/ulab/code/numpy/io/io.c msgid "empty file" -msgstr "" +msgstr "arquivo vazio" #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" @@ -3235,7 +3235,7 @@ msgstr "a matriz da entrada é singular" #: extmod/ulab/code/numpy/create.c msgid "input must be 1- or 2-d" -msgstr "" +msgstr "a entrada deve ser 1- ou 2-d" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" @@ -3450,7 +3450,7 @@ msgstr "o max_length deve ser 0-%d quando Fixed_length for %s" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is " -msgstr "" +msgstr "a quantidade máxima de dimensões é " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -4295,11 +4295,11 @@ msgstr "tipo sem suporte para %q: '%q', '%q'" #: extmod/ulab/code/numpy/io/io.c msgid "usecols is too high" -msgstr "" +msgstr "usecols é muito alto" #: extmod/ulab/code/numpy/io/io.c msgid "usecols keyword must be specified" -msgstr "" +msgstr "palavra-chave para o usecols deve ser definida" #: py/objint.c #, c-format @@ -4344,7 +4344,7 @@ msgstr "um eixo errado foi definido" #: extmod/ulab/code/numpy/io/io.c msgid "wrong dtype" -msgstr "" +msgstr "dtype errado" #: extmod/ulab/code/numpy/transform.c msgid "wrong index type" @@ -4362,7 +4362,7 @@ msgstr "comprimento errado na condição da matriz" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of index array" -msgstr "" +msgstr "comprimento errado do índice da matriz" #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" From 636e22b05b3c59123f4bc642ded002d971d29a2b Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Mon, 11 Jul 2022 21:03:44 +0000 Subject: [PATCH 32/35] Translated using Weblate (Swedish) Currently translated at 100.0% (993 of 993 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 23f6013a74..78ebb6b6ab 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-07-01 17:46+0000\n" +"PO-Revision-Date: 2022-07-12 13:10+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.13.1-dev\n" +"X-Generator: Weblate 4.14-dev\n" #: main.c msgid "" @@ -2407,7 +2407,7 @@ msgstr "array och indexlängd måste vara lika" #: extmod/ulab/code/numpy/io/io.c msgid "array has too many dimensions" -msgstr "" +msgstr "array har för många dimensioner" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/nvm/ByteArray.c @@ -2780,7 +2780,7 @@ msgstr "Argumenten convolve kan inte vara tomma" #: extmod/ulab/code/numpy/io/io.c msgid "corrupted file" -msgstr "" +msgstr "korrupt fil" #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" @@ -2878,7 +2878,7 @@ msgstr "tom" #: extmod/ulab/code/numpy/io/io.c msgid "empty file" -msgstr "" +msgstr "tom fil" #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" @@ -3200,7 +3200,7 @@ msgstr "indatamatrisen är singulär" #: extmod/ulab/code/numpy/create.c msgid "input must be 1- or 2-d" -msgstr "" +msgstr "input måste vara 1- eller 2-d" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" @@ -3415,7 +3415,7 @@ msgstr "max_length måste vara 0-%d när fixed_length är %s" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is " -msgstr "" +msgstr "maximalt antal dimensioner är " #: py/runtime.c msgid "maximum recursion depth exceeded" @@ -4254,11 +4254,11 @@ msgstr "typen %q stöder inte '%q', '%q'" #: extmod/ulab/code/numpy/io/io.c msgid "usecols is too high" -msgstr "" +msgstr "usecols är för hög" #: extmod/ulab/code/numpy/io/io.c msgid "usecols keyword must be specified" -msgstr "" +msgstr "nyckelordet usecols måste anges" #: py/objint.c #, c-format @@ -4303,7 +4303,7 @@ msgstr "fel axel angiven" #: extmod/ulab/code/numpy/io/io.c msgid "wrong dtype" -msgstr "" +msgstr "fel dtype" #: extmod/ulab/code/numpy/transform.c msgid "wrong index type" @@ -4321,7 +4321,7 @@ msgstr "fel längd på villkorsmatrisen" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of index array" -msgstr "" +msgstr "fel längd av index array" #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" From 15fe3864574d0a92f8d9612f0ab1da976ffc3ee0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 12 Jul 2022 11:13:17 -0700 Subject: [PATCH 33/35] Fix build and minify html and js --- docs/library/hashlib.rst | 1 + requirements-dev.txt | 4 ++++ supervisor/shared/web_workflow/websocket.c | 3 +++ tools/gen_web_workflow_static.py | 6 ++++++ 4 files changed, 14 insertions(+) diff --git a/docs/library/hashlib.rst b/docs/library/hashlib.rst index 8e5ebc2d1a..061f9fd1e0 100644 --- a/docs/library/hashlib.rst +++ b/docs/library/hashlib.rst @@ -5,6 +5,7 @@ .. module:: hashlib :synopsis: hashing algorithms + :noindex: |see_cpython_module| :mod:`cpython:hashlib`. diff --git a/requirements-dev.txt b/requirements-dev.txt index 0b2e08163a..3b4411bd3a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -26,3 +26,7 @@ pyelftools # for stubs and annotations adafruit-circuitpython-typing + +# for web workflow minify +minify_html +jsmin diff --git a/supervisor/shared/web_workflow/websocket.c b/supervisor/shared/web_workflow/websocket.c index 8d3941b434..313e18a86d 100644 --- a/supervisor/shared/web_workflow/websocket.c +++ b/supervisor/shared/web_workflow/websocket.c @@ -26,6 +26,9 @@ #include "supervisor/shared/web_workflow/websocket.h" +// TODO: Remove ESP specific stuff. For now, it is useful as we refine the server. +#include "esp_log.h" + typedef struct { socketpool_socket_obj_t socket; uint8_t opcode; diff --git a/tools/gen_web_workflow_static.py b/tools/gen_web_workflow_static.py index 5f0febd084..b8c5baf619 100644 --- a/tools/gen_web_workflow_static.py +++ b/tools/gen_web_workflow_static.py @@ -4,6 +4,8 @@ import argparse import gzip +import minify_html +import jsmin import mimetypes import pathlib @@ -24,6 +26,10 @@ for f in args.files: variable = path.name.replace(".", "_") uncompressed = f.read() ulen = len(uncompressed) + if f.name.endswith(".html"): + uncompressed = minify_html.minify(uncompressed.decode("utf-8")).encode("utf-8") + elif f.name.endswith(".js"): + uncompressed = jsmin.jsmin(uncompressed.decode("utf-8")).encode("utf-8") compressed = gzip.compress(uncompressed) clen = len(compressed) compressed = ", ".join([hex(x) for x in compressed]) From 8093f8e55521cccaaf273bb5f821e40f65432608 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 12 Jul 2022 14:12:25 -0700 Subject: [PATCH 34/35] Default gifio to camera setting --- py/circuitpy_mpconfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index de88dcc727..5d6ef0ddf6 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -233,7 +233,7 @@ CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS) ifeq ($(CIRCUITPY_DISPLAYIO),1) -CIRCUITPY_GIFIO ?= $(CIRCUITPY_FULL_BUILD) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_CAMERA) else CIRCUITPY_GIFIO ?= 0 endif From 031c124a81d6129f9bf8fa47cea1066788d481ba Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 12 Jul 2022 14:12:39 -0700 Subject: [PATCH 35/35] Tweak serial page to work better in Chrome --- supervisor/shared/web_workflow/static/serial.html | 8 ++++---- supervisor/shared/web_workflow/static/serial.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supervisor/shared/web_workflow/static/serial.html b/supervisor/shared/web_workflow/static/serial.html index aaf416b8b3..0c13248904 100644 --- a/supervisor/shared/web_workflow/static/serial.html +++ b/supervisor/shared/web_workflow/static/serial.html @@ -1,15 +1,15 @@ - Simple client - + + -
+

-     
+    
   
diff --git a/supervisor/shared/web_workflow/static/serial.js b/supervisor/shared/web_workflow/static/serial.js index 6ecc2b1659..86ec077e92 100644 --- a/supervisor/shared/web_workflow/static/serial.js +++ b/supervisor/shared/web_workflow/static/serial.js @@ -57,7 +57,7 @@ ws.onerror = function(e) { set_enabled(false); }; -input.onbeforeinput = function(e) { +input.addEventListener("beforeinput", function(e) { if (e.inputType == "insertLineBreak") { ws.send("\r"); input.value = ""; @@ -68,7 +68,7 @@ input.onbeforeinput = function(e) { } else if (e.inputType == "deleteContentBackward") { ws.send("\b"); } -} +}); let ctrl_c = document.querySelector("#c"); ctrl_c.onclick = function() {