@@ -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
@@ -1117,7 +1126,50 @@ endread:
11171126 strcat (Answer, f4);
11181127 goto endeval;
11191128 }
1120-
1129+
1130+ // Message #19, HWD command
1131+ // $CCS,=,=,1500,=,=,=,=, Sets the external Absolute pressure sensor Min Count value
1132+
1133+ if (!strcmp (command, " HWD" )) {
1134+ int i;
1135+ i = 0 ;
1136+ for (i = 0 ; i < 8 ; i++) { // Check the fields
1137+ command = strtok (NULL , SEPARATOR);
1138+ if (strlen (command) < 1 ) goto endeval;
1139+ if (strcmp (command, LEAVE_AS_IS)) {
1140+ switch (i) {
1141+ case 0 : // Deltap Sensor Min Count value
1142+ diffp.setMinRaw (atof (command));
1143+ break ;
1144+ case 1 : // Absolute pressure sensor Min Count value
1145+ absp.setMinRaw (atof (command));
1146+ break ;
1147+ case 2 : // Deltap Sensor Max Count value
1148+ diffp.setMaxRaw (atof (command));
1149+ break ;
1150+ case 3 : // Absolute pressure sensor Max Count value
1151+ absp.setMaxRaw (atof (command));
1152+ break ;
1153+ case 4 : // Deltap Sensor Min Pressure
1154+ diffp.setMinPressure (atof (command));
1155+ break ;
1156+ case 5 : // Abs Sensor Min Pressure
1157+ absp.setMinPressure (atof (command));
1158+ break ;
1159+ case 6 : // Deltap Sensor Max Pressure
1160+ diffp.setMaxPressure (atof (command));
1161+ break ;
1162+ case 7 : // Abs Sensor Max Pressure
1163+ absp.setMaxPressure (atof (command));
1164+ break ;
1165+ default : // IT DOES NOTHING
1166+ break ;
1167+ }
1168+ }
1169+ }
1170+ goto endeval;
1171+ }
1172+
11211173 goto endeval;
11221174 }
11231175
0 commit comments