Compare commits
3 Commits
event-defi
...
7795fecfcb
Author | SHA1 | Date | |
---|---|---|---|
7795fecfcb | |||
9361af02c4
|
|||
842a3b1b03 |
@@ -26,7 +26,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- FreeRTOS monotonic clock which is not subjected to time jumps of the system clock
|
|
||||||
- add CFDP subsystem ID
|
- add CFDP subsystem ID
|
||||||
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742
|
||||||
- `PusTmZcWriter` now exposes API to set message counter field.
|
- `PusTmZcWriter` now exposes API to set message counter field.
|
||||||
|
@@ -210,7 +210,6 @@ inline ReturnValue_t PoolVariable<T>::readWithoutLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->value = *(poolEntry->getDataPtr());
|
this->value = *(poolEntry->getDataPtr());
|
||||||
this->valid = poolEntry->getValid();
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +241,6 @@ ReturnValue_t PoolVariable<T>::commitWithoutLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*(poolEntry->getDataPtr()) = this->value;
|
*(poolEntry->getDataPtr()) = this->value;
|
||||||
poolEntry->setValid(this->valid);
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "FreeRTOS.h"
|
#include "FreeRTOS.h"
|
||||||
#include "fsfw/globalfunctions/timevalOperations.h"
|
#include "fsfw/globalfunctions/timevalOperations.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterfacePrinter.h"
|
|
||||||
#include "fsfw/osal/freertos/Timekeeper.h"
|
#include "fsfw/osal/freertos/Timekeeper.h"
|
||||||
#include "task.h"
|
#include "task.h"
|
||||||
|
|
||||||
@@ -48,8 +47,8 @@ ReturnValue_t Clock::getClock(timeval* time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getClockMonotonic(timeval* time) {
|
ReturnValue_t Clock::getClockMonotonic(timeval* time) {
|
||||||
*time = Timekeeper::instance()->getMonotonicClockOffset() + getUptime();
|
// TODO: I don't actually know if the timekeeper is monotonic..
|
||||||
return returnvalue::OK;
|
return getClock_timeval(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t Clock::getUptime(timeval* uptime) {
|
ReturnValue_t Clock::getUptime(timeval* uptime) {
|
||||||
@@ -59,7 +58,7 @@ ReturnValue_t Clock::getUptime(timeval* uptime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeval Clock::getUptime() {
|
timeval Clock::getUptime() {
|
||||||
TickType_t ticksSinceStart = Timekeeper::instance()->getTicks();
|
TickType_t ticksSinceStart = xTaskGetTickCount();
|
||||||
return Timekeeper::ticksToTimeval(ticksSinceStart);
|
return Timekeeper::ticksToTimeval(ticksSinceStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -17,13 +17,7 @@ Timekeeper* Timekeeper::instance() {
|
|||||||
return myinstance;
|
return myinstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timekeeper::setOffset(const timeval& offset) {
|
void Timekeeper::setOffset(const timeval& offset) { this->offset = offset; }
|
||||||
if (not monotonicClockInitialized) {
|
|
||||||
this->monotonicClockOffset = offset;
|
|
||||||
monotonicClockInitialized = true;
|
|
||||||
}
|
|
||||||
this->offset = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
||||||
timeval uptime;
|
timeval uptime;
|
||||||
@@ -39,7 +33,3 @@ timeval Timekeeper::ticksToTimeval(TickType_t ticks) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TickType_t Timekeeper::getTicks() { return xTaskGetTickCount(); }
|
TickType_t Timekeeper::getTicks() { return xTaskGetTickCount(); }
|
||||||
|
|
||||||
const timeval Timekeeper::getMonotonicClockOffset() const {
|
|
||||||
return monotonicClockOffset;
|
|
||||||
}
|
|
||||||
|
@@ -18,14 +18,9 @@ class Timekeeper {
|
|||||||
Timekeeper();
|
Timekeeper();
|
||||||
|
|
||||||
timeval offset;
|
timeval offset;
|
||||||
// Set when offset is initialized the first time
|
|
||||||
timeval monotonicClockOffset;
|
|
||||||
bool monotonicClockInitialized = false;
|
|
||||||
|
|
||||||
static Timekeeper* myinstance;
|
static Timekeeper* myinstance;
|
||||||
|
|
||||||
void setMonotonicClockOffset(const timeval& monotonicClockOffset);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Timekeeper* instance();
|
static Timekeeper* instance();
|
||||||
virtual ~Timekeeper();
|
virtual ~Timekeeper();
|
||||||
@@ -39,7 +34,6 @@ class Timekeeper {
|
|||||||
|
|
||||||
const timeval& getOffset() const;
|
const timeval& getOffset() const;
|
||||||
void setOffset(const timeval& offset);
|
void setOffset(const timeval& offset);
|
||||||
const timeval getMonotonicClockOffset() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FRAMEWORK_OSAL_FREERTOS_TIMEKEEPER_H_ */
|
#endif /* FRAMEWORK_OSAL_FREERTOS_TIMEKEEPER_H_ */
|
||||||
|
@@ -49,7 +49,7 @@ class Service11TelecommandScheduling final : public PusServiceBase {
|
|||||||
|
|
||||||
//! [EXPORT] : [COMMENT] Deletion of a TC from the map failed.
|
//! [EXPORT] : [COMMENT] Deletion of a TC from the map failed.
|
||||||
//! P1: First 32 bit of request ID, P2. Last 32 bit of Request ID
|
//! P1: First 32 bit of request ID, P2. Last 32 bit of Request ID
|
||||||
static constexpr Event TC_DELETION_FAILED = MAKE_EVENT(0, severity::MEDIUM);
|
static constexpr Event TC_DELETION_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::MEDIUM);
|
||||||
|
|
||||||
// The types of PUS-11 subservices
|
// The types of PUS-11 subservices
|
||||||
enum Subservice : uint8_t {
|
enum Subservice : uint8_t {
|
||||||
|
@@ -53,17 +53,17 @@ void fsfwPrint(sif::PrintLevel printType, const char *fmt, va_list arg) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (printType == sif::PrintLevel::INFO_LEVEL) {
|
if (printType == sif::PrintLevel::INFO_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "INFO ");
|
len += sprintf(bufferPosition + len, "INFO");
|
||||||
}
|
}
|
||||||
if (printType == sif::PrintLevel::DEBUG_LEVEL) {
|
if (printType == sif::PrintLevel::DEBUG_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "DEBUG ");
|
len += sprintf(bufferPosition + len, "DEBUG");
|
||||||
}
|
}
|
||||||
if (printType == sif::PrintLevel::WARNING_LEVEL) {
|
if (printType == sif::PrintLevel::WARNING_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "WARNING");
|
len += sprintf(bufferPosition + len, "WARNING");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (printType == sif::PrintLevel::ERROR_LEVEL) {
|
if (printType == sif::PrintLevel::ERROR_LEVEL) {
|
||||||
len += sprintf(bufferPosition + len, "ERROR ");
|
len += sprintf(bufferPosition + len, "ERROR");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if FSFW_COLORED_OUTPUT == 1
|
#if FSFW_COLORED_OUTPUT == 1
|
||||||
@@ -75,7 +75,7 @@ void fsfwPrint(sif::PrintLevel printType, const char *fmt, va_list arg) {
|
|||||||
/*
|
/*
|
||||||
* Log current time to terminal if desired.
|
* Log current time to terminal if desired.
|
||||||
*/
|
*/
|
||||||
len += sprintf(bufferPosition + len, " | %02lu:%02lu:%02lu.%03lu | ", (unsigned long)now.hour,
|
len += sprintf(bufferPosition + len, " | %lu:%02lu:%02lu.%03lu | ", (unsigned long)now.hour,
|
||||||
(unsigned long)now.minute, (unsigned long)now.second,
|
(unsigned long)now.minute, (unsigned long)now.second,
|
||||||
(unsigned long)now.usecond / 1000);
|
(unsigned long)now.usecond / 1000);
|
||||||
|
|
||||||
|
@@ -79,36 +79,22 @@ void SubsystemBase::executeTable(HybridIterator<ModeListEntry> tableIter, Submod
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (healthHelper.healthTable->hasHealth(object)) {
|
if (healthHelper.healthTable->hasHealth(object)) {
|
||||||
|
if (healthHelper.healthTable->isFaulty(object)) {
|
||||||
switch (healthHelper.healthTable->getHealth(object)) {
|
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND, HasModesIF::MODE_OFF,
|
||||||
case NEEDS_RECOVERY:
|
SUBMODE_NONE);
|
||||||
case FAULTY:
|
} else {
|
||||||
case PERMANENT_FAULTY:
|
if (modeHelper.isForced()) {
|
||||||
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND, HasModesIF::MODE_OFF,
|
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND_FORCED,
|
||||||
SUBMODE_NONE);
|
tableIter.value->getMode(), submodeToCommand);
|
||||||
break;
|
} else {
|
||||||
case HEALTHY:
|
if (healthHelper.healthTable->isCommandable(object)) {
|
||||||
if (modeHelper.isForced()) {
|
|
||||||
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND_FORCED,
|
|
||||||
tableIter.value->getMode(), submodeToCommand);
|
|
||||||
} else {
|
|
||||||
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND,
|
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND,
|
||||||
tableIter.value->getMode(), submodeToCommand);
|
tableIter.value->getMode(), submodeToCommand);
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EXTERNAL_CONTROL:
|
|
||||||
if (modeHelper.isForced()) {
|
|
||||||
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND_FORCED,
|
|
||||||
tableIter.value->getMode(), submodeToCommand);
|
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
// This never happens
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND,
|
ModeMessage::setModeMessage(&command, ModeMessage::CMD_MODE_COMMAND,
|
||||||
tableIter.value->getMode(), submodeToCommand);
|
tableIter.value->getMode(), submodeToCommand);
|
||||||
|
@@ -25,7 +25,7 @@ static constexpr ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE(11)
|
|||||||
|
|
||||||
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::TMTC_DISTRIBUTION;
|
||||||
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
//! P1: Returnvalue, P2: 0 for TM issues, 1 for TC issues
|
||||||
static constexpr Event HANDLE_PACKET_FAILED = MAKE_EVENT(0, severity::LOW);
|
static constexpr Event HANDLE_PACKET_FAILED = event::makeEvent(SUBSYSTEM_ID, 0, severity::LOW);
|
||||||
|
|
||||||
}; // namespace tmtcdistrib
|
}; // namespace tmtcdistrib
|
||||||
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
#endif // FSFW_TMTCPACKET_DEFINITIONS_H
|
||||||
|
@@ -142,7 +142,7 @@ class TemperatureSensor : public AbstractTemperatureSensor {
|
|||||||
|
|
||||||
deltaTime = (uptime.tv_sec + uptime.tv_usec / 1000000.) -
|
deltaTime = (uptime.tv_sec + uptime.tv_usec / 1000000.) -
|
||||||
(uptimeOfOldTemperature.tv_sec + uptimeOfOldTemperature.tv_usec / 1000000.);
|
(uptimeOfOldTemperature.tv_sec + uptimeOfOldTemperature.tv_usec / 1000000.);
|
||||||
deltaTemp = oldTemperature - outputTemperature.value;
|
deltaTemp = oldTemperature - outputTemperature;
|
||||||
if (deltaTemp < 0) {
|
if (deltaTemp < 0) {
|
||||||
deltaTemp = -deltaTemp;
|
deltaTemp = -deltaTemp;
|
||||||
}
|
}
|
||||||
@@ -160,13 +160,13 @@ class TemperatureSensor : public AbstractTemperatureSensor {
|
|||||||
outputTemperature.setValid(PoolVariableIF::INVALID);
|
outputTemperature.setValid(PoolVariableIF::INVALID);
|
||||||
outputTemperature = thermal::INVALID_TEMPERATURE;
|
outputTemperature = thermal::INVALID_TEMPERATURE;
|
||||||
} else {
|
} else {
|
||||||
oldTemperature = outputTemperature.value;
|
oldTemperature = outputTemperature;
|
||||||
uptimeOfOldTemperature = uptime;
|
uptimeOfOldTemperature = uptime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float getTemperature() { return outputTemperature.value; }
|
float getTemperature() { return outputTemperature; }
|
||||||
|
|
||||||
bool isValid() { return outputTemperature.isValid(); }
|
bool isValid() { return outputTemperature.isValid(); }
|
||||||
|
|
||||||
|
@@ -192,8 +192,6 @@ class Clock {
|
|||||||
static MutexIF *timeMutex;
|
static MutexIF *timeMutex;
|
||||||
static uint16_t leapSeconds;
|
static uint16_t leapSeconds;
|
||||||
static bool leapSecondsSet;
|
static bool leapSecondsSet;
|
||||||
static bool monotonicClockInitialized;
|
|
||||||
static timeval monotonicClockOffset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* FSFW_TIMEMANAGER_CLOCK_H_ */
|
#endif /* FSFW_TIMEMANAGER_CLOCK_H_ */
|
||||||
|
Reference in New Issue
Block a user