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

This commit is contained in:
Robin Müller 2022-02-22 13:25:55 +01:00
commit ee2c194aeb
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
13 changed files with 520 additions and 328 deletions

View File

@ -44,11 +44,9 @@
#include "linux/csp/CspComIF.h" #include "linux/csp/CspComIF.h"
#include "linux/csp/CspCookie.h" #include "linux/csp/CspCookie.h"
#include "linux/devices/GPSHyperionLinuxController.h" #include "linux/devices/GPSHyperionLinuxController.h"
#include "linux/devices/PayloadPcduHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h" #include "linux/devices/SolarArrayDeploymentHandler.h"
#include "linux/devices/SusHandler.h" #include "linux/devices/SusHandler.h"
#include "linux/devices/devicedefinitions/SusDefinitions.h" #include "linux/devices/devicedefinitions/SusDefinitions.h"
#include "linux/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/core/GenericFactory.h" #include "mission/core/GenericFactory.h"
#include "mission/devices/ACUHandler.h" #include "mission/devices/ACUHandler.h"
#include "mission/devices/BpxBatteryHandler.h" #include "mission/devices/BpxBatteryHandler.h"
@ -60,6 +58,7 @@
#include "mission/devices/PCDUHandler.h" #include "mission/devices/PCDUHandler.h"
#include "mission/devices/PDU1Handler.h" #include "mission/devices/PDU1Handler.h"
#include "mission/devices/PDU2Handler.h" #include "mission/devices/PDU2Handler.h"
#include "mission/devices/PayloadPcduHandler.h"
#include "mission/devices/PlocMPSoCHandler.h" #include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h" #include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h" #include "mission/devices/RwHandler.h"
@ -71,6 +70,7 @@
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h" #include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
#include "mission/devices/devicedefinitions/RwDefinitions.h" #include "mission/devices/devicedefinitions/RwDefinitions.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h" #include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "mission/devices/devicedefinitions/payloadPcduDefinitions.h"
#include "mission/tmtc/CCSDSHandler.h" #include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h" #include "mission/tmtc/VirtualChannel.h"
#include "mission/utility/TmFunnel.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, q7s::SPI_DEFAULT_DEV, plpcdu::MAX_ADC_REPLY_SIZE,
spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
// Create device handler components // Create device handler components
auto plPcduHandler = auto plPcduHandler = new PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF,
PayloadPcduHandler(objects::PLPCDU_HANDLER, objects::SPI_COM_IF, spiCookie, gpioComIF); 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) { void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {

View File

@ -4,19 +4,18 @@
0x43400001;THERMAL_CONTROLLER 0x43400001;THERMAL_CONTROLLER
0x44120006;MGM_0_LIS3_HANDLER 0x44120006;MGM_0_LIS3_HANDLER
0x44120010;GYRO_0_ADIS_HANDLER 0x44120010;GYRO_0_ADIS_HANDLER
0x44120032;SUS_1 0x44120032;SUS_0
0x44120033;SUS_2 0x44120033;SUS_1
0x44120034;SUS_3 0x44120034;SUS_2
0x44120035;SUS_4 0x44120035;SUS_3
0x44120036;SUS_5 0x44120036;SUS_4
0x44120037;SUS_6 0x44120037;SUS_5
0x44120038;SUS_7 0x44120038;SUS_6
0x44120039;SUS_8 0x44120039;SUS_7
0x44120040;SUS_9 0x44120040;SUS_8
0x44120041;SUS_10 0x44120041;SUS_9
0x44120042;SUS_11 0x44120042;SUS_10
0x44120043;SUS_12 0x44120043;SUS_11
0x44120044;SUS_13
0x44120047;RW1 0x44120047;RW1
0x44120107;MGM_1_RM3100_HANDLER 0x44120107;MGM_1_RM3100_HANDLER
0x44120111;GYRO_1_L3G_HANDLER 0x44120111;GYRO_1_L3G_HANDLER
@ -36,6 +35,7 @@
0x44250002;PDU2_HANDLER 0x44250002;PDU2_HANDLER
0x44250003;ACU_HANDLER 0x44250003;ACU_HANDLER
0x44260000;BPX_BATT_HANDLER 0x44260000;BPX_BATT_HANDLER
0x44300000;PLPCDU_HANDLER
0x443200A5;RAD_SENSOR 0x443200A5;RAD_SENSOR
0x44330000;PLOC_UPDATER 0x44330000;PLOC_UPDATER
0x44330001;PLOC_MEMORY_DUMPER 0x44330001;PLOC_MEMORY_DUMPER
@ -101,6 +101,7 @@
0x53ffffff;FSFW_OBJECTS_END 0x53ffffff;FSFW_OBJECTS_END
0x54000010;SPI_TEST 0x54000010;SPI_TEST
0x54000020;UART_TEST 0x54000020;UART_TEST
0x54000030;I2C_TEST
0x5400AFFE;DUMMY_HANDLER 0x5400AFFE;DUMMY_HANDLER
0x5400CAFE;DUMMY_INTERFACE 0x5400CAFE;DUMMY_INTERFACE
0x54123456;LIBGPIOD_TEST 0x54123456;LIBGPIOD_TEST

1 0x00005060 P60DOCK_TEST_TASK
4 0x43400001 THERMAL_CONTROLLER
5 0x44120006 MGM_0_LIS3_HANDLER
6 0x44120010 GYRO_0_ADIS_HANDLER
7 0x44120032 SUS_1 SUS_0
8 0x44120033 SUS_2 SUS_1
9 0x44120034 SUS_3 SUS_2
10 0x44120035 SUS_4 SUS_3
11 0x44120036 SUS_5 SUS_4
12 0x44120037 SUS_6 SUS_5
13 0x44120038 SUS_7 SUS_6
14 0x44120039 SUS_8 SUS_7
15 0x44120040 SUS_9 SUS_8
16 0x44120041 SUS_10 SUS_9
17 0x44120042 SUS_11 SUS_10
18 0x44120043 SUS_12 SUS_11
0x44120044 SUS_13
19 0x44120047 RW1
20 0x44120107 MGM_1_RM3100_HANDLER
21 0x44120111 GYRO_1_L3G_HANDLER
35 0x44250002 PDU2_HANDLER
36 0x44250003 ACU_HANDLER
37 0x44260000 BPX_BATT_HANDLER
38 0x44300000 PLPCDU_HANDLER
39 0x443200A5 RAD_SENSOR
40 0x44330000 PLOC_UPDATER
41 0x44330001 PLOC_MEMORY_DUMPER
101 0x53ffffff FSFW_OBJECTS_END
102 0x54000010 SPI_TEST
103 0x54000020 UART_TEST
104 0x54000030 I2C_TEST
105 0x5400AFFE DUMMY_HANDLER
106 0x5400CAFE DUMMY_INTERFACE
107 0x54123456 LIBGPIOD_TEST

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 110 translations. * Contains 111 translations.
* Generated on: 2022-02-03 12:01:36 * Generated on: 2022-02-21 17:31:37
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_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_1_STRING = "SUS_1";
const char *SUS_2_STRING = "SUS_2"; const char *SUS_2_STRING = "SUS_2";
const char *SUS_3_STRING = "SUS_3"; 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_9_STRING = "SUS_9";
const char *SUS_10_STRING = "SUS_10"; const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11"; 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 *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER"; const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_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 *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER"; const char *ACU_HANDLER_STRING = "ACU_HANDLER";
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_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 *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER"; const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER"; 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 *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *SPI_TEST_STRING = "SPI_TEST"; const char *SPI_TEST_STRING = "SPI_TEST";
const char *UART_TEST_STRING = "UART_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_HANDLER_STRING = "DUMMY_HANDLER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST"; const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
@ -132,31 +133,29 @@ const char* translateObject(object_id_t object) {
case 0x44120010: case 0x44120010:
return GYRO_0_ADIS_HANDLER_STRING; return GYRO_0_ADIS_HANDLER_STRING;
case 0x44120032: case 0x44120032:
return SUS_1_STRING; return SUS_0_STRING;
case 0x44120033: case 0x44120033:
return SUS_2_STRING; return SUS_1_STRING;
case 0x44120034: case 0x44120034:
return SUS_3_STRING; return SUS_2_STRING;
case 0x44120035: case 0x44120035:
return SUS_4_STRING; return SUS_3_STRING;
case 0x44120036: case 0x44120036:
return SUS_5_STRING; return SUS_4_STRING;
case 0x44120037: case 0x44120037:
return SUS_6_STRING; return SUS_5_STRING;
case 0x44120038: case 0x44120038:
return SUS_7_STRING; return SUS_6_STRING;
case 0x44120039: case 0x44120039:
return SUS_8_STRING; return SUS_7_STRING;
case 0x44120040: case 0x44120040:
return SUS_9_STRING; return SUS_8_STRING;
case 0x44120041: case 0x44120041:
return SUS_10_STRING; return SUS_9_STRING;
case 0x44120042: case 0x44120042:
return SUS_11_STRING; return SUS_10_STRING;
case 0x44120043: case 0x44120043:
return SUS_12_STRING; return SUS_11_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047: case 0x44120047:
return RW1_STRING; return RW1_STRING;
case 0x44120107: case 0x44120107:
@ -195,6 +194,8 @@ const char* translateObject(object_id_t object) {
return ACU_HANDLER_STRING; return ACU_HANDLER_STRING;
case 0x44260000: case 0x44260000:
return BPX_BATT_HANDLER_STRING; return BPX_BATT_HANDLER_STRING;
case 0x44300000:
return PLPCDU_HANDLER_STRING;
case 0x443200A5: case 0x443200A5:
return RAD_SENSOR_STRING; return RAD_SENSOR_STRING;
case 0x44330000: case 0x44330000:
@ -325,6 +326,8 @@ const char* translateObject(object_id_t object) {
return SPI_TEST_STRING; return SPI_TEST_STRING;
case 0x54000020: case 0x54000020:
return UART_TEST_STRING; return UART_TEST_STRING;
case 0x54000030:
return I2C_TEST_STRING;
case 0x5400AFFE: case 0x5400AFFE:
return DUMMY_HANDLER_STRING; return DUMMY_HANDLER_STRING;
case 0x5400CAFE: case 0x5400CAFE:

View File

@ -296,35 +296,29 @@ void SpiTestClass::performOneShotMax1227Test() {
adcCfg.testRadSensorExtConvWithDelay = false; adcCfg.testRadSensorExtConvWithDelay = false;
adcCfg.testRadSensorIntConv = false; adcCfg.testRadSensorIntConv = false;
adcCfg.testSus[0].doTest = true; bool setAllSusOn = false;
adcCfg.testSus[0].intConv = true; bool susIntConv = false;
adcCfg.testSus[6].doTest = true; bool susExtConv = false;
adcCfg.testSus[6].intConv = true; 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; if (susIntConv) {
adcCfg.testSus[1].intConv = true; for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[7].doTest = true; adcCfg.testSus[idx].intConv = true;
adcCfg.testSus[7].intConv = true; }
}
adcCfg.testSus[10].doTest = true; if (susExtConv) {
adcCfg.testSus[10].intConv = true; for (uint8_t idx = 0; idx < 12; idx++) {
adcCfg.testSus[4].doTest = true; adcCfg.testSus[idx].extConv = 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;
adcCfg.plPcduAdcExtConv = false; adcCfg.plPcduAdcExtConv = false;
adcCfg.plPcduAdcIntConv = true; adcCfg.plPcduAdcIntConv = true;
@ -334,7 +328,7 @@ void SpiTestClass::performOneShotMax1227Test() {
void SpiTestClass::performPeriodicMax1227Test() { void SpiTestClass::performPeriodicMax1227Test() {
using namespace max1227; using namespace max1227;
adcCfg.testRadSensorExtConvWithDelay = false; adcCfg.testRadSensorExtConvWithDelay = false;
adcCfg.testRadSensorIntConv = false; adcCfg.testRadSensorIntConv = true;
adcCfg.plPcduAdcExtConv = false; adcCfg.plPcduAdcExtConv = false;
adcCfg.plPcduAdcIntConv = false; adcCfg.plPcduAdcIntConv = false;

View File

@ -1,10 +1,10 @@
#ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_ #ifndef MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#define MISSION_DEVICES_GPSHYPERIONHANDLER_H_ #define MISSION_DEVICES_GPSHYPERIONHANDLER_H_
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
#include "fsfw/FSFW.h" #include "fsfw/FSFW.h"
#include "fsfw/controller/ExtendedControllerBase.h" #include "fsfw/controller/ExtendedControllerBase.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#include "mission/devices/devicedefinitions/GPSDefinitions.h"
#ifdef FSFW_OSAL_LINUX #ifdef FSFW_OSAL_LINUX
#include <gps.h> #include <gps.h>

View File

@ -226,7 +226,7 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData
void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; } void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; }
void SusHandler::printDataset() { void SusHandler::printDataset() {
if(periodicPrintout) { if (periodicPrintout) {
if (divider.checkAndIncrement()) { if (divider.checkAndIncrement()) {
sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID " sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID "
<< std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3); << std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3);

View File

@ -85,6 +85,8 @@ debugging. */
#define OBSW_DEBUG_RTD 0 #define OBSW_DEBUG_RTD 0
#define OBSW_TEST_RAD_SENSOR 0 #define OBSW_TEST_RAD_SENSOR 0
#define OBSW_DEBUG_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_LIBGPIOD 0
#define OBSW_TEST_PLOC_HANDLER 0 #define OBSW_TEST_PLOC_HANDLER 0
#define OBSW_TEST_BPX_BATT 0 #define OBSW_TEST_BPX_BATT 0

View File

@ -1,8 +1,8 @@
/** /**
* @brief Auto-generated object translation file. * @brief Auto-generated object translation file.
* @details * @details
* Contains 110 translations. * Contains 111 translations.
* Generated on: 2022-02-03 12:01:36 * Generated on: 2022-02-21 17:31:37
*/ */
#include "translateObjects.h" #include "translateObjects.h"
@ -12,6 +12,7 @@ const char *ACS_CONTROLLER_STRING = "ACS_CONTROLLER";
const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER"; const char *THERMAL_CONTROLLER_STRING = "THERMAL_CONTROLLER";
const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER"; const char *MGM_0_LIS3_HANDLER_STRING = "MGM_0_LIS3_HANDLER";
const char *GYRO_0_ADIS_HANDLER_STRING = "GYRO_0_ADIS_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_1_STRING = "SUS_1";
const char *SUS_2_STRING = "SUS_2"; const char *SUS_2_STRING = "SUS_2";
const char *SUS_3_STRING = "SUS_3"; 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_9_STRING = "SUS_9";
const char *SUS_10_STRING = "SUS_10"; const char *SUS_10_STRING = "SUS_10";
const char *SUS_11_STRING = "SUS_11"; 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 *RW1_STRING = "RW1";
const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER"; const char *MGM_1_RM3100_HANDLER_STRING = "MGM_1_RM3100_HANDLER";
const char *GYRO_1_L3G_HANDLER_STRING = "GYRO_1_L3G_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 *PDU2_HANDLER_STRING = "PDU2_HANDLER";
const char *ACU_HANDLER_STRING = "ACU_HANDLER"; const char *ACU_HANDLER_STRING = "ACU_HANDLER";
const char *BPX_BATT_HANDLER_STRING = "BPX_BATT_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 *RAD_SENSOR_STRING = "RAD_SENSOR";
const char *PLOC_UPDATER_STRING = "PLOC_UPDATER"; const char *PLOC_UPDATER_STRING = "PLOC_UPDATER";
const char *PLOC_MEMORY_DUMPER_STRING = "PLOC_MEMORY_DUMPER"; 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 *FSFW_OBJECTS_END_STRING = "FSFW_OBJECTS_END";
const char *SPI_TEST_STRING = "SPI_TEST"; const char *SPI_TEST_STRING = "SPI_TEST";
const char *UART_TEST_STRING = "UART_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_HANDLER_STRING = "DUMMY_HANDLER";
const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE"; const char *DUMMY_INTERFACE_STRING = "DUMMY_INTERFACE";
const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST"; const char *LIBGPIOD_TEST_STRING = "LIBGPIOD_TEST";
@ -117,8 +118,8 @@ const char *TM_FUNNEL_STRING = "TM_FUNNEL";
const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE"; const char *CCSDS_IP_CORE_BRIDGE_STRING = "CCSDS_IP_CORE_BRIDGE";
const char *NO_OBJECT_STRING = "NO_OBJECT"; const char *NO_OBJECT_STRING = "NO_OBJECT";
const char *translateObject(object_id_t object) { const char* translateObject(object_id_t object) {
switch ((object & 0xFFFFFFFF)) { switch( (object & 0xFFFFFFFF) ) {
case 0x00005060: case 0x00005060:
return P60DOCK_TEST_TASK_STRING; return P60DOCK_TEST_TASK_STRING;
case 0x43000003: case 0x43000003:
@ -132,31 +133,29 @@ const char *translateObject(object_id_t object) {
case 0x44120010: case 0x44120010:
return GYRO_0_ADIS_HANDLER_STRING; return GYRO_0_ADIS_HANDLER_STRING;
case 0x44120032: case 0x44120032:
return SUS_1_STRING; return SUS_0_STRING;
case 0x44120033: case 0x44120033:
return SUS_2_STRING; return SUS_1_STRING;
case 0x44120034: case 0x44120034:
return SUS_3_STRING; return SUS_2_STRING;
case 0x44120035: case 0x44120035:
return SUS_4_STRING; return SUS_3_STRING;
case 0x44120036: case 0x44120036:
return SUS_5_STRING; return SUS_4_STRING;
case 0x44120037: case 0x44120037:
return SUS_6_STRING; return SUS_5_STRING;
case 0x44120038: case 0x44120038:
return SUS_7_STRING; return SUS_6_STRING;
case 0x44120039: case 0x44120039:
return SUS_8_STRING; return SUS_7_STRING;
case 0x44120040: case 0x44120040:
return SUS_9_STRING; return SUS_8_STRING;
case 0x44120041: case 0x44120041:
return SUS_10_STRING; return SUS_9_STRING;
case 0x44120042: case 0x44120042:
return SUS_11_STRING; return SUS_10_STRING;
case 0x44120043: case 0x44120043:
return SUS_12_STRING; return SUS_11_STRING;
case 0x44120044:
return SUS_13_STRING;
case 0x44120047: case 0x44120047:
return RW1_STRING; return RW1_STRING;
case 0x44120107: case 0x44120107:
@ -195,6 +194,8 @@ const char *translateObject(object_id_t object) {
return ACU_HANDLER_STRING; return ACU_HANDLER_STRING;
case 0x44260000: case 0x44260000:
return BPX_BATT_HANDLER_STRING; return BPX_BATT_HANDLER_STRING;
case 0x44300000:
return PLPCDU_HANDLER_STRING;
case 0x443200A5: case 0x443200A5:
return RAD_SENSOR_STRING; return RAD_SENSOR_STRING;
case 0x44330000: case 0x44330000:
@ -325,6 +326,8 @@ const char *translateObject(object_id_t object) {
return SPI_TEST_STRING; return SPI_TEST_STRING;
case 0x54000020: case 0x54000020:
return UART_TEST_STRING; return UART_TEST_STRING;
case 0x54000030:
return I2C_TEST_STRING;
case 0x5400AFFE: case 0x5400AFFE:
return DUMMY_HANDLER_STRING; return DUMMY_HANDLER_STRING;
case 0x5400CAFE: case 0x5400CAFE:

View File

@ -360,8 +360,8 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#endif #endif
#if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1 #if OBSW_ADD_ACS_BOARD == 1 && OBSW_ADD_ACS_HANDLERS == 1
bool enableAside = true; bool enableAside = false;
bool enableBside = false; bool enableBside = true;
if (enableAside) { if (enableAside) {
// A side // A side
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,

View File

@ -1,10 +1,15 @@
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
#include "PayloadPcduHandler.h" #include "PayloadPcduHandler.h"
#include <fsfw/src/fsfw/datapool/PoolReadGuard.h>
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie, PayloadPcduHandler::PayloadPcduHandler(object_id_t objectId, object_id_t comIF, CookieIF* cookie,
GpioIF* gpioIF) GpioIF* gpioIF, bool periodicPrintout)
: DeviceHandlerBase(objectId, comIF, cookie), adcSet(this), gpioIF(gpioIF) {} : DeviceHandlerBase(objectId, comIF, cookie),
adcSet(this),
periodicPrintout(periodicPrintout),
gpioIF(gpioIF) {}
void PayloadPcduHandler::doStartUp() { void PayloadPcduHandler::doStartUp() {
if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) { if ((state != States::PCDU_OFF) and (state != States::ON_TRANS_SSR)) {
@ -23,7 +28,7 @@ void PayloadPcduHandler::doStartUp() {
if (transitionOk) { if (transitionOk) {
transitionOk = false; transitionOk = false;
// We are now in ON mode // We are now in ON mode
setMode(MODE_ON); startTransition(MODE_NORMAL, 0);
adcState = AdcStates::BOOT_DELAY; adcState = AdcStates::BOOT_DELAY;
// The ADC can now be read. If the values are not close to zero, we should not allow // The ADC can now be read. If the values are not close to zero, we should not allow
// transition // transition
@ -34,18 +39,183 @@ void PayloadPcduHandler::doStartUp() {
void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
if (mode == _MODE_TO_NORMAL) { if (mode == _MODE_TO_NORMAL) {
if(adcState == AdcStates::BOOT_DELAY) { 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;
}
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()) { if (adcCountdown.hasTimedOut()) {
adcState = AdcStates::SEND_SETUP; adcState = AdcStates::SEND_SETUP;
adcCmdExecuted = false; adcCmdExecuted = false;
} }
} }
if(adcState == AdcStates::SEND_SETUP) { if (adcState == AdcStates::SEND_SETUP) {
if(adcCmdExecuted) { if (adcCmdExecuted) {
adcState = AdcStates::NORMAL; adcState = AdcStates::NORMAL;
setMode(MODE_NORMAL, plpcdu::NORMAL_ADC_ONLY);
adcCmdExecuted = false; adcCmdExecuted = false;
} }
} }
if (submode == plpcdu::NORMAL_ALL_ON) {
if (state == States::ON_TRANS_ADC_CLOSE_ZERO) { if (state == States::ON_TRANS_ADC_CLOSE_ZERO) {
if (not commandExecuted) { if (not commandExecuted) {
countdown.resetTimer(); countdown.resetTimer();
@ -126,7 +296,7 @@ void PayloadPcduHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) {
// ADC values are ok, 5 seconds have elapsed // ADC values are ok, 5 seconds have elapsed
if (transitionOk and countdown.hasTimedOut()) { if (transitionOk and countdown.hasTimedOut()) {
state = States::PCDU_ON; state = States::PCDU_ON;
setMode(MODE_NORMAL); setMode(MODE_NORMAL, plpcdu::NORMAL_ALL_ON);
countdown.resetTimer(); countdown.resetTimer();
commandExecuted = false; commandExecuted = false;
transitionOk = false; transitionOk = false;

View File

@ -2,7 +2,9 @@
#define LINUX_DEVICES_PLPCDUHANDLER_H_ #define LINUX_DEVICES_PLPCDUHANDLER_H_
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <fsfw/globalfunctions/PeriodicOperationDivider.h>
#include <fsfw/timemanager/Countdown.h> #include <fsfw/timemanager/Countdown.h>
#include "devicedefinitions/payloadPcduDefinitions.h" #include "devicedefinitions/payloadPcduDefinitions.h"
#include "fsfw_hal/common/gpio/GpioIF.h" #include "fsfw_hal/common/gpio/GpioIF.h"
@ -20,9 +22,13 @@
* - MPA - Medium Power Amplifier * - MPA - Medium Power Amplifier
* - HPA - High Power Amplifier * - HPA - High Power Amplifier
*/ */
class PayloadPcduHandler : DeviceHandlerBase { class PayloadPcduHandler : public DeviceHandlerBase {
public: 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: private:
enum class States { enum class States {
@ -50,6 +56,7 @@ class PayloadPcduHandler : DeviceHandlerBase {
enum class AdcStates { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcStates::OFF; enum class AdcStates { OFF, BOOT_DELAY, SEND_SETUP, NORMAL } adcState = AdcStates::OFF;
bool goToNormalMode = false;
plpcdu::PlPcduAdcSet adcSet; plpcdu::PlPcduAdcSet adcSet;
std::array<uint8_t, plpcdu::MAX_ADC_REPLY_SIZE> cmdBuf = {}; 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 // 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 transitionOk = false;
bool commandExecuted = false; bool commandExecuted = false;
bool adcCmdExecuted = false; bool adcCmdExecuted = false;
bool periodicPrintout = false;
PeriodicOperationDivider opDivider = PeriodicOperationDivider(5);
uint8_t tempReadDivisor = 1; uint8_t tempReadDivisor = 1;
Countdown countdown = Countdown(5000); Countdown countdown = Countdown(5000);
Countdown adcCountdown = Countdown(50); Countdown adcCountdown = Countdown(50);
@ -79,6 +88,10 @@ class PayloadPcduHandler : DeviceHandlerBase {
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
void handleExtConvRead(const uint8_t* bufStart);
void handlePrintout();
void stateMachineToNormal();
}; };
#endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */ #endif /* LINUX_DEVICES_PLPCDUHANDLER_H_ */

View File

@ -3,17 +3,16 @@
#include <fsfw/datapoollocal/StaticLocalDataSet.h> #include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h> #include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include "mission/devices/max1227.h"
#include <cstddef> #include <cstddef>
#include "mission/devices/max1227.h"
namespace plpcdu { namespace plpcdu {
using namespace max1227; using namespace max1227;
enum PlPcduPoolIds: uint32_t { enum PlPcduPoolIds : uint32_t { CHANNEL_VEC = 0, TEMP = 1 };
CHANNEL_VEC = 0,
TEMP = 1
};
static constexpr size_t MAX_ADC_REPLY_SIZE = 64; 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_TEMP = 2;
static constexpr DeviceCommandId_t READ_WITH_TEMP = 3; 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 // 12 ADC values * 2 + trailing zero
static constexpr size_t ADC_REPLY_SIZE = 25; static constexpr size_t ADC_REPLY_SIZE = 25;
// Conversion byte + 24 * zero // Conversion byte + 24 * zero
static constexpr size_t TEMP_REPLY_SIZE = 25; static constexpr size_t TEMP_REPLY_SIZE = 25;
static constexpr uint8_t SETUP_BYTE = max1227::buildSetupByte(ClkSel::EXT_CONV_EXT_TIMED, static constexpr uint8_t SETUP_BYTE =
RefSel::INT_REF_NO_WAKEUP, DiffSel::NONE_0); 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 uint32_t ADC_SET_ID = READ_CMD;
static constexpr uint8_t CHANNELS_NUM = 12; static constexpr uint8_t CHANNELS_NUM = 12;
@ -40,13 +42,12 @@ class PlPcduAdcSet : public StaticLocalDataSet<DATASET_ENTRIES> {
public: public:
PlPcduAdcSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_SET_ID) {} PlPcduAdcSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, ADC_SET_ID) {}
PlPcduAdcSet(object_id_t objectId) PlPcduAdcSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, ADC_SET_ID)) {}
: 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_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); lp_var_t<float> tempC = lp_var_t<float>(sid.objectId, TEMP, this);
}; };
} } // namespace plpcdu
#endif /* LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ */ #endif /* LINUX_DEVICES_DEVICEDEFINITIONS_PAYLOADPCDUDEFINITIONS_H_ */

View File

@ -40,9 +40,7 @@ enum DiffSel : uint8_t {
BIPOLAR_CFG = 0b11 BIPOLAR_CFG = 0b11
}; };
constexpr uint8_t buildResetByte(bool fifoOnly) { constexpr uint8_t buildResetByte(bool fifoOnly) { return (1 << 4) | (fifoOnly << 3); }
return (1 << 4) | (fifoOnly << 3);
}
constexpr uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) { constexpr uint8_t buildConvByte(ScanModes scanMode, uint8_t channel, bool readTemp) {
return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp; return (1 << 7) | (channel << 3) | (scanMode << 1) | readTemp;