split up PSTs and add contd GPS handler
This commit is contained in:
parent
56cabbc117
commit
2331637350
@ -1,3 +1,6 @@
|
||||
#include <fsfw_hal/linux/uart/UartComIF.h>
|
||||
#include <fsfw_hal/linux/uart/UartCookie.h>
|
||||
#include <mission/devices/GPSHandler.h>
|
||||
#include "ObjectFactory.h"
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
@ -68,6 +71,8 @@ void ObjectFactory::produce(void* args){
|
||||
|
||||
#if RPI_ADD_UART_TEST == 1
|
||||
new UartTestClass(objects::UART_TEST);
|
||||
#else
|
||||
new UartComIF(objects::UART_COM_IF);
|
||||
#endif
|
||||
|
||||
#if RPI_LOOPBACK_TEST_GPIO == 1
|
||||
@ -146,4 +151,15 @@ void ObjectFactory::produce(void* args){
|
||||
auto adisGyroHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF, spiCookie);
|
||||
adisGyroHandler->setStartUpImmediately();
|
||||
#endif /* RPI_TEST_ADIS16507 == 1 */
|
||||
|
||||
#if RPI_TEST_GPS_HANDLER == 1
|
||||
UartCookie* uartCookie = new UartCookie(objects::GPS0_HANDLER, "/dev/serial0",
|
||||
UartModes::CANONICAL, 9600, 1024);
|
||||
uartCookie->setToFlushInput(true);
|
||||
uartCookie->setReadCycles(6);
|
||||
GPSHandler* gpsHandler = new GPSHandler(objects::GPS0_HANDLER,
|
||||
objects::UART_COM_IF, uartCookie);
|
||||
gpsHandler->setStartUpImmediately();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define RPI_LOOPBACK_TEST_GPIO 0
|
||||
|
||||
#define RPI_TEST_ADIS16507 0
|
||||
#define RPI_TEST_GPS_HANDLER 0
|
||||
|
||||
// Only one of those 2 should be enabled!
|
||||
#define RPI_ADD_SPI_TEST 0
|
||||
|
2
fsfw_hal
2
fsfw_hal
@ -1 +1 @@
|
||||
Subproject commit fce40ebf9a4a45bafedaee2fc87e5aa10e49fdcc
|
||||
Subproject commit 2533af3b53804bc68436236370911e013a2b8f64
|
@ -619,6 +619,16 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.6, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GYRO_0_ADIS_HANDLER, length * 0.8, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
|
||||
#if RPI_TEST_GPS_HANDLER == 1
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0, DeviceHandlerIF::GET_READ);
|
||||
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.5, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::GPS0_HANDLER, length * 0.5, DeviceHandlerIF::GET_READ);
|
||||
#endif
|
||||
static_cast<void>(length);
|
||||
if (thisSequence->checkSequence() != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "Test PST initialization failed" << std::endl;
|
||||
@ -627,6 +637,7 @@ ReturnValue_t pst::pstTest(FixedTimeslotTaskIF* thisSequence) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#if TE7020 == 1
|
||||
ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
uint32_t length = thisSequence->getPeriodMs();
|
||||
|
||||
@ -675,4 +686,4 @@ ReturnValue_t pst::pollingSequenceTE0720(FixedTimeslotTaskIF *thisSequence) {
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
#endif /* TE7020 == 1 */
|
||||
|
@ -1,7 +1,14 @@
|
||||
#ifndef POLLINGSEQUENCEFACTORY_H_
|
||||
#define POLLINGSEQUENCEFACTORY_H_
|
||||
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include "OBSWConfig.h"
|
||||
#if defined(RASPBERRY_PI)
|
||||
#include "rpiConfig.h"
|
||||
#elif defined(XIPHOS_Q7S)
|
||||
#include "q7sConfig.h"
|
||||
#endif
|
||||
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
|
||||
class FixedTimeslotTaskIF;
|
||||
|
||||
@ -48,11 +55,13 @@ ReturnValue_t pstI2c(FixedTimeslotTaskIF* thisSequence);
|
||||
*/
|
||||
ReturnValue_t pstTest(FixedTimeslotTaskIF* thisSequence);
|
||||
|
||||
|
||||
#if TE7020 == 1
|
||||
/**
|
||||
* @brief This polling sequence will be created when the software is compiled for the TE0720.
|
||||
*/
|
||||
ReturnValue_t pollingSequenceTE0720(FixedTimeslotTaskIF* thisSequence);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,11 +50,25 @@ ReturnValue_t GPSHandler::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
// Pass data to GPS library
|
||||
if(len > 0) {
|
||||
sif::info << "GPSHandler::scanForReply: Received " << len << " bytes" << std::endl;
|
||||
if (internalState == InternalStates::WAIT_FIRST_MESSAGE) {
|
||||
// TODO: Check whether data is valid by chcking whether NMEA start string is valid
|
||||
commandExecuted = true;
|
||||
}
|
||||
int result = lwgps_process(&gpsData, start, len);
|
||||
if(result != 0) {
|
||||
if(result != 1) {
|
||||
sif::warning << "GPSHandler::scanForReply: Issue processing GPS data with lwgps"
|
||||
<< std::endl;
|
||||
}
|
||||
else {
|
||||
sif::info << "GPS Data" << std::endl;
|
||||
// Print messages
|
||||
printf("Valid status: %d\n", gpsData.is_valid);
|
||||
printf("Latitude: %f degrees\n", gpsData.latitude);
|
||||
printf("Longitude: %f degrees\n", gpsData.longitude);
|
||||
printf("Altitude: %f meters\n", gpsData.altitude);
|
||||
}
|
||||
*foundLen = len;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user