Mares Icon HD family: send the command as one single write buffer
The Mares backend used to send the commands by splitting them up into the two-byte command and the "rest", while waiting for the ACK byte (0xAA) to come in between the two parts. That seems to work fine for the serial side, but the the BLE packets, it seems to cause too much of a delay between the command bytes and the argument bytes, and the end result is that the Mares doesn't actually act on the argument bytes at all, and just sends an EOF reply (0xEA). The Mares app itself does seem to send them as two packets, but apparently without actually waiting in between, avoiding the issue. Let's just send the command as a single write, which makes at least my loaner Mares Quad Air with the BlueLink Pro dongle happy. We may need to revisit the details of this based on feedback. But it should speed up downloading too, by avoiding the roundtrip wait for the ACK byte. This affects all the computers in the Mares Icon HD family: Matrix, Smart, Smart Apnea, Icon HD, Icon HD Net Ready, Puck Pro, Nemo Wide 2, Puck 2, Quad Air, Smart Air and Quad. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
e97886a994
commit
f57c53470b
@ -159,7 +159,7 @@ mares_iconhd_transfer (mares_iconhd_device_t *device,
|
||||
return DC_STATUS_CANCELLED;
|
||||
|
||||
// Send the command header to the dive computer.
|
||||
status = dc_iostream_write (device->iostream, command, 2, NULL);
|
||||
status = dc_iostream_write (device->iostream, command, csize, NULL);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the command.");
|
||||
return status;
|
||||
@ -179,15 +179,6 @@ mares_iconhd_transfer (mares_iconhd_device_t *device,
|
||||
return DC_STATUS_PROTOCOL;
|
||||
}
|
||||
|
||||
// Send the command payload to the dive computer.
|
||||
if (csize > 2) {
|
||||
status = dc_iostream_write (device->iostream, command + 2, csize - 2, NULL);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the command.");
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
// Read the packet.
|
||||
status = dc_iostream_read (device->iostream, answer, asize, NULL);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user