diff --git a/src/components/MachineConnection.tsx b/src/components/MachineConnection.tsx
index 1009833..deb826a 100644
--- a/src/components/MachineConnection.tsx
+++ b/src/components/MachineConnection.tsx
@@ -145,6 +145,14 @@ export function MachineConnection({
{(machineInfo.maxWidth / 10).toFixed(1)} × {(machineInfo.maxHeight / 10).toFixed(1)} mm
+ {machineInfo.totalCount !== undefined && (
+
+ Total Stitches:
+
+ {machineInfo.totalCount.toLocaleString()}
+
+
+ )}
)}
diff --git a/src/services/BrotherPP1Service.ts b/src/services/BrotherPP1Service.ts
index 43538d1..f480ad5 100644
--- a/src/services/BrotherPP1Service.ts
+++ b/src/services/BrotherPP1Service.ts
@@ -252,6 +252,17 @@ export class BrotherPP1Service {
.join(":")
.toUpperCase();
+ // Fetch service count data (cumulative statistics)
+ let serviceCount: number | undefined;
+ let totalCount: number | undefined;
+ try {
+ const serviceData = await this.getServiceCount();
+ serviceCount = serviceData.serviceCount;
+ totalCount = serviceData.totalCount;
+ } catch (err) {
+ console.warn('[BrotherPP1] Failed to fetch service count:', err);
+ }
+
return {
serialNumber,
modelNumber: modelCode,
@@ -260,6 +271,22 @@ export class BrotherPP1Service {
maxWidth,
maxHeight,
macAddress,
+ serviceCount,
+ totalCount,
+ };
+ }
+
+ async getServiceCount(): Promise<{ serviceCount: number; totalCount: number }> {
+ const response = await this.sendCommand(Commands.SERVICE_COUNT);
+ const data = response.slice(2);
+
+ // Read uint32 values in little-endian format
+ const readUInt32LE = (offset: number) =>
+ data[offset] | (data[offset + 1] << 8) | (data[offset + 2] << 16) | (data[offset + 3] << 24);
+
+ return {
+ serviceCount: readUInt32LE(0), // Bytes 0-3
+ totalCount: readUInt32LE(4), // Bytes 4-7
};
}
diff --git a/src/types/machine.ts b/src/types/machine.ts
index 81777c5..824e0c7 100644
--- a/src/types/machine.ts
+++ b/src/types/machine.ts
@@ -56,6 +56,8 @@ export interface MachineInfo {
maxWidth: number; // in 0.1mm units
maxHeight: number; // in 0.1mm units
macAddress: string;
+ serviceCount?: number; // Cumulative service counter
+ totalCount?: number; // Total stitches sewn by machine
}
export interface PatternInfo {