Merge pull request 'FixedTimeslotTask object check' (#10) from KSat/fsfw:luz_FixedTimeslotTask_ExistenceCheck into master
Now I think we are done here.
This commit is contained in:
commit
77c21fc2c7
@ -89,7 +89,10 @@ uint32_t FixedSlotSequence::getLengthMs() const {
|
||||
}
|
||||
|
||||
ReturnValue_t FixedSlotSequence::checkSequence() const {
|
||||
//Iterate through slotList and check successful creation. Checks if timing is ok (must be ascending) and if all handlers were found.
|
||||
if(slotList.empty()) {
|
||||
error << "Fixed Slot Sequence: Slot list is empty!" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
auto slotIt = slotList.begin();
|
||||
uint32_t count = 0;
|
||||
uint32_t time = 0;
|
||||
|
@ -6,12 +6,18 @@
|
||||
#include <list>
|
||||
|
||||
/**
|
||||
* \brief This class is the representation of a Polling Sequence Table in software.
|
||||
* @brief This class is the representation of a Polling Sequence Table in software.
|
||||
*
|
||||
* \details The FixedSlotSequence object maintains the dynamic execution of device handler objects.
|
||||
* The main idea is to create a list of device handlers, to announce all handlers to the
|
||||
* polling sequence and to maintain a list of polling slot objects. This slot list represents the
|
||||
* Polling Sequence Table in software. Each polling slot contains information to indicate when and
|
||||
* @details
|
||||
* The FixedSlotSequence object maintains the dynamic execution of
|
||||
* device handler objects.
|
||||
*
|
||||
* The main idea is to create a list of device handlers, to announce all
|
||||
* handlers to thepolling sequence and to maintain a list of
|
||||
* polling slot objects. This slot list represents the Polling Sequence Table
|
||||
* in software.
|
||||
*
|
||||
* Each polling slot contains information to indicate when and
|
||||
* which device handler shall be executed within a given polling period.
|
||||
* The sequence is then executed by iterating through this slot list.
|
||||
* Handlers are invoking by calling a certain function stored in the handler list.
|
||||
@ -97,6 +103,11 @@ public:
|
||||
*/
|
||||
std::list<FixedSequenceSlot*>::iterator current;
|
||||
|
||||
/**
|
||||
* Iterate through slotList and check successful creation.
|
||||
* Checks if timing is ok (must be ascending) and if all handlers were found.
|
||||
* @return
|
||||
*/
|
||||
ReturnValue_t checkSequence() const;
|
||||
protected:
|
||||
|
||||
|
@ -19,8 +19,7 @@ FixedTimeslotTask::~FixedTimeslotTask() {
|
||||
void FixedTimeslotTask::taskEntryPoint(void* argument) {
|
||||
|
||||
//The argument is re-interpreted as FixedTimeslotTask. The Task object is global, so it is found from any place.
|
||||
FixedTimeslotTask *originalTask(
|
||||
reinterpret_cast<FixedTimeslotTask*>(argument));
|
||||
FixedTimeslotTask *originalTask(reinterpret_cast<FixedTimeslotTask*>(argument));
|
||||
// Task should not start until explicitly requested
|
||||
// in FreeRTOS, tasks start as soon as they are created if the scheduler is running
|
||||
// but not if the scheduler is not running.
|
||||
@ -58,10 +57,21 @@ ReturnValue_t FixedTimeslotTask::startTask() {
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||
if(slotTimeMs == 0) {
|
||||
// FreeRTOS throws a sanity error for zero values, so we set
|
||||
// the time to one millisecond.
|
||||
slotTimeMs = 1;
|
||||
}
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
error << "Component " << std::hex << componentId <<
|
||||
" not found, not adding it to pst" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
uint32_t FixedTimeslotTask::getPeriodMs() const {
|
||||
return pst.getLengthMs();
|
||||
}
|
||||
|
@ -40,10 +40,16 @@ uint32_t FixedTimeslotTask::getPeriodMs() const {
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
error << "Component " << std::hex << componentId <<
|
||||
" not found, not adding it to pst" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
ReturnValue_t FixedTimeslotTask::checkSequence() const {
|
||||
return pst.checkSequence();
|
||||
}
|
||||
|
@ -66,12 +66,18 @@ ReturnValue_t PollingTask::startTask() {
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t PollingTask::addSlot(object_id_t componentId, uint32_t slotTimeMs,
|
||||
int8_t executionStep) {
|
||||
ReturnValue_t PollingTask::addSlot(object_id_t componentId,
|
||||
uint32_t slotTimeMs, int8_t executionStep) {
|
||||
if (objectManager->get<ExecutableObjectIF>(componentId) != nullptr) {
|
||||
pst.addSlot(componentId, slotTimeMs, executionStep, this);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
error << "Component " << std::hex << componentId <<
|
||||
" not found, not adding it to pst" << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
uint32_t PollingTask::getPeriodMs() const {
|
||||
return pst.getLengthMs();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user