sus delay implementation

This commit is contained in:
Jakob Meier 2021-05-12 13:06:56 +02:00
parent 50d9365702
commit 48af7ef0fb
10 changed files with 269 additions and 207 deletions

View File

@ -158,10 +158,10 @@ void initmission::initTasks() {
} }
#else #else
FixedTimeslotTaskIF * pollingSequenceTableTE0720 = factory->createFixedTimeslotTask( FixedTimeslotTaskIF * pollingSequenceTaskTE0720 = factory->createFixedTimeslotTask(
"PST_TASK_TE0720", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, "PST_TASK_TE0720", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE * 8, 5.0,
missedDeadlineFunc); missedDeadlineFunc);
result = pst::pollingSequenceTE0720(pollingSequenceTableTE0720); result = pst::pollingSequenceTE0720(pollingSequenceTaskTE0720);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl; sif::error << "InitMission::initTasks: Creating TE0720 PST failed!" << std::endl;
} }
@ -198,7 +198,7 @@ void initmission::initTasks() {
gomSpacePstTask->startTask(); gomSpacePstTask->startTask();
pollingSequenceTableTaskDefault->startTask(); pollingSequenceTableTaskDefault->startTask();
#elif TE0720 == 1 && Q7S_ADD_SPI_TEST == 0 #elif TE0720 == 1 && Q7S_ADD_SPI_TEST == 0
pollingSequenceTableTE0720->startTask(); pollingSequenceTaskTE0720->startTask();
#endif #endif
pusVerification->startTask(); pusVerification->startTask();

View File

@ -105,14 +105,12 @@ void ObjectFactory::produce(){
new UartComIF(objects::UART_COM_IF); new UartComIF(objects::UART_COM_IF);
#if Q7S_ADD_SPI_TEST == 0 #if Q7S_ADD_SPI_TEST == 0
new SpiComIF(objects::SPI_COM_IF, gpioComIF); new SpiComIF(objects::SPI_COM_IF, gpioComIF);
#endif #endif /* Q7S_ADD_SPI_TEST == 0 */
/* Temperature sensors */ /* Temperature sensors */
new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1); new Tmp1075Handler(objects::TMP1075_HANDLER_1, objects::I2C_COM_IF, i2cCookieTmp1075tcs1);
new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2); new Tmp1075Handler(objects::TMP1075_HANDLER_2, objects::I2C_COM_IF, i2cCookieTmp1075tcs2);
GpioCookie* heaterGpiosCookie = new GpioCookie;
#if TE0720 == 0 #if TE0720 == 0
CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH, CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_LENGTH,
addresses::P60DOCK); addresses::P60DOCK);
@ -161,8 +159,7 @@ void ObjectFactory::produce(){
spi::DEFAULT_MAX_1227_SPEED); spi::DEFAULT_MAX_1227_SPEED);
RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR, RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
objects::SPI_COM_IF, spiCookieRadSensor); objects::SPI_COM_IF, spiCookieRadSensor);
// (void) radSensor; (void) radSensor;
radSensor->setStartUpImmediately();
GpioCookie* gpioCookieSus = new GpioCookie(); GpioCookie* gpioCookieSus = new GpioCookie();
@ -210,43 +207,43 @@ void ObjectFactory::produce(){
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO, SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO, SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO, SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO, SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO, SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO, SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO, SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO, SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO, SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO, SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO, SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO, SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO, SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED); SUS::MAX1227_SPI_FREQ);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF, SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
gpioIds::CS_SUS_1); gpioIds::CS_SUS_1);
@ -254,7 +251,7 @@ void ObjectFactory::produce(){
SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF, SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
gpioIds::CS_SUS_2); gpioIds::CS_SUS_2);
(void) sus2; sus2->setStartUpImmediately();
SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF, SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
gpioIds::CS_SUS_3); gpioIds::CS_SUS_3);
@ -270,25 +267,26 @@ void ObjectFactory::produce(){
gpioIds::CS_SUS_7); gpioIds::CS_SUS_7);
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF, SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
gpioIds::CS_SUS_8); gpioIds::CS_SUS_8);
// (void) sus8; (void) sus8;
sus8->setStartUpImmediately();
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF, SusHandler* sus9 = new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
gpioIds::CS_SUS_9); gpioIds::CS_SUS_9);
new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF, (void) sus9;
SusHandler* sus10 = new SusHandler(objects::SUS_10, objects::SPI_COM_IF, spiCookieSus10, gpioComIF,
gpioIds::CS_SUS_10); gpioIds::CS_SUS_10);
(void) sus10;
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11, SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11,
gpioComIF, gpioIds::CS_SUS_11); gpioComIF, gpioIds::CS_SUS_11);
(void) sus11; (void) sus11;
SusHandler* sus12 = new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF, SusHandler* sus12 = new SusHandler(objects::SUS_12, objects::SPI_COM_IF, spiCookieSus12, gpioComIF,
gpioIds::CS_SUS_12); gpioIds::CS_SUS_12);
// sus12->setStartUpImmediately();
(void) sus12; (void) sus12;
SusHandler* sus13 = new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF, SusHandler* sus13 = new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
gpioIds::CS_SUS_13); gpioIds::CS_SUS_13);
// sus13->setStartUpImmediately();
(void) sus13; (void) sus13;
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
@ -364,6 +362,8 @@ void ObjectFactory::produce(){
gyroL3gHandler->setStartUpImmediately(); gyroL3gHandler->setStartUpImmediately();
#endif #endif
GpioCookie* heaterGpiosCookie = new GpioCookie;
/* Pin H2-11 on stack connector */ /* Pin H2-11 on stack connector */
GpiodRegular* gpioConfigHeater0 = new GpiodRegular(std::string("gpiochip7"), 6, GpiodRegular* gpioConfigHeater0 = new GpiodRegular(std::string("gpiochip7"), 6,
std::string("Heater0"), gpio::OUT, 0); std::string("Heater0"), gpio::OUT, 0);
@ -595,14 +595,13 @@ void ObjectFactory::produce(){
#if TE0720 == 1 && TEST_SUS_HANDLER == 1 #if TE0720 == 1 && TEST_SUS_HANDLER == 1
GpioCookie* gpioCookieSus = new GpioCookie; GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip0"), 9, GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
std::string("Chip Select Sus Sensor"), gpio::OUT, 1); std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus); gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
gpioComIF->addGpios(gpioCookieSus); gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1, SpiCookie* spiCookieSus = new SpiCookie(addresses::SUS_1, std::string("/dev/spidev1.0"),
std::string("/dev/spidev1.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE, spi::DEFAULT_MAX_1227_SPEED);
spi::DEFAULT_MAX_1227_SPEED);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF, SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus, gpioComIF,
gpioIds::CS_SUS_1); gpioIds::CS_SUS_1);
@ -611,7 +610,7 @@ void ObjectFactory::produce(){
#if TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1 #if TE0720 == 1 && TEST_RADIATION_SENSOR_HANDLER == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie; GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip0"), 9, GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
std::string("Chip select radiation sensor"), gpio::OUT, 1); std::string("Chip select radiation sensor"), gpio::OUT, 1);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor); gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor); gpioComIF->addGpios(gpioCookieRadSensor);

