Skip to content

Commit 7076da3

Browse files
committed
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.
2 parents 8094435 + 6a76b60 commit 7076da3

File tree

11 files changed

+67
-70
lines changed

11 files changed

+67
-70
lines changed

conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import subprocess
2424
import sys
2525
import urllib.parse
26+
import time
2627

2728
import recommonmark
2829
from sphinx.transforms import SphinxTransform
@@ -101,9 +102,12 @@
101102
# The master toctree document.
102103
#master_doc = 'index'
103104

105+
# Get current date (execution) for copyright year
106+
current_date = time.localtime()
107+
104108
# General information about the project.
105109
project = 'Adafruit CircuitPython'
106-
copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
110+
copyright = f'2014-{current_date.tm_year}, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)'
107111

108112
# These are overwritten on ReadTheDocs.
109113
# The version info for the project you're documenting, acts as replacement for

locale/circuitpython.pot

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d"
20172017
msgstr ""
20182018

20192019
#: shared-bindings/wifi/Radio.c
2020-
msgid "Unknown failure"
2020+
#, c-format
2021+
msgid "Unknown failure %d"
20212022
msgstr ""
20222023

20232024
#: ports/nrf/common-hal/_bleio/__init__.c
@@ -2282,10 +2283,18 @@ msgstr ""
22822283
msgid "branch not in range"
22832284
msgstr ""
22842285

2286+
#: extmod/ulab/code/ulab_create.c
2287+
msgid "buffer is smaller than requested size"
2288+
msgstr ""
2289+
22852290
#: shared-bindings/audiocore/RawSample.c
22862291
msgid "buffer must be a bytes-like object"
22872292
msgstr ""
22882293

2294+
#: extmod/ulab/code/ulab_create.c
2295+
msgid "buffer size must be a multiple of element size"
2296+
msgstr ""
2297+
22892298
#: shared-module/struct/__init__.c
22902299
msgid "buffer size must match format"
22912300
msgstr ""
@@ -3347,6 +3356,10 @@ msgstr ""
33473356
msgid "offset must be >= 0"
33483357
msgstr ""
33493358

3359+
#: extmod/ulab/code/ulab_create.c
3360+
msgid "offset must be non-negative and no greater than buffer length"
3361+
msgstr ""
3362+
33503363
#: py/objstr.c py/objstrunicode.c
33513364
msgid "offset out of bounds"
33523365
msgstr ""

ports/esp32s2/boards/unexpectedmaker_feathers2/board.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "supervisor/board.h"
2828
#include "mpconfigboard.h"
2929
#include "shared-bindings/microcontroller/Pin.h"
30-
#include "components/driver/include/driver/gpio.h"
31-
#include "components/soc/include/hal/gpio_hal.h"
3230

3331
void board_init(void) {
3432
// USB
@@ -49,12 +47,6 @@ void board_init(void) {
4947
common_hal_never_reset_pin(&pin_GPIO30);
5048
common_hal_never_reset_pin(&pin_GPIO31);
5149
common_hal_never_reset_pin(&pin_GPIO32);
52-
53-
54-
// Add LDO2 to never reset list, set to output and enable
55-
common_hal_never_reset_pin(&pin_GPIO21);
56-
gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT);
57-
gpio_set_level(pin_GPIO21.number, true);
5850
}
5951

6052
bool board_requests_safe_mode(void) {

ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
#define AUTORESET_DELAY_MS 500
3636

37-
#define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
38-
#define MICROPY_HW_APA102_SCK (&pin_GPIO45)
37+
// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40)
38+
// #define MICROPY_HW_APA102_SCK (&pin_GPIO45)
3939

4040
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9)
4141
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8)

ports/esp32s2/common-hal/microcontroller/Pin.c

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,13 @@
3737
#ifdef MICROPY_HW_NEOPIXEL
3838
bool neopixel_in_use;
3939
#endif
40-
#ifdef MICROPY_HW_APA102_MOSI
41-
bool apa102_sck_in_use;
42-
bool apa102_mosi_in_use;
43-
#endif
4440

4541
STATIC uint32_t never_reset_pins[2];
4642
STATIC uint32_t in_use[2];
4743

44+
bool apa102_mosi_in_use;
45+
bool apa102_sck_in_use;
46+
4847
STATIC void floating_gpio_reset(gpio_num_t pin_number) {
4948
// This is the same as gpio_reset_pin(), but without the pullup.
5049
// 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) {
8786
return;
8887
}
8988
#endif
90-
#ifdef MICROPY_HW_APA102_MOSI
91-
if (pin_number == MICROPY_HW_APA102_MOSI->number ||
92-
pin_number == MICROPY_HW_APA102_SCK->number) {
93-
apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number;
94-
apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number;
95-
if (!apa102_sck_in_use && !apa102_mosi_in_use) {
96-
rgb_led_status_init();
97-
}
98-
return;
99-
}
100-
#endif
101-
102-
103-
10489
}
10590

