RW Assembly #224

Merged
meierj merged 53 commits from mueller/rw-ass into develop 2022-05-11 17:03:32 +02:00
7 changed files with 33 additions and 34 deletions
Showing only changes of commit 45c1ac0f61 - Show all commits

View File

@ -1,8 +1,9 @@
#include "rwSpiCallback.h"
#include <fsfw/timemanager/Stopwatch.h>
#include "devices/gpioIds.h"
#include "fsfw/serviceinterface/ServiceInterface.h"
#include <fsfw/timemanager/Stopwatch.h>
#include "fsfw_hal/linux/UnixFileGuard.h"
#include "fsfw_hal/linux/spi/SpiCookie.h"
#include "mission/devices/RwHandler.h"
@ -11,7 +12,7 @@ namespace rwSpiCallback {
ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
size_t sendLen, void* args) {
Stopwatch watch;
// Stopwatch watch;
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
RwHandler* handler = reinterpret_cast<RwHandler*>(args);

View File

@ -687,7 +687,8 @@
<listOptionValue builtIn="false" value="&quot;${Q7S_SYSROOT_UNIX}/usr/include&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s/fsfw}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.1331264991" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
@ -699,7 +700,8 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/linux/fsfwconfig}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s/fsfw}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.1143219558" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>
@ -713,10 +715,10 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/linux/fsfwconfig}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/common/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/fsfw/hal/src}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/build-Debug-Q7S/fsfw}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/eive-obsw/cmake-build-debug-q7s/fsfw}&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs.1199844227" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="LINUX=1"/>

View File

