X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosConfigData.java;h=83f3ca07a55dfd35b3541dc70e6c239ae0203ec3;hb=2d44477f5ab4ad82ba658eb327c25c61c8056035;hp=dc9fd6b378ec6708ac2aaebede9c18fc0b729ec8;hpb=e4c93942bbde7a538d1dca114f20dc827275a8e1;p=fw%2Faltos diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index dc9fd6b3..83f3ca07 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -320,8 +320,12 @@ public class AltosConfigData { adjust_accel_cal(); switch (pad_orientation) { case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPRIGHT: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_UP: return accel_cal_plus_cooked; case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPSIDEDOWN: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_DOWN: return invert_accel_value(accel_cal_minus_cooked); default: return AltosLib.MISSING; @@ -333,8 +337,12 @@ public class AltosConfigData { adjust_accel_cal(); switch (pad_orientation) { case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPRIGHT: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_UP: return accel_cal_minus_cooked; case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPSIDEDOWN: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_DOWN: return invert_accel_value(accel_cal_plus_cooked); default: return AltosLib.MISSING; @@ -353,11 +361,15 @@ public class AltosConfigData { { switch (pad_orientation) { case AltosLib.AO_PAD_ORIENTATION_ANTENNA_UP: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPRIGHT: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_UP: accel_cal_plus_cooked = accel_cal_plus; accel_cal_minus_cooked = accel_cal_minus; accel_cal_adjusted = true; break; case AltosLib.AO_PAD_ORIENTATION_ANTENNA_DOWN: + case AltosLib.AO_PAD_ORIENTATION_WORDS_UPSIDEDOWN: + case AltosLib.AO_PAD_ORIENTATION_BIG_PARTS_DOWN: accel_cal_plus_cooked = invert_accel_value(accel_cal_minus); accel_cal_minus_cooked = invert_accel_value(accel_cal_plus); accel_cal_adjusted = true; @@ -735,7 +747,7 @@ public class AltosConfigData { dest.set_flight_log_max_enabled(max_enabled); dest.set_radio_enable(radio_enable); - dest.set_flight_log_max_limit(log_space() / 1024); + dest.set_flight_log_max_limit(log_space() >> 10, storage_erase_unit >> 10); dest.set_flight_log_max(flight_log_max); dest.set_ignite_mode(ignite_mode); dest.set_pad_orientation(pad_orientation); @@ -784,33 +796,28 @@ public class AltosConfigData { 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.flush_output(); 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.flush_output(); 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.flush_output(); link.start_remote(); } } @@ -828,7 +835,7 @@ public class AltosConfigData { link.printf("c a %d %d\n", plus, minus); /* HAS_LOG */ - if (flight_log_max != 0) + if (flight_log_max != 0 && flight_log_max != AltosLib.MISSING) link.printf("c l %d\n", flight_log_max); /* HAS_IGNITE */ @@ -870,7 +877,7 @@ public class AltosConfigData { /* UI doesn't support accel cal */ link.printf("c w\n"); - link.flush_output(); + read_link(link, "Saved"); } public AltosConfigData(AltosLink link) throws InterruptedException, TimeoutException {