Skip to content

Commit

Permalink
Merge pull request #456 from NordicSemiconductor/fix/scope-mode-regre…
Browse files Browse the repository at this point in the history
…ssion

Fix/scope mode regression
  • Loading branch information
kylebonnici authored Apr 12, 2024
2 parents 668c81f + 8d4293e commit 7b7a33f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/actions/deviceActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ export const open =
cappedValue >= getState().app.trigger.level;
prevCappedValue = cappedValue;

if (!DataManager().isInSync()) {
return;
}

if (!getState().app.trigger.active && validTriggerValue) {
if (latestTrigger !== undefined) {
return;
Expand Down Expand Up @@ -496,11 +500,6 @@ export const processTrigger =
onProgress?: (message: string, progress?: number) => void
): AppThunk<RootState, Promise<void>> =>
async (dispatch, getState) => {
if (!DataManager().isInSync()) {
logger.debug('skipping trigger out of sync');
return;
}

const trigger = DataManager().addTimeReachedTrigger(triggerLength);

const triggerTime = Date.now();
Expand Down
9 changes: 8 additions & 1 deletion src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ export const DataManager = () => ({
(options.writeBuffer?.getFirstWriteTime() ??
options.fileBuffer?.getFirstWriteTime() ??
0);
const simulationDelta = getTimestamp() / 1000;

const processedBytes =
options.writeBuffer?.getBytesWritten() ??
options.fileBuffer?.getSessionInBytes() ??
0;

const simulationDelta =
indexToTimestamp(processedBytes / frameSize - 1) / 1000;
if (simulationDelta > actualTimePassed) return true;

const pcAheadDelta = actualTimePassed - simulationDelta;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/WriteBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ export class WriteBuffer {
return this.#pages;
}

#calculateWriteIdealBufferRange(bytesToRight: number): Range {
const bytesWritten = this.getBytesWritten() + bytesToRight;
#calculateWriteIdealBufferRange(bytesToWrite: number): Range {
const bytesWritten = this.getBytesWritten() + bytesToWrite;
const normalizedEnd =
Math.ceil(bytesWritten / this.#bufferPageSize) *
this.#bufferPageSize -
Expand Down

0 comments on commit 7b7a33f

Please sign in to comment.