fram rec
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Irini Kosmidou 2022-04-26 13:22:56 +02:00
parent 578899b5a5
commit e2f0c0f1be

View File

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