A porting of a GPS decoding and presenting program within the mbos RTOS. It is not a definitive application but a study program to test NMEA full decoding library and a first approach to an RTOS. Many thanks to Andrew Levido for his support and his patience on teaching me the RTOS principles from the other side of the Earth. It uses NMEA library by Tim (xtimor@gmail.com) ported by Ken Todotani (http://mbed.org/users/todotani/) on public mbed library (http://mbed.org/users/todotani/programs/GPS_nmeaLib/5yo4h) also available, as original universal C library, on http://nmea.sourceforge.net
Dependencies: mbos Watchdog TextLCD mbed ConfigFile
Diff: LeonardoMbos.cpp
- Revision:
- 1:360c4a23cb1d
- Parent:
- 0:d177c0087d1f
- Child:
- 2:8917036cbf69
--- a/LeonardoMbos.cpp Sun Jan 29 16:06:12 2012 +0000 +++ b/LeonardoMbos.cpp Sun Jan 29 22:08:35 2012 +0000 @@ -46,7 +46,7 @@ the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - dsPID33 is distributed in the hope that it will be useful, + LeonardoMbos is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -330,26 +330,7 @@ break; case 4: - static int ChooseDir=0; - Ang[Gps]=info.direction; - Ang[Mag]=CmpRead()-info.declination; //Compass reading corrected by declination - Ang[Dir]=Path.Azimuth[0]; - - ChooseDir++; - if(ChooseDir<7) - { - showDirLcd(Mag); - } - else if(ChooseDir>=7 && ChooseDir<12) - { - showDirLcd(Gps); - } - else if(ChooseDir>=12) - { - ChooseDir=0; - } - showDirLcd(Dir); - + ShowPathLcd(); Previous=4; break; @@ -362,6 +343,48 @@ } } +void ShowPathLcd(void) +{ + static int ChooseDir=0; + DegMinSec DecCoord; + + Ang[Gps]=info.direction; + Ang[Mag]=CmpRead()-info.declination; //Compass reading corrected by declination + Ang[Dir]=Path.Azimuth[0]; + + ChooseDir++; + if(ChooseDir<7) + { + showDirLcd(Mag); + } + else if(ChooseDir>=7 && ChooseDir<12) + { + showDirLcd(Gps); + } + else if(ChooseDir>=12) + { + ChooseDir=0; + } + showDirLcd(Dir); + + Deg2DegMinSec(nmea_ndeg2degree(Dest.lat), &DecCoord); + lcd.locate(6,0); + lcd.printf("%d%d\'%.0f", DecCoord.Deg, DecCoord.Min, DecCoord.Sec); + lcd.printf("%c", Dest.lat >= 0 ? 'N': 'S'); + + Deg2DegMinSec(nmea_ndeg2degree(Dest.lon), &DecCoord); + lcd.locate(6,1); + lcd.printf("%d%d\'%.0f", DecCoord.Deg, DecCoord.Min, DecCoord.Sec); + lcd.printf("%c", Dest.lon >= 0 ? 'E': 'W'); + + lcd.locate(6,2); + lcd.printf(" dist m"); + lcd.locate(6,3); + lcd.printf("%4.3f",Path.Dist); + + +} + void showDirLcd(int Indx) {/** *\brief display a sort of compass on LCD