Merge branch 'main' of https://github.com/adafruit/circuitpython into add-translation-for-builtin-object-help

* 'main' of https://github.com/adafruit/circuitpython:
  Revert "UMFEATHERS2 - implement use of DotStar for status led"
  fix doc build
  Update to 1.7.1
  Set year from execution date
  Hard code new copyright date
  Update translations
  ulab: update to 1.7.0
  Rename to match WIFI_REASON. Also include specific error code in "Unknown failure" Exception.
  Include all reason codes.
  Rename to match WIFI_REASON. Also return specific reason code.
  Retry on all disconnect reasons other than: 2 exception reasons & 1 manual disconnect reason.
This commit is contained in:
Hugo Dahl 2021-01-19 05:48:17 -06:00
commit 7076da3040
No known key found for this signature in database
GPG Key ID: 9024D7D65BF2F2CF
11 changed files with 67 additions and 70 deletions

View File

@ -23,6 +23,7 @@ import re
import subprocess
import sys
import urllib.parse
import time
import recommonmark
from sphinx.transforms import SphinxTransform
@ -101,9 +102,12 @@ redirects_file = 'docs/redirects.txt'
# The master toctree document.
#master_doc = 'index'
# Get current date (execution) for copyright year
current_date = time.localtime()
# General information about the project.
project = 'Adafruit CircuitPython'
copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
copyright = f'2014-{current_date.tm_year}, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
# These are overwritten on ReadTheDocs.
# The version info for the project you're documenting, acts as replacement for

@ -1 +1 @@
Subproject commit d62d07ea0b9597535428ebe6012da6b0d6608bf9
Subproject commit 8b804f3bcd8c5a3ac1b3e09e0ff7faf8270751de

View File

@ -2017,7 +2017,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d"
msgstr ""
#: shared-bindings/wifi/Radio.c
msgid "Unknown failure"
#, c-format
msgid "Unknown failure %d"
msgstr ""
#: ports/nrf/common-hal/_bleio/__init__.c
@ -2282,10 +2283,18 @@ msgstr ""
msgid "branch not in range"
msgstr ""
#: extmod/ulab/code/ulab_create.c
msgid "buffer is smaller than requested size"
msgstr ""
#: shared-bindings/audiocore/RawSample.c
msgid "buffer must be a bytes-like object"
msgstr ""
#: extmod/ulab/code/ulab_create.c
msgid "buffer size must be a multiple of element size"
msgstr ""
#: shared-module/struct/__init__.c
msgid "buffer size must match format"
msgstr ""
@ -3347,6 +3356,10 @@ msgstr ""
msgid "offset must be >= 0"
msgstr ""
#: extmod/ulab/code/ulab_create.c
msgid "offset must be non-negative and no greater than buffer length"
msgstr ""
#: py/objstr.c py/objstrunicode.c
msgid "offset out of bounds"
msgstr ""

View File

