Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of dgps by
Diff: main.cpp
- Revision:
- 15:e3e03a9df89e
- Parent:
- 14:6be57da62283
- Child:
- 16:4f5d20b87dc3
diff -r 6be57da62283 -r e3e03a9df89e main.cpp --- a/main.cpp Thu Apr 10 02:19:07 2014 +0000 +++ b/main.cpp Thu Apr 10 05:38:45 2014 +0000 @@ -104,9 +104,9 @@ int main() { //getPS().sendPacket(0,NULL,0,PT_EMPTY);getPS().sendPacket(55,NULL,0,PT_IMAGE); - /* - char output[256];for(int i=0;i<256;i++){output[i]=i;}getPS().sendPacket(0,NULL,0,PT_IMAGE);getPS().sendPacket(55,output,256);getPS().sendPacket(55,output,5);getPS().sendPacket(55,NULL,0,PT_END); - PacketStruct* packs[4]; + //char output[256];for(int i=0;i<256;i++){output[i]=i;}getPS().sendPacket(0,NULL,0,PT_IMAGE);getPS().sendPacket(55,output,256);getPS().sendPacket(55,output,5);getPS().sendPacket(55,NULL,0,PT_END); + //while(true){} + /* PacketStruct* packs[4]; for(int i=0;i<4;i){ packs[i]=getPS().getNextPacket(); if(packs[i]!=NULL)i++; @@ -138,9 +138,27 @@ USB::getSerial().printf("Check GPS\n"); while(1){ // Run image handler - //imageHand.run(); + USB::getSerial().printf("Check Image\n"); + imageHand.run(); // Run GPS handler + USB::getSerial().printf("Check GPS\n"); gpsHand.run(); + USB::getSerial().printf("GPS Time: %d\n",DH::Locs().getC().getTime()); + // Read packet + USB::getSerial().printf("Read Input\n"); + PacketStruct* pack=getPS().getNextPacket(); + if(pack!=NULL){ + USB::getSerial().printf("Received Type: %d\n",pack->type); + if(pack->type==PT_REQLOC){ + // Send location + unsigned int sID=getPS().getSuperID(); + getPS().sendPacket(0,NULL,0,PT_EMPTY); + getPS().sendPacket(sID,NULL,0,PT_SENDLOC); + getPS().sendPacket(sID,(char*)(&DH::Locs().getC().getLoc()),sizeof(DataLocation)); + getPS().sendPacket(sID,NULL,0,PT_END); + } + delete pack; + } } /// Main Loop while(true) {