Skip to content

Commit f603377

Browse files
committed
Merge branch 'main' into cardputer_keyboard
2 parents 8883416 + 84e937f commit f603377

File tree

35 files changed

+408
-92
lines changed

35 files changed

+408
-92
lines changed

devices/ble_hci/common-hal/_bleio/Adapter.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,14 @@ STATIC void check_enabled(bleio_adapter_obj_t *adapter) {
267267
// return true;
268268
// }
269269

270-
char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0, 0};
270+
// Includes trailing null.
271+
char default_ble_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 0, 0, 0, 0, 0};
272+
273+
static void _adapter_set_name(bleio_adapter_obj_t *self, mp_obj_str_t *name_obj) {
274+
mp_buffer_info_t bufinfo;
275+
mp_get_buffer_raise(name_obj, &bufinfo, MP_BUFFER_READ);
276+
bleio_characteristic_set_local_value(self->device_name_characteristic, &bufinfo);
277+
}
271278

272279
// Get various values and limits set by the adapter.
273280
// Set event mask.
@@ -283,16 +290,18 @@ STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
283290
#endif
284291

285292
if (!self->name) {
286-
name_len = sizeof(default_ble_name);
293+
name_len = sizeof(default_ble_name) - 1;
287294
bt_addr_t addr;
288295
hci_check_error(hci_read_bd_addr(&addr));
289296

290297
default_ble_name[name_len - 4] = nibble_to_hex_lower[addr.val[1] >> 4 & 0xf];
291298
default_ble_name[name_len - 3] = nibble_to_hex_lower[addr.val[1] & 0xf];
292299
default_ble_name[name_len - 2] = nibble_to_hex_lower[addr.val[0] >> 4 & 0xf];
293300
default_ble_name[name_len - 1] = nibble_to_hex_lower[addr.val[0] & 0xf];
301+
// default_ble_name[name_len] will be zero.
294302
self->name = mp_obj_new_str(default_ble_name, (uint8_t)name_len);
295303
}
304+
_adapter_set_name(self, self->name);
296305

