diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d76f2fb..59d9d32d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -177,6 +177,7 @@ endif()
if(NOT EIVE_BUILD_WATCHDOG)
if(NOT EIVE_BUILD_UNITTESTS)
if(EIVE_ADD_LINUX_FILES)
+ add_subdirectory(${LIB_ARCSEC_PATH})
add_subdirectory(${LINUX_PATH})
endif()
add_subdirectory(${BSP_PATH})
@@ -192,7 +193,6 @@ if((NOT BUILD_Q7S_SIMPLE_MODE) AND (NOT EIVE_BUILD_WATCHDOG))
add_subdirectory(${FSFW_PATH})
add_subdirectory(${MISSION_PATH})
add_subdirectory(${TEST_PATH})
- add_subdirectory(${LIB_ARCSEC_PATH})
endif()
if(EIVE_BUILD_UNITTESTS)
diff --git a/README.md b/README.md
index ff2c359d..5ac8f6e6 100644
--- a/README.md
+++ b/README.md
@@ -11,14 +11,15 @@
4. [Useful and Common Host Commands](#host-commands)
5. [Setting up Prerequisites](#set-up-prereq)
6. [Remote Debugging](#remote-debugging)
-7. [TMTC testing](#tmtc-testing)
-8. [Direct Debugging](#direct-debugging)
-9. [Transfering Files to the Q7S](#file-transfer)
-10. [Q7S OBC](#q7s)
-11. [Static Code Analysis](#static-code-analysis)
-12. [Eclipse](#eclipse)
-13. [Running the OBSW on a Raspberry Pi](#rpi)
-14. [FSFW](#fsfw)
+6. [Remote Reset](#remote-reset)
+8. [TMTC testing](#tmtc-testing)
+9. [Direct Debugging](#direct-debugging)
+10. [Transfering Files to the Q7S](#file-transfer)
+11. [Q7S OBC](#q7s)
+12. [Static Code Analysis](#static-code-analysis)
+13. [Eclipse](#eclipse)
+14. [Running the OBSW on a Raspberry Pi](#rpi)
+15. [FSFW](#fsfw)
# General information
@@ -535,10 +536,10 @@ ssh root@192.168.133.10
```
If this has not been done yet, you can access the serial
-console of the Q7S like this to set it
+console of the Q7S like this
```sh
-picocom -b 115200 /dev/ttyUSB0
+picocom -b 115200 /dev/q7sSerial
```
The flatsat has the aliases and shell scripts `q7s_ssh` and `q7s_serial` for this task as well.
@@ -575,6 +576,29 @@ alias or shell script to do this quickly.
Note: When now setting up a debug session in the Xilinx SDK or Eclipse, the host must be set
to localhost instead of the IP address of the Q7S.
+# Remote Reset
+1. Launch xilinx hardware server on flatsat with alias
+````
+launch-hwserver-xilinx
+````
+2. On host PC start xsc
+3. In xsct console type the follwing command to connect to the hardware server (replace with the IP address of the flatsat PC. Can be found out with ifconfig)
+````
+connect -url tcp::3121
+````
+4. The following command will list all available devices
+````
+targets
+````
+5. Connect to the APU of the Q7S
+````
+target
+````
+6. Perform reset
+````
+rst
+````
+
# TMTC testing
The OBSW supports sending PUS TM packets via TCP or the PDEC IP Core which transmits the data as
diff --git a/bsp_hosted/fsfwconfig/devices/gpioIds.h b/bsp_hosted/fsfwconfig/devices/gpioIds.h
index 1ab55d08..a4b4ac81 100644
--- a/bsp_hosted/fsfwconfig/devices/gpioIds.h
+++ b/bsp_hosted/fsfwconfig/devices/gpioIds.h
@@ -1,8 +1,6 @@
#ifndef FSFWCONFIG_DEVICES_GPIOIDS_H_
#define FSFWCONFIG_DEVICES_GPIOIDS_H_
-#include
-
namespace gpioIds {
enum gpioId_t {
HEATER_0,
diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h
index af89d346..34516fa6 100644
--- a/bsp_q7s/boardconfig/busConf.h
+++ b/bsp_q7s/boardconfig/busConf.h
@@ -8,13 +8,11 @@ static constexpr char SPI_RW_DEV[] = "/dev/spidev3.0";
static constexpr char I2C_DEFAULT_DEV[] = "/dev/i2c-1";
-static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL3";
-static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL4";
-static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL5";
-static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL8";
-
-static constexpr char UART_GNSS_0_DEV[] = "/dev/ttyUL0";
-static constexpr char UART_GNSS_1_DEV[] = "/dev/ttyUL2";
+static constexpr char UART_GNSS_DEV[] = "/dev/ttyUL0";
+static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ttyUL2";
+static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ttyUL3";
+static constexpr char UART_SYRLINKS_DEV[] = "/dev/ttyUL4";
+static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ttyUL7";
static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0";
static constexpr char UIO_PDEC_CONFIG_MEMORY[] = "/dev/uio2";
@@ -31,8 +29,10 @@ namespace gpioNames {
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select";
static constexpr char RESET_GNSS_0[] = "reset_gnss_0";
static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
- static constexpr char GYRO_0_ENABLE[] = "gyro_0_enable";
- static constexpr char GYRO_2_ENABLE[] = "gyro_2_enable";
+ static constexpr char GNSS_0_ENABLE[] = "enable_gnss_0";
+ static constexpr char GNSS_1_ENABLE[] = "enable_gnss_1";
+ static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
+ static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
static constexpr char HEATER_0[] = "heater0";
static constexpr char HEATER_1[] = "heater1";
static constexpr char HEATER_2[] = "heater2";
@@ -54,7 +54,7 @@ namespace gpioNames {
static constexpr char EN_RW_2[] = "enable_rw_2";
static constexpr char EN_RW_3[] = "enable_rw_3";
static constexpr char EN_RW_4[] = "enable_rw_4";
- static constexpr char SPI_MUX_SELECT[] = "spi_mux_select";
+ static constexpr char GNSS_MUX_SELECT[] = "gnss_mux_select";
static constexpr char RAD_SENSOR_CHIP_SELECT[] = "rad_sensor_chip_select";
static constexpr char PAPB_BUSY_SIGNAL_VC0[] = "papb_busy_signal_vc0";
static constexpr char PAPB_EMPTY_SIGNAL_VC0[] = "papb_empty_signal_vc0";
diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp
index 965a6d63..5cead3d5 100644
--- a/bsp_q7s/boardtest/Q7STestTask.cpp
+++ b/bsp_q7s/boardtest/Q7STestTask.cpp
@@ -127,8 +127,18 @@ void Q7STestTask::testDummyParams() {
param.writeJsonFile();
param.print();
- int test = param.getValue(DummyParameter::DUMMY_KEY_PARAM_1);
- std::string test2 = param.getValue(DummyParameter::DUMMY_KEY_PARAM_2);
+ int test = 0;
+ result = param.getValue(DummyParameter::DUMMY_KEY_PARAM_1, &test);
+ if (result != HasReturnvaluesIF::RETURN_OK) {
+ sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
+ << " does not exist" << std::endl;
+ }
+ std::string test2;
+ result = param.getValue(DummyParameter::DUMMY_KEY_PARAM_2, &test2);
+ if (result != HasReturnvaluesIF::RETURN_OK) {
+ sif::warning << "Q7STestTask::testDummyParams: Key " << DummyParameter::DUMMY_KEY_PARAM_1
+ << " does not exist" << std::endl;
+ }
sif::info << "Test value (3 expected): " << test << std::endl;
sif::info << "Test value 2 (\"blirb\" expected): " << test2 << std::endl;
}
diff --git a/bsp_q7s/callbacks/rwSpiCallback.cpp b/bsp_q7s/callbacks/rwSpiCallback.cpp
index d5cab4aa..701fc8dc 100644
--- a/bsp_q7s/callbacks/rwSpiCallback.cpp
+++ b/bsp_q7s/callbacks/rwSpiCallback.cpp
@@ -51,11 +51,6 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
return result;
}
- /** Disconnect PS SPI peripheral and select AXI SPI core */
- if(gpioIF->pullHigh(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
- sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio high" << std::endl;
- }
-
/** Sending frame start sign */
writeBuffer[0] = 0x7E;
writeSize = 1;
@@ -133,8 +128,15 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
closeSpi(gpioId, gpioIF, mutex);
return RwHandler::SPI_READ_FAILURE;
}
+ if(idx == 0) {
+ if(byteRead != FLAG_BYTE) {
+ sif::error << "Invalid data, expected start marker" << std::endl;
+ closeSpi(gpioId, gpioIF, mutex);
+ return RwHandler::NO_START_MARKER;
+ }
+ }
- if (byteRead != 0x7E) {
+ if (byteRead != FLAG_BYTE) {
break;
}
@@ -145,6 +147,10 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
}
}
+#if FSFW_HAL_SPI_WIRETAPPING == 1
+ sif::info << "RW start marker detected" << std::endl;
+#endif
+
size_t decodedFrameLen = 0;
while(decodedFrameLen < replyBufferSize) {
@@ -158,7 +164,7 @@ ReturnValue_t spiCallback(SpiComIF* comIf, SpiCookie *cookie, const uint8_t *sen
}
}
- if (byteRead == 0x7E) {
+ if (byteRead == FLAG_BYTE) {
/** Reached end of frame */
break;
}
@@ -227,10 +233,5 @@ void closeSpi (gpioId_t gpioId, GpioIF* gpioIF, MutexIF* mutex) {
if(mutex->unlockMutex() != HasReturnvaluesIF::RETURN_OK) {
sif::error << "rwSpiCallback::closeSpi: Failed to unlock mutex" << std::endl;;
}
-
- /** Route SPI interface again to PS SPI peripheral */
- if(gpioIF->pullLow(gpioIds::SPI_MUX) != HasReturnvaluesIF::RETURN_OK) {
- sif::error << "rwSpiCallback::spiCallback: Failed to pull spi mux gpio low" << std::endl;
- }
}
}
diff --git a/bsp_q7s/callbacks/rwSpiCallback.h b/bsp_q7s/callbacks/rwSpiCallback.h
index cc7c6cbe..8952f873 100644
--- a/bsp_q7s/callbacks/rwSpiCallback.h
+++ b/bsp_q7s/callbacks/rwSpiCallback.h
@@ -8,6 +8,9 @@
namespace rwSpiCallback {
+//! This is the end and start marker of the frame datalinklayer
+static constexpr uint8_t FLAG_BYTE = 0x7E;
+
/**
* @brief This is the callback function to send commands to the nano avionics reaction wheels and
* receive the replies.
diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp
index d8149ccb..271ec508 100644
--- a/bsp_q7s/core/CoreController.cpp
+++ b/bsp_q7s/core/CoreController.cpp
@@ -1094,8 +1094,8 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
uint8_t wordIdx = 0;
uint8_t arrayIdx = 0;
istringstream iss(nextLine);
- Chip currentChip;
- Copy currentCopy;
+ Chip currentChip = Chip::CHIP_0;
+ Copy currentCopy = Copy::COPY_0;
while(iss >> word) {
if(wordIdx == 1) {
currentChip = static_cast(stoi(word));
diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp
index 7923a2cd..7977deed 100644
--- a/bsp_q7s/core/InitMission.cpp
+++ b/bsp_q7s/core/InitMission.cpp
@@ -22,7 +22,7 @@
ServiceInterfaceStream sif::debug("DEBUG");
ServiceInterfaceStream sif::info("INFO");
ServiceInterfaceStream sif::warning("WARNING");
-ServiceInterfaceStream sif::error("ERROR", false, false, true);
+ServiceInterfaceStream sif::error("ERROR");
#else
ServiceInterfaceStream sif::debug("DEBUG", true);
ServiceInterfaceStream sif::info("INFO", true);
@@ -126,6 +126,16 @@ void initmission::initTasks() {
if(result != HasReturnvaluesIF::RETURN_OK) {
initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::FILE_SYSTEM_HANDLER);
}
+
+#if OBSW_ADD_STAR_TRACKER == 1
+ PeriodicTaskIF* strImgLoaderTask = factory->createPeriodicTask(
+ "FILE_SYSTEM_TASK", 20, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
+ result = strImgLoaderTask->addComponent(objects::STR_HELPER);
+ if(result != HasReturnvaluesIF::RETURN_OK) {
+ initmission::printAddObjectError("FILE_SYSTEM_TASK", objects::STR_HELPER);
+ }
+#endif /* OBSW_ADD_STAR_TRACKER == 1 */
+
#endif /* BOARD_TE0720 */
#if OBSW_TEST_CCSDS_BRIDGE == 1
@@ -187,6 +197,9 @@ void initmission::initTasks() {
#if BOARD_TE0720 == 0
fsTask->startTask();
+#if OBSW_ADD_STAR_TRACKER == 1
+ strImgLoaderTask->startTask();
+#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif
sif::info << "Tasks started.." << std::endl;
@@ -199,7 +212,7 @@ void initmission::createPstTasks(TaskFactory& factory,
/* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask(
- "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0,
+ "PST_TASK_DEFAULT", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.5,
missedDeadlineFunc);
result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
@@ -213,21 +226,21 @@ void initmission::createPstTasks(TaskFactory& factory,
#endif
FixedTimeslotTaskIF* uartPst = factory.createFixedTimeslotTask(
- "UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
+ "UART_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstUart(uartPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
taskVec.push_back(uartPst);
FixedTimeslotTaskIF* gpioPst = factory.createFixedTimeslotTask(
- "GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
+ "GPIO_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstGpio(gpioPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
}
taskVec.push_back(gpioPst);
FixedTimeslotTaskIF* i2cPst = factory.createFixedTimeslotTask(
- "I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 3.0, missedDeadlineFunc);
+ "I2C_PST", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE * 4, 0.2, missedDeadlineFunc);
result = pst::pstI2c(i2cPst);
if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "InitMission::initTasks: Creating PST failed!" << std::endl;
diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp
index b292f644..1c5bb2df 100644
--- a/bsp_q7s/core/ObjectFactory.cpp
+++ b/bsp_q7s/core/ObjectFactory.cpp
@@ -1,5 +1,8 @@
#include
#include "ObjectFactory.h"
+
+#include "bsp_q7s/devices/startracker/StrHelper.h"
+#include "bsp_q7s/devices/startracker/StarTrackerDefinitions.h"
#include "OBSWConfig.h"
#include "devConf.h"
#include "ccsdsConfig.h"
@@ -16,15 +19,17 @@
#include "bsp_q7s/devices/PlocSupervisorHandler.h"
#include "bsp_q7s/devices/PlocUpdater.h"
#include "bsp_q7s/devices/PlocMemoryDumper.h"
+#include "bsp_q7s/devices/startracker/StarTrackerHandler.h"
#include "bsp_q7s/callbacks/rwSpiCallback.h"
#include "bsp_q7s/callbacks/gnssCallback.h"
-#include "linux/devices/HeaterHandler.h"
#include "linux/devices/SolarArrayDeploymentHandler.h"
#include "linux/devices/devicedefinitions/SusDefinitions.h"
#include "linux/devices/SusHandler.h"
#include "linux/csp/CspCookie.h"
#include "linux/csp/CspComIF.h"
+
+#include "mission/devices/HeaterHandler.h"
#include "mission/core/GenericFactory.h"
#include "mission/devices/PDU1Handler.h"
#include "mission/devices/PDU2Handler.h"
@@ -33,20 +38,19 @@
#include "mission/devices/P60DockHandler.h"
#include "mission/devices/Tmp1075Handler.h"
#include "mission/devices/Max31865PT1000Handler.h"
-#include "mission/devices/GyroADIS16507Handler.h"
+#include "mission/devices/GyroADIS1650XHandler.h"
#include "mission/devices/IMTQHandler.h"
#include "mission/devices/SyrlinksHkHandler.h"
#include "mission/devices/PlocMPSoCHandler.h"
#include "mission/devices/RadiationSensorHandler.h"
#include "mission/devices/RwHandler.h"
-#include "mission/devices/StarTrackerHandler.h"
#include "mission/devices/devicedefinitions/GomspaceDefinitions.h"
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
#include "mission/devices/devicedefinitions/PlocMPSoCDefinitions.h"
#include "mission/devices/devicedefinitions/RadSensorDefinitions.h"
#include "mission/devices/devicedefinitions/Max31865Definitions.h"
#include "mission/devices/devicedefinitions/RwDefinitions.h"
-#include "mission/devices/devicedefinitions/StarTrackerDefinitions.h"
+
#include "mission/devices/GPSHyperionHandler.h"
#include "mission/tmtc/CCSDSHandler.h"
#include "mission/tmtc/VirtualChannel.h"
@@ -167,11 +171,15 @@ void ObjectFactory::produce(void* args) {
new FileSystemHandler(objects::FILE_SYSTEM_HANDLER);
#if OBSW_ADD_STAR_TRACKER == 1
- UartCookie* starTrackerCookie = new UartCookie(objects::START_TRACKER,
+ UartCookie* starTrackerCookie = new UartCookie(objects::STAR_TRACKER,
q7s::UART_STAR_TRACKER_DEV, UartModes::NON_CANONICAL, uart::STAR_TRACKER_BAUD,
StarTracker::MAX_FRAME_SIZE* 2 + 2);
starTrackerCookie->setNoFixedSizeReply();
- new StarTrackerHandler(objects::START_TRACKER, objects::UART_COM_IF, starTrackerCookie);
+ StrHelper* strHelper = new StrHelper(objects::STR_HELPER);
+ StarTrackerHandler* starTrackerHandler = new StarTrackerHandler(objects::STAR_TRACKER,
+ objects::UART_COM_IF, starTrackerCookie, strHelper);
+ starTrackerHandler->setStartUpImmediately();
+
#endif /* OBSW_ADD_STAR_TRACKER == 1 */
#endif /* TE7020 == 0 */
@@ -264,7 +272,7 @@ void ObjectFactory::createRadSensorComponent(LinuxLibgpioIF* gpioComIF) {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::RAD_SENSOR;
GpiodRegularByLineName* gpio = new GpiodRegularByLineName(
- q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::OUT, gpio::HIGH);
+ q7s::gpioNames::RAD_SENSOR_CHIP_SELECT, consumer.str(), gpio::DIR_OUT, gpio::HIGH);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, gpio);
gpioComIF->addGpios(gpioCookieRadSensor);
@@ -278,43 +286,43 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF *gpioComIF, SpiComI
GpioCookie* gpioCookieSus = new GpioCookie();
GpioCallback* susgpio = nullptr;
- susgpio = new GpioCallback("Chip select SUS 1", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, susgpio);
- susgpio = new GpioCallback("Chip select SUS 2", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_2, susgpio);
- susgpio = new GpioCallback("Chip select SUS 3", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_3, susgpio);
- susgpio = new GpioCallback("Chip select SUS 4", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_4, susgpio);
- susgpio = new GpioCallback("Chip select SUS 5", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 5", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_5, susgpio);
- susgpio = new GpioCallback("Chip select SUS 6", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 6", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_6, susgpio);
- susgpio = new GpioCallback("Chip select SUS 7", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 7", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_7, susgpio);
- susgpio = new GpioCallback("Chip select SUS 8", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 8", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_8, susgpio);
- susgpio = new GpioCallback("Chip select SUS 9", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 9", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_9, susgpio);
- susgpio = new GpioCallback("Chip select SUS 10", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 10", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_10, susgpio);
- susgpio = new GpioCallback("Chip select SUS 11", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 11", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_11, susgpio);
- susgpio = new GpioCallback("Chip select SUS 12", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 12", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_12, susgpio);
- susgpio = new GpioCallback("Chip select SUS 13", gpio::OUT, gpio::HIGH,
+ susgpio = new GpioCallback("Chip select SUS 13", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieSus->addGpio(gpioIds::CS_SUS_13, susgpio);
@@ -395,61 +403,61 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ADIS_CS, consumer.str(),
- gpio::OUT, gpio::HIGH);
+ gpio::DIR_OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ADIS_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_1_L3G_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_1_L3G_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_1_L3G_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ADIS_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ADIS_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_3_L3G_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_3_L3G_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_3_L3G_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_0_LIS3_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_0_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_0_LIS3_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_1_RM3100_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_1_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_1_RM3100_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_2_LIS3_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_2_CS, consumer.str(),
- gpio::OUT, gpio::HIGH);
+ gpio::DIR_OUT, gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_2_LIS3_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::MGM_3_RM3100_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::MGM_3_CS, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::MGM_3_RM3100_CS, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS0_HANDLER;
// GNSS reset pins are active low
- gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_0, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_NRESET, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GPS1_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::RESET_GNSS_1, consumer.str(), gpio::DIR_OUT,
gpio::HIGH);
gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_NRESET, gpio);
@@ -457,16 +465,28 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
consumer << "0x" << std::hex << objects::GYRO_0_ADIS_HANDLER;
// Enable pins must be pulled low for regular operations
gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_0_ENABLE, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_0_ENABLE, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::GYRO_2_ADIS_HANDLER;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GYRO_2_ENABLE, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieAcsBoard->addGpio(gpioIds::GYRO_2_ENABLE, gpio);
- // TODO: Add enable pins for GPS as soon as new interface board design is finished
+ // Enable pins for GNSS
+ consumer.str("");
+ consumer << "0x" << std::hex << objects::GPS0_HANDLER;
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_0_ENABLE, consumer.str(),
+ gpio::DIR_OUT, gpio::LOW);
+ gpioCookieAcsBoard->addGpio(gpioIds::GNSS_0_ENABLE, gpio);
+
+ consumer.str("");
+ consumer << "0x" << std::hex << objects::GPS1_HANDLER;
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::GNSS_1_ENABLE, consumer.str(), gpio::DIR_OUT,
+ gpio::LOW);
+ gpioCookieAcsBoard->addGpio(gpioIds::GNSS_1_ENABLE, gpio);
+
gpioComIF->addGpios(gpioCookieAcsBoard);
std::string spiDev = q7s::SPI_DEFAULT_DEV;
@@ -509,10 +529,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
// Commented until ACS board V2 in in clean room again
// Gyro 0 Side A
spiCookie = new SpiCookie(addresses::GYRO_0_ADIS, gpioIds::GYRO_0_ADIS_CS, spiDev,
- ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
+ ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
spi::DEFAULT_ADIS16507_SPEED);
- auto adisHandler = new GyroADIS16507Handler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
- spiCookie);
+ auto adisHandler = new GyroADIS1650XHandler(objects::GYRO_0_ADIS_HANDLER, objects::SPI_COM_IF,
+ spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
// Gyro 1 Side A
spiCookie = new SpiCookie(addresses::GYRO_1_L3G, gpioIds::GYRO_1_L3G_CS, spiDev,
@@ -525,10 +545,10 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
#endif
// Gyro 2 Side B
spiCookie = new SpiCookie(addresses::GYRO_2_ADIS, gpioIds::GYRO_2_ADIS_CS, spiDev,
- ADIS16507::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
+ ADIS1650X::MAXIMUM_REPLY_SIZE, spi::DEFAULT_ADIS16507_MODE,
spi::DEFAULT_ADIS16507_SPEED);
- adisHandler = new GyroADIS16507Handler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
- spiCookie);
+ adisHandler = new GyroADIS1650XHandler(objects::GYRO_2_ADIS_HANDLER, objects::SPI_COM_IF,
+ spiCookie, ADIS1650X::Type::ADIS16505);
adisHandler->setStartUpImmediately();
// Gyro 3 Side B
spiCookie = new SpiCookie(addresses::GYRO_3_L3G, gpioIds::GYRO_3_L3G_CS, spiDev,
@@ -550,22 +570,14 @@ void ObjectFactory::createAcsBoardComponents(LinuxLibgpioIF *gpioComIF, UartComI
resetArgsGnss0.gnss1 = false;
resetArgsGnss0.gpioComIF = gpioComIF;
resetArgsGnss0.waitPeriodMs = 100;
- auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_0_DEV,
+ auto uartCookieGps0 = new UartCookie(objects::GPS0_HANDLER, q7s::UART_GNSS_DEV,
UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
uartCookieGps0->setToFlushInput(true);
uartCookieGps0->setReadCycles(6);
- auto uartCookieGps1 = new UartCookie(objects::GPS1_HANDLER, q7s::UART_GNSS_1_DEV,
- UartModes::CANONICAL, uart::GNSS_BAUD, uart::HYPERION_GPS_REPLY_MAX_BUFFER);
- uartCookieGps1->setToFlushInput(true);
- uartCookieGps1->setReadCycles(6);
auto gpsHandler0 = new GPSHyperionHandler(objects::GPS0_HANDLER, objects::UART_COM_IF,
uartCookieGps0, debugGps);
gpsHandler0->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss0);
gpsHandler0->setStartUpImmediately();
- auto gpsHandler1 = new GPSHyperionHandler(objects::GPS1_HANDLER, objects::UART_COM_IF,
- uartCookieGps1, debugGps);
- gpsHandler1->setResetPinTriggerFunction(gps::triggerGpioResetPin, &resetArgsGnss1);
- gpsHandler1->setStartUpImmediately();
}
void ObjectFactory::createHeaterComponents() {
@@ -576,37 +588,37 @@ void ObjectFactory::createHeaterComponents() {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::HEATER_HANDLER;
/* Pin H2-11 on stack connector */
- gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_0, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_0, gpio);
/* Pin H2-12 on stack connector */
- gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_1, gpio);
/* Pin H2-13 on stack connector */
- gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_2, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_2, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_3, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_3, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_4, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_4, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_5, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_5, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_6, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_6, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::HEATER_7, consumer.str(),
- gpio::OUT, gpio::LOW);
+ gpio::DIR_OUT, gpio::LOW);
heaterGpiosCookie->addGpio(gpioIds::HEATER_7, gpio);
new HeaterHandler(objects::HEATER_HANDLER, objects::GPIO_IF, heaterGpiosCookie,
@@ -620,9 +632,9 @@ void ObjectFactory::createSolarArrayDeploymentComponents() {
std::stringstream consumer;
consumer << "0x" << std::hex << objects::SOLAR_ARRAY_DEPL_HANDLER;
gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_0,
- consumer.str(), gpio::OUT, gpio::LOW);
+ consumer.str(), gpio::DIR_OUT, gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA1, gpio);
- gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::SA_DPL_PIN_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
solarArrayDeplCookie->addGpio(gpioIds::DEPLSA2, gpio);
@@ -644,100 +656,100 @@ void ObjectFactory::createSyrlinksComponents() {
void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
GpioCookie* rtdGpioCookie = new GpioCookie;
- GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc0 = new GpioCallback("Chip select RTD IC0", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_3, gpioRtdIc0);
- GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc1 = new GpioCallback("Chip select RTD IC1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_4, gpioRtdIc1);
- GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc2 = new GpioCallback("Chip select RTD IC2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_5, gpioRtdIc2);
- GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc3 = new GpioCallback("Chip select RTD IC3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_6, gpioRtdIc3);
- GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc4 = new GpioCallback("Chip select RTD IC4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_7, gpioRtdIc4);
- GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc5 = new GpioCallback("Chip select RTD IC5", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_8, gpioRtdIc5);
- GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc6 = new GpioCallback("Chip select RTD IC6", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_9, gpioRtdIc6);
- GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc7 = new GpioCallback("Chip select RTD IC7", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_10, gpioRtdIc7);
- GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc8 = new GpioCallback("Chip select RTD IC8", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_11, gpioRtdIc8);
- GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc9 = new GpioCallback("Chip select RTD IC9", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_12, gpioRtdIc9);
- GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc10 = new GpioCallback("Chip select RTD IC10", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_13, gpioRtdIc10);
- GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc11 = new GpioCallback("Chip select RTD IC11", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_14, gpioRtdIc11);
- GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc12 = new GpioCallback("Chip select RTD IC12", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_15, gpioRtdIc12);
- GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc13 = new GpioCallback("Chip select RTD IC13", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_16, gpioRtdIc13);
- GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc14 = new GpioCallback("Chip select RTD IC14", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_17, gpioRtdIc14);
- GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::OUT, gpio::HIGH,
+ GpioCallback* gpioRtdIc15 = new GpioCallback("Chip select RTD IC15", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
rtdGpioCookie->addGpio(gpioIds::RTD_IC_18, gpioRtdIc15);
gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc0 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc1 = new SpiCookie(addresses::RTD_IC_4, gpioIds::RTD_IC_4, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc2 = new SpiCookie(addresses::RTD_IC_5, gpioIds::RTD_IC_5, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc3 = new SpiCookie(addresses::RTD_IC_6, gpioIds::RTD_IC_6, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc4 = new SpiCookie(addresses::RTD_IC_7, gpioIds::RTD_IC_7, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc5 = new SpiCookie(addresses::RTD_IC_8, gpioIds::RTD_IC_8, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc6 = new SpiCookie(addresses::RTD_IC_9, gpioIds::RTD_IC_9, q7s::SPI_DEFAULT_DEV,
- Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc7 = new SpiCookie(addresses::RTD_IC_10, gpioIds::RTD_IC_10,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16,
std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE,
- spi::SpiModes::MODE_1, spi::RTD_SPEED);
+ spi::RTD_MODE, spi::RTD_SPEED);
SpiCookie* spiRtdIc14 = new SpiCookie(addresses::RTD_IC_17, gpioIds::RTD_IC_17,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18,
- q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::SpiModes::MODE_1,
+ q7s::SPI_DEFAULT_DEV, Max31865Definitions::MAX_REPLY_SIZE, spi::RTD_MODE,
spi::RTD_SPEED);
- Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_6, objects::SPI_COM_IF,
+ Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF,
spiRtdIc0);
Max31865PT1000Handler* rtdIc1 = new Max31865PT1000Handler(objects::RTD_IC_4, objects::SPI_COM_IF,
spiRtdIc1);
@@ -773,6 +785,11 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
rtdIc0->setStartUpImmediately();
rtdIc1->setStartUpImmediately();
rtdIc2->setStartUpImmediately();
+#if OBSW_DEBUG_RTD == 1
+ rtdIc0->setInstantNormal(true);
+ rtdIc1->setInstantNormal(true);
+ rtdIc2->setInstantNormal(true);
+#endif
static_cast(rtdIc0);
static_cast(rtdIc1);
@@ -794,50 +811,41 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
void ObjectFactory::createReactionWheelComponents(LinuxLibgpioIF* gpioComIF) {
GpioCookie* gpioCookieRw = new GpioCookie;
- GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::OUT, gpio::HIGH,
+ GpioCallback* csRw1 = new GpioCallback("Chip select reaction wheel 1", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW1, csRw1);
- GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::OUT, gpio::HIGH,
+ GpioCallback* csRw2 = new GpioCallback("Chip select reaction wheel 2", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW2, csRw2);
- GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::OUT, gpio::HIGH,
+ GpioCallback* csRw3 = new GpioCallback("Chip select reaction wheel 3", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW3, csRw3);
- GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::OUT, gpio::HIGH,
+ GpioCallback* csRw4 = new GpioCallback("Chip select reaction wheel 4", gpio::DIR_OUT, gpio::HIGH,
&gpioCallbacks::spiCsDecoderCallback, gpioComIF);
gpioCookieRw->addGpio(gpioIds::CS_RW4, csRw4);
std::stringstream consumer;
GpiodRegularByLineName* gpio = nullptr;
consumer << "0x" << std::hex << objects::RW1;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_1, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW1, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW2;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_2, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW2, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW3;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_3, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW3, gpio);
consumer.str("");
consumer << "0x" << std::hex << objects::RW4;
- gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::EN_RW_4, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRw->addGpio(gpioIds::EN_RW4, gpio);
- /**
- * This GPIO is only internally connected to the SPI MUX module and responsible to disconnect
- * the PS SPI peripheral from the SPI interface and route out the SPI lines of the AXI SPI core.
- * Per default the PS SPI is selected (EMIO = 0).
- */
- gpio = new GpiodRegularByLineName(q7s::gpioNames::SPI_MUX_SELECT,
- "SPI Reaction Wheel Callback ", gpio::OUT, gpio::LOW);
- gpioCookieRw->addGpio(gpioIds::SPI_MUX, gpio);
-
gpioComIF->addGpios(gpioCookieRw);
auto rw1SpiCookie = new SpiCookie(addresses::RW1, gpioIds::CS_RW1, q7s::SPI_RW_DEV,
@@ -942,7 +950,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
consumer.str("");
consumer << "ptme rate setter";
// Init to low -> default bit rate is low bit rate (200 kbps in downlink with syrlinks)
- gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::BIT_RATE_SEL, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookieRateSetter->addGpio(gpioIds::BIT_RATE_SEL, gpio);
gpioComIF->addGpios(gpioCookieRateSetter);
@@ -967,7 +975,7 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
consumer.str("");
consumer << "0x" << std::hex << objects::PDEC_HANDLER;
// GPIO also low after linux boot (specified by device-tree)
- gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), gpio::OUT,
+ gpio = new GpiodRegularByLineName(q7s::gpioNames::PDEC_RESET, consumer.str(), gpio::DIR_OUT,
gpio::LOW);
gpioCookiePdec->addGpio(gpioIds::PDEC_RESET, gpio);
@@ -980,18 +988,18 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) {
#if BOARD_TE0720 == 0
GpioCookie* gpioRS485Chip = new GpioCookie;
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver",
- gpio::Direction::OUT, gpio::LOW);
+ gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_CLOCK, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver",
- gpio::Direction::OUT, gpio::LOW);
+ gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio);
// Default configuration enables RX channels (RXEN = LOW)
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_CLOCK, "RS485 Transceiver",
- gpio::Direction::OUT, gpio::LOW);
+ gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_CLOCK, gpio);
gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_RX_DATA, "RS485 Transceiver",
- gpio::Direction::OUT, gpio::LOW);
+ gpio::Direction::DIR_OUT, gpio::LOW);
gpioRS485Chip->addGpio(gpioIds::RS485_EN_RX_DATA, gpio);
gpioComIF->addGpios(gpioRS485Chip);
@@ -1007,10 +1015,10 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_LIBGPIOD == 1
#if OBSW_TEST_GPIO_OPEN_BYLABEL == 1
/* Configure MIO0 as input */
- GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::OUT, 0, "/amba_pl/gpio@41200000", 0);
+ GpiodRegular* testGpio = new GpiodRegular("MIO0", gpio::DIR_OUT, 0, "/amba_pl/gpio@41200000", 0);
#elif OBSW_TEST_GPIO_OPEN_BY_LINE_NAME
GpiodRegularByLineName* testGpio = new GpiodRegularByLineName("test-name", "gpio-test",
- gpio::OUT, 0);
+ gpio::DIR_OUT, 0);
#else
/* Configure MIO0 as input */
GpiodRegular* testGpio = new GpiodRegular("gpiochip0", 0, "MIO0", gpio::IN, 0);
@@ -1023,7 +1031,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_SUS_HANDLER == 1
GpioCookie* gpioCookieSus = new GpioCookie;
GpiodRegular* chipSelectSus = new GpiodRegular(std::string("gpiochip1"), 9,
- std::string("Chip Select Sus Sensor"), gpio::OUT, 1);
+ std::string("Chip Select Sus Sensor"), gpio::DIR_OUT, 1);
gpioCookieSus->addGpio(gpioIds::CS_SUS_1, chipSelectSus);
gpioComIF->addGpios(gpioCookieSus);
@@ -1051,7 +1059,7 @@ void ObjectFactory::createTestComponents(LinuxLibgpioIF* gpioComIF) {
#if BOARD_TE0720 == 1 && OBSW_TEST_RADIATION_SENSOR_HANDLER == 1
GpioCookie* gpioCookieRadSensor = new GpioCookie;
GpiodRegular* chipSelectRadSensor = new GpiodRegular(std::string("gpiochip1"), 0,
- std::string("Chip select radiation sensor"), gpio::OUT, 1);
+ std::string("Chip select radiation sensor"), gpio::DIR_OUT, 1);
gpioCookieRadSensor->addGpio(gpioIds::CS_RAD_SENSOR, chipSelectRadSensor);
gpioComIF->addGpios(gpioCookieRadSensor);
diff --git a/bsp_q7s/devices/CMakeLists.txt b/bsp_q7s/devices/CMakeLists.txt
index 6347b5f8..70705e83 100644
--- a/bsp_q7s/devices/CMakeLists.txt
+++ b/bsp_q7s/devices/CMakeLists.txt
@@ -2,4 +2,6 @@ target_sources(${TARGET_NAME} PRIVATE
PlocSupervisorHandler.cpp
PlocUpdater.cpp
PlocMemoryDumper.cpp
-)
\ No newline at end of file
+)
+
+add_subdirectory(startracker)
\ No newline at end of file
diff --git a/bsp_q7s/devices/PlocUpdater.cpp b/bsp_q7s/devices/PlocUpdater.cpp
index 5a94495b..592a2c0d 100644
--- a/bsp_q7s/devices/PlocUpdater.cpp
+++ b/bsp_q7s/devices/PlocUpdater.cpp
@@ -168,14 +168,14 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
#if BOARD_TE0720 == 0
// Check if file is stored on SD card and if associated SD card is mounted
if (std::string(reinterpret_cast(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_0_MOUNT_POINT)) {
- if (!isSdCardMounted(sd::SLOT_0)) {
- sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 0 not mounted" << std::endl;
+ if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
+ sif::warning << "PlocUpdater::getImageLocation: SD card 0 not mounted" << std::endl;
return SD_NOT_MOUNTED;
}
}
else if (std::string(reinterpret_cast(data), SD_PREFIX_LENGTH) == std::string(SdCardManager::SD_1_MOUNT_POINT)) {
- if (!isSdCardMounted(sd::SLOT_0)) {
- sif::warning << "PlocUpdater::prepareNvm0AUpdate: SD card 1 not mounted" << std::endl;
+ if (!sdcMan->isSdCardMounted(sd::SLOT_0)) {
+ sif::warning << "PlocUpdater::getImageLocation: SD card 1 not mounted" << std::endl;
return SD_NOT_MOUNTED;
}
}
@@ -193,37 +193,6 @@ ReturnValue_t PlocUpdater::getImageLocation(const uint8_t* data, size_t size) {
return RETURN_OK;
}
-#if BOARD_TE0720 == 0
-bool PlocUpdater::isSdCardMounted(sd::SdCard sdCard) {
- SdCardManager::SdStatePair active;
- ReturnValue_t result = sdcMan->getSdCardActiveStatus(active);
- if (result != RETURN_OK) {
- sif::debug << "PlocUpdater::isSdCardMounted: Failed to get SD card active state";
- return false;
- }
- if (sdCard == sd::SLOT_0) {
- if (active.first == sd::MOUNTED) {
- return true;
- }
- else {
- return false;
- }
- }
- else if (sdCard == sd::SLOT_1) {
- if (active.second == sd::MOUNTED) {
- return true;
- }
- else {
- return false;
- }
- }
- else {
- sif::debug << "PlocUpdater::isSdCardMounted: Unknown SD card specified" << std::endl;
- }
- return false;
-}
-#endif /* #if BOARD_TE0720 == 0 */
-
void PlocUpdater::stepSuccessfulReceived(ActionId_t actionId,
uint8_t step) {
}
diff --git a/bsp_q7s/devices/PlocUpdater.h b/bsp_q7s/devices/PlocUpdater.h
index 50404d14..d016b9e5 100644
--- a/bsp_q7s/devices/PlocUpdater.h
+++ b/bsp_q7s/devices/PlocUpdater.h
@@ -174,13 +174,6 @@ private:
*/
void commandUpdateVerify();
-#if BOARD_TE0720 == 0
- /**
- * @brief Checks whether the SD card to read from is mounted or not.
- */
- bool isSdCardMounted(sd::SdCard sdCard);
-#endif
-
void calcImageCrc();
void adjustSequenceFlags(PLOC_SPV::UpdatePacket& packet);
diff --git a/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.cpp b/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.cpp
new file mode 100644
index 00000000..4e7c9458
--- /dev/null
+++ b/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.cpp
@@ -0,0 +1,78 @@
+#include "ArcsecDatalinkLayer.h"
+
+ArcsecDatalinkLayer::ArcsecDatalinkLayer() {
+ slipInit();
+}
+
+ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {
+}
+
+void ArcsecDatalinkLayer::slipInit() {
+ slipInfo.buffer = rxBuffer;
+ slipInfo.maxlength = StarTracker::MAX_FRAME_SIZE;
+ slipInfo.length = 0;
+ slipInfo.unescape_next = 0;
+ slipInfo.prev_state = SLIP_COMPLETE;
+}
+
+ReturnValue_t ArcsecDatalinkLayer::decodeFrame(const uint8_t* rawData, size_t rawDataSize,
+ size_t* bytesLeft) {
+ size_t bytePos = 0;
+ for (bytePos = 0; bytePos < rawDataSize; bytePos++) {
+ enum arc_dec_result decResult = arc_transport_decode_body(*(rawData + bytePos), &slipInfo,
+ decodedFrame, &decFrameSize);
+ *bytesLeft = rawDataSize - bytePos - 1;
+ switch (decResult) {
+ case ARC_DEC_INPROGRESS: {
+ if (bytePos == rawDataSize - 1) {
+ return DEC_IN_PROGRESS;
+ }
+ continue;
+ }
+ case ARC_DEC_ERROR_FRAME_SHORT:
+ return REPLY_TOO_SHORT;
+ case ARC_DEC_ERROR_CHECKSUM:
+ return CRC_FAILURE;
+ case ARC_DEC_ASYNC:
+ case ARC_DEC_SYNC: {
+ // Reset length of SLIP struct for next frame
+ slipInfo.length = 0;
+ return RETURN_OK;
+ }
+ default:
+ sif::debug << "ArcsecDatalinkLayer::decodeFrame: Unknown result code" << std::endl;
+ break;
+ return RETURN_FAILED;
+ }
+ }
+ return RETURN_FAILED;
+}
+
+uint8_t ArcsecDatalinkLayer::getReplyFrameType() {
+ return decodedFrame[0];
+}
+
+const uint8_t* ArcsecDatalinkLayer::getReply() {
+ return &decodedFrame[1];
+}
+
+void ArcsecDatalinkLayer::encodeFrame(const uint8_t* data, uint32_t length) {
+ arc_transport_encode_body(data, length, encBuffer, &encFrameSize);
+}
+
+uint8_t* ArcsecDatalinkLayer::getEncodedFrame() {
+ return encBuffer;
+}
+
+uint32_t ArcsecDatalinkLayer::getEncodedLength() {
+ return encFrameSize;
+}
+
+uint8_t ArcsecDatalinkLayer::getStatusField() {
+ return *(decodedFrame + STATUS_OFFSET);
+}
+
+uint8_t ArcsecDatalinkLayer::getId() {
+ return *(decodedFrame + ID_OFFSET);
+}
+
diff --git a/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.h b/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.h
new file mode 100644
index 00000000..a65881c7
--- /dev/null
+++ b/bsp_q7s/devices/startracker/ArcsecDatalinkLayer.h
@@ -0,0 +1,100 @@
+#ifndef BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
+#define BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_
+
+#include "StarTrackerDefinitions.h"
+#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+
+extern "C" {
+ #include "common/misc.h"
+}
+
+/**
+ * @brief Helper class to handle the datalinklayer of replies from the star tracker of arcsec.
+ */
+class ArcsecDatalinkLayer: public HasReturnvaluesIF {
+public:
+
+ static const uint8_t INTERFACE_ID = CLASS_ID::STR_HANDLER;
+
+ //! [EXPORT] : [COMMENT] More data required to complete frame
+ static const ReturnValue_t DEC_IN_PROGRESS = MAKE_RETURN_CODE(0xA0);
+ //! [EXPORT] : [COMMENT] Data too short to represent a valid frame
+ static const ReturnValue_t REPLY_TOO_SHORT = MAKE_RETURN_CODE(0xA1);
+ //! [EXPORT] : [COMMENT] Detected CRC failure in received frame
+ static const ReturnValue_t CRC_FAILURE = MAKE_RETURN_CODE(0xA2);
+
+ static const uint8_t STATUS_OK = 0;
+
+ ArcsecDatalinkLayer();
+ virtual ~ArcsecDatalinkLayer();
+
+ /**
+ * @brief Applies decoding to data referenced by rawData pointer
+ *
+ * @param rawData Pointer to raw data received from star tracker
+ * @param rawDataSize Size of raw data stream
+ * @param remainingBytes Number of bytes left
+ */
+ ReturnValue_t decodeFrame(const uint8_t* rawData, size_t rawDataSize, size_t* bytesLeft);
+
+ /**
+ * @brief SLIP encodes data pointed to by data pointer.
+ *
+ * @param data Pointer to data to encode
+ * @param length Length of buffer to encode
+ */
+ void encodeFrame(const uint8_t* data, uint32_t length);
+
+ /**
+ * @brief Returns the frame type field of a decoded frame.
+ */
+ uint8_t getReplyFrameType();
+
+ /**
+ * @brief Returns pointer to reply packet (first entry normally action ID, telemetry ID etc.)
+ */
+ const uint8_t* getReply();
+
+ /**
+ * @brief Returns size of encoded frame
+ */
+ uint32_t getEncodedLength();
+
+ /**
+ * @brief Returns pointer to encoded frame
+ */
+ uint8_t* getEncodedFrame();
+
+ /**
+ * @brief Returns status of reply
+ */
+ uint8_t getStatusField();
+
+ /**
+ * @brief Returns ID of reply
+ */
+ uint8_t getId();
+
+private:
+
+ static const uint8_t ID_OFFSET = 1;
+ static const uint8_t STATUS_OFFSET = 2;
+
+ // Used by arcsec slip decoding function process received data
+ uint8_t rxBuffer[StarTracker::MAX_FRAME_SIZE];
+ // Decoded frame will be copied to this buffer
+ uint8_t decodedFrame[StarTracker::MAX_FRAME_SIZE];
+ // Buffer where encoded frames will be stored. First byte of encoded frame represents type of
+ // reply
+ uint8_t encBuffer[StarTracker::MAX_FRAME_SIZE * 2 + 2];
+ // Size of decoded frame
+ uint32_t decFrameSize = 0;
+ // Size of encoded frame
+ uint32_t encFrameSize = 0;
+
+ slip_decode_state slipInfo;
+
+ void slipInit();
+};
+
+#endif /* BSP_Q7S_DEVICES_ARCSECDATALINKLAYER_H_ */
diff --git a/bsp_q7s/devices/startracker/ArcsecJsonKeys.h b/bsp_q7s/devices/startracker/ArcsecJsonKeys.h
new file mode 100644
index 00000000..2c598b43
--- /dev/null
+++ b/bsp_q7s/devices/startracker/ArcsecJsonKeys.h
@@ -0,0 +1,126 @@
+#ifndef BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
+#define BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_
+
+/**
+ * @brief Keys used in JSON file of ARCSEC.
+ */
+namespace arcseckeys {
+ static const char PROPERTIES[] = "properties";
+ static const char NAME[] = "name";
+ static const char VALUE[] = "value";
+
+ static const char LIMITS[] = "limits";
+ static const char ACTION[] = "action";
+ static const char FPGA18CURRENT[] = "FPGA18Current";
+ static const char FPGA25CURRENT[] = "FPGA25Current";
+ static const char FPGA10CURRENT[] = "FPGA10Current";
+ static const char MCUCURRENT[] = "MCUCurrent";
+ static const char CMOS21CURRENT[] = "CMOS21Current";
+ static const char CMOSPIXCURRENT[] = "CMOSPixCurrent";
+ static const char CMOS33CURRENT[] = "CMOS33Current";
+ static const char CMOSVRESCURRENT[] = "CMOSVResCurrent";
+ static const char CMOS_TEMPERATURE[] = "CMOSTemperature";
+ static const char MCU_TEMPERATURE[] = "MCUTemperature";
+
+ static const char MOUNTING[] = "mounting";
+ static const char qw[] = "qw";
+ static const char qx[] = "qx";
+ static const char qy[] = "qy";
+ static const char qz[] = "qz";
+
+ static const char CAMERA[] = "camera";
+ static const char MODE[] = "mode";
+ static const char FOCALLENGTH[] = "focallength";
+ static const char EXPOSURE[] = "exposure";
+ static const char INTERVAL[] = "interval";
+ static const char OFFSET[] = "offset";
+ static const char PGAGAIN[] = "PGAGain";
+ static const char ADCGAIN[] = "ADCGain";
+ static const char REG_1[] = "reg1";
+ static const char VAL_1[] = "val1";
+ static const char REG_2[] = "reg2";
+ static const char VAL_2[] = "val2";
+ static const char REG_3[] = "reg3";
+ static const char VAL_3[] = "val3";
+ static const char REG_4[] = "reg4";
+ static const char VAL_4[] = "val4";
+ static const char REG_5[] = "reg5";
+ static const char VAL_5[] = "val5";
+ static const char REG_6[] = "reg6";
+ static const char VAL_6[] = "val6";
+ static const char REG_7[] = "reg7";
+ static const char VAL_7[] = "val7";
+ static const char REG_8[] = "reg8";
+ static const char VAL_8[] = "val8";
+ static const char FREQ_1[] = "freq1";
+ static const char FREQ_2[] = "freq2";
+
+ static const char BLOB[] = "blob";
+ static const char MIN_VALUE[] = "minValue";
+ static const char MIN_DISTANCE[] = "minDistance";
+ static const char NEIGHBOUR_DISTANCE[] = "neighbourDistance";
+ static const char NEIGHBOUR_BRIGHT_PIXELS[] = "neighbourBrightPixels";
+ static const char MIN_TOTAL_VALUE[] = "minTotalValue";
+ static const char MAX_TOTAL_VALUE[] = "maxTotalValue";
+ static const char MIN_BRIGHT_NEIGHBOURS[] = "minBrightNeighbours";
+ static const char MAX_BRIGHT_NEIGHBOURS[] = "maxBrightNeighbours";
+ static const char MAX_PIXEL_TO_CONSIDER[] = "maxPixelsToConsider";
+ static const char SIGNAL_THRESHOLD[] = "signalThreshold";
+ static const char DARK_THRESHOLD[] = "darkThreshold";
+ static const char ENABLE_HISTOGRAM[] = "enableHistogram";
+ static const char ENABLE_CONTRAST[] = "enableContrast";
+ static const char BIN_MODE[] = "binMode";
+
+ static const char CENTROIDING[] = "centroiding";
+ static const char ENABLE_FILTER[] = "enableFilter";
+ static const char MAX_QUALITY[] = "maxquality";
+ static const char MIN_QUALITY[] = "minquality";
+ static const char MAX_INTENSITY[] = "maxintensity";
+ static const char MIN_INTENSITY[] = "minintensity";
+ static const char MAX_MAGNITUDE[] = "maxmagnitude";
+ static const char GAUSSIAN_CMAX[] = "gaussianCmax";
+ static const char GAUSSIAN_CMIN[] = "gaussianCmin";
+ static const char TRANSMATRIX_00[] = "transmatrix00";
+ static const char TRANSMATRIX_01[] = "transmatrix01";
+ static const char TRANSMATRIX_10[] = "transmatrix10";
+ static const char TRANSMATRIX_11[] = "transmatrix11";
+
+ static const char LISA[] = "lisa";
+ static const char PREFILTER_DIST_THRESHOLD[] = "prefilterDistThreshold";
+ static const char PREFILTER_ANGLE_THRESHOLD[] = "prefilterAngleThreshold";
+ static const char FOV_WIDTH[] = "fov_width";
+ static const char FOV_HEIGHT[] = "fov_height";
+ static const char FLOAT_STAR_LIMIT[] = "float_star_limit";
+ static const char CLOSE_STAR_LIMIT[] = "close_star_limit";
+ static const char RATING_WEIGHT_CLOSE_STAR_COUNT[] = "rating_weight_close_star_count";
+ static const char RATING_WEIGHT_FRACTION_CLOSE[] = "rating_weight_fraction_close";
+ static const char RATING_WEIGHT_MEAN_SUM[] = "rating_weight_mean_sum";
+ static const char RATING_WEIGHT_DB_STAR_COUNT[] = "rating_weight_db_star_count";
+ static const char MAX_COMBINATIONS[] = "max_combinations";
+ static const char NR_STARS_STOP[] = "nr_stars_stop";
+ static const char FRACTION_CLOSE_STOP[] = "fraction_close_stop";
+
+ static const char MATCHING[] = "matching";
+ static const char SQUARED_DISTANCE_LIMIT[] = "squaredDistanceLimit";
+ static const char SQUARED_SHIFT_LIMIT[] = "squaredShiftLimit";
+
+ static const char VALIDATION[] = "validation";
+ static const char STABLE_COUNT[] = "stable_count";
+ static const char MAX_DIFFERENCE[] = "max_difference";
+ static const char MIN_TRACKER_CONFIDENCE[] = "min_trackerConfidence";
+ static const char MIN_MATCHED_STARS[] = "min_matchedStars";
+
+ static const char TRACKING[] = "tracking";
+ static const char THIN_LIMIT[] = "thinLimit";
+ static const char OUTLIER_THRESHOLD[] = "outlierThreshold";
+ static const char OUTLIER_THRESHOLD_QUEST[] = "outlierThresholdQUEST";
+ static const char TRACKER_CHOICE[] = "trackerChoice";
+
+ static const char ALGO[] = "algo";
+ static const char L2T_MIN_CONFIDENCE[] = "l2t_minConfidence";
+ static const char L2T_MIN_MATCHED[] = "l2t_minConfidence";
+ static const char T2L_MIN_CONFIDENCE[] = "t2l_minConfidence";
+ static const char T2L_MIN_MATCHED[] = "t2l_minMatched";
+}
+
+#endif /* BSP_Q7S_DEVICES_DEVICEDEFINITIONS_ARCSECJSONKEYS_H_ */
diff --git a/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp
new file mode 100644
index 00000000..339c3fe7
--- /dev/null
+++ b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.cpp
@@ -0,0 +1,94 @@
+#include "ArcsecJsonParamBase.h"
+#include "ArcsecJsonKeys.h"
+
+ArcsecJsonParamBase::ArcsecJsonParamBase(std::string setName) : setName(setName) {}
+
+ReturnValue_t ArcsecJsonParamBase::create(std::string fullname, uint8_t* buffer) {
+ ReturnValue_t result = RETURN_OK;
+ result = init(fullname);
+ if (result != RETURN_OK) {
+ return result;
+ }
+ result = createCommand(buffer);
+ return result;
+}
+
+ReturnValue_t ArcsecJsonParamBase::getParam(const std::string name, std::string& value) {
+ for (json::iterator it = set.begin(); it != set.end(); ++it) {
+ if ((*it)[arcseckeys::NAME] == name) {
+ value = (*it)[arcseckeys::VALUE];
+ convertEmpty(value);
+ return RETURN_OK;
+ }
+ }
+ return PARAM_NOT_EXISTS;
+}
+
+void ArcsecJsonParamBase::convertEmpty(std::string& value) {
+ if (value == "") {
+ value = "0";
+ }
+}
+
+void ArcsecJsonParamBase::addfloat(const std::string value, uint8_t* buffer) {
+ float param = std::stof(value);
+ std::memcpy(buffer, ¶m, sizeof(param));
+}
+
+void ArcsecJsonParamBase::adduint8(const std::string value, uint8_t* buffer) {
+ uint8_t param = std::stoi(value);
+ std::memcpy(buffer, ¶m, sizeof(param));
+}
+
+void ArcsecJsonParamBase::addint16(const std::string value, uint8_t* buffer) {
+ int16_t param = std::stoi(value);
+ std::memcpy(buffer, ¶m, sizeof(param));
+}
+
+void ArcsecJsonParamBase::adduint16(const std::string value, uint8_t* buffer) {
+ uint16_t param = std::stoi(value);
+ std::memcpy(buffer, ¶m, sizeof(param));
+}
+
+void ArcsecJsonParamBase::adduint32(const std::string value, uint8_t* buffer) {
+ uint32_t param = std::stoi(value);
+ std::memcpy(buffer, ¶m, sizeof(param));
+}
+
+void ArcsecJsonParamBase::addSetParamHeader(uint8_t* buffer, uint8_t setId) {
+ *buffer = static_cast(TMTC_SETPARAMREQ);
+ *(buffer + 1) = setId;
+}
+
+ReturnValue_t ArcsecJsonParamBase::init(const std::string filename) {
+ ReturnValue_t result = RETURN_OK;
+ if (not std::filesystem::exists(filename)) {
+ sif::warning << "ArcsecJsonParamBase::init: JSON file " << filename << " does not exist"
+ << std::endl;
+ return JSON_FILE_NOT_EXISTS;
+ }
+ createJsonObject(filename);
+ result = initSet();
+ if (result != RETURN_OK) {
+ return result;
+ }
+ return RETURN_OK;
+}
+
+void ArcsecJsonParamBase::createJsonObject(const std::string fullname) {
+ json j;
+ std::ifstream file(fullname);
+ file >> j;
+ file.close();
+ properties = j[arcseckeys::PROPERTIES];
+}
+
+ReturnValue_t ArcsecJsonParamBase::initSet() {
+ for (json::iterator it = properties.begin(); it != properties.end(); ++it) {
+ if ((*it)["name"] == setName) {
+ set = (*it)["fields"];
+ return RETURN_OK;
+ }
+ }
+ return SET_NOT_EXISTS;
+}
diff --git a/bsp_q7s/devices/startracker/ArcsecJsonParamBase.h b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.h
new file mode 100644
index 00000000..320eff53
--- /dev/null
+++ b/bsp_q7s/devices/startracker/ArcsecJsonParamBase.h
@@ -0,0 +1,149 @@
+#ifndef BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
+#define BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_
+
+#include
+#include
+#include
+
+#include "fsfw/returnvalues/HasReturnvaluesIF.h"
+#include "StarTrackerDefinitions.h"
+
+extern "C" {
+ #include "thirdparty/arcsec_star_tracker/common/generated/tmtcstructs.h"
+ #include "thirdparty/arcsec_star_tracker/common/genericstructs.h"
+}
+
+using json = nlohmann::json;
+
+/**
+ * @brief Base class for creation of parameter configuration commands. Reads parameter set
+ * from a json file located on the filesystem and generates the appropriate command
+ * to apply the parameters to the star tracker software.
+ *
+ * @author J. Meier
+ */
+class ArcsecJsonParamBase : public HasReturnvaluesIF {
+public:
+
+ static const uint8_t INTERFACE_ID = CLASS_ID::ARCSEC_JSON_BASE;
+ //! [EXPORT] : [COMMENT] Specified json file does not exist
+ static const ReturnValue_t JSON_FILE_NOT_EXISTS = MAKE_RETURN_CODE(1);
+ //! [EXPORT] : [COMMENT] Requested set does not exist in json file
+ static const ReturnValue_t SET_NOT_EXISTS = MAKE_RETURN_CODE(2);
+ //! [EXPORT] : [COMMENT] Requested parameter does not exist in json file
+ static const ReturnValue_t PARAM_NOT_EXISTS = MAKE_RETURN_CODE(3);
+
+ /**
+ * @brief Constructor
+ *
+ * @param fullname Name with absolute path of json file containing the parameters to set.
+ */
+ ArcsecJsonParamBase(std::string setName);
+
+ /**
+ * @brief Fills a buffer with a parameter set
+ *
+ * @param fullname The name including the absolute path of the json file containing the
+ * parameter set.
+ * @param buffer Pointer to the buffer the command will be written to
+ */
+ ReturnValue_t create(std::string fullname, uint8_t* buffer);
+
+ /**
+ * @brief Returns the size of the parameter command.
+ */
+ virtual size_t getSize() = 0;
+
+protected:
+
+ /**
+ * @brief Reads the value of a parameter from a json set
+ *
+ * @param name The name of the parameter
+ * @param value The string representation of the read value
+ *
+ * @return RETURN_OK if successful, otherwise PARAM_NOT_EXISTS
+ */
+ ReturnValue_t getParam(const std::string name, std::string& value);
+
+ /**
+ * @brief Converts empty string which is equal to define a value as zero.
+ */
+ void convertEmpty(std::string& value);
+
+ /**
+ * @brief This function adds a float represented as string to a buffer
+ *
+ * @param value The float in string representation to add
+ * @param buffer Pointer to the buffer the float will be written to
+ */
+ void addfloat(const std::string value, uint8_t* buffer);
+
+ /**
+ * @brief This function adds a uint8_t represented as string to a buffer
+ *
+ * @param value The uint8_t in string representation to add
+ * @param buffer Pointer to the buffer the uint8_t will be written to
+ */
+ void adduint8(const std::string value, uint8_t* buffer);
+
+ /**
+ * @brief This function adds a int16_t represented as string to a buffer
+ *
+ * @param value The int16_t in string representation to add
+ * @param buffer Pointer to the buffer the int16_t will be written to
+ */
+ void addint16(const std::string value, uint8_t* buffer);
+
+ /**
+ * @brief This function adds a uint16_t represented as string to a buffer
+ *
+ * @param value The uint16_t in string representation to add
+ * @param buffer Pointer to the buffer the uint16_t will be written to
+ */
+ void adduint16(const std::string value, uint8_t* buffer);
+
+ /**
+ * @brief This function adds a uint32_t represented as string to a buffer
+ *
+ * @param value The uint32_t in string representation to add
+ * @param buffer Pointer to the buffer the uint32_t will be written to
+ */
+ void adduint32(const std::string value, uint8_t* buffer);
+
+ void addSetParamHeader(uint8_t* buffer, uint8_t setId);
+
+private:
+
+ json properties;
+ json set;
+ std::string setName;
+
+ /**
+ * @brief This function must be implemented by the derived class to define creation of a
+ * parameter command.
+ */
+ virtual ReturnValue_t createCommand(uint8_t* buffer) = 0;
+
+ /**
+ * @brief Initializes the properties json object and the set json object
+ *
+ * @param fullname Name including absolute path to json file
+ * @param setName The name of the set to work on
+ *
+ * @param return JSON_FILE_NOT_EXISTS if specified file does not exist, otherwise
+ * RETURN_OK
+ */
+ ReturnValue_t init(const std::string filename);
+
+ void createJsonObject(const std::string fullname);
+
+ /**
+ * @brief Extracts the json set object form the json file
+ *
+ * @param setName The name of the set to create the json object from
+ */
+ ReturnValue_t initSet();
+};
+
+#endif /* BSP_Q7S_DEVICES_STARTRACKER_ARCSECJSONPARAMBASE_H_ */
diff --git a/bsp_q7s/devices/startracker/CMakeLists.txt b/bsp_q7s/devices/startracker/CMakeLists.txt
new file mode 100644
index 00000000..28704219
--- /dev/null
+++ b/bsp_q7s/devices/startracker/CMakeLists.txt
@@ -0,0 +1,7 @@
+target_sources(${TARGET_NAME} PRIVATE
+ StarTrackerHandler.cpp
+ StarTrackerJsonCommands.cpp
+ ArcsecDatalinkLayer.cpp
+ ArcsecJsonParamBase.cpp
+ StrHelper.cpp
+)
\ No newline at end of file
diff --git a/bsp_q7s/devices/startracker/StarTrackerDefinitions.h b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h
new file mode 100644
index 00000000..f1f7b7d0
--- /dev/null
+++ b/bsp_q7s/devices/startracker/StarTrackerDefinitions.h
@@ -0,0 +1,1210 @@
+#ifndef MISSION_STARTRACKER_DEFINITIONS_H_
+#define MISSION_STARTRACKER_DEFINITIONS_H_
+
+#include
+#include
+#include
+#include
+#include "objects/systemObjectList.h"
+#include
+
+namespace StarTracker {
+
+/** This is the address of the star tracker */
+static const uint8_t ADDRESS = 33;
+
+static const uint8_t STATUS_OK = 0;
+
+enum PoolIds: lp_id_t {
+ TICKS_TIME_SET,
+ TIME_TIME_SET,
+ RUN_TIME,
+ UNIX_TIME,
+ TICKS_VERSION_SET,
+ TIME_VERSION_SET,
+ PROGRAM,
+ MAJOR,
+ MINOR,
+ TICKS_INTERFACE_SET,
+ TIME_INTERFACE_SET,
+ FRAME_COUNT,
+ CHECKSUM_ERROR_COUNT,
+ SET_PARAM_COUNT,
+ SET_PARAM_REPLY_COUNT,
+ PARAM_REQUEST_COUNT,
+ PARAM_REPLY_COUNT,
+ REQ_TM_COUNT,
+ TM_REPLY_COUNT,
+ ACTION_REQ_COUNT,
+ ACTION_REPLY_COUNT,
+ TICKS_POWER_SET,
+ TIME_POWER_SET,
+ MCU_CURRENT,
+ MCU_VOLTAGE,
+ FPGA_CORE_CURRENT,
+ FPGA_CORE_VOLTAGE,
+ FPGA_18_CURRENT,
+ FPGA_18_VOLTAGE,
+ FPGA_25_CURRENT,
+ FPGA_25_VOLTAGE,
+ CMV_21_CURRENT,
+ CMV_21_VOLTAGE,
+ CMV_PIX_CURRENT,
+ CMV_PIX_VOLTAGE,
+ CMV_33_CURRENT,
+ CMV_33_VOLTAGE,
+ CMV_RES_CURRENT,
+ CMV_RES_VOLTAGE,
+ TICKS_TEMPERATURE_SET,
+ TIME_TEMPERATURE_SET,
+ MCU_TEMPERATURE,
+ CMOS_TEMPERATURE,
+ TICKS_SOLUTION_SET,
+ TIME_SOLUTION_SET,
+ CALI_QW,
+ CALI_QX,
+ CALI_QY,
+ CALI_QZ,
+ TRACK_CONFIDENCE,
+ TRACK_QW,
+ TRACK_QX,
+ TRACK_QY,
+ TRACK_QZ,
+ TRACK_REMOVED,
+ STARS_CENTROIDED,
+ STARS_MATCHED_DATABASE,
+ LISA_QW,
+ LISA_QX,
+ LISA_QY,
+ LISA_QZ,
+ LISA_PERC_CLOSE,
+ LISA_NR_CLOSE,
+ TRUST_WORTHY,
+ STABLE_COUNT,
+ SOLUTION_STRATEGY,
+ TICKS_HISTOGRAM_SET,
+ TIME_HISTOGRAM_SET,
+ HISTOGRAM_BINA0,
+ HISTOGRAM_BINA1,
+ HISTOGRAM_BINA2,
+ HISTOGRAM_BINA3,
+ HISTOGRAM_BINA4,
+ HISTOGRAM_BINA5,
+ HISTOGRAM_BINA6,
+ HISTOGRAM_BINA7,
+ HISTOGRAM_BINA8,
+ HISTOGRAM_BINB0,
+ HISTOGRAM_BINB1,
+ HISTOGRAM_BINB2,
+ HISTOGRAM_BINB3,
+ HISTOGRAM_BINB4,
+ HISTOGRAM_BINB5,
+ HISTOGRAM_BINB6,
+ HISTOGRAM_BINB7,
+ HISTOGRAM_BINB8,
+ HISTOGRAM_BINC0,
+ HISTOGRAM_BINC1,
+ HISTOGRAM_BINC2,
+ HISTOGRAM_BINC3,
+ HISTOGRAM_BINC4,
+ HISTOGRAM_BINC5,
+ HISTOGRAM_BINC6,
+ HISTOGRAM_BINC7,
+ HISTOGRAM_BINC8,
+ HISTOGRAM_BIND0,
+ HISTOGRAM_BIND1,
+ HISTOGRAM_BIND2,
+ HISTOGRAM_BIND3,
+ HISTOGRAM_BIND4,
+ HISTOGRAM_BIND5,
+ HISTOGRAM_BIND6,
+ HISTOGRAM_BIND7,
+ HISTOGRAM_BIND8,
+ TICKS_CONTRAST_SET,
+ TIME_CONTRAST_SET,
+ CONTRAST_BINA0,
+ CONTRAST_BINA1,
+ CONTRAST_BINA2,
+ CONTRAST_BINA3,
+ CONTRAST_BINA4,
+ CONTRAST_BINA5,
+ CONTRAST_BINA6,
+ CONTRAST_BINA7,
+ CONTRAST_BINA8,
+ CONTRAST_BINB0,
+ CONTRAST_BINB1,
+ CONTRAST_BINB2,
+ CONTRAST_BINB3,
+ CONTRAST_BINB4,
+ CONTRAST_BINB5,
+ CONTRAST_BINB6,
+ CONTRAST_BINB7,
+ CONTRAST_BINB8,
+ CONTRAST_BINC0,
+ CONTRAST_BINC1,
+ CONTRAST_BINC2,
+ CONTRAST_BINC3,
+ CONTRAST_BINC4,
+ CONTRAST_BINC5,
+ CONTRAST_BINC6,
+ CONTRAST_BINC7,
+ CONTRAST_BINC8,
+ CONTRAST_BIND0,
+ CONTRAST_BIND1,
+ CONTRAST_BIND2,
+ CONTRAST_BIND3,
+ CONTRAST_BIND4,
+ CONTRAST_BIND5,
+ CONTRAST_BIND6,
+ CONTRAST_BIND7,
+ CONTRAST_BIND8,
+ CHKSUM,
+ DWL_ID,
+ DWL_PIXX,
+ DWL_PIXY,
+ DWL_X_UNCORRECTED,
+ DWL_Y_UNCORRECTED,
+ DWL_X_CORRECTED,
+ DWL_Y_CORRECTED,
+ DWL_MAGNITUDE,
+ DWL_CXA,
+ DWL_CYA,
+ DWL_QUALITY,
+ MATCHEDSTR_ID,
+ MATCHEDSTR_CAMFPX,
+ MATCHEDSTR_CAMFPY,
+ MATCHEDSTR_CAMCARTX,
+ MATCHEDSTR_CAMCARTY,
+ MATCHEDSTR_CAMCARTZ,
+ MATCHEDSTR_CAMMAGNITUDE,
+ MATCHEDSTR_DBFPX,
+ MATCHEDSTR_DBFPY,
+ MATCHEDSTR_DBCARTX,
+ MATCHEDSTR_DBCARTY,
+ MATCHEDSTR_DBCARTZ,
+ MATCHEDSTR_DBMAGNITUDE,
+ MATCHEDSTR_CATALOGID,
+ DBIMAGE_ID,
+ DBIMAGE_PIXX,
+ DBIMAGE_PIXY,
+ DBIMAGE_X,
+ DBIMAGE_Y,
+ DBIMAGE_MAGNITUDE,
+ BLOBPIX_ID,
+ BLOBPIX_X,
+ BLOBPIX_Y,
+ BLOBPIX_TOT_VAL,
+ BLOBPIX_IN_USE,
+ BLOBPIX_BRIGHT_NEIGHBOURS,
+ BLOBPIX_REGION
+};
+
+static const DeviceCommandId_t PING_REQUEST = 0;
+// Boots image (works only in bootloader mode)
+static const DeviceCommandId_t BOOT = 1;
+static const DeviceCommandId_t REQ_VERSION = 2;
+static const DeviceCommandId_t REQ_INTERFACE = 3;
+static const DeviceCommandId_t REQ_TIME = 4;
+static const DeviceCommandId_t ERASE = 5;
+static const DeviceCommandId_t UNLOCK = 6;
+static const DeviceCommandId_t SWITCH_TO_BOOTLOADER_PROGRAM = 7;
+static const DeviceCommandId_t DOWNLOAD_IMAGE = 9;
+static const DeviceCommandId_t UPLOAD_IMAGE = 10;
+static const DeviceCommandId_t REQ_POWER = 11;
+static const DeviceCommandId_t TAKE_IMAGE = 15;
+static const DeviceCommandId_t DOWNLOAD_CENTROID = 16;
+static const DeviceCommandId_t UPLOAD_CENTROID = 17;
+static const DeviceCommandId_t SUBSCRIBE_TO_TM = 18;
+static const DeviceCommandId_t REQ_SOLUTION = 24;
+static const DeviceCommandId_t REQ_TEMPERATURE = 25;
+static const DeviceCommandId_t REQ_HISTOGRAM = 28;
+static const DeviceCommandId_t REQ_CONTRAST = 29;
+static const DeviceCommandId_t LIMITS = 40;
+static const DeviceCommandId_t MOUNTING = 41;
+static const DeviceCommandId_t CAMERA = 42;
+static const DeviceCommandId_t BLOB = 43;
+static const DeviceCommandId_t CENTROIDING = 44;
+static const DeviceCommandId_t LISA = 45;
+static const DeviceCommandId_t MATCHING = 46;
+static const DeviceCommandId_t TRACKING = 47;
+static const DeviceCommandId_t VALIDATION = 48;
+static const DeviceCommandId_t ALGO = 49;
+static const DeviceCommandId_t CHECKSUM = 50;
+static const DeviceCommandId_t READ = 51;
+static const DeviceCommandId_t WRITE = 52;
+static const DeviceCommandId_t DOWNLOAD_MATCHED_STAR = 53;
+static const DeviceCommandId_t STOP_IMAGE_LOADER = 55;
+static const DeviceCommandId_t RESET_ERROR = 56;
+static const DeviceCommandId_t CHANGE_DOWNLOAD_FILE = 57;
+static const DeviceCommandId_t SET_JSON_FILE_NAME = 58;
+static const DeviceCommandId_t SET_READ_FILENAME = 59;
+static const DeviceCommandId_t SET_TIME = 60;
+static const DeviceCommandId_t DOWNLOAD_DBIMAGE = 61;
+static const DeviceCommandId_t DOWNLOAD_BLOBPIXEL = 62;
+static const DeviceCommandId_t DOWNLOAD_FPGA_IMAGE = 63;
+static const DeviceCommandId_t CHANGE_FPGA_DOWNLOAD_FILE = 64;
+static const DeviceCommandId_t UPLOAD_FPGA_IMAGE = 65;
+static const DeviceCommandId_t FPGA_ACTION = 66;
+static const DeviceCommandId_t NONE = 0xFFFFFFFF;
+
+static const uint32_t VERSION_SET_ID = REQ_VERSION;
+static const uint32_t INTERFACE_SET_ID = REQ_INTERFACE;
+static const uint32_t POWER_SET_ID = REQ_POWER;
+static const uint32_t TEMPERATURE_SET_ID = REQ_TEMPERATURE;
+static const uint32_t TIME_SET_ID = REQ_TIME;
+static const uint32_t SOLUTION_SET_ID = REQ_SOLUTION;
+static const uint32_t HISTOGRAM_SET_ID = REQ_HISTOGRAM;
+static const uint32_t CONTRAST_SET_ID = REQ_CONTRAST;
+static const uint32_t CHECKSUM_SET_ID = CHECKSUM;
+static const uint32_t DOWNLOADCENTROID_SET_ID = DOWNLOAD_CENTROID;
+static const uint32_t DOWNLOAD_MATCHED_STAR_SET_ID = DOWNLOAD_MATCHED_STAR;
+static const uint32_t DOWNLOAD_DBIMAGE_SET_ID = DOWNLOAD_DBIMAGE;
+static const uint32_t DOWNLOAD_BLOBPIXEL_SET_ID = DOWNLOAD_BLOBPIXEL;
+
+/** Max size of unencoded frame */
+static const size_t MAX_FRAME_SIZE = 1200;
+
+static const uint8_t TEMPERATURE_SET_ENTRIES = 4;
+static const uint8_t VERSION_SET_ENTRIES = 5;
+static const uint8_t INTERFACE_SET_ENTRIES = 4;
+static const uint8_t POWER_SET_ENTRIES = 18;
+static const uint8_t TIME_SET_ENTRIES = 4;
+static const uint8_t SOLUTION_SET_ENTRIES = 23;
+static const uint8_t HISTOGRAM_SET_ENTRIES = 38;
+static const uint8_t CONTRAST_SET_ENTRIES = 38;
+static const uint8_t CHECKSUM_SET_ENTRIES = 1;
+static const uint8_t DOWNLOAD_CENTROID_SET_ENTRIES = 11;
+static const uint8_t DOWNLOAD_MATCHED_STAR_SET_ENTRIES = 14;
+static const uint8_t DOWNLOAD_DBIMAGE_SET_ENTRIES = 6;
+static const uint8_t DOWNLOAD_BLOBPIXEL_SET_ENTRIES = 7;
+
+// Action, parameter and telemetry IDs
+namespace ID {
+ static const uint8_t PING = 0;
+ static const uint8_t BOOT = 1;
+ static const uint8_t VERSION = 2;
+ static const uint8_t INTERFACE = 3;
+ static const uint8_t LIMITS = 5;
+ static const uint8_t MOUNTING = 6;
+ static const uint8_t CAMERA = 9;
+ static const uint8_t BLOB = 10;
+ static const uint8_t CENTROIDING = 11;
+ static const uint8_t LISA = 12;
+ static const uint8_t MATCHING = 13;
+ static const uint8_t TRACKING = 14;
+ static const uint8_t VALIDATION = 15;
+ static const uint8_t ALGO = 16;
+ static const uint8_t REBOOT = 7;
+ static const uint8_t UPLOAD_IMAGE = 10;
+ static const uint8_t POWER = 11;
+ static const uint8_t SET_TIME = 14;
+ static const uint8_t SUBSCRIBE = 18;
+ static const uint8_t SOLUTION = 24;
+ static const uint8_t TEMPERATURE = 25;
+ static const uint8_t HISTOGRAM = 28;
+ static const uint8_t CONTRAST = 29;
+ static const uint8_t TIME = 1;
+ static const uint8_t WRITE = 2;
+ static const uint8_t READ = 3;
+ static const uint8_t CHECKSUM = 4;
+ static const uint8_t ERASE = 5;
+ static const uint8_t UNLOCK = 6;
+ static const uint8_t TAKE_IMAGE = 15;
+ static const uint8_t ERROR_RESET = 12;
+ static const uint8_t DOWNLOAD_CENTROID = 16;
+ static const uint8_t UPLOAD_CENTROID = 17;
+ static const uint8_t DOWNLOAD_MATCHED_STAR = 18;
+ static const uint8_t DOWNLOAD_DBIMAGE = 19;
+ static const uint8_t DOWNLOAD_BLOBPIXEL = 24;
+ static const uint8_t FPGA_ACTION = 22;
+}
+
+namespace Program {
+ static const uint8_t BOOTLOADER = 1;
+ static const uint8_t FIRMWARE = 2;
+}
+
+/**
+ * @brief This dataset can be used to store the temperature of a reaction wheel.
+ */
+class TemperatureSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 20;
+
+ TemperatureSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {
+ }
+
+ TemperatureSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {
+ }
+
+ // Ticks is time reference generated by internal counter of the star tracker
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_TEMPERATURE_SET, this);
+ /** Unix time in microseconds */
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_TEMPERATURE_SET, this);
+ lp_var_t mcuTemperature = lp_var_t(sid.objectId,
+ PoolIds::MCU_TEMPERATURE, this);
+ lp_var_t cmosTemperature = lp_var_t(sid.objectId,
+ PoolIds::CMOS_TEMPERATURE, this);
+
+ void printSet() {
+ sif::info << "TemperatureSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "TemperatureSet::printSet: Time: "
+ << this->time << " us" << std::endl;
+ sif::info << "TemperatureSet::printSet: MCU Temperature: "
+ << this->mcuTemperature << " °C" << std::endl;
+ sif::info << "TemperatureSet::printSet: CMOS Temperature: "
+ << this->cmosTemperature << " °C" << std::endl;
+ }
+};
+
+/**
+ * @brief Package to store version parameters
+ */
+class VersionSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 15;
+
+ VersionSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, VERSION_SET_ID) {
+ }
+
+ VersionSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, VERSION_SET_ID)) {
+ }
+
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_VERSION_SET, this);
+ /** Unix time in microseconds */
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_VERSION_SET, this);
+ lp_var_t program = lp_var_t(sid.objectId,
+ PoolIds::PROGRAM, this);
+ lp_var_t major = lp_var_t(sid.objectId,
+ PoolIds::MAJOR, this);
+ lp_var_t minor = lp_var_t(sid.objectId,
+ PoolIds::MINOR, this);
+
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "VersionSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "VersionSet::printSet: Unix Time: "
+ << this->time << " us" << std::endl;
+ sif::info << "VersionSet::printSet: Program: "
+ << static_cast(this->program.value) << std::endl;
+ sif::info << "VersionSet::printSet: Major: "
+ << static_cast(this->major.value) << std::endl;
+ sif::info << "VersionSet::printSet: Minor: "
+ << static_cast(this->minor.value) << std::endl;
+ }
+};
+
+/**
+ * @brief Dataset to store the interface telemtry data.
+ */
+class InterfaceSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 20;
+
+ InterfaceSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, REQ_INTERFACE) {
+ }
+
+ InterfaceSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {
+ }
+
+ // Ticks is time reference generated by interanl counter of the star tracker
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_INTERFACE_SET, this);
+ /** Unix time in microseconds */
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_INTERFACE_SET, this);
+ lp_var_t frameCount = lp_var_t(sid.objectId,
+ PoolIds::FRAME_COUNT, this);
+ lp_var_t checksumerrorCount = lp_var_t(sid.objectId,
+ PoolIds::CHECKSUM_ERROR_COUNT, this);
+
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "InterfaceSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "InterfaceSet::printSet: Time: "
+ << this->time << " us" << std::endl;
+ sif::info << "InterfaceSet::printSet: Frame Count: "
+ << this->frameCount << std::endl;
+ sif::info << "InterfaceSet::printSet: Checksum Error Count: "
+ << this->checksumerrorCount << std::endl;
+ }
+};
+
+/**
+ * @brief Dataset to store the data of the power telemetry reply.
+ */
+class PowerSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 76;
+
+ PowerSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, REQ_INTERFACE) {
+ }
+
+ PowerSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {
+ }
+
+ // Ticks is time reference generated by interanl counter of the star tracker
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_POWER_SET, this);
+ /** Unix time in microseconds */
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_POWER_SET, this);
+ lp_var_t mcuCurrent = lp_var_t(sid.objectId,
+ PoolIds::MCU_CURRENT, this);
+ lp_var_t mcuVoltage = lp_var_t(sid.objectId,
+ PoolIds::MCU_VOLTAGE, this);
+ lp_var_t fpgaCoreCurrent = lp_var_t(sid.objectId,
+ PoolIds::FPGA_CORE_CURRENT, this);
+ lp_var_t fpgaCoreVoltage = lp_var_t(sid.objectId,
+ PoolIds::FPGA_CORE_VOLTAGE, this);
+ lp_var_t fpga18Current = lp_var_t(sid.objectId,
+ PoolIds::FPGA_18_CURRENT, this);
+ lp_var_t fpga18Voltage = lp_var_t(sid.objectId,
+ PoolIds::FPGA_18_VOLTAGE, this);
+ lp_var_t fpga25Current = lp_var_t(sid.objectId,
+ PoolIds::FPGA_25_CURRENT, this);
+ lp_var_t fpga25Voltage = lp_var_t(sid.objectId,
+ PoolIds::FPGA_25_VOLTAGE, this);
+ lp_var_t cmv21Current = lp_var_t(sid.objectId,
+ PoolIds::CMV_21_CURRENT, this);
+ lp_var_t cmv21Voltage = lp_var_t(sid.objectId,
+ PoolIds::CMV_21_VOLTAGE, this);
+ lp_var_t cmvPixCurrent = lp_var_t(sid.objectId,
+ PoolIds::CMV_PIX_CURRENT, this);
+ lp_var_t cmvPixVoltage = lp_var_t(sid.objectId,
+ PoolIds::CMV_PIX_VOLTAGE, this);
+ lp_var_t cmv33Current = lp_var_t(sid.objectId,
+ PoolIds::CMV_33_CURRENT, this);
+ lp_var_t cmv33Voltage = lp_var_t(sid.objectId,
+ PoolIds::CMV_33_VOLTAGE, this);
+ lp_var_t cmvResCurrent = lp_var_t(sid.objectId,
+ PoolIds::CMV_RES_CURRENT, this);
+ lp_var_t cmvResVoltage = lp_var_t(sid.objectId,
+ PoolIds::CMV_RES_VOLTAGE, this);
+
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "PowerSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "PowerSet::printSet: Time: "
+ << this->time << " us" << std::endl;
+ sif::info << "PowerSet::printSet: MCU Current: "
+ << this->mcuCurrent << " A" << std::endl;
+ sif::info << "PowerSet::printSet: MCU Voltage: "
+ << this->mcuVoltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA Core current: "
+ << this->fpgaCoreCurrent << " A" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA Core voltage: "
+ << this->fpgaCoreVoltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA 18 current: "
+ << this->fpga18Current << " A" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA 18 voltage: "
+ << this->fpga18Voltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA 25 current: "
+ << this->fpga25Current << " A" << std::endl;
+ sif::info << "PowerSet::printSet: FPGA 25 voltage: "
+ << this->fpga25Voltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: CMV 21 current: "
+ << this->cmv21Current << " A" << std::endl;
+ sif::info << "PowerSet::printSet: CMV 21 voltage: "
+ << this->cmv21Voltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: CMV Pix current: "
+ << this->cmvPixCurrent << " A" << std::endl;
+ sif::info << "PowerSet::printSet: CMV Pix voltage: "
+ << this->cmvPixVoltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: CMV 33 current: "
+ << this->cmv33Current << " A" << std::endl;
+ sif::info << "PowerSet::printSet: CMV 33 voltage: "
+ << this->cmv33Voltage << " V" << std::endl;
+ sif::info << "PowerSet::printSet: CMV Res current: "
+ << this->cmvResCurrent << " A" << std::endl;
+ sif::info << "PowerSet::printSet: CMV Res voltage: "
+ << this->cmvResVoltage << " V" << std::endl;
+ }
+};
+
+/**
+ * @brief Data set to store the time telemetry packet.
+ */
+class TimeSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 24;
+
+ TimeSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, TIME_SET_ID) {
+ }
+
+ TimeSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, TIME_SET_ID)) {
+ }
+
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_TIME_SET, this);
+ /** Unix time in microseconds */
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_TIME_SET, this);
+ // Number of milliseconds since processor start-up
+ lp_var_t runTime = lp_var_t(sid.objectId,
+ PoolIds::RUN_TIME, this);
+ // Unix time in seconds?? --> maybe typo in datasheet. Seems to be microseconds
+ lp_var_t unixTime = lp_var_t(sid.objectId,
+ PoolIds::UNIX_TIME, this);
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "TimeSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "TimeSet::printSet: Time (time stamp): "
+ << this->time << " us" << std::endl;
+ sif::info << "TimeSet::printSet: Run Time: "
+ << this->runTime << " ms" << std::endl;
+ sif::info << "TimeSet::printSet: Unix Time: "
+ << this->unixTime << " s" << std::endl;
+ }
+};
+
+/**
+ * @brief The solution dataset is the main dataset of the star tracker and contains the
+ * attitude information.
+ */
+class SolutionSet:
+ public StaticLocalDataSet {
+public:
+
+ static const size_t SIZE = 78;
+
+ SolutionSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, SOLUTION_SET_ID) {
+ }
+
+ SolutionSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, SOLUTION_SET_ID)) {
+ }
+
+ // Ticks timestamp
+ lp_var_t ticks = lp_var_t(sid.objectId,
+ PoolIds::TICKS_SOLUTION_SET, this);
+ /// Unix time stamp
+ lp_var_t time = lp_var_t(sid.objectId,
+ PoolIds::TIME_SOLUTION_SET, this);
+ // Calibrated quaternion (takes into account the mounting quaternion), typically same as
+ // track q values
+ lp_var_t caliQw = lp_var_t(sid.objectId, PoolIds::CALI_QW, this);
+ lp_var_t caliQx = lp_var_t(sid.objectId, PoolIds::CALI_QX, this);
+ lp_var_t caliQy = lp_var_t(sid.objectId, PoolIds::CALI_QY, this);
+ lp_var_t caliQz = lp_var_t(sid.objectId, PoolIds::CALI_QZ, this);
+ // The lower this value the more confidence that the star tracker solution is correct
+ lp_var_t trackConfidence = lp_var_t(sid.objectId, PoolIds::TRACK_CONFIDENCE,
+ this);
+ // Estimated attitude of spacecraft
+ lp_var_t trackQw = lp_var_t(sid.objectId, PoolIds::TRACK_QW, this);
+ lp_var_t trackQx = lp_var_t(sid.objectId, PoolIds::TRACK_QX, this);
+ lp_var_t trackQy = lp_var_t(sid.objectId, PoolIds::TRACK_QY, this);
+ lp_var_t trackQz = lp_var_t(sid.objectId, PoolIds::TRACK_QZ, this);
+ // Number of stars removed from tracking solution
+ lp_var_t trackRemoved = lp_var_t(sid.objectId, PoolIds::TRACK_REMOVED, this);
+ // Number of stars for which a valid centroid was found
+ lp_var_t starsCentroided = lp_var_t(sid.objectId, PoolIds::STARS_CENTROIDED,
+ this);
+ // Number of stars that matched to a database star
+ lp_var_t starsMatchedDatabase = lp_var_t(sid.objectId,
+ PoolIds::STARS_MATCHED_DATABASE, this);
+ // Result of LISA (lost in space algorithm), searches for stars without prior knowledge of
+ // attitude
+ lp_var_t lisaQw = lp_var_t(sid.objectId, PoolIds::LISA_QW, this);
+ lp_var_t lisaQx = lp_var_t(sid.objectId, PoolIds::LISA_QX, this);
+ lp_var_t lisaQy = lp_var_t(sid.objectId, PoolIds::LISA_QY, this);
+ lp_var_t lisaQz = lp_var_t(sid.objectId, PoolIds::LISA_QZ, this);
+ // Percentage of close stars in LISA solution
+ lp_var_t lisaPercentageClose = lp_var_t(sid.objectId, PoolIds::LISA_PERC_CLOSE,
+ this);
+ // Number of close stars in LISA solution
+ lp_var_t lisaNrClose = lp_var_t(sid.objectId, PoolIds::LISA_NR_CLOSE, this);
+ // Gives a combined overview of the validation parameters (1 for valid solution, otherwise 0)
+ lp_var_t isTrustWorthy = lp_var_t(sid.objectId, PoolIds::TRUST_WORTHY, this);
+ // Number of times the validation criteria was met
+ lp_var_t stableCount = lp_var_t(sid.objectId, PoolIds::STABLE_COUNT, this);
+ // Shows the autonomous mode used to obtain the star tracker attitude
+ lp_var_t solutionStrategy = lp_var_t(sid.objectId, PoolIds::SOLUTION_STRATEGY,
+ this);
+
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "SolutionSet::printSet: Ticks: "
+ << this->ticks << std::endl;
+ sif::info << "SolutionSet::printSet: Time: "
+ << this->time << std::endl;
+ sif::info << "SolutionSet::printSet: Calibrated quaternion Qw: "
+ << this->caliQw << std::endl;
+ sif::info << "SolutionSet::printSet: Calibrated quaternion Qx: "
+ << this->caliQx << std::endl;
+ sif::info << "SolutionSet::printSet: Calibrated quaternion Qy: "
+ << this->caliQy << std::endl;
+ sif::info << "SolutionSet::printSet: Calibrated quaternion Qz: "
+ << this->caliQz << std::endl;
+ sif::info << "SolutionSet::printSet: Track confidence: "
+ << this->trackConfidence << std::endl;
+ sif::info << "SolutionSet::printSet: Track Qw: "
+ << this->trackQw << std::endl;
+ sif::info << "SolutionSet::printSet: Track Qx: "
+ << this->trackQx << std::endl;
+ sif::info << "SolutionSet::printSet: Track Qy: "
+ << this->trackQy << std::endl;
+ sif::info << "SolutionSet::printSet: Track Qz: "
+ << this->trackQz << std::endl;
+ sif::info << "SolutionSet::printSet: Track removed: "
+ << static_cast(this->trackRemoved.value) << std::endl;
+ sif::info << "SolutionSet::printSet: Number of stars centroided: "
+ << static_cast(this->starsCentroided.value) << std::endl;
+ sif::info << "SolutionSet::printSet: Number of stars matched database: "
+ << static_cast(this->starsMatchedDatabase.value) << std::endl;
+ sif::info << "SolutionSet::printSet: LISA Qw: "
+ << this->lisaQw << std::endl;
+ sif::info << "SolutionSet::printSet: LISA Qx: "
+ << this->lisaQx << std::endl;
+ sif::info << "SolutionSet::printSet: LISA Qy: "
+ << this->lisaQy << std::endl;
+ sif::info << "SolutionSet::printSet: LISA Qz: "
+ << this->lisaQz << std::endl;
+ sif::info << "SolutionSet::printSet: LISA Percentage close: "
+ << this->lisaPercentageClose << std::endl;
+ sif::info << "SolutionSet::printSet: LISA number of close stars: "
+ << static_cast(this->lisaNrClose.value) << std::endl;
+ sif::info << "SolutionSet::printSet: Is trust worthy: "
+ << static_cast(this->isTrustWorthy.value) << std::endl;
+ sif::info << "SolutionSet::printSet: Stable count: "
+ << this->stableCount << std::endl;
+ sif::info << "SolutionSet::printSet: Solution strategy: "
+ << static_cast(this->solutionStrategy.value) << std::endl;
+ }
+};
+
+/**
+ * @brief Dataset to store the histogram
+ */
+class HistogramSet:
+ public StaticLocalDataSet {
+public:
+
+ // Size of dataset
+ static const size_t SIZE = 156;
+
+ HistogramSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, HISTOGRAM_SET_ID) {
+ }
+
+ HistogramSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, HISTOGRAM_SET_ID)) {
+ }
+
+ lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::TICKS_HISTOGRAM_SET, this);
+ lp_var_t time = lp_var_t(sid.objectId, PoolIds::TIME_HISTOGRAM_SET, this);
+ lp_var_t binA0 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA0, this);
+ lp_var_t binA1 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA1, this);
+ lp_var_t binA2 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA2, this);
+ lp_var_t binA3 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA3, this);
+ lp_var_t binA4 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA4, this);
+ lp_var_t binA5 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA5, this);
+ lp_var_t binA6 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA6, this);
+ lp_var_t binA7 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA7, this);
+ lp_var_t binA8 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINA8, this);
+ lp_var_t binB0 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB0, this);
+ lp_var_t binB1 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB1, this);
+ lp_var_t binB2 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB2, this);
+ lp_var_t binB3 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB3, this);
+ lp_var_t binB4 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB4, this);
+ lp_var_t binB5 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB5, this);
+ lp_var_t binB6 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB6, this);
+ lp_var_t binB7 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB7, this);
+ lp_var_t binB8 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINB8, this);
+ lp_var_t binC0 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC0, this);
+ lp_var_t binC1 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC1, this);
+ lp_var_t binC2 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC2, this);
+ lp_var_t binC3 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC3, this);
+ lp_var_t binC4 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC4, this);
+ lp_var_t binC5 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC5, this);
+ lp_var_t binC6 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC6, this);
+ lp_var_t binC7 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC7, this);
+ lp_var_t binC8 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BINC8, this);
+ lp_var_t binD0 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND0, this);
+ lp_var_t binD1 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND1, this);
+ lp_var_t binD2 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND2, this);
+ lp_var_t binD3 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND3, this);
+ lp_var_t binD4 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND4, this);
+ lp_var_t binD5 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND5, this);
+ lp_var_t binD6 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND6, this);
+ lp_var_t binD7 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND7, this);
+ lp_var_t binD8 = lp_var_t(sid.objectId, PoolIds::HISTOGRAM_BIND8, this);
+
+ void printSet() {
+ PoolReadGuard rg(this);
+ sif::info << "HistogramSet::printSet: Ticks: " << this->ticks << std::endl;
+ sif::info << "HistogramSet::printSet: Time (time stamp): " << this->time << " us"
+ << std::endl;
+ sif::info << "HistogramSet::printSet: BinA0: " << this->binA0 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA1: " << this->binA1 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA2: " << this->binA2 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA3: " << this->binA3 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA4: " << this->binA4 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA5: " << this->binA5 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA6: " << this->binA6 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA7: " << this->binA7 << std::endl;
+ sif::info << "HistogramSet::printSet: BinA8: " << this->binA8 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB0: " << this->binB0 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB1: " << this->binB1 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB2: " << this->binB2 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB3: " << this->binB3 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB4: " << this->binB4 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB5: " << this->binB5 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB6: " << this->binB6 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB7: " << this->binB7 << std::endl;
+ sif::info << "HistogramSet::printSet: BinB8: " << this->binB8 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC0: " << this->binC0 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC1: " << this->binC1 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC2: " << this->binC2 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC3: " << this->binC3 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC4: " << this->binC4 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC5: " << this->binC5 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC6: " << this->binC6 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC7: " << this->binC7 << std::endl;
+ sif::info << "HistogramSet::printSet: BinC8: " << this->binC8 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD0: " << this->binD0 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD1: " << this->binD1 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD2: " << this->binD2 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD3: " << this->binD3 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD4: " << this->binD4 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD5: " << this->binD5 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD6: " << this->binD6 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD7: " << this->binD7 << std::endl;
+ sif::info << "HistogramSet::printSet: BinD8: " << this->binD8 << std::endl;
+ }
+};
+
+/**
+ * @brief Dataset to store the contrast telemetry data
+ */
+class ContrastSet:
+ public StaticLocalDataSet {
+public:
+
+ // Size of dataset
+ static const size_t SIZE = 156;
+
+ ContrastSet(HasLocalDataPoolIF* owner):
+ StaticLocalDataSet(owner, CONTRAST_SET_ID) {
+ }
+
+ ContrastSet(object_id_t objectId):
+ StaticLocalDataSet(sid_t(objectId, CONTRAST_SET_ID)) {
+ }
+
+ lp_var_t ticks = lp_var_t(sid.objectId, PoolIds::TICKS_CONTRAST_SET, this);
+ lp_var_t time = lp_var_t(sid.objectId, PoolIds::TIME_CONTRAST_SET, this);
+ lp_var_t binA0 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA0, this);
+ lp_var_t binA1 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA1, this);
+ lp_var_t binA2 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA2, this);
+ lp_var_t binA3 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA3, this);
+ lp_var_t binA4 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA4, this);
+ lp_var_t binA5 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA5, this);
+ lp_var_t binA6 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA6, this);
+ lp_var_t binA7 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA7, this);
+ lp_var_t binA8 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINA8, this);
+ lp_var_t binb0 = lp_var_t(sid.objectId, PoolIds::CONTRAST_BINB0, this);
+ lp_var_t binB1 = lp_var_t