@@ -50,6 +50,15 @@ Sd2Card card; // The SD Card
5050SdVolume volume; // The volume (partition) on SD
5151double iTAS, ip1TAS, res, iof; // Accessory variables for Air Data calculations
5252
53+ float diffpMinRaw = 1638.3 ; // Declaration of sensors specific parameters for default ADC configuration
54+ float diffpMaxRaw = 14744.7 ;
55+ float diffpMinPressure = -6984.760 ;
56+ float diffpsetMaxPressure = 6984.760 ;
57+ float absMinRaw = 1638.3 ;
58+ float absMaxRaw = 14744.7 ;
59+ float absMinPressure = 0.0 ;
60+ float abssetMaxPressure = 160000.0 ;
61+
5362AirDC AirDataComputer (1 ); // The Air Data Computer
5463
5564SSC diffp (0x28 , 0 ); // Create an SSC sensor with I2C address 0x28 on I2C bus 0
@@ -116,14 +125,14 @@ void setup() {
116125 Wire1.begin (); // I2C Bus 1
117126
118127 // Setup sensors parameters
119- diffp.setMinRaw (1638.3 );
120- diffp.setMaxRaw (14744.7 );
121- diffp.setMinPressure (- 6984.760 );
122- diffp.setMaxPressure (6984.760 );
123- absp.setMinRaw (1638.3 );
124- absp.setMaxRaw (14744.7 );
125- absp.setMinPressure (0.0 );
126- absp.setMaxPressure (160000.0 );
128+ diffp.setMinRaw (diffpMinRaw );
129+ diffp.setMaxRaw (diffpMaxRaw );
130+ diffp.setMinPressure (diffpMinPressure );
131+ diffp.setMaxPressure (diffpsetMaxPressure );
132+ absp.setMinRaw (absMinRaw );
133+ absp.setMaxRaw (absMaxRaw );
134+ absp.setMinPressure (absMinPressure );
135+ absp.setMaxPressure (abssetMaxPressure );
127136
128137 strcpy (Data[0 ], " \0 " ); // Initialize the Data
129138 strcpy (Data[1 ], " \0 " ); // Initialize the Data
@@ -1114,7 +1123,50 @@ endread:
11141123 strcat (Answer, f4);
11151124 goto endeval;
11161125 }
1117-
1126+
1127+ // Message #19, HWD command
1128+ // $CCS,=,=,1500,=,=,=,=, Sets the external Absolute pressure sensor Min Count value
1129+
1130+ if (!strcmp (command, " HWD" )) {
1131+ int i;
1132+ i = 0 ;
1133+ for (i = 0 ; i < 8 ; i++) { // Check the fields
1134+ command = strtok (NULL , SEPARATOR);
1135+ if (strlen (command) < 1 ) goto endeval;
1136+ if (strcmp (command, LEAVE_AS_IS)) {
1137+ switch (i) {
1138+ case 0 : // Deltap Sensor Min Count value
1139+ diffp.setMinRaw (atof (command));
1140+ break ;
1141+ case 1 : // Absolute pressure sensor Min Count value
1142+ absp.setMinRaw (atof (command));
1143+ break ;
1144+ case 2 : // Deltap Sensor Max Count value
1145+ diffp.setMaxRaw (atof (command));
1146+ break ;
1147+ case 3 : // Absolute pressure sensor Max Count value
1148+ absp.setMaxRaw (atof (command));
1149+ break ;
1150+ case 4 : // Deltap Sensor Min Pressure
1151+ diffp.setMinPressure (atof (command));
1152+ break ;
1153+ case 5 : // Abs Sensor Min Pressure
1154+ absp.setMinPressure (atof (command));
1155+ break ;
1156+ case 6 : // Deltap Sensor Max Pressure
1157+ diffp.setMaxPressure (atof (command));
1158+ break ;
1159+ case 7 : // Abs Sensor Max Pressure
1160+ absp.setMaxPressure (atof (command));
1161+ break ;
1162+ default : // IT DOES NOTHING
1163+ break ;
1164+ }
1165+ }
1166+ }
1167+ goto endeval;
1168+ }
1169+
11181170 goto endeval;
11191171 }
11201172
0 commit comments