wrapping up
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-27 12:17:54 +02:00
parent f8eb4fdd6f
commit dcdceba07e
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 43 additions and 59 deletions

View File

@ -353,7 +353,6 @@ ReturnValue_t StarTrackerHandler::buildNormalDeviceCommand(DeviceCommandId_t* id
if (currentSecondaryTmIter == additionalRequestedTm.end()) {
currentSecondaryTmIter = additionalRequestedTm.begin();
}
sif::debug << "requesting ID " << *id << std::endl;
normalState = NormalState::SOLUTION_REQUEST;
break;
case NormalState::SOLUTION_REQUEST:
@ -527,6 +526,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
return returnvalue::OK;
}
case (startracker::REQ_CONTRAST): {
prepareRequestContrastTm();
return returnvalue::OK;
}
case (startracker::BOOT): {
@ -676,7 +676,7 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
result = prepareRequestBlobsTm();
return result;
}
case(startracker::REQ_AUTO_BLOB): {
case (startracker::REQ_AUTO_BLOB): {
result = prepareRequestAutoBlobTm();
return returnvalue::OK;
}
@ -995,6 +995,12 @@ void StarTrackerHandler::resetSecondaryTmSet() {
centroidSet.setValidity(false, true);
}
}
{
PoolReadGuard pg(&contrastSet);
if (pg.getReadResult() == returnvalue::OK) {
contrastSet.setValidity(false, true);
}
}
{
PoolReadGuard pg(&centroidsSet);
if (pg.getReadResult() == returnvalue::OK) {
@ -1082,7 +1088,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
break;
}
case (startracker::REQ_TIME): {
result = handleTm(packet, timeSet, startracker::TimeSet::SIZE, "REQ_TIME");
result = handleTm(packet, timeSet, "REQ_TIME");
break;
}
case (startracker::PING_REQUEST): {
@ -1097,7 +1103,7 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
break;
}
case (startracker::REQ_VERSION): {
result = handleTm(packet, versionSet, startracker::VersionSet::SIZE, "REQ_VERSION");
result = handleTm(packet, versionSet, "REQ_VERSION");
if (result != returnvalue::OK) {
return result;
}
@ -1108,19 +1114,19 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
break;
}
case (startracker::REQ_INTERFACE): {
result = handleTm(packet, interfaceSet, startracker::InterfaceSet::SIZE, "REQ_INTERFACE");
result = handleTm(packet, interfaceSet, "REQ_INTERFACE");
break;
}
case (startracker::REQ_POWER): {
result = handleTm(packet, powerSet, startracker::PowerSet::SIZE, "REQ_POWER");
result = handleTm(packet, powerSet, "REQ_POWER");
break;
}
case (startracker::REQ_SOLUTION): {
result = handleTm(packet, solutionSet, startracker::SolutionSet::SIZE, "REQ_SOLUTION");
result = handleTm(packet, solutionSet, "REQ_SOLUTION");
break;
}
case(startracker::REQ_CONTRAST): {
result = handleTm(packet, contrastSet, startracker::ContrastSet::SIZE, "REQ_CONTRAST");
case (startracker::REQ_CONTRAST): {
result = handleTm(packet, contrastSet, "REQ_CONTRAST");
break;
}
case (startracker::REQ_AUTO_BLOB): {
@ -1148,11 +1154,11 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id,
break;
}
case (startracker::REQ_TEMPERATURE): {
result = handleTm(packet, temperatureSet, startracker::TemperatureSet::SIZE, "REQ_TEMP");
result = handleTm(packet, temperatureSet, "REQ_TEMP");
break;
}
case (startracker::REQ_HISTOGRAM): {
result = handleTm(packet, histogramSet, startracker::HistogramSet::SIZE, "REQ_HISTO");
result = handleTm(packet, histogramSet, "REQ_HISTO");
break;
}
case (startracker::SUBSCRIPTION):
@ -1825,31 +1831,31 @@ ReturnValue_t StarTrackerHandler::scanForTmReply(uint8_t replyId, DeviceCommandI
*foundId = startracker::REQ_SOLUTION;
break;
}
case(startracker::ID::BLOB): {
case (startracker::ID::BLOB): {
*foundId = startracker::REQ_BLOB;
break;
}
case(startracker::ID::BLOBS): {
case (startracker::ID::BLOBS): {
*foundId = startracker::REQ_BLOBS;
break;
}
case(startracker::ID::CENTROID): {
case (startracker::ID::CENTROID): {
*foundId = startracker::REQ_CENTROID;
break;
}
case(startracker::ID::CENTROIDS): {
case (startracker::ID::CENTROIDS): {
*foundId = startracker::REQ_CENTROIDS;
break;
}
case(startracker::ID::AUTO_BLOB): {
case (startracker::ID::AUTO_BLOB): {
*foundId = startracker::REQ_AUTO_BLOB;
break;
}
case(startracker::ID::MATCHED_CENTROIDS): {
case (startracker::ID::MATCHED_CENTROIDS): {
*foundId = startracker::REQ_MATCHED_CENTROIDS;
break;
}
case(startracker::ID::CONTRAST): {
case (startracker::ID::CONTRAST): {
*foundId = startracker::REQ_CONTRAST;
break;
}
@ -2363,7 +2369,7 @@ ReturnValue_t StarTrackerHandler::checkProgram() {
}
ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
size_t size, const char* context) {
const char* context) {
ReturnValue_t result = statusFieldCheck(rawFrame);
if (result != returnvalue::OK) {
return result;
@ -2374,10 +2380,11 @@ ReturnValue_t StarTrackerHandler::handleTm(const uint8_t* rawFrame, LocalPoolDat
}
const uint8_t* reply = rawFrame + TICKS_OFFSET;
dataset.setValidityBufferGeneration(false);
result = dataset.deSerialize(&reply, &size, SerializeIF::Endianness::LITTLE);
size_t sizeLeft = fullPacketLen;
result = dataset.deSerialize(&reply, &sizeLeft, SerializeIF::Endianness::LITTLE);
if (result != returnvalue::OK) {
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed for " << context
<< std::endl;
sif::warning << "StarTrackerHandler::handleTm: Deserialization failed for " << context << ": 0x"
<< std::hex << std::setw(4) << result << std::dec << std::endl;
}
dataset.setValidityBufferGeneration(true);
dataset.setValidity(true, true);
@ -2787,11 +2794,12 @@ ReturnValue_t StarTrackerHandler::checkCommand(ActionId_t actionId) {
case startracker::REQ_BLOBS:
case startracker::REQ_CENTROID:
case startracker::REQ_CENTROIDS:
case startracker::REQ_CONTRAST:
case startracker::REQ_CONTRAST: {
if (getMode() == MODE_ON and getSubmode() != startracker::Program::FIRMWARE) {
return STARTRACKER_NOT_RUNNING_FIRMWARE;
}
break;
}
case startracker::FIRMWARE_UPDATE:
case startracker::FLASH_READ:
if (getMode() != MODE_ON or getSubmode() != startracker::Program::BOOTLOADER) {

View File

@ -212,7 +212,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
startracker::BlobsSet blobsSet;
startracker::CentroidSet centroidSet;
startracker::CentroidsSet centroidsSet;
startracker::CentroidsSet contrastSet;
startracker::ContrastSet contrastSet;
// Pointer to object responsible for uploading and downloading images to/from the star tracker
StrComHandler* strHelper = nullptr;
@ -519,7 +519,7 @@ class StarTrackerHandler : public DeviceHandlerBase {
*
* @return returnvalue::OK if successful, otherwise error return value
*/
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset, size_t size,
ReturnValue_t handleTm(const uint8_t* rawFrame, LocalPoolDataSetBase& dataset,
const char* context);
ReturnValue_t handleAutoBlobTm(const uint8_t* rawFrame);

View File

@ -540,8 +540,6 @@ static const uint32_t FLASH_REGION_SIZE = 0x20000;
*/
class TemperatureSet : public StaticLocalDataSet<TEMPERATURE_SET_ENTRIES> {
public:
static const size_t SIZE = 24;
TemperatureSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TEMPERATURE_SET_ID) {}
TemperatureSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TEMPERATURE_SET_ID)) {}
@ -571,8 +569,6 @@ class TemperatureSet : public StaticLocalDataSet<TEMPERATURE_SET_ENTRIES> {
*/
class VersionSet : public StaticLocalDataSet<VERSION_SET_ENTRIES> {
public:
static const size_t SIZE = 15;
VersionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, VERSION_SET_ID) {}
VersionSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, VERSION_SET_ID)) {}
@ -602,8 +598,6 @@ class VersionSet : public StaticLocalDataSet<VERSION_SET_ENTRIES> {
*/
class InterfaceSet : public StaticLocalDataSet<INTERFACE_SET_ENTRIES> {
public:
static const size_t SIZE = 20;
InterfaceSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, REQ_INTERFACE) {}
InterfaceSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {}
@ -631,8 +625,6 @@ class InterfaceSet : public StaticLocalDataSet<INTERFACE_SET_ENTRIES> {
*/
class PowerSet : public StaticLocalDataSet<POWER_SET_ENTRIES> {
public:
static const size_t SIZE = 76;
PowerSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, REQ_INTERFACE) {}
PowerSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, REQ_INTERFACE)) {}
@ -696,8 +688,6 @@ class PowerSet : public StaticLocalDataSet<POWER_SET_ENTRIES> {
*/
class TimeSet : public StaticLocalDataSet<TIME_SET_ENTRIES> {
public:
static const size_t SIZE = 24;
TimeSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, TIME_SET_ID) {}
TimeSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, TIME_SET_ID)) {}
@ -724,8 +714,6 @@ class TimeSet : public StaticLocalDataSet<TIME_SET_ENTRIES> {
*/
class SolutionSet : public StaticLocalDataSet<SOLUTION_SET_ENTRIES> {
public:
static const size_t SIZE = 79;
SolutionSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, SOLUTION_SET_ID) {}
SolutionSet(object_id_t objectId) : StaticLocalDataSet(sid_t(objectId, SOLUTION_SET_ID)) {}
@ -1451,11 +1439,9 @@ class AutoBlobSet : public StaticLocalDataSet<3> {
public:
AutoBlobSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, AUTO_BLOB_SET_ID) {}
// Ticks timestamp
lp_var_t<uint32_t> ticks =
lp_var_t<uint32_t>(sid.objectId, PoolIds::TICKS_AUTO_BLOB, this);
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId, PoolIds::TICKS_AUTO_BLOB, this);
// Unix time stamp
lp_var_t<uint64_t> timeUs =
lp_var_t<uint64_t>(sid.objectId, PoolIds::TIME_AUTO_BLOB, this);
lp_var_t<uint64_t> timeUs = lp_var_t<uint64_t>(sid.objectId, PoolIds::TIME_AUTO_BLOB, this);
lp_var_t<float> threshold = lp_var_t<float>(sid.objectId, PoolIds::AUTO_BLOB_THRESHOLD, this);
private:
@ -1463,7 +1449,6 @@ class AutoBlobSet : public StaticLocalDataSet<3> {
class MatchedCentroidsSet : public StaticLocalDataSet<20> {
public:
static constexpr size_t SIZE = 321;
MatchedCentroidsSet(HasLocalDataPoolIF* owner)
: StaticLocalDataSet(owner, MATCHED_CENTROIDS_SET_ID) {}
MatchedCentroidsSet(object_id_t objectId)
@ -1553,27 +1538,18 @@ class CentroidsSet : public StaticLocalDataSet<10> {
lp_vec_t<uint8_t, 16>(sid.objectId, PoolIds::CENTROIDS_MAGNITUDES, this);
};
class ContrastSet: public StaticLocalDataSet<8> {
public:
static constexpr size_t SIZE = 156;
class ContrastSet : public StaticLocalDataSet<8> {
public:
ContrastSet(HasLocalDataPoolIF* owner) : StaticLocalDataSet(owner, CONTRAST_SET_ID) {}
// Data received from the Centroids Telemetry Set (ID 29)
lp_var_t<uint32_t> ticks =
lp_var_t<uint32_t>(sid.objectId, PoolIds::CONTRAST_TICKS, this);
lp_var_t<uint32_t> ticks = lp_var_t<uint32_t>(sid.objectId, PoolIds::CONTRAST_TICKS, this);
// Unix time stamp
lp_var_t<uint64_t> timeUs =
lp_var_t<uint64_t>(sid.objectId, PoolIds::CONTRAST_TIME, this);
lp_vec_t<uint32_t, 9> contrastA =
lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_A, this);
lp_vec_t<uint32_t, 9> contrastB =
lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_B, this);
lp_vec_t<uint32_t, 9> contrastC =
lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_C, this);
lp_vec_t<uint32_t, 9> contrastD =
lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_D, this);
lp_var_t<uint64_t> timeUs = lp_var_t<uint64_t>(sid.objectId, PoolIds::CONTRAST_TIME, this);
lp_vec_t<uint32_t, 9> contrastA = lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_A, this);
lp_vec_t<uint32_t, 9> contrastB = lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_B, this);
lp_vec_t<uint32_t, 9> contrastC = lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_C, this);
lp_vec_t<uint32_t, 9> contrastD = lp_vec_t<uint32_t, 9>(sid.objectId, PoolIds::CONTRAST_D, this);
};
/**