@ -11,7 +11,6 @@ RwHandler::RwHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCooki
: DeviceHandlerBase(objectId, comIF, comCookie),
gpioComIF(gpioComIF),
enableGpio(enableGpio),
temperatureSet(this),
statusSet(this),
lastResetStatusSet(this),
tmDataset(this) {
@ -134,7 +133,7 @@ void RwHandler::fillCommandAndReplyMap() {
RwDefinitions::SIZE_GET_RW_STATUS);
this->insertInCommandAndReplyMap(RwDefinitions::INIT_RW_CONTROLLER, 1, nullptr,
RwDefinitions::SIZE_INIT_RW);
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, &temperatureSet,
this->insertInCommandAndReplyMap(RwDefinitions::GET_TEMPERATURE, 1, nullptr,
RwDefinitions::SIZE_GET_TEMPERATURE_REPLY);
this->insertInCommandAndReplyMap(RwDefinitions::SET_SPEED, 1, nullptr,
RwDefinitions::SIZE_SET_SPEED_REPLY);
@ -278,7 +277,6 @@ ReturnValue_t RwHandler::initializeLocalDataPool(localpool::DataPool& localDataP
localDataPoolMap.emplace(RwDefinitions::SPI_BYTES_READ, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(RwDefinitions::SPI_REG_OVERRUN_ERRORS, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(RwDefinitions::SPI_TOTAL_ERRORS, new PoolEntry<uint32_t>({0}));
poolManager.subscribeForPeriodicPacket(temperatureSet.getSid(), false, 30.0, false);
poolManager.subscribeForPeriodicPacket(statusSet.getSid(), false, 5.0, true);
poolManager.subscribeForPeriodicPacket(tmDataset.getSid(), false, 30.0, false);
return RETURN_OK;
@ -354,17 +352,28 @@ void RwHandler::handleResetStatusReply(const uint8_t* packet) {
}
void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
PoolReadGuard rg(&statusSet);
PoolReadGuard rg0(&statusSet);
PoolReadGuard rg1(&tmDataset);
uint8_t offset = 2;
statusSet.currSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
tmDataset.rwCurrSpeed = statusSet.currSpeed;
tmDataset.rwCurrSpeed.setValid(true);
offset += 4;
statusSet.referenceSpeed = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
tmDataset.rwRefSpeed = statusSet.referenceSpeed;
tmDataset.rwRefSpeed.setValid(true);
offset += 4;
statusSet.state = *(packet + offset);
tmDataset.rwState = statusSet.state;
tmDataset.rwState.setValid(true);
offset += 1;
statusSet.clcMode = *(packet + offset);
tmDataset.rwClcMode = statusSet.clcMode;
tmDataset.rwClcMode.setValid(true);
statusSet.setValidity(true, true);
if (statusSet.state == RwDefinitions::STATE_ERROR) {
// This requires the commanding of the init reaction wheel controller command to recover
@ -388,14 +397,14 @@ void RwHandler::handleGetRwStatusReply(const uint8_t* packet) {
}
void RwHandler::handleTemperatureReply(const uint8_t* packet) {
PoolReadGuard rg(&temperatureSet);
PoolReadGuard rg(&statusSet);
uint8_t offset = 2;
temperatureSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
statusSet.temperatureCelcius = *(packet + offset + 3) << 24 | *(packet + offset + 2) << 16 |
*(packet + offset + 1) << 8 | *(packet + offset);
if (debugMode) {
#if OBSW_VERBOSE_LEVEL >= 1
sif::info << "RwHandler::handleTemperatureReply: Temperature: "
<< temperatureSet.temperatureCelcius << " °C" << std::endl;
sif::info << "RwHandler::handleTemperatureReply: Temperature: " << statusSet.temperatureCelcius
<< " °C" << std::endl;
#endif
}
}

View File

@ -87,7 +87,6 @@ class RwHandler : public DeviceHandlerBase {
gpioId_t enableGpio = gpio::NO_GPIO;
bool debugMode = false;
RwDefinitions::TemperatureSet temperatureSet;
RwDefinitions::StatusSet statusSet;
RwDefinitions::LastResetSatus lastResetStatusSet;
RwDefinitions::TmDataset tmDataset;

View File

@ -98,25 +98,11 @@ static const size_t MAX_CMD_SIZE = 9;
static const size_t MAX_REPLY_SIZE = 2 * SIZE_GET_TELEMETRY_REPLY;
static const uint8_t LAST_RESET_ENTRIES = 2;
static const uint8_t TEMPERATURE_SET_ENTRIES = 1;
static const uint8_t STATUS_SET_ENTRIES = 4;
static const uint8_t STATUS_SET_ENTRIES = 5;
static const uint8_t TM_SET_ENTRIES = 24;
/**
* @brief This dataset can be used to store the temperature of a reaction wheel.
*/
class TemperatureSet : public StaticLocalDataSet<TEMPERATURE_SET_ENTRIES> {
public:
TemperatureSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {}
TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {}
lp_var_t<int32_t> temperatureCelcius =
lp_var_t<int32_t>(sid.objectId, PoolIds::TEMPERATURE_C, this);
};
/**
* @brief This dataset can be used to store the reaction wheel status.
* @brief This dataset can be used to store the data periodically polled from the RW
*/
class StatusSet : public StaticLocalDataSet<STATUS_SET_ENTRIES> {
public:
@ -124,6 +110,8 @@ class StatusSet : public StaticLocalDataSet<STATUS_SET_ENTRIES> {
StatusSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, STATUS_SET_ID)) {}
lp_var_t<int32_t> temperatureCelcius =
lp_var_t<int32_t>(sid.objectId, PoolIds::TEMPERATURE_C, this);
lp_var_t<int32_t> currSpeed = lp_var_t<int32_t>(sid.objectId, PoolIds::CURR_SPEED, this);
lp_var_t<int32_t> referenceSpeed =
lp_var_t<int32_t>(sid.objectId, PoolIds::REFERENCE_SPEED, this);

View File

@ -10,7 +10,7 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PCDU_HANDLER;
//! [EXPORT] : [COMMENT] Indicates that a FSFW object requested setting a switch
//! P1: 1 if on was requested, 0 for off | P2: Switch Index
static constexpr Event SWITCH_CMD_SENT = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
//! [EXPORT] : [COMMENT] Indicated that a swithc state has changed
//! [EXPORT] : [COMMENT] Indicated that a switch state has changed
//! P1: New switch state, 1 for on, 0 for off | P2: Switch Index
static constexpr Event SWITCH_HAS_CHANGED = event::makeEvent(SUBSYSTEM_ID, 1, severity::INFO);
static constexpr Event SWITCHING_Q7S_DENIED = event::makeEvent(SUBSYSTEM_ID, 2, severity::MEDIUM);

2
tmtc

@ -1 +1 @@
Subproject commit 1c5149c2b1bd61347585a2e4982feee60914a2c0
Subproject commit a648b7f76f59838c73ce5286570b2130af426f96