Abstraction for the glider class
Diff: Glider.cpp
- Revision:
- 10:4c4f0ea887a4
- Parent:
- 9:8e34e713e6ef
- Child:
- 11:5e83ff964f5f
--- a/Glider.cpp Thu Apr 20 16:39:12 2017 +0000 +++ b/Glider.cpp Mon Apr 24 21:34:11 2017 +0000 @@ -13,7 +13,7 @@ transmitFlag = false; hmc = new HMC5883L(sda, scl); bmp = new BMP180(sda, scl); - bmp->Initialize(1013.25, BMP180_OSS_ULTRA_LOW_POWER); + bmp->Initialize(64, BMP180_OSS_ULTRA_LOW_POWER); xbeeRxInt.rise(this, &Glider::setCommandFlag); } @@ -34,8 +34,7 @@ } void Glider::setMissionTime() { - //this->dev->printf("current time: %d\r\n", this->missionTime); - this->missionTime = time(NULL) - this->startTime; + this->missionTime = time(NULL) - this->startTime; //duration = current tome - start time } void Glider::setTransmitFlag() { @@ -65,32 +64,29 @@ //else, the file exists. Read the data fscanf(fp, SAVE_DATA_FORMAT, &this->startTime, &this->packetCount, &this->state); //set the start time, packet count, and state - //this->dev->printf("start time: %d\r\n", this->startTime); - //this->dev->printf("start packetCount: %d\r\n", this->packetCount); rewind(fp); //move cursor back to beginning of file fclose(fp); } void Glider::saveData() { FILE *fp = fopen("/telem/data.txt", "w"); - //this->dev->printf("saving packet count: %d\r\n", this->packetCount); - fprintf(fp, SAVE_DATA_FORMAT, this->startTime, this->packetCount, this->state); + fprintf(fp, SAVE_DATA_FORMAT, this->startTime, this->packetCount, this->state); //save the start time, packet count, and state to flash fclose(fp); } void Glider::transmitPacket() { - //TODO: transmit speed + //TODO: transmit // voltage this->packetCount++; this->xbee->printf("3387, GLIDER, %d, %d, %f, %f, %f, %f, %f, %d\r\n", - this->missionTime, - this->packetCount, - this->alt, - this->pressure, - this->temp, - this->speed, - this->heading, + this->missionTime, //duration in seconds + this->packetCount, + this->alt, //meters + this->pressure, // + this->temp, //C + this->speed, //m per s + this->heading, //degrees from North this->state); }