Decoder: Allow older ResetStatus packets without voltage or temperature
parent
27184a203f
commit
68715d515d
|
|
@ -91,7 +91,8 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
||||||
case Network::Type::Internal: {
|
case Network::Type::Internal: {
|
||||||
switch(packet->network.getNetID()) {
|
switch(packet->network.getNetID()) {
|
||||||
case Network::NetID::Reset_Status: {
|
case Network::NetID::Reset_Status: {
|
||||||
if(packet->data.size() < sizeof(HardwareResetStatusPacket)) {
|
// We can deal with not having the last two fields (voltage and temperature)
|
||||||
|
if(packet->data.size() < (sizeof(HardwareResetStatusPacket) - (sizeof(uint16_t) * 2))) {
|
||||||
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
report(APIEvent::Type::PacketDecodingError, APIEvent::Severity::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -101,8 +102,6 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
||||||
msg->network = packet->network;
|
msg->network = packet->network;
|
||||||
msg->mainLoopTime = data->main_loop_time_25ns * 25;
|
msg->mainLoopTime = data->main_loop_time_25ns * 25;
|
||||||
msg->maxMainLoopTime = data->max_main_loop_time_25ns * 25;
|
msg->maxMainLoopTime = data->max_main_loop_time_25ns * 25;
|
||||||
msg->busVoltage = data->busVoltage;
|
|
||||||
msg->deviceTemperature = data->deviceTemperature;
|
|
||||||
msg->justReset = data->status.just_reset;
|
msg->justReset = data->status.just_reset;
|
||||||
msg->comEnabled = data->status.com_enabled;
|
msg->comEnabled = data->status.com_enabled;
|
||||||
msg->cmRunning = data->status.cm_is_running;
|
msg->cmRunning = data->status.cm_is_running;
|
||||||
|
|
@ -116,6 +115,10 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
||||||
msg->cmTooBig = data->status.cm_too_big;
|
msg->cmTooBig = data->status.cm_too_big;
|
||||||
msg->hidUsbState = data->status.hidUsbState;
|
msg->hidUsbState = data->status.hidUsbState;
|
||||||
msg->fpgaUsbState = data->status.fpgaUsbState;
|
msg->fpgaUsbState = data->status.fpgaUsbState;
|
||||||
|
if(packet->data.size() >= sizeof(HardwareResetStatusPacket)) {
|
||||||
|
msg->busVoltage = data->busVoltage;
|
||||||
|
msg->deviceTemperature = data->deviceTemperature;
|
||||||
|
}
|
||||||
result = msg;
|
result = msg;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "icsneo/communication/message/main51message.h"
|
#include "icsneo/communication/message/main51message.h"
|
||||||
#include "icsneo/communication/command.h"
|
#include "icsneo/communication/command.h"
|
||||||
|
#include "icsneo/platform/optional.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace icsneo {
|
namespace icsneo {
|
||||||
|
|
@ -28,8 +29,8 @@ public:
|
||||||
bool cmTooBig;
|
bool cmTooBig;
|
||||||
bool hidUsbState;
|
bool hidUsbState;
|
||||||
bool fpgaUsbState;
|
bool fpgaUsbState;
|
||||||
uint16_t busVoltage;
|
icsneo::optional<uint16_t> busVoltage;
|
||||||
uint16_t deviceTemperature;
|
icsneo::optional<uint16_t> deviceTemperature;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue