Avoid re-setting dongle radio parameters when they haven't changed
during device configuration setting. This avoids flipping back and
forth from remote to local mode three times during config save.
Wait for remote end to say 'Saved' before dropping radio link. This
ensures that the remote end actually gets the save command before the
link is terminated.
Signed-off-by: Keith Packard <keithp@keithp.com>
has_setting,
radio_calibration);
/* When remote, reset the dongle frequency at the same time */
has_setting,
radio_calibration);
/* When remote, reset the dongle frequency at the same time */
- if (remote) {
- link.flush_output();
+ if (remote && frequency != link.frequency) {
link.stop_remote();
link.set_radio_frequency(frequency);
link.stop_remote();
link.set_radio_frequency(frequency);
link.start_remote();
}
}
if (telemetry_rate != AltosLib.MISSING) {
link.printf("c T %d\n", telemetry_rate);
link.start_remote();
}
}
if (telemetry_rate != AltosLib.MISSING) {
link.printf("c T %d\n", telemetry_rate);
- if (remote) {
- link.flush_output();
+ if (remote && telemetry_rate != link.telemetry_rate) {
link.stop_remote();
link.set_telemetry_rate(telemetry_rate);
link.stop_remote();
link.set_telemetry_rate(telemetry_rate);
link.start_remote();
}
}
if (callsign != null) {
link.printf("c c %s\n", callsign);
link.start_remote();
}
}
if (callsign != null) {
link.printf("c c %s\n", callsign);
- if (remote) {
- link.flush_output();
+ if (remote && !callsign.equals(link.callsign)) {
+ System.out.printf("changing link callsign from %s to %s\n", link.callsign, callsign);
link.stop_remote();
link.set_callsign(callsign);
link.stop_remote();
link.set_callsign(callsign);
/* UI doesn't support accel cal */
link.printf("c w\n");
/* UI doesn't support accel cal */
link.printf("c w\n");
+ read_link(link, "Saved");
}
public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException {
}
public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException {