diff --git a/bsp_q7s/boardconfig/busConf.h b/bsp_q7s/boardconfig/busConf.h index ef84b1d0..a6316927 100644 --- a/bsp_q7s/boardconfig/busConf.h +++ b/bsp_q7s/boardconfig/busConf.h @@ -15,7 +15,7 @@ static constexpr char UART_PLOC_MPSOC_DEV[] = "/dev/ul-plmpsoc"; static constexpr char UART_PLOC_SUPERVSIOR_DEV[] = "/dev/ul-plsv"; static constexpr char UART_SYRLINKS_DEV[] = "/dev/ul-syrlinks"; static constexpr char UART_STAR_TRACKER_DEV[] = "/dev/ul-str"; -static constexpr char UART_SCEX_DEV[] = "/dev/ttyS3";//"/dev/ul-scex"; +static constexpr char UART_SCEX_DEV[] = "/dev/ttyS3"; //"/dev/ul-scex"; static constexpr char UIO_PDEC_REGISTERS[] = "/dev/uio0"; static constexpr char UIO_PTME[] = "/dev/uio1"; diff --git a/fsfw b/fsfw index d1630cdc..81955876 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit d1630cdc4c3fc801934f1e394efa80e898f8031b +Subproject commit 8195587604c5f14f04bf25b16a514cf3c771284b diff --git a/linux/devices/ScexUartReader.cpp b/linux/devices/ScexUartReader.cpp index b2138999..024e5222 100644 --- a/linux/devices/ScexUartReader.cpp +++ b/linux/devices/ScexUartReader.cpp @@ -52,12 +52,15 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { } size_t bytesRead = 0; ReturnValue_t result = returnvalue::OK; + // Can be used to read frame, parity and overrun errors + // serial_icounter_struct icounter{}; + // uart::readCountersAndErrors(serialPort, icounter); while (result != DleParser::NO_PACKET_FOUND) { result = dleParser.parseRingBuf(bytesRead); if (result == returnvalue::OK) { // sif::info << "Found dle packet, read " << bytesRead << " bytes" << std::endl; // Packet found, advance read pointer. - auto& decodedPacket = dleParser.getContext().decodedPacket; + auto &decodedPacket = dleParser.getContext().decodedPacket; handleFoundDlePacket(decodedPacket.first, decodedPacket.second); dleParser.confirmBytesRead(bytesRead); } else if (result != DleParser::NO_PACKET_FOUND) { @@ -68,18 +71,6 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) { dleParser.confirmBytesRead(bytesRead); } } - // TODO: Move this to some FSFW helper function - /* - serial_icounter_struct uartErrors{}; - int ioctlres = ioctl(serialPort, TIOCGICOUNT, &uartErrors); - if (uartErrors.parity > 0) { - sif::warning << "Parity error. Current count: " << uartErrors.parity << std::endl; - } - if (uartErrors.overrun > 0) { - sif::warning << "Overrun error. Current count: " << uartErrors.overrun << std::endl; - } - */ - TaskFactory::delayTask(400); } else if (bytesRead < 0) { sif::warning << "ScexUartReader::performOperation: read call failed with error [" << errno @@ -118,7 +109,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { return FAILED; } // Setting up UART parameters - tty.c_cflag &= ~PARENB; // Clear parity bit + tty.c_cflag &= ~PARENB; // Clear parity bit if (uartCookie->getStopBits() == StopBits::TWO_STOP_BITS) { // Use two stop bits tty.c_cflag |= CSTOPB; @@ -143,7 +134,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) { if (cfsetispeed(&tty, B38400) != 0) { sif::warning << "ScexUartReader::initializeInterface: Setting baud rate failed" << std::endl; } -//#endif + //#endif if (tcsetattr(serialPort, TCSANOW, &tty) != 0) { sif::warning << "ScexUartReader::initializeInterface: tcsetattr call failed with error [" << errno << ", " << strerror(errno) << std::endl; diff --git a/mission/devices/ScexDeviceHandler.cpp b/mission/devices/ScexDeviceHandler.cpp index 156dd9b8..529a886c 100644 --- a/mission/devices/ScexDeviceHandler.cpp +++ b/mission/devices/ScexDeviceHandler.cpp @@ -5,10 +5,10 @@ #include #include -#include -#include -#include #include +#include +#include +#include #include "fsfw/globalfunctions/CRC.h" #include "mission/devices/devicedefinitions/ScexDefinitions.h" @@ -348,18 +348,16 @@ void ScexDeviceHandler::modeChanged() {} void ScexDeviceHandler::setPowerSwitcher(PowerSwitchIF& powerSwitcher, power::Switch_t switchId) { DeviceHandlerBase::setPowerSwitcher(&powerSwitcher); this->switchId = switchId; - } ReturnValue_t ScexDeviceHandler::initializeAfterTaskCreation() { + auto mntPrefix = sdcMan.getCurrentMountPrefix(); + std::filesystem::path fullFilePath = mntPrefix; + fullFilePath /= "scex"; + bool fileExists = std::filesystem::exists(fullFilePath); - auto mntPrefix = sdcMan.getCurrentMountPrefix(); - std::filesystem::path fullFilePath = mntPrefix; - fullFilePath /= "scex"; - bool fileExists = std::filesystem::exists(fullFilePath); - - if(not fileExists){ - std::filesystem::create_directory(fullFilePath); - } - return DeviceHandlerBase::initializeAfterTaskCreation(); + if (not fileExists) { + std::filesystem::create_directory(fullFilePath); + } + return DeviceHandlerBase::initializeAfterTaskCreation(); } diff --git a/mission/devices/devicedefinitions/ScexDefinitions.h b/mission/devices/devicedefinitions/ScexDefinitions.h index 89b14c75..22e3878b 100644 --- a/mission/devices/devicedefinitions/ScexDefinitions.h +++ b/mission/devices/devicedefinitions/ScexDefinitions.h @@ -1,14 +1,15 @@ #ifndef MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ #define MISSION_DEVICES_DEVICEDEFINITIONS_SCEXDEFINITIONS_H_ -#include "eive/objects.h" -#include "eive/eventSubsystemIds.h" #include #include #include #include +#include "eive/eventSubsystemIds.h" +#include "eive/objects.h" + // Definitions for the Solar Cell Experiment namespace scex {