request limits, camera and blob parameters
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Jakob Meier
2022-01-17 15:28:53 +01:00
parent abfc120633
commit 5a210e19e1
4 changed files with 235 additions and 11 deletions

View File

@ -18,8 +18,8 @@ StarTrackerHandler::StarTrackerHandler(object_id_t objectId, object_id_t comIF,
CookieIF * comCookie, StrHelper* strHelper) :
DeviceHandlerBase(objectId, comIF, comCookie), temperatureSet(this), versionSet(this), powerSet(
this), interfaceSet(this), timeSet(this), solutionSet(this), histogramSet(this), contrastSet(
this), checksumSet(this), downloadCentroidSet(this), downloadMatchedStar(this),
downloadDbImage(this), downloadBlobPixel(this), cameraSet(this), strHelper(
this), checksumSet(this), downloadCentroidSet(this), downloadMatchedStar(this), downloadDbImage(
this), downloadBlobPixel(this), cameraSet(this), limitsSet(this), blobSet(this), strHelper(
strHelper) {
if (comCookie == nullptr) {
sif::error << "StarTrackerHandler: Invalid com cookie" << std::endl;
@ -496,10 +496,18 @@ ReturnValue_t StarTrackerHandler::buildCommandFromCommand(DeviceCommandId_t devi
result = prepareFpgaActionCommand(commandData, commandDataLen);
return result;
}
case (StarTracker::REQ_CAMERA_PARAMS): {
case (StarTracker::REQ_CAMERA): {
result = prepareRequestCameraParams();
return result;
}
case (StarTracker::REQ_LIMITS): {
result = prepareRequestLimitsParams();
return result;
}
case (StarTracker::REQ_BLOB_PARAMS): {
result = prepareRequestBlobParams();
return result;
}
default:
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
}
@ -578,7 +586,11 @@ void StarTrackerHandler::fillCommandAndReplyMap() {
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::FPGA_ACTION, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_CAMERA_PARAMS, 3, nullptr,
this->insertInCommandAndReplyMap(StarTracker::REQ_CAMERA, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_LIMITS, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
this->insertInCommandAndReplyMap(StarTracker::REQ_BLOB_PARAMS, 3, nullptr,
StarTracker::MAX_FRAME_SIZE * 2 + 2);
}
@ -738,10 +750,18 @@ ReturnValue_t StarTrackerHandler::interpretDeviceReply(DeviceCommandId_t id, con
result = handleSetParamReply();
break;
}
case (StarTracker::REQ_CAMERA_PARAMS): {
case (StarTracker::REQ_CAMERA): {
handleParamRequest(cameraSet, StarTracker::CameraSet::SIZE);
break;
}
case (StarTracker::REQ_LIMITS): {
handleParamRequest(limitsSet, StarTracker::LimitsSet::SIZE);
break;
}
case (StarTracker::REQ_BLOB_PARAMS): {
handleParamRequest(blobSet, StarTracker::BlobSet::SIZE);
break;
}
default: {
sif::debug << "StarTrackerHandler::interpretDeviceReply: Unknown device reply id:" << id
<< std::endl;
@ -966,6 +986,34 @@ ReturnValue_t StarTrackerHandler::initializeLocalDataPool(localpool::DataPool& l
localDataPoolMap.emplace(StarTracker::CAM_VAL3, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::CAM_REG4, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::CAM_VAL4, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_ACTION, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA18CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA25CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_FPGA10CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_MCUCURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOS21CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSPIXCURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOS33CURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSVRESCURRENT, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::LIMITS_CMOSTEMPERATURE, new PoolEntry<float>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MODE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_VALUE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_DISTANCE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_DISTANCE, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_NEIGHBOUR_BRIGHTPIXELS, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_TOTAL_VALUE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_TOTAL_VALUE, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MIN_BRIGHT_NEIGHBOURS, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_BRIGHT_NEIGHBOURS, new PoolEntry<uint16_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_MAX_PIXELSTOCONSIDER, new PoolEntry<uint32_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_SIGNAL_THRESHOLD, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_DARK_THRESHOLD, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_HISTOGRAM, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_ENABLE_CONTRAST, new PoolEntry<uint8_t>( { 0 }));
localDataPoolMap.emplace(StarTracker::BLOB_BIN_MODE, new PoolEntry<uint8_t>( { 0 }));
return RETURN_OK;
}
@ -1127,7 +1175,15 @@ ReturnValue_t StarTrackerHandler::scanForGetParameterReply(DeviceCommandId_t *fo
const uint8_t* reply = dataLinkLayer.getReply();
switch (*reply) {
case (StarTracker::ID::CAMERA): {
*foundId = StarTracker::REQ_CAMERA_PARAMS;
*foundId = StarTracker::REQ_CAMERA;
break;
}
case (StarTracker::ID::LIMITS): {
*foundId = StarTracker::REQ_LIMITS;
break;
}
case (StarTracker::ID::BLOB): {
*foundId = StarTracker::REQ_BLOB_PARAMS;
break;
}
default: {
@ -1749,7 +1805,6 @@ ReturnValue_t StarTrackerHandler::prepareFpgaActionCommand(const uint8_t* comman
}
ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
struct Camera req;
uint32_t length = 0;
arc_pack_camera_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
@ -1758,6 +1813,24 @@ ReturnValue_t StarTrackerHandler::prepareRequestCameraParams() {
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestLimitsParams() {
uint32_t length = 0;
arc_pack_limits_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::prepareRequestBlobParams() {
uint32_t length = 0;
arc_pack_blob_parameter_req(commandBuffer, &length);
dataLinkLayer.encodeFrame(commandBuffer, length);
rawPacket = dataLinkLayer.getEncodedFrame();
rawPacketLen = dataLinkLayer.getEncodedLength();
return RETURN_OK;
}
ReturnValue_t StarTrackerHandler::handleSetParamReply() {
const uint8_t* reply = dataLinkLayer.getReply();
uint8_t status = *(reply + STATUS_OFFSET);