Mares Smart Dive Computer + Bluelink pro

Dirk Hohndel dirk at
Thu Sep 27 08:29:04 PDT 2018

> On Sep 27, 2018, at 6:38 AM, Jef Driesen <jef at> wrote:
> On 2018-09-27 02:37, Linus Torvalds wrote:
>> So it turns out that "BLE is slow" is actually the *reason* for the problem.
>> There's some really odd timing thing, where when we send the read
>> command as two different packets (first the two command bytes, then
>> the 8 bytes of offset/length), and wait for the AA ACK in between,
>> something times out on the Mares side.
>> But if I send the command byte as *one* 10-byte packet, it all just works.
>> Which is really strange, because the Mares app itself actually sends
>> it as two packets, but apparently sends them quickly enough together
>> that the Mares doesn't go "where's the rest?" and give up on us.
>> Anyway, the attached patch to libdivecomputer makes it work for me.
>> I'm really not all that happy with the patch, but hey, it actually
>> removes more lines than it adds, and it does make my loaner Mares Quad
>> Air happy, so it's clearly doing something good.
>> Jef - I assume your "send first two bytes separately" model is because
>> that's what the Mares app does on a serial line too, and you just
>> followed suite?
> Unfortunately that's not the reason. Originally, I used to send everything in one go. But for some reason that didn't work for the Mares Matrix, and that's why I changed it to send the command in two parts. See commit 59bfb0f3189b14ae858650b851539d59e3fefe86 for the details. It's been a while, but I think that's indeed also how the Mares application does it.

That's unfortunate.
I just tried this on my Icon HD and as Jef predicted, this works like a charm (and may I just say, OH MY this is fast... all that BLE testing has gotten me used to expecting tens of seconds (and more) per dive... the Icon HD downloaded 84 dives in maybe 5 seconds...)

> So I'm afraid that applying this fix, and sending everything in one go again, will break the Mares Matrix (and maybe also some of the other models). For the Icon HD it should still work, but that model is a bit different from the others.

Would it make sense to use this change only when doing BLE communication? The Matrix isn't supported by the BlueLink Pro, so this sounds like it might get us both cases taken care of.


More information about the subsurface mailing list