[ECU] Small changes in the demo module

This commit is contained in:
Michal Podhradsky
2017-03-13 09:42:32 -07:00
parent 08026cc0f4
commit 38395f50ed
2 changed files with 20 additions and 4 deletions
@@ -97,13 +97,14 @@ Viking Motorsports ECU example
</section>
<section name="IMU" prefix="IMU_">
<!--
<define name="ACCEL_X_NEUTRAL" value="-50"/>
<define name="ACCEL_Y_NEUTRAL" value="189"/>
<define name="ACCEL_Z_NEUTRAL" value="270"/>
<define name="ACCEL_X_SENS" value="0.59633793275" integer="16"/>
<define name="ACCEL_Y_SENS" value="0.616609304777" integer="16"/>
<define name="ACCEL_Z_SENS" value="0.624348656549" integer="16"/>
-->
<define name="MAG_X_NEUTRAL" value="75"/>
<define name="MAG_Y_NEUTRAL" value="-10"/>
<define name="MAG_Z_NEUTRAL" value="7"/>
@@ -111,9 +112,10 @@ Viking Motorsports ECU example
<define name="MAG_Y_SENS" value="4.23759023915" integer="16"/>
<define name="MAG_Z_SENS" value="4.61141601045" integer="16"/>
<define name="BODY_TO_IMU_PHI" value="0." unit="deg" />
<define name="BODY_TO_IMU_PHI" value="180." unit="deg" />
<define name="BODY_TO_IMU_THETA" value="0." unit="deg" />
<define name="BODY_TO_IMU_PSI" value="0." unit="deg" />
<define name="BODY_TO_IMU_PSI" value="90." unit="deg" />
</section>
<section name="INS" prefix="INS_">
@@ -272,8 +272,22 @@ void vms_ecu_demo_periodic(void)
}
// *PD13 - Digital output. (DOUT_LS4).
static uint8_t cnt = 0;
if (rtds) {
gpio_set(GPIOD, 13);
// 120Hz, 0-5 Ain
// 5V -> fast flash
// 0V -> slow flash
if (cnt > (10-(uint8_t)(ain_1 + ain_2))) {
gpio_set(GPIOD, 13);
cnt = 0;
}
else {
gpio_clear(GPIOD, 13);
cnt++;
}
}
else {
gpio_clear(GPIOD, 13);