Merge branch 'master' into v0.3.0-dev
commit
5f44986c1b
|
|
@ -870,27 +870,33 @@ int LegacyDLLExport icsneoGetDeviceSettingsType(void *hObject, EPlasmaIonVnetCha
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int LegacyDLLExport icsneoSetDeviceSettings(void *hObject, SDeviceSettings *pSettings, int iNumBytes, int bSaveToEEPROM, EPlasmaIonVnetChannel_t vnetSlot)
|
int LegacyDLLExport icsneoSetDeviceSettings(void* hObject, SDeviceSettings* pSettings, int iNumBytes, int bSaveToEEPROM, EPlasmaIonVnetChannel_t vnetSlot)
|
||||||
{
|
{
|
||||||
if (!icsneoValidateHObject(hObject))
|
if (!icsneoValidateHObject(hObject))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
neodevice_t *device = (neodevice_t *)hObject;
|
neodevice_t* device = (neodevice_t*)hObject;
|
||||||
|
|
||||||
|
const size_t offset = size_t(&pSettings->Settings) - size_t(pSettings);
|
||||||
|
|
||||||
if (bSaveToEEPROM)
|
if (bSaveToEEPROM)
|
||||||
return icsneo_settingsApplyStructure(device, pSettings, iNumBytes);
|
return icsneo_settingsApplyStructure(device, &pSettings->Settings, iNumBytes - offset);
|
||||||
|
else
|
||||||
return icsneo_settingsApplyStructureTemporary(device, pSettings, iNumBytes);
|
return icsneo_settingsApplyStructureTemporary(device, &pSettings->Settings, iNumBytes - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LegacyDLLExport icsneoGetDeviceSettings(void *hObject, SDeviceSettings *pSettings, int iNumBytes, EPlasmaIonVnetChannel_t vnetSlot)
|
int LegacyDLLExport icsneoGetDeviceSettings(void* hObject, SDeviceSettings* pSettings, int iNumBytes, EPlasmaIonVnetChannel_t vnetSlot)
|
||||||
{
|
{
|
||||||
if (!icsneoValidateHObject(hObject))
|
if (!icsneoValidateHObject(hObject))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
neodevice_t *device = (neodevice_t *)hObject;
|
neodevice_t* device = (neodevice_t*)hObject;
|
||||||
|
|
||||||
return !!icsneo_settingsReadStructure(device, pSettings, iNumBytes);
|
if (icsneoGetDeviceSettingsType(hObject, vnetSlot, &pSettings->DeviceSettingType) == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const size_t offset = size_t(&pSettings->Settings) - size_t(pSettings);
|
||||||
|
return !!icsneo_settingsReadStructure(device, &pSettings->Settings, iNumBytes - offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LegacyDLLExport icsneoSetBitRateEx(void *hObject, unsigned long BitRate, int NetworkID, int iOptions)
|
int LegacyDLLExport icsneoSetBitRateEx(void *hObject, unsigned long BitRate, int NetworkID, int iOptions)
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,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;
|
||||||
}
|
}
|
||||||
|
|
@ -124,8 +125,6 @@ bool Decoder::decode(std::shared_ptr<Message>& result, const std::shared_ptr<Pac
|
||||||
auto msg = std::make_shared<ResetStatusMessage>();
|
auto msg = std::make_shared<ResetStatusMessage>();
|
||||||
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;
|
||||||
|
|
@ -139,6 +138,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include "icsneo/platform/tchar.h"
|
#include "icsneo/platform/tchar.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
typedef uint8_t byte; // Typedef helper for the following include
|
typedef uint8_t byte; // Typedef helper for the following include
|
||||||
#include "icsneo/icsnVC40.h" // Definitions for structs
|
#include "icsneo/icsnVC40.h" // Definitions for structs
|
||||||
|
|
||||||
|
|
@ -166,4 +167,4 @@ extern int LegacyDLLExport icsneoDisableBitSmash(void* hObject, unsigned int res
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue