Skip to content

Commit

Permalink
fixed bug when reading lightning strike sentences
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe Carrero committed Jan 6, 2025
1 parent fbe2ff1 commit a278a1a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions socs/agents/ld_monitor/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class LDMonitor:
Logs the time at which initialization was carried out
data_dict : dictionary
Dictionary data stored from the lightning detector
newdata_dict : dictioanry
newdata_dict : dictionary
Dictionary where new data is received
"""

Expand Down Expand Up @@ -114,15 +114,15 @@ def read_data(self):
# "lightning strike" sentence
if param == 'LI':
data_split = self.data.split(',')[1:]
if data_split[2].split('*')[0] == 'Miles':
if data_split[1].split('*')[0] == 'Miles':
unit_d = 0
elif data_split[2].split('*')[0] == 'Km':
elif data_split[1].split('*')[0] == 'Km':
unit_d = 1

self.newdata_dict = {
'd_type': 1,
'time_last': time.time(),
'dist': int(data_split[1]),
'dist': int(data_split[0]),
'unit_d': unit_d
}
self.data_dict.update(self.newdata_dict)
Expand Down

0 comments on commit a278a1a

Please sign in to comment.