Skip to content

Commit 5f95232

Browse files
authored
Merge pull request #8542 from jepler/mp-error-text
Switch to using MP_ERROR_TEXT instead of translate, globally
2 parents 05e6db9 + a9a8f2d commit 5f95232

File tree

394 files changed

+1139
-1130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

394 files changed

+1139
-1130
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ pseudoxml:
227227
all-source:
228228

229229
locale/circuitpython.pot: all-source
230-
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' > $@
230+
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' > $@
231231

232232
# Historically, `make translate` updated the .pot file and ran msgmerge.
233233
# However, this was a frequent source of merge conflicts. Weblate can perform

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) {
180180

181181
STATIC void check_enabled(bleio_adapter_obj_t *adapter) {
182182
if (!common_hal_bleio_adapter_get_enabled(adapter)) {
183-
mp_raise_bleio_BluetoothError(translate("Adapter not enabled"));
183+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Adapter not enabled"));
184184
}
185185
}
186186

@@ -297,18 +297,18 @@ STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
297297
// Get version information.
298298
if (hci_read_local_version(&self->hci_version, &self->hci_revision, &self->lmp_version,
299299
&self->manufacturer, &self->lmp_subversion) != HCI_OK) {
300-
mp_raise_bleio_BluetoothError(translate("Could not read HCI version"));
300+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not read HCI version"));
301301
}
302302
// Get supported features.
303303
if (hci_le_read_local_supported_features(self->features) != HCI_OK) {
304-
mp_raise_bleio_BluetoothError(translate("Could not read BLE features"));
304+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not read BLE features"));
305305
}
306306

307307
// Enabled desired events.
308308
// Most importantly, includes:
309309
// BT_EVT_MASK_LE_META_EVENT BT_EVT_BIT(61)
310310
if (hci_set_event_mask(0x3FFFFFFFFFFFFFFF) != HCI_OK) {
311-
mp_raise_bleio_BluetoothError(translate("Could not set event mask"));
311+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not set event mask"));
312312
}
313313
// The default events for LE are:
314314
// BT_EVT_MASK_LE_CONN_COMPLETE, BT_EVT_MASK_LE_ADVERTISING_REPORT,
@@ -329,7 +329,7 @@ STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
329329
uint16_t acl_max_num;
330330
uint16_t sco_max_num;
331331
if (hci_read_buffer_size(&acl_max_len, &sco_max_len, &acl_max_num, &sco_max_num) != HCI_OK) {
332-
mp_raise_bleio_BluetoothError(translate("Could not read BLE buffer info"));
332+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not read BLE buffer info"));
333333
}
334334
self->max_acl_buffer_len = acl_max_len;
335335
self->max_acl_num_buffers = acl_max_num;
@@ -339,7 +339,7 @@ STATIC void bleio_adapter_hci_init(bleio_adapter_obj_t *self) {
339339
if (BT_FEAT_LE_EXT_ADV(self->features)) {
340340
uint16_t max_adv_data_len;
341341
if (hci_le_read_maximum_advertising_data_length(&max_adv_data_len) != HCI_OK) {
342-
mp_raise_bleio_BluetoothError(translate("Could not get max advertising length"));
342+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not get max advertising length"));
343343
}
344344
self->max_adv_data_len = max_adv_data_len;
345345
} else {
@@ -472,7 +472,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t
472472

473473
if (self->scan_results != NULL) {
474474
if (!shared_module_bleio_scanresults_get_done(self->scan_results)) {
475-
mp_raise_bleio_BluetoothError(translate("Scan already in progress. Stop with stop_scan."));
475+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Scan already in progress. Stop with stop_scan."));
476476
}
477477
self->scan_results = NULL;
478478
}
@@ -601,7 +601,7 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre
601601

602602
// uint16_t conn_handle = event_info.conn_handle;
603603
// if (conn_handle == BLE_CONN_HANDLE_INVALID) {
604-
// mp_raise_bleio_BluetoothError(translate("Failed to connect: timeout"));
604+
// mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Failed to connect: timeout"));
605605
// }
606606

607607
// // Negotiate for better PHY, larger MTU and data lengths since we are the central. These are
@@ -622,14 +622,14 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre
622622
// }
623623
// }
624624

625-
mp_raise_bleio_BluetoothError(translate("Failed to connect: internal error"));
625+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Failed to connect: internal error"));
626626

627627
return mp_const_none;
628628
}
629629

630630
STATIC void check_data_fit(size_t data_len, bool connectable) {
631631
if (data_len > MAX_ADVERTISEMENT_SIZE) {
632-
mp_raise_ValueError(translate("Data too large for advertisement packet"));
632+
mp_raise_ValueError(MP_ERROR_TEXT("Data too large for advertisement packet"));
633633
}
634634
}
635635

@@ -686,7 +686,7 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
686686

687687
if (extended) {
688688
if (!BT_FEAT_LE_EXT_ADV(self->features)) {
689-
mp_raise_bleio_BluetoothError(translate("Data length needs extended advertising, but this adapter does not support it"));
689+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Data length needs extended advertising, but this adapter does not support it"));
690690
}
691691

692692
uint16_t props = 0;
@@ -801,7 +801,7 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
801801
check_data_fit(scan_response_data_bufinfo->len, connectable);
802802

803803
if (advertising_data_bufinfo->len > MAX_ADVERTISEMENT_SIZE && scan_response_data_bufinfo->len > 0) {
804-
mp_raise_bleio_BluetoothError(translate("Extended advertisements with scan response not supported."));
804+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Extended advertisements with scan response not supported."));
805805
}
806806

807807
// Anonymous mode requires a timeout so that we don't continue to broadcast
@@ -811,13 +811,13 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
811811
timeout = MAX_ANONYMOUS_ADV_TIMEOUT_SECS;
812812
} else {
813813
if (timeout > MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS) {
814-
mp_raise_bleio_BluetoothError(translate("Timeout is too long: Maximum timeout length is %d seconds"),
814+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Timeout is too long: Maximum timeout length is %d seconds"),
815815
MAX_LIMITED_DISCOVERABLE_ADV_TIMEOUT_SECS);
816816
}
817817
}
818818

819819
if (tx_power != 0) {
820-
mp_raise_NotImplementedError(translate("Only tx_power=0 supported"));
820+
mp_raise_NotImplementedError(MP_ERROR_TEXT("Only tx_power=0 supported"));
821821
}
822822

823823
const uint32_t result = _common_hal_bleio_adapter_start_advertising(
@@ -829,7 +829,7 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self,
829829
tx_power, directed_to);
830830

831831
if (result) {
832-
mp_raise_bleio_BluetoothError(translate("Already advertising"));
832+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Already advertising"));
833833
}
834834
self->circuitpython_advertising = false;
835835
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
4545
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
4646
return service->uuid;
4747
}
48-
mp_raise_RuntimeError(translate("Invalid BLE attribute"));
48+
mp_raise_RuntimeError(MP_ERROR_TEXT("Invalid BLE attribute"));
4949
}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *sel
108108

