diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-05-05 08:50:22 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-05 08:50:22 -0700 |
| commit | f40db45009aa39ecc46b800ec18a23173bd17ac0 (patch) | |
| tree | a5b9a0e9dfecb746e16762f8919cce860b940058 /shared-module | |
| parent | dd216b6cad454c27973439887266170f09b6e0a8 (diff) | |
| parent | e1366d78b125f0aca7d9f2e6faa55d3b0adf2e83 (diff) | |
Merge pull request #2799 from dhalbert/ringbuf-fixes
Ringbuf: fix PacketBuffer; clean up ringbuf implementation and use
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..ae36f8863 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_num_filled(&self->buf) == 0 && !self->done && !mp_hal_is_interrupted()) { RUN_BACKGROUND_TASKS; } - if (ringbuf_count(&self->buf) == 0 || mp_hal_is_interrupted()) { + if (ringbuf_num_filled(&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_num_filled(&self->buf); if (packet_size >= empty_space) { // We can't fit the packet so skip it. return; |
