Commit 8936cc5d authored by TASTE User's avatar TASTE User

add flag for initialisation

parent 5e97564c
This diff is collapsed.
......@@ -72,3 +72,4 @@ PROPERTIES
Taste::HWLibraries => ("../../tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
-- copied aadl libraries
\ No newline at end of file
......@@ -29,6 +29,8 @@ package body copter_imu is
Mag : Magnetometer_Data := (0.0, 0.0, 0.0);
Self_Test_Passed : Boolean := False;
Is_Init : Boolean := False;
---------------------------------------------------------
-- Provided interface "Pulse"
......@@ -59,21 +61,25 @@ package body copter_imu is
Acc_Z_Ptr : General_Acc_Pointer := taste_Acc_Z'Access; -- Read & write
begin
-- Magnetometer not used for the moment
IMU_9_Read (Gyro, Acc, Mag);
if Is_Init then
-- Magnetometer not used for the moment
IMU_9_Read (Gyro, Acc, Mag);
Gyro_X_Ptr.all := asn1sccMyGyroVal (Gyro.X);
Gyro_Y_Ptr.all := asn1sccMyGyroVal (Gyro.Y);
Gyro_Z_Ptr.all := asn1sccMyGyroVal (Gyro.Z);
Gyro_X_Ptr.all := asn1sccMyGyroVal (Gyro.X);
Gyro_Y_Ptr.all := asn1sccMyGyroVal (Gyro.Y);
Gyro_Z_Ptr.all := asn1sccMyGyroVal (Gyro.Z);
Acc_X_Ptr.all := asn1sccMyAccVal (Acc.X);
Acc_Y_Ptr.all := asn1sccMyAccVal (Acc.Y);
Acc_Z_Ptr.all := asn1sccMyAccVal (Acc.Z);
Acc_X_Ptr.all := asn1sccMyAccVal (Acc.X);
Acc_Y_Ptr.all := asn1sccMyAccVal (Acc.Y);
Acc_Z_Ptr.all := asn1sccMyAccVal (Acc.Z);
-- Then send IMU data to the ground
Get_IMU_Data(Gyro_X_Ptr, Gyro_Y_Ptr, Gyro_Z_Ptr,
Acc_X_Ptr, Acc_Y_Ptr, Acc_Z_Ptr);
end if;
-- Then send IMU data to the ground
Get_IMU_Data(Gyro_X_Ptr, Gyro_Y_Ptr, Gyro_Z_Ptr,
Acc_X_Ptr, Acc_Y_Ptr, Acc_Z_Ptr);
end Pulse;
......@@ -85,6 +91,8 @@ package body copter_imu is
-- See if we pass the self test
Self_Test_Passed := System_Self_Test;
Is_Init := True;
-- Start the main loop if the self test passed
if Self_Test_Passed then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment