continued tests, first fixes
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
Robin Müller 2022-02-28 16:47:36 +01:00
parent a2bc72a798
commit 8c2c402821
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
7 changed files with 53 additions and 21 deletions

View File

@ -1198,8 +1198,8 @@ void CoreController::performRebootFileHandling(bool recreateFile) {
if (rebootFile.bootFlag) {
// Trigger event to inform ground that a reboot was triggered
uint32_t p1 = rebootFile.lastChip << 16 | rebootFile.lastCopy;
uint32_t p2 = rebootFile.img00Cnt << 24 | rebootFile.img01Cnt << 16 |
rebootFile.img10Cnt << 8 | rebootFile.img11Cnt;
uint32_t p2 = rebootFile.img00Cnt << 24 | rebootFile.img01Cnt << 16 | rebootFile.img10Cnt << 8 |
rebootFile.img11Cnt;
triggerEvent(REBOOT_MECHANISM_TRIGGERED, p1, p2);
// Clear the boot flag
rebootFile.bootFlag = false;
@ -1512,12 +1512,12 @@ void CoreController::resetRebootCount(xsc::Chip tgtChip, xsc::Copy tgtCopy) {
}
void CoreController::performMountedSdCardOperations() {
if(doPerformMountedSdCardOps) {
if (doPerformMountedSdCardOps) {
bool sdCardMounted = false;
sdCardMounted = sdcMan->isSdCardMounted(sdInfo.pref);
if(sdCardMounted) {
if (sdCardMounted) {
std::string path = sdcMan->getCurrentMountPrefix(sdInfo.pref) + "/" + CONF_FOLDER;
if(not std::filesystem::exists(path)) {
if (not std::filesystem::exists(path)) {
std::filesystem::create_directory(path);
}
initVersionFile();

View File

@ -25,11 +25,11 @@ struct RebootFile {
bool enabled = false;
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
uint8_t img00Cnt = 0;
uint8_t img01Cnt = 0;
uint8_t img10Cnt = 0;
uint8_t img11Cnt = 0;
uint8_t relevantBootCnt = 0;
uint32_t img00Cnt = 0;
uint32_t img01Cnt = 0;
uint32_t img10Cnt = 0;
uint32_t img11Cnt = 0;
uint32_t relevantBootCnt = 0;
bool bootFlag = false;
xsc::Chip lastChip = xsc::Chip::CHIP_0;
xsc::Copy lastCopy = xsc::Copy::COPY_0;
@ -46,8 +46,10 @@ class CoreController : public ExtendedControllerBase {
static constexpr char CONF_FOLDER[] = "conf";
static constexpr char VERSION_FILE_NAME[] = "version.txt";
static constexpr char REBOOT_FILE_NAME[] = "reboot.txt";
const std::string VERSION_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
const std::string REBOOT_FILE = "/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
const std::string VERSION_FILE =
"/" + std::string(CONF_FOLDER) + "/" + std::string(VERSION_FILE_NAME);
const std::string REBOOT_FILE =
"/" + std::string(CONF_FOLDER) + "/" + std::string(REBOOT_FILE_NAME);
static constexpr ActionId_t LIST_DIRECTORY_INTO_FILE = 0;
static constexpr ActionId_t SWITCH_REBOOT_FILE_HANDLING = 5;

View File

@ -266,7 +266,7 @@ void initmission::createPstTasks(TaskFactory& factory,
sif::error << "InitMission::initTasks: GomSpace PST initialization failed!" << std::endl;
}
taskVec.push_back(gomSpacePstTask);
#else /* BOARD_TE7020 == 0 */
#else /* BOARD_TE7020 == 0 */
FixedTimeslotTaskIF* pollingSequenceTaskTE0720 = factory.createFixedTimeslotTask(
"PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 3.0, missedDeadlineFunc);
result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);

View File

@ -1,3 +1,6 @@
{
"editor.tabSize": 2
"editor.tabSize": 2,
"files.associations": {
"iosfwd": "cpp"
}
}

View File

@ -362,7 +362,7 @@ void CoreController::rewriteRebootFile(RebootFile file) {
rebootFile << "on: " << file.enabled << "\nmaxcnt: " << file.maxCount
<< "\nimg00: " << file.img00Cnt << "\nimg01: " << file.img01Cnt
<< "\nimg10: " << file.img10Cnt << "\nimg11: " << file.img11Cnt
<< "\nbootflag: " << file.bootFlag << "\nlast: " << file.lastChip << " "
<< file.lastCopy << "\n";
<< "\nbootflag: " << file.bootFlag << "\nlast: " << static_cast<int>(file.lastChip) << " "
<< static_cast<int>(file.lastCopy) << "\n";
}
}

View File

@ -19,11 +19,11 @@ struct RebootFile {
bool enabled = false;
size_t maxCount = DEFAULT_MAX_BOOT_CNT;
uint8_t img00Cnt = 0;
uint8_t img01Cnt = 0;
uint8_t img10Cnt = 0;
uint8_t img11Cnt = 0;
uint8_t relevantBootCnt = 0;
uint32_t img00Cnt = 0;
uint32_t img01Cnt = 0;
uint32_t img10Cnt = 0;
uint32_t img11Cnt = 0;
uint32_t relevantBootCnt = 0;
bool bootFlag = false;
xsc::Chip lastChip = xsc::Chip::CHIP_0;
xsc::Copy lastCopy = xsc::Copy::COPY_0;

View File

@ -1,8 +1,35 @@
#include "CoreController.h"
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include <fstream>
#include <filesystem>
static constexpr bool CAT_FILE_TO_CONSOLE = true;
const std::string CONF_PATH = "/tmp/conf";
const std::string REBOOT_FILE = CONF_PATH + "/reboot.txt";
void catFileToConsole();
TEST_CASE( "Core Controller Reboot File Handling", "[reboot-file]" ) {
if(not std::filesystem::exists(CONF_PATH)) {
std::filesystem::create_directory(CONF_PATH);
}
CoreController ctrl;
RebootFile rf;
ctrl.performRebootFileHandling(true);
catFileToConsole();
ctrl.parseRebootFile(REBOOT_FILE, rf);
REQUIRE(rf.enabled == 1);
REQUIRE(rf.enabled == 1);
std::filesystem::remove_all(CONF_PATH);
}
void catFileToConsole() {
if(CAT_FILE_TO_CONSOLE) {
std::ifstream file(REBOOT_FILE);
if (file.is_open()) {
std::cout << file.rdbuf();
}
}
}