Skip to content

Commit

Permalink
Merge branch 'main' of github.com:jankae/LibreCAL
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Apr 17, 2023
2 parents 46b574c + 45bdd7c commit 2ba9c7f
Show file tree
Hide file tree
Showing 24 changed files with 1,314 additions and 121 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
PC_Application_Ubuntu:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Install dependencies
run: |
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Get build timestamp
id: id_date
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT

- name: Get app version
id: id_version
Expand All @@ -30,7 +30,7 @@ jobs:
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
echo "app_version=v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build application
run: |
Expand All @@ -42,19 +42,19 @@ jobs:
- name: Upload artifact
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: LibreCAL-GUI-Ubuntu-${{env.LIBRECAL_VERSION}}
path: Software/LibreCAL-GUI/LibreCAL-GUI

PC_Application_Windows:
runs-on: windows-2019
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2

- name: Install Qt
uses: jurplel/install-qt-action@v2
uses: jurplel/install-qt-action@v3
with:
version: '5.15.1'
arch: 'win64_mingw81'
Expand All @@ -71,7 +71,7 @@ jobs:
- name: Get build timestamp
shell: msys2 {0}
id: id_date
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT

- name: Get app version
id: id_version
Expand All @@ -81,7 +81,7 @@ jobs:
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
echo "app_version=v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build application
run: |
Expand All @@ -102,7 +102,7 @@ jobs:
shell: cmd

- name: Upload
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
with:
Expand All @@ -112,7 +112,7 @@ jobs:
PC_Application_OSX:
runs-on: macos-10.15
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Install dependencies
run: |
Expand All @@ -124,7 +124,7 @@ jobs:
- name: Get build timestamp
id: id_date
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT

- name: Get app version
id: id_version
Expand All @@ -133,8 +133,8 @@ jobs:
fw_major=`pcregrep -o '(?<=FW_MAJOR=)[0-9]+' LibreCAL-GUI.pro`
fw_minor=`pcregrep -o '(?<=FW_MINOR=)[0-9]+' LibreCAL-GUI.pro`
fw_patch=`pcregrep -o '(?<=FW_PATCH=)[0-9]+' LibreCAL-GUI.pro`
echo "::set-output name=app_version::v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
echo "app_version=v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build application
run: |
cd Software/LibreCAL-GUI
Expand All @@ -147,28 +147,29 @@ jobs:
- name: Upload artifact
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: LibreCAL-GUI-OSX-${{env.LIBRECAL_VERSION}}
path: Software/LibreCAL-GUI/LibreCAL-GUI.zip

Embedded_Firmware:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: Install toolchain
run: |
sudo apt-get update
sudo apt install -y build-essential gcc-arm-none-eabi binutils-arm-none-eabi
sudo git clone https://github.com/raspberrypi/pico-sdk.git /opt/pico-sdk
sudo git -C /opt/pico-sdk checkout 1.4.0
sudo git -C /opt/pico-sdk submodule update --init
echo 'export PICO_SDK_PATH=/opt/pico-sdk' | sudo tee -a /etc/profile.d/pico-sdk.sh
source /etc/profile
- name: Get build timestamp
id: id_date
run: echo "::set-output name=timestamp::$(date +%Y-%m-%d-%H-%M-%S)"
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M-%S)" >> $GITHUB_OUTPUT

- name: Get app version
id: id_version
Expand All @@ -177,7 +178,7 @@ jobs:
fw_major=`grep -oP '(?<=FW_MAJOR=)[0-9]+' CMakeLists.txt`
fw_minor=`grep -oP '(?<=FW_MINOR=)[0-9]+' CMakeLists.txt`
fw_patch=`grep -oP '(?<=FW_PATCH=)[0-9]+' CMakeLists.txt`
echo "::set-output name=app_version::-v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}"
echo "app_version=v$fw_major.$fw_minor.$fw_patch-${{steps.id_date.outputs.timestamp}}" >> $GITHUB_OUTPUT
- name: Build application
run: |
Expand All @@ -190,7 +191,7 @@ jobs:
shell: bash

