mirror of
				https://github.com/fairwaves/UHD-Fairwaves.git
				synced 2025-11-04 05:53:17 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			1.0.6
			...
			achemeris/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a870e8a16f | ||
| 
						 | 
					3c240a2ab2 | ||
| 
						 | 
					e4c59df63e | ||
| 
						 | 
					ad8ff4a345 | ||
| 
						 | 
					4f909bcfa2 | 
@@ -395,6 +395,10 @@ protected:
 | 
			
		||||
        boost::recursive_mutex::scoped_lock l(_mutex);
 | 
			
		||||
        if (verbosity>0) printf("lms6002d_ctrl_impl::set_tx_vga1dc_i_int(%d)\n", offset);
 | 
			
		||||
        lms.set_tx_vga1dc_i_int(offset);
 | 
			
		||||
        uint8_t old = lms.get_tx_vga1dc_i_int();
 | 
			
		||||
        if (offset != old) {
 | 
			
		||||
            lms.dump();
 | 
			
		||||
        }
 | 
			
		||||
        return offset;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -402,6 +406,10 @@ protected:
 | 
			
		||||
        boost::recursive_mutex::scoped_lock l(_mutex);
 | 
			
		||||
        if (verbosity>0) printf("lms6002d_ctrl_impl::set_tx_vga1dc_q_int(%d)\n", offset);
 | 
			
		||||
        lms.set_tx_vga1dc_q_int(offset);
 | 
			
		||||
        uint8_t old = lms.get_tx_vga1dc_q_int();
 | 
			
		||||
        if (offset != old) {
 | 
			
		||||
            lms.dump();
 | 
			
		||||
        }
 | 
			
		||||
        return offset;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -187,7 +187,7 @@ void umtrx_impl::client_query_handle1(const boost::property_tree::ptree &request
 | 
			
		||||
    else if (action == "GET")
 | 
			
		||||
    {
 | 
			
		||||
        const std::string type = request.get("type", "");
 | 
			
		||||
        if (type.empty()) response.put("error", "type field not specified: BOOL, INT, DOUBLE, SENSOR, RANGE");
 | 
			
		||||
        if (type.empty()) response.put("error", "type field not specified: STRING, BOOL, INT, DOUBLE, SENSOR, RANGE");
 | 
			
		||||
        else if (type == "STRING") response.put("result", _tree->access<std::string>(path).get());
 | 
			
		||||
        else if (type == "BOOL") response.put("result", _tree->access<bool>(path).get());
 | 
			
		||||
        else if (type == "INT") response.put("result", _tree->access<int>(path).get());
 | 
			
		||||
@@ -219,7 +219,7 @@ void umtrx_impl::client_query_handle1(const boost::property_tree::ptree &request
 | 
			
		||||
    else if (action == "SET")
 | 
			
		||||
    {
 | 
			
		||||
        const std::string type = request.get("type", "");
 | 
			
		||||
        if (type.empty()) response.put("error", "type field not specified: BOOL, INT, DOUBLE");
 | 
			
		||||
        if (type.empty()) response.put("error", "type field not specified: STRING, BOOL, INT, DOUBLE");
 | 
			
		||||
        else if (type == "STRING") _tree->access<std::string>(path).set(request.get<std::string>("value"));
 | 
			
		||||
        else if (type == "BOOL") _tree->access<bool>(path).set(request.get<bool>("value"));
 | 
			
		||||
        else if (type == "INT") _tree->access<int>(path).set(request.get<int>("value"));
 | 
			
		||||
 
 | 
			
		||||
@@ -59,6 +59,10 @@ class umtrx_property_tree:
 | 
			
		||||
    self._send_request('GET', path, value_type='RANGE')
 | 
			
		||||
    return self._recv_response()
 | 
			
		||||
 | 
			
		||||
  def query_string_raw(self, path):
 | 
			
		||||
    self._send_request('GET', path, value_type='STRING')
 | 
			
		||||
    return self._recv_response()
 | 
			
		||||
 | 
			
		||||
  #
 | 
			
		||||
  # Getters (value)
 | 
			
		||||
  #
 | 
			
		||||
@@ -83,6 +87,10 @@ class umtrx_property_tree:
 | 
			
		||||
    res = self.query_range_raw(path)
 | 
			
		||||
    return res['result']
 | 
			
		||||
 | 
			
		||||
  def query_string_value(self, path):
 | 
			
		||||
    res = self.query_string_raw(path)
 | 
			
		||||
    return res['result']
 | 
			
		||||
 | 
			
		||||
  #
 | 
			
		||||
  # Setters
 | 
			
		||||
  #
 | 
			
		||||
@@ -99,6 +107,10 @@ class umtrx_property_tree:
 | 
			
		||||
    self._send_request('SET', path, value_type='DOUBLE', value=val)
 | 
			
		||||
    return self._recv_response()
 | 
			
		||||
 | 
			
		||||
  def set_string(self, path, val):
 | 
			
		||||
    self._send_request('SET', path, value_type='STRING', value=val)
 | 
			
		||||
    return self._recv_response()
 | 
			
		||||
 | 
			
		||||
  #
 | 
			
		||||
  # Check path presence and list paths
 | 
			
		||||
  #
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								host/utils/umtrx_query_versions.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										20
									
								
								host/utils/umtrx_query_versions.py
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
#!/usr/bin/env python
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
##########################
 | 
			
		||||
###  Query sensors
 | 
			
		||||
##########################
 | 
			
		||||
 | 
			
		||||
from umtrx_property_tree import umtrx_property_tree
 | 
			
		||||
 | 
			
		||||
s = umtrx_property_tree()
 | 
			
		||||
s.connect()
 | 
			
		||||
 | 
			
		||||
mb_path="/mboards/0"
 | 
			
		||||
fpga_version = s.query_string_value(mb_path+"/fpga_version")
 | 
			
		||||
fw_version = s.query_string_value(mb_path+"/fw_version")
 | 
			
		||||
 | 
			
		||||
print "FPGA bitstream version: %s" % fpga_version
 | 
			
		||||
print "ZPU firmware version: %s" % fw_version
 | 
			
		||||
 | 
			
		||||
s.close()
 | 
			
		||||
@@ -46,6 +46,8 @@ class umtrx_vswr:
 | 
			
		||||
    gamma = self._gamma
 | 
			
		||||
    if gamma == 1.0:
 | 
			
		||||
      return float("inf")
 | 
			
		||||
    elif gamma > 1.0:
 | 
			
		||||
      return float("nan")
 | 
			
		||||
    else:
 | 
			
		||||
      return (1+gamma)/(1-gamma)
 | 
			
		||||
 | 
			
		||||
@@ -54,15 +56,21 @@ class umtrx_vswr:
 | 
			
		||||
    gamma = self._gamma
 | 
			
		||||
    if gamma == 1.0:
 | 
			
		||||
      return float("-inf")
 | 
			
		||||
    elif gamma > 1.0:
 | 
			
		||||
      return float("nan")
 | 
			
		||||
    else:
 | 
			
		||||
      return -10.0 * math.log(1.0-gamma*gamma, 10)
 | 
			
		||||
 | 
			
		||||
  def pf_rate(self):
 | 
			
		||||
    ''' Estimated reflected power rate, % '''
 | 
			
		||||
    gamma = self._gamma
 | 
			
		||||
    if gamma > 1.0:
 | 
			
		||||
      return float("nan")
 | 
			
		||||
    return 1.0 - gamma*gamma
 | 
			
		||||
 | 
			
		||||
  def pr_rate(self):
 | 
			
		||||
    ''' Estimated reflected power rate, % '''
 | 
			
		||||
    gamma = self._gamma
 | 
			
		||||
    if gamma > 1.0:
 | 
			
		||||
      return float("nan")
 | 
			
		||||
    return gamma*gamma
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user