refactored FIFO handling
Some checks are pending
EIVE/eive-obsw/pipeline/head Build started...
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2023-03-06 00:55:12 +01:00
parent f82cc2aeda
commit 3b61697615
9 changed files with 91 additions and 48 deletions

View File

@ -5,6 +5,7 @@
#include <chrono>
#include <cstdint>
#include <optional>
#include <queue>
#include <string>
class WatchdogTask {
@ -35,15 +36,17 @@ class WatchdogTask {
bool watchingObsw = false;
bool printNotRunningLatch = false;
std::array<uint8_t, 64> buf;
std::optional<std::chrono::time_point<std::chrono::system_clock>> notRunningStart;
std::queue<LoopResult> resultQueue;
std::optional<std::chrono::time_point<std::chrono::steady_clock>> notRunningStart;
States state = States::NOT_STARTED;
// Primary loop. Takes care of delaying, and reading from the communication pipe and translating
// messages to loop results.
LoopResult watchdogLoop();
void watchdogLoop();
bool stateMachine(LoopResult result);
LoopResult pollEvent(struct pollfd& waiter);
LoopResult parseCommand(ssize_t readLen);
void pollEvent(struct pollfd& waiter);
void parseCommands(ssize_t readLen);
int performRunningOperation();
int performNotRunningOperation(LoopResult type);