diff --git a/app/api/export/route.ts b/app/api/export/route.ts index 802a8a8..bba522c 100644 --- a/app/api/export/route.ts +++ b/app/api/export/route.ts @@ -57,6 +57,8 @@ export async function POST(req: NextRequest) { const dtMs = Number((r.rec_end_ms as bigint) - (r.rec_start_ms as bigint)) if (Number.isFinite(dtMs) && dtMs > 0) stepMs = dtMs / r.sample_count } + // 采样溢出时强制 1ms 步长(与 16.384s/16384 对齐) + if (r.sample_count >= 16384) stepMs = 1 const hasFit = r.fit_a != null for (let i = 0; i < r.code_data.length; i++) { const t = (i * stepMs).toFixed(3) diff --git a/app/records/[id]/page.tsx b/app/records/[id]/page.tsx index 108f6c5..8df0638 100644 --- a/app/records/[id]/page.tsx +++ b/app/records/[id]/page.tsx @@ -117,8 +117,10 @@ export default function Page({ params }: { params: Promise<{ id: string }> }) { const timeAxis = useMemo(() => { if (!rec) return [] as number[] - // 使用秒为单位,保留3位小数 - const step = rec.sampleCount > 0 ? rec.duration / rec.sampleCount : 0 + // 使用秒为单位,保留3位小数;若采样溢出,固定为 16.384s + const overflow = rec.sampleCount >= 16384 + const effectiveDuration = overflow ? 16.384 : rec.duration + const step = rec.sampleCount > 0 ? effectiveDuration / rec.sampleCount : 0 return Array.from({ length: rec.sampleCount }, (_, i) => +(i * step).toFixed(3)) }, [rec]) @@ -198,7 +200,23 @@ export default function Page({ params }: { params: Promise<{ id: string }> }) {