@ -1 +1 @@
Subproject commit a85c01465bc8687773676f05c5e7eb8af54b25ff Subproject commit 425cfd2ababe3639355c6681ce3f9b606b893430

View File

@ -20,11 +20,11 @@ debugging. */
#define OBSW_PRINT_MISSED_DEADLINES 1 #define OBSW_PRINT_MISSED_DEADLINES 1
#define OBSW_ADD_TEST_CODE 1 #define OBSW_ADD_TEST_CODE 1
#define TEST_LIBGPIOD 0 #define TEST_LIBGPIOD 0
#define TEST_RADIATION_SENSOR_HANDLER 0 #define TEST_RADIATION_SENSOR_HANDLER 1
#define TEST_SUS_HANDLER 1 #define TEST_SUS_HANDLER 1
#define TEST_PLOC_HANDLER 0 #define TEST_PLOC_HANDLER 0
#define TE0720 0 #define TE0720 1
#define TE0720_HEATER_TEST 0 #define TE0720_HEATER_TEST 0
#define P60DOCK_DEBUG 0 #define P60DOCK_DEBUG 0

View File

@ -144,18 +144,11 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
/* Radiation sensor */ /* Radiation sensor */
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ);
/* Sun sensor 1 */
// thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.6, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.8, DeviceHandlerIF::GET_READ);
if (length != 3000) { if (length != 3000) {
sif::warning << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical " sif::warning << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical "
@ -165,95 +158,74 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
/** /**
* The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all * The sun sensor will be shutdown as soon as the chip select is pulled high. Thus all
* requests to a sun sensor must be performed consecutively. Another reason for calling multiple * requests to a sun sensor must be performed consecutively. Another reason for calling multiple
* device handler cycles is that some ADC conversions need a small delay before the results can * device handler cycles is that the ADC conversions take some time. Thus first the ADC
* be read. * conversions are initiated and in a next step the results can be read from the internal FIFO.
* One sun sensor communication sequence also blocks the SPI bus. So other devices can not be * One sun sensor communication sequence also blocks the SPI bus. So other devices can not be
* inserted between the device handler cycles of one SUS. * inserted between the device handler cycles of one SUS.
*/ */
/* Write setup */ /* Write setup */
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.902, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.903, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.904, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_8, length * 0.905, DeviceHandlerIF::GET_READ);
/* Request temperature */ /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_8, 2905, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0.906, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, 2906, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.907, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2907, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.908, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2908, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.909, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, 2909, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_8, length * 0.91, DeviceHandlerIF::GET_READ);
//
// /* Read temperature */ /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_8, 2910, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_8, length * 0.911, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, 2911, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.912, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2912, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_8, length * 0.913, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2913, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_8, length * 0.914, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, 2914, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_8, length * 0.915, DeviceHandlerIF::GET_READ);
//
// /* Request and read ADC conversions */
// thisSequence->addSlot(objects::SUS_8, 2915, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, 2916, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2917, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2918, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, 2919, DeviceHandlerIF::GET_READ);
/* Write setup */ /* Write setup */
// thisSequence->addSlot(objects::SUS_12, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_12, length * 0.916, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.921, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.917, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.922, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.918, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.923, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_12, length * 0.919, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.924, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_12, length * 0.920, DeviceHandlerIF::GET_READ);
//
// /* Request temperature */ /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_12, length * 0.921, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.926, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.922, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.927, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.923, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.928, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_12, length * 0.924, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.929, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_12, length * 0.925, DeviceHandlerIF::GET_READ);
//
// /* Read temperature */ /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_12, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_12, length * 0.926, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.931, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.927, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.932, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_12, length * 0.928, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_12, length * 0.929, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_12, length * 0.930, DeviceHandlerIF::GET_READ);
//
// /* Request and read ADC conversions */ /* Write setup */
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.931, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.936, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.932, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.937, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.933, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.938, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.934, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.939, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.935, DeviceHandlerIF::GET_READ);
//
// /* Write setup */ /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.94, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.936, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.941, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.937, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.942, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.938, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.943, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.939, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.945, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.94, DeviceHandlerIF::GET_READ);
//
// /* Request temperature */ /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_13, length * 0.946, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::SUS_2, length * 0.941, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.947, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.942, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.948, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::SUS_2, length * 0.943, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.949, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::SUS_2, length * 0.944, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.95, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::SUS_2, length * 0.945, DeviceHandlerIF::GET_READ);
//
// /* Read temperature */
// thisSequence->addSlot(objects::SUS_13, length * 0.95, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.951, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.952, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.953, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.954, DeviceHandlerIF::GET_READ);
//
// /* Request and read ADC conversions */
// thisSequence->addSlot(objects::SUS_13, length * 0.955, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.956, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.957, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.958, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.959, DeviceHandlerIF::GET_READ);
if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
@ -315,62 +287,62 @@ ReturnValue_t pst::gomspacePstInit(FixedTimeslotTaskIF *thisSequence){
length * 0.8, DeviceHandlerIF::GET_READ); length * 0.8, DeviceHandlerIF::GET_READ);
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8, thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
//
//
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0,
// DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2,
// DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4,
// DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6,
// DeviceHandlerIF::SEND_READ); DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8, thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8,
// DeviceHandlerIF::GET_READ); DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.2,
DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.4,
DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.6,
DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::GYRO_2_L3G_HANDLER, length * 0.8,
DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0,
@ -446,22 +418,68 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::PLOC_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if TEST_SUS_HANDLER == 1
thisSequence->addSlot(objects::SUS_1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.8, DeviceHandlerIF::GET_READ);
#endif
#if TEST_RADIATION_SENSOR_HANDLER == 1 #if TEST_RADIATION_SENSOR_HANDLER == 1
thisSequence->addSlot(objects::RAD_SENSOR, length * 0, DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::RAD_SENSOR, 800, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.2, DeviceHandlerIF::SEND_WRITE); // thisSequence->addSlot(objects::RAD_SENSOR, 800, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.4, DeviceHandlerIF::GET_WRITE); // thisSequence->addSlot(objects::RAD_SENSOR, 800, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.6, DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::RAD_SENSOR, 800, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.8, DeviceHandlerIF::GET_READ); // thisSequence->addSlot(objects::RAD_SENSOR, 800, DeviceHandlerIF::GET_READ);
#endif #endif
#if TEST_SUS_HANDLER == 1
/* Write setup */
// thisSequence->addSlot(objects::SUS_1, 1000, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, 1010, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, 1020, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, 1030, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, 1040, DeviceHandlerIF::GET_READ);
//
// /* Start ADC conversions */
// thisSequence->addSlot(objects::SUS_1, 1050, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, 1060, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, 1070, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, 1080, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, 1090, DeviceHandlerIF::GET_READ);
//
// /* Read ADC conversions from inernal FIFO */
// thisSequence->addSlot(objects::SUS_1, 2000, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, 2010, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, 2020, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, 2030, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, 2040, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.1, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.1, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.1, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.1, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RAD_SENSOR, length * 0.1, DeviceHandlerIF::GET_READ);
/* Cycle 1 */
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.2, DeviceHandlerIF::GET_READ);
/* Cycl2 */
thisSequence->addSlot(objects::SUS_1, length * 0.3, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.3, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.3, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.3, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.3, DeviceHandlerIF::GET_READ);
/* Cycle 3 */
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_1, length * 0.4, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.9, DeviceHandlerIF::GET_READ);
#endif
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) { if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "Initialization of TE0720 PST failed" << std::endl; sif::error << "Initialization of TE0720 PST failed" << std::endl;

View File

@ -20,7 +20,8 @@ enum {
SA_DEPL_HANDLER, SA_DEPL_HANDLER,
SYRLINKS_HANDLER, SYRLINKS_HANDLER,
IMTQ_HANDLER, IMTQ_HANDLER,
PLOC_HANDLER PLOC_HANDLER,
SUS_HANDLER
}; };
} }

