diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp index 70fa3ebe..73516fb4 100644 --- a/bsp_q7s/callbacks/rwSpiCallback.cpp +++ b/bsp_q7s/callbacks/rwSpiCallback.cpp @@ -212,7 +212,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen result = HasReturnvaluesIF::RETURN_OK; } - cookie->assignTransferSize(decodedFrameLen); + cookie->setTransferSize(decodedFrameLen); closeSpi(gpioId, gpioIF, mutex); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index e529fe09..e3a284fc 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -482,8 +482,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); auto gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_1_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); + //gyroL3gHandler->setGoNormalModeAtStartup(); // Gyro 2 Side B spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev, ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE, @@ -495,8 +496,9 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev, L3GD20H::MAX_BUFFER_SIZE, spi::DEFAULT_L3G_MODE, spi::DEFAULT_L3G_SPEED); gyroL3gHandler = new GyroHandlerL3GD20H(objects::GYRO_3_L3G_HANDLER, - objects::SPI_COM_IF, spiCookie); + objects::SPI_COM_IF, spiCookie, 0); gyroL3gHandler->setStartUpImmediately(); + //gyroL3gHandler->setGoNormalModeAtStartup(); resetArgsGnss1.gnss1 = true; resetArgsGnss1.gpioComIF = gpioComIF; diff --git a/fsfw b/fsfw index 97494a84..bdd7d59d 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 97494a84dfd0acb9dc32770ae9d142f80d4bbcfa +Subproject commit bdd7d59d82a0b9290d77844fbcc5be61c61bcbcb diff --git a/linux/fsfwconfig/FSFWConfig.h.in b/linux/fsfwconfig/FSFWConfig.h.in index 7d1521dc..89d8b9a7 100644 --- a/linux/fsfwconfig/FSFWConfig.h.in +++ b/linux/fsfwconfig/FSFWConfig.h.in @@ -74,5 +74,6 @@ static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; #define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 #define FSFW_DEV_HYPERION_GPS_CREATE_NMEA_CSV 0 +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp index 5a12943a..8342b3cb 100644 --- a/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp +++ b/linux/fsfwconfig/pollingsequence/pollingSequenceFactory.cpp @@ -446,7 +446,7 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // DeviceHandlerIF::SEND_READ); // thisSequence->addSlot(objects::MGM_1_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); -// +//// // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::MGM_2_LIS3_HANDLER, length * 0.2, @@ -469,28 +469,28 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) { // thisSequence->addSlot(objects::MGM_3_RM3100_HANDLER, length * 0.8, // DeviceHandlerIF::GET_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, - DeviceHandlerIF::PERFORM_OPERATION); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, - DeviceHandlerIF::SEND_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, - DeviceHandlerIF::GET_WRITE); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, - DeviceHandlerIF::SEND_READ); - thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, - DeviceHandlerIF::GET_READ); - -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.2, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.2, // DeviceHandlerIF::SEND_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.4, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.4, // DeviceHandlerIF::GET_WRITE); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.6, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, // DeviceHandlerIF::SEND_READ); -// thisSequence->addSlot(objects::GYRO_1_L3G_HANDLER, length * 0.8, +// thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, // 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_ADIS_HANDLER, length * 0, // DeviceHandlerIF::PERFORM_OPERATION); // thisSequence->addSlot(objects::GYRO_2_ADIS_HANDLER, length * 0.2, diff --git a/mission/devices/GyroADIS16507Handler.cpp b/mission/devices/GyroADIS16507Handler.cpp index 6f6fe2a6..793aad66 100644 --- a/mission/devices/GyroADIS16507Handler.cpp +++ b/mission/devices/GyroADIS16507Handler.cpp @@ -403,7 +403,7 @@ ReturnValue_t GyroADIS16507Handler::spiSendCallback(SpiComIF *comIf, SpiCookie * cookie->getSpiParameters(spiMode, spiSpeed, nullptr); comIf->setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); cookie->assignWriteBuffer(sendData); - cookie->assignTransferSize(2); + cookie->setTransferSize(2); gpioId_t gpioId = cookie->getChipSelectPin(); GpioIF* gpioIF = comIf->getGpioInterface(); diff --git a/mission/devices/MGMHandlerLIS3MDL.cpp b/mission/devices/MGMHandlerLIS3MDL.cpp index 0291d8b0..0e1da93e 100644 --- a/mission/devices/MGMHandlerLIS3MDL.cpp +++ b/mission/devices/MGMHandlerLIS3MDL.cpp @@ -292,14 +292,14 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "MGMHandlerLIS3: Magnetic field strength in" " microtesla:" << std::endl; - sif::info << "X: " << mgmX << " \xC2\xB5T" << std::endl; - sif::info << "Y: " << mgmY << " \xC2\xB5T" << std::endl; - sif::info << "Z: " << mgmZ << " \xC2\xB5T" << std::endl; + sif::info << "X: " << mgmX << " uT" << std::endl; + sif::info << "Y: " << mgmY << " uT" << std::endl; + sif::info << "Z: " << mgmZ << " uT" << std::endl; #else sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); - sif::printInfo("X: %f " "\xC2\xB5" "T\n", mgmX); - sif::printInfo("Y: %f " "\xC2\xB5" "T\n", mgmY); - sif::printInfo("Z: %f " "\xC2\xB5" "T\n", mgmZ); + sif::printInfo("X: %f uT\n", mgmX); + sif::printInfo("Y: %f uT\n", mgmY); + sif::printInfo("Z: %f uT\n", mgmZ); #endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ } #endif /* OBSW_VERBOSE_LEVEL >= 1 */ @@ -320,10 +320,10 @@ ReturnValue_t MGMHandlerLIS3MDL::interpretDeviceReply(DeviceCommandId_t id, if(debugDivider->check()) { /* Set terminal to utf-8 if there is an issue with micro printout. */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " \xC2\xB0" << "C" << + sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << std::endl; #else - sif::printInfo("MGMHandlerLIS3: Temperature: %f" "\xC2\xB0" "C\n"); + sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); #endif } #endif diff --git a/mission/devices/MGMHandlerRM3100.cpp b/mission/devices/MGMHandlerRM3100.cpp index a4878b95..71c3e524 100644 --- a/mission/devices/MGMHandlerRM3100.cpp +++ b/mission/devices/MGMHandlerRM3100.cpp @@ -63,6 +63,7 @@ void MGMHandlerRM3100::doShutDown() { ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( DeviceCommandId_t *id) { + size_t commandLen = 0; switch(internalState) { case(InternalState::NONE): case(InternalState::NORMAL): { @@ -77,6 +78,8 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( break; } case(InternalState::STATE_CONFIGURE_TMRC): { + commandBuffer[0] = RM3100::TMRC_DEFAULT_VALUE; + commandLen = 1; *id = RM3100::CONFIGURE_TMRC; break; } @@ -85,18 +88,17 @@ ReturnValue_t MGMHandlerRM3100::buildTransitionDeviceCommand( break; } default: - /* Might be a configuration error. */ - sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << + // Might be a configuration error + sif::warning << "MGMHandlerRM3100::buildTransitionDeviceCommand: Unknown internal state!" << std::endl; return HasReturnvaluesIF::RETURN_OK; } - return buildCommandFromCommand(*id, nullptr, 0); + return buildCommandFromCommand(*id, commandBuffer, commandLen); } -ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { +ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { switch(deviceCommand) { case(RM3100::CONFIGURE_CMM): { commandBuffer[0] = RM3100::CMM_REGISTER; @@ -113,8 +115,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( break; } case(RM3100::CONFIGURE_TMRC): { - return handleTmrcConfigCommand(deviceCommand, commandData, - commandDataLen); + return handleTmrcConfigCommand(deviceCommand, commandData, commandDataLen); } case(RM3100::READ_TMRC): { commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK; @@ -124,8 +125,7 @@ ReturnValue_t MGMHandlerRM3100::buildCommandFromCommand( break; } case(RM3100::CONFIGURE_CYCLE_COUNT): { - return handleCycleCountConfigCommand(deviceCommand, commandData, - commandDataLen); + return handleCycleCountConfigCommand(deviceCommand, commandData, commandDataLen); } case(RM3100::READ_CYCLE_COUNT): { commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK; @@ -162,8 +162,7 @@ ReturnValue_t MGMHandlerRM3100::scanForReply(const uint8_t *start, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t MGMHandlerRM3100::interpretDeviceReply( - DeviceCommandId_t id, const uint8_t *packet) { +ReturnValue_t MGMHandlerRM3100::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; switch(id) { case(RM3100::CONFIGURE_CMM): @@ -281,19 +280,14 @@ ReturnValue_t MGMHandlerRM3100::handleCycleCommand(bool oneCycleValue, return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand( - DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) { - if(commandData == nullptr) { - return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; - } - - if(commandDataLen != 1) { +ReturnValue_t MGMHandlerRM3100::handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + if(commandData == nullptr or commandDataLen != 1) { return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; } commandBuffer[0] = RM3100::TMRC_REGISTER; - commandBuffer[1] = commandData[1]; + commandBuffer[1] = commandData[0]; rawPacketLen = 2; rawPacket = commandBuffer; return HasReturnvaluesIF::RETURN_OK; @@ -325,7 +319,7 @@ ReturnValue_t MGMHandlerRM3100::initializeLocalDataPool( } uint32_t MGMHandlerRM3100::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 10000; + return 25000; } ReturnValue_t MGMHandlerRM3100::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { diff --git a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h index 08f80dd9..4f00bba9 100644 --- a/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h +++ b/mission/devices/devicedefinitions/MGMHandlerRM3100Definitions.h @@ -45,7 +45,7 @@ static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; static constexpr uint8_t TMRC_REGISTER = 0x0B; -static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; +static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_75HZ_VALUE; static constexpr uint8_t MEASUREMENT_REG_START = 0x24; static constexpr uint8_t BIST_REGISTER = 0x33; diff --git a/tmtc b/tmtc index d9968031..dff569e9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit d9968031d641249ca0ad62e7c1c19ed22390078c +Subproject commit dff569e93ff3cb5e62627c89cfa2229f464c76de