moved some more code to mission folder
This commit is contained in:
parent
e1f9a4bbd9
commit
4da0555bfd
@ -44,10 +44,6 @@
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/csp/CspCookie.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/PayloadPcduHandler.h"
|
||||
#include "linux/devices/SolarArrayDeploymentHandler.h"
|
||||
#include "linux/devices/SusHandler.h"
|
||||
#include "linux/devices/devicedefinitions/SusDefinitions.h"
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/devices/ACUHandler.h"
|
||||
#include "mission/devices/BpxBatteryHandler.h"
|
||||
@ -59,9 +55,12 @@
|
||||
#include "mission/devices/PCDUHandler.h"
|
||||
#include "mission/devices/PDU1Handler.h"
|
||||
#include "mission/devices/PDU2Handler.h"
|
||||
#include "mission/devices/PayloadPcduHandler.h"
|
||||
#include "mission/devices/PlocMPSoCHandler.h"
|
||||
#include "mission/devices/RadiationSensorHandler.h"
|
||||
#include "mission/devices/RwHandler.h"
|
||||
#include "mission/devices/SolarArrayDeploymentHandler.h"
|
||||
#include "mission/devices/SusHandler.h"
|
||||
#include "mission/devices/SyrlinksHkHandler.h"
|
||||
#include "mission/devices/Tmp1075Handler.h"
|
||||
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
|
||||
@ -69,6 +68,7 @@
|
||||
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SusDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/tmtc/CCSDSHandler.h"
|
||||
|
@ -1,7 +1,4 @@
|
||||
target_sources(${OBSW_NAME} PRIVATE
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
SusHandler.cpp
|
||||
PayloadPcduHandler.cpp
|
||||
)
|
||||
|
||||
if(EIVE_BUILD_GPSD_GPS_HANDLER)
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <fsfw/tasks/FixedTimeslotTaskIF.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
#include "linux/devices/SusHandler.h"
|
||||
#include "mission/devices/SusHandler.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
ReturnValue_t pst::pstGpio(FixedTimeslotTaskIF *thisSequence) {
|
||||
|
@ -16,4 +16,7 @@ target_sources(${LIB_EIVE_MISSION} PRIVATE
|
||||
GyroADIS1650XHandler.cpp
|
||||
RwHandler.cpp
|
||||
max1227.cpp
|
||||
SusHandler.cpp
|
||||
PayloadPcduHandler.cpp
|
||||
SolarArrayDeploymentHandler.cpp
|
||||
)
|
||||
|
@ -1,11 +1,14 @@
|
||||
#include "PayloadPcduHandler.h"
|
||||
|
||||
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <fsfw_hal/linux/UnixFileGuard.h>
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
#include <fsfw_hal/linux/spi/SpiCookie.h>
|
||||
#include <fsfw_hal/linux/utility.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
@ -315,6 +318,7 @@ void PayloadPcduHandler::stateMachineToNormal() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
ReturnValue_t PayloadPcduHandler::extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen,
|
||||
void* args) {
|
||||
@ -443,3 +447,4 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
#endif
|
@ -5,11 +5,14 @@
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
class SpiComIF;
|
||||
class SpiCookie;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Device handler for the EIVE Payload PCDU
|
||||
@ -35,8 +38,11 @@ class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
|
||||
static ReturnValue_t extConvAsTwoCallback(SpiComIF* comIf, SpiCookie* cookie,
|
||||
const uint8_t* sendData, size_t sendLen, void* args);
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
static ReturnValue_t transferAsTwo(SpiComIF* comIf, SpiCookie* cookie, const uint8_t* sendData,
|
||||
size_t sendLen, bool tempOnly);
|
||||
#endif
|
||||
|
||||
private:
|
||||
enum class States {
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
#include <fsfw_hal/linux/spi/SpiComIF.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
||||
@ -28,11 +27,11 @@ void SusHandler::doStartUp() {
|
||||
}
|
||||
if (comState == ComStates::WRITE_SETUP) {
|
||||
if (commandExecuted) {
|
||||
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
|
||||
setMode(MODE_NORMAL);
|
||||
#else
|
||||
if (goToNormalModeImmediately) {
|
||||
setMode(_MODE_TO_NORMAL);
|
||||
} else {
|
||||
setMode(_MODE_TO_ON);
|
||||
#endif
|
||||
}
|
||||
commandExecuted = false;
|
||||
if (clkMode == ClkModes::INT_CLOCKED) {
|
||||
comState = ComStates::START_INT_CLOCKED_CONVERSIONS;
|
||||
@ -170,23 +169,17 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8
|
||||
PoolReadGuard readSet(&dataset);
|
||||
|
||||
dataset.temperatureCelcius = static_cast<int16_t>((packet[0] << 8) | packet[1]) * 0.125;
|
||||
dataset.ain0 = (*(packet + 2) << 8 | *(packet + 3));
|
||||
dataset.ain1 = (*(packet + 4) << 8 | *(packet + 5));
|
||||
dataset.ain2 = (*(packet + 6) << 8 | *(packet + 7));
|
||||
dataset.ain3 = (*(packet + 8) << 8 | *(packet + 9));
|
||||
dataset.ain4 = (*(packet + 10) << 8 | *(packet + 11));
|
||||
dataset.ain5 = (*(packet + 12) << 8 | *(packet + 13));
|
||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||
dataset.channels[idx] = packet[idx * 2 + 2] << 8 | packet[idx * 2 + 3];
|
||||
}
|
||||
printDataset();
|
||||
break;
|
||||
}
|
||||
case (SUS::READ_EXT_TIMED_CONVERSIONS): {
|
||||
PoolReadGuard readSet(&dataset);
|
||||
dataset.ain0 = (packet[1] << 8) | packet[2];
|
||||
dataset.ain1 = (packet[3] << 8) | packet[4];
|
||||
dataset.ain2 = (packet[5] << 8) | packet[6];
|
||||
dataset.ain3 = (packet[7] << 8) | packet[8];
|
||||
dataset.ain4 = (packet[9] << 8) | packet[10];
|
||||
dataset.ain5 = (packet[11] << 8) | packet[12];
|
||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||
dataset.channels[idx] = packet[idx * 2 + 1] << 8 | packet[idx * 2 + 2];
|
||||
}
|
||||
// Read temperature in next read cycle
|
||||
if (clkMode == ClkModes::EXT_CLOCKED_WITH_TEMP) {
|
||||
comState = ComStates::EXT_CLOCKED_TEMP;
|
||||
@ -213,13 +206,8 @@ uint32_t SusHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { retu
|
||||
|
||||
ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(SUS::TEMPERATURE_C, new PoolEntry<float>({0.0}));
|
||||
localDataPoolMap.emplace(SUS::AIN0, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::AIN1, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::AIN2, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::AIN3, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::AIN4, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::AIN5, new PoolEntry<uint16_t>({0}));
|
||||
localDataPoolMap.emplace(SUS::TEMPERATURE_C, &tempC);
|
||||
localDataPoolMap.emplace(SUS::CHANNEL_VEC, &channelVec);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -228,15 +216,14 @@ void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediat
|
||||
void SusHandler::printDataset() {
|
||||
if (periodicPrintout) {
|
||||
if (divider.checkAndIncrement()) {
|
||||
sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID "
|
||||
<< std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3);
|
||||
sif::info << dataset.ain0 << ",";
|
||||
sif::info << dataset.ain1 << ",";
|
||||
sif::info << dataset.ain2 << ",";
|
||||
sif::info << dataset.ain3 << ",";
|
||||
sif::info << dataset.ain4 << ",";
|
||||
sif::info << dataset.ain5 << "] ";
|
||||
sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl;
|
||||
sif::info << "SUS ADC hex [" << std::setfill('0') << std::hex;
|
||||
for (uint8_t idx = 0; idx < 6; idx++) {
|
||||
sif::info << std::setw(3) << dataset.channels[idx];
|
||||
if (idx < 6 - 1) {
|
||||
sif::info << ",";
|
||||
}
|
||||
}
|
||||
sif::info << "] | T[C] " << std::dec << dataset.temperatureCelcius.value << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
@ -76,6 +76,8 @@ class SusHandler : public DeviceHandlerBase {
|
||||
// Read temperature in each alternating communication step when using
|
||||
// externally clocked mode
|
||||
ClkModes clkMode = ClkModes::INT_CLOCKED;
|
||||
PoolEntry<float> tempC = PoolEntry<float>({0.0});
|
||||
PoolEntry<uint16_t> channelVec = PoolEntry<uint16_t>({0, 0, 0, 0, 0, 0});
|
||||
|
||||
uint8_t susIdx = 0;
|
||||
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
|
@ -61,15 +61,7 @@ static const uint8_t MAX_CMD_SIZE = 32;
|
||||
|
||||
static const uint8_t POOL_ENTRIES = 7;
|
||||
|
||||
enum Max1227PoolIds : lp_id_t {
|
||||
TEMPERATURE_C,
|
||||
AIN0,
|
||||
AIN1,
|
||||
AIN2,
|
||||
AIN3,
|
||||
AIN4,
|
||||
AIN5,
|
||||
};
|
||||
enum Max1227PoolIds : lp_id_t { TEMPERATURE_C, CHANNEL_VEC };
|
||||
|
||||
class SusDataset : public StaticLocalDataSet<POOL_ENTRIES> {
|
||||
public:
|
||||
@ -78,12 +70,7 @@ class SusDataset : public StaticLocalDataSet<POOL_ENTRIES> {
|
||||
SusDataset(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SUS_DATA_SET_ID)) {}
|
||||
|
||||
lp_var_t<float> temperatureCelcius = lp_var_t<float>(sid.objectId, TEMPERATURE_C, this);
|
||||
lp_var_t<uint16_t> ain0 = lp_var_t<uint16_t>(sid.objectId, AIN0, this);
|
||||
lp_var_t<uint16_t> ain1 = lp_var_t<uint16_t>(sid.objectId, AIN1, this);
|
||||
lp_var_t<uint16_t> ain2 = lp_var_t<uint16_t>(sid.objectId, AIN2, this);
|
||||
lp_var_t<uint16_t> ain3 = lp_var_t<uint16_t>(sid.objectId, AIN3, this);
|
||||
lp_var_t<uint16_t> ain4 = lp_var_t<uint16_t>(sid.objectId, AIN4, this);
|
||||
lp_var_t<uint16_t> ain5 = lp_var_t<uint16_t>(sid.objectId, AIN5, this);
|
||||
lp_vec_t<uint16_t, 6> channels = lp_vec_t<uint16_t, 6>(sid.objectId, CHANNEL_VEC, this);
|
||||
};
|
||||
} // namespace SUS
|
||||
|
Loading…
Reference in New Issue
Block a user