update reset pin handling
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...

This commit is contained in:
Robin Müller 2022-05-25 10:59:20 +02:00
parent d870f5ab10
commit 01bac87afb
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
6 changed files with 23 additions and 13 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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,6 +461,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
#if OBSW_DEBUG_GPS == 1
debugGps = true;
#endif
<<<<<<< Updated upstream
resetArgsGnss1.gnss1 = true;
resetArgsGnss1.gpioComIF = gpioComIF;
resetArgsGnss1.waitPeriodMs = 100;
@ -471,6 +471,13 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, UartComI
auto gpsHandler0 =
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
=======
RESET_ARGS_GNSS.gpioComIF = gpioComIF;
RESET_ARGS_GNSS.waitPeriodMs = 100;
auto gpsCtrl =
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
>>>>>>> Stashed changes
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
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,
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;

View File

@ -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;

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 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;