From d5205b59c1eb052b2674617f0dcca312a5eda6da Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:24:47 +0200 Subject: [PATCH 1/5] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 29c74283..350fbc38 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 29c74283f117bb68186d1161896d82e3361680c2 +Subproject commit 350fbc385cedae73ea2396dafdeb5b74b28be74d From b12845521742085375ab45235972e71db6b3cd72 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:35:33 +0200 Subject: [PATCH 2/5] RW small improvements --- bsp_q7s/core/ObjectFactory.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 4223c8fc..ff8415f8 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -813,18 +813,30 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { auto rwHandler1 = new RwHandler(objects::RW1, objects::SPI_COM_IF, rw1SpiCookie, gpioComIF, gpioIds::EN_RW1); +#if OBSW_DEBUG_RW == 1 + rwHandler1->setStartUpImmediately(); +#endif rw1SpiCookie->setCallbackArgs(rwHandler1); auto rwHandler2 = new RwHandler(objects::RW2, objects::SPI_COM_IF, rw2SpiCookie, gpioComIF, gpioIds::EN_RW2); +#if OBSW_DEBUG_RW == 1 + rwHandler2->setStartUpImmediately(); +#endif rw2SpiCookie->setCallbackArgs(rwHandler2); auto rwHandler3 = new RwHandler(objects::RW3, objects::SPI_COM_IF, rw3SpiCookie, gpioComIF, gpioIds::EN_RW3); +#if OBSW_DEBUG_RW == 1 + rwHandler3->setStartUpImmediately(); +#endif rw3SpiCookie->setCallbackArgs(rwHandler3); auto rwHandler4 = new RwHandler(objects::RW4, objects::SPI_COM_IF, rw4SpiCookie, gpioComIF, gpioIds::EN_RW4); +#if OBSW_DEBUG_RW == 1 + rwHandler4->setStartUpImmediately(); +#endif rw4SpiCookie->setCallbackArgs(rwHandler4); } From 8693075061dc78a07ca88d7c2f535c1ea143a2cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 15:58:03 +0200 Subject: [PATCH 3/5] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 350fbc38..dccc2f0b 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 350fbc385cedae73ea2396dafdeb5b74b28be74d +Subproject commit dccc2f0ba77184933e3d551d95950a5b0801d2f2 From 8fc144b595f9527dbaf52bbdb158accab4d10a9a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 16:03:09 +0200 Subject: [PATCH 4/5] RW handler tweaks --- bsp_q7s/core/ObjectFactory.cpp | 8 -------- mission/devices/RwHandler.cpp | 22 +++++++++++----------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ff8415f8..d956a392 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -766,14 +766,6 @@ void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) { &gpioCallbacks::spiCsDecoderCallback, gpioComIF); gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4); -// GpiodRegular* enRw1 = new GpiodRegular("Enable reaction wheel 1", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); -// GpiodRegular* enRw2 = new GpiodRegular("Enable reaction wheel 2", gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_1_CS); -// gpioCookieRw->addGpio(gpioIds::EN_RW2, enRw2); -// GpiodRegular* enRw3 = new GpiodRegular(, gpio::OUT, 0, -// q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_2_CS); auto enRw1 = new GpiodRegularByLabel(q7s::GPIO_RW_DEFAULT_LABEL, q7s::GPIO_RW_0_CS, "Enable reaction wheel 1", gpio::OUT, gpio::LOW); gpioCookieRw->addGpio(gpioIds::EN_RW1, enRw1); diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 571f7eca..792e530d 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -144,47 +144,47 @@ void RwHandler::fillCommandAndReplyMap() { ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, size_t *foundLen) { - - switch (*(start)) { - case (static_cast(RwDefinitions::GET_LAST_RESET_STATUS)): { + uint8_t replyByte = *start; + switch (replyByte) { + case (RwDefinitions::GET_LAST_RESET_STATUS): { *foundLen = RwDefinitions::SIZE_GET_RESET_STATUS; *foundId = RwDefinitions::GET_LAST_RESET_STATUS; break; } - case (static_cast(RwDefinitions::CLEAR_LAST_RESET_STATUS)): { + case (RwDefinitions::CLEAR_LAST_RESET_STATUS): { *foundLen = RwDefinitions::SIZE_CLEAR_RESET_STATUS; *foundId = RwDefinitions::CLEAR_LAST_RESET_STATUS; break; } - case (static_cast(RwDefinitions::GET_RW_STATUS)): { + case (RwDefinitions::GET_RW_STATUS): { *foundLen = RwDefinitions::SIZE_GET_RW_STATUS; *foundId = RwDefinitions::GET_RW_STATUS; break; } - case (static_cast(RwDefinitions::INIT_RW_CONTROLLER)): { + case (RwDefinitions::INIT_RW_CONTROLLER): { *foundLen = RwDefinitions::SIZE_INIT_RW; *foundId = RwDefinitions::INIT_RW_CONTROLLER; break; } - case (static_cast(RwDefinitions::SET_SPEED)): { + case (RwDefinitions::SET_SPEED): { *foundLen = RwDefinitions::SIZE_SET_SPEED_REPLY; *foundId = RwDefinitions::SET_SPEED; break; } - case (static_cast(RwDefinitions::GET_TEMPERATURE)): { + case (RwDefinitions::GET_TEMPERATURE): { *foundLen = RwDefinitions::SIZE_GET_TEMPERATURE_REPLY; *foundId = RwDefinitions::GET_TEMPERATURE; break; } - case (static_cast(RwDefinitions::GET_TM)): { + case (RwDefinitions::GET_TM): { *foundLen = RwDefinitions::SIZE_GET_TELEMETRY_REPLY; *foundId = RwDefinitions::GET_TM; break; } default: { - sif::debug << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; + sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << + std::endl; return RETURN_FAILED; - break; } } From 397e1433fd59b88c53b9fa86dea471db24c88484 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 17:14:08 +0200 Subject: [PATCH 5/5] GPS and RW handler improvements --- fsfw | 2 +- mission/devices/GPSHyperionHandler.cpp | 10 ++++++---- mission/devices/GPSHyperionHandler.h | 1 + mission/devices/RwHandler.cpp | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/fsfw b/fsfw index dccc2f0b..e1a85b47 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit dccc2f0ba77184933e3d551d95950a5b0801d2f2 +Subproject commit e1a85b47c5018590e58b9b1130b1754b0079450f diff --git a/mission/devices/GPSHyperionHandler.cpp b/mission/devices/GPSHyperionHandler.cpp index 26b86a76..8944d17a 100644 --- a/mission/devices/GPSHyperionHandler.cpp +++ b/mission/devices/GPSHyperionHandler.cpp @@ -60,10 +60,8 @@ ReturnValue_t GPSHyperionHandler::buildCommandFromCommand( PoolReadGuard pg(&gpsSet); // Set HK entries invalid gpsSet.setValidity(false, true); - // The user needs to implement this. Don't touch states for now, the device should - // quickly reboot and send valid strings again. - actionHelper.finish(true, getCommanderQueueId(deviceCommand), deviceCommand); - return resetCallback(resetCallbackArgs); + resetCallback(resetCallbackArgs); + return HasActionsIF::EXECUTION_FINISHED; } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; } @@ -210,3 +208,7 @@ ReturnValue_t GPSHyperionHandler::initialize() { // Enable reply immediately for now return updatePeriodicReply(true, GpsHyperion::GPS_REPLY); } + +ReturnValue_t GPSHyperionHandler::acceptExternalDeviceCommands() { + return DeviceHandlerBase::acceptExternalDeviceCommands(); +} diff --git a/mission/devices/GPSHyperionHandler.h b/mission/devices/GPSHyperionHandler.h index 13591b44..e7c925be 100644 --- a/mission/devices/GPSHyperionHandler.h +++ b/mission/devices/GPSHyperionHandler.h @@ -22,6 +22,7 @@ public: using gpioResetFunction_t = ReturnValue_t (*) (void* args); void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void*args); + ReturnValue_t acceptExternalDeviceCommands() override; ReturnValue_t initialize() override; protected: diff --git a/mission/devices/RwHandler.cpp b/mission/devices/RwHandler.cpp index 792e530d..91188d87 100644 --- a/mission/devices/RwHandler.cpp +++ b/mission/devices/RwHandler.cpp @@ -184,6 +184,7 @@ ReturnValue_t RwHandler::scanForReply(const uint8_t *start, size_t remainingSize default: { sif::warning << "RwHandler::scanForReply: Reply contains invalid command code" << std::endl; + *foundLen = remainingSize; return RETURN_FAILED; } }