def display_ip(ip_chars): lcd.writeString("IP:", fd) location=4 for char in ip_chars: lcd.write(ord(char), type, fd) location=location+1 while location<=20: lcd.writeString(" ", fd) location=location+1 return
def no_gps_fix(): lcd.clear(fd) #clear display lcd.writeString("NO GPS FIX", fd) return
sast_time = "SAST: " + Hsast.zfill(2) + ":" + Msast.zfill(2) + ":" + Ssast.zfill(2) + " " if SECONDS ==30: #reset the lcd display every minute to remove display errors lcd.reset(fd) if SECONDS >=59: GPIO.output(arm_pulse, True) else: GPIO.output(arm_pulse, False) diff=SECONDS-old_sast old_sast=SECONDS if diff >= 1 or diff==-59: #If the time has changed by 1 second update the display #======================================================print to LCD display lcd.clear(fd) #clear display type = True lcd.writeString(sast_time, fd) try: IP = get_ip_address('eth0') except: IP= "No Network" if IP: ip_chars = list(IP) display_ip(ip_chars) lcd.writeString(sidereal_time, fd) else: #else if gpsd reports no fix switch off led GPIO.output(gps_stat, False) if fix_flag: no_gps_fix() fix_flag=False #time.sleep(0.5) #set to whatever