fixes for scheduling
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit
This commit is contained in:
@ -27,12 +27,6 @@ GpsHyperionLinuxController::~GpsHyperionLinuxController() {
|
||||
gps_close(&gps);
|
||||
}
|
||||
|
||||
void GpsHyperionLinuxController::performControlOperation() {
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
readGpsDataFromGpsd();
|
||||
#endif
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase *GpsHyperionLinuxController::getDataSetHandle(sid_t sid) { return &gpsSet; }
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
@ -98,6 +92,18 @@ void GpsHyperionLinuxController::setResetPinTriggerFunction(gpioResetFunction_t
|
||||
resetCallbackArgs = args;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::performOperation(uint8_t opCode) {
|
||||
while (true) {
|
||||
bool noDataRead = readGpsDataFromGpsd();
|
||||
if (noDataRead) {
|
||||
handleQueue();
|
||||
poolManager.performHkOperation();
|
||||
}
|
||||
}
|
||||
// Should never be reached.
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::initialize() {
|
||||
ReturnValue_t result = ExtendedControllerBase::initialize();
|
||||
if (result != returnvalue::OK) {
|
||||
@ -133,7 +139,7 @@ ReturnValue_t GpsHyperionLinuxController::handleCommandMessage(CommandMessage *m
|
||||
|
||||
#ifdef FSFW_OSAL_LINUX
|
||||
|
||||
void GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
bool GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
auto readError = [&](int error) {
|
||||
if (gpsReadFailedSwitch) {
|
||||
gpsReadFailedSwitch = false;
|
||||
@ -145,15 +151,15 @@ void GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
currentClientBuf = gps_data(&gps);
|
||||
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 (gps_waiting(&gps, 2000000)) {
|
||||
// Perform other necessary handling if not data seen for 0.2 seconds.
|
||||
if (gps_waiting(&gps, 200000)) {
|
||||
int result = gps_read(&gps);
|
||||
while (result > 0) {
|
||||
result = gps_read(&gps);
|
||||
}
|
||||
if (result == -1) {
|
||||
readError(result);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (MODE_SET != (MODE_SET & gps.set)) {
|
||||
if (mode == MODE_ON) {
|
||||
@ -168,19 +174,20 @@ void GpsHyperionLinuxController::readGpsDataFromGpsd() {
|
||||
noModeSetCntr = -1;
|
||||
}
|
||||
// did not event get mode, nothing to see.
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
noModeSetCntr = 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (readMode == ReadModes::SHM) {
|
||||
int result = gps_read(&gps);
|
||||
if (result == -1) {
|
||||
readError(result);
|
||||
return;
|
||||
}
|
||||
sif::error << "GpsHyperionLinuxController::readGpsDataFromGpsdPermanentLoop: "
|
||||
"SHM read not implemented"
|
||||
<< std::endl;
|
||||
}
|
||||
handleGpsReadData();
|
||||
return true;
|
||||
}
|
||||
|
||||
ReturnValue_t GpsHyperionLinuxController::handleGpsReadData() {
|
||||
|
@ -32,6 +32,7 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
|
||||
|
||||
using gpioResetFunction_t = ReturnValue_t (*)(const uint8_t* actionData, size_t len, void* args);
|
||||
|
||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
void setResetPinTriggerFunction(gpioResetFunction_t resetCallback, void* args);
|
||||
ReturnValue_t handleCommandMessage(CommandMessage* message) override;
|
||||
void performControlOperation() override;
|
||||
@ -66,7 +67,10 @@ class GpsHyperionLinuxController : public ExtendedControllerBase {
|
||||
uint32_t timeIsConstantCounter = 0;
|
||||
Countdown timeUpdateCd = Countdown(60);
|
||||
|
||||
void readGpsDataFromGpsd();
|
||||
// Returns true if data was read and function should be called again
|
||||
// immediately, and false if the gps_waiting blocked for 0.2 seconds
|
||||
// without new data arriving.
|
||||
bool readGpsDataFromGpsd();
|
||||
};
|
||||
|
||||
#endif /* MISSION_DEVICES_GPSHYPERIONHANDLER_H_ */
|
||||
|
Reference in New Issue
Block a user