This commit is contained in:
parent
f8eb4fdd6f
commit
dcdceba07e
@ -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): {
|
||||
@ -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(¢roidsSet);
|
||||
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");
|
||||
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):
|
||||
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
@ -1554,26 +1539,17 @@ class CentroidsSet : public StaticLocalDataSet<10> {
|
||||
};
|
||||
|
||||
class ContrastSet : public StaticLocalDataSet<8> {
|
||||
|
||||
public:
|
||||
static constexpr size_t SIZE = 156;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user