From 17ed2a68986591be562c15fa5def63bfd1abf169 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Sat, 1 Oct 2022 10:41:33 +0530 Subject: [PATCH 1/8] implement certain supervisor functions as properties - disable_ble_workflow - set_next_stack_limit - set_rgb_status_brightness --- shared-bindings/supervisor/Runtime.c | 84 +++++++++++++++++++++++++ shared-bindings/supervisor/__init__.c | 51 --------------- supervisor/shared/bluetooth/bluetooth.c | 10 ++- supervisor/shared/bluetooth/bluetooth.h | 1 + supervisor/shared/stack.c | 4 ++ supervisor/shared/stack.h | 1 + supervisor/shared/status_leds.c | 8 +++ supervisor/shared/status_leds.h | 1 + 8 files changed, 108 insertions(+), 52 deletions(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index fa9431f25a..1fbafb5641 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -34,6 +34,9 @@ #include "shared-bindings/supervisor/Runtime.h" #include "supervisor/shared/reload.h" +#include "supervisor/shared/stack.h" +#include "supervisor/shared/status_leds.h" +#include "supervisor/shared/bluetooth/bluetooth.h" #if (CIRCUITPY_USB) #include "tusb.h" @@ -134,12 +137,93 @@ MP_PROPERTY_GETSET(supervisor_runtime_autoreload_obj, (mp_obj_t)&supervisor_runtime_get_autoreload_obj, (mp_obj_t)&supervisor_runtime_set_autoreload_obj); +//| ble_workflow: bool +//| """Enable/Disable ble workflow until a reset. This prevents BLE advertising outside of the VM and +//| the services used for it.""" +//| +STATIC mp_obj_t supervisor_runtime_get_ble_workflow(mp_obj_t self) { + #if CIRCUITPY_BLE_FILE_SERVICE && CIRCUITPY_SERIAL_BLE + return mp_obj_new_bool(supervisor_bluetooth_workflow_is_enabled()); + #else + return mp_const_false; + #endif +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_ble_workflow_obj, supervisor_runtime_get_ble_workflow); + +STATIC mp_obj_t supervisor_runtime_set_ble_workflow(mp_obj_t self, mp_obj_t state_in) { + #if CIRCUITPY_BLE_FILE_SERVICE && CIRCUITPY_SERIAL_BLE + if (mp_obj_is_true(state_in)) { + supervisor_bluetooth_enable_workflow(); + } else { + supervisor_bluetooth_disable_workflow(); + } + #else + mp_raise_NotImplementedError(NULL); + #endif + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_ble_workflow_obj, supervisor_runtime_set_ble_workflow); + +MP_PROPERTY_GETSET(supervisor_runtime_ble_workflow_obj, + (mp_obj_t)&supervisor_runtime_get_ble_workflow_obj, + (mp_obj_t)&supervisor_runtime_set_ble_workflow_obj); + +//| next_stack_limit: int +//| """The size of the stack for the next vm run. If its too large, the default will be used.""" +//| +STATIC mp_obj_t supervisor_runtime_get_next_stack_limit(mp_obj_t self) { + return mp_obj_new_int(get_next_stack_size()); +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_next_stack_limit_obj, supervisor_runtime_get_next_stack_limit); + +STATIC mp_obj_t supervisor_runtime_set_next_stack_limit(mp_obj_t self, mp_obj_t size_obj) { + mp_int_t size = mp_obj_get_int(size_obj); + mp_arg_validate_int_min(size, 256, MP_QSTR_size); + set_next_stack_size(size); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_next_stack_limit_obj, supervisor_runtime_set_next_stack_limit); + +MP_PROPERTY_GETSET(supervisor_runtime_next_stack_limit_obj, + (mp_obj_t)&supervisor_runtime_get_next_stack_limit_obj, + (mp_obj_t)&supervisor_runtime_set_next_stack_limit_obj); + +//| rgb_status_brightness: int +//| """Set brightness of status RGB LED from 0-255. This will take effect +//| after the current code finishes and the status LED is used to show +//| the finish state.""" +//| +STATIC mp_obj_t supervisor_runtime_get_rgb_status_brightness(mp_obj_t self) { + return MP_OBJ_NEW_SMALL_INT(get_status_brightness()); +} +MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_rgb_status_brightness_obj, supervisor_runtime_get_rgb_status_brightness); + +STATIC mp_obj_t supervisor_runtime_set_rgb_status_brightness(mp_obj_t self, mp_obj_t lvl) { + #if CIRCUITPY_STATUS_LED + // This must be int. If cast to uint8_t first, will never raise a ValueError. + int brightness_int = mp_obj_get_int(lvl); + mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness); + set_status_brightness((uint8_t)brightness_int); + #else + mp_raise_NotImplementedError(NULL); + #endif + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(supervisor_runtime_set_rgb_status_brightness_obj, supervisor_runtime_set_rgb_status_brightness); + +MP_PROPERTY_GETSET(supervisor_runtime_rgb_status_brightness_obj, + (mp_obj_t)&supervisor_runtime_get_rgb_status_brightness_obj, + (mp_obj_t)&supervisor_runtime_set_rgb_status_brightness_obj); + STATIC const mp_rom_map_elem_t supervisor_runtime_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_usb_connected), MP_ROM_PTR(&supervisor_runtime_usb_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_connected), MP_ROM_PTR(&supervisor_runtime_serial_connected_obj) }, { MP_ROM_QSTR(MP_QSTR_serial_bytes_available), MP_ROM_PTR(&supervisor_runtime_serial_bytes_available_obj) }, { MP_ROM_QSTR(MP_QSTR_run_reason), MP_ROM_PTR(&supervisor_runtime_run_reason_obj) }, { MP_ROM_QSTR(MP_QSTR_autoreload), MP_ROM_PTR(&supervisor_runtime_autoreload_obj) }, + { MP_ROM_QSTR(MP_QSTR_ble_workflow), MP_ROM_PTR(&supervisor_runtime_ble_workflow_obj) }, + { MP_ROM_QSTR(MP_QSTR_next_stack_limit), MP_ROM_PTR(&supervisor_runtime_next_stack_limit_obj) }, + { MP_ROM_QSTR(MP_QSTR_rgb_status_brightness), MP_ROM_PTR(&supervisor_runtime_rgb_status_brightness_obj) }, }; STATIC MP_DEFINE_CONST_DICT(supervisor_runtime_locals_dict, supervisor_runtime_locals_dict_table); diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 3dc3bff848..b61d05d636 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -30,11 +30,8 @@ #include "py/objstr.h" #include "shared/runtime/interrupt_char.h" -#include "supervisor/shared/bluetooth/bluetooth.h" #include "supervisor/shared/display.h" -#include "supervisor/shared/status_leds.h" #include "supervisor/shared/reload.h" -#include "supervisor/shared/stack.h" #include "supervisor/shared/traceback.h" #include "supervisor/shared/translate/translate.h" #include "supervisor/shared/workflow.h" @@ -63,21 +60,6 @@ //| the last exception name and location, and firmware version information. //| This object is the sole instance of `supervisor.StatusBar`.""" -//| def set_rgb_status_brightness(brightness: int) -> None: -//| """Set brightness of status RGB LED from 0-255. This will take effect -//| after the current code finishes and the status LED is used to show -//| the finish state.""" -//| ... -//| -STATIC mp_obj_t supervisor_set_rgb_status_brightness(mp_obj_t lvl) { - // This must be int. If cast to uint8_t first, will never raise a ValueError. - int brightness_int = mp_obj_get_int(lvl); - mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness); - set_status_brightness((uint8_t)brightness_int); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_set_rgb_status_brightness); - //| def reload() -> None: //| """Reload the main Python code and run it (equivalent to hitting Ctrl-D at the REPL).""" //| ... @@ -88,21 +70,6 @@ STATIC mp_obj_t supervisor_reload(void) { } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload); -//| def set_next_stack_limit(size: int) -> None: -//| """Set the size of the stack for the next vm run. If its too large, the default will be used.""" -//| ... -//| -STATIC mp_obj_t supervisor_set_next_stack_limit(mp_obj_t size_obj) { - mp_int_t size = mp_obj_get_int(size_obj); - - mp_arg_validate_int_min(size, 256, MP_QSTR_size); - - set_next_stack_size(size); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_next_stack_limit_obj, supervisor_set_next_stack_limit); - //| def set_next_code_file( //| filename: Optional[str], //| *, @@ -278,21 +245,6 @@ STATIC mp_obj_t supervisor_get_previous_traceback(void) { } MP_DEFINE_CONST_FUN_OBJ_0(supervisor_get_previous_traceback_obj, supervisor_get_previous_traceback); -//| def disable_ble_workflow() -> None: -//| """Disable ble workflow until a reset. This prevents BLE advertising outside of the VM and -//| the services used for it.""" -//| ... -//| -STATIC mp_obj_t supervisor_disable_ble_workflow(void) { - #if !CIRCUITPY_BLE_FILE_SERVICE && !CIRCUITPY_SERIAL_BLE - mp_raise_NotImplementedError(NULL); - #else - supervisor_bluetooth_disable_workflow(); - #endif - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(supervisor_disable_ble_workflow_obj, supervisor_disable_ble_workflow); - //| def reset_terminal(x_pixels: int, y_pixels: int) -> None: //| """Reset the CircuitPython serial terminal with new dimensions.""" //| ... @@ -380,15 +332,12 @@ MP_DEFINE_CONST_FUN_OBJ_KW(supervisor_set_usb_identification_obj, 0, supervisor_ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_supervisor) }, - { MP_ROM_QSTR(MP_QSTR_set_rgb_status_brightness), MP_ROM_PTR(&supervisor_set_rgb_status_brightness_obj) }, { MP_ROM_QSTR(MP_QSTR_runtime), MP_ROM_PTR(&common_hal_supervisor_runtime_obj) }, { MP_ROM_QSTR(MP_QSTR_reload), MP_ROM_PTR(&supervisor_reload_obj) }, { MP_ROM_QSTR(MP_QSTR_RunReason), MP_ROM_PTR(&supervisor_run_reason_type) }, - { MP_ROM_QSTR(MP_QSTR_set_next_stack_limit), MP_ROM_PTR(&supervisor_set_next_stack_limit_obj) }, { MP_ROM_QSTR(MP_QSTR_set_next_code_file), MP_ROM_PTR(&supervisor_set_next_code_file_obj) }, { MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) }, { MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) }, - { MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) }, { MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) }, { MP_ROM_QSTR(MP_QSTR_set_usb_identification), MP_ROM_PTR(&supervisor_set_usb_identification_obj) }, { MP_ROM_QSTR(MP_QSTR_status_bar), MP_ROM_PTR(&shared_module_supervisor_status_bar_obj) }, diff --git a/supervisor/shared/bluetooth/bluetooth.c b/supervisor/shared/bluetooth/bluetooth.c index 472d2fa7d5..6fe5d570b8 100644 --- a/supervisor/shared/bluetooth/bluetooth.c +++ b/supervisor/shared/bluetooth/bluetooth.c @@ -354,7 +354,6 @@ void supervisor_bluetooth_enable_workflow(void) { if (workflow_state == WORKFLOW_DISABLED) { return; } - workflow_state = WORKFLOW_ENABLED; #endif } @@ -364,3 +363,12 @@ void supervisor_bluetooth_disable_workflow(void) { workflow_state = WORKFLOW_DISABLED; #endif } + +bool supervisor_bluetooth_workflow_is_enabled(void) { + #if CIRCUITPY_BLE_FILE_SERVICE || CIRCUITPY_SERIAL_BLE + if (workflow_state == 1) { + return true; + } + #endif + return false; +} diff --git a/supervisor/shared/bluetooth/bluetooth.h b/supervisor/shared/bluetooth/bluetooth.h index 231fde3c54..0028c8da33 100644 --- a/supervisor/shared/bluetooth/bluetooth.h +++ b/supervisor/shared/bluetooth/bluetooth.h @@ -37,6 +37,7 @@ void supervisor_stop_bluetooth(void); // Enable only works if it hasn't been set yet. void supervisor_bluetooth_enable_workflow(void); void supervisor_bluetooth_disable_workflow(void); +bool supervisor_bluetooth_workflow_is_enabled(void); // Title bar status bool supervisor_bluetooth_status_dirty(void); diff --git a/supervisor/shared/stack.c b/supervisor/shared/stack.c index d2188e016d..fa8d019fea 100644 --- a/supervisor/shared/stack.c +++ b/supervisor/shared/stack.c @@ -107,6 +107,10 @@ void set_next_stack_size(uint32_t size) { next_stack_size = size; } +uint32_t get_next_stack_size(void) { + return next_stack_size; +} + uint32_t get_current_stack_size(void) { return current_stack_size; } diff --git a/supervisor/shared/stack.h b/supervisor/shared/stack.h index 98cc5a1685..4acda57354 100644 --- a/supervisor/shared/stack.h +++ b/supervisor/shared/stack.h @@ -38,6 +38,7 @@ uint32_t *stack_get_bottom(void); size_t stack_get_length(void); // Next/current requested stack size. void set_next_stack_size(uint32_t size); +uint32_t get_next_stack_size(void); uint32_t get_current_stack_size(void); bool stack_ok(void); diff --git a/supervisor/shared/status_leds.c b/supervisor/shared/status_leds.c index 07ff9634e9..315e64a9a0 100644 --- a/supervisor/shared/status_leds.c +++ b/supervisor/shared/status_leds.c @@ -330,6 +330,14 @@ void set_status_brightness(uint8_t level) { #endif } +uint8_t get_status_brightness(void) { + #if CIRCUITPY_STATUS_LED + return rgb_status_brightness; + #else + return 0; + #endif +} + void init_rxtx_leds(void) { #if CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_RX) common_hal_digitalio_digitalinout_construct(&rx_led, MICROPY_HW_LED_RX); diff --git a/supervisor/shared/status_leds.h b/supervisor/shared/status_leds.h index 99aa0277d6..d065b96d4a 100644 --- a/supervisor/shared/status_leds.h +++ b/supervisor/shared/status_leds.h @@ -53,6 +53,7 @@ void new_status_color(uint32_t rgb); uint32_t color_brightness(uint32_t color, uint8_t brightness); void set_status_brightness(uint8_t level); +uint8_t get_status_brightness(void); void init_rxtx_leds(void); void deinit_rxtx_leds(void); From 90f6096955e6439ec22eba2bcac3680056cdc9d3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 3 Oct 2022 15:29:03 -0400 Subject: [PATCH 2/8] fix ai-thinker creation ids; fix some typos elsewhere --- ports/atmel-samd/common-hal/analogio/AnalogOut.c | 4 ++-- .../espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk | 2 +- ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk | 4 ++-- ports/nrf/common-hal/watchdog/WatchDogTimer.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index b4d556429c..ec690e8ddb 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -45,8 +45,8 @@ #endif #define HAVE_ANALOGOUT ( \ - (defined(PIN_PA02) && !defined(IGNORE_PA02)) || \ - (defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PA05)) \ + (defined(PIN_PA02) && !defined(IGNORE_PIN_PA02)) || \ + (defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05)) \ ) void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk index 913f65f95c..210c4e46f1 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk @@ -1,5 +1,5 @@ CIRCUITPY_CREATOR_ID = 0x000C303B -CIRCUITPY_CREATION_ID = 0x00320001 +CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk index eb88c5caab..1ef07368bf 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk @@ -1,5 +1,5 @@ -CIRCUITPY_CREATOR_ID = 0x70010001 -CIRCUITPY_CREATION_ID = 0x00100001 +CIRCUITPY_CREATOR_ID = 0x000C303B +CIRCUITPY_CREATION_ID = 0x00C30002 IDF_TARGET = esp32c3 diff --git a/ports/nrf/common-hal/watchdog/WatchDogTimer.c b/ports/nrf/common-hal/watchdog/WatchDogTimer.c index cd7aa449bf..99c360c46d 100644 --- a/ports/nrf/common-hal/watchdog/WatchDogTimer.c +++ b/ports/nrf/common-hal/watchdog/WatchDogTimer.c @@ -96,7 +96,7 @@ void common_hal_watchdog_feed(watchdog_watchdogtimer_obj_t *self) { void common_hal_watchdog_deinit(watchdog_watchdogtimer_obj_t *self) { if (self->mode == WATCHDOGMODE_RESET) { if (gc_alloc_possible()) { - mp_raise_NotImplementedError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); + mp_raise_RuntimeError(translate("WatchDogTimer cannot be deinitialized once mode is set to RESET")); } // Don't change anything because RESET cannot be undone. return; From 6dc03ae3ced496c696058be739e0ba6c491c6a62 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 3 Oct 2022 20:46:19 -0400 Subject: [PATCH 3/8] fix some dotenv parsing --- shared-bindings/dotenv/__init__.c | 13 ++- shared-module/dotenv/__init__.c | 115 ++++++++++++--------- tests/circuitpython-manual/dotenv_test.env | 32 ++++++ tests/circuitpython-manual/dotenv_test.py | 23 +++++ 4 files changed, 132 insertions(+), 51 deletions(-) create mode 100644 tests/circuitpython-manual/dotenv_test.env create mode 100644 tests/circuitpython-manual/dotenv_test.py diff --git a/shared-bindings/dotenv/__init__.c b/shared-bindings/dotenv/__init__.c index 0aed49cefb..193338c7c2 100644 --- a/shared-bindings/dotenv/__init__.c +++ b/shared-bindings/dotenv/__init__.c @@ -40,9 +40,13 @@ //| A subset of the CPython `dotenv library `_. It does //| not support variables or double quotes. //| -//| The simplest way to define keys and values is to put them in single quotes. \ and ' are -//| escaped by \ in single quotes. Newlines can occur in quotes for multiline values. Comments -//| start with # and apply for the rest of the line. +//| Keys and values may be put in single quotes. +//| ``\`` and ``'`` are escaped by ``\`` in single quotes. Newlines can occur in quotes for multiline values. +//| Comments start with ``#`` and apply for the rest of the line. +//| A ``#`` immediately following an ``=`` is part of the value, not the start of a comment, +//| and a ``#`` embedded in a value without whitespace will be part of that value. +//| This corresponds to how assignments and comments work in most Unix shells. +//| //| //| File format example: //| @@ -58,6 +62,9 @@ //| multiline = 'hello //| world //| how are you?' +//| # The #'s below will be included in the value. They do not start a comment. +//| key6=#value +//| key7=abc#def //| //| """ //| diff --git a/shared-module/dotenv/__init__.c b/shared-module/dotenv/__init__.c index 1837cef2f5..505eb2a91f 100644 --- a/shared-module/dotenv/__init__.c +++ b/shared-module/dotenv/__init__.c @@ -35,72 +35,90 @@ #include "py/objstr.h" #include "supervisor/filesystem.h" -STATIC uint8_t consume_spaces(FIL *active_file) { - uint8_t character = ' '; - UINT quantity_read = 1; - while (unichar_isspace(character) && quantity_read > 0) { - f_read(active_file, &character, 1, &quantity_read); - } +// Return 0 if there is no next character (EOF). +STATIC uint8_t get_next_character(FIL *active_file) { + uint8_t character = 0; + UINT quantity_read; + // If there's an error or quantity_read is 0, character will remain 0. + f_read(active_file, &character, 1, &quantity_read); + return character; +} + +// Discard whitespace, except for newlines, returning the next character after the whitespace. +// Return 0 if there is no next character (EOF). +STATIC uint8_t consume_whitespace(FIL *active_file) { + uint8_t character; + do { + character = get_next_character(active_file); + } while (character != '\n' && character != 0 && unichar_isspace(character)); return character; } // Starting at the start of a new line, determines if the key matches the given -// key. File pointer is left after the = after the key. +// key. File pointer is set to be just before the = after the key. STATIC bool key_matches(FIL *active_file, const char *key) { - uint8_t character = ' '; - UINT quantity_read = 1; - character = consume_spaces(active_file); + uint8_t character; + character = consume_whitespace(active_file); + if (character == 0) { + return false; + } bool quoted = false; if (character == '\'') { + // Beginning of single-quoted string. quoted = true; - f_read(active_file, &character, 1, &quantity_read); + character = get_next_character(active_file); } size_t key_pos = 0; bool escaped = false; bool matches = true; size_t key_len = strlen(key); - while (quantity_read > 0) { + while (character != 0) { if (character == '\\' && !escaped && quoted) { escaped = true; } else if (!escaped && quoted && character == '\'') { quoted = false; - // Move past the quoted before breaking so we can check the validity of data past it. - f_read(active_file, &character, 1, &quantity_read); + // End of quoted key. Skip over the ending quote. + character = get_next_character(active_file); break; - } else if (!quoted && (unichar_isspace(character) || character == '=' || character == '\n' || character == '#')) { + } else if (!quoted && (unichar_isspace(character) || character == '=' || character == '\n' || character == '#' || character == 0)) { + // End of unquoted key. break; } else { - matches = matches && key[key_pos] == character; - escaped = false; - key_pos++; + // Still on tentative key; see if it matches the next supplied key character, + // but don't run off the end of the supplied key. + if (key_pos < key_len) { + matches = matches && key[key_pos] == character; + escaped = false; + key_pos++; + } else { + // Key on line is too long. + matches = false; + } } - - f_read(active_file, &character, 1, &quantity_read); + character = get_next_character(active_file); } - if (unichar_isspace(character)) { - character = consume_spaces(active_file); - } - if (character == '=' || character == '\n' || character == '#') { - // Rewind one so the value can find it. + if (character == '=' || character == '\n' || character == '#' || character == 0) { + // Rewind one so the value, if any, can be found. f_lseek(active_file, f_tell(active_file) - 1); } else { // We're followed by something else that is invalid syntax. matches = false; } + return matches && key_pos == key_len; } STATIC bool next_line(FIL *active_file) { - uint8_t character = ' '; - UINT quantity_read = 1; + uint8_t character; bool quoted = false; bool escaped = false; // Track comments because they last until the end of the line. bool comment = false; - FRESULT result = FR_OK; // Consume all characters while quoted or others up to \n. - while (result == FR_OK && quantity_read > 0 && (quoted || character != '\n')) { - if (character == '#' || comment) { + do { + character = get_next_character(active_file); + + if ((!quoted || character == '#') || comment) { // Comments consume any escaping. comment = true; } else if (!escaped) { @@ -112,33 +130,32 @@ STATIC bool next_line(FIL *active_file) { } else { escaped = false; } - result = f_read(active_file, &character, 1, &quantity_read); - } - return result == FR_OK && quantity_read > 0; + } while (character != 0 && (quoted || character != '\n')); + + return character != 0; } STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { - uint8_t character = ' '; - UINT quantity_read = 1; - // Consume spaces before = - character = consume_spaces(active_file); + uint8_t character; + // Consume spaces before "=", and get first character of interest. + character = consume_whitespace(active_file); if (character != '=') { if (character == '#' || character == '\n') { // Keys without an = after them are valid with the value None. - return 0; + return -1; } // All other characters are invalid. return -1; } - character = ' '; // Consume space after = - while (unichar_isspace(character) && quantity_read > 0) { - f_read(active_file, &character, 1, &quantity_read); + if (character != '#') { + // a # immediately after = is part of the value! + character = consume_whitespace(active_file); } bool quoted = false; if (character == '\'') { quoted = true; - f_read(active_file, &character, 1, &quantity_read); + character = get_next_character(active_file); } if (character == '"') { // We don't support double quoted values. @@ -150,12 +167,13 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { // Count trailing spaces so we can ignore them at the end of unquoted // values. size_t trailing_spaces = 0; - while (quantity_read > 0) { + bool first_char = true; + while (character != 0) { // Consume the first \ if the value is quoted. if (quoted && character == '\\' && !escaped) { escaped = true; - // Drop this slash by short circuiting the rest of the loop. - f_read(active_file, &character, 1, &quantity_read); + // Drop this backslash by short circuiting the rest of the loop. + character = get_next_character(active_file); continue; } if (quoted && !escaped && character == '\'') { @@ -163,7 +181,7 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { break; } // Unquoted values are ended by a newline or comment. - if (!quoted && (character == '\n' || character == '#')) { + if (!quoted && (character == '\n' || (character == '#' && !first_char))) { if (character == '\n') { // Rewind one so the next_line can find the \n. f_lseek(active_file, f_tell(active_file) - 1); @@ -182,7 +200,8 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { value[value_pos] = character; } value_pos++; - f_read(active_file, &character, 1, &quantity_read); + character = get_next_character(active_file); + first_char = false; } return value_pos - trailing_spaces; @@ -214,7 +233,7 @@ mp_obj_t common_hal_dotenv_get_key(const char *path, const char *key) { // the length. char value[64]; mp_int_t actual_len = dotenv_get_key(path, key, value, sizeof(value)); - if (actual_len <= 0) { + if (actual_len < 0) { return mp_const_none; } if ((size_t)actual_len >= sizeof(value)) { diff --git a/tests/circuitpython-manual/dotenv_test.env b/tests/circuitpython-manual/dotenv_test.env new file mode 100644 index 0000000000..5e4e4cb8f0 --- /dev/null +++ b/tests/circuitpython-manual/dotenv_test.env @@ -0,0 +1,32 @@ +# No e0 value + # comment preceded by spaces +e1=e1value +e2=e2value # value followed by a comment +e3='e3value' +e4='e4value' # quoted value followed by a comment +# e5 should be None +e5 +# e6 should be the empty string +e6= +# e7 should be '#' (bash-like syntax processing) +e7=# +# e8 should be the empty string +e8='' +# e9 should be the empty string +e9= # +e10=e10_first +e10=e10_last +e11='abc#def' +# e12 should be 'abc#def' +e12=abc#def +e12='multi +line' +e13=e13value +e14 #comment +e15 = e15value +# e16 should be '#' +e16=# # +# e17 should be 'def#hi' +e17='def'#hi +# e18 should be '#has a hash' +e18=#has a hash diff --git a/tests/circuitpython-manual/dotenv_test.py b/tests/circuitpython-manual/dotenv_test.py new file mode 100644 index 0000000000..32127b54cb --- /dev/null +++ b/tests/circuitpython-manual/dotenv_test.py @@ -0,0 +1,23 @@ +import dotenv + +FILE = "dotenv_test.env" + +print("e0", dotenv.get_key(FILE, "e0")) +print("e1", dotenv.get_key(FILE, "e1")) +print("e2", dotenv.get_key(FILE, "e2")) +print("e3", dotenv.get_key(FILE, "e3")) +print("e4", dotenv.get_key(FILE, "e4")) +print("e5", dotenv.get_key(FILE, "e5")) +print("e6", dotenv.get_key(FILE, "e6")) +print("e7", dotenv.get_key(FILE, "e7")) +print("e8", dotenv.get_key(FILE, "e8")) +print("e9", dotenv.get_key(FILE, "e9")) +print("e10", dotenv.get_key(FILE, "e10")) +print("e11", dotenv.get_key(FILE, "e11")) +print("e12", dotenv.get_key(FILE, "e12")) +print("e13", dotenv.get_key(FILE, "e13")) +print("e14", dotenv.get_key(FILE, "e14")) +print("e15", dotenv.get_key(FILE, "e15")) +print("e16", dotenv.get_key(FILE, "e16")) +print("e17", dotenv.get_key(FILE, "e17")) +print("e18", dotenv.get_key(FILE, "e18")) From 4fd15acf776f0fea6ebb89a0f20dec5a4c99cd35 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Tue, 4 Oct 2022 08:28:48 +0530 Subject: [PATCH 4/8] implement suggested change pass brightness value directly Co-authored-by: Dan Halbert --- shared-bindings/supervisor/Runtime.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 1fbafb5641..4d8ddbacc7 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -201,9 +201,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_runtime_get_rgb_status_brightness_obj, supe STATIC mp_obj_t supervisor_runtime_set_rgb_status_brightness(mp_obj_t self, mp_obj_t lvl) { #if CIRCUITPY_STATUS_LED // This must be int. If cast to uint8_t first, will never raise a ValueError. - int brightness_int = mp_obj_get_int(lvl); - mp_arg_validate_int_range(brightness_int, 0, 255, MP_QSTR_brightness); - set_status_brightness((uint8_t)brightness_int); + set_status_brightness((uint8_t)mp_arg_validate_int_range(mp_obj_get_int(lvl), 0, 255, MP_QSTR_brightness)); #else mp_raise_NotImplementedError(NULL); #endif From 52bca952080e720ce96154f0fdf1b65e8d7a83a3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 4 Oct 2022 09:37:31 -0500 Subject: [PATCH 5/8] Refactor dotenv module so that it can be tested on host .. it needs to operate on a FILE* rather than FIL depending on the build. Note that this is comparing output to expected, not to cpython dotenv package. Because run-tests.py starts the CPython interpreter with the '-S' (skip site initialization) flag, pip-installed packages are not available for import inside a test file. Instead, the exp file is generated manually: ``` circuitpython/tests$ python3 circuitpython/dotenv_test.py > circuitpython/dotenv_test.py.exp ``` Unfortunately, the test fails on test e15: ```diff FAILURE /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py --- /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.exp 2022-10-04 09:48:16.307703128 -0500 +++ /home/jepler/src/circuitpython/tests/results/circuitpython_dotenv_test.py.out 2022-10-04 09:48:16.307703128 -0500 @@ -14,7 +14,7 @@ line e13 e13value e14 None -e15 e15value +e15 None e16 # e17 def e18 #has a hash ``` --- .../unix/variants/coverage/mpconfigvariant.mk | 4 +- shared-module/dotenv/__init__.c | 61 +++++++++++++++---- .../dotenv_test.env | 0 .../dotenv_test.py | 2 +- tests/circuitpython/dotenv_test.py.exp | 20 ++++++ tests/unix/extra_coverage.py.exp | 25 ++++---- 6 files changed, 85 insertions(+), 27 deletions(-) rename tests/{circuitpython-manual => circuitpython}/dotenv_test.env (100%) rename tests/{circuitpython-manual => circuitpython}/dotenv_test.py (94%) create mode 100644 tests/circuitpython/dotenv_test.py.exp diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 3377bf20d3..1e8e59f9a9 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -33,6 +33,7 @@ SRC_BITMAP := \ shared-bindings/aesio/__init__.c \ shared-bindings/bitmaptools/__init__.c \ shared-bindings/displayio/Bitmap.c \ + shared-bindings/dotenv/__init__.c \ shared-bindings/rainbowio/__init__.c \ shared-bindings/traceback/__init__.c \ shared-bindings/util.c \ @@ -44,17 +45,18 @@ SRC_BITMAP := \ shared-module/displayio/Bitmap.c \ shared-module/displayio/ColorConverter.c \ shared-module/displayio/ColorConverter.c \ + shared-module/dotenv/__init__.c \ shared-module/rainbowio/__init__.c \ shared-module/traceback/__init__.c \ shared-module/zlib/__init__.c \ -$(info $(SRC_BITMAP)) SRC_C += $(SRC_BITMAP) CFLAGS += \ -DCIRCUITPY_AESIO=1 \ -DCIRCUITPY_BITMAPTOOLS=1 \ -DCIRCUITPY_DISPLAYIO_UNIX=1 \ + -DCIRCUITPY_DOTENV=1 \ -DCIRCUITPY_GIFIO=1 \ -DCIRCUITPY_RAINBOWIO=1 \ -DCIRCUITPY_TRACEBACK=1 \ diff --git a/shared-module/dotenv/__init__.c b/shared-module/dotenv/__init__.c index 505eb2a91f..c09e38370b 100644 --- a/shared-module/dotenv/__init__.c +++ b/shared-module/dotenv/__init__.c @@ -29,12 +29,45 @@ #include "shared-bindings/dotenv/__init__.h" -#include "extmod/vfs.h" -#include "extmod/vfs_fat.h" #include "py/mpstate.h" #include "py/objstr.h" #include "supervisor/filesystem.h" +#if defined(UNIX) +typedef FILE *file_arg; +STATIC bool open_file(const char *name, file_arg *active_file) { + FILE *result = fopen(name, "r"); + if (result) { + *active_file = result; + } + return result != NULL; +} +STATIC void close_file(file_arg *active_file) { + fclose(*active_file); +} +STATIC uint8_t get_next_character(file_arg *active_file) { + int value = fgetc(*active_file); + if (value == EOF) { + return 0; + } + return value; +} +STATIC void seek_minus_one(file_arg *active_file) { + fseek(*active_file, -1, SEEK_CUR); +} +#else +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +typedef FIL file_arg; +STATIC bool open_file(const char *name, file_arg *active_file) { + FATFS *fs = filesystem_circuitpy(); + FRESULT result = f_open(fs, active_file, name, FA_READ); + return result == FR_OK; +} +STATIC void close_file(file_arg *active_file) { + // nothing +} + // Return 0 if there is no next character (EOF). STATIC uint8_t get_next_character(FIL *active_file) { uint8_t character = 0; @@ -43,10 +76,14 @@ STATIC uint8_t get_next_character(FIL *active_file) { f_read(active_file, &character, 1, &quantity_read); return character; } +STATIC void seek_minus_one(file_arg *active_file) { + f_lseek(active_file, f_tell(active_file) - 1); +} +#endif // Discard whitespace, except for newlines, returning the next character after the whitespace. // Return 0 if there is no next character (EOF). -STATIC uint8_t consume_whitespace(FIL *active_file) { +STATIC uint8_t consume_whitespace(file_arg *active_file) { uint8_t character; do { character = get_next_character(active_file); @@ -56,7 +93,7 @@ STATIC uint8_t consume_whitespace(FIL *active_file) { // Starting at the start of a new line, determines if the key matches the given // key. File pointer is set to be just before the = after the key. -STATIC bool key_matches(FIL *active_file, const char *key) { +STATIC bool key_matches(file_arg *active_file, const char *key) { uint8_t character; character = consume_whitespace(active_file); if (character == 0) { @@ -99,7 +136,7 @@ STATIC bool key_matches(FIL *active_file, const char *key) { } if (character == '=' || character == '\n' || character == '#' || character == 0) { // Rewind one so the value, if any, can be found. - f_lseek(active_file, f_tell(active_file) - 1); + seek_minus_one(active_file); } else { // We're followed by something else that is invalid syntax. matches = false; @@ -108,7 +145,7 @@ STATIC bool key_matches(FIL *active_file, const char *key) { return matches && key_pos == key_len; } -STATIC bool next_line(FIL *active_file) { +STATIC bool next_line(file_arg *active_file) { uint8_t character; bool quoted = false; bool escaped = false; @@ -135,7 +172,7 @@ STATIC bool next_line(FIL *active_file) { return character != 0; } -STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { +STATIC mp_int_t read_value(file_arg *active_file, char *value, size_t value_len) { uint8_t character; // Consume spaces before "=", and get first character of interest. character = consume_whitespace(active_file); @@ -184,7 +221,7 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { if (!quoted && (character == '\n' || (character == '#' && !first_char))) { if (character == '\n') { // Rewind one so the next_line can find the \n. - f_lseek(active_file, f_tell(active_file) - 1); + seek_minus_one(active_file); } break; } @@ -208,10 +245,8 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) { } mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len) { - FIL active_file; - FATFS *fs = filesystem_circuitpy(); - FRESULT result = f_open(fs, &active_file, path, FA_READ); - if (result != FR_OK) { + file_arg active_file; + if (!open_file(path, &active_file)) { return -1; } @@ -224,7 +259,7 @@ mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t read_ok = next_line(&active_file); } - f_close(&active_file); + close_file(&active_file); return actual_value_len; } diff --git a/tests/circuitpython-manual/dotenv_test.env b/tests/circuitpython/dotenv_test.env similarity index 100% rename from tests/circuitpython-manual/dotenv_test.env rename to tests/circuitpython/dotenv_test.env diff --git a/tests/circuitpython-manual/dotenv_test.py b/tests/circuitpython/dotenv_test.py similarity index 94% rename from tests/circuitpython-manual/dotenv_test.py rename to tests/circuitpython/dotenv_test.py index 32127b54cb..77afaaa0c5 100644 --- a/tests/circuitpython-manual/dotenv_test.py +++ b/tests/circuitpython/dotenv_test.py @@ -1,6 +1,6 @@ import dotenv -FILE = "dotenv_test.env" +FILE = __file__.rsplit(".", 1)[0] + ".env" print("e0", dotenv.get_key(FILE, "e0")) print("e1", dotenv.get_key(FILE, "e1")) diff --git a/tests/circuitpython/dotenv_test.py.exp b/tests/circuitpython/dotenv_test.py.exp new file mode 100644 index 0000000000..bf08026e5f --- /dev/null +++ b/tests/circuitpython/dotenv_test.py.exp @@ -0,0 +1,20 @@ +e0 None +e1 e1value +e2 e2value +e3 e3value +e4 e4value +e5 None +e6 +e7 # +e8 +e9 # +e10 e10_last +e11 abc#def +e12 multi +line +e13 e13value +e14 None +e15 e15value +e16 # +e17 def +e18 #has a hash diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 582d90e1bc..782ab95cc8 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -32,18 +32,19 @@ mport builtins micropython _asyncio _thread _uasyncio aesio array binascii bitmaptools btree cexample cmath -collections cppexample displayio errno -ffi framebuf gc gifio -hashlib json math qrio -rainbowio re sys termios -traceback ubinascii uctypes uerrno -uheapq uio ujson ulab -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 +collections cppexample displayio dotenv +errno ffi framebuf gc +gifio hashlib json math +qrio rainbowio re sys +termios traceback ubinascii uctypes +uerrno uheapq uio ujson +ulab 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 718b8e706e5e1b1f2ba690f7a24210e9d109ab8b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 4 Oct 2022 10:54:22 -0500 Subject: [PATCH 6/8] disable test e15 for now --- tests/circuitpython/dotenv_test.py | 2 +- tests/circuitpython/dotenv_test.py.exp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/circuitpython/dotenv_test.py b/tests/circuitpython/dotenv_test.py index 77afaaa0c5..84856747f4 100644 --- a/tests/circuitpython/dotenv_test.py +++ b/tests/circuitpython/dotenv_test.py @@ -17,7 +17,7 @@ print("e11", dotenv.get_key(FILE, "e11")) print("e12", dotenv.get_key(FILE, "e12")) print("e13", dotenv.get_key(FILE, "e13")) print("e14", dotenv.get_key(FILE, "e14")) -print("e15", dotenv.get_key(FILE, "e15")) +# print("e15", dotenv.get_key(FILE, "e15")) print("e16", dotenv.get_key(FILE, "e16")) print("e17", dotenv.get_key(FILE, "e17")) print("e18", dotenv.get_key(FILE, "e18")) diff --git a/tests/circuitpython/dotenv_test.py.exp b/tests/circuitpython/dotenv_test.py.exp index bf08026e5f..b6de0db390 100644 --- a/tests/circuitpython/dotenv_test.py.exp +++ b/tests/circuitpython/dotenv_test.py.exp @@ -14,7 +14,6 @@ e12 multi line e13 e13value e14 None -e15 e15value e16 # e17 def e18 #has a hash From ed87579a65ff61a1e6c769ec2a668e3ca1cc0201 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 4 Oct 2022 19:22:18 -0400 Subject: [PATCH 7/8] add missing native modules to support matrix --- docs/design_guide.rst | 2 +- docs/library/builtins.rst | 5 +++- docs/library/collections.rst | 2 +- docs/library/micropython.rst | 2 +- docs/shared_bindings_matrix.py | 16 +++++++++--- py/circuitpy_mpconfig.h | 38 +++++++++++------------------ py/circuitpy_mpconfig.mk | 36 +++++++++++++++++++-------- shared-bindings/analogio/AnalogIn.c | 2 +- shared-bindings/support_matrix.rst | 5 ++++ 9 files changed, 66 insertions(+), 42 deletions(-) diff --git a/docs/design_guide.rst b/docs/design_guide.rst index b68398827d..03a0c88309 100644 --- a/docs/design_guide.rst +++ b/docs/design_guide.rst @@ -309,7 +309,7 @@ following structure: param_type ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The type of the parameter. This could be among other `int`, `float`, `str` `bool`, etc. +The type of the parameter. This could be, among others, ``int``, ``float``, ``str``, ``bool``, etc. To document an object in the CircuitPython domain, you need to include a ``~`` before the definition as shown in the following example: diff --git a/docs/library/builtins.rst b/docs/library/builtins.rst index a3be5ae16e..5358f3cda3 100644 --- a/docs/library/builtins.rst +++ b/docs/library/builtins.rst @@ -1,8 +1,11 @@ :mod:`builtins` -- builtin functions and exceptions =================================================== +.. module:: builtins + :synopsis: builtin Python functions + All builtin functions and exceptions are described here. They are also -available via ``builtins`` module. +available via the ``builtins`` module. For more information about built-ins, see the following CPython documentation: diff --git a/docs/library/collections.rst b/docs/library/collections.rst index b7a5fb1765..2cc1a215d1 100644 --- a/docs/library/collections.rst +++ b/docs/library/collections.rst @@ -28,7 +28,7 @@ Classes - The optional *flags* can be 1 to check for overflow when adding items. - As well as supporting `bool` and `len`, deque objects have the following + As well as supporting ``bool`` and ``len``, deque objects have the following methods: .. method:: deque.append(x) diff --git a/docs/library/micropython.rst b/docs/library/micropython.rst index 2623aab582..dddb813d34 100644 --- a/docs/library/micropython.rst +++ b/docs/library/micropython.rst @@ -76,7 +76,7 @@ Functions .. function:: heap_locked() Lock or unlock the heap. When locked no memory allocation can occur and a - `MemoryError` will be raised if any heap allocation is attempted. + ``MemoryError`` will be raised if any heap allocation is attempted. `heap_locked()` returns a true value if the heap is currently locked. These functions can be nested, ie `heap_lock()` can be called multiple times diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index c4bf105898..5b9b63d8fd 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -56,13 +56,23 @@ ALIASES_BRAND_NAMES = { } ADDITIONAL_MODULES = { - "fontio": "CIRCUITPY_DISPLAYIO", - "terminalio": "CIRCUITPY_DISPLAYIO", + "_asyncio": "MICROPY_PY_UASYNCIO", "adafruit_bus_device": "CIRCUITPY_BUSDEVICE", "adafruit_pixelbuf": "CIRCUITPY_PIXELBUF", + "array": "CIRCUITPY_ARRAY", + # always available, so depend on something that's always 1. + "builtins": "CIRCUITPY", + "collections": "CIRCUITPY_COLLECTIONS", + "fontio": "CIRCUITPY_DISPLAYIO", + "io": "CIRCUITPY_IO", + "select": "MICROPY_PY_USELECT_SELECT", + "terminalio": "CIRCUITPY_DISPLAYIO", + "sys": "CIRCUITPY_SYS", "usb": "CIRCUITPY_USB_HOST", } +MODULES_NOT_IN_SHARED_BINDINGS = ["_asyncio", "array", "binascii", "builtins", "collections", "errno", "json", "re", "select", "sys", "ulab"] + FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"] """Files and dirs at the root of a frozen directory that should be ignored. This is the same list as in the preprocess_frozen_modules script.""" @@ -82,7 +92,7 @@ def get_shared_bindings(): """ Get a list of modules in shared-bindings based on folder names. """ shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings" - return [item.name for item in shared_bindings_dir.iterdir()] + ["binascii", "errno", "json", "re", "ulab"] + return [item.name for item in shared_bindings_dir.iterdir()] + MODULES_NOT_IN_SHARED_BINDINGS def get_board_mapping(): diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 7c497c6106..e09c17d85e 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -35,7 +35,8 @@ #include // This is CircuitPython. -#define CIRCUITPY 1 +// Always 1: defined in circuitpy_mpconfig.mk +// #define CIRCUITPY (1) // REPR_C encodes qstrs, 31-bit ints, and 30-bit floats in a single 32-bit word. #ifndef MICROPY_OBJ_REPR @@ -91,7 +92,7 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE (CIRCUITPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE) #define MICROPY_PERSISTENT_CODE_LOAD (1) -#define MICROPY_PY_ARRAY (1) +#define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ATTRTUPLE (1) @@ -113,21 +114,30 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_PY_BUILTINS_STR_UNICODE (1) #define MICROPY_PY_CMATH (0) -#define MICROPY_PY_COLLECTIONS (1) +#define MICROPY_PY_COLLECTIONS (CIRCUITPY_COLLECTIONS) #define MICROPY_PY_DESCRIPTORS (1) #define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_GC (1) // Supplanted by shared-bindings/math +#define MICROPY_PY_IO (CIRCUITPY_IO) #define MICROPY_PY_MATH (0) #define MICROPY_PY_MICROPYTHON_MEM_INFO (0) // Supplanted by shared-bindings/struct #define MICROPY_PY_STRUCT (0) -#define MICROPY_PY_SYS (1) +#define MICROPY_PY_SYS (CIRCUITPY_SYS) #define MICROPY_PY_SYS_MAXSIZE (1) #define MICROPY_PY_SYS_STDFILES (1) +// In extmod +#define MICROPY_PY_UBINASCII (CIRCUITPY_BINASCII) +#define MICROPY_PY_UERRNO (CIRCUITPY_ERRNO) +// Uses about 80 bytes. +#define MICROPY_PY_UERRNO_ERRORCODE (CIRCUITPY_ERRNO) // Supplanted by shared-bindings/random #define MICROPY_PY_URANDOM (0) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (0) +// In extmod +#define MICROPY_PY_UJSON (CIRCUITPY_JSON) +#define MICROPY_PY_URE (CIRCUITPY_RE) #define MICROPY_PY___FILE__ (1) #define MICROPY_QSTR_BYTES_IN_HASH (1) @@ -349,26 +359,6 @@ typedef long mp_off_t; extern const struct _mp_obj_module_t nvm_module; #endif -// Following modules are implemented in either extmod or py directory. - -#define MICROPY_PY_UBINASCII CIRCUITPY_BINASCII - -#define MICROPY_PY_UERRNO CIRCUITPY_ERRNO -// Uses about 80 bytes. -#define MICROPY_PY_UERRNO_ERRORCODE CIRCUITPY_ERRNO - -#define MICROPY_PY_URE CIRCUITPY_RE - -#if CIRCUITPY_JSON -#define MICROPY_PY_UJSON (1) -#define MICROPY_PY_IO (1) -#else -#ifndef MICROPY_PY_IO -// We don't need MICROPY_PY_IO unless someone else wants it. -#define MICROPY_PY_IO (0) -#endif -#endif - #ifndef ULAB_SUPPORTS_COMPLEX #define ULAB_SUPPORTS_COMPLEX (0) #endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index fc270f2c59..96165997ce 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -26,6 +26,10 @@ # Boards default to all modules enabled (with exceptions) # Manually disable by overriding in #mpconfigboard.mk +# Always on. Present here to help generate documentation module support matrix for "builtins". +CIRCUITPY = 1 +CFLAGS += -DCIRCUITPY=$(CIRCUITPY) + # Smaller builds can be forced for resource constrained chips (typically SAMD21s # without external flash) by setting CIRCUITPY_FULL_BUILD=0. Avoid using this # for merely incomplete ports, as it changes settings in other files. @@ -68,6 +72,9 @@ CFLAGS += -DCIRCUITPY_ANALOGBUFIO=$(CIRCUITPY_ANALOGBUFIO) CIRCUITPY_ANALOGIO ?= 1 CFLAGS += -DCIRCUITPY_ANALOGIO=$(CIRCUITPY_ANALOGIO) +CIRCUITPY_ARRAY ?= 1 +CFLAGS += -DCIRCUITPY_ARRAY=$(CIRCUITPY_ARRAY) + CIRCUITPY_ATEXIT ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ATEXIT=$(CIRCUITPY_ATEXIT) @@ -159,21 +166,18 @@ CFLAGS += -DCIRCUITPY_CAMERA=$(CIRCUITPY_CAMERA) CIRCUITPY_CANIO ?= 0 CFLAGS += -DCIRCUITPY_CANIO=$(CIRCUITPY_CANIO) +CIRCUITPY_COLLECTIONS ?= 1 +CFLAGS += -DCIRCUITPY_COLLECTIONS=$(CIRCUITPY_COLLECTIONS) + +CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0 +CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE) + CIRCUITPY_CYW43 ?= 0 CFLAGS += -DCIRCUITPY_CYW43=$(CIRCUITPY_CYW43) CIRCUITPY_DIGITALIO ?= 1 CFLAGS += -DCIRCUITPY_DIGITALIO=$(CIRCUITPY_DIGITALIO) -CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 0 -CFLAGS += -DCIRCUITPY_COMPUTED_GOTO_SAVE_SPACE=$(CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE) - -CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1 -CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH) - -CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD) -CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE) - CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_COUNTIO=$(CIRCUITPY_COUNTIO) @@ -257,6 +261,10 @@ CFLAGS += -DCIRCUITPY_I2CTARGET=$(CIRCUITPY_I2CTARGET) CIRCUITPY_IMAGECAPTURE ?= 0 CFLAGS += -DCIRCUITPY_IMAGECAPTURE=$(CIRCUITPY_IMAGECAPTURE) +# io - needed by JSON support +CIRCUITPY_IO ?= $(CIRCUITPY_JSON) +CFLAGS += -DCIRCUITPY_IO=$(CIRCUITPY_IO) + CIRCUITPY_IPADDRESS ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_IPADDRESS=$(CIRCUITPY_IPADDRESS) @@ -293,6 +301,12 @@ CFLAGS += -DCIRCUITPY_NVM=$(CIRCUITPY_NVM) CIRCUITPY_ONEWIREIO ?= $(CIRCUITPY_BUSIO) CFLAGS += -DCIRCUITPY_ONEWIREIO=$(CIRCUITPY_ONEWIREIO) +CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH ?= 1 +CFLAGS += -DCIRCUITPY_OPT_LOAD_ATTR_FAST_PATH=$(CIRCUITPY_OPT_LOAD_ATTR_FAST_PATH) + +CIRCUITPY_OPT_MAP_LOOKUP_CACHE ?= $(CIRCUITPY_FULL_BUILD) +CFLAGS += -DCIRCUITPY_OPT_MAP_LOOKUP_CACHE=$(CIRCUITPY_OPT_MAP_LOOKUP_CACHE) + CIRCUITPY_OS ?= 1 CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) @@ -374,7 +388,6 @@ CFLAGS += -DCIRCUITPY_SOCKETPOOL=$(CIRCUITPY_SOCKETPOOL) CIRCUITPY_SSL ?= $(CIRCUITPY_WIFI) CFLAGS += -DCIRCUITPY_SSL=$(CIRCUITPY_SSL) -# Currently always off. CIRCUITPY_STAGE ?= 0 CFLAGS += -DCIRCUITPY_STAGE=$(CIRCUITPY_STAGE) @@ -393,6 +406,9 @@ CFLAGS += -DCIRCUITPY_SUPERVISOR=$(CIRCUITPY_SUPERVISOR) CIRCUITPY_SYNTHIO ?= $(CIRCUITPY_AUDIOCORE) CFLAGS += -DCIRCUITPY_SYNTHIO=$(CIRCUITPY_SYNTHIO) +CIRCUITPY_SYS ?= 1 +CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS) + CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 5bacc74073..0ca0e09023 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -117,7 +117,7 @@ MP_PROPERTY_GETTER(analogio_analogin_value_obj, //| reference_voltage: float //| """The maximum voltage measurable (also known as the reference voltage) as a -//| `float` in Volts. Note the ADC value may not scale to the actual voltage linearly +//| ``float`` in Volts. Note the ADC value may not scale to the actual voltage linearly //| at ends of the analog range.""" //| STATIC mp_obj_t analogio_analogin_obj_get_reference_voltage(mp_obj_t self_in) { diff --git a/shared-bindings/support_matrix.rst b/shared-bindings/support_matrix.rst index c54bfa94e1..3d5e544ea0 100644 --- a/shared-bindings/support_matrix.rst +++ b/shared-bindings/support_matrix.rst @@ -6,6 +6,11 @@ Module Support Matrix - Which Modules Are Available on Which Boards The following table lists the available built-in modules for each CircuitPython capable board, as well as each :term:`frozen module` included on it. +You can filter this list by typing one or more module names or partial names into the search box. +Only those boards that provide those modules will be listed. +To exclude boards that provide a module, type a "-" in front of the module name. +You can also type a regular expression as a filter. + .. raw:: html

(all)

From e064500411af38fa65c95dfc440ae084851669d3 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Tue, 4 Oct 2022 07:26:38 +0000 Subject: [PATCH 8/8] Translated using Weblate (Greek) Currently translated at 18.5% (185 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/el/ --- locale/el.po | 210 +++++++++++++++++++++++++++------------------------ 1 file changed, 110 insertions(+), 100 deletions(-) diff --git a/locale/el.po b/locale/el.po index d6f5f7949e..e686dd9bfc 100644 --- a/locale/el.po +++ b/locale/el.po @@ -8,7 +8,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-10-03 13:20+0000\n" +"PO-Revision-Date: 2022-10-05 12:23+0000\n" "Last-Translator: Bill Sideris \n" "Language-Team: none\n" "Language: el\n" @@ -298,43 +298,43 @@ msgstr "'%s' περιμένει {r0, r1, ...}" #: py/emitinlinextensa.c #, c-format msgid "'%s' integer %d isn't within range %d..%d" -msgstr "" +msgstr "'%s' ακέραιος %d δεν είναι μέσα στο επιτρεπτό εύρος %d..%d" #: py/emitinlinethumb.c #, c-format msgid "'%s' integer 0x%x doesn't fit in mask 0x%x" -msgstr "" +msgstr "'%s' ακέραιος 0x%x δεν χωράει στην μάσκα 0x%x" #: py/obj.c #, c-format msgid "'%s' object doesn't support item assignment" -msgstr "" +msgstr "'%s' αντικείμενο δεν υποστηρίζει ορισμό πράγματος" #: py/obj.c #, c-format msgid "'%s' object doesn't support item deletion" -msgstr "" +msgstr "'%s' αντικείμενο δεν υποστηρίζει διαγραφή πράγματος" #: ports/raspberrypi/common-hal/wifi/Radio.c py/runtime.c msgid "'%s' object has no attribute '%q'" -msgstr "" +msgstr "'%s' αντικείμενο δεν έχει γνώρισμα '%q'" #: py/obj.c #, c-format msgid "'%s' object isn't subscriptable" -msgstr "" +msgstr "'%s' αντικείμενο δεν είναι subscriptable" #: py/objstr.c msgid "'=' alignment not allowed in string format specifier" -msgstr "" +msgstr "Ευθυγράμμιση του '=' δεν επιτρέπεται εντός προσδιοριστή string format" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" -msgstr "" +msgstr "'S' και 'O' δεν είναι υποστηριζόμενοι τύποι format" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "" +msgstr "'align' απαιτεί τουλάχιστον ένα όρισμα" #: py/compile.c msgid "'await' outside function" @@ -342,11 +342,11 @@ msgstr "'await' εκτός συνάρτησης" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "" +msgstr "'await', 'async for' ή 'async with' εκτός ασύνχρονης συνάρτησης" #: py/compile.c msgid "'break' outside loop" -msgstr "" +msgstr "'break' εκτός επανάληψης" #: py/compile.c msgid "'continue' outside loop" @@ -362,27 +362,27 @@ msgstr "'data' απαιτεί τουλάχιστον 2 παραμέτρους" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "" +msgstr "'data' απαιτεί ακέραιες παραμέτρους" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "" +msgstr "'label' απαιτεί ένα όρισμα" #: py/compile.c msgid "'return' outside function" -msgstr "" +msgstr "'return' εκτός συνάρτησης" #: py/compile.c msgid "'yield from' inside async function" -msgstr "" +msgstr "'yield from' εκτός ασύνχρονης συνάρτησης" #: py/compile.c msgid "'yield' outside function" -msgstr "" +msgstr "'yield' εκτός συνάρτησης" #: py/compile.c msgid "*x must be assignment target" -msgstr "" +msgstr "*x πρέπει να είναι στόχος ανάθεσης" #: py/obj.c msgid ", in %q\n" @@ -397,8 +397,9 @@ msgid "3-arg pow() not supported" msgstr "pow() με 3 παραμέτρους δεν υποστηρίζεται" #: shared-module/msgpack/__init__.c +#, fuzzy msgid "64 bit types" -msgstr "" +msgstr "64 bit τύποι" #: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/atmel-samd/common-hal/countio/Counter.c @@ -467,7 +468,7 @@ msgstr "Όλα τα κανάλια συμβάντων συγχρονισμού #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" -msgstr "" +msgstr "Όλοι οι χρονιστές για αυτό το pin χρησιμοποιούνται ήδη" #: ports/atmel-samd/common-hal/_pew/PewPew.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -484,68 +485,68 @@ msgstr "" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c #: ports/stm/peripherals/timers.c shared-bindings/pwmio/PWMOut.c msgid "All timers in use" -msgstr "" +msgstr "Όλοι οι χρονιστές βρίσκονται σε χρήση" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "" +msgstr "Ήδη διαφημίζουμε." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" -msgstr "" +msgstr "Ύπάρχει ήδη all-matches ακροατής" #: shared-module/memorymonitor/AllocationAlarm.c #: shared-module/memorymonitor/AllocationSize.c msgid "Already running" -msgstr "" +msgstr "Τρέχει ήδη" #: ports/espressif/common-hal/wifi/Radio.c #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Already scanning for wifi networks" -msgstr "" +msgstr "Ήδη γίνεται σάρωση για δίκτυα wifi" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" -msgstr "" +msgstr "Και άλλο PWMAudioOut είναι σε χρήση" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c msgid "Another send is already active" -msgstr "" +msgstr "Άλλη αποστολή είναι ήδη ενεργή" #: shared-bindings/pulseio/PulseOut.c msgid "Array must contain halfwords (type 'H')" -msgstr "" +msgstr "H παράταξη πρέπει να περιέχει halfwords (τύπου 'H')" #: shared-bindings/alarm/SleepMemory.c shared-bindings/nvm/ByteArray.c msgid "Array values should be single bytes." -msgstr "" +msgstr "Η τιμές της παράταξη πρέπει να είναι μονά bytes." #: shared-bindings/microcontroller/Pin.c msgid "At most %d %q may be specified (not %d)" -msgstr "" +msgstr "Το πολύ %d %q μπορεί να είναι καθορισμένα (όχι %d)" #: shared-module/memorymonitor/AllocationAlarm.c #, c-format msgid "Attempt to allocate %d blocks" -msgstr "" +msgstr "Προσπάθεια να δεσμευτούν %d blocks" #: supervisor/shared/safe_mode.c msgid "Attempted heap allocation when VM not running." -msgstr "" +msgstr "Προσπάθεια δέσμευσης heap όταν το VM δεν τρέχει." #: ports/raspberrypi/audio_dma.c msgid "Audio conversion not implemented" -msgstr "" +msgstr "Η μετατροπή ήχου δεν υποστηρίζεται" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" -msgstr "" +msgstr "AuthMode.OPEN δεν μπορεί να χρησιμοποιηθεί με κωδικό" #: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" -msgstr "" +msgstr "Αποτυχία αυθεντικοποίησης" #: main.c msgid "Auto-reload is off.\n" @@ -561,93 +562,93 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" +msgstr "Baudrate δεν υποστηρίζεται από την περιφεριακή συσκευή" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c msgid "Below minimum frame rate" -msgstr "" +msgstr "Χαμηλότερο από το ελάχιστο frame rate" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "" +msgstr "Ρολόι bit και word select πρέπει να είναι διαδοχικά pins" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" -msgstr "" +msgstr "Ρολόι bit και word select πρέπει να μοιράζονται μια μονάδα ρολογιού" #: shared-bindings/audiobusio/PDMIn.c msgid "Bit depth must be multiple of 8." -msgstr "" +msgstr "Βάθος bit πρέπει να είναι πολλαπλάσιο του 8." #: shared-bindings/bitmaptools/__init__.c msgid "Bitmap size and bits per value must match" -msgstr "" +msgstr "Το μέγεθος του bitmap και τα bits ανα τιμή πρέπει να ταιριάζουν" #: supervisor/shared/safe_mode.c msgid "Boot device must be first device (interface #0)." -msgstr "" +msgstr "Η συσκευή boot πρέπει να είναι η πρώτη συσκευή (interface #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" -msgstr "" +msgstr "Και RX και TX απαιτούνται για έλεγχο flow" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" -msgstr "" +msgstr "Και τα δύο pin πρέπει να υποστηρίζουν interrupts υλικού" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/is31fl3741/FrameBuffer.c #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "Brightness must be 0-1.0" -msgstr "" +msgstr "Η φωτινότητα πρέπει να είναι μεταξύ 0-1.0" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" -msgstr "" +msgstr "H φωτεινότητα δεν μπορεί να προσαρμοστεί" #: shared-bindings/_bleio/UUID.c #, c-format msgid "Buffer + offset too small %d %d %d" -msgstr "" +msgstr "Buffer + offset είναι πολύ μικρά %d %d %d" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Buffer elements must be 4 bytes long or less" -msgstr "" +msgstr "Στοιχεία του buffer πρέπει να είναι το πολύ 4 bytes" #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "" +msgstr "Το buffer δεν είναι ένα bytearray." #: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is too small" -msgstr "" +msgstr "Πολύ μικρό buffer" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" -msgstr "" +msgstr "Το μήκος buffer %d είναι πολύ μεγάλο. Πρέπει ν α είναι λιγότερο απο %d" #: ports/atmel-samd/common-hal/sdioio/SDCard.c #: ports/cxd56/common-hal/sdioio/SDCard.c shared-module/sdcardio/SDCard.c msgid "Buffer length must be a multiple of 512" -msgstr "" +msgstr "Το μήκος buffer πρέπει να είναι πολλαπλάσιο του 512" #: ports/stm/common-hal/sdioio/SDCard.c shared-bindings/floppyio/__init__.c msgid "Buffer must be a multiple of 512 bytes" -msgstr "" +msgstr "Buffer πρέπει να είναι πολλαπλάσιο των 512 bytes" #: shared-bindings/_bleio/PacketBuffer.c #, c-format msgid "Buffer too short by %d bytes" -msgstr "" +msgstr "Buffer πολύ μικρό κατα %d bytes" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" -msgstr "" +msgstr "Τα Buffers πρέπει να είναι του ιδίου μεγέθους" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -655,218 +656,227 @@ msgstr "" #: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" -msgstr "" +msgstr "Bus pin %d είναι ήδη σε χρήση" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." -msgstr "" +msgstr "Byte buffer πρέπει να είναι 16 bytes." #: shared-bindings/aesio/aes.c msgid "CBC blocks must be multiples of 16 bytes" -msgstr "" +msgstr "CBC blocks πρέπει να είναι πολλαπλάσια του 16 bytes" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "" +msgstr "Ο CIRCUITPY δίσκος δεν μπόρεσε να βρεθεί ή να δημιουργηθεί." #: ports/espressif/common-hal/espidf/__init__.c ports/espressif/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ή checksum ήταν άκυρο" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "" +msgstr "Κλήση super().__init__() πρίν την πρόσβαση του τοπικού αντικειμένου." #: ports/cxd56/common-hal/camera/Camera.c msgid "Camera init" -msgstr "" +msgstr "Εκκίνηση κάμερας" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "" +msgstr "Μόνο IO alarm ή RTC επιτρέπονται από βαθύ ύπνο." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" +"Μόνο ένα alarm από low pin ενώ τα άλλα alarm θα είναι απο high σε βαθύ ύπνο." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "" +msgstr "Μπορεί να γίνει alarm μόνο σε δύο low pins σε βαθύ ύπνο." #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "" +msgstr "Δεν μπορεί να οριστεί CCCD σε τοπικό Characteristic" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c msgid "Cannot change USB devices now" -msgstr "" +msgstr "Δεν μπορούν να αλλάξουν οι USB συσκευές τώρα" #: shared-bindings/_bleio/Adapter.c msgid "Cannot create a new Adapter; use _bleio.adapter;" -msgstr "" +msgstr "Δεν μπορεί να δημιουργηθεί νέο Adapter; χρησιμοποιείστε _bleio.adapter;" #: shared-bindings/displayio/Bitmap.c #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Cannot delete values" -msgstr "" +msgstr "Δεν μπορούν να διαγραφούν οι τιμές" #: ports/atmel-samd/common-hal/digitalio/DigitalInOut.c #: ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c #: ports/nrf/common-hal/digitalio/DigitalInOut.c #: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "" +msgstr "Δεν γίνεται να διαβαστεί το pull όσο είναι σε output mode" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" -msgstr "" +msgstr "Δεν μπορεί να διαβαστεί η θερμοκρασία" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" +"Δεν μπορούμε να έχουμε απαντήσεις scan για εκτεταμένες, συνδεόμενες " +"διαφημήσεις." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" +msgstr "Δεν γίνεται pull σε pin μόνο για εισόδο." #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" -msgstr "" +msgstr "Δεν μπορεί να γίνει καταγραφή σε αρχείο" #: shared-module/storage/__init__.c msgid "Cannot remount '/' when visible via USB." -msgstr "" +msgstr "Δεν μπορεί να γίνει remount του '/' όταν είναι ορατό μέσω USB." #: ports/atmel-samd/common-hal/microcontroller/__init__.c #: ports/cxd56/common-hal/microcontroller/__init__.c #: ports/mimxrt10xx/common-hal/microcontroller/__init__.c msgid "Cannot reset into bootloader because no bootloader is present" msgstr "" +"Δεν μπορεί να γίνει επανεκκίνηση στον bootloader διότι δεν υπάρχει " +"bootloader παρόν" #: ports/espressif/common-hal/socketpool/Socket.c msgid "Cannot set socket options" -msgstr "" +msgstr "Δεν μπορεί να γίνει ρύθμιση των επιλογών του socket" #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "" +msgstr "Δεν μπορεί να οριστεί τιμή οταν η κατεύθυνση είναι input." #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Cannot specify RTS or CTS in RS485 mode" -msgstr "" +msgstr "Δεν μπορεί να οριστεί RTS ή CTS σε RS485 mode" #: py/objslice.c msgid "Cannot subclass slice" -msgstr "" +msgstr "Δεν γίνεται υποκατηγορία ενός slice" #: shared-module/bitbangio/SPI.c msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" +msgstr "Δεν μπορεί να γίνει μεταφορά χωρίς MOSI και MISO pins" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" +"Δεν μπορεί να γίνει δυναμική μεταβολή της συχνότητας σε έναν χρονιστή που " +"είναι ήδη σε χρήση" #: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge, only level" -msgstr "" +msgstr "Δεν γίνεται αφύπνηση σε pin edge, αλλά μόνο σε level" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "" +msgstr "Δεν μπορεί να γίνει αφύπνηση σε pin edge. Μόνο level." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "" +msgstr "Δεν υποστηρίζονται εγγραφές στο CharacteristicBuffer" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "" +msgstr "Ο πυρήνας της CircuitPython κατέρευσε. Οουπς!\n" #: supervisor/shared/safe_mode.c msgid "CircuitPython was unable to allocate the heap." -msgstr "" +msgstr "Η CircuitPython δεν μπορέσε να δεσμεύσει το heap." #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" -msgstr "" +msgstr "Stretch ρολογιού πολύ μεγάλο" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Clock unit in use" -msgstr "" +msgstr "Μονάδα ρολογιού ήδη σε χρήση" #: shared-bindings/_bleio/Connection.c msgid "" "Connection has been disconnected and can no longer be used. Create a new " "connection." msgstr "" +"Έχει γίνει αποσύνδεση και αυτή η συνδεση δεν μπορεί να χρησιμοποιηθεί. " +"Δημιουργήστε μια νέα σύνδεση." #: py/persistentcode.c msgid "Corrupt .mpy file" -msgstr "" +msgstr "Κατεστραμένο .mpy αρχείο" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" -msgstr "" +msgstr "Δεν μπόρεσε να ανακληθεί το ρολόι" #: shared-bindings/_bleio/Adapter.c msgid "Could not set address" -msgstr "" +msgstr "Δεν μπόρεσε να ρυθμιστεί η διεύθυνση" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "" +msgstr "Δεν μπόρεσε να ξεκινήσει το PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" -msgstr "" +msgstr "Δεν μπόρεσε να εκκινηθεί το interrupt, RX κατειλημμένο" #: shared-module/audiomp3/MP3Decoder.c msgid "Couldn't allocate decoder" -msgstr "" +msgstr "Δεν μπόρεσε να δεσμευτεί decoder" #: supervisor/shared/safe_mode.c msgid "Crash into the HardFault_Handler." -msgstr "" +msgstr "Κατέρευσε μέσα στο HardFault_Handler." #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "" +msgstr "Σφάλμα εκκίνησης καναλιού DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "" +msgstr "Σφάλμα εκκίνησης συσκευής DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" -msgstr "" +msgstr "DAC είναι ήδη σε χρήση" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/nrf/common-hal/paralleldisplay/ParallelBus.c msgid "Data 0 pin must be byte aligned" -msgstr "" +msgstr "Το Data 0 pin πρέπει να είναι byte aligned" #: shared-module/audiocore/WaveFile.c msgid "Data chunk must follow fmt chunk" -msgstr "" +msgstr "Το data chunk πρέπει να ακολουθεί το fmt chunk" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data not supported with directed advertising" -msgstr "" +msgstr "Δεν υποστηρίζονται δεδομένα με κατευθυνόμενη διαφήμιση" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Data too large for advertisement packet" -msgstr "" +msgstr "Τα δεδομένα είναι πολύ μεγάλα για πακέτο διαφημίσεων" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Deep sleep pins must use a rising edge with pulldown" -msgstr "" +msgstr "Τα pins βαθύ ύπνου πρέπει να χρησιμοποιούν rising edge με pulldown" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length."