297306
// Get version information.
298307
if (hci_read_local_version(&self->hci_version, &self->hci_revision, &self->lmp_version,
@@ -358,7 +367,6 @@ void common_hal_bleio_adapter_construct_hci_uart(bleio_adapter_obj_t *self, busi
358367

359368
common_hal_bleio_adapter_set_enabled(self, true);
360369
bleio_adapter_hci_init(self);
361-
common_hal_bleio_adapter_set_name(self, default_ble_name);
362370
}
363371

364372
void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enabled) {
@@ -426,9 +434,7 @@ mp_obj_str_t *common_hal_bleio_adapter_get_name(bleio_adapter_obj_t *self) {
426434

427435
void common_hal_bleio_adapter_set_name(bleio_adapter_obj_t *self, const char *name) {
428436
self->name = mp_obj_new_str(name, strlen(name));
429-
mp_buffer_info_t bufinfo;
430-
mp_get_buffer_raise(self->name, &bufinfo, MP_BUFFER_READ);
431-
bleio_characteristic_set_local_value(self->device_name_characteristic, &bufinfo);
437+
_adapter_set_name(self, self->name);
432438
}
433439

434440

locale/ID.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2308,6 +2308,11 @@ msgstr ""
23082308
msgid "You pressed the BOOT button at start up"
23092309
msgstr ""
23102310

2311+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2312+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2313+
msgid "You pressed the BOOT button at start up."
2314+
msgstr ""
2315+
23112316
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23122317
msgid "You pressed the GPIO0 button at start up."
23132318
msgstr ""
@@ -2324,10 +2329,6 @@ msgstr ""
23242329
msgid "You pressed the VOLUME button at start up."
23252330
msgstr ""
23262331

2327-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2328-
msgid "You pressed the boot button at start up."
2329-
msgstr ""
2330-
23312332
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23322333
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23332334
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h

locale/cs.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,6 +2317,11 @@ msgstr "Při spuštění jsi stiskl tlačítko DOWN."
23172317
msgid "You pressed the BOOT button at start up"
23182318
msgstr "Při spuštění jsi stiskl tlačítko BOOT"
23192319

2320+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2321+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2322+
msgid "You pressed the BOOT button at start up."
2323+
msgstr ""
2324+
23202325
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23212326
msgid "You pressed the GPIO0 button at start up."
23222327
msgstr "Při spuštění jsi stiskl tlačítko na pinu GPIO0."
@@ -2333,10 +2338,6 @@ msgstr "Při spuštění jsi stiskl tlačítko SW38."
23332338
msgid "You pressed the VOLUME button at start up."
23342339
msgstr "Při spuštění jsi stiskl tlačítko VOLUME."
23352340

2336-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2337-
msgid "You pressed the boot button at start up."
2338-
msgstr ""
2339-
23402341
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23412342
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23422343
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h

locale/de_DE.po

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,6 +2350,11 @@ msgstr "Der DOWN-Knopf wurde beim Starten gedrückt."
23502350
msgid "You pressed the BOOT button at start up"
23512351
msgstr "Der BOOT-Knopf wurde beim Starten gedrückt"
23522352

2353+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2354+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2355+
msgid "You pressed the BOOT button at start up."
2356+
msgstr ""
2357+
23532358
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23542359
msgid "You pressed the GPIO0 button at start up."
23552360
msgstr "Der GPIO0-Knopf wurde beim Starten gedrückt."
@@ -2366,10 +2371,6 @@ msgstr "Der SW38-Knopf wurde beim Starten gedrückt."
23662371
msgid "You pressed the VOLUME button at start up."
23672372
msgstr "Der VOLUME-Knopf wurde beim Starten gedrückt."
23682373

2369-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2370-
msgid "You pressed the boot button at start up."
2371-
msgstr "Der Boot-Knopf wurde beim Starten gedrückt."
2372-
23732374
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23742375
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23752376
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h
@@ -4401,6 +4402,9 @@ msgstr "zi muss eine Gleitkommazahl sein"
44014402
msgid "zi must be of shape (n_section, 2)"
44024403
msgstr "zi muss die Form (n_section, 2) haben"
44034404

4405+
#~ msgid "You pressed the boot button at start up."
4406+
#~ msgstr "Der Boot-Knopf wurde beim Starten gedrückt."
4407+
44044408
#~ msgid "Error: Failure to bind"
44054409
#~ msgstr "Error: Bind Fehler"
44064410

locale/el.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,6 +2314,11 @@ msgstr ""
23142314
msgid "You pressed the BOOT button at start up"
23152315
msgstr ""
23162316

2317+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2318+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2319+
msgid "You pressed the BOOT button at start up."
2320+
msgstr ""
2321+
23172322
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23182323
msgid "You pressed the GPIO0 button at start up."
23192324
msgstr ""
@@ -2330,10 +2335,6 @@ msgstr ""
23302335
msgid "You pressed the VOLUME button at start up."
23312336
msgstr ""
23322337

2333-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2334-
msgid "You pressed the boot button at start up."
2335-
msgstr ""
2336-
23372338
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23382339
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23392340
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h

locale/en_GB.po

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,11 @@ msgstr "You pressed button DOWN at start up."
23212321
msgid "You pressed the BOOT button at start up"
23222322
msgstr "You pressed the BOOT button at start up"
23232323

2324+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2325+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2326+
msgid "You pressed the BOOT button at start up."
2327+
msgstr ""
2328+
23242329
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23252330
msgid "You pressed the GPIO0 button at start up."
23262331
msgstr "You pressed the GPIO0 button at start up."
@@ -2337,10 +2342,6 @@ msgstr "You pressed the SW38 button at start up."
23372342
msgid "You pressed the VOLUME button at start up."
23382343
msgstr "You pressed the VOLUME button at start up."
23392344

2340-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2341-
msgid "You pressed the boot button at start up."
2342-
msgstr "You pressed the boot button at start up."
2343-
23442345
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23452346
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23462347
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h
@@ -4349,6 +4350,9 @@ msgstr "zi must be of float type"
43494350
msgid "zi must be of shape (n_section, 2)"
43504351
msgstr "zi must be of shape (n_section, 2)"
43514352

4353+
#~ msgid "You pressed the boot button at start up."
4354+
#~ msgstr "You pressed the boot button at start up."
4355+
43524356
#~ msgid "Error: Failure to bind"
43534357
#~ msgstr "Error: Failure to bind"
43544358

locale/es.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2353,6 +2353,11 @@ msgstr ""
23532353
msgid "You pressed the BOOT button at start up"
23542354
msgstr "Usted presionó el botón BOOT al iniciar"
23552355

2356+
#: ports/espressif/boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
2357+
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2358+
msgid "You pressed the BOOT button at start up."
2359+
msgstr ""
2360+
23562361
#: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h
23572362
msgid "You pressed the GPIO0 button at start up."
23582363
msgstr "Presionaste el botón GPIO0 al inicio."
@@ -2369,10 +2374,6 @@ msgstr "Presionó el botón SW38 al iniciar."
23692374
msgid "You pressed the VOLUME button at start up."
23702375
msgstr "Usted presionó el botón de volumen al iniciar."
23712376

2372-
#: ports/espressif/boards/adafruit_itsybitsy_esp32/mpconfigboard.h
2373-
msgid "You pressed the boot button at start up."
2374-
msgstr ""
2375-
23762377
#: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h
23772378
#: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h
23782379
#: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h

0 commit comments

Comments
 (0)