save before changing to internally clocked mode

This commit is contained in:
Jakob Meier 2021-05-09 18:18:27 +02:00
parent fab28904de
commit a6465c42ba
3 changed files with 105 additions and 51 deletions

View File

@ -161,7 +161,8 @@ void ObjectFactory::produce(){
spi::DEFAULT_MAX_1227_SPEED);
RadiationSensorHandler* radSensor = new RadiationSensorHandler(objects::RAD_SENSOR,
objects::SPI_COM_IF, spiCookieRadSensor);
(void) radSensor;
// (void) radSensor;
radSensor->setStartUpImmediately();
GpioCookie* gpioCookieSus = new GpioCookie();
@ -207,59 +208,56 @@ void ObjectFactory::produce(){
gpioComIF->addGpios(gpioCookieSus);
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpioIds::CS_SUS_1,
SpiCookie* spiCookieSus1 = new SpiCookie(addresses::SUS_1, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpioIds::CS_SUS_2,
SpiCookie* spiCookieSus2 = new SpiCookie(addresses::SUS_2, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpioIds::CS_SUS_3,
SpiCookie* spiCookieSus3 = new SpiCookie(addresses::SUS_3, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpioIds::CS_SUS_4,
SpiCookie* spiCookieSus4 = new SpiCookie(addresses::SUS_4, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpioIds::CS_SUS_5,
SpiCookie* spiCookieSus5 = new SpiCookie(addresses::SUS_5, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6,
SpiCookie* spiCookieSus6 = new SpiCookie(addresses::SUS_6, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpioIds::CS_SUS_7,
SpiCookie* spiCookieSus7 = new SpiCookie(addresses::SUS_7, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus8 = new SpiCookie(addresses::SUS_8, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpioIds::CS_SUS_9,
SpiCookie* spiCookieSus9 = new SpiCookie(addresses::SUS_9, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpioIds::CS_SUS_10,
SpiCookie* spiCookieSus10 = new SpiCookie(addresses::SUS_10, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpioIds::CS_SUS_11,
SpiCookie* spiCookieSus11 = new SpiCookie(addresses::SUS_11, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpioIds::CS_SUS_12,
SpiCookie* spiCookieSus12 = new SpiCookie(addresses::SUS_12, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpioIds::CS_SUS_13,
SpiCookie* spiCookieSus13 = new SpiCookie(addresses::SUS_13, gpio::NO_GPIO,
std::string("/dev/spidev2.0"), SUS::MAX_CMD_SIZE, spi::DEFAULT_MAX_1227_MODE,
SUS::SUS_MAX_1227_SPEED);
SusHandler* sus1 = new SusHandler(objects::SUS_1, objects::SPI_COM_IF, spiCookieSus1, gpioComIF,
gpioIds::CS_SUS_1);
// sus1->setStartUpImmediately();
(void) sus1;
SusHandler* sus2 = new SusHandler(objects::SUS_2, objects::SPI_COM_IF, spiCookieSus2, gpioComIF,
gpioIds::CS_SUS_2);
sus2->setStartUpImmediately();
(void) sus2;
SusHandler* sus3 = new SusHandler(objects::SUS_3, objects::SPI_COM_IF, spiCookieSus3, gpioComIF,
gpioIds::CS_SUS_3);
sus3->setStartUpImmediately();
(void) sus3;
new SusHandler(objects::SUS_4, objects::SPI_COM_IF, spiCookieSus4, gpioComIF,
@ -272,6 +270,7 @@ void ObjectFactory::produce(){
gpioIds::CS_SUS_7);
SusHandler* sus8 = new SusHandler(objects::SUS_8, objects::SPI_COM_IF, spiCookieSus8, gpioComIF,
gpioIds::CS_SUS_8);
// (void) sus8;
sus8->setStartUpImmediately();
new SusHandler(objects::SUS_9, objects::SPI_COM_IF, spiCookieSus9, gpioComIF,
@ -280,12 +279,17 @@ void ObjectFactory::produce(){
gpioIds::CS_SUS_10);
SusHandler* sus11 = new SusHandler(objects::SUS_11, objects::SPI_COM_IF, spiCookieSus11,
gpioComIF, gpioIds::CS_SUS_11);
sus11->setStartUpImmediately();
(void) sus11;
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);
new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
// sus12->setStartUpImmediately();
(void) sus12;
SusHandler* sus13 = new SusHandler(objects::SUS_13, objects::SPI_COM_IF, spiCookieSus13, gpioComIF,
gpioIds::CS_SUS_13);
// sus13->setStartUpImmediately();
(void) sus13;
#if OBSW_ADD_ACS_BOARD == 1
GpioCookie* gpioCookieAcsBoard = new GpioCookie();

View File

@ -21,7 +21,7 @@ static constexpr uint32_t DEFAULT_L3G_SPEED = 3'900'000;
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_0;
static constexpr spi::SpiModes DEFAULT_MAX_1227_MODE = spi::SpiModes::MODE_3;
}

View File

@ -157,8 +157,8 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
// thisSequence->addSlot(objects::SUS_1, length * 0.6, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_1, length * 0.8, DeviceHandlerIF::GET_READ);
if (length != 3) {
sif::waring << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical "
if (length != 3000) {
sif::warning << "pollingSequenceInitDefault: Frequency changed. Make sure timing critical "
<< "SUS sensors still produce correct values" << std::endl;
}
@ -172,38 +172,88 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
*/
/* Write setup */
thisSequence->addSlot(objects::SUS_8, length * 0.991, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.992, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.993, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.994, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.995, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::SUS_8, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.4, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.6, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.8, DeviceHandlerIF::GET_READ);
/* Request temperature */
thisSequence->addSlot(objects::SUS_8, length * 0.996, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.997, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.998, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.999, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.9, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_8, 2905, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, 2906, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2907, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2908, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, 2909, DeviceHandlerIF::GET_READ);
//
// /* Read temperature */
// thisSequence->addSlot(objects::SUS_8, 2910, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_8, 2911, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2912, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_8, 2913, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_8, 2914, 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);
/* Read temperature */
thisSequence->addSlot(objects::SUS_8, length * 0.901, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.902, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.903, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.904, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.905, DeviceHandlerIF::GET_READ);
/* Request and read ADC conversions */
thisSequence->addSlot(objects::SUS_8, length * 0.906, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::SUS_8, length * 0.907, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.908, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::SUS_8, length * 0.909, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::SUS_8, length * 0.91, DeviceHandlerIF::GET_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_11, length * 0.2, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.4, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_11, length * 0.6, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_11, length * 0.8, DeviceHandlerIF::GET_READ);
/* Write setup */
// thisSequence->addSlot(objects::SUS_12, length * 0.92, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.921, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.922, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.923, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.924, DeviceHandlerIF::GET_READ);
//
// /* Request temperature */
// thisSequence->addSlot(objects::SUS_12, length * 0.925, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.926, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.927, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.928, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.929, DeviceHandlerIF::GET_READ);
//
// /* Read temperature */
// thisSequence->addSlot(objects::SUS_12, length * 0.93, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.931, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.932, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.933, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.934, DeviceHandlerIF::GET_READ);
//
// /* Request and read ADC conversions */
// thisSequence->addSlot(objects::SUS_12, length * 0.935, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_12, length * 0.936, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.937, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_12, length * 0.938, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_12, length * 0.939, DeviceHandlerIF::GET_READ);
//
// /* Write setup */
// thisSequence->addSlot(objects::SUS_13, length * 0.94, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.941, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.942, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.943, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.945, DeviceHandlerIF::GET_READ);
//
// /* Request temperature */
// thisSequence->addSlot(objects::SUS_13, length * 0.946, DeviceHandlerIF::PERFORM_OPERATION);
// thisSequence->addSlot(objects::SUS_13, length * 0.947, DeviceHandlerIF::SEND_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.948, DeviceHandlerIF::GET_WRITE);
// thisSequence->addSlot(objects::SUS_13, length * 0.949, DeviceHandlerIF::SEND_READ);
// thisSequence->addSlot(objects::SUS_13, length * 0.95, 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) {
return HasReturnvaluesIF::RETURN_OK;