View File

@ -145,7 +145,7 @@ void RadiationSensorHandler::setNormalDatapoolEntriesInvalid(){
} }
uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){ uint32_t RadiationSensorHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo){
return 5000; return 500;
} }
ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t RadiationSensorHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,

View File

@ -1,6 +1,7 @@
#include <fsfw/datapool/PoolReadGuard.h> #include <fsfw/datapool/PoolReadGuard.h>
#include <mission/devices/SusHandler.h> #include <mission/devices/SusHandler.h>
#include <OBSWConfig.h> #include <OBSWConfig.h>
#include <fsfw_hal/linux/spi/SpiComIF.h>
SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie, SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCookie,
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId) : LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId) :
@ -17,6 +18,24 @@ SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF * comCo
SusHandler::~SusHandler() { SusHandler::~SusHandler() {
} }
ReturnValue_t SusHandler::initialize() {
ReturnValue_t result = RETURN_OK;
result = DeviceHandlerBase::initialize();
if (result != RETURN_OK) {
return result;
}
auto spiComIF = dynamic_cast<SpiComIF*>(communicationInterface);
if (spiComIF == nullptr) {
sif::debug << "SusHandler::initialize: Invalid communication interface" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
spiMutex = spiComIF->getMutex();
if (spiMutex == nullptr) {
sif::debug << "SusHandler::initialize: Failed to get spi mutex" << std::endl;
return ObjectManagerIF::CHILD_INIT_FAILED;
}
return RETURN_OK;
}
void SusHandler::doStartUp(){ void SusHandler::doStartUp(){
#if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1 #if OBSW_SWITCH_TO_NORMAL_MODE_AFTER_STARTUP == 1
@ -62,8 +81,20 @@ ReturnValue_t SusHandler::buildCommandFromCommand(
* measurement the setup has to be rewritten. There must also be a little delay between * measurement the setup has to be rewritten. There must also be a little delay between
* the transmission of the setup byte and the first conversion. Thus the conversion * the transmission of the setup byte and the first conversion. Thus the conversion
* will be performed in an extra step. * will be performed in an extra step.
* Because the chip select is driven manually by the SusHandler the SPI bus must be
* protected with a mutex here.
*/ */
//TODO: Protect spi bus with mutex ReturnValue_t result = spiMutex->lockMutex(timeoutType, timeoutMs);
if(result == MutexIF::MUTEX_TIMEOUT) {
sif::error << "SusHandler::buildCommandFromCommand: Mutex timeout" << std::endl;
return ERROR_LOCK_MUTEX;
}
else if(result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "SusHandler::buildCommandFromCommand: Failed to lock spi mutex"
<< std::endl;
return ERROR_LOCK_MUTEX;
}
gpioComIF->pullLow(chipSelectId); gpioComIF->pullLow(chipSelectId);
cmdBuffer[0] = SUS::SETUP; cmdBuffer[0] = SUS::SETUP;
rawPacket = cmdBuffer; rawPacket = cmdBuffer;
@ -132,6 +163,12 @@ ReturnValue_t SusHandler::interpretDeviceReply(DeviceCommandId_t id,
#endif #endif
/** SUS can now be shutdown and thus the SPI bus released again */ /** SUS can now be shutdown and thus the SPI bus released again */
gpioComIF->pullHigh(chipSelectId); gpioComIF->pullHigh(chipSelectId);
ReturnValue_t result = spiMutex->unlockMutex();
if (result != RETURN_OK) {
sif::error << "SusHandler::interpretDeviceReply: Failed to unlock spi mutex"
<< std::endl;
return ERROR_UNLOCK_MUTEX;
}
break; break;
} }
default: { default: {

View File

@ -4,6 +4,7 @@
#include <fsfw/devicehandlers/DeviceHandlerBase.h> #include <fsfw/devicehandlers/DeviceHandlerBase.h>
#include <mission/devices/devicedefinitions/SusDefinitions.h> #include <mission/devices/devicedefinitions/SusDefinitions.h>
#include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h> #include <fsfw_hal/linux/gpio/LinuxLibgpioIF.h>
#include <fsfw/ipc/MutexGuard.h>
/** /**
* @brief This is the device handler class for the SUS sensor. The sensor is * @brief This is the device handler class for the SUS sensor. The sensor is
@ -21,6 +22,8 @@ public:
CookieIF * comCookie, LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId); CookieIF * comCookie, LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
virtual ~SusHandler(); virtual ~SusHandler();
virtual ReturnValue_t initialize();
protected: protected:
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
@ -40,6 +43,11 @@ protected:
private: private:
static const uint8_t INTERFACE_ID = CLASS_ID::SUS_HANDLER;
static const ReturnValue_t ERROR_UNLOCK_MUTEX = MAKE_RETURN_CODE(0xA0);
static const ReturnValue_t ERROR_LOCK_MUTEX = MAKE_RETURN_CODE(0xA1);
enum class CommunicationStep { enum class CommunicationStep {
WRITE_SETUP, WRITE_SETUP,
START_CONVERSIONS, START_CONVERSIONS,
@ -54,6 +62,11 @@ private:
uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE];
CommunicationStep communicationStep = CommunicationStep::WRITE_SETUP; CommunicationStep communicationStep = CommunicationStep::WRITE_SETUP;
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING;
uint32_t timeoutMs = 20;
MutexIF* spiMutex = nullptr;
}; };
#endif /* MISSION_DEVICES_SUSHANDLER_H_ */ #endif /* MISSION_DEVICES_SUSHANDLER_H_ */

View File

@ -4,10 +4,10 @@
namespace SUS { namespace SUS {
/** /**
* The MAX1227 in externally clocked mode did not properly work with frequencies higher than * Some MAX1227 could not be reached with frequencies around 4 MHz. Maybe this is caused by
* 1 MHz. * the decoder and buffer circuits. Thus frequency is here defined to 1 MHz.
*/ */
static const uint32_t SUS_MAX_1227_SPEED = 1000000; static const uint32_t MAX1227_SPI_FREQ = 1000000;
static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending static const DeviceCommandId_t NONE = 0x0; // Set when no command is pending
@ -46,11 +46,6 @@ namespace SUS {
*/ */
static const uint8_t CONVERSION = 0b10101001; static const uint8_t CONVERSION = 0b10101001;
/** Writing this value resets the fifo */
static const uint8_t RESET_FIFO = 0b00011000;
static const uint8_t DUMMY_BYTE = 0x0;
static const uint8_t SUS_DATA_SET_ID = READ_CONVERSIONS; static const uint8_t SUS_DATA_SET_ID = READ_CONVERSIONS;
/** Size of data replies. Temperature and 6 channel convesions (AIN0 - AIN5) */ /** Size of data replies. Temperature and 6 channel convesions (AIN0 - AIN5) */
@ -60,7 +55,6 @@ namespace SUS {
static const uint8_t POOL_ENTRIES = 7; static const uint8_t POOL_ENTRIES = 7;
enum Max1227PoolIds: lp_id_t { enum Max1227PoolIds: lp_id_t {
TEMPERATURE_C, TEMPERATURE_C,
AIN0, AIN0,