109109
void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo) {
110110
if (self->fixed_length && bufinfo->len != self->max_length) {
111-
mp_raise_ValueError(translate("Value length != required fixed length"));
111+
mp_raise_ValueError(MP_ERROR_TEXT("Value length != required fixed length"));
112112
}
113113
if (bufinfo->len > self->max_length) {
114-
mp_raise_ValueError(translate("Value length > max_length"));
114+
mp_raise_ValueError(MP_ERROR_TEXT("Value length > max_length"));
115115
}
116116

117117
// Do GATT operations only if this characteristic has been added to a registered service.
@@ -125,7 +125,7 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self,
125125
} else if (self->props & CHAR_PROP_WRITE_NO_RESPONSE) {
126126
// att_write_cmd(conn_handle, self->handle, bufinfo->buff, bufinfo->len);
127127
} else {
128-
mp_raise_bleio_BluetoothError(translate("Characteristic not writable"));
128+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Characteristic not writable"));
129129
}
130130
} else {
131131
// Always write the value locally even if no connections are active.
@@ -168,7 +168,7 @@ bleio_characteristic_properties_t common_hal_bleio_characteristic_get_properties
168168
void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *self, bleio_descriptor_obj_t *descriptor) {
169169
if (self->handle != common_hal_bleio_adapter_obj.last_added_characteristic_handle) {
170170
mp_raise_bleio_BluetoothError(
171-
translate("Descriptor can only be added to most recently added characteristic"));
171+
MP_ERROR_TEXT("Descriptor can only be added to most recently added characteristic"));
172172
}
173173

