Ok I readout the arduino with a Raspberry Pi. I use a python script, where i got raw_mph and raw_angle. Now I would like to load the windcal.dat file and look up the real windspeed. but how?
windcal_filename = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'windcal.dat')
windcal_file = open(windcal_filename, 'rb')
self.windcal_tab = bytearray(windcal_file.read())
windcal_file.close()
loginf('using wind calibration file %s' % windcal_filename)
self.lastWindRaw = -1 # for wind gust spike filtering
# Use lookup table to correct raw wind speed errors
def calc_wind_speed_ec(self, raw_mph, raw_angle):
# some sanitization: no corrections needed under 3 and no values exist above 150 mph
if raw_mph < 3 or raw_mph > 150:
return raw_mph
return self.windcal_tab[(raw_mph - 1) * 256 + raw_angle]
something like that?