parameters: (sdrangel_ip, sdrangel_port, tracker_device_index, tracker_channel_index, tracker_content, tracker_offset)
docstring: Adjust transverter frequency so that the frequency tracker absolute frequency is loosely locked to the
          carrier it is supposed to track
docstring_summary: Adjust transverter frequency so that the frequency tracker absolute frequency is loosely locked to the
          carrier it is supposed to track
docstring_tokens: Adjust transverter frequency so that the frequency tracker absolute frequency is loosely locked to the carrier it is supposed to track
function: def adjust_xvtr(sdrangel_ip, sdrangel_port, tracker_device_index, tracker_channel_index, tracker_content, tracker_offset):
      """ Adjust transverter frequency so that the frequency tracker absolute frequency is loosely locked to the
          carrier it is supposed to track
      """
  # ----------------------------------------------------------------------
      global TRACKER_OFFSET
      base_url = f'http://{sdrangel_ip}:{sdrangel_port}/sdrangel'
      correction = 0
      tracker_device_frequency = get_device_frequency(sdrangel_ip, sdrangel_port, tracker_device_index)
      # get correction from report
      if tracker_device_frequency is None:
          print(f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} get tracker device {tracker_device_index} frequency failed')
          return
      tracker_frequency = tracker_device_frequency + tracker_offset
      correction = TRACKER_FREQUENCY - tracker_frequency
      # do not correct if correction is too small
      if correction > -REFCORR_LIMIT and correction < REFCORR_LIMIT:
          return
      # apply correction
      r = requests.get(url=base_url + f'/deviceset/{XVTR_DEVICE}/device/settings')
      if r.status_code // 100 != 2:
          print(f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} get transverter device {XVTR_DEVICE} settings failed')
          return
      device_content = r.json()
      for xvtr_freq in gen_dict_extract('transverterDeltaFrequency', device_content):
          # device
          update_frequency_setting(device_content, 'transverterDeltaFrequency', xvtr_freq + correction)
          r = requests.patch(url=base_url + f'/deviceset/{XVTR_DEVICE}/device/settings', json=device_content)
          if r.status_code // 100 != 2:
              print(f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} transverter device {XVTR_DEVICE} adjust failed')
              return
          # tracker
          TRACKER_OFFSET = tracker_offset + correction
          update_frequency_setting(tracker_content, 'inputFrequencyOffset', tracker_offset + correction)
          r = requests.patch(url=base_url + f'/deviceset/{tracker_device_index}/channel/{tracker_channel_index}/settings', json=tracker_content)
          if r.status_code // 100 != 2:
              print(f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} tracker [{tracker_device_index}:{tracker_channel_index}] adjust failed')
function_tokens: def adjust_xvtr ( sdrangel_ip , sdrangel_port , tracker_device_index , tracker_channel_index , tracker_content , tracker_offset ) : # ---------------------------------------------------------------------- global TRACKER_OFFSET base_url = f'http://{sdrangel_ip}:{sdrangel_port}/sdrangel' correction = 0 tracker_device_frequency = get_device_frequency ( sdrangel_ip , sdrangel_port , tracker_device_index ) # get correction from report if tracker_device_frequency is None : print ( f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} get tracker device {tracker_device_index} frequency failed' ) return tracker_frequency = tracker_device_frequency + tracker_offset correction = TRACKER_FREQUENCY - tracker_frequency # do not correct if correction is too small if correction > - REFCORR_LIMIT and correction < REFCORR_LIMIT : return # apply correction r = requests . get ( url = base_url + f'/deviceset/{XVTR_DEVICE}/device/settings' ) if r . status_code // 100 != 2 : print ( f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} get transverter device {XVTR_DEVICE} settings failed' ) return device_content = r . json ( ) for xvtr_freq in gen_dict_extract ( 'transverterDeltaFrequency' , device_content ) : # device update_frequency_setting ( device_content , 'transverterDeltaFrequency' , xvtr_freq + correction ) r = requests . patch ( url = base_url + f'/deviceset/{XVTR_DEVICE}/device/settings' , json = device_content ) if r . status_code // 100 != 2 : print ( f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} transverter device {XVTR_DEVICE} adjust failed' ) return # tracker TRACKER_OFFSET = tracker_offset + correction update_frequency_setting ( tracker_content , 'inputFrequencyOffset' , tracker_offset + correction ) r = requests . patch ( url = base_url + f'/deviceset/{tracker_device_index}/channel/{tracker_channel_index}/settings' , json = tracker_content ) if r . status_code // 100 != 2 : print ( f'SDRangel::adjust_xvtr: {sdrangel_ip}:{SDRANGEL_API_PORT} tracker [{tracker_device_index}:{tracker_channel_index}] adjust failed' )