sus printout runtime configurable
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-02-19 17:15:38 +01:00
parent f95abfe032
commit 68e1208b7f
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 33 additions and 16 deletions

View File

@ -463,6 +463,20 @@ void ObjectFactory::createSunSensorComponents(LinuxLibgpioIF* gpioComIF, SpiComI
susHandler9->setToGoToNormalMode(true); susHandler9->setToGoToNormalMode(true);
susHandler10->setToGoToNormalMode(true); susHandler10->setToGoToNormalMode(true);
susHandler11->setToGoToNormalMode(true); susHandler11->setToGoToNormalMode(true);
#if OBSW_DEBUG_SUS == 1
susHandler0->enablePeriodicPrintout(true, 3);
susHandler1->enablePeriodicPrintout(true, 3);
susHandler2->enablePeriodicPrintout(true, 3);
susHandler3->enablePeriodicPrintout(true, 3);
susHandler4->enablePeriodicPrintout(true, 3);
susHandler5->enablePeriodicPrintout(true, 3);
susHandler6->enablePeriodicPrintout(true, 3);
susHandler7->enablePeriodicPrintout(true, 3);
susHandler8->enablePeriodicPrintout(true, 3);
susHandler9->enablePeriodicPrintout(true, 3);
susHandler10->enablePeriodicPrintout(true, 3);
susHandler11->enablePeriodicPrintout(true, 3);
#endif
#endif #endif
#endif /* OBSW_ADD_SUN_SENSORS == 1 */ #endif /* OBSW_ADD_SUN_SENSORS == 1 */

View File

@ -226,7 +226,7 @@ ReturnValue_t SusHandler::initializeLocalDataPool(localpool::DataPool &localData
void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; } void SusHandler::setToGoToNormalMode(bool enable) { this->goToNormalModeImmediately = enable; }
void SusHandler::printDataset() { void SusHandler::printDataset() {
#if OBSW_VERBOSE_LEVEL >= 1 && OBSW_DEBUG_SUS == 1 if(periodicPrintout) {
if (divider.checkAndIncrement()) { if (divider.checkAndIncrement()) {
sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID " sif::info << "SUS " << std::setw(2) << std::dec << static_cast<int>(susIdx) << " ID "
<< std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3); << std::hex << "0x" << this->getObjectId() << " [" << std::hex << std::setw(3);
@ -238,5 +238,10 @@ void SusHandler::printDataset() {
sif::info << dataset.ain5 << "] "; sif::info << dataset.ain5 << "] ";
sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl; sif::info << "T[C] " << dataset.temperatureCelcius << " C" << std::endl;
} }
#endif }
}
void SusHandler::enablePeriodicPrintout(bool enable, uint8_t divider) {
this->periodicPrintout = enable;
this->divider.setDivider(divider);
} }

View File

@ -32,7 +32,7 @@ class SusHandler : public DeviceHandlerBase {
LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId); LinuxLibgpioIF* gpioComIF, gpioId_t chipSelectId);
virtual ~SusHandler(); virtual ~SusHandler();
// virtual ReturnValue_t performOperation(uint8_t counter) override; void enablePeriodicPrintout(bool enable, uint8_t divider);
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
void setToGoToNormalMode(bool enable); void setToGoToNormalMode(bool enable);
@ -48,7 +48,6 @@ class SusHandler : public DeviceHandlerBase {
ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId, ReturnValue_t scanForReply(const uint8_t* start, size_t remainingSize, DeviceCommandId_t* foundId,
size_t* foundLen) override; size_t* foundLen) override;
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override; ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) override;
// void setNormalDatapoolEntriesInvalid() override;
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
@ -68,9 +67,8 @@ class SusHandler : public DeviceHandlerBase {
READ_INT_CLOCKED_CONVERSIONS READ_INT_CLOCKED_CONVERSIONS
}; };
bool periodicPrintout = false;
PeriodicOperationDivider divider; PeriodicOperationDivider divider;
// LinuxLibgpioIF* gpioComIF = nullptr;
// gpioId_t chipSelectId = gpio::NO_GPIO;
bool goToNormalModeImmediately = false; bool goToNormalModeImmediately = false;
bool commandExecuted = false; bool commandExecuted = false;