Merge pull request 'IMTQ: Lower Integration Time' (#552) from imtq_lower_integration_time into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
Reviewed-on: #552
This commit is contained in:
commit
e3677f89fe
11
CHANGELOG.md
11
CHANGELOG.md
@ -18,6 +18,10 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
- q7s-package: v2.4.0
|
- q7s-package: v2.4.0
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- Version of thermal controller which performs basic control tasks.
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
- PTME was not reset after configuration changes.
|
- PTME was not reset after configuration changes.
|
||||||
@ -26,6 +30,9 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
- Poll threshold configuration of the PTME IP core is now configurable via a parameter command
|
- Poll threshold configuration of the PTME IP core is now configurable via a parameter command
|
||||||
and is set to 0b010 (4 polls) instead of 0b001 (1 poll) per default.
|
and is set to 0b010 (4 polls) instead of 0b001 (1 poll) per default.
|
||||||
|
- EIVE system fallback and COM system fallback: Perform general subsystem handling first, then
|
||||||
|
event reception, and finally any new transition handling.
|
||||||
|
- IMTQ MGM integration time lowered to 6 ms. This relaxes scheduling requirements a bit.
|
||||||
|
|
||||||
# [v1.42.0] 2023-04-01
|
# [v1.42.0] 2023-04-01
|
||||||
|
|
||||||
@ -100,7 +107,6 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Version of thermal controller which performs basic control tasks.
|
|
||||||
- The event `MEKF_RECOVERY` will be triggered in case the `MEKF` does manage to recover itself.
|
- The event `MEKF_RECOVERY` will be triggered in case the `MEKF` does manage to recover itself.
|
||||||
- The persistent TM stores now have low priorities and behave like background threads now. This
|
- The persistent TM stores now have low priorities and behave like background threads now. This
|
||||||
should prevent them from blocking or slowing down the system even during dumps
|
should prevent them from blocking or slowing down the system even during dumps
|
||||||
@ -112,8 +118,6 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
||||||
- EIVE system fallback and COM system fallback: Perform general subsystem handling first, then
|
|
||||||
event reception, and finally any new transition handling.
|
|
||||||
- Rework FSFW OSALs to properly support regular scheduling (NICE priorities) and real-time
|
- Rework FSFW OSALs to properly support regular scheduling (NICE priorities) and real-time
|
||||||
scheduling.
|
scheduling.
|
||||||
- STR: Move datalink layer to `StrComHandler` completely. DLL is now completely hidden from
|
- STR: Move datalink layer to `StrComHandler` completely. DLL is now completely hidden from
|
||||||
@ -137,7 +141,6 @@ will consitute of a breaking change warranting a new major release:
|
|||||||
- Bugfix for STR: Some action commands wrongfully declined.
|
- Bugfix for STR: Some action commands wrongfully declined.
|
||||||
- STR: No normal command handling while a special request like an image upload is active.
|
- STR: No normal command handling while a special request like an image upload is active.
|
||||||
- RS485 data line was not enabled when the transmitter was switched on.
|
- RS485 data line was not enabled when the transmitter was switched on.
|
||||||
>>>>>>> origin/develop
|
|
||||||
|
|
||||||
# [v1.39.0] 2023-03-21
|
# [v1.39.0] 2023-03-21
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ ReturnValue_t ImtqPollingTask::performOperation(uint8_t operationCode) {
|
|||||||
|
|
||||||
comStatus = returnvalue::OK;
|
comStatus = returnvalue::OK;
|
||||||
// Stopwatch watch;
|
// Stopwatch watch;
|
||||||
switch (currentRequest) {
|
switch (currentRequest.requestType) {
|
||||||
case imtq::RequestType::MEASURE_NO_ACTUATION: {
|
case imtq::RequestType::MEASURE_NO_ACTUATION: {
|
||||||
// Measured to take 24 ms for debug and release builds.
|
// Measured to take 24 ms for debug and release builds.
|
||||||
// Stopwatch watch;
|
// Stopwatch watch;
|
||||||
@ -51,6 +51,30 @@ void ImtqPollingTask::handleMeasureStep() {
|
|||||||
uint8_t* replyPtr;
|
uint8_t* replyPtr;
|
||||||
ImtqRepliesDefault replies(replyBuf.data());
|
ImtqRepliesDefault replies(replyBuf.data());
|
||||||
// If some startup handling is added later, set configured after it was done once.
|
// If some startup handling is added later, set configured after it was done once.
|
||||||
|
if (performStartup) {
|
||||||
|
// Set integration time for the MGM.
|
||||||
|
cmdBuf[0] = imtq::CC::SET_PARAM;
|
||||||
|
size_t dummy = 0;
|
||||||
|
SerializeAdapter::serialize(&imtq::param::INTEGRATION_TIME_SELECT, cmdBuf.data() + 1, &dummy,
|
||||||
|
cmdBuf.size(), SerializeIF::Endianness::LITTLE);
|
||||||
|
cmdBuf[3] = currentRequest.integrationTimeSel;
|
||||||
|
cmdLen = 4;
|
||||||
|
ReturnValue_t result = performI2cFullRequest(replyBuf.data(), 5);
|
||||||
|
if (result != returnvalue::OK) {
|
||||||
|
comStatus = imtq::STARTUP_CFG_ERROR;
|
||||||
|
}
|
||||||
|
if (replyBuf[0] != imtq::CC::SET_PARAM) {
|
||||||
|
sif::error << "ImtqPollingTask: First byte of reply not equal to sent CC" << std::endl;
|
||||||
|
comStatus = imtq::STARTUP_CFG_ERROR;
|
||||||
|
}
|
||||||
|
if (replyBuf[4] != currentRequest.integrationTimeSel) {
|
||||||
|
sif::error << "ImtqPollingTask: Integration time configuration failed" << std::endl;
|
||||||
|
comStatus = imtq::STARTUP_CFG_ERROR;
|
||||||
|
}
|
||||||
|
currentIntegrationTimeMs =
|
||||||
|
imtq::integrationTimeFromSelectValue(currentRequest.integrationTimeSel);
|
||||||
|
performStartup = false;
|
||||||
|
}
|
||||||
replies.setConfigured();
|
replies.setConfigured();
|
||||||
|
|
||||||
// Can be used later to verify correct timing (e.g. all data has been read)
|
// Can be used later to verify correct timing (e.g. all data has been read)
|
||||||
@ -73,7 +97,7 @@ void ImtqPollingTask::handleMeasureStep() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (specialRequest != imtq::SpecialRequest::NONE) {
|
if (currentRequest.specialRequest != imtq::SpecialRequest::NONE) {
|
||||||
auto executeSelfTest = [&](imtq::selfTest::Axis axis) {
|
auto executeSelfTest = [&](imtq::selfTest::Axis axis) {
|
||||||
cmdBuf[0] = imtq::CC::SELF_TEST_CMD;
|
cmdBuf[0] = imtq::CC::SELF_TEST_CMD;
|
||||||
cmdBuf[1] = axis;
|
cmdBuf[1] = axis;
|
||||||
@ -81,7 +105,7 @@ void ImtqPollingTask::handleMeasureStep() {
|
|||||||
};
|
};
|
||||||
// If a self-test is already ongoing, ignore the request.
|
// If a self-test is already ongoing, ignore the request.
|
||||||
if (replies.getSystemState()[2] != static_cast<uint8_t>(imtq::mode::SELF_TEST)) {
|
if (replies.getSystemState()[2] != static_cast<uint8_t>(imtq::mode::SELF_TEST)) {
|
||||||
switch (specialRequest) {
|
switch (currentRequest.specialRequest) {
|
||||||
case (imtq::SpecialRequest::DO_SELF_TEST_POS_X): {
|
case (imtq::SpecialRequest::DO_SELF_TEST_POS_X): {
|
||||||
executeSelfTest(imtq::selfTest::Axis::X_POSITIVE);
|
executeSelfTest(imtq::selfTest::Axis::X_POSITIVE);
|
||||||
break;
|
break;
|
||||||
@ -234,18 +258,21 @@ ReturnValue_t ImtqPollingTask::initializeInterface(CookieIF* cookie) {
|
|||||||
ReturnValue_t ImtqPollingTask::sendMessage(CookieIF* cookie, const uint8_t* sendData,
|
ReturnValue_t ImtqPollingTask::sendMessage(CookieIF* cookie, const uint8_t* sendData,
|
||||||
size_t sendLen) {
|
size_t sendLen) {
|
||||||
const auto* imtqReq = reinterpret_cast<const imtq::Request*>(sendData);
|
const auto* imtqReq = reinterpret_cast<const imtq::Request*>(sendData);
|
||||||
|
if (sendLen != sizeof(imtq::Request)) {
|
||||||
|
return returnvalue::FAILED;
|
||||||
|
}
|
||||||
{
|
{
|
||||||
MutexGuard mg(ipcLock);
|
MutexGuard mg(ipcLock);
|
||||||
if (imtqReq->request == imtq::RequestType::ACTUATE) {
|
|
||||||
std::memcpy(dipoles, imtqReq->dipoles, sizeof(dipoles));
|
|
||||||
torqueDuration = imtqReq->torqueDuration;
|
|
||||||
}
|
|
||||||
currentRequest = imtqReq->request;
|
|
||||||
specialRequest = imtqReq->specialRequest;
|
|
||||||
if (state != InternalState::IDLE) {
|
if (state != InternalState::IDLE) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
state = InternalState::IS_BUSY;
|
state = InternalState::IS_BUSY;
|
||||||
|
if (currentRequest.mode != imtqReq->mode) {
|
||||||
|
if (imtqReq->mode == acs::SimpleSensorMode::NORMAL) {
|
||||||
|
performStartup = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::memcpy(¤tRequest, imtqReq, sendLen);
|
||||||
}
|
}
|
||||||
semaphore->release();
|
semaphore->release();
|
||||||
|
|
||||||
@ -345,10 +372,10 @@ void ImtqPollingTask::buildDipoleCommand() {
|
|||||||
uint8_t* serPtr = cmdBuf.data() + 1;
|
uint8_t* serPtr = cmdBuf.data() + 1;
|
||||||
size_t serLen = 0;
|
size_t serLen = 0;
|
||||||
for (uint8_t idx = 0; idx < 3; idx++) {
|
for (uint8_t idx = 0; idx < 3; idx++) {
|
||||||
SerializeAdapter::serialize(&dipoles[idx], &serPtr, &serLen, cmdBuf.size(),
|
SerializeAdapter::serialize(¤tRequest.dipoles[idx], &serPtr, &serLen, cmdBuf.size(),
|
||||||
SerializeIF::Endianness::LITTLE);
|
SerializeIF::Endianness::LITTLE);
|
||||||
}
|
}
|
||||||
SerializeAdapter::serialize(&torqueDuration, &serPtr, &serLen, cmdBuf.size(),
|
SerializeAdapter::serialize(¤tRequest.torqueDuration, &serPtr, &serLen, cmdBuf.size(),
|
||||||
SerializeIF::Endianness::LITTLE);
|
SerializeIF::Endianness::LITTLE);
|
||||||
// sif::debug << "Dipole X: " << dipoles[0] << std::endl;
|
// sif::debug << "Dipole X: " << dipoles[0] << std::endl;
|
||||||
// sif::debug << "Torqeu Dur: " << torqueDuration << std::endl;
|
// sif::debug << "Torqeu Dur: " << torqueDuration << std::endl;
|
||||||
@ -357,22 +384,28 @@ void ImtqPollingTask::buildDipoleCommand() {
|
|||||||
|
|
||||||
ReturnValue_t ImtqPollingTask::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
|
ReturnValue_t ImtqPollingTask::readReceivedMessage(CookieIF* cookie, uint8_t** buffer,
|
||||||
size_t* size) {
|
size_t* size) {
|
||||||
imtq::RequestType currentRequest;
|
imtq::Request currentRequest;
|
||||||
{
|
{
|
||||||
MutexGuard mg(ipcLock);
|
MutexGuard mg(ipcLock);
|
||||||
currentRequest = this->currentRequest;
|
std::memcpy(¤tRequest, &this->currentRequest, sizeof(currentRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t replyLen = 0;
|
size_t replyLen = 0;
|
||||||
MutexGuard mg(bufLock);
|
{
|
||||||
if (currentRequest == imtq::RequestType::MEASURE_NO_ACTUATION) {
|
MutexGuard mg(bufLock);
|
||||||
replyLen = getExchangeBufLen(specialRequest);
|
if (currentRequest.requestType == imtq::RequestType::MEASURE_NO_ACTUATION) {
|
||||||
memcpy(exchangeBuf.data(), replyBuf.data(), replyLen);
|
replyLen = getExchangeBufLen(currentRequest.specialRequest);
|
||||||
} else if (currentRequest == imtq::RequestType::ACTUATE) {
|
memcpy(exchangeBuf.data(), replyBuf.data(), replyLen);
|
||||||
replyLen = ImtqRepliesWithTorque::BASE_LEN;
|
} else if (currentRequest.requestType == imtq::RequestType::ACTUATE) {
|
||||||
memcpy(exchangeBuf.data(), replyBufActuation.data(), replyLen);
|
replyLen = ImtqRepliesWithTorque::BASE_LEN;
|
||||||
} else {
|
memcpy(exchangeBuf.data(), replyBufActuation.data(), replyLen);
|
||||||
*size = 0;
|
} else {
|
||||||
|
*size = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
MutexGuard mg(ipcLock);
|
||||||
|
this->currentRequest.requestType = imtq::RequestType::DO_NOTHING;
|
||||||
}
|
}
|
||||||
*buffer = exchangeBuf.data();
|
*buffer = exchangeBuf.data();
|
||||||
*size = replyLen;
|
*size = replyLen;
|
||||||
@ -417,6 +450,7 @@ void ImtqPollingTask::clearReadFlagsWithTorque(ImtqRepliesWithTorque& replies) {
|
|||||||
ReturnValue_t ImtqPollingTask::performI2cFullRequest(uint8_t* reply, size_t replyLen) {
|
ReturnValue_t ImtqPollingTask::performI2cFullRequest(uint8_t* reply, size_t replyLen) {
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
if (cmdLen == 0 or reply == nullptr) {
|
if (cmdLen == 0 or reply == nullptr) {
|
||||||
|
sif::error << "ImtqPollingTask: Command lenght is zero or reply PTR is invalid" << std::endl;
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <fsfw/tasks/SemaphoreIF.h>
|
#include <fsfw/tasks/SemaphoreIF.h>
|
||||||
#include <fsfw_hal/linux/i2c/I2cCookie.h>
|
#include <fsfw_hal/linux/i2c/I2cCookie.h>
|
||||||
|
#include <mission/acs/acsBoardPolling.h>
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
@ -24,7 +25,6 @@ class ImtqPollingTask : public SystemObject,
|
|||||||
static constexpr ReturnValue_t NO_REPLY_AVAILABLE = returnvalue::makeCode(2, 0);
|
static constexpr ReturnValue_t NO_REPLY_AVAILABLE = returnvalue::makeCode(2, 0);
|
||||||
|
|
||||||
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
|
enum class InternalState { IDLE, IS_BUSY } state = InternalState::IDLE;
|
||||||
imtq::RequestType currentRequest = imtq::RequestType::MEASURE_NO_ACTUATION;
|
|
||||||
|
|
||||||
SemaphoreIF* semaphore;
|
SemaphoreIF* semaphore;
|
||||||
ReturnValue_t comStatus = returnvalue::OK;
|
ReturnValue_t comStatus = returnvalue::OK;
|
||||||
@ -38,10 +38,9 @@ class ImtqPollingTask : public SystemObject,
|
|||||||
// 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 = 6;
|
static constexpr uint32_t MGM_READ_BUFFER_TIME_MS = 6;
|
||||||
bool ignoreNextActuateRequest = false;
|
bool ignoreNextActuateRequest = false;
|
||||||
|
bool performStartup = false;
|
||||||
|
|
||||||
imtq::SpecialRequest specialRequest = imtq::SpecialRequest::NONE;
|
imtq::Request currentRequest{};
|
||||||
int16_t dipoles[3] = {};
|
|
||||||
uint16_t torqueDuration = 0;
|
|
||||||
|
|
||||||
std::array<uint8_t, 32> cmdBuf;
|
std::array<uint8_t, 32> cmdBuf;
|
||||||
std::array<uint8_t, 524> replyBuf;
|
std::array<uint8_t, 524> replyBuf;
|
||||||
|
@ -151,19 +151,25 @@ void ImtqHandler::doStartUp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ImtqHandler::doShutDown() {
|
void ImtqHandler::doShutDown() {
|
||||||
updatePeriodicReply(false, imtq::cmdIds::REPLY_NO_TORQUE);
|
if (internalState != InternalState::SHUTDOWN) {
|
||||||
updatePeriodicReply(false, imtq::cmdIds::REPLY_WITH_TORQUE);
|
commandExecuted = false;
|
||||||
specialRequestActive = false;
|
internalState = InternalState::SHUTDOWN;
|
||||||
firstReplyCycle = true;
|
}
|
||||||
internalState = InternalState::NONE;
|
if (internalState == InternalState::SHUTDOWN and commandExecuted) {
|
||||||
commandExecuted = false;
|
updatePeriodicReply(false, imtq::cmdIds::REPLY_NO_TORQUE);
|
||||||
statusSet.setValidity(false, true);
|
updatePeriodicReply(false, imtq::cmdIds::REPLY_WITH_TORQUE);
|
||||||
rawMtmNoTorque.setValidity(false, true);
|
specialRequestActive = false;
|
||||||
rawMtmWithTorque.setValidity(false, true);
|
firstReplyCycle = true;
|
||||||
hkDatasetNoTorque.setValidity(false, true);
|
internalState = InternalState::NONE;
|
||||||
hkDatasetWithTorque.setValidity(false, true);
|
commandExecuted = false;
|
||||||
calMtmMeasurementSet.setValidity(false, true);
|
statusSet.setValidity(false, true);
|
||||||
setMode(_MODE_POWER_DOWN);
|
rawMtmNoTorque.setValidity(false, true);
|
||||||
|
rawMtmWithTorque.setValidity(false, true);
|
||||||
|
hkDatasetNoTorque.setValidity(false, true);
|
||||||
|
hkDatasetWithTorque.setValidity(false, true);
|
||||||
|
calMtmMeasurementSet.setValidity(false, true);
|
||||||
|
setMode(_MODE_POWER_DOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
@ -178,7 +184,7 @@ ReturnValue_t ImtqHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
*id = imtq::cmdIds::REQUEST;
|
*id = imtq::cmdIds::REQUEST;
|
||||||
request.request = imtq::RequestType::DO_NOTHING;
|
request.requestType = imtq::RequestType::DO_NOTHING;
|
||||||
request.specialRequest = imtq::SpecialRequest::NONE;
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
||||||
expectedReply = DeviceHandlerIF::NO_COMMAND_ID;
|
expectedReply = DeviceHandlerIF::NO_COMMAND_ID;
|
||||||
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
rawPacket = reinterpret_cast<uint8_t*>(&request);
|
||||||
@ -190,7 +196,7 @@ 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) {
|
if (internalState == InternalState::STARTUP or internalState == InternalState::SHUTDOWN) {
|
||||||
*id = imtq::cmdIds::REQUEST;
|
*id = imtq::cmdIds::REQUEST;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
@ -201,7 +207,7 @@ ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
|
|||||||
const uint8_t* commandData,
|
const uint8_t* commandData,
|
||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
auto genericSpecialRequest = [&](imtq::SpecialRequest specialRequest) {
|
auto genericSpecialRequest = [&](imtq::SpecialRequest specialRequest) {
|
||||||
request.request = imtq::RequestType::MEASURE_NO_ACTUATION;
|
request.requestType = imtq::RequestType::MEASURE_NO_ACTUATION;
|
||||||
request.specialRequest = specialRequest;
|
request.specialRequest = specialRequest;
|
||||||
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
||||||
specialRequestActive = true;
|
specialRequestActive = true;
|
||||||
@ -238,9 +244,16 @@ ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
|
|||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case (imtq::cmdIds::REQUEST): {
|
case (imtq::cmdIds::REQUEST): {
|
||||||
request.request = imtq::RequestType::MEASURE_NO_ACTUATION;
|
request.requestType = imtq::RequestType::MEASURE_NO_ACTUATION;
|
||||||
request.specialRequest = imtq::SpecialRequest::NONE;
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
||||||
|
// 6 ms integration time instead of 10 ms.
|
||||||
|
request.integrationTimeSel = 2;
|
||||||
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
expectedReply = imtq::cmdIds::REPLY_NO_TORQUE;
|
||||||
|
if (internalState == InternalState::SHUTDOWN) {
|
||||||
|
request.mode = acs::SimpleSensorMode::OFF;
|
||||||
|
} else {
|
||||||
|
request.mode = acs::SimpleSensorMode::NORMAL;
|
||||||
|
}
|
||||||
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;
|
||||||
@ -267,7 +280,7 @@ ReturnValue_t ImtqHandler::buildCommandFromCommand(DeviceCommandId_t deviceComma
|
|||||||
}
|
}
|
||||||
|
|
||||||
expectedReply = imtq::cmdIds::REPLY_WITH_TORQUE;
|
expectedReply = imtq::cmdIds::REPLY_WITH_TORQUE;
|
||||||
request.request = imtq::RequestType::ACTUATE;
|
request.requestType = imtq::RequestType::ACTUATE;
|
||||||
request.specialRequest = imtq::SpecialRequest::NONE;
|
request.specialRequest = imtq::SpecialRequest::NONE;
|
||||||
std::memcpy(request.dipoles, dipoleSet.dipoles.value, sizeof(request.dipoles));
|
std::memcpy(request.dipoles, dipoleSet.dipoles.value, sizeof(request.dipoles));
|
||||||
request.torqueDuration = dipoleSet.currentTorqueDurationMs.value;
|
request.torqueDuration = dipoleSet.currentTorqueDurationMs.value;
|
||||||
@ -309,6 +322,9 @@ ReturnValue_t ImtqHandler::scanForReply(const uint8_t* start, size_t remainingSi
|
|||||||
if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or getMode() == _MODE_POWER_DOWN) {
|
if (getMode() == _MODE_WAIT_OFF or getMode() == _MODE_WAIT_ON or getMode() == _MODE_POWER_DOWN) {
|
||||||
return IGNORE_FULL_PACKET;
|
return IGNORE_FULL_PACKET;
|
||||||
}
|
}
|
||||||
|
if (internalState == InternalState::SHUTDOWN) {
|
||||||
|
commandExecuted = true;
|
||||||
|
}
|
||||||
if (remainingSize > 0) {
|
if (remainingSize > 0) {
|
||||||
*foundLen = remainingSize;
|
*foundLen = remainingSize;
|
||||||
*foundId = expectedReply;
|
*foundId = expectedReply;
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_
|
#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_
|
||||||
#define MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_
|
#define MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_
|
||||||
|
|
||||||
|
#include <mission/acs/defs.h>
|
||||||
|
|
||||||
#include "fsfw/thermal/tcsDefinitions.h"
|
#include "fsfw/thermal/tcsDefinitions.h"
|
||||||
#include "gyroAdisHelpers.h"
|
#include "gyroAdisHelpers.h"
|
||||||
|
|
||||||
namespace acs {
|
namespace acs {
|
||||||
|
|
||||||
enum SimpleSensorMode { NORMAL = 0, OFF = 1 };
|
|
||||||
|
|
||||||
struct Adis1650XRequest {
|
struct Adis1650XRequest {
|
||||||
SimpleSensorMode mode;
|
SimpleSensorMode mode;
|
||||||
adis1650x::Type type;
|
adis1650x::Type type;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
namespace acs {
|
namespace acs {
|
||||||
|
|
||||||
|
enum class SimpleSensorMode { NORMAL = 0, OFF = 1 };
|
||||||
|
|
||||||
// These modes are the submodes of the ACS controller and the modes of the ACS subsystem.
|
// These modes are the submodes of the ACS controller and the modes of the ACS subsystem.
|
||||||
enum AcsMode : Mode_t {
|
enum AcsMode : Mode_t {
|
||||||
OFF = HasModesIF::MODE_OFF,
|
OFF = HasModesIF::MODE_OFF,
|
||||||
|
@ -1,5 +1,26 @@
|
|||||||
#include "imtqHelpers.h"
|
#include "imtqHelpers.h"
|
||||||
|
|
||||||
|
uint16_t imtq::integrationTimeFromSelectValue(uint8_t value) {
|
||||||
|
switch (value) {
|
||||||
|
case (0):
|
||||||
|
return 2;
|
||||||
|
case (1):
|
||||||
|
return 3;
|
||||||
|
case (2):
|
||||||
|
return 6;
|
||||||
|
case (3):
|
||||||
|
return 10;
|
||||||
|
case (4):
|
||||||
|
return 20;
|
||||||
|
case (5):
|
||||||
|
return 40;
|
||||||
|
case (6):
|
||||||
|
return 80;
|
||||||
|
default:
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
size_t imtq::getReplySize(CC::CC cc, size_t* optSecondSize) {
|
size_t imtq::getReplySize(CC::CC cc, size_t* optSecondSize) {
|
||||||
switch (cc) {
|
switch (cc) {
|
||||||
// Software reset is a bit special and can also cause a I2C NAK because
|
// Software reset is a bit special and can also cause a I2C NAK because
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <fsfw/datapool/PoolReadGuard.h>
|
#include <fsfw/datapool/PoolReadGuard.h>
|
||||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||||
|
#include <mission/acs/defs.h>
|
||||||
|
|
||||||
class ImtqHandler;
|
class ImtqHandler;
|
||||||
|
|
||||||
@ -13,6 +14,8 @@ class ImtqHandler;
|
|||||||
|
|
||||||
namespace imtq {
|
namespace imtq {
|
||||||
|
|
||||||
|
uint16_t integrationTimeFromSelectValue(uint8_t value);
|
||||||
|
|
||||||
enum class RequestType : uint8_t { MEASURE_NO_ACTUATION, ACTUATE, DO_NOTHING };
|
enum class RequestType : uint8_t { MEASURE_NO_ACTUATION, ACTUATE, DO_NOTHING };
|
||||||
|
|
||||||
enum class SpecialRequest : uint8_t {
|
enum class SpecialRequest : uint8_t {
|
||||||
@ -27,7 +30,8 @@ enum class SpecialRequest : uint8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Request {
|
struct Request {
|
||||||
imtq::RequestType request = imtq::RequestType::MEASURE_NO_ACTUATION;
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
|
imtq::RequestType requestType = imtq::RequestType::MEASURE_NO_ACTUATION;
|
||||||
imtq::SpecialRequest specialRequest = imtq::SpecialRequest::NONE;
|
imtq::SpecialRequest specialRequest = imtq::SpecialRequest::NONE;
|
||||||
uint8_t integrationTimeSel = 3;
|
uint8_t integrationTimeSel = 3;
|
||||||
int16_t dipoles[3]{};
|
int16_t dipoles[3]{};
|
||||||
@ -57,9 +61,10 @@ static const ReturnValue_t CC_UNAVAILABLE = MAKE_RETURN_CODE(5);
|
|||||||
static const ReturnValue_t INTERNAL_PROCESSING_ERROR = MAKE_RETURN_CODE(6);
|
static const ReturnValue_t INTERNAL_PROCESSING_ERROR = MAKE_RETURN_CODE(6);
|
||||||
static const ReturnValue_t REJECTED_WITHOUT_REASON = MAKE_RETURN_CODE(7);
|
static const ReturnValue_t REJECTED_WITHOUT_REASON = MAKE_RETURN_CODE(7);
|
||||||
static const ReturnValue_t CMD_ERR_UNKNOWN = MAKE_RETURN_CODE(8);
|
static const ReturnValue_t CMD_ERR_UNKNOWN = MAKE_RETURN_CODE(8);
|
||||||
|
static constexpr ReturnValue_t STARTUP_CFG_ERROR = MAKE_RETURN_CODE(9);
|
||||||
//! [EXPORT] : [COMMENT] The status reply to a self test command was received but no self test
|
//! [EXPORT] : [COMMENT] The status reply to a self test command was received but no self test
|
||||||
//! command has been sent. This should normally never happen.
|
//! command has been sent. This should normally never happen.
|
||||||
static const ReturnValue_t UNEXPECTED_SELF_TEST_REPLY = MAKE_RETURN_CODE(0xA7);
|
static const ReturnValue_t UNEXPECTED_SELF_TEST_REPLY = MAKE_RETURN_CODE(10);
|
||||||
|
|
||||||
namespace cmdIds {
|
namespace cmdIds {
|
||||||
|
|
||||||
@ -162,6 +167,13 @@ enum CC : uint8_t {
|
|||||||
|
|
||||||
} // namespace CC
|
} // namespace CC
|
||||||
|
|
||||||
|
namespace param {
|
||||||
|
|
||||||
|
static constexpr uint16_t SEL_MTM = 0x2002;
|
||||||
|
static constexpr uint16_t INTEGRATION_TIME_SELECT = 0x2003;
|
||||||
|
|
||||||
|
} // namespace param
|
||||||
|
|
||||||
size_t getReplySize(CC::CC cc, size_t* optSecondSize = nullptr);
|
size_t getReplySize(CC::CC cc, size_t* optSecondSize = nullptr);
|
||||||
|
|
||||||
namespace mode {
|
namespace mode {
|
||||||
|
@ -129,7 +129,7 @@ void ThermalController::performControlOperation() {
|
|||||||
hpaLimits.opUpperLimit = 0;
|
hpaLimits.opUpperLimit = 0;
|
||||||
hpaLimits.nopUpperLimit = 0;
|
hpaLimits.nopUpperLimit = 0;
|
||||||
#endif
|
#endif
|
||||||
if(changedLimits) {
|
if (changedLimits) {
|
||||||
sif::debug << "ThermalController: changing limits" << std::endl; // TODO: rausschmeissen
|
sif::debug << "ThermalController: changing limits" << std::endl; // TODO: rausschmeissen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ void HeaterHandler::handleSwitchOnCommand(heater::Switchers heaterIdx) {
|
|||||||
// Just waiting for the main switch being set on
|
// Just waiting for the main switch being set on
|
||||||
return;
|
return;
|
||||||
} else if (mainSwitchState == PowerSwitchIF::SWITCH_OFF or
|
} else if (mainSwitchState == PowerSwitchIF::SWITCH_OFF or
|
||||||
mainSwitchState == PowerSwitchIF::SWITCH_UNKNOWN) {
|
mainSwitchState == PowerSwitchIF::SWITCH_UNKNOWN) {
|
||||||
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
mainLineSwitcher->sendSwitchCommand(mainLineSwitch, PowerSwitchIF::SWITCH_ON);
|
||||||
heater.mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
heater.mainSwitchCountdown.setTimeout(mainLineSwitcher->getSwitchDelayMs());
|
||||||
heater.waitMainSwitchOn = true;
|
heater.waitMainSwitchOn = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user