@ -27,8 +27,6 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/include/driver/gpio.h"
#include "components/soc/include/hal/gpio_hal.h"
void board_init(void) {
// USB
@ -49,12 +47,6 @@ void board_init(void) {
common_hal_never_reset_pin(&pin_GPIO30);
common_hal_never_reset_pin(&pin_GPIO31);
common_hal_never_reset_pin(&pin_GPIO32);
// Add LDO2 to never reset list, set to output and enable
common_hal_never_reset_pin(&pin_GPIO21);
gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(pin_GPIO21.number, true);
}
bool board_requests_safe_mode(void) {

View File

@ -34,8 +34,8 @@
#define AUTORESET_DELAY_MS 500
#define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
#define MICROPY_HW_APA102_SCK (&pin_GPIO45)
// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
// #define MICROPY_HW_APA102_SCK (&pin_GPIO45)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)

View File

@ -37,14 +37,13 @@
#ifdef MICROPY_HW_NEOPIXEL
bool neopixel_in_use;
#endif
#ifdef MICROPY_HW_APA102_MOSI
bool apa102_sck_in_use;
bool apa102_mosi_in_use;
#endif
STATIC uint32_t never_reset_pins[2];
STATIC uint32_t in_use[2];
bool apa102_mosi_in_use;
bool apa102_sck_in_use;
STATIC void floating_gpio_reset(gpio_num_t pin_number) {
// This is the same as gpio_reset_pin(), but without the pullup.
// Note that gpio_config resets the iomatrix to GPIO_FUNC as well.
@ -87,20 +86,6 @@ void reset_pin_number(gpio_num_t pin_number) {
return;
}
#endif
#ifdef MICROPY_HW_APA102_MOSI
if (pin_number == MICROPY_HW_APA102_MOSI->number ||
pin_number == MICROPY_HW_APA102_SCK->number) {
apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number;
apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number;
if (!apa102_sck_in_use && !apa102_mosi_in_use) {
rgb_led_status_init();
}
return;
}
#endif
}
void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
@ -125,11 +110,6 @@ void reset_all_pins(void) {
#ifdef MICROPY_HW_NEOPIXEL
neopixel_in_use = false;
#endif
#ifdef MICROPY_HW_APA102_MOSI
apa102_sck_in_use = false;
apa102_mosi_in_use = false;
#endif
}
void claim_pin(const mcu_pin_obj_t* pin) {
@ -139,15 +119,6 @@ void claim_pin(const mcu_pin_obj_t* pin) {
neopixel_in_use = true;
}
#endif
#ifdef MICROPY_HW_APA102_MOSI
if (pin == MICROPY_HW_APA102_MOSI) {
apa102_mosi_in_use = true;
}
if (pin == MICROPY_HW_APA102_SCK) {
apa102_sck_in_use = true;
}
#endif
}
void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) {
@ -160,18 +131,10 @@ bool pin_number_is_free(gpio_num_t pin_number) {
return !neopixel_in_use;
}
#endif
#ifdef MICROPY_HW_APA102_MOSI
if (pin_number == MICROPY_HW_APA102_MOSI->number) {
return !apa102_mosi_in_use;
}
if (pin_number == MICROPY_HW_APA102_SCK->number) {
return !apa102_sck_in_use;
}
#endif
uint8_t offset = pin_number / 32;
uint32_t mask = 1 << (pin_number % 32);
return (in_use[offset] & mask) == 0;
return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0;
}
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {

View File

@ -31,10 +31,8 @@
#include "peripherals/pins.h"
#ifdef MICROPY_HW_APA102_MOSI
extern bool apa102_sck_in_use;
extern bool apa102_mosi_in_use;
#endif
extern bool apa102_sck_in_use;
#ifdef MICROPY_HW_NEOPIXEL
extern bool neopixel_in_use;

View File

@ -168,11 +168,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
} while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted());
if ((bits & WIFI_DISCONNECTED_BIT) != 0) {
if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) {
return WIFI_RADIO_ERROR_AUTH;
return WIFI_RADIO_ERROR_AUTH_FAIL;
} else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) {
return WIFI_RADIO_ERROR_NO_AP_FOUND;
}
return WIFI_RADIO_ERROR_UNKNOWN;
return self->last_disconnect_reason;
}
return WIFI_RADIO_ERROR_NONE;
}

View File

@ -65,11 +65,9 @@ static void event_handler(void* arg, esp_event_base_t event_base,
uint8_t reason = d->reason;
ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason);
if (radio->retries_left > 0 &&
(reason == WIFI_REASON_AUTH_EXPIRE ||
reason == WIFI_REASON_NOT_AUTHED ||
reason == WIFI_REASON_ASSOC_EXPIRE ||
reason == WIFI_REASON_CONNECTION_FAIL ||
reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) {
reason != WIFI_REASON_AUTH_FAIL &&
reason != WIFI_REASON_NO_AP_FOUND &&
reason != WIFI_REASON_ASSOC_LEAVE) {
radio->retries_left--;
ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left);
esp_wifi_connect();

View File

@ -218,12 +218,12 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m
}
wifi_radio_error_t error = common_hal_wifi_radio_connect(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, timeout, bssid.buf, bssid.len);
if (error == WIFI_RADIO_ERROR_AUTH) {
if (error == WIFI_RADIO_ERROR_AUTH_FAIL) {
mp_raise_ConnectionError(translate("Authentication failure"));
} else if (error == WIFI_RADIO_ERROR_NO_AP_FOUND) {
mp_raise_ConnectionError(translate("No network with that ssid"));
} else if (error != WIFI_RADIO_ERROR_NONE) {
mp_raise_ConnectionError(translate("Unknown failure"));
mp_raise_msg_varg(&mp_type_ConnectionError, translate("Unknown failure %d"), error);
}
return mp_const_none;

View File

@ -36,10 +36,39 @@
const mp_obj_type_t wifi_radio_type;
typedef enum {
WIFI_RADIO_ERROR_NONE,
WIFI_RADIO_ERROR_UNKNOWN,
WIFI_RADIO_ERROR_AUTH,
WIFI_RADIO_ERROR_NO_AP_FOUND
// 0 is circuitpython-specific; 1-53 are IEEE; 200+ are Espressif
WIFI_RADIO_ERROR_NONE = 0,
WIFI_RADIO_ERROR_UNSPECIFIED = 1,
WIFI_RADIO_ERROR_AUTH_EXPIRE = 2,
WIFI_RADIO_ERROR_AUTH_LEAVE = 3,
WIFI_RADIO_ERROR_ASSOC_EXPIRE = 4,
WIFI_RADIO_ERROR_ASSOC_TOOMANY = 5,
WIFI_RADIO_ERROR_NOT_AUTHED = 6,
WIFI_RADIO_ERROR_NOT_ASSOCED = 7,
WIFI_RADIO_ERROR_ASSOC_LEAVE = 8,
WIFI_RADIO_ERROR_ASSOC_NOT_AUTHED = 9,
WIFI_RADIO_ERROR_DISASSOC_PWRCAP_BAD = 10,
WIFI_RADIO_ERROR_DISASSOC_SUPCHAN_BAD = 11,
WIFI_RADIO_ERROR_IE_INVALID = 13,
WIFI_RADIO_ERROR_MIC_FAILURE = 14,
WIFI_RADIO_ERROR_4WAY_HANDSHAKE_TIMEOUT = 15,
WIFI_RADIO_ERROR_GROUP_KEY_UPDATE_TIMEOUT = 16,
WIFI_RADIO_ERROR_IE_IN_4WAY_DIFFERS = 17,
WIFI_RADIO_ERROR_GROUP_CIPHER_INVALID = 18,
WIFI_RADIO_ERROR_PAIRWISE_CIPHER_INVALID = 19,
WIFI_RADIO_ERROR_AKMP_INVALID = 20,
WIFI_RADIO_ERROR_UNSUPP_RSN_IE_VERSION = 21,
WIFI_RADIO_ERROR_INVALID_RSN_IE_CAP = 22,
WIFI_RADIO_ERROR_802_1X_AUTH_FAILED = 23,
WIFI_RADIO_ERROR_CIPHER_SUITE_REJECTED = 24,
WIFI_RADIO_ERROR_INVALID_PMKID = 53,
WIFI_RADIO_ERROR_BEACON_TIMEOUT = 200,
WIFI_RADIO_ERROR_NO_AP_FOUND = 201,
WIFI_RADIO_ERROR_AUTH_FAIL = 202,
WIFI_RADIO_ERROR_ASSOC_FAIL = 203,
WIFI_RADIO_ERROR_HANDSHAKE_TIMEOUT = 204,
WIFI_RADIO_ERROR_CONNECTION_FAIL = 205,
WIFI_RADIO_ERROR_AP_TSF_RESET = 206,
} wifi_radio_error_t;
extern bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self);