glider code

Dependencies:   BMP180 Glider HMC5883L mbed-os beep

Committer:
chasefarmer2808
Date:
Fri Jun 09 01:16:36 2017 +0000
Revision:
23:aabddb8f1b74
Parent:
22:d21559bd79f2
yo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chasefarmer2808 0:db9e6e5a082b 1 #include "Glider.h"
chasefarmer2808 0:db9e6e5a082b 2
chasefarmer2808 0:db9e6e5a082b 3 Serial pc(USBTX, USBRX);
chasefarmer2808 3:8bdb55e85c85 4 LocalFileSystem local("telem");
chasefarmer2808 5:b2b6de73d542 5 Ticker transmitTimer;
chasefarmer2808 16:79f30775420c 6 Timeout emergencyAlarm;
chasefarmer2808 0:db9e6e5a082b 7
chasefarmer2808 4:a5d4b62240ba 8 int main() {
chasefarmer2808 1:477c993d97fa 9 Glider g(&pc, p28, p27, p9, p10);
chasefarmer2808 6:c62b5e2124d6 10 transmitTimer.attach(&g, &Glider::setTransmitFlag, FREQ);
chasefarmer2808 22:d21559bd79f2 11 emergencyAlarm.attach(&g, &Glider::forceLandState, EMERGENCY_TIMEOUT);
chasefarmer2808 16:79f30775420c 12
chasefarmer2808 0:db9e6e5a082b 13 while (1) {
chasefarmer2808 9:24dd76917236 14
chasefarmer2808 11:7fbf4bee8472 15 //g.saveData();
chasefarmer2808 15:9442b3a17d58 16 g.updateTelem();
chasefarmer2808 15:9442b3a17d58 17
chasefarmer2808 15:9442b3a17d58 18 switch (g.state) {
chasefarmer2808 15:9442b3a17d58 19 case CRUZE:
chasefarmer2808 15:9442b3a17d58 20 //g.checkForLand();
chasefarmer2808 15:9442b3a17d58 21 break;
chasefarmer2808 15:9442b3a17d58 22 case LAND:
chasefarmer2808 15:9442b3a17d58 23 transmitTimer.detach();
chasefarmer2808 15:9442b3a17d58 24 g.endMission();
chasefarmer2808 15:9442b3a17d58 25 break;
chasefarmer2808 15:9442b3a17d58 26 }
chasefarmer2808 5:b2b6de73d542 27
chasefarmer2808 5:b2b6de73d542 28 if (g.transmitFlag) {
chasefarmer2808 14:f49ac8f6ed3a 29 g.updateTelem();
chasefarmer2808 11:7fbf4bee8472 30 g.saveData();
chasefarmer2808 15:9442b3a17d58 31 g.saveTelem();
chasefarmer2808 5:b2b6de73d542 32 g.transmitPacket();
chasefarmer2808 5:b2b6de73d542 33 g.transmitFlag = false;
chasefarmer2808 5:b2b6de73d542 34 }
chasefarmer2808 14:f49ac8f6ed3a 35
chasefarmer2808 9:24dd76917236 36 g.processCommand();
chasefarmer2808 0:db9e6e5a082b 37 }
chasefarmer2808 0:db9e6e5a082b 38
chasefarmer2808 0:db9e6e5a082b 39 }
chasefarmer2808 0:db9e6e5a082b 40