Skip to content

Commit 5ad54dc

Browse files
author
JLJu
committed
ru
commented lines
1 parent c424570 commit 5ad54dc

2 files changed

Lines changed: 20 additions & 10 deletions

File tree

Software/Asgard/Microcontroller/Firmware/AsgardADC/AsgardADC.ino

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ unsigned char bytecount = 0;
5858
void setup()
5959
{
6060
//Deafult configuration for ADC Hardware. 1 present; 0 not installed
61-
AirDataComputer._status[0] = '1'; //SD Card
61+
AirDataComputer._status[0] = '0'; //SD Card
6262
AirDataComputer._status[1] = '1'; //Deltap pressure sensor
6363
AirDataComputer._status[2] = '1'; //Absolute pressure sensor
6464
AirDataComputer._status[3] = '1'; //External temperature sensor
6565
AirDataComputer._status[4] = '1'; //Deltap sensor temperature
6666
AirDataComputer._status[5] = '1'; //Absolute pressure sensor temperature
6767
AirDataComputer._status[6] = '0'; //Real time clock temperature temperature
6868
AirDataComputer._status[7] = '0'; //Error/Warning
69-
AirDataComputer._status[8] = '1'; //BT Module present on serial1
69+
AirDataComputer._status[8] = '0'; //BT Module present on serial1
7070
InitTime = 1; //First run
7171
pinMode(TsensorPin, INPUT); // and set pins to input.
7272

@@ -105,8 +105,11 @@ void loop()
105105
{
106106
delay(500);
107107
noInterrupts();
108+
Serial.println("uno");
108109
comm();
109-
acquisition();
110+
Serial.println("due");
111+
acquisition();// <- Questa si appende
112+
Serial.println("tre");
110113
computation();
111114
interrupts();
112115

@@ -183,6 +186,7 @@ void computation() {
183186
}
184187
void comm()
185188
{
189+
noInterrupts();
186190
endmsg = false;
187191
ch = &input[0];// Return to first index, ready for the new message; <- Receive one single command at time, if the command is garbled then is dropped and we need retrasmittal
188192
bytecount = 0;
@@ -214,6 +218,7 @@ void comm()
214218
bytecount++;
215219
}
216220
}
221+
217222
if (!((endmsg) && (ch != &input[0]))) {
218223
goto fine;
219224
}
@@ -226,8 +231,8 @@ void comm()
226231
}
227232
if (endmsg) { //New message is received
228233
endmsg = false;
229-
*ch = 0;
230-
ch = &input[0];// Return to first index, ready for the new message; Here for Debug purposes.
234+
// *ch = 0;
235+
// ch = &input[0];// Return to first index, ready for the new message; Here for Debug purposes.
231236

232237
if (AirDataComputer._status[8] == '1') { //if (AirDataComputer._status[8] == '1' )
233238
Serial1.println(outputb);
@@ -238,15 +243,17 @@ void comm()
238243
}
239244
}
240245
fine:;
246+
interrupts();
241247
}
242248

243249
void acquisition()
244250
{
251+
noInterrupts();
245252
//Outside Temperature Sensor
246253
temperature = TMP36GT_AI_value_to_Celsius(analogRead(TsensorPin)); // read temperature
247254
//Differential Pressure sensor
248-
diffp.update();
249-
dp = diffp.pressure();
255+
diffp.update();
256+
dp = diffp.pressure();
250257
AirDataComputer._qcRaw = diffp.pressure_Raw();
251258
AirDataComputer._Tdeltap = diffp.temperature();
252259
AirDataComputer._TdeltapRaw = diffp.temperature_Raw();
@@ -257,12 +264,15 @@ void acquisition()
257264
AirDataComputer._Tabsp = absp.temperature();
258265
AirDataComputer._TabspRaw = absp.temperature_Raw();
259266
pstatic = absp.pressure();
267+
interrupts();
260268
}
261269
double TMP36GT_AI_value_to_Celsius(int AI_value)
262270
{ // Convert Analog-input value to temperature
271+
noInterrupts();
263272
float Voltage;
264273
Voltage = AI_value * (3300.0 / 1024); // Sensor value in mV:
265274
return (((Voltage - 750) / 10) + 25) + 273.15; // [K] Temperature according to datasheet: 750 mV @ 25 °C
266275
// 10 mV / °C
276+
interrupts();
267277
}
268278

Software/Asgard/Microcontroller/Hardware Assembly Test/Teensy3.6ADCAsgard/Teensy3.6ADCAsgard.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
You should have received a copy of the GNU General Public License
1919
along with this program. If not, see <http://www.gnu.org/licenses/>.
2020
*/
21-
//#define BT_PRESENT true;
21+
//#define BT_PRESENT false;
2222

2323
#include <SD.h>
2424
#include <SD_t3.h>
@@ -48,7 +48,7 @@ void setup()
4848
Serial1.begin(9600);// Begin the serial monitor at 9600 bps over BT module
4949
#endif
5050
#ifndef BT_PRESENT
51-
Serial.begin(57600);// Begin the serial monitor at 57600 bps over the USB
51+
Serial.begin(115200);// Begin the serial monitor at 57600 bps over the USB
5252
#endif
5353
Wire.begin(); // I2C Bus 0
5454
Wire1.begin(); //I2C Bus 1
@@ -183,7 +183,7 @@ void testme_local()
183183
}
184184

185185
//Outside Temperature Sensor
186-
temperature = TMP36GT_AI_value_to_Celsius(analogRead(TsensorPin)); // read temperature
186+
//temperature = TMP36GT_AI_value_to_Celsius(analogRead(TsensorPin)); // read temperature
187187
Serial.println("Outside Temperature Measurement");
188188
Serial.print(temperature, 1); // write temperature to Serial
189189
Serial.println(" °C");

0 commit comments

Comments
 (0)