bool DevLX16xx::PutGPRMB(PDeviceDescriptor_t d) { //RMB - The recommended minimum navigation sentence is sent whenever a route or a goto is active. // On some systems it is sent all of the time with null data. // The Arrival alarm flag is similar to the arrival alarm inside the unit and can be decoded to // drive an external alarm. // Note: the use of leading zeros in this message to preserve the character spacing. // This is done, I believe, because some autopilots may depend on exact character spacing. // // $GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20 //where: // RMB Recommended minimum navigation information // A Data status A = OK, V = Void (warning) // 0.66,L Cross-track error (nautical miles, 9.99 max), // steer Left to correct (or R = right) // 003 Origin waypoint ID // 004 Destination waypoint ID // 4917.24,N Destination waypoint latitude 49 deg. 17.24 min. N // 12309.57,W Destination waypoint longitude 123 deg. 09.57 min. W // 001.3 Range to destination, nautical miles (999.9 max) // 052.5 True bearing to destination // 000.5 Velocity towards destination, knots // V Arrival alarm A = arrived, V = not arrived // *20 checksum TCHAR szTmp[256]; /* extern START_POINT StartPoints[]; extern TASK_POINT Task[]; extern TASKSTATS_POINT TaskStats[]; extern WAYPOINT *WayPointList; extern WPCALC *WayPointCalc; */ //WayPointCalc-> int overindex = GetOvertargetIndex(); if (!ValidWayPoint(overindex)) return TRUE; _stprintf( szTmp, TEXT("$GPRMB,A,0.66,L,EDLG,%6s,%010.5f,N,%010.5f,E,%05.1f,%05.1f,%05.1f,V"), WayPointList[overindex].Name, WayPointList[overindex].Latitude * 100, WayPointList[overindex].Longitude * 100, WayPointCalc[0].Distance * 1000 * TONAUTICALMILES, WayPointCalc[0].Bearing, WayPointCalc[0].VGR * TOKNOTS); // _stprintf(szTmp, TEXT("$GPRMB,A,0.00,L,KLE,UWOE,4917.24,N,12309.57,E,011.3,052.5,000.5,V")); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); return(true); }
BOOL DevLX16xx::LX16xxDirectLink(PDeviceDescriptor_t d, BOOL bLinkEnable) { TCHAR szTmp[254]; if(bLinkEnable) { LockComm(); StartupStore(TEXT("enable LX 16xx direct Link %s"), NEWLINE); _stprintf(szTmp, TEXT("$PFLX0,COLIBRI")); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); Sleep(100); } else { // exit transfer mode // and return to normal LX16xx communication StartupStore(TEXT("return from LX 16xx link %s"), NEWLINE); _stprintf(szTmp, TEXT("$PFLX0,LX1600")); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); unsigned long lOldBR = d->Com->GetBaudrate(); /* switch to 4k8 for new Firmware versions of LX1600 */ d->Com->SetBaudrate(4800); Sleep(100); d->Com->WriteString(szTmp); Sleep(100); d->Com->WriteString(szTmp); Sleep(100); /* return to previous original */ d->Com->SetBaudrate(lOldBR); Sleep(100); d->Com->WriteString(szTmp); Sleep(100); d->Com->WriteString(szTmp); Sleep(100); UnlockComm(); } return true; }
BOOL LX16xxPutMacCready(PDeviceDescriptor_t d, double MacCready){ TCHAR szTmp[254]; if(bValid == false) return false; _stprintf(szTmp, TEXT("$PFLX2,%3.1f,%4.2f,%.0f,%4.2f,%4.2f,%4.2f,%d"), MacCready ,CalculateLXBalastFactor(BALLAST),CalculateLXBugs(BUGS),fPolar_a, fPolar_b, fPolar_c,(int) fVolume); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); MacCreadyUpdateTimeout = 5; return true; }
BOOL LX16xxPutBallast(PDeviceDescriptor_t d, double Ballast){ TCHAR szTmp[254]; if(bValid == false) return false; _stprintf(szTmp, TEXT("$PFLX2,%3.1f,%4.2f,%.0f,%4.2f,%4.2f,%4.2f,%d"), MACCREADY ,CalculateLXBalastFactor(Ballast),CalculateLXBugs(BUGS),fPolar_a, fPolar_b, fPolar_c,(int) fVolume); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); BallastUpdateTimeout =5; return(TRUE); }
bool DevLX16xx::SetupLX_Sentence(PDeviceDescriptor_t d) { TCHAR szTmp[254]; _stprintf(szTmp, TEXT("$PFLX0,GPGGA,1,GPRMC,1,LXWP0,1,LXWP1,0,LXWP2,5,LXWP3,17,LXWP4,20,LXWP5,50")); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); static int oldQNH=0; int iQNH= (int) QNH *1000; if(GPS_INFO.BaroAltitudeAvailable) { if(iQNH != oldQNH) { oldQNH = iQNH; _stprintf(szTmp, TEXT("$PFLX3,%i,,,,,,,,,,,,"),(int)((QFEAltitudeOffset- (double)LX16xxAlt) *TOFEET)); LX16xxNMEAddCheckSumStrg(szTmp); LX166AltitudeUpdateTimeout = 5; d->Com->WriteString(szTmp); } } return true; }
// ToDo raw 2.5% may cause circular updates due to inaccurate steps // can be solved later update from LX to LK works BOOL LX16xxPutBugs(PDeviceDescriptor_t d, double Bugs){ TCHAR szTmp[254]; if(bValid == false) return false; if(Bugs < 0.7) Bugs = 0.7; _stprintf(szTmp, TEXT("$PFLX2,%3.1f,%4.2f,%.0f,%4.2f,%4.2f,%4.2f,%d"), MACCREADY , (1.0+BALLAST),(1.00-Bugs)*100.0,fPolar_a, fPolar_b, fPolar_c,(int) fVolume); LX16xxNMEAddCheckSumStrg(szTmp); d->Com->WriteString(szTmp); BugsUpdateTimeout = 5; return(TRUE); }