diff options
| author | Dan Halbert <halbert@halwitz.org> | 2020-04-21 17:37:22 -0400 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2020-04-21 17:38:20 -0400 |
| commit | 38ec3bc57476c6fde45cd7d722370a5408fd8e10 (patch) | |
| tree | bea75dc24a3f94c14e564cb885af3fde87f9c033 /shared-module | |
| parent | 1a71c8c51577cc7014d5db1c05084778c0b977e9 (diff) | |
further ringbuf cleanup
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/_bleio/ScanResults.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/shared-module/_bleio/ScanResults.c b/shared-module/_bleio/ScanResults.c index 7ea0c165f..2e6fd07ff 100644 --- a/shared-module/_bleio/ScanResults.c +++ b/shared-module/_bleio/ScanResults.c @@ -45,10 +45,10 @@ bleio_scanresults_obj_t* shared_module_bleio_new_scanresults(size_t buffer_size, } mp_obj_t common_hal_bleio_scanresults_next(bleio_scanresults_obj_t *self) { - while (ringbuf_count(&self->buf) == 0 && !self->done && !mp_hal_is_interrupted()) { + while (ringbuf_avail(&self->buf) == 0 && !self->done && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; } - if (ringbuf_count(&self->buf) == 0 || mp_hal_is_interrupted()) { + if (ringbuf_avail(&self->buf) == 0 || mp_hal_is_interrupted()) { return mp_const_none; } @@ -97,7 +97,7 @@ void shared_module_bleio_scanresults_append(bleio_scanresults_obj_t* self, uint16_t len) { int32_t packet_size = sizeof(uint8_t) + sizeof(ticks_ms) + sizeof(rssi) + NUM_BLEIO_ADDRESS_BYTES + sizeof(addr_type) + sizeof(len) + len; - int32_t empty_space = self->buf.size - ringbuf_count(&self->buf); + int32_t empty_space = self->buf.size - ringbuf_avail(&self->buf); if (packet_size >= empty_space) { // We can't fit the packet so skip it. return; |
