Pre-1.9.7 firmware does not handle negative values. Instead, send
large positive values which will wrap around to negative values inside
the flight computer.
Signed-off-by: Keith Packard <keithp@keithp.com>
if (config_data.pad_orientation != AltosLib.MISSING)
link.printf("c o %d\n", config_data.pad_orientation);
if (plus != AltosLib.MISSING && minus != AltosLib.MISSING && plus != 0) {
+ if (plus < 0)
+ plus = 65536 + plus;
+ if (minus < 0)
+ minus = 65536 + minus;
if (config_data.accel_zero_along != AltosLib.MISSING)
link.printf("c a %d %d %d %d %d\n",
plus, minus,
int plus = accel_cal_plus(pad_orientation);
int minus = accel_cal_minus(pad_orientation);
if (plus != AltosLib.MISSING && minus != AltosLib.MISSING) {
+ if (plus < 0)
+ plus = 65536 + plus;
+ if (minus < 0)
+ minus = 65536 + minus;
if (accel_zero_along != AltosLib.MISSING &&
accel_zero_across != AltosLib.MISSING &&
accel_zero_through != AltosLib.MISSING)