diff --git a/bsp_q7s/callbacks/gnssCallback.cpp b/bsp_q7s/callbacks/gnssCallback.cpp index d5dbc3b0..3d29ca4c 100644 --- a/bsp_q7s/callbacks/gnssCallback.cpp +++ b/bsp_q7s/callbacks/gnssCallback.cpp @@ -1,9 +1,14 @@ #include "gnssCallback.h" +#include "fsfw/action/HasActionsIF.h" #include "devices/gpioIds.h" #include "fsfw/tasks/TaskFactory.h" -ReturnValue_t gps::triggerGpioResetPin(void* args) { +ReturnValue_t gps::triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args) { + // At least one byte which denotes which GPS to reset is required + if(len < 1 or actionData == nullptr) { + return HasActionsIF::INVALID_PARAMETERS; + } ResetArgs* resetArgs = reinterpret_cast(args); if (args == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; @@ -12,11 +17,10 @@ ReturnValue_t gps::triggerGpioResetPin(void* args) { return HasReturnvaluesIF::RETURN_FAILED; } gpioId_t gpioId; - if (resetArgs->gnss1) { - gpioId = gpioIds::GNSS_1_NRESET; - - } else { + if (actionData[0] == 0) { gpioId = gpioIds::GNSS_0_NRESET; + } else { + gpioId = gpioIds::GNSS_1_NRESET; } resetArgs->gpioComIF->pullLow(gpioId); TaskFactory::delayTask(resetArgs->waitPeriodMs); diff --git a/bsp_q7s/callbacks/gnssCallback.h b/bsp_q7s/callbacks/gnssCallback.h index 3e769899..cd69f5a6 100644 --- a/bsp_q7s/callbacks/gnssCallback.h +++ b/bsp_q7s/callbacks/gnssCallback.h @@ -5,14 +5,13 @@ #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" struct ResetArgs { - bool gnss1 = false; LinuxLibgpioIF* gpioComIF = nullptr; uint32_t waitPeriodMs = 100; }; namespace gps { -ReturnValue_t triggerGpioResetPin(void* args); +ReturnValue_t triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args); } diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 490b5251..b5b5f06d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -93,8 +93,7 @@ #include "mission/tmtc/VirtualChannel.h" #include "mission/utility/TmFunnel.h" -ResetArgs resetArgsGnss0; -ResetArgs resetArgsGnss1; +ResetArgs RESET_ARGS_GNSS; void Factory::setStaticFrameworkObjectIds() { PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; @@ -462,15 +461,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI #if OBSW_DEBUG_GPS == 1 debugGps = true; #endif - resetArgsGnss1.gnss1 = true; - resetArgsGnss1.gpioComIF = gpioComIF; - resetArgsGnss1.waitPeriodMs = 100; - resetArgsGnss0.gnss1 = false; - resetArgsGnss0.gpioComIF = gpioComIF; - resetArgsGnss0.waitPeriodMs = 100; - auto gpsHandler0 = + RESET_ARGS_GNSS.gpioComIF = gpioComIF; + RESET_ARGS_GNSS.waitPeriodMs = 100; + auto gpsCtrl = new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); - gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); + gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS); AcsBoardHelper acsBoardHelper = AcsBoardHelper( objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, diff --git a/linux/devices/GPSHyperionLinuxController.cpp b/linux/devices/GPSHyperionLinuxController.cpp index dee3c9af..5d97554a 100644 --- a/linux/devices/GPSHyperionLinuxController.cpp +++ b/linux/devices/GPSHyperionLinuxController.cpp @@ -57,12 +57,12 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, const uint8_t *data, size_t size) { switch (actionId) { - case (GpsHyperion::TRIGGER_RESET_PIN): { + case (GpsHyperion::TRIGGER_RESET_PIN_GNSS): { if (resetCallback != nullptr) { PoolReadGuard pg(&gpsSet); // Set HK entries invalid gpsSet.setValidity(false, true); - resetCallback(resetCallbackArgs); + resetCallback(data, size, resetCallbackArgs); return HasActionsIF::EXECUTION_FINISHED; } return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; diff --git a/linux/devices/GPSHyperionLinuxController.h b/linux/devices/GPSHyperionLinuxController.h index 94e82023..35ce0a63 100644 --- a/linux/devices/GPSHyperionLinuxController.h +++ b/linux/devices/GPSHyperionLinuxController.h @@ -30,7 +30,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase { bool debugHyperionGps = false); virtual ~GPSHyperionLinuxController(); - using gpioResetFunction_t = ReturnValue_t (*)(void* args); + using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args); void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args); ReturnValue_t handleCommandMessage(CommandMessage* message) override; diff --git a/mission/devices/devicedefinitions/GPSDefinitions.h b/mission/devices/devicedefinitions/GPSDefinitions.h index f953da22..e842f54b 100644 --- a/mission/devices/devicedefinitions/GPSDefinitions.h +++ b/mission/devices/devicedefinitions/GPSDefinitions.h @@ -14,7 +14,7 @@ static constexpr uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::GPS_HANDLER; static constexpr Event GPS_FIX_CHANGE = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO); static constexpr DeviceCommandId_t GPS_REPLY = 0; -static constexpr DeviceCommandId_t TRIGGER_RESET_PIN = 5; +static constexpr DeviceCommandId_t TRIGGER_RESET_PIN_GNSS = 5; static constexpr uint32_t DATASET_ID = 0;