Compare commits
30 Commits
master
...
mohr/timet
Author | SHA1 | Date | |
---|---|---|---|
027d309a7a | |||
4518fec65c | |||
5a35f8e50b | |||
877c5fa798 | |||
cf47d2079f | |||
dac1aacab2 | |||
0042f92fdf | |||
656faf8169 | |||
f84431e965 | |||
0cec9ebb73 | |||
a440b7c394 | |||
bbfc1b2b34 | |||
025b379e8b | |||
0f81d5e458 | |||
b50f092939 | |||
2f90e12179 | |||
8b77fac099 | |||
47503824d7 | |||
5e3f5c4121 | |||
1f36c082ef | |||
aa84e93603 | |||
8f63a0e747 | |||
6fc8f756a7 | |||
d98ed40e3d | |||
b057250bfb | |||
066dd0d397 | |||
f735c2e9d4 | |||
319199cb22 | |||
9a09cadb4f | |||
61620bfce7 |
27
CHANGELOG.md
27
CHANGELOG.md
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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(×tamp, &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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user