bugfix for file system handler, running now

This commit is contained in:
Robin Müller 2021-07-19 14:02:17 +02:00
parent 674865429f
commit a6280da4ba
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
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); 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 #if TEST_CCSDS_BRIDGE == 1
PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask( PeriodicTaskIF* ptmeTestTask = factory->createPeriodicTask(
"PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc); "PTME_TEST", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
@ -137,6 +146,8 @@ void initmission::initTasks() {
#if TEST_CCSDS_BRIDGE == 1 #if TEST_CCSDS_BRIDGE == 1
ptmeTestTask->startTask(); ptmeTestTask->startTask();
#endif #endif
fsTask->startTask();
sif::info << "Tasks started.." << std::endl; sif::info << "Tasks started.." << std::endl;
} }

View File

@ -11,6 +11,7 @@
#include "bsp_q7s/core/CoreController.h" #include "bsp_q7s/core/CoreController.h"
#include "bsp_q7s/spiCallbacks/rwSpiCallback.h" #include "bsp_q7s/spiCallbacks/rwSpiCallback.h"
#include "bsp_q7s/boardtest/Q7STestTask.h" #include "bsp_q7s/boardtest/Q7STestTask.h"
#include "bsp_q7s/memory/FileSystemHandler.h"
#include "linux/devices/HeaterHandler.h" #include "linux/devices/HeaterHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h" #include "linux/devices/SolarArrayDeploymentHandler.h"
@ -132,6 +133,7 @@ void ObjectFactory::produce(void* args){
createTestComponents(); createTestComponents();
#endif /* OBSW_ADD_TEST_CODE == 1 */ #endif /* OBSW_ADD_TEST_CODE == 1 */
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
} }
void ObjectFactory::createTmpComponents() { 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 // 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 // so we will just run in a permanent loop here and check file system
// messages permanently // messages permanently
opCounter++;
TaskFactory::instance()->delayTask(1000); TaskFactory::instance()->delayTask(1000);
} }
@ -78,7 +79,7 @@ void FileSystemHandler::fileSystemCheckup() {
(statusPair.first == sd::SdStatus::MOUNTED)) { (statusPair.first == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_0_MOUNT_POINT; 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)) { (statusPair.second == sd::SdStatus::MOUNTED)) {
currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT; currentMountPrefix = SdCardManager::SD_1_MOUNT_POINT;
} }
@ -90,8 +91,9 @@ void FileSystemHandler::fileSystemCheckup() {
else { else {
sdString = "1"; sdString = "1";
} }
sif::warning << "FileSystemHandler::performOperation: Inconsistent" << sif::warning << "FileSystemHandler::performOperation: "
" state detected. Preferred SD card is " << sdString << "Inconsistent state detected" << std::endl;
sif::warning << "Preferred SD card is " << sdString <<
" but does not appear to be mounted. Attempting fix.." << std::endl; " but does not appear to be mounted. Attempting fix.." << std::endl;
// This function will appear to fix the inconsistent state // This function will appear to fix the inconsistent state
ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard); ReturnValue_t result = sdcMan->sanitizeState(&statusPair, preferredSdCard);