def airspeed_voltage(VFR_HUD, ratio=None):
    '''back-calculate the voltage the airspeed sensor must have seen'''
    import mavutil
    mav = mavutil.mavfile_global
    if ratio is None:
        ratio = 1.9936 # APM default
    if 'ARSPD_RATIO' in mav.params:
        used_ratio = mav.params['ARSPD_RATIO']
    else:
        used_ratio = ratio
    if 'ARSPD_OFFSET' in mav.params:
        offset = mav.params['ARSPD_OFFSET']
    else:
        return -1
    airspeed_pressure = (pow(VFR_HUD.airspeed,2)) / used_ratio
    raw = airspeed_pressure + offset
    SCALING_OLD_CALIBRATION = 204.8
    voltage = 5.0 * raw / 4096
    return voltage
def airspeed_voltage ( VFR_HUD , ratio = None ) : import mavutil mav = mavutil . mavfile_global if ratio is None : ratio = 1.9936 if 'ARSPD_RATIO' in mav . params : used_ratio = mav . params [ 'ARSPD_RATIO' ] else : used_ratio = ratio if 'ARSPD_OFFSET' in mav . params : offset = mav . params [ 'ARSPD_OFFSET' ] else : return - 1 airspeed_pressure = ( pow ( VFR_HUD . airspeed , 2 ) ) / used_ratio raw = airspeed_pressure + offset SCALING_OLD_CALIBRATION = 204.8 voltage = 5.0 * raw / 4096 return voltage
back-calculate the voltage the airspeed sensor must have seen