Introduction
Each API version includes the necessary firmware for all supported Squidstats to connect properly. When a new API is released, it may include updated firmware with new features or fixes. However, firmware updates are not automatic. They must be initiated manually. A Squidstat won’t connect to the API until its firmware is compatible. Once updated, the firmware stays on the device until another update is performed. No separate files or tools are needed, and updates are only required when the API version changes.
This page explains how to detect and handle outdated firmware.
- Note
- The latest Squidstat API and Squidstat User Interface should always have matching firmware versions for all devices. If switching between them requires a firmware update, please verify that you have both the latest SUI and API.
Checking for and Updating Outdated Firmware
If AisDeviceTracker::connectToDeviceOnComPort returns the AisErrorCode::FirmwareNotSupported error code, a firmware update is required to use the device with the API. Here is an example of how to update the firmware in this scenario.
- C++
#include "AisInstrumentHandler.h"
#include "AisDeviceTracker.h"
#include <QCoreApplication>
#include <QThread>
#include <QDebug>
#define COMPORT "COM1"
int main()
{
int args;
QCoreApplication a(args, nullptr);
qDebug() << message;
if (message.contains("firmware is updated.")) {
}
});
auto error = tracker->connectToDeviceOnComPort(COMPORT);
error = tracker->updateFirmwareOnComPort(COMPORT);
qDebug() << "Error: " << error.message();
}
qDebug() << "Error: " << error.message();
} else {
qDebug() << "Device firmware is up to date";
}
return a.exec();
}
- Python
import sys
from PySide6.QtWidgets import QApplication
from SquidstatPyLibrary import AisDeviceTracker
from SquidstatPyLibrary import AisInstrumentHandler
from SquidstatPyLibrary import AisErrorCode
COMPORT = "COM16"
app = QApplication()
def onProgressMessage(message):
print(message)
if message.__contains__("firmware is updated"):
app.quit()
tracker.firmwareUpdateNotification.connect(onProgressMessage)
error = tracker.connectToDeviceOnComPort(COMPORT)
if error.value() == AisErrorCode.FirmwareNotSupported:
error = tracker.updateFirmwareOnComPort(COMPORT)
if error.value() != AisErrorCode.Success:
print(f"Error: {error.message()}")
sys.exit()
elif error.value() != AisErrorCode.Success:
print(f"Error: {error.message()}")
sys.exit()
else:
print("Device is already up to date.")
sys.exit()
sys.exit(app.exec())
The AisDeviceTracker::firmwareUpdateNotification signal will display the progress of the firmware update as a percentage while the instrument is updating. Once the update is complete, this notification will send the message "Firmware is updated", signaling that the instrument can now be connected to the API.
- C++
qDebug() << message;
if (message.contains("firmware is updated.")) {
}
});
- Python
tracker.firmwareUpdateNotification.connect(onProgressMessage)
See the full example here
Note that we check the AisErrorCode first before performing the firmware update. Alternatively, you can use AisDeviceTracker::updateFirmwareOnAllAvailableDevices all connected devices that require an update.