Add an extra delay after writing to the flash memory

The S_BLOCK_WRITE (0x30) command sends a stream of bytes to the dive
computer. Because the payload has no fixed length and there is no length
field included, the hwOS firmware detects the end of the stream by means
of a 400ms timeout. Therefore the ready byte is always delayed by this
400ms timeout.

The same remark applies to the DISPLAY (0x6E) and CUSTOMTEXT (0x63)
commands. But because libdivecomputer always pad the text with zeros and
sends the maximum payload size, we won't hit the timeout.

Reported-by: Ralph Lembcke <mail@ralph-lembcke.de>
This commit is contained in:
Jef Driesen 2020-03-10 22:58:48 +01:00
parent 7b9b6b4005
commit da4a8a90c7

View File

@ -81,6 +81,7 @@
#define CR 0x05
#define NODELAY 0
#define TIMEOUT 400
typedef enum hw_ostc3_state_t {
OPEN,
@ -1253,7 +1254,7 @@ hw_ostc3_firmware_block_write (hw_ostc3_device_t *device, unsigned int addr, con
array_uint24_be_set (buffer, addr);
memcpy (buffer + 3, block, block_size);
return hw_ostc3_transfer (device, NULL, S_BLOCK_WRITE, buffer, 3 + block_size, NULL, 0, NODELAY);
return hw_ostc3_transfer (device, NULL, S_BLOCK_WRITE, buffer, 3 + block_size, NULL, 0, TIMEOUT);
}
static dc_status_t