Merge branch 'develop' into tmp_dev_custom_fdir
This commit is contained in:
@ -17,6 +17,10 @@
|
||||
#include "mission/utility/ProgressPrinter.h"
|
||||
#include "mission/utility/Timestamp.h"
|
||||
|
||||
extern "C" {
|
||||
#include <sagitta/client/actionreq.h>
|
||||
}
|
||||
|
||||
using namespace returnvalue;
|
||||
|
||||
StrComHandler::StrComHandler(object_id_t objectId) : SystemObject(objectId) {
|
||||
@ -305,6 +309,7 @@ ReturnValue_t StrComHandler::performImageUpload() {
|
||||
uint32_t imageSize = 0;
|
||||
struct UploadActionRequest uploadReq;
|
||||
uploadReq.position = 0;
|
||||
size_t writtenBytes = 0;
|
||||
#ifdef XIPHOS_Q7S
|
||||
if (not sdcMan->getActiveSdCard()) {
|
||||
return HasFileSystemIF::FILESYSTEM_INACTIVE;
|
||||
@ -327,7 +332,9 @@ ReturnValue_t StrComHandler::performImageUpload() {
|
||||
#if OBSW_DEBUG_STARTRACKER == 1
|
||||
ProgressPrinter progressPrinter("Image upload", imageSize);
|
||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||
while ((uploadReq.position + 1) * SIZE_IMAGE_PART < imageSize) {
|
||||
size_t fullChunks = imageSize / SIZE_IMAGE_PART;
|
||||
size_t remainder = imageSize % SIZE_IMAGE_PART;
|
||||
for (size_t idx = 0; idx < fullChunks; idx++) {
|
||||
if (terminate) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
@ -346,6 +353,7 @@ ReturnValue_t StrComHandler::performImageUpload() {
|
||||
progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART);
|
||||
#endif /* OBSW_DEBUG_STARTRACKER == 1 */
|
||||
uploadReq.position++;
|
||||
writtenBytes += SIZE_IMAGE_PART;
|
||||
|
||||
// This does a bit of delaying roughly every second
|
||||
if (uploadReq.position % 50 == 0) {
|
||||
@ -353,20 +361,20 @@ ReturnValue_t StrComHandler::performImageUpload() {
|
||||
TaskFactory::delayTask(2);
|
||||
}
|
||||
}
|
||||
std::memset(uploadReq.data, 0, sizeof(uploadReq.data));
|
||||
uint32_t remainder = imageSize - uploadReq.position * SIZE_IMAGE_PART;
|
||||
file.seekg(uploadReq.position * SIZE_IMAGE_PART, file.beg);
|
||||
file.read(reinterpret_cast<char*>(uploadReq.data), remainder);
|
||||
file.close();
|
||||
uploadReq.position++;
|
||||
arc_pack_upload_action_req(&uploadReq, cmdBuf.data(), &size);
|
||||
result = sendAndRead(size, uploadReq.position);
|
||||
if (result != returnvalue::OK) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = checkActionReply(replyLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
if (remainder > 0) {
|
||||
std::memset(uploadReq.data, 0, sizeof(uploadReq.data));
|
||||
file.seekg(fullChunks * SIZE_IMAGE_PART, file.beg);
|
||||
file.read(reinterpret_cast<char*>(uploadReq.data), remainder);
|
||||
file.close();
|
||||
arc_pack_upload_action_req(&uploadReq, cmdBuf.data(), &size);
|
||||
result = sendAndRead(size, uploadReq.position);
|
||||
if (result != returnvalue::OK) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
result = checkActionReply(replyLen);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#if OBSW_DEBUG_STARTRACKER == 1
|
||||
progressPrinter.print((uploadReq.position + 1) * SIZE_IMAGE_PART);
|
||||
|
@ -18,10 +18,6 @@
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw_hal/linux/serial/SerialComIF.h"
|
||||
|
||||
extern "C" {
|
||||
#include <sagitta/client/arc_client.h>
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Helper class for the star tracker handler to accelerate large data transfers.
|
||||
*
|
||||
@ -176,7 +172,7 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public
|
||||
static const uint32_t FLASH_REGION_SIZE = 0x20000;
|
||||
|
||||
struct ImageDownload {
|
||||
static const uint32_t LAST_POSITION = 4095;
|
||||
static const uint32_t LAST_POSITION = 4096;
|
||||
};
|
||||
|
||||
static const uint32_t MAX_POLLS = 10000;
|
||||
|
Reference in New Issue
Block a user