• That's great! Are you using an MDBT42 with external aerial? If not, you could maybe get away with just a Pixl.js (which still has the same bluetooth).

    will BTLE scanning always have priority (like interrupt handling)?

    Yes, it should be fine - as long as you're not using Bluetooth to talk to the Pixl?

    One thing to watch out for is to get the setScan handler as fast as possible though. While BT scanning is in an IRQ, if you don't handle the data from it fast enough then potentially you could lose some

  • Thanks, @Gordon.
    Yes, it's the one with the aerial. For some reasons:

    • I'd like to experiment with reception ranges, maybe put the antenna "on the track" (there should be a gap in the track) or use a directional antenna.
    • I wanted bigger batteries since I fear the Pixls coin cell will die at some time when scanning for hours, flashing lights and beeping
    • I had a box for everything like buttons, batteries, power switch etc. anyway, so why sacrifice a Pixl?

    The setScan handler may be an issue indeed. If I monitor ~ 8 devices for longer somehow the thing freezes and when I connect via BLE afterwards I'll see messages like
    Interrupted during event processing coming up. Is this related?

    The crux is:

    • I'd need to process every single packed received since there may not be many when someone passes very quickly
    • I'd do some calculation / thresholds / decision if this was a lap or not, so there are some lines of code involved here. Still looking for a reliable and also simple solution. Maybe you haven an idea.

    First it worked on the assumption that contact is lost for some seconds on the far side of the lap so the next time someone passes it counts a new lap.
    But if someone stays just at the edge of reception or is veeery slow, this can accumulate many false laps.
    So now I monitor RSSI which will have to rise above a certain level first and then drop again below another level. Will have to test this again.

    Or maybe I'll make setScan just do basic things and fill a buffer or something and do the calculations in another concurrent task?

About

Avatar for ChristianW @ChristianW started