merged develop

This commit is contained in:
Jakob Meier 2021-12-19 12:15:18 +01:00
parent 8694a20c63
commit e3841d180e
15 changed files with 142 additions and 73 deletions

View File

@ -31,8 +31,8 @@ namespace gpioNames {
static constexpr char MGM_3_CS[] = "mgm_3_rm3100_chip_select"; 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_0[] = "reset_gnss_0";
static constexpr char RESET_GNSS_1[] = "reset_gnss_1"; static constexpr char RESET_GNSS_1[] = "reset_gnss_1";
static constexpr char GYRO_0_ENABLE[] = "gyro_0_enable"; static constexpr char GYRO_0_ENABLE[] = "enable_gyro_0";
static constexpr char GYRO_2_ENABLE[] = "gyro_2_enable"; static constexpr char GYRO_2_ENABLE[] = "enable_gyro_2";
static constexpr char HEATER_0[] = "heater0"; static constexpr char HEATER_0[] = "heater0";
static constexpr char HEATER_1[] = "heater1"; static constexpr char HEATER_1[] = "heater1";
static constexpr char HEATER_2[] = "heater2"; static constexpr char HEATER_2[] = "heater2";

View File

@ -1094,8 +1094,8 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
uint8_t wordIdx = 0; uint8_t wordIdx = 0;
uint8_t arrayIdx = 0; uint8_t arrayIdx = 0;
istringstream iss(nextLine); istringstream iss(nextLine);
Chip currentChip; Chip currentChip = Chip::CHIP_0;
Copy currentCopy; Copy currentCopy = Copy::COPY_0;
while(iss >> word) { while(iss >> word) {
if(wordIdx == 1) { if(wordIdx == 1) {
currentChip = static_cast<Chip>(stoi(word)); currentChip = static_cast<Chip>(stoi(word));

View File

@ -207,7 +207,7 @@ void initmission::createPstTasks(TaskFactory& factory,
/* Polling Sequence Table Default */ /* Polling Sequence Table Default */
#if OBSW_ADD_SPI_TEST_CODE == 0 #if OBSW_ADD_SPI_TEST_CODE == 0
FixedTimeslotTaskIF* spiPst = factory.createFixedTimeslotTask( 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); missedDeadlineFunc);
result = pst::pstSpi(spiPst); result = pst::pstSpi(spiPst);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -704,45 +704,45 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
gpioComIF->addGpios(rtdGpioCookie); gpioComIF->addGpios(rtdGpioCookie);
SpiCookie* spiRtdIc0 = new SpiCookie(addresses::RTD_IC_3, gpioIds::RTD_IC_3, q7s::SPI_DEFAULT_DEV, 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, 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, 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, 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, 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, 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, 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, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc8 = new SpiCookie(addresses::RTD_IC_11, gpioIds::RTD_IC_11, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc9 = new SpiCookie(addresses::RTD_IC_12, gpioIds::RTD_IC_12, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc10 = new SpiCookie(addresses::RTD_IC_13, gpioIds::RTD_IC_13, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc11 = new SpiCookie(addresses::RTD_IC_14, gpioIds::RTD_IC_14, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc12 = new SpiCookie(addresses::RTD_IC_15, gpioIds::RTD_IC_15, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16, SpiCookie* spiRtdIc13 = new SpiCookie(addresses::RTD_IC_16, gpioIds::RTD_IC_16,
std::string(q7s::SPI_DEFAULT_DEV), Max31865Definitions::MAX_REPLY_SIZE, 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, 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); spi::RTD_SPEED);
SpiCookie* spiRtdIc15 = new SpiCookie(addresses::RTD_IC_18, gpioIds::RTD_IC_18, 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); spi::RTD_SPEED);
Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF, Max31865PT1000Handler* rtdIc0 = new Max31865PT1000Handler(objects::RTD_IC_3, objects::SPI_COM_IF,
@ -781,6 +781,11 @@ void ObjectFactory::createRtdComponents(LinuxLibgpioIF *gpioComIF) {
rtdIc0->setStartUpImmediately(); rtdIc0->setStartUpImmediately();
rtdIc1->setStartUpImmediately(); rtdIc1->setStartUpImmediately();
rtdIc2->setStartUpImmediately(); rtdIc2->setStartUpImmediately();
#if OBSW_DEBUG_RTD == 1
rtdIc0->setInstantNormal(true);
rtdIc1->setInstantNormal(true);
rtdIc2->setInstantNormal(true);
#endif
static_cast<void>(rtdIc0); static_cast<void>(rtdIc0);
static_cast<void>(rtdIc1); static_cast<void>(rtdIc1);

View File

@ -73,10 +73,21 @@ ReturnValue_t StarTrackerHandler::executeAction(ActionId_t actionId, MessageQueu
ReturnValue_t result = RETURN_OK; ReturnValue_t result = RETURN_OK;
if (actionId == StarTracker::STOP_IMAGE_LOADER) { switch(actionId) {
case(StarTracker::STOP_IMAGE_LOADER): {
strImageLoader->stopProcess(); strImageLoader->stopProcess();
return EXECUTION_FINISHED; return EXECUTION_FINISHED;
} }
case(StarTracker::SET_JSON_FILE_NAME): {
if (size > MAX_PATH_SIZE) {
return FILE_PATH_TOO_LONG;
}
paramJsonFile = std::string(reinterpret_cast<const char*>(data), size);
return EXECUTION_FINISHED;
}
default:
break;
}
if (imageLoaderExecuting == true) { if (imageLoaderExecuting == true) {
return IMAGE_LOADER_EXECUTING; return IMAGE_LOADER_EXECUTING;

View File

@ -17,7 +17,7 @@ fi
os_fsfw="linux" os_fsfw="linux"
tgt_bsp="arm/q7s" tgt_bsp="arm/q7s"
build_dir="build-Debug-Q7S" build_dir="build-Release-Q7S"
build_generator="make" build_generator="make"
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
python="py" python="py"
@ -28,6 +28,6 @@ fi
echo "Running command (without the leading +):" echo "Running command (without the leading +):"
set -x # Print command set -x # Print command
${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "debug" -t "${tgt_bsp}" \ ${python} ${cfg_script_name} -o "${os_fsfw}" -g "${build_generator}" -b "release" -t "${tgt_bsp}" \
-l"${build_dir}" -l"${build_dir}"
# set +x # set +x

View File

@ -12,15 +12,15 @@ namespace spi {
// Default values, changing them is not supported for now // Default values, changing them is not supported for now
static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000; static constexpr uint32_t DEFAULT_LIS3_SPEED = 976'000;
static constexpr uint32_t LIS3_TRANSITION_DELAY = 10000; static constexpr uint32_t LIS3_TRANSITION_DELAY = 5000;
static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_LIS3_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000; static constexpr uint32_t DEFAULT_RM3100_SPEED = 976'000;
static constexpr uint32_t RM3100_TRANSITION_DELAY = 10000; static constexpr uint32_t RM3100_TRANSITION_DELAY = 5000;
static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_RM3100_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000; static constexpr uint32_t DEFAULT_L3G_SPEED = 976'000;
static constexpr uint32_t L3G_TRANSITION_DELAY = 10000; static constexpr uint32_t L3G_TRANSITION_DELAY = 5000;
static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3; static constexpr spi::SpiModes DEFAULT_L3G_MODE = spi::SpiModes::MODE_3;
static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000; static constexpr uint32_t DEFAULT_MAX_1227_SPEED = 3'900'000;

2
fsfw

@ -1 +1 @@
Subproject commit 9a858eb54c5603ccd3cbd2423cdaf87b20f0c0c4 Subproject commit b98c85d33fd79853e674f75dadd0a082a962aee4

View File

@ -102,7 +102,6 @@ debugging. */
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMQT 0 #define OBSW_DEBUG_IMQT 0
#define OBSW_DEBUG_ADIS16507 0
#define OBSW_DEBUG_RAD_SENSOR 0 #define OBSW_DEBUG_RAD_SENSOR 0
#define OBSW_DEBUG_SUS 0 #define OBSW_DEBUG_SUS 0
#define OBSW_DEBUG_RTD 0 #define OBSW_DEBUG_RTD 0
@ -115,8 +114,8 @@ debugging. */
/*******************************************************************/ /*******************************************************************/
/** Hardcoded */ /** Hardcoded */
/*******************************************************************/ /*******************************************************************/
// Leave at one as the BSP is linux. Used by the ADIS16507 device handler // Leave at one as the BSP is linux. Used by the ADIS1650X device handler
#define OBSW_ADIS16507_LINUX_COM_IF 1 #define OBSW_ADIS1650X_LINUX_COM_IF 1
#include "OBSWVersion.h" #include "OBSWVersion.h"

View File

@ -415,37 +415,37 @@ ReturnValue_t pst::pstSpi(FixedTimeslotTaskIF *thisSequence) {
#if OBSW_ADD_RW == 1 #if OBSW_ADD_RW == 1
thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW1, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW1, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW1, length * 0.4, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW1, length * 0.5, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW1, length * 0.6, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW1, length * 0.65, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW1, length * 0.8, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW1, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW2, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW2, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW2, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW2, length * 0.5, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW2, length * 0.7, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW2, length * 0.65, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW2, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW2, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW3, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW3, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW3, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW3, length * 0.5, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW3, length * 0.7, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW3, length * 0.65, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW3, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW3, length * 0.8, DeviceHandlerIF::GET_READ);
thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION); thisSequence->addSlot(objects::RW4, length * 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE); thisSequence->addSlot(objects::RW4, length * 0.2, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::RW4, length * 0.6, DeviceHandlerIF::GET_WRITE); thisSequence->addSlot(objects::RW4, length * 0.5, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::RW4, length * 0.7, DeviceHandlerIF::SEND_READ); thisSequence->addSlot(objects::RW4, length * 0.65, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::RW4, length * 0.85, DeviceHandlerIF::GET_READ); thisSequence->addSlot(objects::RW4, length * 0.8, DeviceHandlerIF::GET_READ);
#endif #endif
#if OBSW_ADD_ACS_BOARD == 1 #if OBSW_ADD_ACS_BOARD == 1
bool enableAside = false; bool enableAside = true;
bool enableBside = true; bool enableBside = false;
if(enableAside) { if(enableAside) {
// A side // A side
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0,
DeviceHandlerIF::PERFORM_OPERATION); DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.2, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.25,
DeviceHandlerIF::SEND_WRITE); DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6, thisSequence->addSlot(objects::MGM_0_LIS3_HANDLER, length * 0.6,
DeviceHandlerIF::GET_WRITE); DeviceHandlerIF::GET_WRITE);

View File

@ -185,7 +185,7 @@ void GyroADIS1650XHandler::fillCommandAndReplyMap() {
ReturnValue_t GyroADIS1650XHandler::scanForReply(const uint8_t *start, size_t remainingSize, ReturnValue_t GyroADIS1650XHandler::scanForReply(const uint8_t *start, size_t remainingSize,
DeviceCommandId_t *foundId, size_t *foundLen) { DeviceCommandId_t *foundId, size_t *foundLen) {
/* For SPI, the ID will always be the one of the last sent command. */ // For SPI, the ID will always be the one of the last sent command
*foundId = this->getPendingCommand(); *foundId = this->getPendingCommand();
*foundLen = this->rawPacketLen; *foundLen = this->rawPacketLen;
@ -196,18 +196,19 @@ ReturnValue_t GyroADIS1650XHandler::interpretDeviceReply(DeviceCommandId_t id,
const uint8_t *packet) { const uint8_t *packet) {
switch(id) { switch(id) {
case(ADIS1650X::READ_OUT_CONFIG): { case(ADIS1650X::READ_OUT_CONFIG): {
PoolReadGuard rg(&configDataset);
uint16_t readProdId = packet[10] << 8 | packet[11]; uint16_t readProdId = packet[10] << 8 | packet[11];
if(((adisType == ADIS1650X::Type::ADIS16507) and if(((adisType == ADIS1650X::Type::ADIS16507) and
(readProdId != ADIS1650X::PROD_ID_16507)) or (readProdId != ADIS1650X::PROD_ID_16507)) or
((adisType == ADIS1650X::Type::ADIS16505) and ((adisType == ADIS1650X::Type::ADIS16505) and
(readProdId != ADIS1650X::PROD_ID_16505))) { (readProdId != ADIS1650X::PROD_ID_16505))) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Invalid product ID " sif::warning << "GyroADIS1650XHandler::interpretDeviceReply: Invalid product ID "
<< readProdId << std::endl; << readProdId << std::endl;
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
PoolReadGuard rg(&configDataset);
configDataset.diagStatReg.value = packet[2] << 8 | packet[3]; configDataset.diagStatReg.value = packet[2] << 8 | packet[3];
configDataset.filterSetting.value = packet[4] << 8 | packet[5]; configDataset.filterSetting.value = packet[4] << 8 | packet[5];
configDataset.mscCtrlReg.value = packet[6] << 8 | packet[7]; configDataset.mscCtrlReg.value = packet[6] << 8 | packet[7];
@ -232,21 +233,20 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) {
switch(burstMode) { switch(burstMode) {
case(BurstModes::BURST_16_BURST_SEL_1): case(BurstModes::BURST_16_BURST_SEL_1):
case(BurstModes::BURST_32_BURST_SEL_1): { case(BurstModes::BURST_32_BURST_SEL_1): {
sif::warning << "GyroADIS16507Handler::interpretDeviceReply: Analysis with BURST_SEL1" sif::warning << "GyroADIS1650XHandler::interpretDeviceReply: Analysis with BURST_SEL1"
" not implemented!" << std::endl; " not implemented!" << std::endl;
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
case(BurstModes::BURST_16_BURST_SEL_0): { case(BurstModes::BURST_16_BURST_SEL_0): {
uint16_t checksum = packet[20] << 8 | packet[21]; uint16_t checksum = packet[20] << 8 | packet[21];
/* Now verify the read checksum with the expected checksum // Now verify the read checksum with the expected checksum according to datasheet p. 20
according to datasheet p. 20 */
uint16_t calcChecksum = 0; uint16_t calcChecksum = 0;
for(size_t idx = 2; idx < 20; idx ++) { for(size_t idx = 2; idx < 20; idx ++) {
calcChecksum += packet[idx]; calcChecksum += packet[idx];
} }
if(checksum != calcChecksum) { if(checksum != calcChecksum) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
sif::warning << "GyroADIS16507Handler::interpretDeviceReply: " sif::warning << "GyroADIS1650XHandler::interpretDeviceReply: "
"Invalid checksum detected!" << std::endl; "Invalid checksum detected!" << std::endl;
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
@ -277,7 +277,7 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) {
} else if(adisType == ADIS1650X::Type::ADIS16505) { } else if(adisType == ADIS1650X::Type::ADIS16505) {
accelScaling = ADIS1650X::ACCELEROMETER_RANGE_16505; accelScaling = ADIS1650X::ACCELEROMETER_RANGE_16505;
} else { } else {
sif::warning << "GyroADIS16507Handler::handleSensorData: " sif::warning << "GyroADIS1650XHandler::handleSensorData: "
"Unknown ADIS type" << std::endl; "Unknown ADIS type" << std::endl;
} }
int16_t accelXRaw = packet[10] << 8 | packet[11]; int16_t accelXRaw = packet[10] << 8 | packet[11];
@ -298,11 +298,11 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) {
#if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1 #if FSFW_HAL_ADIS1650X_GYRO_DEBUG == 1
if(debugDivider->checkAndIncrement()) { if(debugDivider->checkAndIncrement()) {
sif::info << "GyroADIS16507Handler: Angular velocities in deg / s" << std::endl; sif::info << "GyroADIS1650XHandler: Angular velocities in deg / s" << std::endl;
sif::info << "X: " << primaryDataset.angVelocX.value << std::endl; sif::info << "X: " << primaryDataset.angVelocX.value << std::endl;
sif::info << "Y: " << primaryDataset.angVelocY.value << std::endl; sif::info << "Y: " << primaryDataset.angVelocY.value << std::endl;
sif::info << "Z: " << primaryDataset.angVelocZ.value << std::endl; sif::info << "Z: " << primaryDataset.angVelocZ.value << std::endl;
sif::info << "GyroADIS16507Handler: Accelerations in m / s^2: " << std::endl; sif::info << "GyroADIS1650XHandler: Accelerations in m / s^2: " << std::endl;
sif::info << "X: " << primaryDataset.accelX.value << std::endl; sif::info << "X: " << primaryDataset.accelX.value << std::endl;
sif::info << "Y: " << primaryDataset.accelY.value << std::endl; sif::info << "Y: " << primaryDataset.accelY.value << std::endl;
sif::info << "Z: " << primaryDataset.accelZ.value << std::endl; sif::info << "Z: " << primaryDataset.accelZ.value << std::endl;
@ -319,7 +319,7 @@ ReturnValue_t GyroADIS1650XHandler::handleSensorData(const uint8_t *packet) {
} }
uint32_t GyroADIS1650XHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { uint32_t GyroADIS1650XHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
return 5000; return 10000;
} }
void GyroADIS1650XHandler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne, void GyroADIS1650XHandler::prepareWriteCommand(uint8_t startReg, uint8_t valueOne,

View File

@ -8,7 +8,7 @@
#include "fsfw/globalfunctions/PeriodicOperationDivider.h" #include "fsfw/globalfunctions/PeriodicOperationDivider.h"
#include "fsfw/devicehandlers/DeviceHandlerBase.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h"
#if OBSW_ADIS16507_LINUX_COM_IF == 1 #if OBSW_ADIS1650X_LINUX_COM_IF == 1
class SpiComIF; class SpiComIF;
class SpiCookie; class SpiCookie;
#endif #endif
@ -24,7 +24,7 @@ public:
GyroADIS1650XHandler(object_id_t objectId, object_id_t deviceCommunication, GyroADIS1650XHandler(object_id_t objectId, object_id_t deviceCommunication,
CookieIF* comCookie, ADIS1650X::Type type); CookieIF* comCookie, ADIS1650X::Type type);
/* DeviceHandlerBase abstract function implementation */ // DeviceHandlerBase abstract function implementation
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
@ -66,7 +66,7 @@ private:
BurstModes getBurstMode(); BurstModes getBurstMode();
#if OBSW_ADIS16507_LINUX_COM_IF == 1 #if OBSW_ADIS1650X_LINUX_COM_IF == 1
static ReturnValue_t spiSendCallback(SpiComIF* comIf, SpiCookie *cookie, static ReturnValue_t spiSendCallback(SpiComIF* comIf, SpiCookie *cookie,
const uint8_t *sendData, size_t sendLen, void* args); const uint8_t *sendData, size_t sendLen, void* args);
#endif #endif

View File

@ -7,10 +7,10 @@
Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId, object_id_t comIF, Max31865PT1000Handler::Max31865PT1000Handler(object_id_t objectId, object_id_t comIF,
CookieIF *comCookie): CookieIF *comCookie):
DeviceHandlerBase(objectId, comIF, comCookie), sensorDataset(this), DeviceHandlerBase(objectId, comIF, comCookie),
sensorDatasetSid(sensorDataset.getSid()) { sensorDataset(this), sensorDatasetSid(sensorDataset.getSid()) {
#if OBSW_VERBOSE_LEVEL >= 1 #if OBSW_VERBOSE_LEVEL >= 1
debugDivider = new PeriodicOperationDivider(0); debugDivider = new PeriodicOperationDivider(10);
#endif #endif
} }
@ -68,12 +68,21 @@ void Max31865PT1000Handler::doStartUp() {
if(internalState == InternalState::REQUEST_LOW_THRESHOLD) { if(internalState == InternalState::REQUEST_LOW_THRESHOLD) {
if(commandExecuted) { if(commandExecuted) {
setMode(MODE_ON); internalState = InternalState::CLEAR_FAULT_BYTE;
setMode(MODE_NORMAL);
internalState = InternalState::RUNNING;
commandExecuted = false; commandExecuted = false;
} }
} }
if(internalState == InternalState::CLEAR_FAULT_BYTE) {
if(commandExecuted) {
commandExecuted = false;
internalState = InternalState::RUNNING;
if(instantNormal) {
setMode(MODE_NORMAL);
} else {
setMode(_MODE_TO_ON);
}
}
}
} }
void Max31865PT1000Handler::doShutDown() { void Max31865PT1000Handler::doShutDown() {
@ -91,6 +100,10 @@ ReturnValue_t Max31865PT1000Handler::buildNormalDeviceCommand(
*id = Max31865Definitions::REQUEST_FAULT_BYTE; *id = Max31865Definitions::REQUEST_FAULT_BYTE;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
*id = Max31865Definitions::CLEAR_FAULT_BYTE;
return buildCommandFromCommand(*id, nullptr, 0);
}
else { else {
return DeviceHandlerBase::NOTHING_TO_SEND; return DeviceHandlerBase::NOTHING_TO_SEND;
} }
@ -128,6 +141,10 @@ ReturnValue_t Max31865PT1000Handler::buildTransitionDeviceCommand(
*id = Max31865Definitions::REQUEST_LOW_THRESHOLD; *id = Max31865Definitions::REQUEST_LOW_THRESHOLD;
return buildCommandFromCommand(*id, nullptr, 0); return buildCommandFromCommand(*id, nullptr, 0);
} }
case(InternalState::CLEAR_FAULT_BYTE): {
*id = Max31865Definitions::CLEAR_FAULT_BYTE;
return buildCommandFromCommand(*id, nullptr, 0);
}
default: default:
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
@ -155,6 +172,13 @@ ReturnValue_t Max31865PT1000Handler::buildCommandFromCommand(
return DeviceHandlerIF::NO_COMMAND_DATA; return DeviceHandlerIF::NO_COMMAND_DATA;
} }
} }
case(Max31865Definitions::CLEAR_FAULT_BYTE): {
commandBuffer[0] = static_cast<uint8_t>(Max31865Definitions::CONFIG_CMD);
commandBuffer[1] = Max31865Definitions::CLEAR_FAULT_BIT_VAL;
DeviceHandlerBase::rawPacketLen = 2;
DeviceHandlerBase::rawPacket = commandBuffer.data();
return HasReturnvaluesIF::RETURN_OK;
}
case(Max31865Definitions::REQUEST_CONFIG): { case(Max31865Definitions::REQUEST_CONFIG): {
commandBuffer[0] = static_cast<uint8_t>( commandBuffer[0] = static_cast<uint8_t>(
Max31865Definitions::REQUEST_CONFIG); Max31865Definitions::REQUEST_CONFIG);
@ -233,6 +257,7 @@ void Max31865PT1000Handler::fillCommandAndReplyMap() {
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3, insertInCommandAndReplyMap(Max31865Definitions::REQUEST_RTD, 3,
&sensorDataset); &sensorDataset);
insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3); insertInCommandAndReplyMap(Max31865Definitions::REQUEST_FAULT_BYTE, 3);
insertInCommandAndReplyMap(Max31865Definitions::CLEAR_FAULT_BYTE, 3);
} }
ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start, ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
@ -290,6 +315,15 @@ ReturnValue_t Max31865PT1000Handler::scanForReply(const uint8_t *start,
*foundLen = 2; *foundLen = 2;
internalState = InternalState::RUNNING; internalState = InternalState::RUNNING;
} }
else if(internalState == InternalState::CLEAR_FAULT_BYTE) {
*foundId = Max31865Definitions::CLEAR_FAULT_BYTE;
*foundLen = 2;
if(mode == _MODE_START_UP) {
commandExecuted = true;
} else {
internalState = InternalState::RUNNING;
}
}
else { else {
*foundId = Max31865Definitions::REQUEST_CONFIG; *foundId = Max31865Definitions::REQUEST_CONFIG;
*foundLen = configReplySize; *foundLen = configReplySize;
@ -306,10 +340,11 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
if(packet[1] != DEFAULT_CONFIG) { if(packet[1] != DEFAULT_CONFIG) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
// it propably would be better if we at least try one restart.. // it propably would be better if we at least try one restart..
sif::error << "Max31865PT1000Handler: Object ID: " << std::hex << this->getObjectId() sif::error << "Max31865PT1000Handler: 0x" << std::hex << this->getObjectId()
<< ": Invalid configuration reply!" << std::endl; << ": Invalid configuration reply" << std::endl;
#else #else
sif::printError("Max31865PT1000Handler: Invalid configuration reply!\n"); sif::printError("Max31865PT1000Handler: %04x: Invalid configuration reply!\n",
this->getObjectId());
#endif #endif
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -360,9 +395,14 @@ ReturnValue_t Max31865PT1000Handler::interpretDeviceReply(
case(Max31865Definitions::REQUEST_RTD): { case(Max31865Definitions::REQUEST_RTD): {
// first bit of LSB reply byte is the fault bit // first bit of LSB reply byte is the fault bit
uint8_t faultBit = packet[2] & 0b0000'0001; uint8_t faultBit = packet[2] & 0b0000'0001;
if(faultBit == 1) { if(resetFaultBit) {
internalState = InternalState::CLEAR_FAULT_BYTE;
resetFaultBit = false;
}
else if(faultBit == 1) {
// Maybe we should attempt to restart it? // Maybe we should attempt to restart it?
internalState = InternalState::REQUEST_FAULT_BYTE; internalState = InternalState::REQUEST_FAULT_BYTE;
resetFaultBit = true;
} }
// RTD value consists of last seven bits of the LSB reply byte and // RTD value consists of last seven bits of the LSB reply byte and
@ -495,6 +535,12 @@ ReturnValue_t Max31865PT1000Handler::initializeLocalDataPool(localpool::DataPool
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
void Max31865PT1000Handler::modeChanged() { void Max31865PT1000Handler::setInstantNormal(bool instantNormal) {
internalState = InternalState::NONE; this->instantNormal = instantNormal;
}
void Max31865PT1000Handler::modeChanged() {
if(mode == MODE_OFF) {
internalState = InternalState::NONE;
}
} }

View File

@ -45,6 +45,7 @@ public:
// 8. 1 for 50 Hz filter, 0 for 60 Hz filter (noise rejection filter) // 8. 1 for 50 Hz filter, 0 for 60 Hz filter (noise rejection filter)
static constexpr uint8_t DEFAULT_CONFIG = 0b11000001; static constexpr uint8_t DEFAULT_CONFIG = 0b11000001;
void setInstantNormal(bool instantNormal);
/** /**
* Expected temperature range is -100 C and 100 C. * Expected temperature range is -100 C and 100 C.
* If there are temperatures beyond this range there must be a fault. * If there are temperatures beyond this range there must be a fault.
@ -59,7 +60,7 @@ public:
static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm static constexpr float RTD_RREF_PT1000 = 4020.0; //!< Ohm
static constexpr float RTD_RESISTANCE0_PT1000 = 1000.0; //!< Ohm static constexpr float RTD_RESISTANCE0_PT1000 = 1000.0; //!< Ohm
protected: protected:
/* DeviceHandlerBase abstract function implementation */ // DeviceHandlerBase abstract function implementation
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t * id) override;
@ -85,6 +86,7 @@ protected:
private: private:
uint8_t switchId = 0; uint8_t switchId = 0;
bool instantNormal = true;
enum class InternalState { enum class InternalState {
NONE, NONE,
@ -96,12 +98,14 @@ private:
REQUEST_LOW_THRESHOLD, REQUEST_LOW_THRESHOLD,
REQUEST_CONFIG, REQUEST_CONFIG,
RUNNING, RUNNING,
REQUEST_FAULT_BYTE REQUEST_FAULT_BYTE,
CLEAR_FAULT_BYTE
}; };
InternalState internalState = InternalState::NONE; InternalState internalState = InternalState::NONE;
bool commandExecuted = false; bool commandExecuted = false;
bool resetFaultBit = false;
dur_millis_t startTime = 0; dur_millis_t startTime = 0;
uint8_t faultByte = 0; uint8_t faultByte = 0;
std::array<uint8_t, 3> commandBuffer { 0 }; std::array<uint8_t, 3> commandBuffer { 0 };

View File

@ -17,13 +17,17 @@ enum PoolIds: lp_id_t {
static constexpr DeviceCommandId_t CONFIG_CMD = 0x80; static constexpr DeviceCommandId_t CONFIG_CMD = 0x80;
static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83; static constexpr DeviceCommandId_t WRITE_HIGH_THRESHOLD = 0x83;
static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85; static constexpr DeviceCommandId_t WRITE_LOW_THRESHOLD = 0x85;
static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00; static constexpr DeviceCommandId_t REQUEST_CONFIG = 0x00;
static constexpr DeviceCommandId_t REQUEST_RTD = 0x01; static constexpr DeviceCommandId_t REQUEST_RTD = 0x01;
static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03; static constexpr DeviceCommandId_t REQUEST_HIGH_THRESHOLD = 0x03;
static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05; static constexpr DeviceCommandId_t REQUEST_LOW_THRESHOLD = 0x05;
static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07; static constexpr DeviceCommandId_t REQUEST_FAULT_BYTE = 0x07;
static constexpr DeviceCommandId_t CLEAR_FAULT_BYTE = 0x08;
static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD; static constexpr uint32_t MAX31865_SET_ID = REQUEST_RTD;
static constexpr uint8_t CLEAR_FAULT_BIT_VAL = 0b0000'0010;
static constexpr size_t MAX_REPLY_SIZE = 5; static constexpr size_t MAX_REPLY_SIZE = 5;