mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-04 22:17:31 +00:00
Enforce amplitude cal point limit, SCPI command for reading trace data
This commit is contained in:
parent
611b1ef59d
commit
62939ff882
21 changed files with 342 additions and 116 deletions
|
|
@ -34,6 +34,10 @@ bool AmplitudeCal::Load() {
|
|||
LOG_WARN("Invalid version in flash, expected %u, got %u", version, cal.version);
|
||||
SetDefault();
|
||||
return false;
|
||||
} else if(cal.Source.usedPoints == 0 || cal.Receiver.usedPoints == 0){
|
||||
LOG_WARN("Empty amplitude calibration, resetting to default");
|
||||
SetDefault();
|
||||
return false;
|
||||
} else {
|
||||
LOG_INFO("Loaded from flash");
|
||||
return true;
|
||||
|
|
@ -128,7 +132,7 @@ static void addPoint(CorrectionTable& table, const Protocol::AmplitudeCorrection
|
|||
table.freq[p.pointNum] = p.freq;
|
||||
table.port1Correction[p.pointNum] = p.port1;
|
||||
table.port2Correction[p.pointNum] = p.port2;
|
||||
if(p.pointNum == p.totalPoints - 1) {
|
||||
if(p.pointNum == p.totalPoints - 1 || p.pointNum == AmplitudeCal::maxPoints - 1) {
|
||||
// this was the last point, update used points and save
|
||||
table.usedPoints = p.totalPoints;
|
||||
LOG_INFO("Last point received, saving to flash");
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ void App_Start() {
|
|||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
case Protocol::PacketType::RequestDeviceInfo:
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
Protocol::PacketInfo p;
|
||||
p.type = Protocol::PacketType::DeviceInfo;
|
||||
HW::fillDeviceInfo(&p.info);
|
||||
|
|
@ -189,16 +190,20 @@ void App_Start() {
|
|||
break;
|
||||
#endif
|
||||
case Protocol::PacketType::RequestSourceCal:
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
AmplitudeCal::SendSource();
|
||||
break;
|
||||
case Protocol::PacketType::RequestReceiverCal:
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
AmplitudeCal::SendReceiver();
|
||||
break;
|
||||
case Protocol::PacketType::SourceCalPoint:
|
||||
AmplitudeCal::AddSourcePoint(recv_packet.amplitudePoint);
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
case Protocol::PacketType::ReceiverCalPoint:
|
||||
AmplitudeCal::AddReceiverPoint(recv_packet.amplitudePoint);
|
||||
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||
break;
|
||||
default:
|
||||
// this packet type is not supported
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue