diff --git a/src/components/ProgressMonitor.tsx b/src/components/ProgressMonitor.tsx index 0f1d3ea..a952328 100644 --- a/src/components/ProgressMonitor.tsx +++ b/src/components/ProgressMonitor.tsx @@ -56,8 +56,15 @@ export function ProgressMonitor() { const stateVisual = getStateVisualInfo(machineStatus); - const progressPercent = patternInfo - ? ((sewingProgress?.currentStitch || 0) / patternInfo.totalStitches) * 100 + // Use PEN stitch count as fallback when machine reports 0 total stitches + const totalStitches = patternInfo + ? (patternInfo.totalStitches === 0 && pesData?.penStitches + ? pesData.penStitches.stitches.length + : patternInfo.totalStitches) + : 0; + + const progressPercent = totalStitches > 0 + ? ((sewingProgress?.currentStitch || 0) / totalStitches) * 100 : 0; // Calculate color block information from decoded penStitches @@ -173,7 +180,7 @@ export function ProgressMonitor() { Total Stitches - {patternInfo.totalStitches.toLocaleString()} + {totalStitches.toLocaleString()}