import debug
import SER
 
TRUE = 1
FALSE = 0
 
#Get Position (without using the GPS library)    
def getActualPosition():
    debug.msg("Get Position")
    a = SER.receive(20) # collects the GPS string, waits for 3 seconds (assuming that its a 1Hz GPS)
    a1 = SER.receive(20) # collects the GPS string, waits for 3 seconds (assuming that its a 1Hz GPS)
    a = a + a1
    debug.msg(a)
    gpspos_parts = a.split('\n')
    for part in gpspos_parts:
        gps_string = part.split(',', 1)
        if (gps_string[0] == '$GPGGA'):
            return part
        else:
            gpspos = 'Not GGA'
    return gpspos
 
#GPS status
def gps_status(gpspos):
    debug.msg('Retrieving GPS status')
    gpspos_parts = gpspos.split(',')
    if (gpspos_parts[6] == '1'): #2D or 3D fix
        debug.msg('GPS fix "' + gpspos_parts[6] + '" ie valid');
        status = TRUE
    else:
        debug.msg('GPS fix "' + gpspos_parts[6] + '" ie not valid');
        status = FALSE
    return status
 
projects/firefly/gpslib.py.txt · Last modified: 2008/04/18 23:54 by jamescoxon
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki