Merge pull request 'DHB Mode Off disable pending commands' (#95) from meier/dhb-disable-pending-commands into develop
Reviewed-on: eive/fsfw#95 Reviewed-by: Robin Müller <muellerr@irs.uni-stuttgart.de>
This commit is contained in:
commit
5a69c1f8b9
@ -572,6 +572,9 @@ void DeviceHandlerBase::setMode(Mode_t newMode, uint8_t newSubmode) {
|
|||||||
mode = newMode;
|
mode = newMode;
|
||||||
modeChanged();
|
modeChanged();
|
||||||
setNormalDatapoolEntriesInvalid();
|
setNormalDatapoolEntriesInvalid();
|
||||||
|
if (newMode == MODE_OFF) {
|
||||||
|
disableCommandsAndReplies();
|
||||||
|
}
|
||||||
if (!isTransitionalMode()) {
|
if (!isTransitionalMode()) {
|
||||||
modeHelper.modeChanged(newMode, newSubmode);
|
modeHelper.modeChanged(newMode, newSubmode);
|
||||||
announceMode(false);
|
announceMode(false);
|
||||||
@ -1567,3 +1570,22 @@ void DeviceHandlerBase::setParent(object_id_t parent) { this->parent = parent; }
|
|||||||
void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) {
|
void DeviceHandlerBase::setPowerSwitcher(PowerSwitchIF* switcher) {
|
||||||
this->powerSwitcher = switcher;
|
this->powerSwitcher = switcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeviceHandlerBase::disableCommandsAndReplies() {
|
||||||
|
for (auto& command : deviceCommandMap) {
|
||||||
|
if (command.second.isExecuting) {
|
||||||
|
command.second.isExecuting = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto& reply : deviceReplyMap) {
|
||||||
|
if (!reply.second.periodic) {
|
||||||
|
if (reply.second.countdown != nullptr) {
|
||||||
|
reply.second.countdown->timeOut();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reply.second.delayCycles = 0;
|
||||||
|
}
|
||||||
|
reply.second.active = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1325,6 +1325,11 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
|||||||
void printWarningOrError(sif::OutputTypes errorType, const char *functionName,
|
void printWarningOrError(sif::OutputTypes errorType, const char *functionName,
|
||||||
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
ReturnValue_t errorCode = HasReturnvaluesIF::RETURN_FAILED,
|
||||||
const char *errorPrint = nullptr);
|
const char *errorPrint = nullptr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disables all commands and replies when device is set to MODE_OFF
|
||||||
|
*/
|
||||||
|
void disableCommandsAndReplies();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERBASE_H_ */
|
#endif /* FSFW_DEVICEHANDLERS_DEVICEHANDLERBASE_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user