v1.5.0 #60
@ -21,7 +21,7 @@ int main(void)
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
std::cout << "-- Compiled for " << COMPILE_PRINTOUT << " --" << std::endl;
|
||||
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
|
||||
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
|
||||
<< SW_SUBVERSION << "." << SW_REVISION << " -- " << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
initmission::initMission();
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "InitMission.h"
|
||||
#include <OBSWVersion.h>
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
#include <fsfw/tasks/TaskFactory.h>
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
#include "fsfw/tasks/TaskFactory.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@ -21,8 +22,9 @@ int main(void)
|
||||
{
|
||||
std::cout << "-- EIVE OBSW --" << std::endl;
|
||||
std::cout << "-- Compiled for Linux board " << BOARD_NAME << " --" << std::endl;
|
||||
std::cout << "-- Software version " << SW_NAME << " v" << SW_VERSION << "."
|
||||
<< SW_SUBVERSION << "." << SW_SUBSUBVERSION << " -- " << std::endl;
|
||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
||||
FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
initmission::initMission();
|
||||
|
@ -1,10 +1,12 @@
|
||||
#include "CoreController.h"
|
||||
#include "q7sConfig.h"
|
||||
#include "OBSWVersion.h"
|
||||
|
||||
#include "fsfw/FSFWVersion.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
#include "../memory/scratchApi.h"
|
||||
#include "../memory/SdCardManager.h"
|
||||
#include "bsp_q7s/memory/scratchApi.h"
|
||||
#include "bsp_q7s/memory/SdCardManager.h"
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
@ -46,6 +48,7 @@ ReturnValue_t CoreController::initialize() {
|
||||
sif::warning << "CoreController::initialize: Setting up alloc failure "
|
||||
"count failed" << std::endl;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -180,6 +183,14 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initializeAfterTaskCreation() {
|
||||
ReturnValue_t result = versionFileInit();
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::warning << "CoreController::initialize: Version initialization failed" << std::endl;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::sdCardColdRedundantInit(SdCardManager* sdcMan,
|
||||
SdCardManager::SdStatusPair& statusPair) {
|
||||
sd::SdCard preferredSdCard = sd::SdCard::SLOT_0;
|
||||
@ -254,3 +265,86 @@ ReturnValue_t CoreController::incrementAllocationFailureCount() {
|
||||
count++;
|
||||
return scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, count);
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::versionFileInit() {
|
||||
|
||||
std::string unameFileName = "/tmp/uname_version.txt";
|
||||
std::string unameCmd = "uname -a > " + unameFileName;
|
||||
int result = std::system(unameCmd.c_str());
|
||||
if(result != 0) {
|
||||
utility::handleSystemError(result, "CoreController::versionFileInit");
|
||||
}
|
||||
std::ifstream unameFile(unameFileName);
|
||||
std::string unameLine;
|
||||
if(not std::getline(unameFile, unameLine)) {
|
||||
sif::warning << "CoreController::versionFileInit: Retrieving uname line failed"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::string fullObswVersionString = "OBSW: v" + std::to_string(SW_VERSION) + "." +
|
||||
std::to_string(SW_SUBVERSION) + "." + std::to_string(SW_REVISION);
|
||||
std::string fullFsfwVersionString = "FSFW: v" + std::to_string(FSFW_VERSION) + "." +
|
||||
std::to_string(FSFW_SUBVERSION) + "." + std::to_string(FSFW_REVISION);
|
||||
std::string systemString = "System: " + unameLine;
|
||||
std::string mountPrefix = SdCardManager::instance()->getCurrentMountPrefix();
|
||||
std::string versionFilePath = mountPrefix + "/conf/version.txt";
|
||||
std::fstream versionFile;
|
||||
|
||||
if(not std::filesystem::exists(versionFilePath)) {
|
||||
sif::info << "Writing version file " << versionFilePath << ".." << std::endl;
|
||||
versionFile.open(versionFilePath, std::ios_base::out);
|
||||
versionFile << fullObswVersionString << std::endl;
|
||||
versionFile << fullFsfwVersionString << std::endl;
|
||||
versionFile << systemString << std::endl;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
// Check whether any version has changed
|
||||
bool createNewFile = false;
|
||||
versionFile.open(versionFilePath);
|
||||
std::string currentVersionString;
|
||||
uint8_t idx = 0;
|
||||
while(std::getline(versionFile, currentVersionString)) {
|
||||
if(idx == 0) {
|
||||
if(currentVersionString != fullObswVersionString) {
|
||||
sif::info << "OBSW version changed" << std::endl;
|
||||
sif::info << "From " << currentVersionString << " to " <<
|
||||
fullObswVersionString << std::endl;
|
||||
createNewFile = true;
|
||||
}
|
||||
}
|
||||
else if(idx == 1) {
|
||||
if(currentVersionString != fullFsfwVersionString) {
|
||||
sif::info << "FSFW version changed" << std::endl;
|
||||
sif::info << "From " << currentVersionString << " to " <<
|
||||
fullFsfwVersionString << std::endl;
|
||||
createNewFile = true;
|
||||
}
|
||||
}
|
||||
else if(idx == 2) {
|
||||
if(currentVersionString != systemString) {
|
||||
sif::info << "System version changed" << std::endl;
|
||||
sif::info << "Old: " << currentVersionString << std::endl;
|
||||
sif::info << "New: " << systemString << std::endl;
|
||||
createNewFile = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
sif::warning << "Invalid version file! Rewriting it.." << std::endl;
|
||||
createNewFile = true;
|
||||
}
|
||||
idx++;
|
||||
}
|
||||
|
||||
// Overwrite file if necessary
|
||||
if(createNewFile) {
|
||||
sif::info << "Rewriting version.txt file with updated versions.." << std::endl;
|
||||
versionFile.close();
|
||||
versionFile.open(versionFilePath, std::ios_base::out | std::ios_base::trunc);
|
||||
versionFile << fullObswVersionString << std::endl;
|
||||
versionFile << fullFsfwVersionString << std::endl;
|
||||
versionFile << systemString << std::endl;
|
||||
}
|
||||
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
ReturnValue_t initializeAfterTaskCreation() override;
|
||||
|
||||
ReturnValue_t executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy, const uint8_t *data, size_t size) override;
|
||||
|
||||
@ -37,6 +39,9 @@ private:
|
||||
sd::SdCard sdCard, sd::SdStatus status, std::string sdString);
|
||||
ReturnValue_t sdCardColdRedundantInit(SdCardManager* sdcMan,
|
||||
SdCardManager::SdStatusPair& statusPair);
|
||||
|
||||
ReturnValue_t versionFileInit();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ int obsw::obsw() {
|
||||
std::cout << "-- Compiled for Linux (TE0720) --" << std::endl;
|
||||
#endif
|
||||
std::cout << "-- OBSW " << SW_NAME << " v" << SW_VERSION << "." << SW_SUBVERSION <<
|
||||
"." << SW_SUBSUBVERSION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
||||
"." << SW_REVISION << ", FSFW v" << FSFW_VERSION << "." << FSFW_SUBVERSION <<
|
||||
FSFW_REVISION << "--" << std::endl;
|
||||
std::cout << "-- " << __DATE__ << " " << __TIME__ << " --" << std::endl;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
const char* const SW_NAME = "eive";
|
||||
|
||||
#define SW_VERSION 1
|
||||
#define SW_SUBVERSION 3
|
||||
#define SW_SUBSUBVERSION 0
|
||||
#define SW_SUBVERSION 5
|
||||
#define SW_REVISION 0
|
||||
|
||||
#endif /* COMMON_CONFIG_OBSWVERSION_H_ */
|
||||
|
2
fsfw
2
fsfw
@ -1 +1 @@
|
||||
Subproject commit 3e422f51bd1b5f934a138f5e496675b398e27827
|
||||
Subproject commit c5420c7b538ec12f841b27f95b91d75e41b53f94
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 941f46401e13fb6ee5fc653875eebff8496133ec
|
||||
Subproject commit 2e942ec21e47485b9ab6416a0341b9ab8ec30543
|
Loading…
Reference in New Issue
Block a user