altos: Clear callsign on initial config load
[fw/altos] / src / ao_sample.c
index ac15664663c0b7b2fdb2183d8af3a26b87a4a103..b2b8e9f63ff662385054b6a904797f38e6c77ce9 100644 (file)
@@ -139,7 +139,7 @@ ao_sample(void)
                 *
                 *                      ao_sample_accel       32767
                 *                    = ------------ *  ------------
-                *                         32737        ao_accel_ref
+                *                         32767        ao_accel_ref
                 *
                 * Multiply through by 32767:
                 *
@@ -179,6 +179,8 @@ ao_sample(void)
                 * just dropped a bit of noise off the low end.
                 */
                ao_sample_accel = (uint16_t) ((((uint32_t) ao_sample_accel << 16) / (ao_accel_ref[ao_sample_adc] << 1))) >> 1;
+               if (ao_config.pad_orientation != AO_PAD_ORIENTATION_ANTENNA_UP)
+                       ao_sample_accel = 0x7fff - ao_sample_accel;
                ao_adc->accel = ao_sample_accel;
 #endif
 #endif