Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 54 additions & 3 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-04 21:18+0530\n"
"POT-Creation-Date: 2020-11-11 16:58-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -108,6 +108,11 @@ msgstr ""
msgid "%q() takes %d positional arguments but %d were given"
msgstr ""

#: ports/esp32s2/esp_error.c
#, c-format
msgid "%s error 0x%x"
msgstr ""

#: py/argcheck.c
msgid "'%q' argument required"
msgstr ""
Expand Down Expand Up @@ -296,7 +301,8 @@ msgstr ""
msgid "All I2C peripherals are in use"
msgstr ""

#: ports/esp32s2/peripherals/pcnt_handler.c
#: ports/esp32s2/common-hal/countio/Counter.c
#: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c
msgid "All PCNT units in use"
msgstr ""

Expand Down Expand Up @@ -521,6 +527,10 @@ msgstr ""
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

#: py/objtype.c
msgid "Call super().__init__() before accessing native object."
msgstr ""
Expand Down Expand Up @@ -941,6 +951,10 @@ msgstr ""
msgid "Function requires lock"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Generic Failure"
msgstr ""

#: shared-bindings/displayio/Display.c
#: shared-bindings/displayio/EPaperDisplay.c
#: shared-bindings/framebufferio/FramebufferDisplay.c
Expand Down Expand Up @@ -1055,7 +1069,7 @@ msgstr ""
msgid "Invalid PWM frequency"
msgstr ""

#: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c
#: ports/esp32s2/esp_error.c py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c
msgid "Invalid argument"
msgstr ""

Expand Down Expand Up @@ -1162,6 +1176,14 @@ msgstr ""
msgid "Invalid security_mode"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Invalid size"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Invalid state"
msgstr ""

#: shared-bindings/audiomixer/Mixer.c
msgid "Invalid voice"
msgstr ""
Expand Down Expand Up @@ -1202,6 +1224,10 @@ msgstr ""
msgid "Length must be non-negative"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "MAC address was invalid"
msgstr ""

#: shared-module/bitbangio/SPI.c
msgid "MISO pin init failed."
msgstr ""
Expand Down Expand Up @@ -1427,6 +1453,18 @@ msgstr ""
msgid "Only raw int supported for ip"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Operation or feature not supported"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Operation timed out"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Out of memory"
msgstr ""

#: ports/esp32s2/common-hal/socketpool/SocketPool.c
msgid "Out of sockets"
msgstr ""
Expand Down Expand Up @@ -1563,6 +1601,10 @@ msgstr ""
msgid "Read-only object"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Received response was invalid"
msgstr ""

#: shared-bindings/displayio/EPaperDisplay.c
msgid "Refresh too soon"
msgstr ""
Expand All @@ -1575,6 +1617,10 @@ msgstr ""
msgid "Requested AES mode is unsupported"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Requested resource not found"
msgstr ""

#: ports/atmel-samd/common-hal/audioio/AudioOut.c
msgid "Right channel unsupported"
msgstr ""
Expand Down Expand Up @@ -1929,6 +1975,10 @@ msgstr ""
msgid "Value length > max_length"
msgstr ""

#: ports/esp32s2/esp_error.c
msgid "Version was invalid"
msgstr ""

#: py/emitnative.c
msgid "Viper functions don't currently support more than 4 arguments"
msgstr ""
Expand Down Expand Up @@ -3201,6 +3251,7 @@ msgstr ""
msgid "pow() with 3 arguments requires integers"
msgstr ""

#: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h
#: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h
#: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h
#: ports/esp32s2/boards/espressif_kaluga_1/mpconfigboard.h
Expand Down
1 change: 1 addition & 0 deletions ports/esp32s2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD

SRC_C += \
background.c \
esp_error.c \
fatfs_port.c \
mphalport.c \
bindings/espidf/__init__.c \
Expand Down
87 changes: 87 additions & 0 deletions ports/esp32s2/esp_error.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Jeff Epler 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 "esp_error.h"
#include "py/runtime.h"

void raise_esp_error(esp_err_t err) {
const compressed_string_t *msg = NULL;
switch(err) {
case ESP_FAIL:
msg = translate("Generic Failure");
break;
case ESP_ERR_NO_MEM:
msg = translate("Out of memory");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

break;
case ESP_ERR_INVALID_ARG:
msg = translate("Invalid argument");
break;
case ESP_ERR_INVALID_STATE:
msg = translate("Invalid state");
break;
case ESP_ERR_INVALID_SIZE:
msg = translate("Invalid size");
break;
case ESP_ERR_NOT_FOUND:
msg = translate("Requested resource not found");
break;
case ESP_ERR_NOT_SUPPORTED:
msg = translate("Operation or feature not supported");
break;
case ESP_ERR_TIMEOUT:
msg = translate("Operation timed out");
break;
case ESP_ERR_INVALID_RESPONSE:
msg = translate("Received response was invalid");
break;
case ESP_ERR_INVALID_CRC:
msg = translate("CRC or checksum was invalid");
break;
case ESP_ERR_INVALID_VERSION:
msg = translate("Version was invalid");
break;
case ESP_ERR_INVALID_MAC:
msg = translate("MAC address was invalid");
break;
}
if (msg) {
mp_raise_msg(&mp_type_OSError, msg);
}

const char *group = "ESP-IDF";

// tests must be in descending order
MP_STATIC_ASSERT( ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE );
MP_STATIC_ASSERT( ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE );
if(err >= ESP_ERR_FLASH_BASE) {
group = "Flash";
} else if (err >= ESP_ERR_MESH_BASE) {
group = "Mesh";
} else if (err >= ESP_ERR_WIFI_BASE) {
group = "WiFi";
}
mp_raise_msg_varg(&mp_type_OSError, translate("%s error 0x%x"), group, err);
}
32 changes: 32 additions & 0 deletions ports/esp32s2/esp_error.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2020 Jeff Epler 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 "esp_err.h"
#include "py/mpconfig.h"

void raise_esp_error(esp_err_t err) NORETURN;
#define ESP_CALL_RAISE(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0)