174174
descriptor->handle = bleio_adapter_add_attribute(&common_hal_bleio_adapter_obj, MP_OBJ_TO_PTR(descriptor));
@@ -181,11 +181,11 @@ void common_hal_bleio_characteristic_add_descriptor(bleio_characteristic_obj_t *
181181

182182
void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, bool notify, bool indicate) {
183183
if (self->cccd == NULL) {
184-
mp_raise_bleio_BluetoothError(translate("No CCCD for this Characteristic"));
184+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("No CCCD for this Characteristic"));
185185
}
186186

187187
if (!common_hal_bleio_service_get_is_remote(self->service)) {
188-
mp_raise_bleio_RoleError(translate("Can't set CCCD on local Characteristic"));
188+
mp_raise_bleio_RoleError(MP_ERROR_TEXT("Can't set CCCD on local Characteristic"));
189189
}
190190

191191
const uint16_t conn_handle = bleio_connection_get_conn_handle(self->service->connection);
@@ -199,7 +199,7 @@ void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self,
199199
(void)cccd_value;
200200
// uint8_t rsp[sizeof(bt_att_error_rsp)];
201201
// if (att_write_req(conn_handle, self->cccd->handle, &cccd_value, sizeof(cccd_value)) == 0) {
202-
// mp_raise_bleio_BluetoothError(translate("Could not write CCCD"));
202+
// mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Could not write CCCD"));
203203
// }
204204
}
205205

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern
640640
// mp_obj_t uuid_obj;
641641
// while ((uuid_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) {
642642
// if (!mp_obj_is_type(uuid_obj, &bleio_uuid_type)) {
643-
// mp_raise_TypeError(translate("non-UUID found in service_uuids_whitelist"));
643+
// mp_raise_TypeError(MP_ERROR_TEXT("non-UUID found in service_uuids_whitelist"));
644644
// }
645645
// bleio_uuid_obj_t *uuid = MP_OBJ_TO_PTR(uuid_obj);
646646

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void common_hal_bleio_descriptor_construct(bleio_descriptor_obj_t *self, bleio_c
4343

4444
const mp_int_t max_length_max = fixed_length ? BLE_GATTS_FIX_ATTR_LEN_MAX : BLE_GATTS_VAR_ATTR_LEN_MAX;
4545
if (max_length < 0 || max_length > max_length_max) {
46-
mp_raise_ValueError_varg(translate("max_length must be 0-%d when fixed_length is %s"),
46+
mp_raise_ValueError_varg(MP_ERROR_TEXT("max_length must be 0-%d when fixed_length is %s"),
4747
max_length_max, fixed_length ? "True" : "False");
4848
}
4949
self->max_length = max_length;
@@ -85,10 +85,10 @@ size_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self, uint8
8585

8686
void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buffer_info_t *bufinfo) {
8787
if (self->fixed_length && bufinfo->len != self->max_length) {
88-
mp_raise_ValueError(translate("Value length != required fixed length"));
88+
mp_raise_ValueError(MP_ERROR_TEXT("Value length != required fixed length"));
8989
}
9090
if (bufinfo->len > self->max_length) {
91-
mp_raise_ValueError(translate("Value length > max_length"));
91+
mp_raise_ValueError(MP_ERROR_TEXT("Value length > max_length"));
9292
}
9393

9494
self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void common_hal_bleio_packet_buffer_construct(
102102

103103
if (incoming) {
104104
if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size))) {
105-
mp_raise_ValueError(translate("Buffer too large and unable to allocate"));
105+
mp_raise_ValueError(MP_ERROR_TEXT("Buffer too large and unable to allocate"));
106106
}
107107
}
108108

