somethings wrong
Some checks failed
EIVE/eive-obsw/pipeline/pr-main There was a failure building this commit

This commit is contained in:
2023-11-14 15:28:27 +01:00
parent bb20def961
commit 2563432171
6 changed files with 42 additions and 27 deletions

View File

@ -45,10 +45,12 @@ PlocSupvUartManager::PlocSupvUartManager(object_id_t objectId)
PlocSupvUartManager::~PlocSupvUartManager() = default;
ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
sif::debug << "init ploc supv uart IF" << std::endl;
auto* uartCookie = dynamic_cast<SerialCookie*>(cookie);
if (uartCookie == nullptr) {
return FAILED;
}
sif::debug << "hello blub" << std::endl;
std::string devname = uartCookie->getDeviceFile();
/* Get file descriptor */
serialPort = open(devname.c_str(), O_RDWR);
@ -70,7 +72,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
tty.c_lflag &= ~(ICANON | ECHO);
// Blocking mode, 0.2 seconds timeout
tty.c_cc[VTIME] = 2;
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 0;
serial::setBaudrate(tty, uartCookie->getBaudrate());
@ -80,6 +82,7 @@ ReturnValue_t PlocSupvUartManager::initializeInterface(CookieIF* cookie) {
}
// Flush received and unread data
tcflush(serialPort, TCIOFLUSH);
sif::debug << "ploc supv cfg complete" << std::endl;
return OK;
}
@ -114,6 +117,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
lock->lockMutex();
InternalState currentState = state;
lock->unlockMutex();
sif::debug << "supv uart man post-lock" << std::endl;
switch (currentState) {
case InternalState::SLEEPING:
case InternalState::GO_TO_SLEEP: {
@ -139,6 +143,7 @@ ReturnValue_t PlocSupvUartManager::performOperation(uint8_t operationCode) {
ReturnValue_t PlocSupvUartManager::handleUartReception() {
ReturnValue_t result = OK;
ReturnValue_t status = OK;
sif::debug << "handling uart reception" << std::endl;
ssize_t bytesRead = read(serialPort, reinterpret_cast<void*>(recBuf.data()),
static_cast<unsigned int>(recBuf.size()));
if (bytesRead == 0) {