bugfix for GPS handler
This commit is contained in:
parent
9bcc424d86
commit
10378ef1bb
@ -23,7 +23,7 @@
|
||||
#include "linux/boardtest/UartTestClass.h"
|
||||
#include "linux/callbacks/gpioCallbacks.h"
|
||||
#include "linux/csp/CspComIF.h"
|
||||
#include "linux/devices/GPSHyperionLinuxController.h"
|
||||
#include "linux/devices/GpsHyperionLinuxController.h"
|
||||
#include "linux/devices/ScexUartReader.h"
|
||||
#include "linux/devices/devicedefinitions/PlocMPSoCDefinitions.h"
|
||||
#include "linux/devices/devicedefinitions/StarTrackerDefinitions.h"
|
||||
@ -474,7 +474,7 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF* gpioComIF, SerialCo
|
||||
RESET_ARGS_GNSS.gpioComIF = gpioComIF;
|
||||
RESET_ARGS_GNSS.waitPeriodMs = 100;
|
||||
auto gpsCtrl =
|
||||
new GPSHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
||||
new GpsHyperionLinuxController(objects::GPS_CONTROLLER, objects::NO_OBJECT, debugGps);
|
||||
gpsCtrl->setResetPinTriggerFunction(gps::triggerGpioResetPin, &RESET_ARGS_GNSS);
|
||||
|
||||
AcsBoardHelper acsBoardHelper = AcsBoardHelper(
|
||||
|
@ -121,8 +121,8 @@ void ObjectFactory::createSunSensorComponents(GpioIF* gpioComIF, SpiComIF* spiCo
|
||||
fdir = new SusFdir(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
|
||||
susHandlers[5]->setCustomFdir(fdir);
|
||||
|
||||
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE, spi::SUS_MAX_1227_MODE,
|
||||
spi::SUS_MAX1227_SPI_FREQ);
|
||||
spiCookie = new SpiCookie(addresses::SUS_6, gpioIds::CS_SUS_6, SUS::MAX_CMD_SIZE,
|
||||
spi::SUS_MAX_1227_MODE, spi::SUS_MAX1227_SPI_FREQ);
|
||||
susHandlers[6] =
|
||||
new SusHandler(objects::SUS_6_R_LOC_XFYBZM_PT_XF, 6, objects::SPI_MAIN_COM_IF, spiCookie);
|
||||
fdir = new SusFdir(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
|
||||
|
@ -1,5 +1,5 @@
|
||||
if(EIVE_BUILD_GPSD_GPS_HANDLER)
|
||||
target_sources(${OBSW_NAME} PRIVATE GPSHyperionLinuxController.cpp)
|
||||
target_sources(${OBSW_NAME} PRIVATE GpsHyperionLinuxController.cpp)
|
||||
endif()
|
||||
|
||||
target_sources(
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "GPSHyperionLinuxController.h"
|
||||
#include "GpsHyperionLinuxController.h"
|
||||
|
||||
#include <fsfw/timemanager/Stopwatch.h>
|
||||
|
||||
@ -16,26 +16,26 @@
|
||||
#include <cmath>
|
||||
#include <ctime>
|
||||
|
||||
GPSHyperionLinuxController::GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
GpsHyperionLinuxController::GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
bool debugHyperionGps)
|
||||
: ExtendedControllerBase(objectId), gpsSet(this), debugHyperionGps(debugHyperionGps) {
|
||||
timeUpdateCd.resetTimer();
|
||||
}
|
||||
|
||||
GPSHyperionLinuxController::~GPSHyperionLinuxController() {
|
||||
GpsHyperionLinuxController::~GpsHyperionLinuxController() {
|
||||
gps_stream(&gps, WATCH_DISABLE, nullptr);
|
||||
gps_close(&gps);
|
||||
}
|
||||
|
||||
void GPSHyperionLinuxController::performControlOperation() {
|
||||
void GpsHyperionLinuxController::performControlOperation() {
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
readGpsDataFromGpsd();
|
||||
#endif
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *GPSHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; }
|
||||
LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; }
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode) {
|
||||
if (not modeCommanded) {
|
||||
if (mode == MODE_ON or mode == MODE_OFF) {
|
||||
@ -54,7 +54,7 @@ ReturnValue_t GPSHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||
ReturnValue_t GpsHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||
MessageQueueId_t commandedBy,
|
||||
const uint8_t *data, size_t size) {
|
||||
switch (actionId) {
|
||||
@ -72,7 +72,7 @@ ReturnValue_t GPSHyperionLinuxController::executeAction(ActionId_t actionId,
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
||||
ReturnValue_t GpsHyperionLinuxController::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
localDataPoolMap.emplace(GpsHyperion::ALTITUDE, new PoolEntry<double>({0.0}));
|
||||
localDataPoolMap.emplace(GpsHyperion::LONGITUDE, new PoolEntry<double>({0.0}));
|
||||
@ -92,13 +92,13 @@ ReturnValue_t GPSHyperionLinuxController::initializeLocalDataPool(
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
void GPSHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
|
||||
void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t resetCallback,
|
||||
void *args) {
|
||||
this->resetCallback = resetCallback;
|
||||
resetCallbackArgs = args;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::initialize() {
|
||||
ReturnValue_t GpsHyperionLinuxController::initialize() {
|
||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -127,13 +127,13 @@ ReturnValue_t GPSHyperionLinuxController::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::handleCommandMessage(CommandMessage *message) {
|
||||
ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *message) {
|
||||
return ExtendedControllerBase::handleCommandMessage(message);
|
||||
}
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
|
||||
void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
void GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
auto readError = [&](int error) {
|
||||
if (gpsReadFailedSwitch) {
|
||||
gpsReadFailedSwitch = false;
|
||||
@ -146,15 +146,17 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
if (readMode == ReadModes::SOCKET) {
|
||||
gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr);
|
||||
// Exit if no data is seen in 2 seconds (should not happen)
|
||||
if (not gps_waiting(&gps, 2000000)) {
|
||||
return;
|
||||
}
|
||||
if (gps_waiting(&gps, 2000000)) {
|
||||
int result = gps_read(&gps);
|
||||
while (result > 0) {
|
||||
result = gps_read(&gps);
|
||||
}
|
||||
if (result == -1) {
|
||||
readError(result);
|
||||
return;
|
||||
}
|
||||
if (MODE_SET != (MODE_SET & gps.set)) {
|
||||
if (mode == MODE_ON) {
|
||||
if (noModeSetCntr >= 0) {
|
||||
noModeSetCntr++;
|
||||
}
|
||||
@ -165,8 +167,12 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
<< std::endl;
|
||||
noModeSetCntr = -1;
|
||||
}
|
||||
// did not event get mode, nothing to see.
|
||||
return;
|
||||
}
|
||||
}
|
||||
noModeSetCntr = 0;
|
||||
}
|
||||
} else if (readMode == ReadModes::SHM) {
|
||||
int result = gps_read(&gps);
|
||||
if (result == -1) {
|
||||
@ -174,10 +180,10 @@ void GPSHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
handleGpsRead();
|
||||
handleGpsReadData();
|
||||
}
|
||||
|
||||
ReturnValue_t GPSHyperionLinuxController::handleGpsRead() {
|
||||
ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
||||
PoolReadGuard pg(&gpsSet);
|
||||
if (pg.getReadResult() != returnvalue::OK) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
@ -20,15 +20,15 @@
|
||||
* This device handler can only be used on Linux system where the gpsd daemon with shared memory
|
||||
* export is running.
|
||||
*/
|
||||
class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
class GpsHyperionLinuxController : public ExtendedControllerBase {
|
||||
public:
|
||||
static constexpr uint32_t MAX_SECONDS_TO_REACH_FIX = 60 * 60 * 5;
|
||||
|
||||
enum ReadModes { SHM = 0, SOCKET = 1 };
|
||||
|
||||
GPSHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
GpsHyperionLinuxController(object_id_t objectId, object_id_t parentId,
|
||||
bool debugHyperionGps = false);
|
||||
virtual ~GPSHyperionLinuxController();
|
||||
virtual ~GpsHyperionLinuxController();
|
||||
|
||||
using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args);
|
||||
|
||||
@ -49,7 +49,7 @@ class GPSHyperionLinuxController : public ExtendedControllerBase {
|
||||
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
|
||||
ReturnValue_t handleGpsRead();
|
||||
ReturnValue_t handleGpsReadData();
|
||||
|
||||
private:
|
||||
GpsPrimaryDataset gpsSet;
|
@ -63,7 +63,7 @@ class GpsPrimaryDataset : public StaticLocalDataSet<18> {
|
||||
lp_var_t<uint32_t>(sid.objectId, GpsHyperion::UNIX_SECONDS, this);
|
||||
|
||||
private:
|
||||
friend class GPSHyperionLinuxController;
|
||||
friend class GpsHyperionLinuxController;
|
||||
GpsPrimaryDataset(HasLocalDataPoolIF* hkOwner)
|
||||
: StaticLocalDataSet(hkOwner, GpsHyperion::DATASET_ID) {}
|
||||
};
|
||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
||||
Subproject commit 04f5a769629ae79048f68a37d0555e458c9f9a94
|
||||
Subproject commit 5e27a22a85acca321cc4ef5067c01924579d2c1e
|
Loading…
x
Reference in New Issue
Block a user