diff --git a/freedata_server/frame_handler.py b/freedata_server/frame_handler.py index b4790615e..c3102433a 100644 --- a/freedata_server/frame_handler.py +++ b/freedata_server/frame_handler.py @@ -5,6 +5,8 @@ import time from codec2 import FREEDV_MODE from message_system_db_manager import DatabaseManager +from message_system_db_station import DatabaseManagerStations + import maidenhead TESTMODE = False @@ -127,6 +129,14 @@ def add_to_heard_stations(self): return dxgrid = frame.get('gridsquare', "------") + #try to find station info in database + try: + station = DatabaseManagerStations(self.event_manager).get_station(frame['origin']) + if station and "gridsquare" in station["location"]: + dxgrid = station["location"]["gridsquare"] + except Exception: + pass + # Initialize distance values distance_km = None distance_miles = None