2022-10-20 10:32:17 +02:00
|
|
|
#include <commonConfig.h>
|
|
|
|
#include <fsfw/datapool/PoolEntry.h>
|
2021-03-21 17:35:14 +01:00
|
|
|
#include <fsfw/datapool/PoolReadGuard.h>
|
2022-10-20 10:32:17 +02:00
|
|
|
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
|
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.h>
|
|
|
|
#include <fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h>
|
|
|
|
#include <fsfw/datapoollocal/localPoolDefinitions.h>
|
|
|
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
2023-02-19 12:25:26 +01:00
|
|
|
#include <fsfw/globalfunctions/arrayprinter.h>
|
2022-10-20 10:32:17 +02:00
|
|
|
#include <fsfw/ipc/MutexFactory.h>
|
|
|
|
#include <fsfw/ipc/MutexGuard.h>
|
|
|
|
#include <fsfw/ipc/messageQueueDefinitions.h>
|
|
|
|
#include <fsfw/modes/ModeMessage.h>
|
|
|
|
#include <fsfw/objectmanager/SystemObjectIF.h>
|
|
|
|
#include <fsfw/power/definitions.h>
|
|
|
|
#include <fsfw/returnvalues/returnvalue.h>
|
2022-10-19 19:08:36 +02:00
|
|
|
#include <fsfw/serialize/SerializeAdapter.h>
|
2022-10-20 10:32:17 +02:00
|
|
|
#include <fsfw/serialize/SerializeIF.h>
|
|
|
|
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
|
|
|
#include <fsfw/tasks/TaskFactory.h>
|
|
|
|
#include <fsfw/timemanager/Countdown.h>
|
|
|
|
#include <fsfw/timemanager/clockDefinitions.h>
|
2023-03-24 20:50:33 +01:00
|
|
|
#include <mission/acs/ImtqHandler.h>
|
2021-05-17 16:37:29 +02:00
|
|
|
|
2022-01-27 15:29:58 +01:00
|
|
|
#include <cmath>
|
2022-10-20 10:32:17 +02:00
|
|
|
#include <fsfw/datapoollocal/LocalPoolVariable.tpp>
|
2022-01-27 16:04:45 +01:00
|
|
|
|
2023-01-27 18:38:36 +01:00
|
|
|
#include "mission/config/torquer.h"
|
2022-10-19 18:52:16 +02:00
|
|
|
|
2022-10-20 16:09:18 +02:00
|
|
|
static constexpr bool ACTUATION_WIRETAPPING = false;
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ImtqHandler::ImtqHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie,
|
2023-03-26 15:28:00 +02:00
|
|
|
power::Switch_t pwrSwitcher, bool enableHkSets)
|
2022-01-18 11:41:19 +01:00
|
|
|
: DeviceHandlerBase(objectId, comIF, comCookie),
|
2023-03-26 15:28:00 +02:00
|
|
|
enableHkSets(enableHkSets),
|
2023-02-19 12:25:26 +01:00
|
|
|
statusSet(this),
|
2022-10-19 15:36:57 +02:00
|
|
|
dipoleSet(*this),
|
2023-02-19 12:25:26 +01:00
|
|
|
rawMtmNoTorque(this),
|
|
|
|
hkDatasetNoTorque(this),
|
|
|
|
rawMtmWithTorque(this),
|
|
|
|
hkDatasetWithTorque(this),
|
|
|
|
calMtmMeasurementSet(this),
|
2022-01-18 11:41:19 +01:00
|
|
|
posXselfTestDataset(this),
|
|
|
|
negXselfTestDataset(this),
|
|
|
|
posYselfTestDataset(this),
|
|
|
|
negYselfTestDataset(this),
|
|
|
|
posZselfTestDataset(this),
|
2022-04-15 01:42:00 +02:00
|
|
|
negZselfTestDataset(this),
|
|
|
|
switcher(pwrSwitcher) {
|
|
|
|
if (comCookie == nullptr) {
|
2022-01-18 11:41:19 +01:00
|
|
|
sif::error << "IMTQHandler: Invalid com cookie" << std::endl;
|
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2023-02-20 19:35:36 +01:00
|
|
|
ReturnValue_t ImtqHandler::performOperation(uint8_t opCode) {
|
|
|
|
uint8_t dhbOpCode = DeviceHandlerIF::PERFORM_OPERATION;
|
2023-03-04 14:32:18 +01:00
|
|
|
auto actuateStep = [&]() {
|
|
|
|
if (ignoreActForRestOfComSteps) {
|
|
|
|
requestStep = imtq::RequestType::DO_NOTHING;
|
|
|
|
} else {
|
|
|
|
requestStep = imtq::RequestType::ACTUATE;
|
|
|
|
}
|
|
|
|
};
|
2023-02-20 19:35:36 +01:00
|
|
|
switch (static_cast<imtq::ComStep>(opCode)) {
|
|
|
|
case (imtq::ComStep::DHB_OP): {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::START_MEASURE_SEND): {
|
|
|
|
requestStep = imtq::RequestType::MEASURE_NO_ACTUATION;
|
|
|
|
dhbOpCode = DeviceHandlerIF::SEND_WRITE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::START_MEASURE_GET): {
|
|
|
|
requestStep = imtq::RequestType::MEASURE_NO_ACTUATION;
|
|
|
|
dhbOpCode = DeviceHandlerIF::GET_WRITE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::READ_MEASURE_SEND): {
|
|
|
|
requestStep = imtq::RequestType::MEASURE_NO_ACTUATION;
|
|
|
|
dhbOpCode = DeviceHandlerIF::SEND_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::READ_MEASURE_GET): {
|
|
|
|
requestStep = imtq::RequestType::MEASURE_NO_ACTUATION;
|
|
|
|
dhbOpCode = DeviceHandlerIF::GET_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::START_ACTUATE_SEND): {
|
2023-03-04 14:32:18 +01:00
|
|
|
if (manualTorqueCmdActive) {
|
|
|
|
if (manuallyCommandedTorqueDuration.isBusy()) {
|
|
|
|
ignoreActForRestOfComSteps = true;
|
|
|
|
requestStep = imtq::RequestType::DO_NOTHING;
|
|
|
|
} else {
|
|
|
|
manualTorqueCmdActive = false;
|
|
|
|
PoolReadGuard pg(&dipoleSet);
|
|
|
|
dipoleSet.dipoles[0] = 0;
|
|
|
|
dipoleSet.dipoles[1] = 0;
|
|
|
|
dipoleSet.dipoles[2] = 0;
|
|
|
|
dipoleSet.currentTorqueDurationMs = 0;
|
|
|
|
requestStep = imtq::RequestType::ACTUATE;
|
|
|
|
ignoreActForRestOfComSteps = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
requestStep = imtq::RequestType::ACTUATE;
|
|
|
|
}
|
2023-02-20 19:35:36 +01:00
|
|
|
dhbOpCode = DeviceHandlerIF::SEND_WRITE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::START_ACTUATE_GET): {
|
2023-03-04 14:32:18 +01:00
|
|
|
actuateStep();
|
2023-02-20 19:35:36 +01:00
|
|
|
dhbOpCode = DeviceHandlerIF::GET_WRITE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::READ_ACTUATE_SEND): {
|
2023-03-04 14:32:18 +01:00
|
|
|
actuateStep();
|
2023-02-20 19:35:36 +01:00
|
|
|
dhbOpCode = DeviceHandlerIF::SEND_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case (imtq::ComStep::READ_ACTUATE_GET): {
|
2023-03-04 14:32:18 +01:00
|
|
|
actuateStep();
|
2023-02-20 19:35:36 +01:00
|
|
|
dhbOpCode = DeviceHandlerIF::GET_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
sif::error << "ImtqHandler: Unexpected COM step" << std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DeviceHandlerBase::performOperation(dhbOpCode);
|
|
|
|
}
|
|
|
|
|
2022-10-20 16:09:18 +02:00
|
|
|
ImtqHandler::~ImtqHandler() = default;
|
2022-01-18 11:41:19 +01:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::doStartUp() {
|
2023-03-06 09:17:03 +01:00
|
|
|
if (internalState != InternalState::STARTUP) {
|
|
|
|
commandExecuted = false;
|
|
|
|
updatePeriodicReply(true, imtq::cmdIds::REPLY_NO_TORQUE);
|
|
|
|
updatePeriodicReply(true, imtq::cmdIds::REPLY_WITH_TORQUE);
|
|
|
|
internalState = InternalState::STARTUP;
|
|
|
|
}
|
|
|
|
if (internalState == InternalState::STARTUP) {
|
|
|
|
if (commandExecuted) {
|
|
|
|
if (goToNormalMode) {
|
|
|
|
setMode(MODE_NORMAL);
|
|
|
|
} else {
|
|
|
|
setMode(_MODE_TO_ON);
|
|
|
|
}
|
2023-03-06 11:02:56 +01:00
|
|
|
commandExecuted = false;
|
2023-03-06 09:17:03 +01:00
|
|
|
}
|
2022-01-27 15:29:58 +01:00
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
void ImtqHandler::doShutDown() {
|
2023-04-03 15:16:53 +02:00
|
|
|
if (internalState != InternalState::SHUTDOWN) {
|
|
|
|
commandExecuted = false;
|
|
|
|
internalState = InternalState::SHUTDOWN;
|
|
|
|
}
|
|
|
|
if (internalState == InternalState::SHUTDOWN and commandExecuted) {
|
|
|
|
updatePeriodicReply(false, imtq::cmdIds::REPLY_NO_TORQUE);
|
|
|
|
updatePeriodicReply(false, imtq::cmdIds::REPLY_WITH_TORQUE);
|
|
|
|
specialRequestActive = false;
|
|
|
|
firstReplyCycle = true;
|
|
|
|
internalState = InternalState::NONE;
|
|
|
|
commandExecuted = false;
|
|
|
|
statusSet.setValidity(false, true);
|
|
|
|
rawMtmNoTorque.setValidity(false, true);
|
|
|
|
rawMtmWithTorque.setValidity(false, true);
|
|
|
|
hkDatasetNoTorque.setValidity(false, true);
|
|
|
|
hkDatasetWithTorque.setValidity(false, true);
|
|
|
|
calMtmMeasurementSet.setValidity(false, true);
|
|
|
|
setMode(_MODE_POWER_DOWN);
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
2023-02-19 12:25:26 +01:00
|
|
|
switch (requestStep) {
|
2023-02-20 19:35:36 +01:00
|
|
|
case (imtq::RequestType::MEASURE_NO_ACTUATION): {
|
2023-02-19 12:25:26 +01:00
|
|
|
*id = imtq::cmdIds::REQUEST;
|
|
|
|
return buildCommandFromCommand(*id, nullptr, 0);
|
|
|
|
}
|
|
|
|
case (imtq::RequestType::ACTUATE): {
|
|
|
|
*id = imtq::cmdIds::START_ACTUATION_DIPOLE;
|
|
|
|
return buildCommandFromCommand(*id, nullptr, 0);
|
2022-10-20 10:32:17 +02:00
|
|
|
}
|
2023-03-04 14:32:18 +01:00
|
|
|
default: {
|
2023-03-04 17:06:23 +01:00
|
|
|
*id = imtq::cmdIds::REQUEST;
|
2023-04-02 20:12:24 +02:00
|
|
|
request.requestType = imtq::RequestType::DO_NOTHING;
|
2023-03-04 17:06:23 +01:00
|
|
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
2023-03-06 11:02:56 +01:00
|
|
|
expectedReply = DeviceHandlerIF::NO_COMMAND_ID;
|
2023-03-04 17:06:23 +01:00
|
|
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
2023-03-06 09:17:03 +01:00
|
|
|
rawPacketLen = sizeof(imtq::Request);
|
2023-03-04 17:06:23 +01:00
|
|
|
return returnvalue::OK;
|
2023-03-04 14:32:18 +01:00
|
|
|
}
|
2022-10-20 15:08:33 +02:00
|
|
|
}
|
|
|
|
return NOTHING_TO_SEND;
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
2023-04-03 15:27:06 +02:00
|
|
|
if (internalState == InternalState::STARTUP or internalState == InternalState::SHUTDOWN) {
|
2023-03-06 11:02:56 +01:00
|
|
|
*id = imtq::cmdIds::REQUEST;
|
|
|
|
return buildCommandFromCommand(*id, nullptr, 0);
|
|
|
|
}
|
2022-05-24 19:08:00 +02:00
|
|
|
return NOTHING_TO_SEND;
|
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
2022-01-18 11:41:19 +01:00
|
|
|
const uint8_t* commandData,
|
|
|
|
size_t commandDataLen) {
|
2023-02-20 19:37:26 +01:00
|
|
|
auto genericSpecialRequest = [&](imtq::SpecialRequest specialRequest) {
|
2023-04-02 20:12:24 +02:00
|
|
|
request.requestType = imtq::RequestType::MEASURE_NO_ACTUATION;
|
2023-03-04 14:32:18 +01:00
|
|
|
request.specialRequest = specialRequest;
|
2023-03-04 17:06:23 +01:00
|
|
|
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
2023-02-20 11:47:26 +01:00
|
|
|
specialRequestActive = true;
|
2023-03-04 14:32:18 +01:00
|
|
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
2023-03-06 09:17:03 +01:00
|
|
|
rawPacketLen = sizeof(imtq::Request);
|
2023-02-20 02:32:48 +01:00
|
|
|
};
|
2022-01-18 11:41:19 +01:00
|
|
|
switch (deviceCommand) {
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::POS_X_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_POS_X);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::NEG_X_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_NEG_X);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::POS_Y_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_POS_Y);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::NEG_Y_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_NEG_Y);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::POS_Z_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_POS_Z);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::NEG_Z_SELF_TEST): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::DO_SELF_TEST_NEG_Z);
|
2023-02-19 12:25:26 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
|
|
|
case (imtq::cmdIds::GET_SELF_TEST_RESULT): {
|
2023-02-20 19:35:36 +01:00
|
|
|
genericSpecialRequest(imtq::SpecialRequest::GET_SELF_TEST_RESULT);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::REQUEST): {
|
2023-04-02 20:12:24 +02:00
|
|
|
request.requestType = imtq::RequestType::MEASURE_NO_ACTUATION;
|
2023-03-04 14:32:18 +01:00
|
|
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
2023-04-02 23:43:41 +02:00
|
|
|
// 6 ms integration time instead of 10 ms.
|
|
|
|
request.integrationTimeSel = 2;
|
2023-03-04 17:06:23 +01:00
|
|
|
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
2023-04-03 15:16:53 +02:00
|
|
|
if (internalState == InternalState::SHUTDOWN) {
|
|
|
|
request.mode = acs::SimpleSensorMode::OFF;
|
|
|
|
} else {
|
|
|
|
request.mode = acs::SimpleSensorMode::NORMAL;
|
|
|
|
}
|
2023-03-04 14:32:18 +01:00
|
|
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
2023-03-06 09:17:03 +01:00
|
|
|
rawPacketLen = sizeof(imtq::Request);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case (imtq::cmdIds::START_ACTUATION_DIPOLE): {
|
2022-10-20 10:32:17 +02:00
|
|
|
if (commandData != nullptr && commandDataLen < 8) {
|
2022-04-11 17:16:25 +02:00
|
|
|
return DeviceHandlerIF::INVALID_COMMAND_PARAMETER;
|
|
|
|
}
|
2023-03-04 10:15:51 +01:00
|
|
|
{
|
2023-03-04 17:06:23 +01:00
|
|
|
// Do this in any case to read values which might be commanded by the ACS controller.
|
2022-10-20 15:08:33 +02:00
|
|
|
PoolReadGuard pg(&dipoleSet);
|
2023-03-04 10:15:51 +01:00
|
|
|
// Commands override anything which was set in the software
|
|
|
|
if (commandData != nullptr) {
|
|
|
|
dipoleSet.setValidityBufferGeneration(false);
|
|
|
|
ReturnValue_t result = dipoleSet.deSerialize(&commandData, &commandDataLen,
|
|
|
|
SerializeIF::Endianness::NETWORK);
|
|
|
|
dipoleSet.setValidityBufferGeneration(true);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
}
|
2023-03-04 14:32:18 +01:00
|
|
|
manualTorqueCmdActive = true;
|
|
|
|
manuallyCommandedTorqueDuration.setTimeout(dipoleSet.currentTorqueDurationMs.value);
|
2023-03-04 10:15:51 +01:00
|
|
|
}
|
2022-10-20 10:32:17 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
|
2023-03-04 17:06:23 +01:00
|
|
|
expectedReply = imtq::cmdIds::REPLY_WITH_TORQUE;
|
2023-04-02 20:12:24 +02:00
|
|
|
request.requestType = imtq::RequestType::ACTUATE;
|
2023-03-04 14:32:18 +01:00
|
|
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
|
|
|
std::memcpy(request.dipoles, dipoleSet.dipoles.value, sizeof(request.dipoles));
|
|
|
|
request.torqueDuration = dipoleSet.currentTorqueDurationMs.value;
|
2022-10-20 16:09:18 +02:00
|
|
|
if (ACTUATION_WIRETAPPING) {
|
2023-03-04 14:32:18 +01:00
|
|
|
sif::debug << "Actuating IMTQ with parameters x = " << dipoleSet.dipoles[0]
|
|
|
|
<< ", y = " << dipoleSet.dipoles[1] << ", z = " << dipoleSet.dipoles[2]
|
2022-10-20 16:09:18 +02:00
|
|
|
<< ", duration = " << dipoleSet.currentTorqueDurationMs.value << std::endl;
|
|
|
|
}
|
2023-03-02 15:32:12 +01:00
|
|
|
MutexGuard mg(torquer::lazyLock(), torquer::LOCK_TYPE, torquer::LOCK_TIMEOUT,
|
|
|
|
torquer::LOCK_CTX);
|
2022-10-20 15:08:33 +02:00
|
|
|
torquer::TORQUEING = true;
|
|
|
|
torquer::TORQUE_COUNTDOWN.setTimeout(dipoleSet.currentTorqueDurationMs.value);
|
2023-03-04 14:32:18 +01:00
|
|
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
2023-03-06 09:17:03 +01:00
|
|
|
rawPacketLen = sizeof(imtq::Request);
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
default:
|
2022-01-18 11:41:19 +01:00
|
|
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
|
|
|
}
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::FAILED;
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::fillCommandAndReplyMap() {
|
2023-02-19 12:25:26 +01:00
|
|
|
insertInCommandMap(imtq::cmdIds::REQUEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::START_ACTUATION_DIPOLE);
|
2023-03-04 17:06:23 +01:00
|
|
|
insertInReplyMap(imtq::cmdIds::REPLY_NO_TORQUE, 5, nullptr, 0, true);
|
|
|
|
insertInReplyMap(imtq::cmdIds::REPLY_WITH_TORQUE, 20, nullptr, 0, true);
|
2023-02-20 02:32:48 +01:00
|
|
|
insertInCommandMap(imtq::cmdIds::POS_X_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::NEG_X_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::POS_Y_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::NEG_Y_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::POS_Z_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::NEG_Z_SELF_TEST);
|
|
|
|
insertInCommandMap(imtq::cmdIds::GET_SELF_TEST_RESULT);
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
2022-01-18 11:41:19 +01:00
|
|
|
DeviceCommandId_t* foundId, size_t* foundLen) {
|
2023-03-06 14:02:03 +01:00
|
|
|
if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or getMode() == _MODE_POWER_DOWN) {
|
2023-02-19 12:25:26 +01:00
|
|
|
return IGNORE_FULL_PACKET;
|
2022-01-18 11:41:19 +01:00
|
|
|
}
|
2023-04-03 15:16:53 +02:00
|
|
|
if (internalState == InternalState::SHUTDOWN) {
|
|
|
|
commandExecuted = true;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (remainingSize > 0) {
|
|
|
|
*foundLen = remainingSize;
|
2023-03-04 17:06:23 +01:00
|
|
|
*foundId = expectedReply;
|
2023-02-19 12:25:26 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
|
|
|
return returnvalue::FAILED;
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
2023-02-19 15:28:59 +01:00
|
|
|
ReturnValue_t result;
|
|
|
|
ReturnValue_t status = returnvalue::OK;
|
2023-02-22 19:45:41 +01:00
|
|
|
if (getMode() != MODE_NORMAL) {
|
2023-03-06 11:02:56 +01:00
|
|
|
if (expectedReply == imtq::cmdIds::REPLY_NO_TORQUE) {
|
|
|
|
ImtqRepliesDefault replies(packet);
|
|
|
|
if (replies.devWasConfigured() and internalState == InternalState::STARTUP) {
|
|
|
|
commandExecuted = true;
|
|
|
|
}
|
|
|
|
}
|
2023-02-20 19:54:04 +01:00
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
2023-03-04 17:06:23 +01:00
|
|
|
if (expectedReply == imtq::cmdIds::REPLY_NO_TORQUE) {
|
2023-02-20 19:54:04 +01:00
|
|
|
// sif::debug << "handle measure" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
ImtqRepliesDefault replies(packet);
|
2023-03-06 09:17:03 +01:00
|
|
|
if (replies.devWasConfigured() and internalState == InternalState::STARTUP) {
|
|
|
|
commandExecuted = true;
|
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
if (specialRequestActive) {
|
|
|
|
if (replies.wasSpecialRequestRead()) {
|
|
|
|
uint8_t* specialRequest = replies.getSpecialRequest();
|
|
|
|
imtq::CC::CC cc = static_cast<imtq::CC::CC>(specialRequest[0]);
|
|
|
|
result = parseStatusByte(cc, packet);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
status = result;
|
|
|
|
}
|
|
|
|
if (cc == imtq::CC::CC::GET_SELF_TEST_RESULT) {
|
|
|
|
handleSelfTestReply(specialRequest);
|
|
|
|
}
|
|
|
|
// For a special request, the other stuff was not read, so return here.
|
|
|
|
return status;
|
|
|
|
} else {
|
|
|
|
sif::warning << "IMTQ: Possible timing issue, special request was not read" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
specialRequestActive = false;
|
2023-02-20 02:32:48 +01:00
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
if (not replies.wasEngHkRead() and not firstReplyCycle) {
|
2023-02-20 02:32:48 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, ENG HK was not read" << std::endl;
|
|
|
|
}
|
|
|
|
// Still read it, even if it is old. Better than nothing
|
|
|
|
uint8_t* engHkReply = replies.getEngHk();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_ENG_HK_DATA, engHkReply);
|
|
|
|
if (result == returnvalue::OK) {
|
|
|
|
fillEngHkDataset(hkDatasetNoTorque, engHkReply);
|
|
|
|
} else {
|
|
|
|
status = result;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
|
2023-02-20 11:47:26 +01:00
|
|
|
if (not replies.wasGetSystemStateRead() and not firstReplyCycle) {
|
2023-02-20 02:32:48 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, system state was not read" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2023-02-20 02:32:48 +01:00
|
|
|
uint8_t* sysStateReply = replies.getSystemState();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_SYSTEM_STATE, sysStateReply);
|
|
|
|
if (result == returnvalue::OK) {
|
|
|
|
fillSystemStateIntoDataset(sysStateReply);
|
|
|
|
} else {
|
|
|
|
status = result;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
|
2023-02-20 11:47:26 +01:00
|
|
|
if (not replies.wasGetRawMgmMeasurementRead() and not firstReplyCycle) {
|
2023-03-06 11:06:38 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, raw MGM measurement was not read" << std::endl;
|
2023-02-20 02:32:48 +01:00
|
|
|
}
|
|
|
|
uint8_t* rawMgmMeasurement = replies.getRawMgmMeasurement();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_RAW_MTM_MEASUREMENT, rawMgmMeasurement);
|
|
|
|
if (result == returnvalue::OK) {
|
2023-03-02 14:42:42 +01:00
|
|
|
fillRawMtmDataset(rawMtmNoTorque, rawMgmMeasurement);
|
2023-02-20 02:32:48 +01:00
|
|
|
} else {
|
|
|
|
status = result;
|
|
|
|
}
|
|
|
|
|
2023-02-20 11:47:26 +01:00
|
|
|
if (not replies.wasCalibMgmMeasurementRead() and not firstReplyCycle) {
|
2023-03-06 11:06:38 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, calib MGM measurement was not read"
|
|
|
|
<< std::endl;
|
2023-02-20 02:32:48 +01:00
|
|
|
}
|
|
|
|
uint8_t* calibMgmMeasurement = replies.getCalibMgmMeasurement();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_CAL_MTM_MEASUREMENT, calibMgmMeasurement);
|
|
|
|
if (result == returnvalue::OK) {
|
2023-03-02 14:42:42 +01:00
|
|
|
fillCalibratedMtmDataset(calibMgmMeasurement);
|
2023-02-20 02:32:48 +01:00
|
|
|
} else {
|
|
|
|
status = result;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2023-03-04 17:06:23 +01:00
|
|
|
} else if (expectedReply == imtq::cmdIds::REPLY_WITH_TORQUE) {
|
2023-02-20 19:54:04 +01:00
|
|
|
// sif::debug << "handle measure with torque" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
ImtqRepliesWithTorque replies(packet);
|
|
|
|
if (replies.wasDipoleActuationRead()) {
|
|
|
|
parseStatusByte(imtq::CC::START_ACTUATION_DIPOLE, replies.getDipoleActuation());
|
2023-02-20 11:47:26 +01:00
|
|
|
} else if (not firstReplyCycle) {
|
2023-02-20 02:32:48 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, start actuation dipole status was not read"
|
|
|
|
<< std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
|
|
|
|
if (not replies.wasGetRawMgmMeasurementRead() and not firstReplyCycle) {
|
2023-02-20 02:32:48 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, was MGM measurement with torque was not read"
|
|
|
|
<< std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-20 02:32:48 +01:00
|
|
|
uint8_t* rawMgmMeasurement = replies.getRawMgmMeasurement();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_RAW_MTM_MEASUREMENT, rawMgmMeasurement);
|
|
|
|
if (result == returnvalue::OK) {
|
2023-03-02 14:42:42 +01:00
|
|
|
fillRawMtmDataset(rawMtmWithTorque, rawMgmMeasurement);
|
2023-02-20 02:32:48 +01:00
|
|
|
} else {
|
|
|
|
status = result;
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
|
|
|
|
if (not replies.wasEngHkRead() and not firstReplyCycle) {
|
2023-02-20 02:32:48 +01:00
|
|
|
sif::warning << "IMTQ: Possible timing issue, engineering HK with torque was not read"
|
|
|
|
<< std::endl;
|
|
|
|
}
|
|
|
|
uint8_t* engHkReply = replies.getEngHk();
|
|
|
|
result = parseStatusByte(imtq::CC::GET_ENG_HK_DATA, engHkReply);
|
|
|
|
if (result != returnvalue::OK) {
|
|
|
|
return result;
|
|
|
|
} else {
|
|
|
|
status = result;
|
|
|
|
}
|
2023-03-02 14:42:42 +01:00
|
|
|
fillEngHkDataset(hkDatasetWithTorque, engHkReply);
|
2023-02-20 19:44:54 +01:00
|
|
|
if (firstReplyCycle) {
|
|
|
|
firstReplyCycle = false;
|
|
|
|
}
|
2023-02-20 11:47:26 +01:00
|
|
|
}
|
2023-02-19 15:28:59 +01:00
|
|
|
return status;
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
LocalPoolDataSetBase* ImtqHandler::getDataSetHandle(sid_t sid) {
|
2023-02-19 12:25:26 +01:00
|
|
|
if (sid == hkDatasetNoTorque.getSid()) {
|
|
|
|
return &hkDatasetNoTorque;
|
|
|
|
} else if (sid == dipoleSet.getSid()) {
|
|
|
|
return &dipoleSet;
|
2023-03-04 17:06:23 +01:00
|
|
|
} else if (sid == statusSet.getSid()) {
|
|
|
|
return &statusSet;
|
2023-02-19 12:25:26 +01:00
|
|
|
} else if (sid == hkDatasetWithTorque.getSid()) {
|
|
|
|
return &hkDatasetWithTorque;
|
|
|
|
} else if (sid == rawMtmWithTorque.getSid()) {
|
|
|
|
return &rawMtmWithTorque;
|
2022-01-18 11:41:19 +01:00
|
|
|
} else if (sid == calMtmMeasurementSet.getSid()) {
|
|
|
|
return &calMtmMeasurementSet;
|
2023-02-19 12:25:26 +01:00
|
|
|
} else if (sid == rawMtmNoTorque.getSid()) {
|
|
|
|
return &rawMtmNoTorque;
|
2022-01-18 11:41:19 +01:00
|
|
|
} else if (sid == posXselfTestDataset.getSid()) {
|
|
|
|
return &posXselfTestDataset;
|
|
|
|
} else if (sid == negXselfTestDataset.getSid()) {
|
|
|
|
return &negXselfTestDataset;
|
|
|
|
} else if (sid == posYselfTestDataset.getSid()) {
|
|
|
|
return &posYselfTestDataset;
|
|
|
|
} else if (sid == negYselfTestDataset.getSid()) {
|
|
|
|
return &negYselfTestDataset;
|
|
|
|
} else if (sid == posZselfTestDataset.getSid()) {
|
|
|
|
return &posZselfTestDataset;
|
|
|
|
} else if (sid == negZselfTestDataset.getSid()) {
|
|
|
|
return &negZselfTestDataset;
|
|
|
|
} else {
|
2023-03-02 17:56:10 +01:00
|
|
|
sif::error << "ImtqHandler::getDataSetHandle: Invalid SID" << std::endl;
|
2022-01-18 11:41:19 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
2021-06-12 15:45:24 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
uint32_t ImtqHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 5000; }
|
2021-04-25 12:47:41 +02:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
2022-01-18 11:41:19 +01:00
|
|
|
LocalDataPoolManager& poolManager) {
|
2023-02-19 12:25:26 +01:00
|
|
|
/** Entries of housekeeping dataset */
|
|
|
|
localDataPoolMap.emplace(imtq::STATUS_BYTE_MODE, &statusMode);
|
|
|
|
localDataPoolMap.emplace(imtq::STATUS_BYTE_CONF, &statusConfig);
|
|
|
|
localDataPoolMap.emplace(imtq::STATUS_BYTE_ERROR, &statusError);
|
|
|
|
localDataPoolMap.emplace(imtq::STATUS_BYTE_UPTIME, &statusUptime);
|
2023-03-04 14:32:18 +01:00
|
|
|
|
|
|
|
// ENG HK No Torque
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::DIGITAL_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::ANALOG_CURRENT, new PoolEntry<float>({0}));
|
2023-03-04 14:32:18 +01:00
|
|
|
localDataPoolMap.emplace(imtq::COIL_CURRENTS, &coilCurrentsMilliampsNoTorque);
|
|
|
|
localDataPoolMap.emplace(imtq::COIL_TEMPERATURES, &coilTempsNoTorque);
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::MCU_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
2023-03-04 14:32:18 +01:00
|
|
|
// ENG HK With Torque
|
|
|
|
localDataPoolMap.emplace(imtq::DIGITAL_VOLTAGE_MV_WT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::ANALOG_VOLTAGE_MV_WT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::DIGITAL_CURRENT_WT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::ANALOG_CURRENT_WT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::COIL_CURRENTS_WT, &coilCurrentsMilliampsWithTorque);
|
|
|
|
localDataPoolMap.emplace(imtq::COIL_TEMPERATURES_WT, &coilTempsWithTorque);
|
|
|
|
localDataPoolMap.emplace(imtq::MCU_TEMPERATURE_WT, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::DIPOLES_ID, &dipolesPoolEntry);
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::CURRENT_TORQUE_DURATION, &torqueDurationEntry);
|
2022-10-20 10:44:28 +02:00
|
|
|
|
2022-01-18 11:41:19 +01:00
|
|
|
/** Entries of calibrated MTM measurement dataset */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::MGM_CAL_NT, &mgmCalEntry);
|
|
|
|
localDataPoolMap.emplace(imtq::ACTUATION_CAL_STATUS, new PoolEntry<uint8_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** Entries of raw MTM measurement dataset */
|
2023-03-04 14:32:18 +01:00
|
|
|
localDataPoolMap.emplace(imtq::MTM_RAW, &mtmRawNoTorque);
|
|
|
|
localDataPoolMap.emplace(imtq::ACTUATION_RAW_STATUS, &actStatusNoTorque);
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::MTM_RAW_WT, &mtmRawWithTorque);
|
|
|
|
localDataPoolMap.emplace(imtq::ACTUATION_RAW_STATUS_WT, &actStatusWithTorque);
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for positive X axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for negative X axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for positive Y axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for negative Y axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for positive Z axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_POS_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** INIT measurements for negative Z axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::INIT_NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_RAW_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_RAW_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_RAW_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_CAL_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_CAL_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_CAL_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_X_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_Y_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_Z_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_RAW_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_RAW_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_RAW_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_CAL_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_CAL_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_CAL_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_X_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_Y_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_Z_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_RAW_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_RAW_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_RAW_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_CAL_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_CAL_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_CAL_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_X_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_Y_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_Z_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_RAW_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_RAW_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_RAW_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_CAL_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_CAL_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_CAL_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_X_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_Y_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_Z_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::POS_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_RAW_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_RAW_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_RAW_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_CAL_MAG_X, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_CAL_MAG_Y, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_CAL_MAG_Z, new PoolEntry<uint32_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_X_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_Y_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_Z_CURRENT, new PoolEntry<uint16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for positive X axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for negative X axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_X_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for positive Y axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for negative Y axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Y_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for positive Z axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_POS_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
|
|
|
/** FINA measurements for negative Z axis test */
|
2023-02-19 12:25:26 +01:00
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_ERR, new PoolEntry<uint8_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_RAW_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_RAW_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_RAW_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_CAL_MAG_X, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_CAL_MAG_Y, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_CAL_MAG_Z, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_X_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_Y_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_Z_CURRENT, new PoolEntry<float>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_X_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_Y_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
|
|
|
localDataPoolMap.emplace(imtq::FINA_NEG_Z_COIL_Z_TEMPERATURE, new PoolEntry<int16_t>({0}));
|
2022-01-18 11:41:19 +01:00
|
|
|
|
2022-08-15 11:57:57 +02:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
2023-04-04 19:18:53 +02:00
|
|
|
subdp::DiagnosticsHkPeriodicParams(hkDatasetNoTorque.getSid(), enableHkSets, 30.0));
|
2022-08-15 11:57:57 +02:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
2023-04-04 19:18:53 +02:00
|
|
|
subdp::DiagnosticsHkPeriodicParams(hkDatasetWithTorque.getSid(), enableHkSets, 30.0));
|
2023-02-19 12:25:26 +01:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
|
|
|
subdp::DiagnosticsHkPeriodicParams(rawMtmNoTorque.getSid(), false, 10.0));
|
2022-08-15 11:57:57 +02:00
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
2023-02-19 12:25:26 +01:00
|
|
|
subdp::DiagnosticsHkPeriodicParams(rawMtmWithTorque.getSid(), false, 10.0));
|
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
|
|
|
subdp::DiagnosticsHkPeriodicParams(calMtmMeasurementSet.getSid(), false, 10.0));
|
2023-03-04 17:06:23 +01:00
|
|
|
poolManager.subscribeForRegularPeriodicPacket(
|
|
|
|
subdp::RegularHkPeriodicParams(statusSet.getSid(), false, 10.0));
|
|
|
|
poolManager.subscribeForDiagPeriodicPacket(
|
|
|
|
subdp::DiagnosticsHkPeriodicParams(dipoleSet.getSid(), false, 10.0));
|
2023-02-12 20:41:20 +01:00
|
|
|
return DeviceHandlerBase::initializeLocalDataPool(localDataPoolMap, poolManager);
|
2021-04-25 12:47:41 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::getSelfTestCommandId(DeviceCommandId_t* id) {
|
2022-01-18 11:41:19 +01:00
|
|
|
DeviceCommandId_t commandId = getPendingCommand();
|
|
|
|
switch (commandId) {
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::cmdIds::POS_X_SELF_TEST:
|
|
|
|
case imtq::cmdIds::NEG_X_SELF_TEST:
|
|
|
|
case imtq::cmdIds::POS_Y_SELF_TEST:
|
|
|
|
case imtq::cmdIds::NEG_Y_SELF_TEST:
|
|
|
|
case imtq::cmdIds::POS_Z_SELF_TEST:
|
|
|
|
case imtq::cmdIds::NEG_Z_SELF_TEST:
|
2022-01-18 11:41:19 +01:00
|
|
|
*id = commandId;
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
default:
|
2022-01-18 11:41:19 +01:00
|
|
|
sif::error << "IMTQHandler::getSelfTestCommandId: Reply does not match to pending "
|
|
|
|
<< "command" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
// return UNEXPECTED_SELF_TEST_REPLY;
|
2022-01-18 11:41:19 +01:00
|
|
|
}
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2021-06-11 11:53:43 +02:00
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
ReturnValue_t ImtqHandler::parseStatusByte(imtq::CC::CC command, const uint8_t* packet) {
|
2023-03-04 14:32:18 +01:00
|
|
|
uint8_t cmdErrorField = packet[1] & 0xF;
|
2023-02-19 12:25:26 +01:00
|
|
|
if (cmdErrorField == 0) {
|
|
|
|
return returnvalue::OK;
|
|
|
|
}
|
|
|
|
sif::error << std::hex;
|
2022-01-18 11:41:19 +01:00
|
|
|
switch (cmdErrorField) {
|
2021-03-17 11:14:48 +01:00
|
|
|
case 1:
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: Command 0x" << std::setw(2) << command
|
|
|
|
<< " rejected without reason" << std::endl;
|
|
|
|
return imtq::REJECTED_WITHOUT_REASON;
|
2021-03-17 11:14:48 +01:00
|
|
|
case 2:
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: Command 0x" << std::setw(2) << command
|
|
|
|
<< " has invalid command code" << std::endl;
|
|
|
|
return imtq::INVALID_COMMAND_CODE;
|
2021-03-17 11:14:48 +01:00
|
|
|
case 3:
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: Command 0x" << std::setw(2) << command
|
|
|
|
<< " has missing parameter" << std::endl;
|
|
|
|
return imtq::PARAMETER_MISSING;
|
2021-03-17 11:14:48 +01:00
|
|
|
case 4:
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: Command 0x" << std::setw(2) << command
|
|
|
|
<< " has invalid parameter" << std::endl;
|
|
|
|
return imtq::PARAMETER_INVALID;
|
2021-03-17 11:14:48 +01:00
|
|
|
case 5:
|
2023-03-04 17:06:23 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: CC 0x" << std::setw(2) << command << " unavailable"
|
|
|
|
<< std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
return imtq::CC_UNAVAILABLE;
|
2021-03-17 11:14:48 +01:00
|
|
|
case 7:
|
2023-03-04 17:06:23 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: Internal processing error for command 0x"
|
|
|
|
<< std::setw(2) << command << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
return imtq::INTERNAL_PROCESSING_ERROR;
|
2021-03-17 11:14:48 +01:00
|
|
|
default:
|
2023-03-04 14:32:18 +01:00
|
|
|
sif::error << "IMTQ::parseStatusByte: CMD error field for command 0x" << std::setw(2)
|
|
|
|
<< command << " contains unknown error code 0x" << static_cast<int>(cmdErrorField)
|
|
|
|
<< std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
return imtq::CMD_ERR_UNKNOWN;
|
2022-01-18 11:41:19 +01:00
|
|
|
}
|
2023-03-04 14:32:18 +01:00
|
|
|
sif::error << std::dec;
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
void ImtqHandler::fillEngHkDataset(imtq::HkDataset& hkDataset, const uint8_t* packet) {
|
|
|
|
PoolReadGuard rg(&hkDataset);
|
2022-01-18 11:41:19 +01:00
|
|
|
uint8_t offset = 2;
|
2023-02-19 12:25:26 +01:00
|
|
|
hkDataset.digitalVoltageMv = *(packet + offset + 1) << 8 | *(packet + offset);
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-02-19 12:25:26 +01:00
|
|
|
hkDataset.analogVoltageMv = *(packet + offset + 1) << 8 | *(packet + offset);
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-02-19 12:25:26 +01:00
|
|
|
hkDataset.digitalCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-02-19 12:25:26 +01:00
|
|
|
hkDataset.analogCurrentmA = (*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilCurrentsMilliamps[0] =
|
2022-01-18 11:41:19 +01:00
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilCurrentsMilliamps[1] =
|
2022-01-18 11:41:19 +01:00
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilCurrentsMilliamps[2] =
|
2022-01-18 11:41:19 +01:00
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilTemperatures[0] = (*(packet + offset + 1) << 8 | *(packet + offset));
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilTemperatures[1] = (*(packet + offset + 1) << 8 | *(packet + offset));
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2023-03-04 14:32:18 +01:00
|
|
|
hkDataset.coilTemperatures[2] = (*(packet + offset + 1) << 8 | *(packet + offset));
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 2;
|
2022-10-19 19:08:36 +02:00
|
|
|
size_t dummy = 2;
|
2023-02-19 12:25:26 +01:00
|
|
|
SerializeAdapter::deSerialize(&hkDataset.mcuTemperature.value, packet + offset, &dummy,
|
2022-10-20 10:32:17 +02:00
|
|
|
SerializeIF::Endianness::LITTLE);
|
2022-01-18 11:41:19 +01:00
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
hkDataset.setValidity(true, true);
|
2022-06-03 18:03:25 +02:00
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::info << "IMTQ digital voltage: " << hkDataset.digitalVoltageMv << " mV" << std::endl;
|
|
|
|
sif::info << "IMTQ analog voltage: " << hkDataset.analogVoltageMv << " mV" << std::endl;
|
|
|
|
sif::info << "IMTQ digital current: " << hkDataset.digitalCurrentmA << " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ analog current: " << hkDataset.analogCurrentmA << " mA" << std::endl;
|
2023-03-04 14:32:18 +01:00
|
|
|
sif::info << "IMTQ coil X current: " << hkDataset.coilCurrentsMilliamps[0] << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ coil Y current: " << hkDataset.coilCurrentsMilliamps[1] << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ coil Z current: " << hkDataset.coilCurrentsMilliamps[2] << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ coil X temperature: " << hkDataset.coilTemperatures[0] << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ coil Y temperature: " << hkDataset.coilTemperatures[1] << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ coil Z temperature: " << hkDataset.coilTemperatures[2] << " °C" << std::endl;
|
2023-02-19 12:25:26 +01:00
|
|
|
sif::info << "IMTQ coil MCU temperature: " << hkDataset.mcuTemperature << " °C" << std::endl;
|
2021-03-17 11:14:48 +01:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-03-17 11:14:48 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::setToGoToNormal(bool enable) { this->goToNormalMode = enable; }
|
2021-03-17 11:14:48 +01:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::fillCalibratedMtmDataset(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&calMtmMeasurementSet);
|
2022-08-15 10:50:19 +02:00
|
|
|
calMtmMeasurementSet.setValidity(true, true);
|
2022-01-18 11:41:19 +01:00
|
|
|
int8_t offset = 2;
|
2022-08-15 10:50:19 +02:00
|
|
|
calMtmMeasurementSet.mgmXyz[0] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
2022-08-15 17:25:16 +02:00
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 4;
|
2022-08-15 10:50:19 +02:00
|
|
|
calMtmMeasurementSet.mgmXyz[1] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
2022-08-15 17:25:16 +02:00
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 4;
|
2022-08-15 10:50:19 +02:00
|
|
|
calMtmMeasurementSet.mgmXyz[2] = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
2022-08-15 17:25:16 +02:00
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
2022-01-18 11:41:19 +01:00
|
|
|
offset += 4;
|
|
|
|
calMtmMeasurementSet.coilActuationStatus = (*(packet + offset + 3) << 24) |
|
|
|
|
(*(packet + offset + 2) << 16) |
|
|
|
|
(*(packet + offset + 1) << 8) | (*(packet + offset));
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
2022-08-15 10:50:19 +02:00
|
|
|
sif::info << "IMTQ calibrated MTM measurement X: " << calMtmMeasurementSet.mgmXyz[0] << " nT"
|
2022-04-26 10:37:25 +02:00
|
|
|
<< std::endl;
|
2022-08-15 10:50:19 +02:00
|
|
|
sif::info << "IMTQ calibrated MTM measurement Y: " << calMtmMeasurementSet.mgmXyz[1] << " nT"
|
2022-04-26 10:37:25 +02:00
|
|
|
<< std::endl;
|
2022-08-15 10:50:19 +02:00
|
|
|
sif::info << "IMTQ calibrated MTM measurement Z: " << calMtmMeasurementSet.mgmXyz[2] << " nT"
|
2022-04-26 10:37:25 +02:00
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ coil actuation status during MTM measurement: "
|
|
|
|
<< (unsigned int)calMtmMeasurementSet.coilActuationStatus.value << std::endl;
|
2021-04-26 07:56:02 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-04-26 07:56:02 +02:00
|
|
|
}
|
|
|
|
|
2023-03-02 14:42:42 +01:00
|
|
|
void ImtqHandler::fillRawMtmDataset(imtq::RawMtmMeasurementSet& set, const uint8_t* packet) {
|
|
|
|
PoolReadGuard rg(&set);
|
2023-03-02 15:22:21 +01:00
|
|
|
if (rg.getReadResult() != returnvalue::OK) {
|
2023-03-04 14:32:18 +01:00
|
|
|
sif::error << "ImtqHandler::fillRawMtmDataset: Read failure" << std::endl;
|
2023-03-02 14:42:42 +01:00
|
|
|
}
|
2022-08-18 18:18:44 +02:00
|
|
|
unsigned int offset = 2;
|
|
|
|
size_t deSerLen = 16;
|
|
|
|
const uint8_t* dataStart = packet + offset;
|
|
|
|
int32_t xRaw = 0;
|
|
|
|
int32_t yRaw = 0;
|
|
|
|
int32_t zRaw = 0;
|
|
|
|
uint32_t coilActStatus = 0;
|
2022-08-20 12:11:08 +02:00
|
|
|
auto res =
|
|
|
|
SerializeAdapter::deSerialize(&xRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (res != returnvalue::OK) {
|
2022-08-18 18:18:44 +02:00
|
|
|
return;
|
|
|
|
}
|
2022-08-20 12:11:08 +02:00
|
|
|
res =
|
|
|
|
SerializeAdapter::deSerialize(&yRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (res != returnvalue::OK) {
|
2022-08-18 18:18:44 +02:00
|
|
|
return;
|
|
|
|
}
|
2022-08-20 12:11:08 +02:00
|
|
|
res =
|
|
|
|
SerializeAdapter::deSerialize(&zRaw, &dataStart, &deSerLen, SerializeIF::Endianness::LITTLE);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (res != returnvalue::OK) {
|
2022-08-18 18:18:44 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
res = SerializeAdapter::deSerialize(&coilActStatus, &dataStart, &deSerLen,
|
2022-08-20 12:11:08 +02:00
|
|
|
SerializeIF::Endianness::LITTLE);
|
2022-08-24 17:27:47 +02:00
|
|
|
if (res != returnvalue::OK) {
|
2022-08-18 18:18:44 +02:00
|
|
|
return;
|
|
|
|
}
|
2023-03-02 14:42:42 +01:00
|
|
|
set.mtmRawNt[0] = static_cast<float>(xRaw) * 7.5;
|
|
|
|
set.mtmRawNt[1] = static_cast<float>(yRaw) * 7.5;
|
|
|
|
set.mtmRawNt[2] = static_cast<float>(zRaw) * 7.5;
|
|
|
|
set.coilActuationStatus = static_cast<uint8_t>(coilActStatus);
|
|
|
|
set.setValidity(true, true);
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
2023-03-04 17:06:23 +01:00
|
|
|
sif::info << "Set ID: " << set.getSid().ownerSetId << std::endl;
|
2023-03-02 14:42:42 +01:00
|
|
|
sif::info << "IMTQ raw MTM measurement X: " << set.mtmRawNt[0] << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ raw MTM measurement Y: " << set.mtmRawNt[1] << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ raw MTM measurement Z: " << set.mtmRawNt[2] << " nT" << std::endl;
|
2022-04-26 10:37:25 +02:00
|
|
|
sif::info << "IMTQ coil actuation status during MTM measurement: "
|
2023-03-02 14:42:42 +01:00
|
|
|
<< (unsigned int)set.coilActuationStatus.value << std::endl;
|
2021-04-26 07:56:02 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-04-26 07:56:02 +02:00
|
|
|
}
|
2021-06-04 16:45:54 +02:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handleSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
uint16_t offset = 2;
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
2021-06-04 16:45:54 +02:00
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
switch (*(packet + imtq::MAIN_STEP_OFFSET)) {
|
|
|
|
case imtq::selfTest::step::X_POSITIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handlePositiveXSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-11 11:53:43 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::X_NEGATIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handleNegativeXSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Y_POSITIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handlePositiveYSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Y_NEGATIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handleNegativeYSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Z_POSITIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handlePositiveZSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Z_NEGATIVE: {
|
2022-01-18 11:41:19 +01:00
|
|
|
handleNegativeZSelfTestReply(packet);
|
|
|
|
break;
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
2021-06-11 11:53:43 +02:00
|
|
|
default:
|
2022-01-18 11:41:19 +01:00
|
|
|
break;
|
|
|
|
}
|
2021-06-11 11:53:43 +02:00
|
|
|
}
|
2021-06-04 16:45:54 +02:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handlePositiveXSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
posXselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posXselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posXselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posXselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posXselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posXselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posXselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posXselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(posXselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posXselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << posXselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << posXselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< posXselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< posXselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< posXselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << posXselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << posXselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << posXselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< posXselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< posXselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< posXselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (+X) err: "
|
|
|
|
<< static_cast<unsigned int>(posXselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) raw magnetic field X: " << posXselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) raw magnetic field Y: " << posXselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) raw magnetic field Z: " << posXselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) calibrated magnetic field X: " << posXselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) calibrated magnetic field Y: " << posXselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) calibrated magnetic field Z: " << posXselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil X current: " << posXselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil Y current: " << posXselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil Z current: " << posXselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil X temperature: " << posXselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil Y temperature: " << posXselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+X) coil Z temperature: " << posXselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(posXselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << posXselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << posXselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << posXselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< posXselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< posXselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< posXselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << posXselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << posXselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << posXselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< posXselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< posXselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< posXselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-04 16:45:54 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-04 16:45:54 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handleNegativeXSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
negXselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negXselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negXselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negXselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negXselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negXselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negXselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negXselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(negXselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negXselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << negXselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << negXselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< negXselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< negXselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< negXselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << negXselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << negXselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << negXselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< negXselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< negXselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< negXselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (-X) err: "
|
|
|
|
<< static_cast<unsigned int>(negXselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) raw magnetic field X: " << negXselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) raw magnetic field Y: " << negXselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) raw magnetic field Z: " << negXselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) calibrated magnetic field X: " << negXselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) calibrated magnetic field Y: " << negXselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) calibrated magnetic field Z: " << negXselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil X current: " << negXselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil Y current: " << negXselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil Z current: " << negXselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil X temperature: " << negXselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil Y temperature: " << negXselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-X) coil Z temperature: " << negXselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(negXselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << negXselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << negXselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << negXselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< negXselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< negXselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< negXselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << negXselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << negXselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << negXselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< negXselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< negXselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< negXselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handlePositiveYSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
posYselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posYselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posYselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posYselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posYselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posYselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posYselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posYselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(posYselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posYselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << posYselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << posYselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< posYselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< posYselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< posYselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << posYselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << posYselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << posYselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< posYselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< posYselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< posYselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (+Y) err: "
|
|
|
|
<< static_cast<unsigned int>(posYselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) raw magnetic field X: " << posYselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) raw magnetic field Y: " << posYselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) raw magnetic field Z: " << posYselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) calibrated magnetic field X: " << posYselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) calibrated magnetic field Y: " << posYselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) calibrated magnetic field Z: " << posYselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil X current: " << posYselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil Y current: " << posYselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil Z current: " << posYselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil X temperature: " << posYselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil Y temperature: " << posYselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Y) coil Z temperature: " << posYselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(posYselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << posYselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << posYselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << posYselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< posYselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< posYselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< posYselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << posYselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << posYselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << posYselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< posYselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< posYselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< posYselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handleNegativeYSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
posZselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negYselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negYselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negYselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negYselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negYselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negYselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negYselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(negYselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negYselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << negYselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << negYselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< negYselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< negYselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< negYselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << negYselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << negYselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << negYselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< negYselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< negYselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< negYselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (-Y) err: "
|
|
|
|
<< static_cast<unsigned int>(negYselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) raw magnetic field X: " << negYselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) raw magnetic field Y: " << negYselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) raw magnetic field Z: " << negYselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) calibrated magnetic field X: " << negYselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) calibrated magnetic field Y: " << negYselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) calibrated magnetic field Z: " << negYselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil X current: " << negYselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil Y current: " << negYselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil Z current: " << negYselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil X temperature: " << negYselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil Y temperature: " << negYselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Y) coil Z temperature: " << negYselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(negYselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << negYselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << negYselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << negYselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< negYselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< negYselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< negYselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << negYselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << negYselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << negYselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< negYselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< negYselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< negYselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handlePositiveZSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
posZselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posZselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posZselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posZselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
posZselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
posZselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
posZselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
posZselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(posZselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << posZselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << posZselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << posZselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< posZselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< posZselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< posZselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << posZselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << posZselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << posZselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< posZselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< posZselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< posZselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (+Z) err: "
|
|
|
|
<< static_cast<unsigned int>(posZselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) raw magnetic field X: " << posZselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) raw magnetic field Y: " << posZselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) raw magnetic field Z: " << posZselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) calibrated magnetic field X: " << posZselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) calibrated magnetic field Y: " << posZselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) calibrated magnetic field Z: " << posZselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil X current: " << posZselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil Y current: " << posZselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil Z current: " << posZselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil X temperature: " << posZselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil Y temperature: " << posZselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (+Z) coil Z temperature: " << negYselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(posZselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << posZselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << posZselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << posZselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< posZselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< posZselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< posZselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << posZselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << posZselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << posZselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< posZselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< posZselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< posZselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::handleNegativeZSelfTestReply(const uint8_t* packet) {
|
2022-01-18 11:41:19 +01:00
|
|
|
PoolReadGuard rg(&posXselfTestDataset);
|
|
|
|
|
|
|
|
uint16_t offset = 2;
|
|
|
|
/** Init measurements */
|
|
|
|
negZselfTestDataset.initErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negZselfTestDataset.initRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.initCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.initCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.initCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.initCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.initCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.initCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** +X measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negZselfTestDataset.err = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negZselfTestDataset.rawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.rawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.rawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.calMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.calMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.calMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.coilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.coilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.coilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.coilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.coilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.coilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
/** FINA measurements */
|
|
|
|
checkErrorByte(*(packet + offset), *(packet + offset + 1));
|
|
|
|
negZselfTestDataset.finaErr = *(packet + offset);
|
|
|
|
offset += 2; // STEP byte will not be stored
|
|
|
|
negZselfTestDataset.finaRawMagX = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaRawMagY = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaRawMagZ = (*(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset)) *
|
|
|
|
7.5;
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaCalMagX = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaCalMagY = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaCalMagZ = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
|
|
|
|
*(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
negZselfTestDataset.finaCoilXCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.finaCoilYCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.finaCoilZCurrent =
|
|
|
|
static_cast<int16_t>(*(packet + offset + 1) << 8 | *(packet + offset)) * 0.1;
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.finaCoilXTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.finaCoilYTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 2;
|
|
|
|
negZselfTestDataset.finaCoilZTemperature = *(packet + offset + 1) << 8 | *(packet + offset);
|
|
|
|
offset += 4;
|
|
|
|
|
2022-04-26 10:37:25 +02:00
|
|
|
if (debugMode) {
|
|
|
|
#if OBSW_VERBOSE_LEVEL >= 1
|
|
|
|
sif::info << "IMTQ self test (INIT) err: "
|
|
|
|
<< static_cast<unsigned int>(negZselfTestDataset.initErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field X: " << negZselfTestDataset.initRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Y: " << negZselfTestDataset.initRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) raw magnetic field Z: " << negZselfTestDataset.initRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field X: "
|
|
|
|
<< negZselfTestDataset.initCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Y: "
|
|
|
|
<< negZselfTestDataset.initCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) calibrated magnetic field Z: "
|
|
|
|
<< negZselfTestDataset.initCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X current: " << negZselfTestDataset.initCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y current: " << negZselfTestDataset.initCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z current: " << negZselfTestDataset.initCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil X temperature: "
|
|
|
|
<< negZselfTestDataset.initCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Y temperature: "
|
|
|
|
<< negZselfTestDataset.initCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (INIT) coil Z temperature: "
|
|
|
|
<< negZselfTestDataset.initCoilZTemperature << " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (-Z) err: "
|
|
|
|
<< static_cast<unsigned int>(negZselfTestDataset.err.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) raw magnetic field X: " << negZselfTestDataset.rawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) raw magnetic field Y: " << negZselfTestDataset.rawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) raw magnetic field Z: " << negZselfTestDataset.rawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) calibrated magnetic field X: " << negZselfTestDataset.calMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) calibrated magnetic field Y: " << negZselfTestDataset.calMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) calibrated magnetic field Z: " << negZselfTestDataset.calMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil X current: " << negZselfTestDataset.coilXCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil Y current: " << negZselfTestDataset.coilYCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil Z current: " << negZselfTestDataset.coilZCurrent << " mA"
|
|
|
|
<< std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil X temperature: " << negZselfTestDataset.coilXTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil Y temperature: " << negZselfTestDataset.coilYTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (-Z) coil Z temperature: " << negYselfTestDataset.coilZTemperature
|
|
|
|
<< " °C" << std::endl;
|
|
|
|
|
|
|
|
sif::info << "IMTQ self test (FINA) err: "
|
|
|
|
<< static_cast<unsigned int>(negZselfTestDataset.finaErr.value) << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field X: " << negZselfTestDataset.finaRawMagX
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Y: " << negZselfTestDataset.finaRawMagY
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) raw magnetic field Z: " << negZselfTestDataset.finaRawMagZ
|
|
|
|
<< " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field X: "
|
|
|
|
<< negZselfTestDataset.finaCalMagX << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Y: "
|
|
|
|
<< negZselfTestDataset.finaCalMagY << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) calibrated magnetic field Z: "
|
|
|
|
<< negZselfTestDataset.finaCalMagZ << " nT" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X current: " << negZselfTestDataset.finaCoilXCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y current: " << negZselfTestDataset.finaCoilYCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z current: " << negZselfTestDataset.finaCoilZCurrent
|
|
|
|
<< " mA" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil X temperature: "
|
|
|
|
<< negZselfTestDataset.finaCoilXTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Y temperature: "
|
|
|
|
<< negZselfTestDataset.finaCoilYTemperature << " °C" << std::endl;
|
|
|
|
sif::info << "IMTQ self test (FINA) coil Z temperature: "
|
|
|
|
<< negZselfTestDataset.finaCoilZTemperature << " °C" << std::endl;
|
2021-06-15 15:13:47 +02:00
|
|
|
#endif
|
2022-04-26 10:37:25 +02:00
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::setDebugMode(bool enable) { this->debugMode = enable; }
|
2022-04-26 10:37:25 +02:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
void ImtqHandler::checkErrorByte(const uint8_t errorByte, const uint8_t step) {
|
2022-01-18 11:41:19 +01:00
|
|
|
std::string stepString("");
|
|
|
|
if (step < 8) {
|
|
|
|
stepString = makeStepString(step);
|
|
|
|
} else {
|
|
|
|
/** This should normally never happen */
|
|
|
|
sif::debug << "IMTQHandler::checkErrorByte: Invalid step" << std::endl;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (errorByte == 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::I2C_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_I2C_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test I2C failure for step " << stepString
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::SPI_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_SPI_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test SPI failure for step " << stepString
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::ADC_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_ADC_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test ADC failure for step " << stepString
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::PWM_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_PWM_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test PWM failure for step " << stepString
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::TC_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_TC_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test TC failure (system failure) for step "
|
|
|
|
<< stepString << std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::MTM_RANGE_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_TC_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test MTM range failure for step " << stepString
|
|
|
|
<< std::endl;
|
|
|
|
}
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::COIL_CURRENT_FAILURE_MASK) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(SELF_TEST_COIL_CURRENT_FAILURE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test coil current outside of expected "
|
|
|
|
"range for step "
|
|
|
|
<< stepString << std::endl;
|
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
if (errorByte & imtq::INVALID_ERROR_BYTE) {
|
2022-01-18 11:41:19 +01:00
|
|
|
triggerEvent(INVALID_ERROR_BYTE, step);
|
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Self test result of step " << stepString
|
|
|
|
<< " has invalid error byte" << std::endl;
|
|
|
|
}
|
2021-06-15 15:13:47 +02:00
|
|
|
}
|
|
|
|
|
2023-02-19 12:25:26 +01:00
|
|
|
void ImtqHandler::fillSystemStateIntoDataset(const uint8_t* packet) {
|
|
|
|
PoolReadGuard pg(&statusSet);
|
|
|
|
statusSet.statusByteMode.value = packet[2];
|
|
|
|
statusSet.statusByteError.value = packet[3];
|
|
|
|
statusSet.statusByteConfig.value = packet[4];
|
|
|
|
size_t dummy = 0;
|
|
|
|
SerializeAdapter::deSerialize<uint32_t>(&statusSet.statusByteUptime.value, packet + 5, &dummy,
|
|
|
|
SerializeIF::Endianness::LITTLE);
|
2023-02-19 14:05:02 +01:00
|
|
|
statusSet.setValidity(true, true);
|
2023-02-19 12:25:26 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
std::string ImtqHandler::makeStepString(const uint8_t step) {
|
2022-01-18 11:41:19 +01:00
|
|
|
std::string stepString("");
|
|
|
|
switch (step) {
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::INIT:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("INIT");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::X_POSITIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("+X");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::X_NEGATIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("-X");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Y_POSITIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("+Y");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Y_NEGATIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("-Y");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Z_POSITIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("+Z");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::Z_NEGATIVE:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("-Z");
|
|
|
|
break;
|
2023-02-19 12:25:26 +01:00
|
|
|
case imtq::selfTest::step::FINA:
|
2022-01-18 11:41:19 +01:00
|
|
|
stepString = std::string("FINA");
|
|
|
|
break;
|
2021-06-04 16:45:54 +02:00
|
|
|
default:
|
2022-01-18 11:41:19 +01:00
|
|
|
sif::error << "IMTQHandler::checkErrorByte: Received packet with invalid step information"
|
|
|
|
<< std::endl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return stepString;
|
2021-06-04 16:45:54 +02:00
|
|
|
}
|
2022-04-14 11:17:07 +02:00
|
|
|
|
2022-10-19 18:52:16 +02:00
|
|
|
ReturnValue_t ImtqHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
2022-04-14 11:17:07 +02:00
|
|
|
if (switcher != power::NO_SWITCH) {
|
|
|
|
*numberOfSwitches = 1;
|
|
|
|
*switches = &switcher;
|
2022-08-24 17:27:47 +02:00
|
|
|
return returnvalue::OK;
|
2022-04-14 11:17:07 +02:00
|
|
|
}
|
|
|
|
return DeviceHandlerBase::NO_SWITCH;
|
|
|
|
}
|