Merge pull request #475 from hharte/improve-hard-sector-decode

Improve hard sector decode
This commit is contained in:
David Given
2022-02-26 12:37:48 +00:00
committed by GitHub
2 changed files with 16 additions and 1 deletions

View File

@@ -103,6 +103,15 @@ public:
clock = seekToPattern(SECTOR_SYNC_PATTERN);
}
_sector->headerStartTime = tell().ns();
/* seekToPattern() can skip past the index hole, if this happens
* too close to the end of the Fluxmap, discard the sector.
*/
if (_sector->headerStartTime > (getFluxmapDuration() - 12.5e6)) {
return 0;
}
return clock;
}

View File

@@ -106,8 +106,14 @@ public:
* _hardSectorId after the sector header is found.
*/
nanoseconds_t clock = seekToPattern(ANY_SECTOR_PATTERN);
_sector->headerStartTime = tell().ns();
int sectorFoundTimeRaw = std::round((tell().ns()) / 1e6);
/* Discard a possible partial sector. */
if (_sector->headerStartTime > (getFluxmapDuration() - 21e6)) {
return 0;
}
int sectorFoundTimeRaw = std::round(_sector->headerStartTime / 1e6);
int sectorFoundTime;
/* Round time to the nearest 20ms */