Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addressed (most of) Issue #531 #539

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions socs/agents/vantagepro2/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,27 +241,27 @@ def receive_data(self):
loop_data['packet_type'] = byte_data[4]
loop_data['next_record'] = byte_data[5]
loop_data['barometer'] = byte_data[6] / 1000.0
loop_data['temp_inside'] = byte_data[7] / 10.0
loop_data['temp_inside'] = (byte_data[7] / 10.0 - 32) * (5 / 9)
mhasself marked this conversation as resolved.
Show resolved Hide resolved
loop_data['humidity_inside'] = byte_data[8]
loop_data['temp_outside'] = byte_data[9] / 10.0
loop_data['temp_outside'] = (byte_data[9] / 10.0 - 32) * (5 / 9)
loop_data['wind_speed'] = byte_data[10]
loop_data['avg_wind_speed'] = byte_data[11]
loop_data['wind_dir'] = byte_data[12]
loop_data['extra_temp0'] = byte_data[13] - 90.0
loop_data['extra_temp1'] = byte_data[14] - 90.0
loop_data['extra_temp2'] = byte_data[15] - 90.0
loop_data['extra_temp3'] = byte_data[16] - 90.0
loop_data['extra_temp4'] = byte_data[17] - 90.0
loop_data['extra_temp5'] = byte_data[18] - 90.0
loop_data['extra_temp6'] = byte_data[19] - 90.0
loop_data['soil_temp0'] = byte_data[20] - 90.0
loop_data['soil_temp1'] = byte_data[21] - 90.0
loop_data['soil_temp2'] = byte_data[22] - 90.0
loop_data['soil_temp3'] = byte_data[23] - 90.0
loop_data['leaf_temp0'] = byte_data[24] - 90.0
loop_data['leaf_temp1'] = byte_data[25] - 90.0
loop_data['leaf_temp2'] = byte_data[26] - 90.0
loop_data['leaf_temp3'] = byte_data[27] - 90.0
loop_data['extra_temp0'] = (byte_data[13] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp1'] = (byte_data[14] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp2'] = (byte_data[15] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp3'] = (byte_data[16] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp4'] = (byte_data[17] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp5'] = (byte_data[18] - 90.0 - 32) * (5 / 9)
loop_data['extra_temp6'] = (byte_data[19] - 90.0 - 32) * (5 / 9)
loop_data['soil_temp0'] = (byte_data[20] - 90.0 - 32) * (5 / 9)
loop_data['soil_temp1'] = (byte_data[21] - 90.0 - 32) * (5 / 9)
loop_data['soil_temp2'] = (byte_data[22] - 90.0 - 32) * (5 / 9)
loop_data['soil_temp3'] = (byte_data[23] - 90.0 - 32) * (5 / 9)
loop_data['leaf_temp0'] = (byte_data[24] - 90.0 - 32) * (5 / 9)
loop_data['leaf_temp1'] = (byte_data[25] - 90.0 - 32) * (5 / 9)
loop_data['leaf_temp2'] = (byte_data[26] - 90.0 - 32) * (5 / 9)
loop_data['leaf_temp3'] = (byte_data[27] - 90.0 - 32) * (5 / 9)
loop_data['humidity_outside'] = byte_data[28]
loop_data['extra_hum0'] = byte_data[29]
loop_data['extra_hum1'] = byte_data[30]
Expand Down Expand Up @@ -312,6 +312,13 @@ def receive_data(self):
loop_data['time_sunrise'] = byte_data[75]
loop_data['time_sunset'] = byte_data[76]

# Correct UV Index by a factor of 10 and fix overflow
uvi = loop_data['UV']
if uvi < 0:
uvi += 2**7
BrianJKoopman marked this conversation as resolved.
Show resolved Hide resolved
uvi /= 10
loop_data['UV'] = uvi

# CRC check, data must be sent byte by byte
pure_data = struct.unpack('=99b', info)
self.crc_check(pure_data)
Expand Down