tcs assembly working for now
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
This commit is contained in:
parent
5fb4e468ba
commit
3e9910b1d2
2
fsfw
2
fsfw
@ -1 +1 @@
|
|||||||
Subproject commit bbe21e7e8957a39e6697c6dd4fb2fe044b560044
|
Subproject commit 4b5e3e70f7eb65780b697a81ba95ecc2a74a8b84
|
@ -87,6 +87,7 @@ void Max31865PT1000Handler::doStartUp() {
|
|||||||
|
|
||||||
void Max31865PT1000Handler::doShutDown() {
|
void Max31865PT1000Handler::doShutDown() {
|
||||||
commandExecuted = false;
|
commandExecuted = false;
|
||||||
|
warningSwitch = true;
|
||||||
setMode(_MODE_POWER_DOWN);
|
setMode(_MODE_POWER_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -319,15 +320,15 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case (Max31865Definitions::REQUEST_CONFIG): {
|
case (Max31865Definitions::REQUEST_CONFIG): {
|
||||||
if (packet[1] != DEFAULT_CONFIG) {
|
if (packet[1] != DEFAULT_CONFIG) {
|
||||||
if(warningSwitch) {
|
if (warningSwitch) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
// it propably would be better if we at least try one restart..
|
// it propably would be better if we at least try one restart..
|
||||||
sif::warning << "Max31865PT1000Handler: 0x" << std::hex << this->getObjectId()
|
sif::warning << "Max31865PT1000Handler: 0x" << std::hex << this->getObjectId()
|
||||||
<< ": Invalid configuration reply" << std::endl;
|
<< ": Invalid configuration reply" << std::endl;
|
||||||
#else
|
#else
|
||||||
sif::printWarning("Max31865PT1000Handler: %04x: Invalid configuration reply!\n",
|
sif::printWarning("Max31865PT1000Handler: %04x: Invalid configuration reply!\n",
|
||||||
this->getObjectId());
|
this->getObjectId());
|
||||||
#endif
|
#endif
|
||||||
warningSwitch = false;
|
warningSwitch = false;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
@ -508,10 +509,6 @@ ReturnValue_t Max31865PT1000Handler::getSwitches(const uint8_t **switches,
|
|||||||
return DeviceHandlerBase::NO_SWITCH;
|
return DeviceHandlerBase::NO_SWITCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Max31865PT1000Handler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
|
||||||
DeviceHandlerBase::doTransition(modeFrom, subModeFrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry<float>({0}));
|
localDataPoolMap.emplace(Max31865Definitions::PoolIds::RTD_VALUE, new PoolEntry<float>({0}));
|
||||||
|
@ -74,8 +74,6 @@ class Max31865PT1000Handler : public DeviceHandlerBase {
|
|||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
|
ReturnValue_t getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) override;
|
||||||
|
|
||||||
void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override;
|
|
||||||
|
|
||||||
void debugInterface(uint8_t positionTracker = 0, object_id_t objectId = 0,
|
void debugInterface(uint8_t positionTracker = 0, object_id_t objectId = 0,
|
||||||
uint32_t parameter = 0) override;
|
uint32_t parameter = 0) override;
|
||||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
@ -84,7 +82,7 @@ class Max31865PT1000Handler : public DeviceHandlerBase {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t switchId = 0;
|
uint8_t switchId = 0;
|
||||||
bool instantNormal = true;
|
bool instantNormal = false;
|
||||||
bool warningSwitch = true;
|
bool warningSwitch = true;
|
||||||
|
|
||||||
enum class InternalState {
|
enum class InternalState {
|
||||||
|
@ -8,6 +8,14 @@ TcsBoardAssembly::TcsBoardAssembly(object_id_t objectId, object_id_t parentId,
|
|||||||
TcsBoardHelper helper)
|
TcsBoardHelper helper)
|
||||||
: AssemblyBase(objectId, parentId, 24), switcher(pwrSwitcher, theSwitch), helper(helper) {
|
: AssemblyBase(objectId, parentId, 24), switcher(pwrSwitcher, theSwitch), helper(helper) {
|
||||||
eventQueue = QueueFactory::instance()->createMessageQueue(24);
|
eventQueue = QueueFactory::instance()->createMessageQueue(24);
|
||||||
|
ModeListEntry entry;
|
||||||
|
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
||||||
|
entry.setObject(helper.rtdIds[idx]);
|
||||||
|
entry.setMode(MODE_OFF);
|
||||||
|
entry.setSubmode(SUBMODE_NONE);
|
||||||
|
entry.setInheritSubmode(false);
|
||||||
|
modeTable.insert(entry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcsBoardAssembly::performChildOperation() {
|
void TcsBoardAssembly::performChildOperation() {
|
||||||
@ -24,7 +32,7 @@ void TcsBoardAssembly::performChildOperation() {
|
|||||||
switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
||||||
// Indicator that mode commanding can be performed now
|
// Indicator that mode commanding can be performed now
|
||||||
AssemblyBase::startTransition(targetMode, targetSubmode);
|
AssemblyBase::startTransition(targetMode, targetSubmode);
|
||||||
AssemblyBase::performChildOperation();
|
// AssemblyBase::performChildOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,14 +54,33 @@ ReturnValue_t TcsBoardAssembly::commandChildren(Mode_t mode, Submode_t submode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t TcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) {
|
ReturnValue_t TcsBoardAssembly::checkChildrenStateOn(Mode_t wantedMode, Submode_t wantedSubmode) {
|
||||||
uint8_t devsInWrongMode = 0;
|
int devsInWrongMode = 0;
|
||||||
|
try {
|
||||||
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
||||||
if (childrenMap[idx].mode != wantedMode) {
|
if (childrenMap.at(helper.rtdIds[idx]).mode != wantedMode) {
|
||||||
devsInWrongMode++;
|
devsInWrongMode++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const std::out_of_range& e) {
|
||||||
|
sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
if (devsInWrongMode == 16) {
|
||||||
|
if (warningSwitch) {
|
||||||
|
sif::warning << "TcsBoardAssembly::checkChildrenStateOn: All devices in"
|
||||||
|
<< " wrong mode" << std::endl;
|
||||||
|
warningSwitch = false;
|
||||||
|
}
|
||||||
|
return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE;
|
||||||
|
}
|
||||||
// TODO: Can't really do something other than power cycling if devices in wrong mode.
|
// TODO: Can't really do something other than power cycling if devices in wrong mode.
|
||||||
// Might attempt one power-cycle. In any case, trigger an event
|
// Might attempt one power-cycle. In any case, trigger an event
|
||||||
|
if (devsInWrongMode > 0) {
|
||||||
|
if (warningSwitch) {
|
||||||
|
sif::warning << "TcsBoardAssembly::checkChildrenStateOn: " << devsInWrongMode << " devices in"
|
||||||
|
<< " wrong mode" << std::endl;
|
||||||
|
warningSwitch = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +104,7 @@ ReturnValue_t TcsBoardAssembly::initialize() {
|
|||||||
|
|
||||||
void TcsBoardAssembly::startTransition(Mode_t mode, Submode_t submode) {
|
void TcsBoardAssembly::startTransition(Mode_t mode, Submode_t submode) {
|
||||||
if (mode != MODE_OFF) {
|
if (mode != MODE_OFF) {
|
||||||
switcher.turnOn();
|
switcher.turnOn(true);
|
||||||
switcher.doStateMachine();
|
switcher.doStateMachine();
|
||||||
if (switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
if (switcher.getState() == PowerSwitcher::SWITCH_IS_ON) {
|
||||||
AssemblyBase::startTransition(mode, submode);
|
AssemblyBase::startTransition(mode, submode);
|
||||||
@ -87,6 +114,7 @@ void TcsBoardAssembly::startTransition(Mode_t mode, Submode_t submode) {
|
|||||||
targetSubmode = submode;
|
targetSubmode = submode;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Perform regular mode commanding first
|
||||||
AssemblyBase::startTransition(mode, submode);
|
AssemblyBase::startTransition(mode, submode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,8 +124,9 @@ ReturnValue_t TcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
|
|||||||
bool needsSecondStep = false;
|
bool needsSecondStep = false;
|
||||||
Mode_t devMode = 0;
|
Mode_t devMode = 0;
|
||||||
object_id_t objId = 0;
|
object_id_t objId = 0;
|
||||||
|
try {
|
||||||
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
for (uint8_t idx = 0; idx < NUMBER_RTDS; idx++) {
|
||||||
devMode = childrenMap[idx].mode;
|
devMode = childrenMap.at(helper.rtdIds[idx]).mode;
|
||||||
objId = helper.rtdIds[idx];
|
objId = helper.rtdIds[idx];
|
||||||
if (mode == devMode) {
|
if (mode == devMode) {
|
||||||
modeTable[idx].setMode(mode);
|
modeTable[idx].setMode(mode);
|
||||||
@ -121,6 +150,9 @@ ReturnValue_t TcsBoardAssembly::handleNormalOrOnModeCmd(Mode_t mode, Submode_t s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (const std::out_of_range& e) {
|
||||||
|
sif::error << "TcsBoardAssembly: Invalid children map: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
if (needsSecondStep) {
|
if (needsSecondStep) {
|
||||||
result = NEED_SECOND_STEP;
|
result = NEED_SECOND_STEP;
|
||||||
}
|
}
|
||||||
@ -147,7 +179,7 @@ MessageQueueId_t TcsBoardAssembly::getEventReceptionQueue() { return eventQueue-
|
|||||||
|
|
||||||
void TcsBoardAssembly::handleModeReached() {
|
void TcsBoardAssembly::handleModeReached() {
|
||||||
if (targetMode == MODE_OFF) {
|
if (targetMode == MODE_OFF) {
|
||||||
switcher.turnOff();
|
switcher.turnOff(true);
|
||||||
switcher.doStateMachine();
|
switcher.doStateMachine();
|
||||||
// Need to wait with call to AssemblyBase::handleModeReached until power switcher is done
|
// Need to wait with call to AssemblyBase::handleModeReached until power switcher is done
|
||||||
if (switcher.getState() == PowerSwitcher::SWITCH_IS_OFF) {
|
if (switcher.getState() == PowerSwitcher::SWITCH_IS_OFF) {
|
||||||
@ -157,3 +189,17 @@ void TcsBoardAssembly::handleModeReached() {
|
|||||||
AssemblyBase::handleModeReached();
|
AssemblyBase::handleModeReached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TcsBoardAssembly::handleChildrenLostMode(ReturnValue_t result) {
|
||||||
|
// TODO: Maybe trigger event
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TcsBoardAssembly::handleModeTransitionFailed(ReturnValue_t result) {
|
||||||
|
if (targetMode == MODE_OFF) {
|
||||||
|
AssemblyBase::handleModeTransitionFailed(result);
|
||||||
|
} else {
|
||||||
|
// To avoid transitioning back to off
|
||||||
|
triggerEvent(MODE_TRANSITION_FAILED, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -23,6 +23,7 @@ class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF {
|
|||||||
private:
|
private:
|
||||||
static constexpr uint8_t NUMBER_RTDS = 16;
|
static constexpr uint8_t NUMBER_RTDS = 16;
|
||||||
PowerSwitcher switcher;
|
PowerSwitcher switcher;
|
||||||
|
bool warningSwitch = true;
|
||||||
TcsBoardHelper helper;
|
TcsBoardHelper helper;
|
||||||
FixedArrayList<ModeListEntry, NUMBER_RTDS> modeTable;
|
FixedArrayList<ModeListEntry, NUMBER_RTDS> modeTable;
|
||||||
MessageQueueIF* eventQueue = nullptr;
|
MessageQueueIF* eventQueue = nullptr;
|
||||||
@ -45,6 +46,8 @@ class TcsBoardAssembly : public AssemblyBase, public ConfirmsFailuresIF {
|
|||||||
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) override;
|
||||||
void startTransition(Mode_t mode, Submode_t submode) override;
|
void startTransition(Mode_t mode, Submode_t submode) override;
|
||||||
void handleModeReached() override;
|
void handleModeReached() override;
|
||||||
|
void handleChildrenLostMode(ReturnValue_t result) override;
|
||||||
|
void handleModeTransitionFailed(ReturnValue_t result) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_SYSTEM_TCSSUBSYSTEM_H_ */
|
#endif /* MISSION_SYSTEM_TCSSUBSYSTEM_H_ */
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit a55940339850e862b05a06a94fa8381bf7da0743
|
Subproject commit 0abdea987a677a629173b6ec9cd2fa8dc265cb24
|
Loading…
Reference in New Issue
Block a user