33
33
#include "shared-bindings/_bleio/Address.h"
34
34
#include "shared-bindings/_bleio/Adapter.h"
35
35
36
- #define ADV_INTERVAL_MIN (0.02001f )
37
- #define ADV_INTERVAL_MIN_STRING "0.02001 "
36
+ #define ADV_INTERVAL_MIN (0.02f )
37
+ #define ADV_INTERVAL_MIN_STRING "0.02 "
38
38
#define ADV_INTERVAL_MAX (10.24f)
39
39
#define ADV_INTERVAL_MAX_STRING "10.24"
40
40
// 20ms is recommended by Apple
@@ -204,7 +204,7 @@ const mp_obj_property_t bleio_adapter_name_obj = {
204
204
//| :param ~_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed.
205
205
//| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral.
206
206
//| :param bool anonymous: If `True` then this device's MAC address is randomized before advertising.
207
- //| :param int timeout: If set, we will only advertise for this many seconds.
207
+ //| :param int timeout: If set, we will only advertise for this many seconds. Zero means no timeout.
208
208
//| :param float interval: advertising interval, in seconds"""
209
209
//| ...
210
210
//|
@@ -237,7 +237,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t
237
237
args [ARG_interval ].u_obj = mp_obj_new_float (ADV_INTERVAL_DEFAULT );
238
238
}
239
239
240
- const mp_float_t interval = mp_obj_float_get (args [ARG_interval ].u_obj );
240
+ const mp_float_t interval = mp_obj_get_float (args [ARG_interval ].u_obj );
241
241
if (interval < ADV_INTERVAL_MIN || interval > ADV_INTERVAL_MAX ) {
242
242
mp_raise_ValueError_varg (translate ("interval must be in range %s-%s" ),
243
243
ADV_INTERVAL_MIN_STRING , ADV_INTERVAL_MAX_STRING );
@@ -279,7 +279,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt
279
279
//| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated.
280
280
//| :param int buffer_size: the maximum number of advertising bytes to buffer.
281
281
//| :param bool extended: When True, support extended advertising packets. Increasing buffer_size is recommended when this is set.
282
- //| :param float timeout: the scan timeout in seconds. If None, will scan until `stop_scan` is called.
282
+ //| :param float timeout: the scan timeout in seconds. If None or zero , will scan until `stop_scan` is called.
283
283
//| :param float interval: the interval (in seconds) between the start of two consecutive scan windows
284
284
//| Must be in the range 0.0025 - 40.959375 seconds.
285
285
//| :param float window: the duration (in seconds) to scan a single BLE channel.
@@ -320,7 +320,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args
320
320
args [ARG_window ].u_obj = mp_obj_new_float (WINDOW_DEFAULT );
321
321
}
322
322
323
- const mp_float_t interval = mp_obj_float_get (args [ARG_interval ].u_obj );
323
+ const mp_float_t interval = mp_obj_get_float (args [ARG_interval ].u_obj );
324
324
if (interval < INTERVAL_MIN || interval > INTERVAL_MAX ) {
325
325
mp_raise_ValueError_varg (translate ("interval must be in range %s-%s" ), INTERVAL_MIN_STRING , INTERVAL_MAX_STRING );
326
326
}
@@ -332,7 +332,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args
332
332
}
333
333
#pragma GCC diagnostic pop
334
334
335
- const mp_float_t window = mp_obj_float_get (args [ARG_window ].u_obj );
335
+ const mp_float_t window = mp_obj_get_float (args [ARG_window ].u_obj );
336
336
if (window > interval ) {
337
337
mp_raise_ValueError (translate ("window must be <= interval" ));
338
338
}
0 commit comments