diff --git a/testPowerSensor.cc b/testPowerSensor.cc deleted file mode 100644 index a992c4c4c946d982a5430f3f5d59b1b519b58fe0..0000000000000000000000000000000000000000 --- a/testPowerSensor.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2016 -// ASTRON (Netherlands Institute for Radio Astronomy) / John W. Romein -// P.O. Box 2, 7990 AA Dwingeloo, the Netherlands - -// This file is part of PowerSensor. - -// PowerSensor is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// PowerSensor is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with PowerSensor. If not, see <http://www.gnu.org/licenses/>. - - -#include <iostream> -#include <iomanip> -#include "PowerSensor.h" - -#include <cstdlib> -#include <iostream> - -#include <inttypes.h> -#include <unistd.h> - -#define MAX_MICRO_SECONDS 4000000 - - -int main(int argc, char **argv) -{ - if (argc > 2) { - std::cerr << "usage: " << argv[0] << " [device]" << std::endl; - exit(1); - } - - const char *device = argc == 2 ? argv[1] : "/dev/ttyUSB0"; - PowerSensor powerSensor(device, "/tmp/sensor_values"); - - PowerSensor::State states[2]; - states[0] = powerSensor.read(); - - for (uint32_t micros = 100, i = 1; micros <= MAX_MICRO_SECONDS; micros *= 2, i ^= 1) { - usleep(micros); - states[i] = powerSensor.read(); - - std::cout << "exp. time: " << micros * 1e-6 << " s, " - "measured: " << PowerSensor::seconds(states[i ^ 1], states[i]) << " s, " << - PowerSensor::Joules(states[i ^ 1], states[i]) << " J, " << - PowerSensor::Watt(states[i ^ 1], states[i]) << " W" << - std::endl; - } - - return 0; -}