Merge pull request 'GPS Reset Pin Handling Update' (#261) from mueller/gps-reset-pin-update into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #261
Reviewed-by: Jakob.Meier <meierj@irs.uni-stuttgart.de>
This commit is contained in:
Jakob Meier 2022-05-25 15:20:12 +02:00
commit 686ec4bffa
6 changed files with 19 additions and 21 deletions

View File

@ -1,9 +1,14 @@
#include "gnssCallback.h" #include "gnssCallback.h"
#include "fsfw/action/HasActionsIF.h"
#include "devices/gpioIds.h" #include "devices/gpioIds.h"
#include "fsfw/tasks/TaskFactory.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<ResetArgs*>(args); ResetArgs* resetArgs = reinterpret_cast<ResetArgs*>(args);
if (args == nullptr) { if (args == nullptr) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
@ -12,11 +17,10 @@ ReturnValue_t gps::triggerGpioResetPin(void* args) {
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
gpioId_t gpioId; gpioId_t gpioId;
if (resetArgs->gnss1) { if (actionData[0] == 0) {
gpioId = gpioIds::GNSS_1_NRESET;
} else {
gpioId = gpioIds::GNSS_0_NRESET; gpioId = gpioIds::GNSS_0_NRESET;
} else {
gpioId = gpioIds::GNSS_1_NRESET;
} }
resetArgs->gpioComIF->pullLow(gpioId); resetArgs->gpioComIF->pullLow(gpioId);
TaskFactory::delayTask(resetArgs->waitPeriodMs); TaskFactory::delayTask(resetArgs->waitPeriodMs);

View File

@ -5,14 +5,13 @@
#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" #include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h"
struct ResetArgs { struct ResetArgs {
bool gnss1 = false;
LinuxLibgpioIF* gpioComIF = nullptr; LinuxLibgpioIF* gpioComIF = nullptr;
uint32_t waitPeriodMs = 100; uint32_t waitPeriodMs = 100;
}; };
namespace gps { namespace gps {
ReturnValue_t triggerGpioResetPin(void* args); ReturnValue_t triggerGpioResetPin(const uint8_t* actionData, size_t len, void* args);
} }

View File

@ -93,8 +93,7 @@
#include "mission/tmtc/VirtualChannel.h" #include "mission/tmtc/VirtualChannel.h"
#include "mission/utility/TmFunnel.h" #include "mission/utility/TmFunnel.h"
ResetArgs resetArgsGnss0; ResetArgs RESET_ARGS_GNSS;
ResetArgs resetArgsGnss1;
void Factory::setStaticFrameworkObjectIds() { void Factory::setStaticFrameworkObjectIds() {
PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR; PusServiceBase::packetSource = objects::PUS_PACKET_DISTRIBUTOR;
@ -462,15 +461,11 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
#if OBSW_DEBUG_GPS == 1 #if OBSW_DEBUG_GPS == 1
debugGps = true; debugGps = true;
#endif #endif
resetArgsGnss1.gnss1 = true; RESET_ARGS_GNSS.gpioComIF = gpioComIF;
resetArgsGnss1.gpioComIF = gpioComIF; RESET_ARGS_GNSS.waitPeriodMs = 100;
resetArgsGnss1.waitPeriodMs = 100; auto gpsCtrl =
resetArgsGnss0.gnss1 = false;
resetArgsGnss0.gpioComIF = gpioComIF;
resetArgsGnss0.waitPeriodMs = 100;
auto gpsHandler0 =
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps); new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0); gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
AcsBoardHelper acsBoardHelper = AcsBoardHelper( AcsBoardHelper acsBoardHelper = AcsBoardHelper(
objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER, objects::MGM_0_LIS3_HANDLER, objects::MGM_1_RM3100_HANDLER, objects::MGM_2_LIS3_HANDLER,

View File

@ -57,12 +57,12 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
MessageQueueId_t commandedBy, MessageQueueId_t commandedBy,
const uint8_t *data, size_t size) { const uint8_t *data, size_t size) {
switch (actionId) { switch (actionId) {
case (GpsHyperion::TRIGGER_RESET_PIN): { case (GpsHyperion::TRIGGER_RESET_PIN_GNSS): {
if (resetCallback != nullptr) { if (resetCallback != nullptr) {
PoolReadGuard pg(&gpsSet); PoolReadGuard pg(&gpsSet);
// Set HK entries invalid // Set HK entries invalid
gpsSet.setValidity(false, true); gpsSet.setValidity(false, true);
resetCallback(resetCallbackArgs); resetCallback(data, size, resetCallbackArgs);
return HasActionsIF::EXECUTION_FINISHED; return HasActionsIF::EXECUTION_FINISHED;
} }
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;

View File

@ -30,7 +30,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
bool debugHyperionGps = false); bool debugHyperionGps = false);
virtual ~GPSHyperionLinuxController(); 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); void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args);
ReturnValue_t handleCommandMessage(CommandMessage* message) override; ReturnValue_t handleCommandMessage(CommandMessage* message) override;

View File

@ -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 Event GPS_FIX_CHANGE = event::makeEvent(SUBSYSTEM_ID, 0, severity::INFO);
static constexpr DeviceCommandId_t GPS_REPLY = 0; 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; static constexpr uint32_t DATASET_ID = 0;