-
Notifications
You must be signed in to change notification settings - Fork 1
/
smartDelay.h
51 lines (45 loc) · 1.06 KB
/
smartDelay.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// This custom version of delay() ensures that the gps object
// is being "fed".
static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
if ( !bnoValid ){
bno.begin();
bnoValid = true;
}
if(!bmpValid){
bmpSetup();
}
recieveDataTelemetry();
processGps();
if ( currentMode == FLIGHT ){
bmpGetValues();
updateAlt(adjusted_alt);
}
if (resetShort()){
lockProbe();
lockPrachute();
stopDeployingHeatSheild();
stopRaisingFlag();
currentState = IDLE ;
currentMode = FLIGHT ;
packet_count = 0;
HS_deployed = false;
PC_deployed = false;
MAST_raised = false;
zero_alt_calib = 0;
WriteALL();
telemetry = true;
tilt_calibration = false ;
simulation_enabled = false;
}
/*
if( !SD_works && currentState == IDLE ){
SDsetup();
SD_works = true ;
}
*/
} while (millis() - start < ms );
}