split up op divider, assing imtq power switcher
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
This commit is contained in:
parent
5e0e8232df
commit
604870d1fe
@ -29,7 +29,8 @@ xsc::Chip CoreController::CURRENT_CHIP = xsc::Chip::NO_CHIP;
|
||||
xsc::Copy CoreController::CURRENT_COPY = xsc::Copy::NO_COPY;
|
||||
|
||||
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;
|
||||
try {
|
||||
result = initWatchdogFifo();
|
||||
@ -75,6 +76,8 @@ void CoreController::performControlOperation() {
|
||||
sdStateMachine();
|
||||
performMountedSdCardOperations();
|
||||
readHkData();
|
||||
opDivider5.checkAndIncrement();
|
||||
opDivider10.checkAndIncrement();
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
@ -1200,7 +1203,7 @@ ReturnValue_t CoreController::handleProtInfoUpdateLine(std::string nextLine) {
|
||||
|
||||
void CoreController::performWatchdogControlOperation() {
|
||||
// Only perform each fifth iteration
|
||||
if (watchdogFifoFd != 0 and opDivider.checkAndIncrement()) {
|
||||
if (watchdogFifoFd != 0 and opDivider5.check()) {
|
||||
if (watchdogFifoFd == RETRY_FIFO_OPEN) {
|
||||
// Open FIFO write only and non-blocking
|
||||
watchdogFifoFd = open(watchdog::FIFO_NAME.c_str(), O_WRONLY | O_NONBLOCK);
|
||||
@ -1692,23 +1695,23 @@ void CoreController::setRebootMechanismLock(bool lock, xsc::Chip tgtChip, xsc::C
|
||||
}
|
||||
|
||||
ReturnValue_t CoreController::timeFileHandler() {
|
||||
if (gpsFix == GpsHyperion::FixMode::FIX_2D or gpsFix == GpsHyperion::FixMode::FIX_3D) {
|
||||
if(opDivider.check()) {
|
||||
// It is assumed that the system time is set from the GPS time
|
||||
timeval currentTime = {};
|
||||
ReturnValue_t result = Clock::getClock_timeval(¤tTime);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::string fileName = currMntPrefix + TIME_FILE;
|
||||
std::ofstream timeFile(fileName);
|
||||
if (not timeFile.good()) {
|
||||
sif::error << "CoreController::timeFileHandler: Error opening time file: " <<
|
||||
strerror(errno) << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
|
||||
// Always set time. We could only set it if it is updated by GPS, but then the backup time would
|
||||
// become obsolete on GPS problems.
|
||||
if(opDivider10.check()) {
|
||||
// It is assumed that the system time is set from the GPS time
|
||||
timeval currentTime = {};
|
||||
ReturnValue_t result = Clock::getClock_timeval(¤tTime);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
std::string fileName = currMntPrefix + TIME_FILE;
|
||||
std::ofstream timeFile(fileName);
|
||||
if (not timeFile.good()) {
|
||||
sif::error << "CoreController::timeFileHandler: Error opening time file: " <<
|
||||
strerror(errno) << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
timeFile << "UNIX SECONDS: " << currentTime.tv_sec << std::endl;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
@ -188,7 +188,8 @@ class CoreController : public ExtendedControllerBase {
|
||||
* Index 3: Chip 1 Copy 1
|
||||
*/
|
||||
std::array<bool, 4> protArray;
|
||||
PeriodicOperationDivider opDivider;
|
||||
PeriodicOperationDivider opDivider5;
|
||||
PeriodicOperationDivider opDivider10;
|
||||
|
||||
core::HkSet hkSet;
|
||||
|
||||
|
@ -161,12 +161,11 @@ void ObjectFactory::produce(void* args) {
|
||||
I2cCookie* imtqI2cCookie =
|
||||
new I2cCookie(addresses::IMTQ, IMTQ::MAX_REPLY_SIZE, q7s::I2C_DEFAULT_DEV);
|
||||
auto imtqHandler = new IMTQHandler(objects::IMTQ_HANDLER, objects::I2C_COM_IF, imtqI2cCookie);
|
||||
imtqHandler->setPowerSwitcher(pwrSwitcher);
|
||||
static_cast<void>(imtqHandler);
|
||||
#if OBSW_DEBUG_IMTQ == 1
|
||||
#if OBSW_TEST_IMTQ == 1
|
||||
imtqHandler->setStartUpImmediately();
|
||||
imtqHandler->setToGoToNormal(true);
|
||||
#else
|
||||
(void)imtqHandler;
|
||||
#endif
|
||||
#endif
|
||||
createReactionWheelComponents(gpioComIF);
|
||||
|
@ -127,6 +127,8 @@ debugging. */
|
||||
#define OBSW_DEBUG_PL_PCDU 0
|
||||
#define OBSW_TEST_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_PLOC_HANDLER 0
|
||||
@ -143,9 +145,8 @@ debugging. */
|
||||
#define OBSW_DEBUG_GPS 0
|
||||
#define OBSW_DEBUG_ACU 0
|
||||
#define OBSW_DEBUG_SYRLINKS 0
|
||||
#define OBSW_DEBUG_IMTQ 0
|
||||
#define OBSW_DEBUG_RW 0
|
||||
#define OBSW_DEBUG_PDEC_HANDLER 0
|
||||
#define OBSW_DEBUG_PDEC_HANDLER 0
|
||||
|
||||
#ifdef TE0720_1CFA
|
||||
#define OBSW_DEBUG_PLOC_SUPERVISOR 1
|
||||
|
Loading…
Reference in New Issue
Block a user