this seems to work
EIVE/eive-obsw/pipeline/head This commit looks good Details

This commit is contained in:
Robin Müller 2022-10-06 11:15:55 +02:00
parent adbece25aa
commit 0341865e98
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
5 changed files with 22 additions and 32 deletions

View File

@ -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";

2
fsfw

@ -1 +1 @@
Subproject commit d1630cdc4c3fc801934f1e394efa80e898f8031b
Subproject commit 8195587604c5f14f04bf25b16a514cf3c771284b

View File

@ -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;

View File

@ -5,10 +5,10 @@
#include <algorithm>
#include <ctime>
#include <iostream>
#include <fstream>
#include <random>
#include <filesystem>
#include <fstream>
#include <iostream>
#include <random>
#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();
}

View File

@ -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 <fsfw/devicehandlers/DeviceHandlerIF.h>
#include <fsfw/events/Event.h>
#include <cstdint>
#include <vector>
#include "eive/eventSubsystemIds.h"
#include "eive/objects.h"
// Definitions for the Solar Cell Experiment
namespace scex {