rework SUS polling
This commit is contained in:
parent
0fabe3adb6
commit
11f476878d
@ -19,8 +19,8 @@ class LocalParameterHandler : public NVMParameterBase {
|
|||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*
|
*
|
||||||
* @param sdRelativeName Absolute name of json file relative to mount
|
* @param sdRelativeName Absolute name of json file relative to mount
|
||||||
* directory of SD card.
|
* directory
|
||||||
* E.g. conf/example.json
|
* of SD card. E.g. conf/example.json
|
||||||
* @param sdcMan Pointer to SD card manager
|
* @param sdcMan Pointer to SD card manager
|
||||||
*/
|
*/
|
||||||
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
|
LocalParameterHandler(std::string sdRelativeName, SdCardMountedIF* sdcMan);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <fsfw/controller/ExtendedControllerBase.h>
|
#include <fsfw/controller/ExtendedControllerBase.h>
|
||||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
|
|
||||||
class CoreControllerDummy : public ExtendedControllerBase {
|
class CoreControllerDummy : public ExtendedControllerBase {
|
||||||
public:
|
public:
|
||||||
|
@ -35,8 +35,9 @@ uint32_t SusDummy::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return
|
|||||||
|
|
||||||
ReturnValue_t SusDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t SusDummy::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(SUS::SusPoolIds::TEMPERATURE_C, new PoolEntry<float>({0}, 1, true));
|
localDataPoolMap.emplace(susMax1227::SusPoolIds::TEMPERATURE_C,
|
||||||
localDataPoolMap.emplace(SUS::SusPoolIds::CHANNEL_VEC,
|
new PoolEntry<float>({0}, 1, true));
|
||||||
|
localDataPoolMap.emplace(susMax1227::SusPoolIds::CHANNEL_VEC,
|
||||||
new PoolEntry<uint16_t>({2603, 781, 2760, 2048, 4056, 0}, true));
|
new PoolEntry<uint16_t>({2603, 781, 2760, 2048, 4056, 0}, true));
|
||||||
|
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
#define DUMMIES_SUSDUMMY_H_
|
#define DUMMIES_SUSDUMMY_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
|
||||||
|
|
||||||
class SusDummy : public DeviceHandlerBase {
|
class SusDummy : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
@ -17,7 +16,7 @@ class SusDummy : public DeviceHandlerBase {
|
|||||||
virtual ~SusDummy();
|
virtual ~SusDummy();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SUS::SusDataset susSet;
|
susMax1227::SusDataset susSet;
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
|
@ -78,7 +78,8 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
#if OBSW_ADD_SUN_SENSORS == 1
|
#if OBSW_ADD_SUN_SENSORS == 1
|
||||||
SusFdir* fdir = nullptr;
|
SusFdir* fdir = nullptr;
|
||||||
std::array<SusHandler*, 12> susHandlers = {};
|
std::array<SusHandler*, 12> susHandlers = {};
|
||||||
SpiCookie* spiCookie = new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, SUS::MAX_CMD_SIZE,
|
SpiCookie* spiCookie =
|
||||||
|
new SpiCookie(addresses::SUS_0, gpioIds::CS_SUS_0, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[0] =
|
susHandlers[0] =
|
||||||
@ -86,7 +87,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
fdir = new SusFdir(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
|
||||||
susHandlers[0]->setCustomFdir(fdir);
|
susHandlers[0]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[1] =
|
susHandlers[1] =
|
||||||
@ -94,7 +95,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
|
fdir = new SusFdir(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
|
||||||
susHandlers[1]->setCustomFdir(fdir);
|
susHandlers[1]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[2] =
|
susHandlers[2] =
|
||||||
@ -102,7 +103,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
|
fdir = new SusFdir(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
|
||||||
susHandlers[2]->setCustomFdir(fdir);
|
susHandlers[2]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[3] =
|
susHandlers[3] =
|
||||||
@ -110,7 +111,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
|
fdir = new SusFdir(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
|
||||||
susHandlers[3]->setCustomFdir(fdir);
|
susHandlers[3]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[4] =
|
susHandlers[4] =
|
||||||
@ -118,7 +119,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
|
fdir = new SusFdir(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
|
||||||
susHandlers[4]->setCustomFdir(fdir);
|
susHandlers[4]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[5] =
|
susHandlers[5] =
|
||||||
@ -126,7 +127,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
|
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
|
||||||
susHandlers[5]->setCustomFdir(fdir);
|
susHandlers[5]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[6] =
|
susHandlers[6] =
|
||||||
@ -134,7 +135,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
|
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
|
||||||
susHandlers[6]->setCustomFdir(fdir);
|
susHandlers[6]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[7] =
|
susHandlers[7] =
|
||||||
@ -142,7 +143,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
|
fdir = new SusFdir(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
|
||||||
susHandlers[7]->setCustomFdir(fdir);
|
susHandlers[7]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_8, gpioIds::CS_SUS_8, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[8] =
|
susHandlers[8] =
|
||||||
@ -150,7 +151,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
|
fdir = new SusFdir(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
|
||||||
susHandlers[8]->setCustomFdir(fdir);
|
susHandlers[8]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[9] =
|
susHandlers[9] =
|
||||||
@ -158,7 +159,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
|
fdir = new SusFdir(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
|
||||||
susHandlers[9]->setCustomFdir(fdir);
|
susHandlers[9]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[10] =
|
susHandlers[10] =
|
||||||
@ -166,7 +167,7 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
|||||||
fdir = new SusFdir(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
|
fdir = new SusFdir(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
|
||||||
susHandlers[10]->setCustomFdir(fdir);
|
susHandlers[10]->setCustomFdir(fdir);
|
||||||
|
|
||||||
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, SUS::MAX_CMD_SIZE,
|
spiCookie = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11, susMax1227::MAX_CMD_SIZE,
|
||||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||||
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
spiCookie->setMutexParams(MutexIF::TimeoutType::WAITING, spi::SUS_CS_TIMEOUT);
|
||||||
susHandlers[11] =
|
susHandlers[11] =
|
||||||
|
@ -24,7 +24,6 @@ class AcsBoardPolling : public SystemObject,
|
|||||||
MutexIF* ipcLock;
|
MutexIF* ipcLock;
|
||||||
SemaphoreIF* semaphore;
|
SemaphoreIF* semaphore;
|
||||||
std::array<uint8_t, 32> cmdBuf;
|
std::array<uint8_t, 32> cmdBuf;
|
||||||
std::array<uint8_t, 32> replyBuf;
|
|
||||||
|
|
||||||
struct DevBase {
|
struct DevBase {
|
||||||
SpiCookie* cookie = nullptr;
|
SpiCookie* cookie = nullptr;
|
||||||
|
@ -7,6 +7,7 @@ target_sources(
|
|||||||
PRIVATE Max31865RtdPolling.cpp
|
PRIVATE Max31865RtdPolling.cpp
|
||||||
ScexUartReader.cpp
|
ScexUartReader.cpp
|
||||||
ImtqPollingTask.cpp
|
ImtqPollingTask.cpp
|
||||||
|
SusPolling.cpp
|
||||||
ScexDleParser.cpp
|
ScexDleParser.cpp
|
||||||
ScexHelper.cpp
|
ScexHelper.cpp
|
||||||
RwPollingTask.cpp
|
RwPollingTask.cpp
|
||||||
|
109
linux/devices/SusPolling.cpp
Normal file
109
linux/devices/SusPolling.cpp
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#include "SusPolling.h"
|
||||||
|
|
||||||
|
#include <fsfw/tasks/SemaphoreFactory.h>
|
||||||
|
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
||||||
|
|
||||||
|
using namespace returnvalue;
|
||||||
|
|
||||||
|
SusPolling::SusPolling(object_id_t objectId, SpiComIF& spiComIF, GpioIF& gpioIF)
|
||||||
|
: SystemObject(objectId), spiComIF(spiComIF), gpioIF(gpioIF) {
|
||||||
|
semaphore = SemaphoreFactory::instance()->createBinarySemaphore();
|
||||||
|
semaphore->acquire();
|
||||||
|
ipcLock = MutexFactory::instance()->createMutex();
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::performOperation(uint8_t operationCode) {
|
||||||
|
while (true) {
|
||||||
|
ipcLock->lockMutex();
|
||||||
|
state = InternalState::IDLE;
|
||||||
|
ipcLock->unlockMutex();
|
||||||
|
semaphore->acquire();
|
||||||
|
// TODO: Perform SUS polling here.
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::initialize() { return OK; }
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::initializeInterface(CookieIF* cookie) {
|
||||||
|
auto* spiCookie = dynamic_cast<SpiCookie*>(cookie);
|
||||||
|
if (spiCookie == nullptr) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
int susIdx = addressToIndex(spiCookie->getSpiAddress());
|
||||||
|
if (susIdx < 0) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
susDevs[susIdx].cookie = spiCookie;
|
||||||
|
return spiComIF.initializeInterface(cookie);
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) {
|
||||||
|
auto* spiCookie = dynamic_cast<SpiCookie*>(cookie);
|
||||||
|
if (spiCookie == nullptr) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
int susIdx = addressToIndex(spiCookie->getSpiAddress());
|
||||||
|
if (susIdx < 0) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
if (sendLen != sizeof(acs::SusRequest)) {
|
||||||
|
return FAILED;
|
||||||
|
}
|
||||||
|
const auto* susReq = reinterpret_cast<const acs::SusRequest*>(sendData);
|
||||||
|
if (susDevs[susIdx].mode != susReq->mode) {
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::getSendSuccess(CookieIF* cookie) { return OK; }
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::requestReceiveMessage(CookieIF* cookie, size_t requestLen) { return OK; }
|
||||||
|
|
||||||
|
ReturnValue_t SusPolling::readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) {
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SusPolling::addressToIndex(address_t addr) {
|
||||||
|
switch (addr) {
|
||||||
|
case (addresses::SUS_0):
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_1):
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_2):
|
||||||
|
return 2;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_3):
|
||||||
|
return 3;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_4):
|
||||||
|
return 4;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_5):
|
||||||
|
return 5;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_6):
|
||||||
|
return 6;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_7):
|
||||||
|
return 7;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_8):
|
||||||
|
return 8;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_9):
|
||||||
|
return 9;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_10):
|
||||||
|
return 10;
|
||||||
|
break;
|
||||||
|
case (addresses::SUS_11):
|
||||||
|
return 11;
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
50
linux/devices/SusPolling.h
Normal file
50
linux/devices/SusPolling.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#ifndef LINUX_DEVICES_SUSPOLLING_H_
|
||||||
|
#define LINUX_DEVICES_SUSPOLLING_H_
|
||||||
|
|
||||||
|
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
||||||
|
#include <fsfw/objectmanager/SystemObject.h>
|
||||||
|
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||||
|
#include <fsfw/tasks/SemaphoreIF.h>
|
||||||
|
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||||
|
|
||||||
|
#include "devices/addresses.h"
|
||||||
|
#include "mission/devices/devicedefinitions/acsPolling.h"
|
||||||
|
|
||||||
|
class SusPolling : public SystemObject, public ExecutableObjectIF, public DeviceCommunicationIF {
|
||||||
|
public:
|
||||||
|
SusPolling(object_id_t objectId, SpiComIF& spiComIF, GpioIF& gpioIF);
|
||||||
|
|
||||||
|
ReturnValue_t performOperation(uint8_t operationCode) override;
|
||||||
|
ReturnValue_t initialize() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum class InternalState { IDLE, BUSY } state = InternalState::IDLE;
|
||||||
|
|
||||||
|
struct SusDev {
|
||||||
|
SpiCookie* cookie = nullptr;
|
||||||
|
bool performStartup = false;
|
||||||
|
acs::SimpleSensorMode mode = acs::SimpleSensorMode::OFF;
|
||||||
|
ReturnValue_t replyResult = returnvalue::OK;
|
||||||
|
acs::SusReply ownReply{};
|
||||||
|
acs::SusReply readerReply{};
|
||||||
|
};
|
||||||
|
|
||||||
|
MutexIF* ipcLock;
|
||||||
|
SemaphoreIF* semaphore;
|
||||||
|
uint8_t* rawReply = nullptr;
|
||||||
|
size_t dummy = 0;
|
||||||
|
SpiComIF& spiComIF;
|
||||||
|
GpioIF& gpioIF;
|
||||||
|
|
||||||
|
std::array<SusDev, 12> susDevs;
|
||||||
|
|
||||||
|
ReturnValue_t initializeInterface(CookieIF* cookie) override;
|
||||||
|
ReturnValue_t sendMessage(CookieIF* cookie, const uint8_t* sendData, size_t sendLen) override;
|
||||||
|
ReturnValue_t getSendSuccess(CookieIF* cookie) override;
|
||||||
|
ReturnValue_t requestReceiveMessage(CookieIF* cookie, size_t requestLen) override;
|
||||||
|
ReturnValue_t readReceivedMessage(CookieIF* cookie, uint8_t** buffer, size_t* size) override;
|
||||||
|
|
||||||
|
static int addressToIndex(address_t addr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* LINUX_DEVICES_SUSPOLLING_H_ */
|
@ -105,8 +105,7 @@ class PdecHandler : public SystemObject,
|
|||||||
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
|
//! [EXPORT] : [COMMENT] Failed to pull PDEC reset to low
|
||||||
static constexpr Event PDEC_RESET_FAILED = event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
|
static constexpr Event PDEC_RESET_FAILED = event::makeEvent(SUBSYSTEM_ID, 10, severity::HIGH);
|
||||||
//! [EXPORT] : [COMMENT] Failed to open the IRQ uio file
|
//! [EXPORT] : [COMMENT] Failed to open the IRQ uio file
|
||||||
static constexpr Event OPEN_IRQ_FILE_FAILED =
|
static constexpr Event OPEN_IRQ_FILE_FAILED = event::makeEvent(SUBSYSTEM_ID, 11, severity::HIGH);
|
||||||
event::makeEvent(SUBSYSTEM_ID, 11, severity::HIGH);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
|
static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
#include <fsfw/parameters/ReceivesParameterMessagesIF.h>
|
||||||
#include <fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h>
|
#include <fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h>
|
||||||
#include <fsfw_hal/devicehandlers/MgmRM3100Handler.h>
|
#include <fsfw_hal/devicehandlers/MgmRM3100Handler.h>
|
||||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
|
||||||
#include <mission/devices/devicedefinitions/imtqHelpers.h>
|
#include <mission/devices/devicedefinitions/imtqHelpers.h>
|
||||||
#include <mission/devices/devicedefinitions/rwHelpers.h>
|
#include <mission/devices/devicedefinitions/rwHelpers.h>
|
||||||
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
#include <mission/trace.h>
|
#include <mission/trace.h>
|
||||||
|
|
||||||
#include "acs/ActuatorCmd.h"
|
#include "acs/ActuatorCmd.h"
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include <fsfw/timemanager/Countdown.h>
|
#include <fsfw/timemanager/Countdown.h>
|
||||||
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h>
|
#include <mission/controller/controllerdefinitions/ThermalControllerDefinitions.h>
|
||||||
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
#include <mission/devices/devicedefinitions/Max31865Definitions.h>
|
||||||
#include <mission/devices/devicedefinitions/SusDefinitions.h>
|
|
||||||
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
#include <mission/devices/devicedefinitions/Tmp1075Definitions.h>
|
||||||
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -112,18 +112,18 @@ class ThermalController : public ExtendedControllerBase {
|
|||||||
TMP1075::Tmp1075Dataset tmp1075SetIfBoard;
|
TMP1075::Tmp1075Dataset tmp1075SetIfBoard;
|
||||||
|
|
||||||
// SUS
|
// SUS
|
||||||
SUS::SusDataset susSet0;
|
susMax1227::SusDataset susSet0;
|
||||||
SUS::SusDataset susSet1;
|
susMax1227::SusDataset susSet1;
|
||||||
SUS::SusDataset susSet2;
|
susMax1227::SusDataset susSet2;
|
||||||
SUS::SusDataset susSet3;
|
susMax1227::SusDataset susSet3;
|
||||||
SUS::SusDataset susSet4;
|
susMax1227::SusDataset susSet4;
|
||||||
SUS::SusDataset susSet5;
|
susMax1227::SusDataset susSet5;
|
||||||
SUS::SusDataset susSet6;
|
susMax1227::SusDataset susSet6;
|
||||||
SUS::SusDataset susSet7;
|
susMax1227::SusDataset susSet7;
|
||||||
SUS::SusDataset susSet8;
|
susMax1227::SusDataset susSet8;
|
||||||
SUS::SusDataset susSet9;
|
susMax1227::SusDataset susSet9;
|
||||||
SUS::SusDataset susSet10;
|
susMax1227::SusDataset susSet10;
|
||||||
SUS::SusDataset susSet11;
|
susMax1227::SusDataset susSet11;
|
||||||
|
|
||||||
// TempLimits
|
// TempLimits
|
||||||
TempLimits acsBoardLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
TempLimits acsBoardLimits = TempLimits(-40.0, -40.0, 80.0, 85.0, 85.0);
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
#include <mission/devices/devicedefinitions/gyroAdisHelpers.h>
|
#include <mission/devices/devicedefinitions/gyroAdisHelpers.h>
|
||||||
#include <mission/devices/devicedefinitions/imtqHelpers.h>
|
#include <mission/devices/devicedefinitions/imtqHelpers.h>
|
||||||
#include <mission/devices/devicedefinitions/rwHelpers.h>
|
#include <mission/devices/devicedefinitions/rwHelpers.h>
|
||||||
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
|
|
||||||
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h"
|
||||||
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
#include "fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h"
|
||||||
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
#include "fsfw_hal/devicehandlers/MgmRM3100Handler.h"
|
||||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
|
||||||
|
|
||||||
namespace ACS {
|
namespace ACS {
|
||||||
|
|
||||||
@ -36,19 +36,19 @@ class SensorValues {
|
|||||||
imtq::RawMtmMeasurementNoTorque imtqMgmSet =
|
imtq::RawMtmMeasurementNoTorque imtqMgmSet =
|
||||||
imtq::RawMtmMeasurementNoTorque(objects::IMTQ_HANDLER);
|
imtq::RawMtmMeasurementNoTorque(objects::IMTQ_HANDLER);
|
||||||
|
|
||||||
std::array<SUS::SusDataset, 12> susSets{
|
std::array<susMax1227::SusDataset, 12> susSets{
|
||||||
SUS::SusDataset(objects::SUS_0_N_LOC_XFYFZM_PT_XF),
|
susMax1227::SusDataset(objects::SUS_0_N_LOC_XFYFZM_PT_XF),
|
||||||
SUS::SusDataset(objects::SUS_1_N_LOC_XBYFZM_PT_XB),
|
susMax1227::SusDataset(objects::SUS_1_N_LOC_XBYFZM_PT_XB),
|
||||||
SUS::SusDataset(objects::SUS_2_N_LOC_XFYBZB_PT_YB),
|
susMax1227::SusDataset(objects::SUS_2_N_LOC_XFYBZB_PT_YB),
|
||||||
SUS::SusDataset(objects::SUS_3_N_LOC_XFYBZF_PT_YF),
|
susMax1227::SusDataset(objects::SUS_3_N_LOC_XFYBZF_PT_YF),
|
||||||
SUS::SusDataset(objects::SUS_4_N_LOC_XMYFZF_PT_ZF),
|
susMax1227::SusDataset(objects::SUS_4_N_LOC_XMYFZF_PT_ZF),
|
||||||
SUS::SusDataset(objects::SUS_5_N_LOC_XFYMZB_PT_ZB),
|
susMax1227::SusDataset(objects::SUS_5_N_LOC_XFYMZB_PT_ZB),
|
||||||
SUS::SusDataset(objects::SUS_6_R_LOC_XFYBZM_PT_XF),
|
susMax1227::SusDataset(objects::SUS_6_R_LOC_XFYBZM_PT_XF),
|
||||||
SUS::SusDataset(objects::SUS_7_R_LOC_XBYBZM_PT_XB),
|
susMax1227::SusDataset(objects::SUS_7_R_LOC_XBYBZM_PT_XB),
|
||||||
SUS::SusDataset(objects::SUS_8_R_LOC_XBYBZB_PT_YB),
|
susMax1227::SusDataset(objects::SUS_8_R_LOC_XBYBZB_PT_YB),
|
||||||
SUS::SusDataset(objects::SUS_9_R_LOC_XBYBZB_PT_YF),
|
susMax1227::SusDataset(objects::SUS_9_R_LOC_XBYBZB_PT_YF),
|
||||||
SUS::SusDataset(objects::SUS_10_N_LOC_XMYBZF_PT_ZF),
|
susMax1227::SusDataset(objects::SUS_10_N_LOC_XMYBZF_PT_ZF),
|
||||||
SUS::SusDataset(objects::SUS_11_R_LOC_XBYMZB_PT_ZB),
|
susMax1227::SusDataset(objects::SUS_11_R_LOC_XBYMZB_PT_ZB),
|
||||||
};
|
};
|
||||||
|
|
||||||
AdisGyroPrimaryDataset gyr0AdisSet = AdisGyroPrimaryDataset(objects::GYRO_0_ADIS_HANDLER);
|
AdisGyroPrimaryDataset gyr0AdisSet = AdisGyroPrimaryDataset(objects::GYRO_0_ADIS_HANDLER);
|
||||||
|
@ -43,25 +43,25 @@ ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (ComStates::WRITE_SETUP): {
|
case (ComStates::WRITE_SETUP): {
|
||||||
*id = SUS::WRITE_SETUP;
|
*id = susMax1227::WRITE_SETUP;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
case (ComStates::EXT_CLOCKED_CONVERSIONS): {
|
case (ComStates::EXT_CLOCKED_CONVERSIONS): {
|
||||||
*id = SUS::READ_EXT_TIMED_CONVERSIONS;
|
*id = susMax1227::READ_EXT_TIMED_CONVERSIONS;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
case (ComStates::START_INT_CLOCKED_CONVERSIONS): {
|
case (ComStates::START_INT_CLOCKED_CONVERSIONS): {
|
||||||
*id = SUS::START_INT_TIMED_CONVERSIONS;
|
*id = susMax1227::START_INT_TIMED_CONVERSIONS;
|
||||||
comState = ComStates::READ_INT_CLOCKED_CONVERSIONS;
|
comState = ComStates::READ_INT_CLOCKED_CONVERSIONS;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
case (ComStates::READ_INT_CLOCKED_CONVERSIONS): {
|
case (ComStates::READ_INT_CLOCKED_CONVERSIONS): {
|
||||||
*id = SUS::READ_INT_TIMED_CONVERSIONS;
|
*id = susMax1227::READ_INT_TIMED_CONVERSIONS;
|
||||||
comState = ComStates::START_INT_CLOCKED_CONVERSIONS;
|
comState = ComStates::START_INT_CLOCKED_CONVERSIONS;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
case (ComStates::EXT_CLOCKED_TEMP): {
|
case (ComStates::EXT_CLOCKED_TEMP): {
|
||||||
*id = SUS::READ_EXT_TIMED_TEMPS;
|
*id = susMax1227::READ_EXT_TIMED_TEMPS;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ ReturnValue_t SusHandler::buildNormalDeviceCommand(DeviceCommandId_t *id) {
|
|||||||
|
|
||||||
ReturnValue_t SusHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
ReturnValue_t SusHandler::buildTransitionDeviceCommand(DeviceCommandId_t *id) {
|
||||||
if (comState == ComStates::WRITE_SETUP) {
|
if (comState == ComStates::WRITE_SETUP) {
|
||||||
*id = SUS::WRITE_SETUP;
|
*id = susMax1227::WRITE_SETUP;
|
||||||
return buildCommandFromCommand(*id, nullptr, 0);
|
return buildCommandFromCommand(*id, nullptr, 0);
|
||||||
}
|
}
|
||||||
return NOTHING_TO_SEND;
|
return NOTHING_TO_SEND;
|
||||||
@ -81,32 +81,32 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
size_t commandDataLen) {
|
size_t commandDataLen) {
|
||||||
using namespace max1227;
|
using namespace max1227;
|
||||||
switch (deviceCommand) {
|
switch (deviceCommand) {
|
||||||
case (SUS::WRITE_SETUP): {
|
case (susMax1227::WRITE_SETUP): {
|
||||||
if (clkMode == ClkModes::INT_CLOCKED) {
|
if (clkMode == ClkModes::INT_CLOCKED) {
|
||||||
cmdBuffer[0] = SUS::SETUP_INT_CLOKED;
|
cmdBuffer[0] = susMax1227::SETUP_INT_CLOKED;
|
||||||
} else {
|
} else {
|
||||||
cmdBuffer[0] = SUS::SETUP_EXT_CLOCKED;
|
cmdBuffer[0] = susMax1227::SETUP_EXT_CLOCKED;
|
||||||
}
|
}
|
||||||
|
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 1;
|
rawPacketLen = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::START_INT_TIMED_CONVERSIONS): {
|
case (susMax1227::START_INT_TIMED_CONVERSIONS): {
|
||||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||||
cmdBuffer[0] = max1227::buildResetByte(true);
|
cmdBuffer[0] = max1227::buildResetByte(true);
|
||||||
cmdBuffer[1] = SUS::CONVERSION;
|
cmdBuffer[1] = susMax1227::CONVERSION;
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = 2;
|
rawPacketLen = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_INT_TIMED_CONVERSIONS): {
|
case (susMax1227::READ_INT_TIMED_CONVERSIONS): {
|
||||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
rawPacketLen = SUS::SIZE_READ_INT_CONVERSIONS;
|
rawPacketLen = susMax1227::SIZE_READ_INT_CONVERSIONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_CONVERSIONS): {
|
case (susMax1227::READ_EXT_TIMED_CONVERSIONS): {
|
||||||
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
std::memset(cmdBuffer, 0, sizeof(cmdBuffer));
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||||
@ -114,10 +114,10 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
cmdBuffer[idx * 2 + 1] = 0;
|
cmdBuffer[idx * 2 + 1] = 0;
|
||||||
}
|
}
|
||||||
cmdBuffer[12] = 0x00;
|
cmdBuffer[12] = 0x00;
|
||||||
rawPacketLen = SUS::SIZE_READ_EXT_CONVERSIONS;
|
rawPacketLen = susMax1227::SIZE_READ_EXT_CONVERSIONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_TEMPS): {
|
case (susMax1227::READ_EXT_TIMED_TEMPS): {
|
||||||
cmdBuffer[0] = buildConvByte(ScanModes::N_ONCE, 0, true);
|
cmdBuffer[0] = buildConvByte(ScanModes::N_ONCE, 0, true);
|
||||||
std::memset(cmdBuffer + 1, 0, 24);
|
std::memset(cmdBuffer + 1, 0, 24);
|
||||||
rawPacket = cmdBuffer;
|
rawPacket = cmdBuffer;
|
||||||
@ -131,13 +131,13 @@ ReturnValue_t SusHandler::buildCommandFromCommand(DeviceCommandId_t deviceComman
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SusHandler::fillCommandAndReplyMap() {
|
void SusHandler::fillCommandAndReplyMap() {
|
||||||
insertInCommandAndReplyMap(SUS::WRITE_SETUP, 1);
|
insertInCommandAndReplyMap(susMax1227::WRITE_SETUP, 1);
|
||||||
insertInCommandAndReplyMap(SUS::START_INT_TIMED_CONVERSIONS, 1);
|
insertInCommandAndReplyMap(susMax1227::START_INT_TIMED_CONVERSIONS, 1);
|
||||||
insertInCommandAndReplyMap(SUS::READ_INT_TIMED_CONVERSIONS, 1, &dataset,
|
insertInCommandAndReplyMap(susMax1227::READ_INT_TIMED_CONVERSIONS, 1, &dataset,
|
||||||
SUS::SIZE_READ_INT_CONVERSIONS);
|
susMax1227::SIZE_READ_INT_CONVERSIONS);
|
||||||
insertInCommandAndReplyMap(SUS::READ_EXT_TIMED_CONVERSIONS, 1, &dataset,
|
insertInCommandAndReplyMap(susMax1227::READ_EXT_TIMED_CONVERSIONS, 1, &dataset,
|
||||||
SUS::SIZE_READ_EXT_CONVERSIONS);
|
susMax1227::SIZE_READ_EXT_CONVERSIONS);
|
||||||
insertInCommandAndReplyMap(SUS::READ_EXT_TIMED_TEMPS, 1);
|
insertInCommandAndReplyMap(susMax1227::READ_EXT_TIMED_TEMPS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSize,
|
ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSize,
|
||||||
@ -149,16 +149,16 @@ ReturnValue_t SusHandler::scanForReply(const uint8_t *start, size_t remainingSiz
|
|||||||
|
|
||||||
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case SUS::WRITE_SETUP: {
|
case susMax1227::WRITE_SETUP: {
|
||||||
if (getMode() == _MODE_START_UP) {
|
if (getMode() == _MODE_START_UP) {
|
||||||
commandExecuted = true;
|
commandExecuted = true;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case SUS::START_INT_TIMED_CONVERSIONS: {
|
case susMax1227::START_INT_TIMED_CONVERSIONS: {
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
case SUS::READ_INT_TIMED_CONVERSIONS: {
|
case susMax1227::READ_INT_TIMED_CONVERSIONS: {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = max1227::getTemperature(((packet[0] & 0x0f) << 8) | packet[1]);
|
dataset.temperatureCelcius = max1227::getTemperature(((packet[0] & 0x0f) << 8) | packet[1]);
|
||||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||||
@ -168,7 +168,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
printDataset();
|
printDataset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_CONVERSIONS): {
|
case (susMax1227::READ_EXT_TIMED_CONVERSIONS): {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||||
dataset.channels[idx] = packet[idx * 2 + 1] << 8 | packet[idx * 2 + 2];
|
dataset.channels[idx] = packet[idx * 2 + 1] << 8 | packet[idx * 2 + 2];
|
||||||
@ -181,7 +181,7 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
|||||||
printDataset();
|
printDataset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (SUS::READ_EXT_TIMED_TEMPS): {
|
case (susMax1227::READ_EXT_TIMED_TEMPS): {
|
||||||
PoolReadGuard readSet(&dataset);
|
PoolReadGuard readSet(&dataset);
|
||||||
dataset.temperatureCelcius = max1227::getTemperature(((packet[23] & 0x0f) << 8) | packet[24]);
|
dataset.temperatureCelcius = max1227::getTemperature(((packet[23] & 0x0f) << 8) | packet[24]);
|
||||||
dataset.temperatureCelcius.setValid(true);
|
dataset.temperatureCelcius.setValid(true);
|
||||||
@ -200,8 +200,8 @@ uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { retu
|
|||||||
|
|
||||||
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||||
LocalDataPoolManager &poolManager) {
|
LocalDataPoolManager &poolManager) {
|
||||||
localDataPoolMap.emplace(SUS::TEMPERATURE_C, &tempC);
|
localDataPoolMap.emplace(susMax1227::TEMPERATURE_C, &tempC);
|
||||||
localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec);
|
localDataPoolMap.emplace(susMax1227::CHANNEL_VEC, &channelVec);
|
||||||
poolManager.subscribeForDiagPeriodicPacket(
|
poolManager.subscribeForDiagPeriodicPacket(
|
||||||
subdp::DiagnosticsHkPeriodicParams(dataset.getSid(), false, 5.0));
|
subdp::DiagnosticsHkPeriodicParams(dataset.getSid(), false, 5.0));
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#define MISSION_DEVICES_SUSHANDLER_H_
|
#define MISSION_DEVICES_SUSHANDLER_H_
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||||
|
#include <mission/devices/devicedefinitions/susMax1227Helpers.h>
|
||||||
|
|
||||||
#include "devicedefinitions/SusDefinitions.h"
|
|
||||||
#include "events/subsystemIdRanges.h"
|
#include "events/subsystemIdRanges.h"
|
||||||
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
|
#include "fsfw/globalfunctions/PeriodicOperationDivider.h"
|
||||||
#include "mission/devices/max1227.h"
|
#include "mission/devices/max1227.h"
|
||||||
@ -71,7 +71,7 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
bool goToNormalModeImmediately = false;
|
bool goToNormalModeImmediately = false;
|
||||||
bool commandExecuted = false;
|
bool commandExecuted = false;
|
||||||
|
|
||||||
SUS::SusDataset dataset;
|
susMax1227::SusDataset dataset;
|
||||||
// Read temperature in each alternating communication step when using
|
// Read temperature in each alternating communication step when using
|
||||||
// externally clocked mode
|
// externally clocked mode
|
||||||
ClkModes clkMode = ClkModes::INT_CLOCKED;
|
ClkModes clkMode = ClkModes::INT_CLOCKED;
|
||||||
@ -79,7 +79,7 @@ class SusHandler : public DeviceHandlerBase {
|
|||||||
PoolEntry<uint16_t> channelVec = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0});
|
PoolEntry<uint16_t> channelVec = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0});
|
||||||
|
|
||||||
uint8_t susIdx = 0;
|
uint8_t susIdx = 0;
|
||||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
uint8_t cmdBuffer[susMax1227::MAX_CMD_SIZE];
|
||||||
ComStates comState = ComStates::IDLE;
|
ComStates comState = ComStates::IDLE;
|
||||||
|
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
|
||||||
|
@ -76,6 +76,16 @@ struct MgmLis3Reply {
|
|||||||
int16_t temperatureRaw = thermal::INVALID_TEMPERATURE;
|
int16_t temperatureRaw = thermal::INVALID_TEMPERATURE;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SusRequest {
|
||||||
|
SimpleSensorMode mode = SimpleSensorMode::OFF;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SusReply {
|
||||||
|
bool dataWasSet = false;
|
||||||
|
uint16_t tempRaw = 0;
|
||||||
|
uint16_t channelsRaw[6]{};
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace acs
|
} // namespace acs
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_ */
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_ACSPOLLING_H_ */
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace SUS {
|
namespace susMax1227 {
|
||||||
|
|
||||||
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
|
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
|
||||||
|
|
||||||
@ -72,6 +72,6 @@ class SusDataset : public StaticLocalDataSet<POOL_ENTRIES> {
|
|||||||
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, TEMPERATURE_C, this);
|
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, TEMPERATURE_C, this);
|
||||||
lp_vec_t<uint16_t, 6> channels = lp_vec_t<uint16_t, 6>(sid.objectId, CHANNEL_VEC, this);
|
lp_vec_t<uint16_t, 6> channels = lp_vec_t<uint16_t, 6>(sid.objectId, CHANNEL_VEC, this);
|
||||||
};
|
};
|
||||||
} // namespace SUS
|
} // namespace susMax1227
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SUS_H_ */
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_SUS_H_ */
|
@ -1,17 +1,16 @@
|
|||||||
#ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_
|
#ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_
|
||||||
#define MISSION_SYSTEM_COMSUBSYSTEM_H_
|
#define MISSION_SYSTEM_COMSUBSYSTEM_H_
|
||||||
|
|
||||||
|
#include <common/config/eive/eventSubsystemIds.h>
|
||||||
#include <fsfw/events/EventMessage.h>
|
#include <fsfw/events/EventMessage.h>
|
||||||
#include <fsfw/parameters/HasParametersIF.h>
|
#include <fsfw/parameters/HasParametersIF.h>
|
||||||
#include <fsfw/parameters/ParameterHelper.h>
|
#include <fsfw/parameters/ParameterHelper.h>
|
||||||
#include <fsfw/subsystem/Subsystem.h>
|
#include <fsfw/subsystem/Subsystem.h>
|
||||||
#include <common/config/eive/eventSubsystemIds.h>
|
|
||||||
|
|
||||||
#include "mission/comDefs.h"
|
#include "mission/comDefs.h"
|
||||||
|
|
||||||
class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::COM_SUBSYSTEM;
|
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::COM_SUBSYSTEM;
|
||||||
|
|
||||||
//! [EXPORT] : [COMMENT] The transmit timer to protect the Syrlinks expired
|
//! [EXPORT] : [COMMENT] The transmit timer to protect the Syrlinks expired
|
||||||
@ -27,7 +26,8 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
|||||||
* @param maxNumberOfSequences
|
* @param maxNumberOfSequences
|
||||||
* @param maxNumberOfTables
|
* @param maxNumberOfTables
|
||||||
* @param transmitterTimeout Maximum time the transmitter of the syrlinks
|
* @param transmitterTimeout Maximum time the transmitter of the syrlinks
|
||||||
* will be enabled
|
* will
|
||||||
|
* be enabled
|
||||||
*/
|
*/
|
||||||
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
|
ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables,
|
||||||
uint32_t transmitterTimeout);
|
uint32_t transmitterTimeout);
|
||||||
|
Loading…
Reference in New Issue
Block a user