Compare commits

...

30 Commits

Author SHA1 Message Date
Ulrich Mohr 027d309a7a Merge branch 'development' into mohr/timetag_fix
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-05-08 15:29:56 +02:00
Ulrich Mohr 4518fec65c CHANGELOG
fsfw/fsfw/pipeline/head There was a failure building this commit Details
2023-05-08 15:25:47 +02:00
Ulrich Mohr 5a35f8e50b CHANGELOG
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-05-08 15:15:33 +02:00
Ulrich Mohr 877c5fa798 Merge branch 'development' into mohr/timetag_fix 2023-05-08 15:12:32 +02:00
Ulrich Mohr cf47d2079f changed rounding to be correct 2023-05-08 15:11:35 +02:00
Ulrich Mohr dac1aacab2 Merge pull request 'Update Power Switch IF' (#743) from eive/fsfw:update_power_switch_if into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #743
2023-05-08 15:00:47 +02:00
Ulrich Mohr 0042f92fdf Merge pull request 'bump ETL version' (#748) from KSat/fsfw:bump_etl_dep into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #748
2023-05-08 14:53:02 +02:00
Ulrich Mohr 656faf8169 Merge remote-tracking branch 'upstream/development' into update_power_switch_if
fsfw/fsfw/pipeline/pr-development This commit looks good Details
2023-05-08 14:44:27 +02:00
Ulrich Mohr f84431e965 Merge pull request 'bugfix and changelog for Linux getUptime' (#745) from eive/fsfw:important_bugfix_linux_get_uptime into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #745
2023-05-08 14:29:55 +02:00
Ulrich Mohr 0cec9ebb73 Merge pull request 'small tweak for version getter' (#744) from eive/fsfw:small_version_getter_tweak into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #744
2023-05-08 14:13:06 +02:00
Ulrich Mohr a440b7c394 Merge pull request 'add CFDP subsystem ID' (#742) from eive/fsfw:add_cfdp_subsystem_id into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #742
2023-05-08 14:09:04 +02:00
Ulrich Mohr bbfc1b2b34 Merge pull request 'FixedArrayList compile time assert' (#740) from eive/fsfw:container_additional_assert into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #740
2023-05-08 14:04:56 +02:00
Robin Müller 025b379e8b
bump ETL version
fsfw/fsfw/pipeline/pr-development This commit looks good Details
2023-05-04 14:04:55 +02:00
Robin Müller 0f81d5e458
Merge remote-tracking branch 'upstream/development' into container_additional_assert
fsfw/fsfw/pipeline/pr-development This commit looks good Details
2023-03-15 12:34:36 +01:00
Robin Müller b50f092939
Merge remote-tracking branch 'upstream/development' into update_power_switch_if
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-03-15 12:33:08 +01:00
Robin Müller 2f90e12179
Merge remote-tracking branch 'upstream/development' into important_bugfix_linux_get_uptime
fsfw/fsfw/pipeline/pr-development Build started... Details
2023-03-15 12:32:25 +01:00
Robin Müller 8b77fac099 Merge pull request 'health service fixes and changelog' (#746) from eive/fsfw:health_service_fixes into development
fsfw/fsfw/pipeline/head There was a failure building this commit Details
Reviewed-on: #746
2023-03-15 12:29:31 +01:00
Robin Müller 47503824d7
health service fixes and changelog
fsfw/fsfw/pipeline/pr-development Build started... Details
2023-03-15 12:27:39 +01:00
Robin Müller 5e3f5c4121
fuse update
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-03-15 12:25:39 +01:00
Robin Müller 1f36c082ef
bugfix and changelog for Linux getUptime
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-03-15 12:21:50 +01:00
Robin Müller aa84e93603
small tweak for version getter
fsfw/fsfw/pipeline/pr-development Build started... Details
2023-03-15 12:17:36 +01:00
Robin Müller 8f63a0e747
changelog
fsfw/fsfw/pipeline/pr-development This commit looks good Details
2023-03-15 12:15:21 +01:00
Robin Müller 6fc8f756a7
update power switch IF 2023-03-15 12:13:55 +01:00
Robin Müller d98ed40e3d
add CFDP subsystem ID
fsfw/fsfw/pipeline/pr-development Build started... Details
2023-03-15 12:09:30 +01:00
Robin Müller b057250bfb
changelog
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-03-15 11:53:12 +01:00
Robin Müller 066dd0d397
changelog 2023-03-15 11:52:20 +01:00
Robin Müller f735c2e9d4
assert size larger than 0 2023-03-15 11:51:51 +01:00
Ulrich Mohr 319199cb22 missed one
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-02-09 13:20:21 +01:00
Ulrich Mohr 9a09cadb4f Merge branch 'development' into mohr/timetag_fix
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-02-09 12:07:37 +01:00
Ulrich Mohr 61620bfce7 moved TCScheduling Service to use timeval internally
fsfw/fsfw/pipeline/head There was a failure building this commit Details
fsfw/fsfw/pipeline/pr-development There was a failure building this commit Details
2023-02-07 14:28:35 +01:00
11 changed files with 96 additions and 32 deletions

View File

@ -8,6 +8,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
# [unreleased]
## Fixes
- PUS Health Service: Size check for set health command.
Perform operation completion for announce health command.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/746
- Linux OSAL `getUptime` fix: Check validity of `/proc/uptime` file before reading uptime.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/745
- Small tweak for version getter
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/744
- PUS Scheduling Service: Use timeval internally
PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/735
## Added
- add CFDP subsystem ID
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
## Changed
- Bump ETL version to 20.35.14
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/748
- Renamed `PCDU_2` subsystem ID to `POWER_SWITCH_IF`.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/743
- Add new `PowerSwitchIF::SWITCH_UNKNOWN` returnvalue.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/743
- Assert that `FixedArrayList` is larger than 0 at compile time.
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/740
# [v6.0.0] 2023-02-10
## Fixes

View File

@ -72,7 +72,7 @@ set(FSFW_ETL_LIB_MAJOR_VERSION
20
CACHE STRING "ETL library major version requirement")
set(FSFW_ETL_LIB_VERSION
${FSFW_ETL_LIB_MAJOR_VERSION}.28.0
${FSFW_ETL_LIB_MAJOR_VERSION}.35.14
CACHE STRING "ETL library exact version requirement")
set(FSFW_ETL_LINK_TARGET etl::etl)

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> {
static_assert(MAX_SIZE <= std::numeric_limits<count_t>::max(),
"count_t is not large enough to hold MAX_SIZE");
static_assert(MAX_SIZE > 0, "MAX_SIZE is 0");
private:
T data[MAX_SIZE];

View File

@ -10,7 +10,7 @@ enum : uint8_t {
CDH = 28,
TCS_1 = 59,
PCDU_1 = 42,
PCDU_2 = 43,
POWER_SWITCH_IF = 43,
HEATER = 50,
T_SENSORS = 52,
FDIR = 70,
@ -33,6 +33,7 @@ enum : uint8_t {
PUS_SERVICE_23 = 103,
MGM_LIS3MDL = 106,
MGM_RM3100 = 107,
CFDP = 108,
FW_SUBSYSTEM_ID_RANGE
};

View File

@ -76,14 +76,17 @@ timeval Clock::getUptime() {
}
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;
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_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.

View File

@ -32,7 +32,7 @@ class Fuse : public SystemObject,
gp_id_t poolIdPower;
};
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_1;
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::POWER_SWITCH_IF;
//! PSS detected that current on a fuse is totally out of bounds.
static const Event FUSE_CURRENT_HIGH = MAKE_EVENT(1, severity::LOW);
//! PSS detected a fuse that went off.

View File

@ -28,10 +28,12 @@ class PowerSwitchIF {
static const ReturnValue_t SWITCH_TIMEOUT = MAKE_RETURN_CODE(2);
static const ReturnValue_t FUSE_ON = MAKE_RETURN_CODE(3);
static const ReturnValue_t FUSE_OFF = MAKE_RETURN_CODE(4);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_2;
static const Event SWITCH_WENT_OFF = MAKE_EVENT(
0, severity::LOW); //!< Someone detected that a switch went off which shouldn't. Severity:
//!< Low, Parameter1: switchId1, Parameter2: switchId2
static const ReturnValue_t SWITCH_UNKNOWN = MAKE_RETURN_CODE(5);
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::POWER_SWITCH_IF;
//!< Someone detected that a switch went off which shouldn't. Severity:
//!< Low, Parameter1: switchId1, Parameter2: switchId2
static const Event SWITCH_WENT_OFF = MAKE_EVENT(0, severity::LOW);
/**
* send a direct command to the Power Unit to enable/disable the specified switch.
*
@ -50,6 +52,7 @@ class PowerSwitchIF {
* @return
* - @c SWITCH_ON if the specified switch is on.
* - @c SWITCH_OFF if the specified switch is off.
* - @c SWITCH_UNKNOWN if the state of the specified switch is unknown.
* - @c returnvalue::FAILED if an error occured
*/
virtual ReturnValue_t getSwitchState(power::Switch_t switchNr) const = 0;

View File

@ -82,6 +82,9 @@ ReturnValue_t CServiceHealthCommanding::prepareCommand(CommandMessage *message,
ReturnValue_t result = returnvalue::OK;
switch (subservice) {
case (Subservice::COMMAND_SET_HEALTH): {
if (tcDataLen != sizeof(object_id_t) + sizeof(HasHealthIF::HealthState)) {
return CommandingServiceBase::INVALID_TC;
}
HealthSetCommand healthCommand;
result = healthCommand.deSerialize(&tcData, &tcDataLen, SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) {
@ -93,7 +96,7 @@ ReturnValue_t CServiceHealthCommanding::prepareCommand(CommandMessage *message,
}
case (Subservice::COMMAND_ANNOUNCE_HEALTH): {
HealthMessage::setHealthMessage(message, HealthMessage::HEALTH_ANNOUNCE);
break;
return CommandingServiceBase::EXECUTION_COMPLETE;
}
case (Subservice::COMMAND_ANNOUNCE_HEALTH_ALL): {
ReturnValue_t result = iterateHealthTable(true);

View File

@ -91,7 +91,6 @@ class Service11TelecommandScheduling final : public PusServiceBase {
private:
struct TelecommandStruct {
uint64_t requestId{};
uint32_t seconds{};
store_address_t storeAddr; // uint16
};
@ -114,7 +113,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
* The telecommand map uses the exectution time as a Unix time stamp as
* the key. This is mapped to a generic telecommand struct.
*/
using TelecommandMap = etl::multimap<uint32_t, TelecommandStruct, MAX_NUM_TCS>;
using TelecommandMap = etl::multimap<timeval, TelecommandStruct, MAX_NUM_TCS>;
using TcMapIter = typename TelecommandMap::iterator;
TelecommandMap telecommandMap;

View File

@ -3,6 +3,7 @@
#include <cstddef>
#include "fsfw/globalfunctions/CRC.h"
#include "fsfw/globalfunctions/timevalOperations.h"
#include "fsfw/objectmanager/ObjectManager.h"
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h"
@ -79,7 +80,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::performService
// NOTE: The iterator is increased in the loop here. Increasing the iterator as for-loop arg
// does not work in this case as we are deleting the current element here.
for (auto it = telecommandMap.begin(); it != telecommandMap.end();) {
if (it->first <= tNow.tv_sec) {
if (it->first <= tNow) {
if (schedulingEnabled) {
// release tc
TmTcMessage releaseMsg(it->second.storeAddr);
@ -150,17 +151,25 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::handleResetCom
template <size_t MAX_NUM_TCS>
inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivity(
const uint8_t *data, size_t size) {
uint32_t timestamp = 0;
ReturnValue_t result = SerializeAdapter::deSerialize(&timestamp, &data, &size, DEF_END);
uint32_t seconds = 0;
ReturnValue_t result = SerializeAdapter::deSerialize(&seconds, &data, &size, DEF_END);
if (result != returnvalue::OK) {
return result;
}
timeval scheduledTime;
scheduledTime.tv_sec = seconds;
scheduledTime.tv_usec = 0;
// Insert possible if sched. time is above margin
// (See requirement for Time margin)
timeval tNow = {};
Clock::getClock_timeval(&tNow);
if (timestamp - tNow.tv_sec <= RELEASE_TIME_MARGIN_SECONDS) {
timeval timeDifference = scheduledTime - tNow;
// round subseconds up
if (timeDifference.tv_usec != 0) {
timeDifference.tv_sec++;
}
if (timeDifference.tv_sec <= RELEASE_TIME_MARGIN_SECONDS) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "Service11TelecommandScheduling::doInsertActivity: Release time too close to "
"current time"
@ -197,11 +206,10 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doInsertActivi
// insert into multimap with new store address
TelecommandStruct tc;
tc.seconds = timestamp;
tc.storeAddr = addr;
tc.requestId = getRequestIdFromTc(); // TODO: Missing sanity check of the returned request id
auto it = telecommandMap.insert(std::pair<uint32_t, TelecommandStruct>(timestamp, tc));
auto it = telecommandMap.insert(std::pair<timeval, TelecommandStruct>(scheduledTime, tc));
if (it == telecommandMap.end()) {
return returnvalue::FAILED;
}
@ -391,7 +399,8 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doTimeshiftAct
// temporarily hold the item
TelecommandStruct tempTc(tcToTimeshiftIt->second);
uint32_t tempKey = tcToTimeshiftIt->first + relativeTime;
timeval tempKey = tcToTimeshiftIt->first;
tempKey.tv_sec += relativeTime;
// delete old entry from the mm
telecommandMap.erase(tcToTimeshiftIt);
@ -436,7 +445,8 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::doFilterTimesh
for (auto it = itBegin; it != itEnd;) {
// temporarily hold the item
TelecommandStruct tempTc(it->second);
uint32_t tempKey = it->first + relativeTime;
timeval tempKey = it->first;
tempKey.tv_sec += relativeTime;
// delete the old entry from the mm
telecommandMap.erase(it++);
@ -533,12 +543,16 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
}
case TypeOfTimeWindow::FROM_TIMETAG: {
uint32_t fromTimestamp = 0;
result = SerializeAdapter::deSerialize(&fromTimestamp, &data, &dataSize, DEF_END);
uint32_t fromSeconds = 0;
result = SerializeAdapter::deSerialize(&fromSeconds, &data, &dataSize, DEF_END);
if (result != returnvalue::OK) {
return result;
}
timeval fromTimestamp;
fromTimestamp.tv_sec = fromSeconds;
fromTimestamp.tv_usec = 0;
itBegin = telecommandMap.begin();
while (itBegin->first < fromTimestamp && itBegin != telecommandMap.end()) {
itBegin++;
@ -549,11 +563,15 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
}
case TypeOfTimeWindow::TO_TIMETAG: {
uint32_t toTimestamp;
result = SerializeAdapter::deSerialize(&toTimestamp, &data, &dataSize, DEF_END);
uint32_t toSeconds = 0;
result = SerializeAdapter::deSerialize(&toSeconds, &data, &dataSize, DEF_END);
if (result != returnvalue::OK) {
return result;
}
timeval toTimestamp;
toTimestamp.tv_sec = toSeconds;
toTimestamp.tv_usec = 0;
itBegin = telecommandMap.begin();
itEnd = telecommandMap.begin();
while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) {
@ -563,19 +581,27 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
}
case TypeOfTimeWindow::FROM_TIMETAG_TO_TIMETAG: {
uint32_t fromTimestamp;
uint32_t toTimestamp;
uint32_t fromSeconds = 0;
uint32_t toSeconds = 0;
result = SerializeAdapter::deSerialize(&fromTimestamp, &data, &dataSize,
result = SerializeAdapter::deSerialize(&fromSeconds, &data, &dataSize,
SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) {
return result;
}
result = SerializeAdapter::deSerialize(&toTimestamp, &data, &dataSize,
result = SerializeAdapter::deSerialize(&toSeconds, &data, &dataSize,
SerializeIF::Endianness::BIG);
if (result != returnvalue::OK) {
return result;
}
timeval fromTimestamp;
fromTimestamp.tv_sec = fromSeconds;
fromTimestamp.tv_usec = 0;
timeval toTimestamp;
toTimestamp.tv_sec = toSeconds;
toTimestamp.tv_usec = 0;
if (fromTimestamp > toTimestamp) {
return INVALID_TIME_WINDOW;
}

View File

@ -1,6 +1,7 @@
#include "version.h"
#include <cstdio>
#include <cstring>
#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 {
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);
}
}
@ -30,7 +31,7 @@ namespace fsfw {
#if FSFW_CPP_OSTREAM_ENABLED == 1
std::ostream& operator<<(std::ostream& os, const Version& v) {
os << v.major << "." << v.minor << "." << v.revision;
if (v.addInfo != nullptr) {
if (v.addInfo != nullptr and std::strcmp(v.addInfo, "") != 0) {
os << "-" << v.addInfo;
}
return os;