10691
void common_hal_reset_pin(const mcu_pin_obj_t* pin) {
@@ -125,11 +110,6 @@ void reset_all_pins(void) {
125110
#ifdef MICROPY_HW_NEOPIXEL
126111
neopixel_in_use = false;
127112
#endif
128-
#ifdef MICROPY_HW_APA102_MOSI
129-
apa102_sck_in_use = false;
130-
apa102_mosi_in_use = false;
131-
#endif
132-
133113
}
134114

135115
void claim_pin(const mcu_pin_obj_t* pin) {
@@ -139,15 +119,6 @@ void claim_pin(const mcu_pin_obj_t* pin) {
139119
neopixel_in_use = true;
140120
}
141121
#endif
142-
#ifdef MICROPY_HW_APA102_MOSI
143-
if (pin == MICROPY_HW_APA102_MOSI) {
144-
apa102_mosi_in_use = true;
145-
}
146-
if (pin == MICROPY_HW_APA102_SCK) {
147-
apa102_sck_in_use = true;
148-
}
149-
#endif
150-
151122
}
152123

153124
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) {
160131
return !neopixel_in_use;
161132
}
162133
#endif
163-
#ifdef MICROPY_HW_APA102_MOSI
164-
if (pin_number == MICROPY_HW_APA102_MOSI->number) {
165-
return !apa102_mosi_in_use;
166-
}
167-
if (pin_number == MICROPY_HW_APA102_SCK->number) {
168-
return !apa102_sck_in_use;
169-
}
170-
#endif
171134

172135
uint8_t offset = pin_number / 32;
173136
uint32_t mask = 1 << (pin_number % 32);
174-
return (in_use[offset] & mask) == 0;
137+
return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0;
175138
}
176139

177140
bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) {

ports/esp32s2/common-hal/microcontroller/Pin.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@
3131

3232
#include "peripherals/pins.h"
3333

34-
#ifdef MICROPY_HW_APA102_MOSI
35-
extern bool apa102_sck_in_use;
3634
extern bool apa102_mosi_in_use;
37-
#endif
35+
extern bool apa102_sck_in_use;
3836

3937
#ifdef MICROPY_HW_NEOPIXEL
4038
extern bool neopixel_in_use;

ports/esp32s2/common-hal/wifi/Radio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
168168
} while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted());
169169
if ((bits & WIFI_DISCONNECTED_BIT) != 0) {
170170
if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) {
171-
return WIFI_RADIO_ERROR_AUTH;
171+
return WIFI_RADIO_ERROR_AUTH_FAIL;
172172
} else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) {
173173
return WIFI_RADIO_ERROR_NO_AP_FOUND;
174174
}
175-
return WIFI_RADIO_ERROR_UNKNOWN;
175+
return self->last_disconnect_reason;
176176
}
177177
return WIFI_RADIO_ERROR_NONE;
178178
}

ports/esp32s2/common-hal/wifi/__init__.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ static void event_handler(void* arg, esp_event_base_t event_base,
6565
uint8_t reason = d->reason;
6666
ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason);
6767
if (radio->retries_left > 0 &&
68-
(reason == WIFI_REASON_AUTH_EXPIRE ||
69-
reason == WIFI_REASON_NOT_AUTHED ||
70-
reason == WIFI_REASON_ASSOC_EXPIRE ||
71-
reason == WIFI_REASON_CONNECTION_FAIL ||
72-
reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) {
68+
reason != WIFI_REASON_AUTH_FAIL &&
69+
reason != WIFI_REASON_NO_AP_FOUND &&
70+
reason != WIFI_REASON_ASSOC_LEAVE) {
7371
radio->retries_left--;
7472
ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left);
7573
esp_wifi_connect();

shared-bindings/wifi/Radio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m
218218
}
219219

220220
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);
221-
if (error == WIFI_RADIO_ERROR_AUTH) {
221+
if (error == WIFI_RADIO_ERROR_AUTH_FAIL) {
222222
mp_raise_ConnectionError(translate("Authentication failure"));
223223
} else if (error == WIFI_RADIO_ERROR_NO_AP_FOUND) {
224224
mp_raise_ConnectionError(translate("No network with that ssid"));
225225
} else if (error != WIFI_RADIO_ERROR_NONE) {
226-
mp_raise_ConnectionError(translate("Unknown failure"));
226+
mp_raise_msg_varg(&mp_type_ConnectionError, translate("Unknown failure %d"), error);
227227
}
228228

229229
return mp_const_none;

0 commit comments

Comments
 (0)