eive-obsw/mission/devices/torquer.cpp
Robin Mueller 29a34256a7
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
old code seems to work
2022-10-20 15:08:33 +02:00

28 lines
616 B
C++

#include "torquer.h"
#include <fsfw/ipc/MutexGuard.h>
MutexIF* TORQUE_LOCK = nullptr;
namespace torquer {
bool TORQUEING = false;
bool NEW_ACTUATION_FLAG = false;
Countdown TORQUE_COUNTDOWN = Countdown();
bool mgtIsTorqueing(dur_millis_t* remainingTorqueDuration) {
if (TORQUEING and remainingTorqueDuration != nullptr) {
*remainingTorqueDuration = TORQUE_COUNTDOWN.getRemainingMillis() + TORQUE_BUFFER_TIME_MS;
}
return TORQUEING;
}
MutexIF* lazyLock() {
if (TORQUE_LOCK == nullptr) {
TORQUE_LOCK = MutexFactory::instance()->createMutex();
}
return TORQUE_LOCK;
}
} // namespace torquer