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
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:
commit
686ec4bffa
@ -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<ResetArgs*>(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);
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user