- name: Upload
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
env:
LIBRECAL_VERSION: "${{steps.id_version.outputs.app_version}}"
with:
Expand Down
3 changes: 3 additions & 0 deletions Software/.gitignore → .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/.metadata/
/LibreCAL-Eclipse-build/
/LibreCAL-GUI/build-*
Software/build-*
Software/.metadata/


Binary file modified Documentation/SCPI_API.pdf
Binary file not shown.
17 changes: 16 additions & 1 deletion Documentation/SCPI_API.tex
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ \subsubsection{:BOOTloader}
\event{Reboots and enters the bootloader mode}{:BOOTloader}{None}
This is equivalent to pressing the "BOOTSEL" button when applying power.

\subsubsection{:DATE\_TIME}
\event{Sets local Date Time with UTC offset}{:DATE\_TIME <DATE> <TIME> <UTC>}{<DATE>Format YYYY/MM/DD\\<TIME>Format hh:mm:ss\\<UTC>Format UTC+/-hh:mm}
\query{Returns the local Date Time with UTC offset}{:DATE\_TIME?}{NONE}{local Date Time with UTC offset}

Example: Date Time with UTC offset(France):
\begin{lstlisting}
2023/03/20 17:06:58 UTC+01:00
\end{lstlisting}

\subsection{Port Control Commands}
This section contains commands to control and check the configuration of the ports.
\subsubsection{:PORTS}
Expand Down Expand Up @@ -202,7 +211,13 @@ \subsubsection{:COEFFicient:CREATE}
\event{Creates a new calibration coefficient}{:COEFFicient:CREATE <set name> <coefficient name>}{<set name> Name of the coefficient set\\<coefficient name> Name of the coefficient}
If the coefficient already exists, it will be deleted first (along with all its coefficient data). Afterwards, a new and empty coefficient will be created.

This command should be used in conjunction with :COEFFicient:ADD and :COEFFicient:FINish.
This command should be used in conjunction with :COEFFicient:ADD\_COMMENT, :COEFFicient:ADD and :COEFFicient:FINish.
\subsubsection{:COEFFicient:ADD\_COMMENT}
\event{Add ASCII text comment before to add coefficient datapoint}{:COEFFicient:ADD\_COMMENT <ASCII text comment>}{<ASCII text comment> add an ASCII text comment with size up to 120chars\\if the comment exceed 120 characters it will be truncated to 120 characters}

This command should be used only after :COEFFicient:CREATE as it is intended to add comment before to add any datapoint (:COEFFicient:ADD).

There is a limitation of maximum 100 comments per calibration coefficient (:COEFFicient:CREATE)(if there is more comment the command will return an error and comment will be not added).
\subsubsection{:COEFFicient:ADD}
\event{Add a datapoint to an existing coefficient}{:COEFFicient:ADD <frequency> <S parameters>}{<frequency> Frequency of the datapoint, in GHz\\
<S parameters> S parameters, split into real and imaginary parts}
Expand Down
2 changes: 1 addition & 1 deletion Software/LibreCAL-GUI/LibreCAL-GUI.pro
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ windows{

REVISION = $$system(git rev-parse HEAD)
DEFINES += GITHASH=\\"\"$$REVISION\\"\"
DEFINES += FW_MAJOR=0 FW_MINOR=1 FW_PATCH=0 FW_SUFFIX=""#\\"\"-alpha.2\\"\"
DEFINES += FW_MAJOR=0 FW_MINOR=2 FW_PATCH=0 FW_SUFFIX=""#\\"\"-alpha.2\\"\"

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
Expand Down
73 changes: 59 additions & 14 deletions Software/LibreCAL-GUI/appwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ AppWindow::AppWindow() :

portCBs = {ui->port1, ui->port2, ui->port3, ui->port4};

progress = new QProgressDialog();
progress->setLabelText("Loading calibration coefficients from device...");
progress->setWindowTitle("Updating");
progress->setWindowModality(Qt::ApplicationModal);
progress->setMinimumDuration(0);
progress->setCancelButton(nullptr);
progress->reset();

// Set up the temperature chart
auto chart = new QChart();
ui->chartView->setChart(chart);
Expand Down Expand Up @@ -96,6 +104,18 @@ AppWindow::AppWindow() :
}
}

AppWindow::~AppWindow()
{
delete device;
delete progress;
delete deviceActionGroup;
delete status;
delete updateTimer;
delete tempSeries;
delete heaterSeries;
delete ui;
}

