X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Ftelemega-v5.0%2Fao_pins.h;h=5901eeae272fd838b497e5470d34a42f718f4b71;hb=abfa580ad700415f5ea240450a1621f9de35de82;hp=2f70f27b1c09baba93148d8845fc925aa8c02211;hpb=064e30c73ff539ec53d15efe6cbab982b9c35eaf;p=fw%2Faltos diff --git a/src/telemega-v5.0/ao_pins.h b/src/telemega-v5.0/ao_pins.h index 2f70f27b..5901eeae 100644 --- a/src/telemega-v5.0/ao_pins.h +++ b/src/telemega-v5.0/ao_pins.h @@ -83,7 +83,9 @@ #define BEEPER_CHANNEL 2 #define BEEPER_PORT (&stm_gpioe) #define BEEPER_PIN 4 -#define AO_BEEP_MID_DEFAULT 179 /* 2100 Hz */ +#define AO_BEEP_MID_DEFAULT 179 /* 2100 Hz */ +#define AO_BEEP_MAKE_LOW(m) ((uint8_t) ((m) * 197U/179U)) /* 1900 Hz */ +#define AO_BEEP_MAKE_HIGH(m) ((uint8_t) ((m) * 163U/179U)) /* 2300 Hz */ #define HAS_BATTERY_REPORT 1 #define HAS_RADIO 1 #define HAS_TELEMETRY 1 @@ -185,7 +187,7 @@ struct ao_adc { }; #define AO_ADC_DUMP(p) \ - printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ + printf("tick: %5lu A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \ (p)->tick, \ (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \ (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \ @@ -266,6 +268,12 @@ struct ao_adc { #define AO_BATTERY_DIV_PLUS 56 /* 5.6k */ #define AO_BATTERY_DIV_MINUS 100 /* 10k */ +/* + * Voltage divider on ADC pyro battery sampler + */ +#define AO_PYRO_BATTERY_DIV_PLUS 100 /* 100k */ +#define AO_PYRO_BATTERY_DIV_MINUS 27 /* 27k */ + /* * Voltage divider on ADC igniter samplers */ @@ -327,22 +335,27 @@ struct ao_adc { /* + * Here are the required sensor signs: * - * If the board is laying component side up with - * the antenna (nose) pointing north + * +along nose up + * +across USB down + * +through TH down * - * +along north +roll left up - * +across west +pitch nose down - * +through up +yaw left turn + * With the board aligned to have positive accel for the relevant + * axis, looking down from above we have: + * + * +roll counter clockwise (nose up) + * +pitch counter clockwise (USB down) + * +yaw counter clockwise (TH down) */ /* - * mpu6000 - * - * pin 1 NW corner of chip + * On TMega v5, MPU6000 pin 1 (NW corner of chip) is placed towards + * the USB and antenna edges of the board. Relative to MPU6000 specs, + * we don't need to change any signs and so the correct values are: * * +along +Y +roll +Y - * +across -X +pitch -X + * +across +X +pitch +X * +through +Z +yaw +Z * */ @@ -356,11 +369,11 @@ struct ao_adc { #define HAS_IMU 1 #define ao_mpu6000_along(m) ((m)->accel_y) -#define ao_mpu6000_across(m) (-(m)->accel_x) +#define ao_mpu6000_across(m) ((m)->accel_x) #define ao_mpu6000_through(m) ((m)->accel_z) #define ao_mpu6000_roll(m) ((m)->gyro_y) -#define ao_mpu6000_pitch(m) (-(m)->gyro_x) +#define ao_mpu6000_pitch(m) ((m)->gyro_x) #define ao_mpu6000_yaw(m) ((m)->gyro_z) #define ao_data_along(packet) ao_mpu6000_along(&(packet)->mpu6000)