mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-09-10 06:46:03 +00:00
fix(sensor_data): fixed sample timestamp
This commit is contained in:

committed by
Carles Fernandez

parent
e22564f75e
commit
ce8acb6a7d
@@ -33,7 +33,7 @@ SensorDataFile::SensorDataFile(
|
|||||||
offset_in_file_(offset_in_file),
|
offset_in_file_(offset_in_file),
|
||||||
item_size_(item_size),
|
item_size_(item_size),
|
||||||
chunks_read_(0),
|
chunks_read_(0),
|
||||||
last_sample_stamp_(sample_delay),
|
next_sample_stamp_(sample_delay),
|
||||||
io_buffer_size_(item_size * IO_BUFFER_MAX_SIZE),
|
io_buffer_size_(item_size * IO_BUFFER_MAX_SIZE),
|
||||||
offset_in_io_buffer_(io_buffer_size_), // Set to end of buffer so that first look up will trigger a read.
|
offset_in_io_buffer_(io_buffer_size_), // Set to end of buffer so that first look up will trigger a read.
|
||||||
repeat_(repeat),
|
repeat_(repeat),
|
||||||
@@ -76,10 +76,10 @@ bool SensorDataFile::read_item(std::vector<uint8_t>& buffer)
|
|||||||
|
|
||||||
bool SensorDataFile::read_until_sample(std::size_t end_sample, std::size_t& sample_stamp, std::vector<uint8_t>& buffer)
|
bool SensorDataFile::read_until_sample(std::size_t end_sample, std::size_t& sample_stamp, std::vector<uint8_t>& buffer)
|
||||||
{
|
{
|
||||||
if (last_sample_stamp_ + sample_period_ < end_sample)
|
if (next_sample_stamp_ + sample_period_ < end_sample)
|
||||||
{
|
{
|
||||||
last_sample_stamp_ += sample_period_;
|
sample_stamp = next_sample_stamp_;
|
||||||
sample_stamp = last_sample_stamp_;
|
next_sample_stamp_ += sample_period_;
|
||||||
read_item(buffer);
|
read_item(buffer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ private:
|
|||||||
std::size_t item_size_;
|
std::size_t item_size_;
|
||||||
|
|
||||||
std::size_t chunks_read_;
|
std::size_t chunks_read_;
|
||||||
std::size_t last_sample_stamp_;
|
std::size_t next_sample_stamp_;
|
||||||
std::vector<uint8_t> io_buffer_;
|
std::vector<uint8_t> io_buffer_;
|
||||||
std::size_t io_buffer_size_;
|
std::size_t io_buffer_size_;
|
||||||
std::size_t offset_in_io_buffer_;
|
std::size_t offset_in_io_buffer_;
|
||||||
|
Reference in New Issue
Block a user