11 Commits

Author SHA1 Message Date
Kirill Zakharenko
e4dff6e07c bumped version to 1.0.17 2019-07-08 21:48:01 +03:00
Kirill Zakharenko
fab18d97a2 umtrx_auto_calibration: save result files to /var/lib/umtrx by default 2019-07-05 15:13:26 +03:00
Kirill Zakharenko
c9304575bf bumped version to 1.0.16 2019-07-03 21:17:31 +03:00
Kirill Zakharenko
61ac2ee278 umtrx_cal_*: fix for abrupt termination
tx_thread creates a child thread, which it join()s on, when terminating
calling interrupt() on tx_thread interferes with the join()
so we replace interrupt() with an atomic flag

(not sure how this worked before)
2019-07-03 21:17:31 +03:00
Kirill Zakharenko
7199b8667f boost: use minimally required build Boost dependencies
speeds up clean builds
2019-07-03 21:17:31 +03:00
Kirill Zakharenko
91185de06a util: install python utils directly into /usr/bin 2019-07-03 21:17:30 +03:00
Kirill Zakharenko
99d1b8adf3 utils: move umtrx python libraries to PYTHONPATH 2019-07-03 21:17:30 +03:00
Kirill Zakharenko
b81240db26 utils: remove collectd integration, it belongs in another package 2019-07-03 21:17:30 +03:00
Kirill Zakharenko
0d0f0c710c debian: Update deb deps to bionic 2019-07-03 21:17:30 +03:00
sergforce
f528fa442f Merge pull request #23 from pespin/pespin/fix-build
umtrx_monitor.cpp: Fix compilation against newer boost
2018-04-22 18:41:38 +03:00
Pau Espin Pedrol
132f8995ec umtrx_monitor.cpp: Fix compilation against newer boost
Related: github issue #22
2018-04-21 15:23:42 +02:00
17 changed files with 49 additions and 85 deletions

16
debian/changelog vendored
View File

@@ -1,3 +1,19 @@
umtrx (1.0.17) bionic; urgency=medium
* umtrx_auto_calibration: save result files to /var/lib/umtrx by default
-- Kirill Zakharenko <earwin@gmail.com> Wed, 20 Jun 2019 13:39:48 +0300
umtrx (1.0.16) bionic; urgency=medium
* first bionic build
* python libraries are now in PYTHONPATH and reusable
* minimized Boost build deps for faster builds
* dropped collectd integration
* fixed abrupt termination of umtrx_cal_*
-- Kirill Zakharenko <earwin@gmail.com> Wed, 19 Jun 2019 13:39:48 +0300
umtrx (1.0.15) trusty; urgency=medium
* host: Python 2 compatibility for umtrx_property_tree.py

2
debian/compat vendored
View File

@@ -1 +1 @@
9
11

8
debian/control vendored
View File

@@ -3,9 +3,13 @@ Section: libs
Priority: optional
Maintainer: Josh Blum <josh@pothosware.com>
Build-Depends:
debhelper (>= 9.0.0),
debhelper (>= 11.0.0),
cmake (>= 2.8),
libboost-all-dev,
libboost-date-time-dev,
libboost-filesystem-dev,
libboost-system-dev,
libboost-thread-dev,
libboost-program-options-dev,
libuhd-dev (>= 3.7)
Standards-Version: 3.9.5
Homepage: http://umtrx.org/

View File

@@ -1,8 +1,3 @@
usr/bin
images/u2plus_umtrx_v2.bin images/umtrx_txrx_uhd.bin usr/share/umtrx/firmware
host/utils/umtrx_property_tree.py host/utils/umtrx_vswr.py usr/share/umtrx
host/utils/umtrx_query_sensors.py host/utils/umtrx_query_versions.py host/utils/umtrx_net_burner.py usr/share/umtrx
host/utils/collectd/umtrx.types.db usr/share/collectd
host/utils/collectd/umtrx2collectd.py usr/share/umtrx
host/utils/collectd/umtrx.conf etc/collectd/collectd.conf.d
host/utils/umtrx_property_tree.py host/utils/umtrx_vswr.py usr/lib/python2.7/dist-packages

