Merge https://github.com/libdivecomputer/libdivecomputer into Subsurface-NG
Pull upstream updates from Jef Driesen. This is mainly the Pelagic (Oceanic, Sherwood, Aeris, Aqualung etc) download interface reset sequence. * https://github.com/libdivecomputer/libdivecomputer: Fix the RTS signal handling for Pelagic interface Fix a memory leak in the error handling
This commit is contained in:
commit
abde311d3a
@ -894,21 +894,37 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Give the interface 100 ms to settle and draw power up.
|
||||
// Set the DTR line.
|
||||
status = dc_iostream_set_dtr (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the DTR/RTS lines.
|
||||
status = dc_iostream_set_dtr(device->iostream, 1);
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
return status;
|
||||
}
|
||||
status = dc_iostream_set_rts(device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to set the DTR line.");
|
||||
return status;
|
||||
ERROR (context, "Failed to set the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Give the interface 100 ms to settle and draw power up.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Make sure everything is in a sane state.
|
||||
dc_iostream_purge (device->iostream, DC_DIRECTION_ALL);
|
||||
|
||||
|
||||
@ -272,6 +272,20 @@ oceanic_veo250_device_open (dc_device_t **out, dc_context_t *context, dc_iostrea
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
@ -442,6 +442,20 @@ oceanic_vtpro_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Clear the RTS line to reset the PIC inside the data cable as it
|
||||
// may not have have been previously cleared. This ensures that the
|
||||
// PIC will always start in a known state once RTS is set. Starting
|
||||
// in a known default state is very important as the PIC won't
|
||||
// respond to init commands unless it is in a default state.
|
||||
status = dc_iostream_set_rts (device->iostream, 0);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
ERROR (context, "Failed to clear the RTS line.");
|
||||
goto error_free;
|
||||
}
|
||||
|
||||
// Hold RTS clear for a bit to allow PIC to reset.
|
||||
dc_iostream_sleep (device->iostream, 100);
|
||||
|
||||
// Set the RTS line.
|
||||
status = dc_iostream_set_rts (device->iostream, 1);
|
||||
if (status != DC_STATUS_SUCCESS) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user