+ /* Once we have all of the values from the config data, compute the
+ * accel cal values relative to Antenna Up orientation.
+ */
+ private void adjust_accel_cal() {
+ if (!accel_cal_adjusted &&
+ pad_orientation != AltosLib.MISSING &&
+ accel_cal_plus != AltosLib.MISSING &&
+ accel_cal_minus != AltosLib.MISSING)
+ {
+ 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;
+ break;
+ default:
+ break;
+ }
+ }