split up op divider, assing imtq power switcher
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2022-04-12 15:27:48 +02:00
parent 5e0e8232df
commit 604870d1fe
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 28 additions and 24 deletions

View File

@ -29,7 +29,8 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY; xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
CoreController::CoreController(object_id_t objectId) CoreController::CoreController(object_id_t objectId)
: ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider(5), hkSet(this) { : ExtendedControllerBase(objectId, objects::NO_OBJECT, 5), opDivider5(5), opDivider10(10),
hkSet(this) {
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
try { try {
result = initWatchdogFifo(); result = initWatchdogFifo();
@ -75,6 +76,8 @@ void CoreController::performControlOperation() {
sdStateMachine(); sdStateMachine();
performMountedSdCardOperations(); performMountedSdCardOperations();
readHkData(); readHkData();
opDivider5.checkAndIncrement();
opDivider10.checkAndIncrement();
} }
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
@ -1200,7 +1203,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
void CoreController::performWatchdogControlOperation() { void CoreController::performWatchdogControlOperation() {
// Only perform each fifth iteration // Only perform each fifth iteration
if (watchdogFifoFd != 0 and opDivider.checkAndIncrement()) { if (watchdogFifoFd != 0 and opDivider5.check()) {
if (watchdogFifoFd == RETRY_FIFO_OPEN) { if (watchdogFifoFd == RETRY_FIFO_OPEN) {
// Open FIFO write only and non-blocking // Open FIFO write only and non-blocking
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK); watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
@ -1692,8 +1695,9 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C
} }
ReturnValue_t CoreController::timeFileHandler() { ReturnValue_t CoreController::timeFileHandler() {
if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) { // Always set time. We could only set it if it is updated by GPS, but then the backup time would
if(opDivider.check()) { // become obsolete on GPS problems.
if(opDivider10.check()) {
// It is assumed that the system time is set from the GPS time // It is assumed that the system time is set from the GPS time
timeval currentTime = {}; timeval currentTime = {};
ReturnValue_t result = Clock::getClock_timeval(&currentTime); ReturnValue_t result = Clock::getClock_timeval(&currentTime);
@ -1709,7 +1713,6 @@ ReturnValue_t CoreController::timeFileHandler() {
} }
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl; timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
} }
}
return RETURN_OK; return RETURN_OK;
} }

View File

@ -188,7 +188,8 @@ class CoreController : public ExtendedControllerBase {
* Index 3: Chip 1 Copy 1 * Index 3: Chip 1 Copy 1
*/ */
std::array<bool, 4> protArray; std::array<bool, 4> protArray;
PeriodicOperationDivider opDivider; PeriodicOperationDivider opDivider5;
PeriodicOperationDivider opDivider10;
core::HkSet hkSet; core::HkSet hkSet;

View File

@ -161,12 +161,11 @@ void ObjectFactory::produce(void* args) {
I2cCookie* imtqI2cCookie = I2cCookie* imtqI2cCookie =
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV); new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie); auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
imtqHandler->setPowerSwitcher(pwrSwitcher);
static_cast<void>(imtqHandler); static_cast<void>(imtqHandler);
#if OBSW_DEBUG_IMTQ == 1 #if OBSW_TEST_IMTQ == 1
imtqHandler->setStartUpImmediately(); imtqHandler->setStartUpImmediately();
imtqHandler->setToGoToNormal(true); imtqHandler->setToGoToNormal(true);
#else
(void)imtqHandler;
#endif #endif
#endif #endif
createReactionWheelComponents(gpioComIF); createReactionWheelComponents(gpioComIF);

View File

@ -127,6 +127,8 @@ debugging. */
#define OBSW_DEBUG_PL_PCDU 0 #define OBSW_DEBUG_PL_PCDU 0
#define OBSW_TEST_BPX_BATT 0 #define OBSW_TEST_BPX_BATT 0
#define OBSW_DEBUG_BPX_BATT 0 #define OBSW_DEBUG_BPX_BATT 0
#define OBSW_TEST_IMTQ 0
#define OBSW_DEBUG_IMTQ 0
#define OBSW_TEST_LIBGPIOD 0 #define OBSW_TEST_LIBGPIOD 0
#define OBSW_TEST_PLOC_HANDLER 0 #define OBSW_TEST_PLOC_HANDLER 0
@ -143,7 +145,6 @@ debugging. */
#define OBSW_DEBUG_GPS 0 #define OBSW_DEBUG_GPS 0
#define OBSW_DEBUG_ACU 0 #define OBSW_DEBUG_ACU 0
#define OBSW_DEBUG_SYRLINKS 0 #define OBSW_DEBUG_SYRLINKS 0
#define OBSW_DEBUG_IMTQ 0
#define OBSW_DEBUG_RW 0 #define OBSW_DEBUG_RW 0
#define OBSW_DEBUG_PDEC_HANDLER 0 #define OBSW_DEBUG_PDEC_HANDLER 0