Pull CFPD bugfix in dev branch #147

Merged
muellerr merged 30 commits from pull-cfdp-fix-into-dev-branch into obsw-v3.0.0-dev 2023-06-09 13:41:29 +02:00
5 changed files with 14 additions and 6 deletions
Showing only changes of commit 656faf8169 - Show all commits

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Fixes ## Fixes
- Linux OSAL `getUptime` fix: Check validity of `/proc/uptime` file before reading uptime.
- PUS Health Service: Size check for set health command. - PUS Health Service: Size check for set health command.
- PUS Health Service: Perform operation completion for announce health command. - PUS Health Service: Perform operation completion for announce health command.
@ -17,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`. - Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
- Add new `PowerSwitchIF::SWITCH_UNKNOWN` returnvalue. - Add new `PowerSwitchIF::SWITCH_UNKNOWN` returnvalue.
- Assert that `FixedArrayList` is larger than 0 at compile time.
# [v6.0.0] 2023-02-10 # [v6.0.0] 2023-02-10

View File

@ -12,6 +12,7 @@ template <typename T, size_t MAX_SIZE, typename count_t = uint8_t>
class FixedArrayList : public ArrayList<T, count_t> { class FixedArrayList : public ArrayList<T, count_t> {
static_assert(MAX_SIZE <= std::numeric_limits<count_t>::max(), static_assert(MAX_SIZE <= std::numeric_limits<count_t>::max(),
"count_t is not large enough to hold MAX_SIZE"); "count_t is not large enough to hold MAX_SIZE");
static_assert(MAX_SIZE > 0, "MAX_SIZE is 0");
private: private:
T data[MAX_SIZE]; T data[MAX_SIZE];

View File

@ -33,6 +33,7 @@ enum : uint8_t {
PUS_SERVICE_23 = 103, PUS_SERVICE_23 = 103,
MGM_LIS3MDL = 106, MGM_LIS3MDL = 106,
MGM_RM3100 = 107, MGM_RM3100 = 107,
CFDP = 108,
FW_SUBSYSTEM_ID_RANGE FW_SUBSYSTEM_ID_RANGE
}; };

View File

@ -76,15 +76,18 @@ timeval Clock::getUptime() {
} }
ReturnValue_t Clock::getUptime(timeval* uptime) { ReturnValue_t Clock::getUptime(timeval* uptime) {
// TODO This is not posix compatible and delivers only seconds precision
// Linux specific file read but more precise.
double uptimeSeconds; double uptimeSeconds;
if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) { std::ifstream ifile("/proc/uptime");
if (ifile.bad()) {
return returnvalue::FAILED;
}
if (ifile >> uptimeSeconds) {
uptime->tv_sec = uptimeSeconds; uptime->tv_sec = uptimeSeconds;
uptime->tv_usec = uptimeSeconds * (double)1e6 - (uptime->tv_sec * 1e6); uptime->tv_usec = uptimeSeconds * (double)1e6 - (uptime->tv_sec * 1e6);
}
return returnvalue::OK; return returnvalue::OK;
} }
return returnvalue::FAILED;
}
// Wait for new FSFW Clock function delivering seconds uptime. // Wait for new FSFW Clock function delivering seconds uptime.
// uint32_t Clock::getUptimeSeconds() { // uint32_t Clock::getUptimeSeconds() {

View File

@ -1,6 +1,7 @@
#include "version.h" #include "version.h"
#include <cstdio> #include <cstdio>
#include <cstring>
#include "fsfw/FSFWVersion.h" #include "fsfw/FSFWVersion.h"
@ -20,7 +21,7 @@ fsfw::Version::Version(int major, int minor, int revision, const char* addInfo)
void fsfw::Version::getVersion(char* str, size_t maxLen) const { void fsfw::Version::getVersion(char* str, size_t maxLen) const {
size_t len = snprintf(str, maxLen, "%d.%d.%d", major, minor, revision); size_t len = snprintf(str, maxLen, "%d.%d.%d", major, minor, revision);
if (addInfo != nullptr) { if (addInfo != nullptr and std::strcmp(addInfo, "") != 0) {
snprintf(str + len, maxLen - len, "-%s", addInfo); snprintf(str + len, maxLen - len, "-%s", addInfo);
} }
} }
@ -30,7 +31,7 @@ namespace fsfw {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
std::ostream& operator<<(std::ostream& os, const Version& v) { std::ostream& operator<<(std::ostream& os, const Version& v) {
os << v.major << "." << v.minor << "." << v.revision; os << v.major << "." << v.minor << "." << v.revision;
if (v.addInfo != nullptr) { if (v.addInfo != nullptr and std::strcmp(v.addInfo, "") != 0) {
os << "-" << v.addInfo; os << "-" << v.addInfo;
} }
return os; return os;