Move/RN computeNSlotsPerDgram to Device::getNSlotsPerDgram

This commit is contained in:
2025-11-16 12:37:25 -04:00
parent a18fab04a5
commit a4493b26a1
4 changed files with 36 additions and 27 deletions
@@ -851,28 +851,5 @@ void IoUringAssemblyEngine::printSlotBytes(size_t slotIndex, size_t nBytes)
}
}
size_t IoUringAssemblyEngine::computePointsPerDgram(int returnMode)
{
/*
* Map modes to points per datagram based on Livox docs
* 1: first, 2: strongest -> 96 samples => 96 points
* 3: dual -> 48 samples * 2 points = 96
* 4: triple -> 30 samples * 3 points = 90
*/
switch (returnMode)
{
case static_cast<int>(livoxProto1::Device::ReturnMode::SingleFirst):
case static_cast<int>(livoxProto1::Device::ReturnMode::SingleStrongest):
case static_cast<int>(livoxProto1::Device::ReturnMode::Dual):
return 96u;
case static_cast<int>(livoxProto1::Device::ReturnMode::Triple):
return 90u;
default:
throw std::runtime_error(
std::string(__func__) + ": Unknown returnMode "
+ std::to_string(returnMode));
}
}
} // namespace stim_buff
} // namespace smo
@@ -40,9 +40,8 @@ public:
void assembleFrameReq(Callback<assembleFrameReqCbFn> cb);
// Telemetry helpers
static size_t computePointsPerDgram(int returnMode);
static size_t computePointsPerFrame(int returnMode, size_t nDgramsPerFrame)
{ return computePointsPerDgram(returnMode) * nDgramsPerFrame; }
{ return livoxProto1::Device::getNPointsPerDgram(returnMode) * nDgramsPerFrame; }
static bool compactionIsNeeded(uint32_t nSucceeded, uint32_t nTotal)
{ return nSucceeded != 0 && nTotal != 0 && nSucceeded != nTotal; }
@@ -11,6 +11,7 @@
#include <asynchronousLoop.h>
#include <componentThread.h>
#include <user/stimulusFrame.h>
#include <livoxProto1/device.h>
#include "livoxGen1.h"
#include "openClCollatingAndMeshingEngine.h"
#include "pcloudStimulusProducer.h"
@@ -645,7 +646,7 @@ bool OpenClCollatingAndMeshingEngine::setupCollateDgramsArgs(
}
int returnMode = static_cast<int>(parent.device->currentReturnMode);
uint32_t nPointsPerSlot = static_cast<uint32_t>(
IoUringAssemblyEngine::computePointsPerDgram(returnMode));
livoxProto1::Device::getNPointsPerDgram(returnMode));
uint32_t nDgramsPerFrame = static_cast<uint32_t>(
frameAssemblyDesc->numSlots);
@@ -1030,7 +1031,9 @@ public:
}
int returnMode = static_cast<int>(engine.parent.device->currentReturnMode);
size_t pointsPerDgram = IoUringAssemblyEngine::computePointsPerDgram(returnMode);
size_t pointsPerDgram = livoxProto1::Device::getNPointsPerDgram(
returnMode);
uint32_t nSucceeded = context->frameAssemblyResult.nSucceeded.load();
size_t totalPoints = nSucceeded * pointsPerDgram;