This commit is contained in:
parent
5e8eb7151b
commit
9d7291eea2
@ -1,5 +1,6 @@
|
|||||||
#include "GpsHyperionLinuxController.h"
|
#include "GpsHyperionLinuxController.h"
|
||||||
|
|
||||||
|
#include <fsfw/tasks/TaskFactory.h>
|
||||||
#include <fsfw/timemanager/Stopwatch.h>
|
#include <fsfw/timemanager/Stopwatch.h>
|
||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
@ -96,8 +97,8 @@ ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) {
|
|||||||
handleQueue();
|
handleQueue();
|
||||||
poolManager.performHkOperation();
|
poolManager.performHkOperation();
|
||||||
while (true) {
|
while (true) {
|
||||||
bool callAgain = readGpsDataFromGpsd();
|
bool callAgainImmediately = readGpsDataFromGpsd();
|
||||||
if (not callAgain) {
|
if (not callAgainImmediately) {
|
||||||
handleQueue();
|
handleQueue();
|
||||||
poolManager.performHkOperation();
|
poolManager.performHkOperation();
|
||||||
}
|
}
|
||||||
@ -126,6 +127,7 @@ ReturnValue_t GpsHyperionLinuxController::initialize() {
|
|||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
openError("Socket", retval);
|
openError("Socket", retval);
|
||||||
}
|
}
|
||||||
|
gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr);
|
||||||
} else if (readMode == ReadModes::SHM) {
|
} else if (readMode == ReadModes::SHM) {
|
||||||
int retval = gps_open(GPSD_SHARED_MEMORY, "", &gps);
|
int retval = gps_open(GPSD_SHARED_MEMORY, "", &gps);
|
||||||
if (retval != 0) {
|
if (retval != 0) {
|
||||||
@ -142,25 +144,19 @@ ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *m
|
|||||||
void GpsHyperionLinuxController::performControlOperation() {}
|
void GpsHyperionLinuxController::performControlOperation() {}
|
||||||
|
|
||||||
bool GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
bool GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||||
auto readError = [&](int error) {
|
auto readError = [&]() {
|
||||||
if (gpsReadFailedSwitch) {
|
if (gpsReadFailedSwitch) {
|
||||||
gpsReadFailedSwitch = false;
|
gpsReadFailedSwitch = false;
|
||||||
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed | "
|
sif::warning << "GPSHyperionHandler::readGpsDataFromGpsd: Reading GPS data failed | "
|
||||||
"Error "
|
"Error "
|
||||||
<< error << " | " << gps_errstr(error) << std::endl;
|
<< errno << " | " << gps_errstr(errno) << std::endl;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
currentClientBuf = gps_data(&gps);
|
|
||||||
if (readMode == ReadModes::SOCKET) {
|
if (readMode == ReadModes::SOCKET) {
|
||||||
gps_stream(&gps, WATCH_ENABLE | WATCH_JSON, nullptr);
|
|
||||||
// Perform other necessary handling if not data seen for 0.2 seconds.
|
// Perform other necessary handling if not data seen for 0.2 seconds.
|
||||||
if (gps_waiting(&gps, 200000)) {
|
if (gps_waiting(&gps, 200000)) {
|
||||||
int result = gps_read(&gps);
|
if (-1 == gps_read(&gps)) {
|
||||||
while (result > 0) {
|
readError();
|
||||||
result = gps_read(&gps);
|
|
||||||
}
|
|
||||||
if (result == -1) {
|
|
||||||
readError(result);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (MODE_SET != (MODE_SET & gps.set)) {
|
if (MODE_SET != (MODE_SET & gps.set)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user