Merge branch 'master' into DeviceInterface
This commit is contained in:
commit
d9b4da3a8f
@ -23,6 +23,9 @@
|
|||||||
- made USB communication more robust
|
- made USB communication more robust
|
||||||
- PLL locking issue fixed
|
- PLL locking issue fixed
|
||||||
|
|
||||||
|
## v1.4.1
|
||||||
|
- Bugfix: Configure voltage regulator for correct voltage at startup
|
||||||
|
|
||||||
## v1.4.0
|
## v1.4.0
|
||||||
|
|
||||||
- New features:
|
- New features:
|
||||||
|
@ -603,6 +603,11 @@ void Calibration::edit()
|
|||||||
std::set<CalibrationMeasurement::Base*> m;
|
std::set<CalibrationMeasurement::Base*> m;
|
||||||
auto selected = ui->table->selectionModel()->selectedRows();
|
auto selected = ui->table->selectionModel()->selectedRows();
|
||||||
for(auto s : selected) {
|
for(auto s : selected) {
|
||||||
|
auto meas = measurements[s.row()];
|
||||||
|
if(!meas->readyForMeasurement()) {
|
||||||
|
InformationBox::ShowError("Unable to measure", CalibrationMeasurement::Base::TypeToString(meas->getType())+" measurement is not ready, please check that a valid calibration standard is selected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
m.insert(measurements[s.row()]);
|
m.insert(measurements[s.row()]);
|
||||||
}
|
}
|
||||||
if(!CalibrationMeasurement::Base::canMeasureSimultaneously(m)) {
|
if(!CalibrationMeasurement::Base::canMeasureSimultaneously(m)) {
|
||||||
@ -1656,7 +1661,7 @@ bool Calibration::canCompute(Calibration::CalType type, double *startFreq, doubl
|
|||||||
// missing measurement
|
// missing measurement
|
||||||
return false;
|
return false;
|
||||||
} else if (!meas->readyForCalculation()){
|
} else if (!meas->readyForCalculation()){
|
||||||
// measurement not ready (either not calkit standard definded or no measurements
|
// measurement not ready (either not calkit standard definded or no measurements)
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
foundMeasurements.push_back(meas);
|
foundMeasurements.push_back(meas);
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual double minFreq() = 0;
|
virtual double minFreq() = 0;
|
||||||
virtual double maxFreq() = 0;
|
virtual double maxFreq() = 0;
|
||||||
virtual unsigned int numPoints() = 0;
|
virtual unsigned int numPoints() = 0;
|
||||||
|
virtual bool readyForMeasurement() {return false;}
|
||||||
virtual bool readyForCalculation() {return false;}
|
virtual bool readyForCalculation() {return false;}
|
||||||
|
|
||||||
static std::vector<Type> availableTypes();
|
static std::vector<Type> availableTypes();
|
||||||
@ -80,6 +81,7 @@ public:
|
|||||||
virtual double minFreq() override;
|
virtual double minFreq() override;
|
||||||
virtual double maxFreq() override;
|
virtual double maxFreq() override;
|
||||||
virtual unsigned int numPoints() override {return points.size();}
|
virtual unsigned int numPoints() override {return points.size();}
|
||||||
|
virtual bool readyForMeasurement() override {return standard != nullptr;}
|
||||||
virtual bool readyForCalculation() override {return standard && points.size() > 0;}
|
virtual bool readyForCalculation() override {return standard && points.size() > 0;}
|
||||||
|
|
||||||
virtual void clearPoints() override;
|
virtual void clearPoints() override;
|
||||||
@ -194,6 +196,7 @@ public:
|
|||||||
virtual double minFreq() override;
|
virtual double minFreq() override;
|
||||||
virtual double maxFreq() override;
|
virtual double maxFreq() override;
|
||||||
virtual unsigned int numPoints() override {return points.size();}
|
virtual unsigned int numPoints() override {return points.size();}
|
||||||
|
virtual bool readyForMeasurement() override {return standard != nullptr;}
|
||||||
virtual bool readyForCalculation() override {return standard && points.size() > 0;}
|
virtual bool readyForCalculation() override {return standard && points.size() > 0;}
|
||||||
|
|
||||||
virtual void clearPoints() override;
|
virtual void clearPoints() override;
|
||||||
@ -265,6 +268,7 @@ public:
|
|||||||
virtual double minFreq() override;
|
virtual double minFreq() override;
|
||||||
virtual double maxFreq() override;
|
virtual double maxFreq() override;
|
||||||
virtual unsigned int numPoints() override;
|
virtual unsigned int numPoints() override;
|
||||||
|
virtual bool readyForMeasurement() override {return true;}
|
||||||
virtual bool readyForCalculation() override {return points.size() > 0;}
|
virtual bool readyForCalculation() override {return points.size() > 0;}
|
||||||
|
|
||||||
virtual void clearPoints() override;
|
virtual void clearPoints() override;
|
||||||
|
@ -120,7 +120,7 @@ void OnePort::clearMeasurement()
|
|||||||
delete touchstone;
|
delete touchstone;
|
||||||
touchstone = nullptr;
|
touchstone = nullptr;
|
||||||
minFreq = std::numeric_limits<double>::lowest();
|
minFreq = std::numeric_limits<double>::lowest();
|
||||||
minFreq = std::numeric_limits<double>::max();
|
maxFreq = std::numeric_limits<double>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json OnePort::toJSON()
|
nlohmann::json OnePort::toJSON()
|
||||||
@ -538,7 +538,7 @@ void TwoPort::clearMeasurement()
|
|||||||
delete touchstone;
|
delete touchstone;
|
||||||
touchstone = nullptr;
|
touchstone = nullptr;
|
||||||
minFreq = std::numeric_limits<double>::lowest();
|
minFreq = std::numeric_limits<double>::lowest();
|
||||||
minFreq = std::numeric_limits<double>::max();
|
maxFreq = std::numeric_limits<double>::max();
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json TwoPort::toJSON()
|
nlohmann::json TwoPort::toJSON()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "touchstone.h"
|
#include "touchstone.h"
|
||||||
|
|
||||||
#include "Util/util.h"
|
#include "Util/util.h"
|
||||||
|
#include "unit.h"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -162,14 +163,16 @@ Touchstone Touchstone::fromFile(string filename)
|
|||||||
Datapoint point;
|
Datapoint point;
|
||||||
|
|
||||||
string line;
|
string line;
|
||||||
|
unsigned int lineCnt = 0;
|
||||||
while(getline(file, line)) {
|
while(getline(file, line)) {
|
||||||
|
lineCnt++;
|
||||||
// remove comments
|
// remove comments
|
||||||
auto comment = line.find_first_of('!');
|
auto comment = line.find_first_of('!');
|
||||||
if(comment != string::npos) {
|
if(comment != string::npos) {
|
||||||
line.erase(comment);
|
line.erase(comment);
|
||||||
}
|
}
|
||||||
// remove leading whitespace
|
// remove leading whitespace
|
||||||
size_t first = line.find_first_not_of(" \t");
|
size_t first = line.find_first_not_of(" \t\r\n");
|
||||||
if (string::npos == first) {
|
if (string::npos == first) {
|
||||||
// string does only contain whitespace, skip line
|
// string does only contain whitespace, skip line
|
||||||
continue;
|
continue;
|
||||||
@ -231,10 +234,11 @@ Touchstone Touchstone::fromFile(string filename)
|
|||||||
if(!option_line_found) {
|
if(!option_line_found) {
|
||||||
throw runtime_error("First dataline before option line");
|
throw runtime_error("First dataline before option line");
|
||||||
}
|
}
|
||||||
auto parseDatapoint = [format](istream &in) -> complex<double> {
|
auto parseDatapoint = [format, &point, &lineCnt](istream &in) -> complex<double> {
|
||||||
double part1, part2;
|
double part1, part2;
|
||||||
in >> part1;
|
if(!(in >> part1) || !(in >> part2)) {
|
||||||
in >> part2;
|
throw runtime_error("Failed to parse parameters on line "+std::to_string(lineCnt)+" with frequency "+Unit::ToString(point.frequency,"Hz", " kMG", 10).toStdString());
|
||||||
|
}
|
||||||
complex<double> ret;
|
complex<double> ret;
|
||||||
switch(format) {
|
switch(format) {
|
||||||
case Format::MagnitudeAngle:
|
case Format::MagnitudeAngle:
|
||||||
|
@ -110,13 +110,14 @@ int main(void)
|
|||||||
SystemClock_Config();
|
SystemClock_Config();
|
||||||
|
|
||||||
/* USER CODE BEGIN SysInit */
|
/* USER CODE BEGIN SysInit */
|
||||||
|
MX_I2C2_Init();
|
||||||
|
uint8_t ctrl = 0x0A;
|
||||||
|
HAL_I2C_Mem_Write(&hi2c2, 0x42, 0x01, I2C_MEMADD_SIZE_8BIT, &ctrl, 1, 100);
|
||||||
/* USER CODE END SysInit */
|
/* USER CODE END SysInit */
|
||||||
|
|
||||||
/* Initialize all configured peripherals */
|
/* Initialize all configured peripherals */
|
||||||
MX_GPIO_Init();
|
MX_GPIO_Init();
|
||||||
MX_DMA_Init();
|
MX_DMA_Init();
|
||||||
MX_I2C2_Init();
|
|
||||||
MX_SPI1_Init();
|
MX_SPI1_Init();
|
||||||
MX_SPI2_Init();
|
MX_SPI2_Init();
|
||||||
MX_UCPD1_Init();
|
MX_UCPD1_Init();
|
||||||
|
Loading…
Reference in New Issue
Block a user