add new MessageQueue to ModeHelper; which is equal to the parentQueue and can command the object without forcing the object to EXTERNAL_CONTROL

This commit is contained in:
spahr@ksat-stuttgart.de 2025-03-29 23:28:24 +01:00
parent 131456e19e
commit 0681b1895b
2 changed files with 16 additions and 2 deletions

View File

@ -35,8 +35,12 @@ ReturnValue_t ModeHelper::handleModeCommand(CommandMessage* command) {
commandedMode = mode; commandedMode = mode;
commandedSubmode = submode; commandedSubmode = submode;
if ((parentQueueId != MessageQueueIF::NO_QUEUE) && // if (((parentQueueId != MessageQueueIF::NO_QUEUE) &&
(theOneWhoCommandedAMode != parentQueueId)) { // (theOneWhoCommandedAMode != parentQueueId))) {
// owner->setToExternalControl();
// }
if(theOneWhoCommandedAMode != parentQueueId and theOneWhoCommandedAMode != powerswitchQueueId) {
owner->setToExternalControl(); owner->setToExternalControl();
} }
@ -106,3 +110,7 @@ bool ModeHelper::isTimedOut() { return countdown.hasTimedOut(); }
bool ModeHelper::isForced() { return forced; } bool ModeHelper::isForced() { return forced; }
void ModeHelper::setForced(bool forced) { this->forced = forced; } void ModeHelper::setForced(bool forced) { this->forced = forced; }
void ModeHelper::setPowerswitchQueueId(MessageQueueId_t queueId) {
powerswitchQueueId = queueId;
}

View File

@ -25,6 +25,11 @@ class ModeHelper {
*/ */
void setParentQueue(MessageQueueId_t parentQueueId); void setParentQueue(MessageQueueId_t parentQueueId);
/**
* Set to MessageQueue::NO_QUEUE if no powerswitch is commanding the obejct.
*/
void setPowerswitchQueueId(MessageQueueId_t queueId);
ReturnValue_t initialize(MessageQueueId_t parentQueueId); ReturnValue_t initialize(MessageQueueId_t parentQueueId);
ReturnValue_t initialize(void); ReturnValue_t initialize(void);
@ -42,6 +47,7 @@ class ModeHelper {
protected: protected:
HasModesIF *owner; HasModesIF *owner;
MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE; MessageQueueId_t parentQueueId = MessageQueueIF::NO_QUEUE;
MessageQueueId_t powerswitchQueueId = MessageQueueIF::NO_QUEUE;
Countdown countdown; Countdown countdown;