--- metar-v4.py.dist 2020-09-19 14:11:56.144476814 -0700 +++ metar-v4.py 2020-09-22 16:37:26.604927342 -0700 @@ -509,7 +509,9 @@ ########################## toggle = 0 #used for homeport display outerloop = 1 #Set to TRUE for infinite outerloop +display_num = 0 while (outerloop): + display_num = display_num + 1 #Time calculations, dependent on 'hour_to_display' offset. this determines how far in the future the TAF data should be. #This time is recalculated everytime the FAA data gets updated @@ -1110,13 +1112,12 @@ #grab the airport category, wind speed and various weather from the results given from FAA. for metar in root.iter('METAR'): stationId = metar.find('station_id').text - logger.debug(stationId) #debug # Routine to create flight category via cloud cover and/or visability when flight category is not reported. # Routine written and contributed to project by Nick Cirincione. Thank you for your contribution. if metar.find('flight_category') is None or metar.find('flight_category') == 'NONE': #if category is blank, then see if there's a sky condition or vis that would dictate flight category flightcategory = "VFR" #intialize flight category - logger.info(stationId + " Not Reporting Flight Category.") + logger.info(stationId + " Not Reporting Flight Category through the API.") #There can be multiple layers of clouds in each METAR, but they are always listed lowest AGL first. #Check the lowest (first) layer and see if it's overcast, broken, or obscured. If it is, then compare to cloud base height to set flight category. @@ -1162,9 +1163,10 @@ elif 3.0 <= visibility_statute_mi <= 5.0 and flightcategory != "IFR": #if Flight Category was already set to IFR by clouds, it can't be reduced to MVFR flightcategory = "MVFR" - logger.debug(stationId + " flight category is " + flightcategory) + logger.debug(stationId + " flight category determined by script processing as " + flightcategory) else: + logger.debug(stationId + " is reporting " + metar.find('flight_category').text + " through the API") flightcategory = metar.find('flight_category').text #pull flight category if it exists and save all the algoritm above #End of added routine to create flight category via cloud cover and/or visability when flight category is not reported. @@ -1200,7 +1202,9 @@ #Setup timed loop for updating FAA Weather that will run based on the value of 'update_interval' which is a user setting timeout_start = time.time() #Start the timer. When timer hits user-defined value, go back to outer loop to update FAA Weather. + loopcount=0 while time.time() < timeout_start + (update_interval * 60): #take 'update_interval' which is in minutes and turn into seconds + loopcount = loopcount + 1 #Routine to restart this script if config.py is changed while this script is running. for f, mtime in WATCHED_FILES_MTIMES: @@ -1358,9 +1362,11 @@ toggle = not(toggle) #Used to determine if the homeport color should be displayed if "homeport = 1" + print ("\nWX Display #" + str(display_num) + " Cycle Loop #" + str(loopcount) + ": ",end='') #Start main loop. This loop will create all the necessary colors to display the weather one time. for cycle_num in cycles: #cycle through the strip 6 times, setting the color then displaying to create various effects. - print(("\n Cycle Num = " + str(cycle_num))) #debug +# print(("\n Cycle Num = " + str(cycle_num))) #debug + print(" " + str(cycle_num),end='') i = 0 #Inner Loop. Increments through each LED in the strip setting the appropriate color to each individual LED. for airportcode in airports: @@ -1372,16 +1378,21 @@ #debug print out if metar_taf_mos == 0: - logger.debug(("TAF Time +" + str(hour_to_display) + " Hour" + " -->"), end=' ') + pin_color_log="TAF Time +" + str(hour_to_display) + " Hour" + " --> " +# logger.debug(("TAF Time +" + str(hour_to_display) + " Hour" + " -->"), end=' ') elif metar_taf_mos==1: - logger.debug(("METAR -->"), end=' ') +# logger.debug(("METAR -->"), end=' ') + pin_color_log="METAR --> " elif metar_taf_mos == 2: - logger.debug(("MOS Time +" + str(hour_to_display) + " Hour" + " -->"), end=' ') +# logger.debug(("MOS Time +" + str(hour_to_display) + " Hour" + " -->"), end=' ') + pin_color_log="MOS Time +" + str(hour_to_display) + " Hour" + " --> " elif metar_taf_mos == 3: - logger.debug(("Heat Map + "), end=' ') +# logger.debug(("Heat Map + "), end=' ') + pin_color_log="Heat Map + " - logger.debug((airportcode + " " + flightcategory + " " + str(airportwinds) + " " + airportwx + " " + str(cycle_num) + " ")) #debug +# logger.debug((logpreface + airportcode + " " + flightcategory + " wind=" + str(airportwinds) + " wx=" + airportwx + " cycle=" + str(cycle_num) + " ")) #debug + pin_color_log=pin_color_log + airportcode + " " + flightcategory + " wind=" + str(airportwinds) + " wx=" + airportwx + " cycle=" + str(cycle_num) + " " #Check to see if airport code is a NULL and set to black. if airportcode == "NULL" or airportcode == "LGND": @@ -1555,8 +1566,15 @@ xcolor = Color(norm_color[0], norm_color[1], norm_color[2]) strip.setPixelColor(i, xcolor) #set color to display on a specific LED for the current cycle_num cycle. + # Debug log the color settings if it's an airport PIN + pin_color_log = pin_color_log + "/ pin " + str(i) + " color is RGB=" + str(color) +# if airportcode not in [ 'NULL', 'LGND' ]: +# logger.debug(pin_color_log) i = i + 1 #set next LED pin in strip + # logger.debug('Sending color commands to LEDs for cycle ' + str(cycle_num)) + print("/LED.",end='') strip.show() #Display strip with newly assigned colors for the current cycle_num cycle. + print(".",end='') wait_time = cycle_wait[cycle_num] #cycle_wait time is a user defined value time.sleep(wait_time) #pause between cycles. pauses are setup in user definitions.