Merge branch 'master' into DeviceInterface
This commit is contained in:
commit
d9b4da3a8f
@ -23,6 +23,9 @@
|
||||
- made USB communication more robust
|
||||
- PLL locking issue fixed
|
||||
|
||||
## v1.4.1
|
||||
- Bugfix: Configure voltage regulator for correct voltage at startup
|
||||
|
||||
## v1.4.0
|
||||
|
||||
- New features:
|
||||
|
@ -603,6 +603,11 @@ void Calibration::edit()
|
||||
std::set<CalibrationMeasurement::Base*> m;
|
||||
auto selected = ui->table->selectionModel()->selectedRows();
|
||||
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()]);
|
||||
}
|
||||
if(!CalibrationMeasurement::Base::canMeasureSimultaneously(m)) {
|
||||
@ -1656,7 +1661,7 @@ bool Calibration::canCompute(Calibration::CalType type, double *startFreq, doubl
|
||||
// missing measurement
|
||||
return false;
|
||||
} 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;
|
||||
} else {
|
||||
foundMeasurements.push_back(meas);
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
virtual double minFreq() = 0;
|
||||
virtual double maxFreq() = 0;
|
||||
virtual unsigned int numPoints() = 0;
|
||||
virtual bool readyForMeasurement() {return false;}
|
||||
virtual bool readyForCalculation() {return false;}
|
||||
|
||||
static std::vector<Type> availableTypes();
|
||||
@ -80,6 +81,7 @@ public:
|
||||
virtual double minFreq() override;
|
||||
virtual double maxFreq() override;
|
||||
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 void clearPoints() override;
|
||||
@ -194,6 +196,7 @@ public:
|
||||
virtual double minFreq() override;
|
||||
virtual double maxFreq() override;
|
||||
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 void clearPoints() override;
|
||||
@ -265,6 +268,7 @@ public:
|
||||
virtual double minFreq() override;
|
||||
virtual double maxFreq() override;
|
||||
virtual unsigned int numPoints() override;
|
||||
virtual bool readyForMeasurement() override {return true;}
|
||||
virtual bool readyForCalculation() override {return points.size() > 0;}
|
||||
|
||||
virtual void clearPoints() override;
|
||||
|
@ -120,7 +120,7 @@ void OnePort::clearMeasurement()
|
||||
delete touchstone;
|
||||
touchstone = nullptr;
|
||||
minFreq = std::numeric_limits<double>::lowest();
|
||||
minFreq = std::numeric_limits<double>::max();
|
||||
maxFreq = std::numeric_limits<double>::max();
|
||||
}
|
||||
|
||||
nlohmann::json OnePort::toJSON()
|
||||
@ -538,7 +538,7 @@ void TwoPort::clearMeasurement()
|
||||
delete touchstone;
|
||||
touchstone = nullptr;
|
||||
minFreq = std::numeric_limits<double>::lowest();
|
||||
minFreq = std::numeric_limits<double>::max();
|
||||
maxFreq = std::numeric_limits<double>::max();
|
||||
}
|
||||
|
||||
nlohmann::json TwoPort::toJSON()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "touchstone.h"
|
||||
|
||||
#include "Util/util.h"
|
||||
#include "unit.h"
|
||||
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
@ -162,14 +163,16 @@ Touchstone Touchstone::fromFile(string filename)
|
||||
Datapoint point;
|
||||
|
||||
string line;
|
||||
unsigned int lineCnt = 0;
|
||||
while(getline(file, line)) {
|
||||
lineCnt++;
|
||||
// remove comments
|
||||
auto comment = line.find_first_of('!');
|
||||
if(comment != string::npos) {
|
||||
line.erase(comment);
|
||||
}
|
||||
// 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) {
|
||||
// string does only contain whitespace, skip line
|
||||
continue;
|
||||
@ -231,10 +234,11 @@ Touchstone Touchstone::fromFile(string filename)
|
||||
if(!option_line_found) {
|
||||
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;
|
||||
in >> part1;
|
||||
in >> part2;
|
||||
if(!(in >> part1) || !(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;
|
||||
switch(format) {
|
||||
case Format::MagnitudeAngle:
|
||||
|
@ -110,13 +110,14 @@ int main(void)
|
||||
SystemClock_Config();
|
||||
|
||||
/* 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 */
|
||||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_I2C2_Init();
|
||||
MX_SPI1_Init();
|
||||
MX_SPI2_Init();
|
||||
MX_UCPD1_Init();
|
||||
|
Loading…
Reference in New Issue
Block a user