3
debian/umtrx.links vendored
View File

@@ -1,3 +0,0 @@
/usr/share/umtrx/umtrx_net_burner.py /usr/bin/umtrx_net_burner
/usr/share/umtrx/umtrx_query_sensors.py /usr/bin/umtrx_query_sensors
/usr/share/umtrx/umtrx_query_versions.py /usr/bin/umtrx_query_versions

View File

@@ -118,7 +118,7 @@ void umtrx_impl::status_monitor_handler(void)
void umtrx_impl::server_query_handler(void)
{
//accept the client socket (timeout is 100 ms, task is called again)
if (not wait_read_sockfd(_server_query_tcp_acceptor->native(), 100)) return;
if (not wait_read_sockfd(_server_query_tcp_acceptor->native_handle(), 100)) return;
boost::shared_ptr<asio::ip::tcp::socket> socket(new asio::ip::tcp::socket(_server_query_io_service));
_server_query_tcp_acceptor->accept(*socket);

View File

@@ -6,6 +6,9 @@ INSTALL(PROGRAMS
umtrx_gps_coord
umtrx_auto_calibration
umtrx_firmware
umtrx_net_burner
umtrx_query_sensors
umtrx_query_versions
DESTINATION bin
)

View File

@@ -1,6 +0,0 @@
TypesDB "/usr/share/collectd/umtrx.types.db"
LoadPlugin exec
<Plugin exec>
Exec "fairwaves-monitoring" "/usr/share/umtrx/umtrx2collectd.py"
</Plugin>

View File

@@ -1 +0,0 @@
sensor value:GAUGE:U:U

View File

@@ -1,54 +0,0 @@
#!/usr/bin/python -u
# -*- coding: utf-8 -*-
import os
import sched, time
from umtrx_property_tree import umtrx_property_tree
from umtrx_vswr import umtrx_vswr
BOARD_ID = "0"
SENSORS_PATH = "/mboards/{id}/sensors".format(id=BOARD_ID)
VSWR_CALIBRATION = 0 # = TM10_VSWR_cal
HOSTNAME = os.environ['COLLECTD_HOSTNAME'] if 'COLLECTD_HOSTNAME' in os.environ else 'localhost'
INTERVAL = os.environ['COLLECTD_INTERVAL'] if 'COLLECTD_INTERVAL' in os.environ else '60'
umtrx = umtrx_property_tree()
umtrx.connect()
# typically this yields: ['tempA', 'tempB', 'voltagePR1', 'voltagePF1', 'voltagePR2', 'voltagePF2', 'voltagezero', 'voltageVin', 'voltageVinPA', 'voltageDCOUT']
sensors_list = umtrx.list_path_raw(SENSORS_PATH).get("result", [])
def publish():
now = time.time()
current_sensors = {sensor: umtrx.query_sensor_value(SENSORS_PATH + "/" + sensor) for sensor in sensors_list}
for channel in ["1", "2"]:
vpf_name = "voltagePF" + channel
vpr_name = "voltagePR" + channel
if vpf_name in current_sensors and vpr_name in current_sensors:
vswr = umtrx_vswr(float(current_sensors[vpf_name]), float(current_sensors[vpr_name]), VSWR_CALIBRATION)
current_sensors["VSWR" + channel] = vswr.vswr()
current_sensors["ReturnLoss" + channel] = vswr.return_loss()
for name, value in current_sensors.items():
print "PUTVAL {host}/umtrx-{id}/sensor-{name} interval={interval} {now}:{value}".format(
host=HOSTNAME, id=BOARD_ID, name=name.lower(), interval=INTERVAL, now=now, value=value)
s = sched.scheduler(time.time, time.sleep)
def timer_loop():
s.enter(float(INTERVAL), 1, timer_loop, ())
publish()
timer_loop()
s.run()
umtrx.close()

View File

@@ -12,16 +12,22 @@ if [ "$#" -lt "1" ] ; then
echo " - Tx DC offset calibration"
echo " - Tx IQ balance calibration"
echo
echo "The result of the calibration is stored in the DIR/.uhd/cal/ directory. DIR is one of the \$APPDATA, \$HOME and /tmp,"
echo "whichever is defined. Make sure you run calibration from the same user as the one who runs applications or define"
echo "\$APPDATA or \$HOME appropriately. Calibration files will be loaded by the application automatically on startup."
echo "Old calibration files are renamed when you run a calibration to avoid overwriting."
echo "The result of the calibration is stored in the \$UHD_CONFIG_DIR/.uhd/cal/ directory."
echo "If \$UHD_CONFIG_DIR is undefined, /var/lib/umtrx is used instead."
echo "When running UHD applications, make sure you set one of \$UHD_CONFIG_DIR, \$APPDATA or \$HOME to the same directory,"
echo "so the calibration files could be found and autoloaded by the application on startup."
echo "Existing calibration files are renamed when you run a calibration to avoid overwriting."
echo
echo "Calibration is permanent and only depends on temperature. If the temperature of the system is stable, you need to"
echo "run the calibration only once."
exit 1
fi
if [ -z "$UHD_CONFIG_DIR" ]; then
export UHD_CONFIG_DIR=/var/lib/umtrx
fi
mkdir -p $UHD_CONFIG_DIR
presets=$*
sides="A B"

View File

@@ -18,6 +18,7 @@
#include "usrp_cal_utils.hpp"
#include <uhd/utils/safe_main.hpp>
#include <boost/ref.hpp>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <boost/math/special_functions/round.hpp>
@@ -342,8 +343,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
//create a transmitter thread
std::atomic<bool> interrupted(false);
boost::thread_group threads;
threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl));
threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl, boost::ref(interrupted)));
//store the results here
std::vector<result_t> results;
@@ -403,7 +405,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << std::endl;
//stop the transmitter
threads.interrupt_all();
interrupted = true;
threads.join_all();
if (not vm.count("single_test"))

