bugfix for file system handler, running now

This commit is contained in:
Robin Müller 2021-07-19 14:02:17 +02:00 committed by Robin Mueller
parent fb3b5582ad
commit d4e5919a21
3 changed files with 18 additions and 3 deletions

View File

@ -95,6 +95,15 @@ void initmission::initTasks() {
initmission::printAddObjectError("UDP_POLLING", objects::UDP_POLLING_TASK);
}
// FS task, task interval does not matter because it runs in permanent loop, priority low
// because it is a non-essential background task
PeriodicTaskIF* fsTask = factory->createPeriodicTask(
"FILE_SYSTEM_TASK", 25, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, missedDeadlineFunc);
result = fsTask->addComponent(objects::FILE_SYSTEM_HANDLER);
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
}
#if TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
@ -137,6 +146,8 @@ void initmission::initTasks() {
#if TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask();
#endif
fsTask->startTask();
sif::info << "Tasks started.." << std::endl;
}

View File

@ -11,6 +11,7 @@
#include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
#include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/memory/FileSystemHandler.h"
#include "linux/devices/HeaterHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
@ -132,6 +133,7 @@ void ObjectFactory::produce(void* args){
createTestComponents();
#endif /* OBSW_ADD_TEST_CODE == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
}
void ObjectFactory::createTmpComponents() {

View File

@ -66,6 +66,7 @@ void FileSystemHandler::fileSystemHandlerLoop() {
// This task will have a low priority and will run permanently in the background
// so we will just run in a permanent loop here and check file system
// messages permanently
opCounter++;
TaskFactory::instance()->delayTask(1000);
}
@ -78,7 +79,7 @@ void FileSystemHandler::fileSystemCheckup() {
(statusPair.first == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT;
}
if((preferredSdCard == sd::SdCard::SLOT_1) and
else if((preferredSdCard == sd::SdCard::SLOT_1) and
(statusPair.second == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
}
@ -90,8 +91,9 @@ void FileSystemHandler::fileSystemCheckup() {
else {
sdString = "1";
}
sif::warning << "FileSystemHandler::performOperation: Inconsistent" <<
" state detected. Preferred SD card is " << sdString <<
sif::warning << "FileSystemHandler::performOperation: "
"Inconsistent state detected" << std::endl;
sif::warning << "Preferred SD card is " << sdString <<
" but does not appear to be mounted. Attempting fix.." << std::endl;
// This function will appear to fix the inconsistent state
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);