Fix changing the OSTC settings
The command to change the OSTC settings has a variable length payload (1 to 4 bytes). Therefore, the expected number of bytes is only know after evaluating the first option index byte. Due to the limited UART buffer in the OSTC, sending the remainder of the packet immediately after the first byte, can cause the OSTC to get out of sync. Introduce a small delay between sending the option index and the remaining parameters to avoid this problem.
This commit is contained in:
parent
0448ce686a
commit
0753f10661
@ -318,11 +318,29 @@ hw_ostc3_transfer (hw_ostc3_device_t *device,
|
||||
}
|
||||
|
||||
if (input) {
|
||||
// Send the input data packet.
|
||||
status = hw_ostc3_write (device, progress, input, isize);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the data packet.");
|
||||
return status;
|
||||
if (cmd == WRITE) {
|
||||
// Send the first byte of the input data packet.
|
||||
status = hw_ostc3_write (device, progress, input, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the data packet.");
|
||||
return status;
|
||||
}
|
||||
|
||||
dc_iostream_sleep (device->iostream, 10);
|
||||
|
||||
// Send the reamainder of the input data packet.
|
||||
status = hw_ostc3_write (device, progress, input + 1, isize - 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the data packet.");
|
||||
return status;
|
||||
}
|
||||
} else {
|
||||
// Send the input data packet.
|
||||
status = hw_ostc3_write (device, progress, input, isize);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (abstract->context, "Failed to send the data packet.");
|
||||
return status;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user