From bbb07dd459efc06d9a3338ad3f97b7269f002481 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 18 Feb 2022 13:10:39 +0100 Subject: [PATCH] sus dev handler update --- fsfw | 2 +- linux/boardtest/SpiTestClass.cpp | 4 ++-- linux/devices/SusHandler.cpp | 21 +++++++++++---------- linux/devices/SusHandler.h | 3 ++- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/fsfw b/fsfw index 9e92afbf..bd05afbd 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 9e92afbf076b57df843a1ee526bd63c3303995a5 +Subproject commit bd05afbddd7e2da43b19b8ceafb6272e73d5464d diff --git a/linux/boardtest/SpiTestClass.cpp b/linux/boardtest/SpiTestClass.cpp index 60abbe67..5d0fd229 100644 --- a/linux/boardtest/SpiTestClass.cpp +++ b/linux/boardtest/SpiTestClass.cpp @@ -308,8 +308,8 @@ void SpiTestClass::performOneShotMax1227Test() { adcCfg.testSus[4].doTest = true; adcCfg.testSus[4].intConv = true; - adcCfg.testSus[1].doTest = true; - adcCfg.testSus[1].intConv = true; + adcCfg.testSus[11].doTest = true; + adcCfg.testSus[11].intConv = true; adcCfg.testSus[5].doTest = true; adcCfg.testSus[5].intConv = true; diff --git a/linux/devices/SusHandler.cpp b/linux/devices/SusHandler.cpp index bf33e4d7..7303c356 100644 --- a/linux/devices/SusHandler.cpp +++ b/linux/devices/SusHandler.cpp @@ -6,9 +6,9 @@ #include "OBSWConfig.h" -SusHandler::SusHandler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie, +SusHandler::SusHandler(object_id_t objectId, uint8_t susIdx, object_id_t comIF, CookieIF *comCookie, LinuxLibgpioIF *gpioComIF, gpioId_t chipSelectId) - : DeviceHandlerBase(objectId, comIF, comCookie), divider(5), dataset(this) {} + : DeviceHandlerBase(objectId, comIF, comCookie), divider(5), dataset(this), susIdx(susIdx) {} SusHandler::~SusHandler() {} @@ -228,14 +228,15 @@ void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediat void SusHandler::printDataset() { #if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 if (divider.checkAndIncrement()) { - sif::info << "SUS Object ID 0x" << std::hex << this->getObjectId() << ":" << std::endl; - sif::info << "Temperature: " << dataset.temperatureCelcius << " C" << std::endl; - sif::info << "AIN0: " << std::dec << dataset.ain0 << std::endl; - sif::info << "AIN1: " << std::dec << dataset.ain1 << std::endl; - sif::info << "AIN2: " << std::dec << dataset.ain2 << std::endl; - sif::info << "AIN3: " << std::dec << dataset.ain3 << std::endl; - sif::info << "AIN4: " << std::dec << dataset.ain4 << std::endl; - sif::info << "AIN5: " << std::dec << dataset.ain5 << std::endl; + sif::info << "SUS " << std::setw(2) << std::dec << static_cast(susIdx) << " ID " << std::hex + << this->getObjectId() << " [" << std::hex << std::setw(3); + sif::info << dataset.ain0 << ","; + sif::info << dataset.ain1 << ","; + sif::info << dataset.ain2 << ","; + sif::info << dataset.ain3 << ","; + sif::info << dataset.ain4 << ","; + sif::info << dataset.ain5 << "] "; + sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl; } #endif } diff --git a/linux/devices/SusHandler.h b/linux/devices/SusHandler.h index 04fd3032..4088bd0a 100644 --- a/linux/devices/SusHandler.h +++ b/linux/devices/SusHandler.h @@ -28,7 +28,7 @@ class SusHandler : public DeviceHandlerBase { static const uint8_t FIRST_WRITE = 7; - SusHandler(object_id_t objectId, object_id_t comIF, CookieIF* comCookie, + SusHandler(object_id_t objectId, uint8_t susIdx, object_id_t comIF, CookieIF* comCookie, LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId); virtual ~SusHandler(); @@ -79,6 +79,7 @@ class SusHandler : public DeviceHandlerBase { // externally clocked mode ClkModes clkMode = ClkModes::INT_CLOCKED; + uint8_t susIdx = 0; uint8_t cmdBuffer[SUS::MAX_CMD_SIZE]; ComStates comState = ComStates::IDLE;