@@ -151,7 +151,7 @@ mp_int_t common_hal_bleio_packet_buffer_readinto(bleio_packet_buffer_obj_t *self
151151
mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self,
152152
const uint8_t *data, size_t len, uint8_t *header, size_t header_len) {
153153
if (self->outgoing[0] == NULL) {
154-
mp_raise_bleio_BluetoothError(translate("Writes not supported on Characteristic"));
154+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Writes not supported on Characteristic"));
155155
}
156156
if (self->conn_handle == BLE_CONN_HANDLE_INVALID) {
157157
return -1;
@@ -160,7 +160,7 @@ mp_int_t common_hal_bleio_packet_buffer_write(bleio_packet_buffer_obj_t *self,
160160

161161
if (len + header_len > outgoing_packet_length) {
162162
// Supplied data will not fit in a single BLE packet.
163-
mp_raise_ValueError(translate("Total data to write is larger than outgoing_packet_length"));
163+
mp_raise_ValueError(MP_ERROR_TEXT("Total data to write is larger than outgoing_packet_length"));
164164
}
165165

166166
if (len + self->pending_size > outgoing_packet_length) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ uint32_t _common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uu
5353
void common_hal_bleio_service_construct(bleio_service_obj_t *self, bleio_uuid_obj_t *uuid, bool is_secondary) {
5454
if (_common_hal_bleio_service_construct(self, uuid, is_secondary,
5555
mp_obj_new_list(0, NULL)) != 0) {
56-
mp_raise_RuntimeError(translate("Failed to add service"));
56+
mp_raise_RuntimeError(MP_ERROR_TEXT("Failed to add service"));
5757
}
5858
}
5959

@@ -89,7 +89,7 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self,
8989

9090
if (self->handle != common_hal_bleio_adapter_obj.last_added_service_handle) {
9191
mp_raise_bleio_BluetoothError(
92-
translate("Characteristic can only be added to most recently added service"));
92+
MP_ERROR_TEXT("Characteristic can only be added to most recently added service"));
9393
}
9494
characteristic->decl_handle = bleio_adapter_add_attribute(
9595
&common_hal_bleio_adapter_obj, MP_OBJ_TO_PTR(characteristic));

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ bool vm_used_ble;
5050

5151
// switch (sec_status) {
5252
// case BLE_GAP_SEC_STATUS_UNSPECIFIED:
53-
// mp_raise_bleio_SecurityError(translate("Unspecified issue. Can be that the pairing prompt on the other device was declined or ignored."));
53+
// mp_raise_bleio_SecurityError(MP_ERROR_TEXT("Unspecified issue. Can be that the pairing prompt on the other device was declined or ignored."));
5454
// return;
5555
// default:
56-
// mp_raise_bleio_SecurityError(translate("Unknown security error: 0x%04x"), sec_status);
56+
// mp_raise_bleio_SecurityError(MP_ERROR_TEXT("Unknown security error: 0x%04x"), sec_status);
5757
// }
5858
// }
5959

@@ -96,14 +96,14 @@ bleio_adapter_obj_t common_hal_bleio_adapter_obj = {
9696

9797
bleio_adapter_obj_t *common_hal_bleio_allocate_adapter_or_raise(void) {
9898
if (common_hal_bleio_adapter_obj.allocated) {
99-
mp_raise_RuntimeError(translate("Too many Adapters"));
99+
mp_raise_RuntimeError(MP_ERROR_TEXT("Too many Adapters"));
100100
}
101101
return &common_hal_bleio_adapter_obj;
102102
}
103103

104104
void common_hal_bleio_check_connected(uint16_t conn_handle) {
105105
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
106-
mp_raise_ConnectionError(translate("Not connected"));
106+
mp_raise_ConnectionError(MP_ERROR_TEXT("Not connected"));
107107
}
108108
}
109109

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1727,52 +1727,52 @@ static void check_att_err(uint8_t err) {
17271727
case 0:
17281728
return;
17291729
case BT_ATT_ERR_INVALID_HANDLE:
1730-
msg = translate("Invalid handle");
1730+
msg = MP_ERROR_TEXT("Invalid handle");
17311731
break;
17321732
case BT_ATT_ERR_READ_NOT_PERMITTED:
1733-
msg = translate("Read not permitted");
1733+
msg = MP_ERROR_TEXT("Read not permitted");
17341734
break;
17351735
case BT_ATT_ERR_WRITE_NOT_PERMITTED:
1736-
msg = translate("Write not permitted");
1736+
msg = MP_ERROR_TEXT("Write not permitted");
17371737
break;
17381738
case BT_ATT_ERR_INVALID_PDU:
1739-
msg = translate("Invalid PDU");
1739+
msg = MP_ERROR_TEXT("Invalid PDU");
17401740
break;
17411741
case BT_ATT_ERR_NOT_SUPPORTED:
1742-
msg = translate("Not supported");
1742+
msg = MP_ERROR_TEXT("Not supported");
17431743
break;
17441744
case BT_ATT_ERR_INVALID_OFFSET:
1745-
msg = translate("Invalid offset");
1745+
msg = MP_ERROR_TEXT("Invalid offset");
17461746
break;
17471747
case BT_ATT_ERR_PREPARE_QUEUE_FULL:
1748-
msg = translate("Prepare queue full");
1748+
msg = MP_ERROR_TEXT("Prepare queue full");
17491749
break;
17501750
case BT_ATT_ERR_ATTRIBUTE_NOT_FOUND:
1751-
msg = translate("Attribute not found");
1751+
msg = MP_ERROR_TEXT("Attribute not found");
17521752
break;
17531753
case BT_ATT_ERR_ATTRIBUTE_NOT_LONG:
1754-
msg = translate("Attribute not long");
1754+
msg = MP_ERROR_TEXT("Attribute not long");
17551755
break;
17561756
case BT_ATT_ERR_ENCRYPTION_KEY_SIZE:
1757-
msg = translate("Encryption key size");
1757+
msg = MP_ERROR_TEXT("Encryption key size");
17581758
break;
17591759
case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN:
1760-
msg = translate("Invalid attribute length");
1760+
msg = MP_ERROR_TEXT("Invalid attribute length");
17611761
break;
17621762
case BT_ATT_ERR_UNLIKELY:
1763-
msg = translate("Unlikely");
1763+
msg = MP_ERROR_TEXT("Unlikely");
17641764
break;
17651765
case BT_ATT_ERR_UNSUPPORTED_GROUP_TYPE:
1766-
msg = translate("Unsupported group type");
1766+
msg = MP_ERROR_TEXT("Unsupported group type");
17671767
break;
17681768
case BT_ATT_ERR_INSUFFICIENT_RESOURCES:
1769-
msg = translate("Insufficient resources");
1769+
msg = MP_ERROR_TEXT("Insufficient resources");
17701770
break;
17711771
case BT_ATT_ERR_DB_OUT_OF_SYNC:
1772-
msg = translate("DB out of sync");
1772+
msg = MP_ERROR_TEXT("DB out of sync");
17731773
break;
17741774
case BT_ATT_ERR_VALUE_NOT_ALLOWED:
1775-
msg = translate("Value not allowed");
1775+
msg = MP_ERROR_TEXT("Value not allowed");
17761776
break;
17771777
}
17781778
if (msg) {
@@ -1781,15 +1781,15 @@ static void check_att_err(uint8_t err) {
17811781

17821782
switch (err) {
17831783
case BT_ATT_ERR_AUTHENTICATION:
1784-
msg = translate("Insufficient authentication");
1784+
msg = MP_ERROR_TEXT("Insufficient authentication");
17851785
break;
17861786
case BT_ATT_ERR_INSUFFICIENT_ENCRYPTION:
1787-
msg = translate("Insufficient encryption");
1787+
msg = MP_ERROR_TEXT("Insufficient encryption");
17881788
break;
17891789
}
17901790
if (msg) {
17911791
mp_raise_bleio_SecurityError(msg);
17921792
}
17931793

1794-
mp_raise_bleio_BluetoothError(translate("Unknown ATT error: 0x%02x"), err);
1794+
mp_raise_bleio_BluetoothError(MP_ERROR_TEXT("Unknown ATT error: 0x%02x"), err);
17951795
}

0 commit comments

Comments
 (0)