Merge branch 'mueller/plpcdu-sus-updates' of https://egit.irs.uni-stuttgart.de/eive/eive-obsw into mueller/plpcdu-sus-updates
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
commit
ee2c194aeb
@ -44,11 +44,9 @@
|
||||
#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 "linux/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/core/GenericFactory.h"
|
||||
#include "mission/devices/ACUHandler.h"
|
||||
#include "mission/devices/BpxBatteryHandler.h"
|
||||
@ -60,6 +58,7 @@
|
||||
#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"
|
||||
@ -71,6 +70,7 @@
|
||||
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/RwDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "mission/tmtc/CCSDSHandler.h"
|
||||
#include "mission/tmtc/VirtualChannel.h"
|
||||
#include "mission/utility/TmFunnel.h"
|
||||
@ -1207,8 +1207,15 @@ void ObjectFactory::createPlPcduComponents(LinuxLibgpioIF* gpioComIF, SpiComIF*
|
||||
q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
|
||||
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
|
||||
// Create device handler components
|
||||
auto plPcduHandler =
|
||||
PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF);
|
||||
auto plPcduHandler = new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF,
|
||||
spiCookie, gpioComIF, false);
|
||||
#if OBSW_TEST_PL_PCDU == 1
|
||||
plPcduHandler->setStartUpImmediately();
|
||||
#if OBSW_DEBUG_PL_PCDU == 1
|
||||
plPcduHandler->setToGoToNormalModeImmediately(true);
|
||||
plPcduHandler->enablePeriodicPrintout(true, 5);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
|
||||
|
@ -4,19 +4,18 @@
|
||||
0x43400001;THERMAL_CONTROLLER
|
||||
0x44120006;MGM_0_LIS3_HANDLER
|
||||
0x44120010;GYRO_0_ADIS_HANDLER
|
||||
0x44120032;SUS_1
|
||||
0x44120033;SUS_2
|
||||
0x44120034;SUS_3
|
||||
0x44120035;SUS_4
|
||||
0x44120036;SUS_5
|
||||
0x44120037;SUS_6
|
||||
0x44120038;SUS_7
|
||||
0x44120039;SUS_8
|
||||
0x44120040;SUS_9
|
||||
0x44120041;SUS_10
|
||||
0x44120042;SUS_11
|
||||
0x44120043;SUS_12
|
||||
0x44120044;SUS_13
|
||||
0x44120032;SUS_0
|
||||
0x44120033;SUS_1
|
||||
0x44120034;SUS_2
|
||||
0x44120035;SUS_3
|
||||
0x44120036;SUS_4
|
||||
0x44120037;SUS_5
|
||||
0x44120038;SUS_6
|
||||
0x44120039;SUS_7
|
||||
0x44120040;SUS_8
|
||||
0x44120041;SUS_9
|
||||
0x44120042;SUS_10
|
||||
0x44120043;SUS_11
|
||||
0x44120047;RW1
|
||||
0x44120107;MGM_1_RM3100_HANDLER
|
||||
0x44120111;GYRO_1_L3G_HANDLER
|
||||
@ -36,6 +35,7 @@
|
||||
0x44250002;PDU2_HANDLER
|
||||
0x44250003;ACU_HANDLER
|
||||
0x44260000;BPX_BATT_HANDLER
|
||||
0x44300000;PLPCDU_HANDLER
|
||||
0x443200A5;RAD_SENSOR
|
||||
0x44330000;PLOC_UPDATER
|
||||
0x44330001;PLOC_MEMORY_DUMPER
|
||||
@ -101,6 +101,7 @@
|
||||
0x53ffffff;FSFW_OBJECTS_END
|
||||
0x54000010;SPI_TEST
|
||||
0x54000020;UART_TEST
|
||||
0x54000030;I2C_TEST
|
||||
0x5400AFFE;DUMMY_HANDLER
|
||||
0x5400CAFE;DUMMY_INTERFACE
|
||||
0x54123456;LIBGPIOD_TEST
|
||||
|
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 110 translations.
|
||||
* Generated on: 2022-02-03 12:01:36
|
||||
* Contains 111 translations.
|
||||
* Generated on: 2022-02-21 17:31:37
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
|
||||
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
|
||||
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
|
||||
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
|
||||
const char *SUS_0_STRING = "SUS_0";
|
||||
const char *SUS_1_STRING = "SUS_1";
|
||||
const char *SUS_2_STRING = "SUS_2";
|
||||
const char *SUS_3_STRING = "SUS_3";
|
||||
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
|
||||
const char *SUS_9_STRING = "SUS_9";
|
||||
const char *SUS_10_STRING = "SUS_10";
|
||||
const char *SUS_11_STRING = "SUS_11";
|
||||
const char *SUS_12_STRING = "SUS_12";
|
||||
const char *SUS_13_STRING = "SUS_13";
|
||||
const char *RW1_STRING = "RW1";
|
||||
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
|
||||
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
|
||||
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
|
||||
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
|
||||
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
||||
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
|
||||
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
|
||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
||||
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
||||
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -132,31 +133,29 @@ const char* translateObject(object_id_t object) {
|
||||
case 0x44120010:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44120032:
|
||||
return SUS_1_STRING;
|
||||
return SUS_0_STRING;
|
||||
case 0x44120033:
|
||||
return SUS_2_STRING;
|
||||
return SUS_1_STRING;
|
||||
case 0x44120034:
|
||||
return SUS_3_STRING;
|
||||
return SUS_2_STRING;
|
||||
case 0x44120035:
|
||||
return SUS_4_STRING;
|
||||
return SUS_3_STRING;
|
||||
case 0x44120036:
|
||||
return SUS_5_STRING;
|
||||
return SUS_4_STRING;
|
||||
case 0x44120037:
|
||||
return SUS_6_STRING;
|
||||
return SUS_5_STRING;
|
||||
case 0x44120038:
|
||||
return SUS_7_STRING;
|
||||
return SUS_6_STRING;
|
||||
case 0x44120039:
|
||||
return SUS_8_STRING;
|
||||
return SUS_7_STRING;
|
||||
case 0x44120040:
|
||||
return SUS_9_STRING;
|
||||
return SUS_8_STRING;
|
||||
case 0x44120041:
|
||||
return SUS_10_STRING;
|
||||
return SUS_9_STRING;
|
||||
case 0x44120042:
|
||||
return SUS_11_STRING;
|
||||
return SUS_10_STRING;
|
||||
case 0x44120043:
|
||||
return SUS_12_STRING;
|
||||
case 0x44120044:
|
||||
return SUS_13_STRING;
|
||||
return SUS_11_STRING;
|
||||
case 0x44120047:
|
||||
return RW1_STRING;
|
||||
case 0x44120107:
|
||||
@ -195,6 +194,8 @@ const char* translateObject(object_id_t object) {
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44260000:
|
||||
return BPX_BATT_HANDLER_STRING;
|
||||
case 0x44300000:
|
||||
return PLPCDU_HANDLER_STRING;
|
||||
case 0x443200A5:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x44330000:
|
||||
@ -325,6 +326,8 @@ const char* translateObject(object_id_t object) {
|
||||
return SPI_TEST_STRING;
|
||||
case 0x54000020:
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
|
@ -296,35 +296,29 @@ void SpiTestClass::performOneShotMax1227Test() {
|
||||
adcCfg.testRadSensorExtConvWithDelay = false;
|
||||
adcCfg.testRadSensorIntConv = false;
|
||||
|
||||
adcCfg.testSus[0].doTest = true;
|
||||
adcCfg.testSus[0].intConv = true;
|
||||
adcCfg.testSus[6].doTest = true;
|
||||
adcCfg.testSus[6].intConv = true;
|
||||
bool setAllSusOn = false;
|
||||
bool susIntConv = false;
|
||||
bool susExtConv = false;
|
||||
if (setAllSusOn) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].doTest = true;
|
||||
}
|
||||
} else {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].doTest = false;
|
||||
}
|
||||
}
|
||||
|
||||
adcCfg.testSus[1].doTest = true;
|
||||
adcCfg.testSus[1].intConv = true;
|
||||
adcCfg.testSus[7].doTest = true;
|
||||
adcCfg.testSus[7].intConv = true;
|
||||
|
||||
adcCfg.testSus[10].doTest = true;
|
||||
adcCfg.testSus[10].intConv = true;
|
||||
adcCfg.testSus[4].doTest = true;
|
||||
adcCfg.testSus[4].intConv = true;
|
||||
|
||||
adcCfg.testSus[11].doTest = true;
|
||||
adcCfg.testSus[11].intConv = true;
|
||||
adcCfg.testSus[5].doTest = true;
|
||||
adcCfg.testSus[5].intConv = true;
|
||||
|
||||
adcCfg.testSus[2].doTest = true;
|
||||
adcCfg.testSus[2].intConv = true;
|
||||
adcCfg.testSus[3].doTest = true;
|
||||
adcCfg.testSus[3].intConv = true;
|
||||
|
||||
adcCfg.testSus[8].doTest = true;
|
||||
adcCfg.testSus[8].intConv = true;
|
||||
adcCfg.testSus[9].doTest = true;
|
||||
adcCfg.testSus[9].intConv = true;
|
||||
if (susIntConv) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].intConv = true;
|
||||
}
|
||||
}
|
||||
if (susExtConv) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcCfg.testSus[idx].extConv = true;
|
||||
}
|
||||
}
|
||||
|
||||
adcCfg.plPcduAdcExtConv = false;
|
||||
adcCfg.plPcduAdcIntConv = true;
|
||||
@ -334,7 +328,7 @@ void SpiTestClass::performOneShotMax1227Test() {
|
||||
void SpiTestClass::performPeriodicMax1227Test() {
|
||||
using namespace max1227;
|
||||
adcCfg.testRadSensorExtConvWithDelay = false;
|
||||
adcCfg.testRadSensorIntConv = false;
|
||||
adcCfg.testRadSensorIntConv = true;
|
||||
|
||||
adcCfg.plPcduAdcExtConv = false;
|
||||
adcCfg.plPcduAdcIntConv = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
|
||||
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
#include "fsfw/FSFW.h"
|
||||
#include "fsfw/controller/ExtendedControllerBase.h"
|
||||
#include "fsfw/devicehandlers/DeviceHandlerBase.h"
|
||||
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
#include <gps.h>
|
||||
|
@ -226,7 +226,7 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData
|
||||
void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; }
|
||||
|
||||
void SusHandler::printDataset() {
|
||||
if(periodicPrintout) {
|
||||
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);
|
||||
|
@ -85,6 +85,8 @@ debugging. */
|
||||
#define OBSW_DEBUG_RTD 0
|
||||
#define OBSW_TEST_RAD_SENSOR 0
|
||||
#define OBSW_DEBUG_RAD_SENSOR 0
|
||||
#define OBSW_TEST_PL_PCDU 0
|
||||
#define OBSW_DEBUG_PL_PCDU 0
|
||||
#define OBSW_TEST_LIBGPIOD 0
|
||||
#define OBSW_TEST_PLOC_HANDLER 0
|
||||
#define OBSW_TEST_BPX_BATT 0
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* @brief Auto-generated object translation file.
|
||||
* @details
|
||||
* Contains 110 translations.
|
||||
* Generated on: 2022-02-03 12:01:36
|
||||
* Contains 111 translations.
|
||||
* Generated on: 2022-02-21 17:31:37
|
||||
*/
|
||||
#include "translateObjects.h"
|
||||
|
||||
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
|
||||
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
|
||||
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
|
||||
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_HANDLER";
|
||||
const char *SUS_0_STRING = "SUS_0";
|
||||
const char *SUS_1_STRING = "SUS_1";
|
||||
const char *SUS_2_STRING = "SUS_2";
|
||||
const char *SUS_3_STRING = "SUS_3";
|
||||
@ -23,8 +24,6 @@ const char *SUS_8_STRING = "SUS_8";
|
||||
const char *SUS_9_STRING = "SUS_9";
|
||||
const char *SUS_10_STRING = "SUS_10";
|
||||
const char *SUS_11_STRING = "SUS_11";
|
||||
const char *SUS_12_STRING = "SUS_12";
|
||||
const char *SUS_13_STRING = "SUS_13";
|
||||
const char *RW1_STRING = "RW1";
|
||||
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
|
||||
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_HANDLER";
|
||||
@ -44,6 +43,7 @@ const char *PDU1_HANDLER_STRING = "PDU1_HANDLER";
|
||||
const char *PDU2_HANDLER_STRING = "PDU2_HANDLER";
|
||||
const char *ACU_HANDLER_STRING = "ACU_HANDLER";
|
||||
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_HANDLER";
|
||||
const char *PLPCDU_HANDLER_STRING = "PLPCDU_HANDLER";
|
||||
const char *RAD_SENSOR_STRING = "RAD_SENSOR";
|
||||
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
|
||||
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER";
|
||||
@ -109,6 +109,7 @@ const char *TIME_STAMPER_STRING = "TIME_STAMPER";
|
||||
const char *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
|
||||
const char *SPI_TEST_STRING = "SPI_TEST";
|
||||
const char *UART_TEST_STRING = "UART_TEST";
|
||||
const char *I2C_TEST_STRING = "I2C_TEST";
|
||||
const char *DUMMY_HANDLER_STRING = "DUMMY_HANDLER";
|
||||
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
|
||||
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
|
||||
@ -117,230 +118,232 @@ const char *TM_FUNNEL_STRING = "TM_FUNNEL";
|
||||
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
|
||||
const char *NO_OBJECT_STRING = "NO_OBJECT";
|
||||
|
||||
const char *translateObject(object_id_t object) {
|
||||
switch ((object & 0xFFFFFFFF)) {
|
||||
case 0x00005060:
|
||||
return P60DOCK_TEST_TASK_STRING;
|
||||
case 0x43000003:
|
||||
return CORE_CONTROLLER_STRING;
|
||||
case 0x43100002:
|
||||
return ACS_CONTROLLER_STRING;
|
||||
case 0x43400001:
|
||||
return THERMAL_CONTROLLER_STRING;
|
||||
case 0x44120006:
|
||||
return MGM_0_LIS3_HANDLER_STRING;
|
||||
case 0x44120010:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44120032:
|
||||
return SUS_1_STRING;
|
||||
case 0x44120033:
|
||||
return SUS_2_STRING;
|
||||
case 0x44120034:
|
||||
return SUS_3_STRING;
|
||||
case 0x44120035:
|
||||
return SUS_4_STRING;
|
||||
case 0x44120036:
|
||||
return SUS_5_STRING;
|
||||
case 0x44120037:
|
||||
return SUS_6_STRING;
|
||||
case 0x44120038:
|
||||
return SUS_7_STRING;
|
||||
case 0x44120039:
|
||||
return SUS_8_STRING;
|
||||
case 0x44120040:
|
||||
return SUS_9_STRING;
|
||||
case 0x44120041:
|
||||
return SUS_10_STRING;
|
||||
case 0x44120042:
|
||||
return SUS_11_STRING;
|
||||
case 0x44120043:
|
||||
return SUS_12_STRING;
|
||||
case 0x44120044:
|
||||
return SUS_13_STRING;
|
||||
case 0x44120047:
|
||||
return RW1_STRING;
|
||||
case 0x44120107:
|
||||
return MGM_1_RM3100_HANDLER_STRING;
|
||||
case 0x44120111:
|
||||
return GYRO_1_L3G_HANDLER_STRING;
|
||||
case 0x44120148:
|
||||
return RW2_STRING;
|
||||
case 0x44120208:
|
||||
return MGM_2_LIS3_HANDLER_STRING;
|
||||
case 0x44120212:
|
||||
return GYRO_2_ADIS_HANDLER_STRING;
|
||||
case 0x44120249:
|
||||
return RW3_STRING;
|
||||
case 0x44120309:
|
||||
return MGM_3_RM3100_HANDLER_STRING;
|
||||
case 0x44120313:
|
||||
return GYRO_3_L3G_HANDLER_STRING;
|
||||
case 0x44120350:
|
||||
return RW4_STRING;
|
||||
case 0x44130001:
|
||||
return STAR_TRACKER_STRING;
|
||||
case 0x44130045:
|
||||
return GPS_CONTROLLER_STRING;
|
||||
case 0x44140014:
|
||||
return IMTQ_HANDLER_STRING;
|
||||
case 0x442000A1:
|
||||
return PCDU_HANDLER_STRING;
|
||||
case 0x44250000:
|
||||
return P60DOCK_HANDLER_STRING;
|
||||
case 0x44250001:
|
||||
return PDU1_HANDLER_STRING;
|
||||
case 0x44250002:
|
||||
return PDU2_HANDLER_STRING;
|
||||
case 0x44250003:
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44260000:
|
||||
return BPX_BATT_HANDLER_STRING;
|
||||
case 0x443200A5:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x44330000:
|
||||
return PLOC_UPDATER_STRING;
|
||||
case 0x44330001:
|
||||
return PLOC_MEMORY_DUMPER_STRING;
|
||||
case 0x44330002:
|
||||
return STR_HELPER_STRING;
|
||||
case 0x44330015:
|
||||
return PLOC_MPSOC_HANDLER_STRING;
|
||||
case 0x44330016:
|
||||
return PLOC_SUPERVISOR_HANDLER_STRING;
|
||||
case 0x444100A2:
|
||||
return SOLAR_ARRAY_DEPL_HANDLER_STRING;
|
||||
case 0x444100A4:
|
||||
return HEATER_HANDLER_STRING;
|
||||
case 0x44420004:
|
||||
return TMP1075_HANDLER_1_STRING;
|
||||
case 0x44420005:
|
||||
return TMP1075_HANDLER_2_STRING;
|
||||
case 0x44420016:
|
||||
return RTD_IC_3_STRING;
|
||||
case 0x44420017:
|
||||
return RTD_IC_4_STRING;
|
||||
case 0x44420018:
|
||||
return RTD_IC_5_STRING;
|
||||
case 0x44420019:
|
||||
return RTD_IC_6_STRING;
|
||||
case 0x44420020:
|
||||
return RTD_IC_7_STRING;
|
||||
case 0x44420021:
|
||||
return RTD_IC_8_STRING;
|
||||
case 0x44420022:
|
||||
return RTD_IC_9_STRING;
|
||||
case 0x44420023:
|
||||
return RTD_IC_10_STRING;
|
||||
case 0x44420024:
|
||||
return RTD_IC_11_STRING;
|
||||
case 0x44420025:
|
||||
return RTD_IC_12_STRING;
|
||||
case 0x44420026:
|
||||
return RTD_IC_13_STRING;
|
||||
case 0x44420027:
|
||||
return RTD_IC_14_STRING;
|
||||
case 0x44420028:
|
||||
return RTD_IC_15_STRING;
|
||||
case 0x44420029:
|
||||
return RTD_IC_16_STRING;
|
||||
case 0x44420030:
|
||||
return RTD_IC_17_STRING;
|
||||
case 0x44420031:
|
||||
return RTD_IC_18_STRING;
|
||||
case 0x445300A3:
|
||||
return SYRLINKS_HK_HANDLER_STRING;
|
||||
case 0x49000000:
|
||||
return ARDUINO_COM_IF_STRING;
|
||||
case 0x49010005:
|
||||
return GPIO_IF_STRING;
|
||||
case 0x49020004:
|
||||
return SPI_COM_IF_STRING;
|
||||
case 0x49030003:
|
||||
return UART_COM_IF_STRING;
|
||||
case 0x49040002:
|
||||
return I2C_COM_IF_STRING;
|
||||
case 0x49050001:
|
||||
return CSP_COM_IF_STRING;
|
||||
case 0x50000100:
|
||||
return CCSDS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000200:
|
||||
return PUS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000300:
|
||||
return TMTC_BRIDGE_STRING;
|
||||
case 0x50000400:
|
||||
return TMTC_POLLING_TASK_STRING;
|
||||
case 0x50000500:
|
||||
return FILE_SYSTEM_HANDLER_STRING;
|
||||
case 0x50000600:
|
||||
return PTME_STRING;
|
||||
case 0x50000700:
|
||||
return PDEC_HANDLER_STRING;
|
||||
case 0x50000800:
|
||||
return CCSDS_HANDLER_STRING;
|
||||
case 0x51000500:
|
||||
return PUS_SERVICE_6_STRING;
|
||||
case 0x53000000:
|
||||
return FSFW_OBJECTS_START_STRING;
|
||||
case 0x53000001:
|
||||
return PUS_SERVICE_1_VERIFICATION_STRING;
|
||||
case 0x53000002:
|
||||
return PUS_SERVICE_2_DEVICE_ACCESS_STRING;
|
||||
case 0x53000003:
|
||||
return PUS_SERVICE_3_HOUSEKEEPING_STRING;
|
||||
case 0x53000005:
|
||||
return PUS_SERVICE_5_EVENT_REPORTING_STRING;
|
||||
case 0x53000008:
|
||||
return PUS_SERVICE_8_FUNCTION_MGMT_STRING;
|
||||
case 0x53000009:
|
||||
return PUS_SERVICE_9_TIME_MGMT_STRING;
|
||||
case 0x53000017:
|
||||
return PUS_SERVICE_17_TEST_STRING;
|
||||
case 0x53000020:
|
||||
return PUS_SERVICE_20_PARAMETERS_STRING;
|
||||
case 0x53000200:
|
||||
return PUS_SERVICE_200_MODE_MGMT_STRING;
|
||||
case 0x53000201:
|
||||
return PUS_SERVICE_201_HEALTH_STRING;
|
||||
case 0x53001000:
|
||||
return CFDP_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x53010000:
|
||||
return HEALTH_TABLE_STRING;
|
||||
case 0x53010100:
|
||||
return MODE_STORE_STRING;
|
||||
case 0x53030000:
|
||||
return EVENT_MANAGER_STRING;
|
||||
case 0x53040000:
|
||||
return INTERNAL_ERROR_REPORTER_STRING;
|
||||
case 0x534f0100:
|
||||
return TC_STORE_STRING;
|
||||
case 0x534f0200:
|
||||
return TM_STORE_STRING;
|
||||
case 0x534f0300:
|
||||
return IPC_STORE_STRING;
|
||||
case 0x53500010:
|
||||
return TIME_STAMPER_STRING;
|
||||
case 0x53ffffff:
|
||||
return FSFW_OBJECTS_END_STRING;
|
||||
case 0x54000010:
|
||||
return SPI_TEST_STRING;
|
||||
case 0x54000020:
|
||||
return UART_TEST_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
return DUMMY_INTERFACE_STRING;
|
||||
case 0x54123456:
|
||||
return LIBGPIOD_TEST_STRING;
|
||||
case 0x54694269:
|
||||
return TEST_TASK_STRING;
|
||||
case 0x73000100:
|
||||
return TM_FUNNEL_STRING;
|
||||
case 0x73500000:
|
||||
return CCSDS_IP_CORE_BRIDGE_STRING;
|
||||
case 0xFFFFFFFF:
|
||||
return NO_OBJECT_STRING;
|
||||
default:
|
||||
return "UNKNOWN_OBJECT";
|
||||
}
|
||||
return 0;
|
||||
const char* translateObject(object_id_t object) {
|
||||
switch( (object & 0xFFFFFFFF) ) {
|
||||
case 0x00005060:
|
||||
return P60DOCK_TEST_TASK_STRING;
|
||||
case 0x43000003:
|
||||
return CORE_CONTROLLER_STRING;
|
||||
case 0x43100002:
|
||||
return ACS_CONTROLLER_STRING;
|
||||
case 0x43400001:
|
||||
return THERMAL_CONTROLLER_STRING;
|
||||
case 0x44120006:
|
||||
return MGM_0_LIS3_HANDLER_STRING;
|
||||
case 0x44120010:
|
||||
return GYRO_0_ADIS_HANDLER_STRING;
|
||||
case 0x44120032:
|
||||
return SUS_0_STRING;
|
||||
case 0x44120033:
|
||||
return SUS_1_STRING;
|
||||
case 0x44120034:
|
||||
return SUS_2_STRING;
|
||||
case 0x44120035:
|
||||
return SUS_3_STRING;
|
||||
case 0x44120036:
|
||||
return SUS_4_STRING;
|
||||
case 0x44120037:
|
||||
return SUS_5_STRING;
|
||||
case 0x44120038:
|
||||
return SUS_6_STRING;
|
||||
case 0x44120039:
|
||||
return SUS_7_STRING;
|
||||
case 0x44120040:
|
||||
return SUS_8_STRING;
|
||||
case 0x44120041:
|
||||
return SUS_9_STRING;
|
||||
case 0x44120042:
|
||||
return SUS_10_STRING;
|
||||
case 0x44120043:
|
||||
return SUS_11_STRING;
|
||||
case 0x44120047:
|
||||
return RW1_STRING;
|
||||
case 0x44120107:
|
||||
return MGM_1_RM3100_HANDLER_STRING;
|
||||
case 0x44120111:
|
||||
return GYRO_1_L3G_HANDLER_STRING;
|
||||
case 0x44120148:
|
||||
return RW2_STRING;
|
||||
case 0x44120208:
|
||||
return MGM_2_LIS3_HANDLER_STRING;
|
||||
case 0x44120212:
|
||||
return GYRO_2_ADIS_HANDLER_STRING;
|
||||
case 0x44120249:
|
||||
return RW3_STRING;
|
||||
case 0x44120309:
|
||||
return MGM_3_RM3100_HANDLER_STRING;
|
||||
case 0x44120313:
|
||||
return GYRO_3_L3G_HANDLER_STRING;
|
||||
case 0x44120350:
|
||||
return RW4_STRING;
|
||||
case 0x44130001:
|
||||
return STAR_TRACKER_STRING;
|
||||
case 0x44130045:
|
||||
return GPS_CONTROLLER_STRING;
|
||||
case 0x44140014:
|
||||
return IMTQ_HANDLER_STRING;
|
||||
case 0x442000A1:
|
||||
return PCDU_HANDLER_STRING;
|
||||
case 0x44250000:
|
||||
return P60DOCK_HANDLER_STRING;
|
||||
case 0x44250001:
|
||||
return PDU1_HANDLER_STRING;
|
||||
case 0x44250002:
|
||||
return PDU2_HANDLER_STRING;
|
||||
case 0x44250003:
|
||||
return ACU_HANDLER_STRING;
|
||||
case 0x44260000:
|
||||
return BPX_BATT_HANDLER_STRING;
|
||||
case 0x44300000:
|
||||
return PLPCDU_HANDLER_STRING;
|
||||
case 0x443200A5:
|
||||
return RAD_SENSOR_STRING;
|
||||
case 0x44330000:
|
||||
return PLOC_UPDATER_STRING;
|
||||
case 0x44330001:
|
||||
return PLOC_MEMORY_DUMPER_STRING;
|
||||
case 0x44330002:
|
||||
return STR_HELPER_STRING;
|
||||
case 0x44330015:
|
||||
return PLOC_MPSOC_HANDLER_STRING;
|
||||
case 0x44330016:
|
||||
return PLOC_SUPERVISOR_HANDLER_STRING;
|
||||
case 0x444100A2:
|
||||
return SOLAR_ARRAY_DEPL_HANDLER_STRING;
|
||||
case 0x444100A4:
|
||||
return HEATER_HANDLER_STRING;
|
||||
case 0x44420004:
|
||||
return TMP1075_HANDLER_1_STRING;
|
||||
case 0x44420005:
|
||||
return TMP1075_HANDLER_2_STRING;
|
||||
case 0x44420016:
|
||||
return RTD_IC_3_STRING;
|
||||
case 0x44420017:
|
||||
return RTD_IC_4_STRING;
|
||||
case 0x44420018:
|
||||
return RTD_IC_5_STRING;
|
||||
case 0x44420019:
|
||||
return RTD_IC_6_STRING;
|
||||
case 0x44420020:
|
||||
return RTD_IC_7_STRING;
|
||||
case 0x44420021:
|
||||
return RTD_IC_8_STRING;
|
||||
case 0x44420022:
|
||||
return RTD_IC_9_STRING;
|
||||
case 0x44420023:
|
||||
return RTD_IC_10_STRING;
|
||||
case 0x44420024:
|
||||
return RTD_IC_11_STRING;
|
||||
case 0x44420025:
|
||||
return RTD_IC_12_STRING;
|
||||
case 0x44420026:
|
||||
return RTD_IC_13_STRING;
|
||||
case 0x44420027:
|
||||
return RTD_IC_14_STRING;
|
||||
case 0x44420028:
|
||||
return RTD_IC_15_STRING;
|
||||
case 0x44420029:
|
||||
return RTD_IC_16_STRING;
|
||||
case 0x44420030:
|
||||
return RTD_IC_17_STRING;
|
||||
case 0x44420031:
|
||||
return RTD_IC_18_STRING;
|
||||
case 0x445300A3:
|
||||
return SYRLINKS_HK_HANDLER_STRING;
|
||||
case 0x49000000:
|
||||
return ARDUINO_COM_IF_STRING;
|
||||
case 0x49010005:
|
||||
return GPIO_IF_STRING;
|
||||
case 0x49020004:
|
||||
return SPI_COM_IF_STRING;
|
||||
case 0x49030003:
|
||||
return UART_COM_IF_STRING;
|
||||
case 0x49040002:
|
||||
return I2C_COM_IF_STRING;
|
||||
case 0x49050001:
|
||||
return CSP_COM_IF_STRING;
|
||||
case 0x50000100:
|
||||
return CCSDS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000200:
|
||||
return PUS_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x50000300:
|
||||
return TMTC_BRIDGE_STRING;
|
||||
case 0x50000400:
|
||||
return TMTC_POLLING_TASK_STRING;
|
||||
case 0x50000500:
|
||||
return FILE_SYSTEM_HANDLER_STRING;
|
||||
case 0x50000600:
|
||||
return PTME_STRING;
|
||||
case 0x50000700:
|
||||
return PDEC_HANDLER_STRING;
|
||||
case 0x50000800:
|
||||
return CCSDS_HANDLER_STRING;
|
||||
case 0x51000500:
|
||||
return PUS_SERVICE_6_STRING;
|
||||
case 0x53000000:
|
||||
return FSFW_OBJECTS_START_STRING;
|
||||
case 0x53000001:
|
||||
return PUS_SERVICE_1_VERIFICATION_STRING;
|
||||
case 0x53000002:
|
||||
return PUS_SERVICE_2_DEVICE_ACCESS_STRING;
|
||||
case 0x53000003:
|
||||
return PUS_SERVICE_3_HOUSEKEEPING_STRING;
|
||||
case 0x53000005:
|
||||
return PUS_SERVICE_5_EVENT_REPORTING_STRING;
|
||||
case 0x53000008:
|
||||
return PUS_SERVICE_8_FUNCTION_MGMT_STRING;
|
||||
case 0x53000009:
|
||||
return PUS_SERVICE_9_TIME_MGMT_STRING;
|
||||
case 0x53000017:
|
||||
return PUS_SERVICE_17_TEST_STRING;
|
||||
case 0x53000020:
|
||||
return PUS_SERVICE_20_PARAMETERS_STRING;
|
||||
case 0x53000200:
|
||||
return PUS_SERVICE_200_MODE_MGMT_STRING;
|
||||
case 0x53000201:
|
||||
return PUS_SERVICE_201_HEALTH_STRING;
|
||||
case 0x53001000:
|
||||
return CFDP_PACKET_DISTRIBUTOR_STRING;
|
||||
case 0x53010000:
|
||||
return HEALTH_TABLE_STRING;
|
||||
case 0x53010100:
|
||||
return MODE_STORE_STRING;
|
||||
case 0x53030000:
|
||||
return EVENT_MANAGER_STRING;
|
||||
case 0x53040000:
|
||||
return INTERNAL_ERROR_REPORTER_STRING;
|
||||
case 0x534f0100:
|
||||
return TC_STORE_STRING;
|
||||
case 0x534f0200:
|
||||
return TM_STORE_STRING;
|
||||
case 0x534f0300:
|
||||
return IPC_STORE_STRING;
|
||||
case 0x53500010:
|
||||
return TIME_STAMPER_STRING;
|
||||
case 0x53ffffff:
|
||||
return FSFW_OBJECTS_END_STRING;
|
||||
case 0x54000010:
|
||||
return SPI_TEST_STRING;
|
||||
case 0x54000020:
|
||||
return UART_TEST_STRING;
|
||||
case 0x54000030:
|
||||
return I2C_TEST_STRING;
|
||||
case 0x5400AFFE:
|
||||
return DUMMY_HANDLER_STRING;
|
||||
case 0x5400CAFE:
|
||||
return DUMMY_INTERFACE_STRING;
|
||||
case 0x54123456:
|
||||
return LIBGPIOD_TEST_STRING;
|
||||
case 0x54694269:
|
||||
return TEST_TASK_STRING;
|
||||
case 0x73000100:
|
||||
return TM_FUNNEL_STRING;
|
||||
case 0x73500000:
|
||||
return CCSDS_IP_CORE_BRIDGE_STRING;
|
||||
case 0xFFFFFFFF:
|
||||
return NO_OBJECT_STRING;
|
||||
default:
|
||||
return "UNKNOWN_OBJECT";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -360,8 +360,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
|
||||
#endif
|
||||
|
||||
#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1
|
||||
bool enableAside = true;
|
||||
bool enableBside = false;
|
||||
bool enableAside = false;
|
||||
bool enableBside = true;
|
||||
if (enableAside) {
|
||||
// A side
|
||||
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
|
||||
|
@ -1,10 +1,15 @@
|
||||
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
|
||||
#include "PayloadPcduHandler.h"
|
||||
|
||||
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
#include "devices/gpioIds.h"
|
||||
|
||||
PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie,
|
||||
GpioIF* gpioIF)
|
||||
: DeviceHandlerBase(objectId, comIF, cookie), adcSet(this), gpioIF(gpioIF) {}
|
||||
GpioIF* gpioIF, bool periodicPrintout)
|
||||
: DeviceHandlerBase(objectId, comIF, cookie),
|
||||
adcSet(this),
|
||||
periodicPrintout(periodicPrintout),
|
||||
gpioIF(gpioIF) {}
|
||||
|
||||
void PayloadPcduHandler::doStartUp() {
|
||||
if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
|
||||
@ -23,7 +28,7 @@ void PayloadPcduHandler::doStartUp() {
|
||||
if (transitionOk) {
|
||||
transitionOk = false;
|
||||
// We are now in ON mode
|
||||
setMode(MODE_ON);
|
||||
startTransition(MODE_NORMAL, 0);
|
||||
adcState = AdcStates::BOOT_DELAY;
|
||||
// The ADC can now be read. If the values are not close to zero, we should not allow
|
||||
// transition
|
||||
@ -34,18 +39,183 @@ void PayloadPcduHandler::doStartUp() {
|
||||
|
||||
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
if (mode == _MODE_TO_NORMAL) {
|
||||
if(adcState == AdcStates::BOOT_DELAY) {
|
||||
if (adcCountdown.hasTimedOut()) {
|
||||
adcState = AdcStates::SEND_SETUP;
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
stateMachineToNormal();
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::doShutDown() {}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||
switch (adcState) {
|
||||
case (AdcStates::SEND_SETUP): {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
buildCommandFromCommand(*id, nullptr, 0);
|
||||
break;
|
||||
}
|
||||
if(adcState == AdcStates::SEND_SETUP) {
|
||||
if(adcCmdExecuted) {
|
||||
adcState = AdcStates::NORMAL;
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
case (AdcStates::NORMAL): {
|
||||
*id = plpcdu::READ_WITH_TEMP;
|
||||
buildCommandFromCommand(*id, nullptr, 0);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
*id = plpcdu::SETUP_CMD;
|
||||
buildCommandFromCommand(*id, nullptr, 0);
|
||||
}
|
||||
return NOTHING_TO_SEND;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(plpcdu::READ_CMD, 2, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_TEMP, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::READ_WITH_TEMP, 1, &adcSet);
|
||||
insertInCommandAndReplyMap(plpcdu::SETUP_CMD, 1);
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
switch (deviceCommand) {
|
||||
case (plpcdu::SETUP_CMD): {
|
||||
cmdBuf[0] = plpcdu::SETUP_BYTE;
|
||||
rawPacket = cmdBuf.data();
|
||||
rawPacketLen = 1;
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_CMD): {
|
||||
max1227::prepareExternallyClockedRead0ToN(cmdBuf.data(), plpcdu::CHANNEL_N, rawPacketLen);
|
||||
rawPacket = cmdBuf.data();
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_TEMP): {
|
||||
max1227::prepareExternallyClockedTemperatureRead(cmdBuf.data(), rawPacketLen);
|
||||
rawPacket = cmdBuf.data();
|
||||
break;
|
||||
}
|
||||
case (plpcdu::READ_WITH_TEMP): {
|
||||
size_t sz = 0;
|
||||
max1227::prepareExternallyClockedRead0ToN(cmdBuf.data(), plpcdu::CHANNEL_N, sz);
|
||||
max1227::prepareExternallyClockedTemperatureRead(cmdBuf.data() + sz, sz);
|
||||
rawPacketLen = sz;
|
||||
rawPacket = cmdBuf.data();
|
||||
}
|
||||
}
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||
// SPI is full duplex
|
||||
*foundId = getPendingCommand();
|
||||
*foundLen = remainingSize;
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t* packet) {
|
||||
using namespace plpcdu;
|
||||
switch (id) {
|
||||
case (SETUP_CMD): {
|
||||
break;
|
||||
}
|
||||
case (READ_TEMP): {
|
||||
uint8_t tempStartIdx = TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 2]);
|
||||
break;
|
||||
}
|
||||
case (READ_CMD): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
case (READ_WITH_TEMP): {
|
||||
PoolReadGuard pg(&adcSet);
|
||||
if (pg.getReadResult() != HasReturnvaluesIF::RETURN_OK) {
|
||||
return pg.getReadResult();
|
||||
}
|
||||
handleExtConvRead(packet);
|
||||
uint8_t tempStartIdx = ADC_REPLY_SIZE + TEMP_REPLY_SIZE - 2;
|
||||
adcSet.tempC.value =
|
||||
max1227::getTemperature(packet[tempStartIdx] << 8 | packet[tempStartIdx + 2]);
|
||||
handlePrintout();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
uint32_t PayloadPcduHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||
// 20 minutes transition delay is allowed
|
||||
return 20 * 60 * 60;
|
||||
}
|
||||
|
||||
ReturnValue_t PayloadPcduHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) {
|
||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::CHANNEL_VEC, &channelValues);
|
||||
localDataPoolMap.emplace(plpcdu::PlPcduPoolIds::TEMP, &tempC);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::setToGoToNormalModeImmediately(bool enable) {
|
||||
this->goToNormalMode = enable;
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::handleExtConvRead(const uint8_t* bufStart) {
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
adcSet.channels[idx] = bufStart[idx * 2 + 1] << 8 | bufStart[idx * 2 + 2];
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::handlePrintout() {
|
||||
if (periodicPrintout) {
|
||||
if (opDivider.checkAndIncrement()) {
|
||||
sif::info << "PL PCDU ADC hex [" << std::hex << std::setw(4);
|
||||
for (uint8_t idx = 0; idx < 12; idx++) {
|
||||
sif::info << std::setfill('0') << adcSet.channels[idx];
|
||||
if (idx < 11) {
|
||||
sif::info << ",";
|
||||
}
|
||||
}
|
||||
sif::info << "] | T[C] " << std::dec << adcSet.tempC.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
|
||||
this->periodicPrintout = enable;
|
||||
opDivider.setDivider(divider);
|
||||
}
|
||||
|
||||
void PayloadPcduHandler::stateMachineToNormal() {
|
||||
if (adcState == AdcStates::BOOT_DELAY) {
|
||||
if (adcCountdown.hasTimedOut()) {
|
||||
adcState = AdcStates::SEND_SETUP;
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
}
|
||||
if (adcState == AdcStates::SEND_SETUP) {
|
||||
if (adcCmdExecuted) {
|
||||
adcState = AdcStates::NORMAL;
|
||||
setMode(MODE_NORMAL, plpcdu::NORMAL_ADC_ONLY);
|
||||
adcCmdExecuted = false;
|
||||
}
|
||||
}
|
||||
if (submode == plpcdu::NORMAL_ALL_ON) {
|
||||
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
|
||||
if (not commandExecuted) {
|
||||
countdown.resetTimer();
|
||||
@ -126,7 +296,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
|
||||
// ADC values are ok, 5 seconds have elapsed
|
||||
if (transitionOk and countdown.hasTimedOut()) {
|
||||
state = States::PCDU_ON;
|
||||
setMode(MODE_NORMAL);
|
||||
setMode(MODE_NORMAL, plpcdu::NORMAL_ALL_ON);
|
||||
countdown.resetTimer();
|
||||
commandExecuted = false;
|
||||
transitionOk = false;
|
||||
|
@ -2,7 +2,9 @@
|
||||
#define LINUX_DEVICES_PLPCDUHANDLER_H_
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
|
||||
#include "devicedefinitions/payloadPcduDefinitions.h"
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
|
||||
@ -20,9 +22,13 @@
|
||||
* - MPA - Medium Power Amplifier
|
||||
* - HPA - High Power Amplifier
|
||||
*/
|
||||
class PayloadPcduHandler : DeviceHandlerBase {
|
||||
class PayloadPcduHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF);
|
||||
PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, GpioIF* gpioIF,
|
||||
bool periodicPrintout);
|
||||
|
||||
void setToGoToNormalModeImmediately(bool enable);
|
||||
void enablePeriodicPrintout(bool enable, uint8_t divider);
|
||||
|
||||
private:
|
||||
enum class States {
|
||||
@ -50,6 +56,7 @@ class PayloadPcduHandler : DeviceHandlerBase {
|
||||
|
||||
enum class AdcStates { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcStates::OFF;
|
||||
|
||||
bool goToNormalMode = false;
|
||||
plpcdu::PlPcduAdcSet adcSet;
|
||||
std::array<uint8_t, plpcdu::MAX_ADC_REPLY_SIZE> cmdBuf = {};
|
||||
// This variable is tied to DRO +6 V voltage. Voltages, currents are monitored and the experiment
|
||||
@ -57,6 +64,8 @@ class PayloadPcduHandler : DeviceHandlerBase {
|
||||
bool transitionOk = false;
|
||||
bool commandExecuted = false;
|
||||
bool adcCmdExecuted = false;
|
||||
bool periodicPrintout = false;
|
||||
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
|
||||
uint8_t tempReadDivisor = 1;
|
||||
Countdown countdown = Countdown(5000);
|
||||
Countdown adcCountdown = Countdown(50);
|
||||
@ -79,6 +88,10 @@ class PayloadPcduHandler : DeviceHandlerBase {
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
void handleExtConvRead(const uint8_t* bufStart);
|
||||
void handlePrintout();
|
||||
void stateMachineToNormal();
|
||||
};
|
||||
|
||||
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */
|
||||
|
@ -3,17 +3,16 @@
|
||||
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
|
||||
#include "mission/devices/max1227.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#include "mission/devices/max1227.h"
|
||||
|
||||
namespace plpcdu {
|
||||
|
||||
using namespace max1227;
|
||||
|
||||
enum PlPcduPoolIds: uint32_t {
|
||||
CHANNEL_VEC = 0,
|
||||
TEMP = 1
|
||||
};
|
||||
enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, TEMP = 1 };
|
||||
|
||||
static constexpr size_t MAX_ADC_REPLY_SIZE = 64;
|
||||
|
||||
@ -22,13 +21,16 @@ static constexpr DeviceCommandId_t SETUP_CMD = 1;
|
||||
static constexpr DeviceCommandId_t READ_TEMP = 2;
|
||||
static constexpr DeviceCommandId_t READ_WITH_TEMP = 3;
|
||||
|
||||
static constexpr Submode_t NORMAL_ADC_ONLY = 0;
|
||||
static constexpr Submode_t NORMAL_ALL_ON = 1;
|
||||
|
||||
// 12 ADC values * 2 + trailing zero
|
||||
static constexpr size_t ADC_REPLY_SIZE = 25;
|
||||
// Conversion byte + 24 * zero
|
||||
static constexpr size_t TEMP_REPLY_SIZE = 25;
|
||||
|
||||
static constexpr uint8_t SETUP_BYTE = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED,
|
||||
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||
static constexpr uint8_t SETUP_BYTE =
|
||||
max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0);
|
||||
|
||||
static constexpr uint32_t ADC_SET_ID = READ_CMD;
|
||||
static constexpr uint8_t CHANNELS_NUM = 12;
|
||||
@ -40,13 +42,12 @@ class PlPcduAdcSet : public StaticLocalDataSet<DATASET_ENTRIES> {
|
||||
public:
|
||||
PlPcduAdcSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_SET_ID) {}
|
||||
|
||||
PlPcduAdcSet(object_id_t objectId)
|
||||
: StaticLocalDataSet(sid_t(objectId, ADC_SET_ID)) {}
|
||||
PlPcduAdcSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_SET_ID)) {}
|
||||
|
||||
lp_vec_t<uint16_t, 12> channels = lp_vec_t<uint16_t, 12>(sid.objectId, CHANNEL_VEC, this);
|
||||
lp_var_t<float> tempC = lp_var_t<float>(sid.objectId, TEMP, this);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace plpcdu
|
||||
|
||||
#endif /* LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ */
|
||||
|
@ -40,9 +40,7 @@ enum DiffSel : uint8_t {
|
||||
BIPOLAR_CFG = 0b11
|
||||
};
|
||||
|
||||
constexpr uint8_t buildResetByte(bool fifoOnly) {
|
||||
return (1 << 4) | (fifoOnly << 3);
|
||||
}
|
||||
constexpr uint8_t buildResetByte(bool fifoOnly) { return (1 << 4) | (fifoOnly << 3); }
|
||||
|
||||
constexpr uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
|
||||
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;
|
||||
|
Loading…
Reference in New Issue
Block a user