int AppWindow::UpdateDeviceList()
{
deviceActionGroup->setExclusive(true);
Expand Down Expand Up @@ -163,8 +183,19 @@ bool AppWindow::ConnectToDevice(QString serial)
}
}

status->setText("Connected to "+device->serial()+", firmware version "+device->getFirmware()+", "+QString::number(device->getNumPorts())+" ports");

QString LibreCAL_DateTimeUTC = device->getDateTimeUTC();
if(LibreCAL_DateTimeUTC.isEmpty())
{
status->setText("Connected to "+device->serial()+
", firmware version "+device->getFirmware()+
", "+QString::number(device->getNumPorts())+" ports");
}else
{
status->setText("Connected to "+device->serial()+
", firmware version "+device->getFirmware()+
", "+QString::number(device->getNumPorts())+" ports"+
", "+LibreCAL_DateTimeUTC);
}
for(int i=0;i<device->getNumPorts();i++) {
portCBs[i]->setEnabled(true);
for(auto s : CalDevice::availableStandards()) {
Expand Down Expand Up @@ -292,9 +323,28 @@ void AppWindow::updateStatus()
auto stable = device->stabilized();
if(!stable) {
ui->temperatureStatus->setStyleSheet("QLabel { color : red; }");
ui->temperatureStatus->setText("Temperature unstable, please wait before taking measurements");
QString date_time_utc = device->getDateTimeUTC();
QString temperature;
temperature = QString("Temperature %1°C (min=%2°C max=%3°C) unstable, please wait before taking measurements")
.arg(temp, 2, 'f', 2)
.arg(minTemp, 2, 'f', 2)
.arg(maxTemp, 2, 'f', 2);
if(!date_time_utc.isEmpty()) {
temperature = QString(date_time_utc+" "+temperature);
}
ui->temperatureStatus->setText(temperature);
} else {
ui->temperatureStatus->clear();
ui->temperatureStatus->setStyleSheet("QLabel { color : black; }");
QString date_time_utc = device->getDateTimeUTC();
QString temperature;
temperature = QString("Temperature %1°C (min=%2°C max=%3°C)")
.arg(temp, 2, 'f', 2)
.arg(minTemp, 2, 'f', 2)
.arg(maxTemp, 2, 'f', 2);
if(!date_time_utc.isEmpty()) {
temperature = QString(date_time_utc+" "+temperature);
}
ui->temperatureStatus->setText(temperature);
}
}
}
Expand All @@ -311,25 +361,20 @@ void AppWindow::loadCoefficients()
}
}
backgroundOperations = true;
auto d = new QProgressDialog();
d->setLabelText("Loading calibration coefficients from device...");
d->setWindowTitle("Updating");
d->setWindowModality(Qt::ApplicationModal);
d->setMinimumDuration(0);
connect(device, &CalDevice::updateCoefficientsPercent, d, &QProgressDialog::setValue);
connect(device, &CalDevice::updateCoefficientsDone, d, [=](){
progress->setValue(0);
connect(device, &CalDevice::updateCoefficientsPercent, progress, &QProgressDialog::setValue, Qt::UniqueConnection);
connect(device, &CalDevice::updateCoefficientsDone, this, [=](){
ui->saveCoefficients->setEnabled(false);
backgroundOperations = false;
d->accept();
delete d;
progress->reset();

ui->coeffList->clear();
for(auto set : device->getCoefficientSets()) {
ui->coeffList->addItem(set.name);
}
ui->coeffList->setCurrentRow(0);
});
d->show();
progress->show();
device->loadCoefficientSets();
}

Expand Down
3 changes: 3 additions & 0 deletions Software/LibreCAL-GUI/appwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class AppWindow : public QMainWindow
Q_OBJECT
public:
AppWindow();
~AppWindow();

private slots:
int UpdateDeviceList();
Expand All @@ -40,6 +41,8 @@ private slots:
QActionGroup *deviceActionGroup;
QLabel *status;

QProgressDialog *progress;

std::array<QComboBox*, 4> portCBs;

QTimer *updateTimer;
Expand Down
Loading

0 comments on commit 2ba9c7f

Please sign in to comment.