fram rec
EIVE/eive-obsw/pipeline/head This commit looks good Details

This commit is contained in:
Irini Kosmidou 2022-04-26 13:22:56 +02:00
parent 578899b5a5
commit e2f0c0f1be
1 changed files with 9 additions and 6 deletions

View File

@ -25,7 +25,7 @@ UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
: TestTask(objectId), reader(reader) {
mode = TestModes::SCEX;
scexMode = ScexModes::READER_TASK;
currCmd = scex::ScexCmds::PING;
currCmd = scex::ScexCmds::FRAM;
if (scexMode == ScexModes::SIMPLE) {
auto encodingBuf = new std::array<uint8_t, 4096>;
DleParser::BufPair encodingBufPair{encodingBuf->data(), encodingBuf->size()};
@ -178,7 +178,7 @@ void UartTestClass::scexPeriodic() {
} else {
if (not cmdSent) {
size_t len = 0;
prepareScexCmd(scex::ScexCmds::PING, false, cmdBuf.data(), &len);
prepareScexCmd(currCmd, false, cmdBuf.data(), &len);
reader->sendMessage(uartCookie, cmdBuf.data(), len);
cmdSent = true;
cmdDone = false;
@ -199,21 +199,24 @@ void UartTestClass::scexPeriodic() {
//ping
//if ping cmd
if(helper.getCmd() == PING) {
ofstream out("/tmp/scex-ping.bin", ofstream::binary );
if (out.bad()) {
sif::warning << "bad" <<std::endl;
}
out << helper;
}
//fram
//packetcounter eins höher, wenn mehr packet verloren ->
//countdown (max 2min), wenn nicht if (helper.getPacketCounter() == helper.getTotalPacketCounter()) { nach 2min reader->finish();
if(helper.getCmd() == FRAM) {
if(helper.getPacketCounter() == 0) {
// neues file anlegen wie oben ping
ofstream out("/tmp/scex-fram.bin", ofstream::binary ); // neues file anlegen wie oben ping
} else {
// an bestehendes file hinzufügen
ofstream out("/tmp/scex-fram.bin", ofstream::binary | ofstream::app );// an bestehendes file hinzufügen
out << helper;
}
}
out << helper;
if (helper.getPacketCounter() == helper.getTotalPacketCounter()) {
reader->finish();
@ -326,7 +329,7 @@ void UartTestClass::scexSimplePeriodic() {
int UartTestClass::prepareScexCmd(scex::ScexCmds cmd, bool tempCheck, uint8_t* cmdBuf,
size_t* len) {
using namespace scex;
// Send ping command
// Send command
cmdBuf[0] = scex::createCmdByte(cmd, false);
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
// telecommand so far