supervisor fixes detected during testing
This commit is contained in:
@ -6,12 +6,13 @@
|
||||
#include "OBSWConfig.h"
|
||||
#ifdef XIPHOS_Q7S
|
||||
#include "bsp_q7s/memory/FilesystemHelper.h"
|
||||
#include "bsp_q7s/memory/SDCardManager.h"
|
||||
#endif
|
||||
|
||||
#include "bsp_q7s/memory/FilesystemHelper.h"
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "mission/utility/Timestamp.h"
|
||||
#include "mission/utility/Filenaming.h"
|
||||
#include "mission/utility/ProgressPrinter.h"
|
||||
#include "mission/utility/Timestamp.h"
|
||||
|
||||
PlocSupvHelper::PlocSupvHelper(object_id_t objectId) : SystemObject(objectId) {}
|
||||
|
||||
@ -57,8 +58,7 @@ ReturnValue_t PlocSupvHelper::performOperation(uint8_t operationCode) {
|
||||
} else if (result == PROCESS_TERMINATED) {
|
||||
// Event already triggered
|
||||
break;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
triggerEvent(SUPV_EVENT_BUFFER_REQUEST_FAILED, result);
|
||||
}
|
||||
internalState = InternalState::IDLE;
|
||||
@ -91,11 +91,11 @@ ReturnValue_t PlocSupvHelper::startUpdate(std::string file, uint8_t memoryId,
|
||||
sif::warning << "PlocSupvHelper::startUpdate: File " << file << " does not exist" << std::endl;
|
||||
return result;
|
||||
}
|
||||
result = FileSytemHelper::fileExists(file);
|
||||
result = FilesystemHelper::fileExists(file);
|
||||
if (result != RETURN_OK) {
|
||||
sif::warning << "PlocSupvHelper::startUpdate: The file " << file << " does not exist"
|
||||
<< std::endl;
|
||||
reurn result;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
#ifdef TE0720_1CFA
|
||||
@ -148,6 +148,10 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
ProgressPrinter progressPrinter("Supervisor update: ", update.length,
|
||||
ProgressPrinter::ONE_PERCENT);
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
uint8_t tempData[supv::WriteMemory::CHUNK_MAX];
|
||||
std::ifstream file(update.file, std::ifstream::binary);
|
||||
size_t remainingSize = update.length;
|
||||
@ -185,8 +189,10 @@ ReturnValue_t PlocSupvHelper::performUpdate() {
|
||||
return result;
|
||||
}
|
||||
bytesWritten += dataLength;
|
||||
#if OBSW_DEBUG_PLOC_SUPERVISOR == 1
|
||||
progressPrinter.print(bytesWritten);
|
||||
}
|
||||
|
||||
#endif /* OBSW_DEBUG_PLOC_SUPERVISOR == 1 */
|
||||
result = handleCheckMemoryCommand();
|
||||
if (result != RETURN_OK) {
|
||||
return result;
|
||||
@ -340,7 +346,7 @@ ReturnValue_t PlocSupvHelper::handleTmReception(supv::TmPacket* tmPacket, size_t
|
||||
}
|
||||
if (remainingBytes != 0) {
|
||||
sif::warning << "PlocSupvHelper::handleTmReception: Failed to read " << remainingBytes
|
||||
<< " bytes" << std::endl;
|
||||
<< " bytes" << std::endl;
|
||||
return RETURN_FAILED;
|
||||
}
|
||||
result = tmPacket->checkCrc();
|
||||
@ -435,13 +441,15 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
|
||||
uint32_t PlocSupvHelper::getFileSize(std::string filename) {
|
||||
std::ifstream file(filename, std::ifstream::binary);
|
||||
file.seekg(0, file.end);
|
||||
return file.tellg();
|
||||
uint32_t size = file.tellg();
|
||||
file.close();
|
||||
return size;
|
||||
}
|
||||
|
||||
ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
std::string filename = Filenaming::generateAbsoluteFilename(eventBufferReq.path,
|
||||
eventBufferReq.filename, timestamping);
|
||||
std::string filename = Filenaming::generateAbsoluteFilename(
|
||||
eventBufferReq.path, eventBufferReq.filename, timestamping);
|
||||
std::ofstream file(filename, std::ios_base::app | std::ios_base::out);
|
||||
uint32_t packetsRead = 0;
|
||||
size_t requestLen = 0;
|
||||
@ -460,7 +468,7 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
||||
result = handleTmReception(&tmPacket, requestLen);
|
||||
if (result != RETURN_OK) {
|
||||
sif::debug << "PlocSupvHelper::handleEventBufferReception: Failed while trying to read packet"
|
||||
<< " " << packetsRead + 1 << std::endl;
|
||||
<< " " << packetsRead + 1 << std::endl;
|
||||
file.close();
|
||||
return result;
|
||||
}
|
||||
@ -476,3 +484,7 @@ ReturnValue_t PlocSupvHelper::handleEventBufferReception() {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//ReturnValue_t PlocSupervisorHandler::parseStatusCode(std::string* meaning) {
|
||||
//
|
||||
//}
|
||||
|
Reference in New Issue
Block a user