View File

@@ -18,6 +18,7 @@
#include "usrp_cal_utils.hpp"
#include <uhd/utils/safe_main.hpp>
#include <boost/ref.hpp>
#include <boost/program_options.hpp>
#include <boost/math/special_functions/round.hpp>
#include <iostream>
@@ -83,8 +84,9 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
uhd::rx_streamer::sptr rx_stream = usrp->get_rx_stream(stream_args);
//create a transmitter thread
std::atomic<bool> interrupted(false);
boost::thread_group threads;
threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl));
threads.create_thread(boost::bind(&tx_thread, usrp, tx_wave_freq, tx_wave_ampl, boost::ref(interrupted)));
//re-usable buffer for samples
std::vector<samp_type> buff;
@@ -177,7 +179,7 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){
std::cout << std::endl;
//stop the transmitter
threads.interrupt_all();
interrupted = true;
threads.join_all();
store_results(usrp, results, "tx", "iq", vm.count("append"));

View File

@@ -18,7 +18,6 @@
#
import optparse
import math
import os
import re
import struct

View File

@@ -31,6 +31,7 @@
#include <complex>
#include <cmath>
#include <fstream>
#include <atomic>
namespace fs = boost::filesystem;
@@ -227,7 +228,7 @@ static void capture_samples(
/***********************************************************************
* Transmit thread
**********************************************************************/
static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_freq, const double tx_wave_ampl){
static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_freq, const double tx_wave_ampl, std::atomic<bool> &interrupted){
uhd::set_thread_priority_safe();
//create a transmit streamer
@@ -246,7 +247,7 @@ static void tx_thread(uhd::usrp::multi_usrp::sptr usrp, const double tx_wave_fre
wave_table table(tx_wave_ampl);
//fill buff and send until interrupted
while (not boost::this_thread::interruption_requested()){
while (not interrupted){
for (size_t i = 0; i < buff.size(); i++){
buff[i] = table(index += step);
}