why do we need so much buffer time?
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
6e10ccd2d6
commit
d18a0e98a5
@ -138,7 +138,8 @@ void ImtqPollingTask::handleMeasureStep() {
|
|||||||
if (i2cCmdExecMeasure(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
|
if (i2cCmdExecMeasure(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((replyPtr[2] >> 7) == 0b1) {
|
if ((replyPtr[2] >> 7) == 0) {
|
||||||
|
sif::error << "IMTQ: MGM measurement still too old" << std::endl;
|
||||||
replyPtr[0] = false;
|
replyPtr[0] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,7 +199,8 @@ void ImtqPollingTask::handleActuateStep() {
|
|||||||
if (i2cCmdExecActuate(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
|
if (i2cCmdExecActuate(imtq::CC::GET_RAW_MTM_MEASUREMENT) != returnvalue::OK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((replyPtr[2] >> 7) == 0b1) {
|
if ((replyPtr[2] >> 7) == 0) {
|
||||||
|
sif::error << "IMTQ: MGM measurement still too old" << std::endl;
|
||||||
replyPtr[0] = false;
|
replyPtr[0] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class ImtqPollingTask : public SystemObject,
|
|||||||
address_t i2cAddr = 0;
|
address_t i2cAddr = 0;
|
||||||
uint32_t currentIntegrationTimeMs = 10;
|
uint32_t currentIntegrationTimeMs = 10;
|
||||||
// Required in addition to integration time, otherwise old data might be read.
|
// Required in addition to integration time, otherwise old data might be read.
|
||||||
static constexpr uint32_t MGM_READ_BUFFER_TIME_MS = 5;
|
static constexpr uint32_t MGM_READ_BUFFER_TIME_MS = 6;
|
||||||
bool ignoreNextActuateRequest = false;
|
bool ignoreNextActuateRequest = false;
|
||||||
|
|
||||||
imtq::SpecialRequest specialRequest = imtq::SpecialRequest::NONE;
|
imtq::SpecialRequest specialRequest = imtq::SpecialRequest::NONE;
|
||||||
|
@ -144,6 +144,7 @@ void ImtqHandler::doStartUp() {
|
|||||||
} else {
|
} else {
|
||||||
setMode(_MODE_TO_ON);
|
setMode(_MODE_TO_ON);
|
||||||
}
|
}
|
||||||
|
commandExecuted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,6 +155,7 @@ void ImtqHandler::doShutDown() {
|
|||||||
specialRequestActive = false;
|
specialRequestActive = false;
|
||||||
firstReplyCycle = true;
|
firstReplyCycle = true;
|
||||||
internalState = InternalState::NONE;
|
internalState = InternalState::NONE;
|
||||||
|
commandExecuted = false;
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,6 +173,7 @@ ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
|||||||
*id = imtq::cmdIds::REQUEST;
|
*id = imtq::cmdIds::REQUEST;
|
||||||
request.request = imtq::RequestType::DO_NOTHING;
|
request.request = imtq::RequestType::DO_NOTHING;
|
||||||
request.specialRequest = imtq::SpecialRequest::NONE;
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
||||||
|
expectedReply = DeviceHandlerIF::NO_COMMAND_ID;
|
||||||
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
||||||
rawPacketLen = sizeof(imtq::Request);
|
rawPacketLen = sizeof(imtq::Request);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
@ -180,6 +183,10 @@ ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ImtqHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t ImtqHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
|
if (internalState == InternalState::STARTUP) {
|
||||||
|
*id = imtq::cmdIds::REQUEST;
|
||||||
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
|
}
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,10 +314,14 @@ ReturnValue_t ImtqHandler::interpretDeviceReply(DeviceCommandId_t id, const uint
|
|||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
ReturnValue_t status = returnvalue::OK;
|
ReturnValue_t status = returnvalue::OK;
|
||||||
if (getMode() != MODE_NORMAL) {
|
if (getMode() != MODE_NORMAL) {
|
||||||
// Ignore replies during transitions.
|
if (expectedReply == imtq::cmdIds::REPLY_NO_TORQUE) {
|
||||||
|
ImtqRepliesDefault replies(packet);
|
||||||
|
if (replies.devWasConfigured() and internalState == InternalState::STARTUP) {
|
||||||
|
commandExecuted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
// arrayprinter::print(packet, ImtqReplies::BASE_LEN);
|
|
||||||
if (expectedReply == imtq::cmdIds::REPLY_NO_TORQUE) {
|
if (expectedReply == imtq::cmdIds::REPLY_NO_TORQUE) {
|
||||||
// sif::debug << "handle measure" << std::endl;
|
// sif::debug << "handle measure" << std::endl;
|
||||||
ImtqRepliesDefault replies(packet);
|
ImtqRepliesDefault replies(packet);
|
||||||
|
@ -128,7 +128,7 @@ class ImtqHandler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
power::Switch_t switcher = power::NO_SWITCH;
|
power::Switch_t switcher = power::NO_SWITCH;
|
||||||
|
|
||||||
DeviceCommandId_t expectedReply = imtq::cmdIds::REPLY_WITH_TORQUE;
|
DeviceCommandId_t expectedReply = DeviceHandlerIF::NO_COMMAND_ID;
|
||||||
bool goToNormalMode = false;
|
bool goToNormalMode = false;
|
||||||
bool debugMode = false;
|
bool debugMode = false;
|
||||||
bool specialRequestActive = false;
|
bool specialRequestActive = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user