adapted MessageQueueSenderIF function calls
This commit is contained in:
@ -105,11 +105,14 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
//The component for this slot is executed and the next one is chosen.
|
||||
this->pst.executeAndAdvance();
|
||||
if (not pst.slotFollowsImmediately()) {
|
||||
// Get the interval till execution of the next slot.
|
||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
||||
interval = pdMS_TO_TICKS(intervalMs);
|
||||
|
||||
/* If all operations are finished and the difference of the
|
||||
* current time minus the last wake time is larger than the
|
||||
* expected wait period, a deadline was missed. */
|
||||
if(xTaskGetTickCount() - xLastWakeTime >=
|
||||
pdMS_TO_TICKS(this->pst.getIntervalToPreviousSlotMs())) {
|
||||
if(xTaskGetTickCount() - xLastWakeTime >= interval) {
|
||||
#ifdef DEBUG
|
||||
sif::warning << "FixedTimeslotTask: " << pcTaskGetName(NULL) <<
|
||||
" missed deadline!\n" << std::flush;
|
||||
@ -117,14 +120,9 @@ void FixedTimeslotTask::taskFunctionality() {
|
||||
if(deadlineMissedFunc != nullptr) {
|
||||
this->deadlineMissedFunc();
|
||||
}
|
||||
// Continue immediately, no need to wait.
|
||||
continue;
|
||||
}
|
||||
|
||||
// we need to wait before executing the current slot
|
||||
//this gives us the time to wait:
|
||||
intervalMs = this->pst.getIntervalToPreviousSlotMs();
|
||||
interval = pdMS_TO_TICKS(intervalMs);
|
||||
// Wait for the interval. This exits immediately if a deadline was
|
||||
// missed while also updating the last wake time.
|
||||
vTaskDelayUntil(&xLastWakeTime, interval);
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +80,12 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message,
|
||||
}
|
||||
|
||||
ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) {
|
||||
if(message->getMaximumMessageSize() < maxMessageSize) {
|
||||
sif::error << "MessageQueue::receiveMessage: Message size "
|
||||
<< message->getMaximumMessageSize() <<
|
||||
" too small to receive data!" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
BaseType_t result = xQueueReceive(handle,reinterpret_cast<void*>(
|
||||
message->getBuffer()), 0);
|
||||
if (result == pdPASS){
|
||||
@ -126,8 +132,10 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
||||
message->setSender(sentFrom);
|
||||
BaseType_t result;
|
||||
if(message->getMaximumMessageSize() > maxSize) {
|
||||
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size"
|
||||
"too large for queue!" << std::endl;
|
||||
sif::error << "MessageQueue::sendMessageFromMessageQueue: Message size "
|
||||
<< message->getMaximumMessageSize() << " too large for queue"
|
||||
" with max. message size " << maxSize << "!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,11 @@ QueueFactory* QueueFactory::factoryInstance = nullptr;
|
||||
ReturnValue_t MessageQueueSenderIF::sendMessage(MessageQueueId_t sendTo,
|
||||
MessageQueueMessageIF* message, size_t maxSize,
|
||||
MessageQueueId_t sentFrom, bool ignoreFault) {
|
||||
if(maxSize == 0) {
|
||||
sif::error << "MessageQueueSenderIF::sendMessage: Max Size is 0!"
|
||||
<< std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return MessageQueue::sendMessageFromMessageQueue(sendTo,message, maxSize,
|
||||
sentFrom,ignoreFault);
|
||||
}
|
||||
|
Reference in New Issue
Block a user