fix: slightly shorten homing message

This commit is contained in:
Jan-Henrik Bruhn 2025-12-18 11:27:58 +01:00
parent 7c2172f52c
commit a4fc959eb1

View file

@ -18,9 +18,9 @@ export const SewingMachineError = {
RestartError17: 0x17,
RestartError18: 0x18,
RestartError19: 0x19,
RestartError1A: 0x1A,
RestartError1B: 0x1B,
RestartError1C: 0x1C,
RestartError1A: 0x1a,
RestartError1B: 0x1b,
RestartError1C: 0x1c,
NeedlePlateError: 0x20,
ThreadLeverError: 0x21,
UpperThreadError: 0x60,
@ -32,9 +32,9 @@ export const SewingMachineError = {
InitialHoopError: 0x72,
RegularInspectionError: 0x80,
Setting: 0x98,
None: 0xDD,
Unknown: 0xEE,
OtherError: 0xFF,
None: 0xdd,
Unknown: 0xee,
OtherError: 0xff,
} as const;
/**
@ -54,226 +54,208 @@ interface ErrorInfo {
*/
const ERROR_DETAILS: Record<number, ErrorInfo> = {
[SewingMachineError.NeedlePositionError]: {
title: 'The Needle is Down',
description: 'The needle is in the down position and needs to be raised before continuing.',
solutions: [
'Press the needle position switch to raise the needle',
],
title: "The Needle is Down",
description:
"The needle is in the down position and needs to be raised before continuing.",
solutions: ["Press the needle position switch to raise the needle"],
},
[SewingMachineError.SafetyError]: {
title: 'Safety Error',
description: 'The machine is sensing an operational issue.',
title: "Safety Error",
description: "The machine is sensing an operational issue.",
solutions: [
'Remove the thread on the top of the fabric and then remove the needle',
'Remove the thread on the underside of the fabric and clean the bobbin case of all threads',
'Check the bobbin case for scratches or contamination',
'Insert the embroidery needle',
'Check that the bobbin is inserted correctly',
"Remove the thread on the top of the fabric and then remove the needle",
"Remove the thread on the underside of the fabric and clean the bobbin case of all threads",
"Check the bobbin case for scratches or contamination",
"Insert the embroidery needle",
"Check that the bobbin is inserted correctly",
],
},
[SewingMachineError.LowerThreadSafetyError]: {
title: 'Lower Thread Safety Error',
description: 'The bobbin winder safety device is activated.',
solutions: [
'Check if the thread is tangled',
],
title: "Lower Thread Safety Error",
description: "The bobbin winder safety device is activated.",
solutions: ["Check if the thread is tangled"],
},
[SewingMachineError.LowerThreadFreeError]: {
title: 'Lower Thread Free Error',
description: 'Problem with lower thread.',
solutions: [
'Slide the bobbin winder shaft toward the front',
],
title: "Lower Thread Free Error",
description: "Problem with lower thread.",
solutions: ["Slide the bobbin winder shaft toward the front"],
},
[SewingMachineError.RestartError10]: {
title: 'Restart Required',
description: 'A malfunction occurred.',
solutions: [
'Turn the machine off, then on again',
],
title: "Restart Required",
description: "A malfunction occurred.",
solutions: ["Turn the machine off, then on again"],
},
[SewingMachineError.RestartError11]: {
title: 'Restart Required (M519411)',
description: 'A malfunction occurred. Error code: M519411',
title: "Restart Required (M519411)",
description: "A malfunction occurred. Error code: M519411",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519411 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519411 and contact technical support",
],
},
[SewingMachineError.RestartError12]: {
title: 'Restart Required (M519412)',
description: 'A malfunction occurred. Error code: M519412',
title: "Restart Required (M519412)",
description: "A malfunction occurred. Error code: M519412",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519412 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519412 and contact technical support",
],
},
[SewingMachineError.RestartError13]: {
title: 'Restart Required (M519413)',
description: 'A malfunction occurred. Error code: M519413',
title: "Restart Required (M519413)",
description: "A malfunction occurred. Error code: M519413",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519413 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519413 and contact technical support",
],
},
[SewingMachineError.RestartError14]: {
title: 'Restart Required (M519414)',
description: 'A malfunction occurred. Error code: M519414',
title: "Restart Required (M519414)",
description: "A malfunction occurred. Error code: M519414",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519414 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519414 and contact technical support",
],
},
[SewingMachineError.RestartError15]: {
title: 'Restart Required (M519415)',
description: 'A malfunction occurred. Error code: M519415',
title: "Restart Required (M519415)",
description: "A malfunction occurred. Error code: M519415",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519415 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519415 and contact technical support",
],
},
[SewingMachineError.RestartError16]: {
title: 'Restart Required (M519416)',
description: 'A malfunction occurred. Error code: M519416',
title: "Restart Required (M519416)",
description: "A malfunction occurred. Error code: M519416",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519416 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519416 and contact technical support",
],
},
[SewingMachineError.RestartError17]: {
title: 'Restart Required (M519417)',
description: 'A malfunction occurred. Error code: M519417',
title: "Restart Required (M519417)",
description: "A malfunction occurred. Error code: M519417",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519417 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519417 and contact technical support",
],
},
[SewingMachineError.RestartError18]: {
title: 'Restart Required (M519418)',
description: 'A malfunction occurred. Error code: M519418',
title: "Restart Required (M519418)",
description: "A malfunction occurred. Error code: M519418",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519418 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519418 and contact technical support",
],
},
[SewingMachineError.RestartError19]: {
title: 'Restart Required (M519419)',
description: 'A malfunction occurred. Error code: M519419',
title: "Restart Required (M519419)",
description: "A malfunction occurred. Error code: M519419",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M519419 and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M519419 and contact technical support",
],
},
[SewingMachineError.RestartError1A]: {
title: 'Restart Required (M51941A)',
description: 'A malfunction occurred. Error code: M51941A',
title: "Restart Required (M51941A)",
description: "A malfunction occurred. Error code: M51941A",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M51941A and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M51941A and contact technical support",
],
},
[SewingMachineError.RestartError1B]: {
title: 'Restart Required (M51941B)',
description: 'A malfunction occurred. Error code: M51941B',
title: "Restart Required (M51941B)",
description: "A malfunction occurred. Error code: M51941B",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M51941B and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M51941B and contact technical support",
],
},
[SewingMachineError.RestartError1C]: {
title: 'Restart Required (M51941C)',
description: 'A malfunction occurred. Error code: M51941C',
title: "Restart Required (M51941C)",
description: "A malfunction occurred. Error code: M51941C",
solutions: [
'Turn the machine off, then on again',
'If the problem persists, note error code M51941C and contact technical support',
"Turn the machine off, then on again",
"If the problem persists, note error code M51941C and contact technical support",
],
},
[SewingMachineError.NeedlePlateError]: {
title: 'Needle Plate Error',
description: 'Check the needle plate cover.',
title: "Needle Plate Error",
description: "Check the needle plate cover.",
solutions: [
'Reattach the needle plate cover',
'Check the bobbin case (for misalignment, scratches, etc.) and then reattach the needle plate cover',
"Reattach the needle plate cover",
"Check the bobbin case (for misalignment, scratches, etc.) and then reattach the needle plate cover",
],
},
[SewingMachineError.ThreadLeverError]: {
title: 'Thread Lever Error',
description: 'The needle threading lever is not in its original position.',
solutions: [
'Return the needle threading lever to its original position',
],
title: "Thread Lever Error",
description: "The needle threading lever is not in its original position.",
solutions: ["Return the needle threading lever to its original position"],
},
[SewingMachineError.UpperThreadError]: {
title: 'Upper Thread Error',
description: 'Check and rethread the upper thread.',
title: "Upper Thread Error",
description: "Check and rethread the upper thread.",
solutions: [
'Check the upper thread and rethread it',
'If the problem persists, replace the embroidery needle, then check the upper thread and rethread it',
"Check the upper thread and rethread it",
"If the problem persists, replace the embroidery needle, then check the upper thread and rethread it",
],
},
[SewingMachineError.LowerThreadError]: {
title: 'Lower Thread Error',
description: 'The bobbin thread is almost empty.',
title: "Lower Thread Error",
description: "The bobbin thread is almost empty.",
solutions: [
'Replace the bobbin thread',
'Wind the thread onto the empty bobbin in the correct way, then insert the bobbin',
"Replace the bobbin thread",
"Wind the thread onto the empty bobbin in the correct way, then insert the bobbin",
],
},
[SewingMachineError.UpperThreadSewingStartError]: {
title: 'Upper Thread Error at Sewing Start',
description: 'Check and rethread the upper thread.',
title: "Upper Thread Error at Sewing Start",
description: "Check and rethread the upper thread.",
solutions: [
'Press the Accept button to resolve the error',
'Check the upper thread and rethread it',
'If the problem persists, replace the embroidery needle, then check the upper thread and rethread it',
"Press the Accept button to resolve the error",
"Check the upper thread and rethread it",
"If the problem persists, replace the embroidery needle, then check the upper thread and rethread it",
],
},
[SewingMachineError.PRWiperError]: {
title: 'PR Wiper Error',
description: 'PR Wiper Error.',
solutions: [
'Press the Accept button to resolve the error',
],
title: "PR Wiper Error",
description: "PR Wiper Error.",
solutions: ["Press the Accept button to resolve the error"],
},
[SewingMachineError.HoopError]: {
title: 'Hoop Error',
description: 'This embroidery frame cannot be used.',
solutions: [
'Use another frame that fits the pattern',
],
title: "Hoop Error",
description: "This embroidery frame cannot be used.",
solutions: ["Use another frame that fits the pattern"],
},
[SewingMachineError.NoHoopError]: {
title: 'No Hoop Detected',
description: 'No hoop attached.',
solutions: [
'Attach the embroidery hoop',
],
title: "No Hoop Detected",
description: "No hoop attached.",
solutions: ["Attach the embroidery hoop"],
},
[SewingMachineError.InitialHoopError]: {
title: 'Machine Initialization Required',
description: 'The hoop needs to be removed and an initial homing procedure must be performed.',
title: "Machine Initialization Required",
description: "An initial homing procedure must be performed.",
solutions: [
'Remove the embroidery hoop from the machine completely',
'Press the Accept button',
'Wait for the machine to complete its initialization (homing)',
'Once initialization is complete, reattach the hoop',
'The machine should now recognize the hoop correctly',
"Remove the embroidery hoop from the machine completely",
"Press the Accept button",
"Wait for the machine to complete its initialization (homing)",
"Once initialization is complete, reattach the hoop",
"The machine should now recognize the hoop correctly",
],
isInformational: true, // This is a normal initialization step, not an error
},
[SewingMachineError.RegularInspectionError]: {
title: 'Regular Inspection Required',
description: 'Preventive maintenance is recommended. This message is displayed when maintenance is due.',
solutions: [
'Please contact the service center',
],
title: "Regular Inspection Required",
description:
"Preventive maintenance is recommended. This message is displayed when maintenance is due.",
solutions: ["Please contact the service center"],
},
[SewingMachineError.Setting]: {
title: 'Settings Error',
description: 'Stitch count cannot be changed.',
solutions: [
'This setting cannot be modified at this time',
],
title: "Settings Error",
description: "Stitch count cannot be changed.",
solutions: ["This setting cannot be modified at this time"],
},
};
@ -281,36 +263,37 @@ const ERROR_DETAILS: Record<number, ErrorInfo> = {
* Simple error titles for all error codes
*/
const ERROR_MESSAGES: Record<number, string> = {
[SewingMachineError.NeedlePositionError]: 'Needle Position Error',
[SewingMachineError.SafetyError]: 'Safety Error',
[SewingMachineError.LowerThreadSafetyError]: 'Lower Thread Safety Error',
[SewingMachineError.LowerThreadFreeError]: 'Lower Thread Free Error',
[SewingMachineError.RestartError10]: 'Restart Required (0x10)',
[SewingMachineError.RestartError11]: 'Restart Required (0x11)',
[SewingMachineError.RestartError12]: 'Restart Required (0x12)',
[SewingMachineError.RestartError13]: 'Restart Required (0x13)',
[SewingMachineError.RestartError14]: 'Restart Required (0x14)',
[SewingMachineError.RestartError15]: 'Restart Required (0x15)',
[SewingMachineError.RestartError16]: 'Restart Required (0x16)',
[SewingMachineError.RestartError17]: 'Restart Required (0x17)',
[SewingMachineError.RestartError18]: 'Restart Required (0x18)',
[SewingMachineError.RestartError19]: 'Restart Required (0x19)',
[SewingMachineError.RestartError1A]: 'Restart Required (0x1A)',
[SewingMachineError.RestartError1B]: 'Restart Required (0x1B)',
[SewingMachineError.RestartError1C]: 'Restart Required (0x1C)',
[SewingMachineError.NeedlePlateError]: 'Needle Plate Error',
[SewingMachineError.ThreadLeverError]: 'Thread Lever Error',
[SewingMachineError.UpperThreadError]: 'Upper Thread Error',
[SewingMachineError.LowerThreadError]: 'Lower Thread Error',
[SewingMachineError.UpperThreadSewingStartError]: 'Upper Thread Error at Sewing Start',
[SewingMachineError.PRWiperError]: 'PR Wiper Error',
[SewingMachineError.HoopError]: 'Hoop Error',
[SewingMachineError.NoHoopError]: 'No Hoop Detected',
[SewingMachineError.InitialHoopError]: 'Initial Hoop Position Error',
[SewingMachineError.RegularInspectionError]: 'Regular Inspection Required',
[SewingMachineError.Setting]: 'Settings Error',
[SewingMachineError.Unknown]: 'Unknown Error',
[SewingMachineError.OtherError]: 'Other Error',
[SewingMachineError.NeedlePositionError]: "Needle Position Error",
[SewingMachineError.SafetyError]: "Safety Error",
[SewingMachineError.LowerThreadSafetyError]: "Lower Thread Safety Error",
[SewingMachineError.LowerThreadFreeError]: "Lower Thread Free Error",
[SewingMachineError.RestartError10]: "Restart Required (0x10)",
[SewingMachineError.RestartError11]: "Restart Required (0x11)",
[SewingMachineError.RestartError12]: "Restart Required (0x12)",
[SewingMachineError.RestartError13]: "Restart Required (0x13)",
[SewingMachineError.RestartError14]: "Restart Required (0x14)",
[SewingMachineError.RestartError15]: "Restart Required (0x15)",
[SewingMachineError.RestartError16]: "Restart Required (0x16)",
[SewingMachineError.RestartError17]: "Restart Required (0x17)",
[SewingMachineError.RestartError18]: "Restart Required (0x18)",
[SewingMachineError.RestartError19]: "Restart Required (0x19)",
[SewingMachineError.RestartError1A]: "Restart Required (0x1A)",
[SewingMachineError.RestartError1B]: "Restart Required (0x1B)",
[SewingMachineError.RestartError1C]: "Restart Required (0x1C)",
[SewingMachineError.NeedlePlateError]: "Needle Plate Error",
[SewingMachineError.ThreadLeverError]: "Thread Lever Error",
[SewingMachineError.UpperThreadError]: "Upper Thread Error",
[SewingMachineError.LowerThreadError]: "Lower Thread Error",
[SewingMachineError.UpperThreadSewingStartError]:
"Upper Thread Error at Sewing Start",
[SewingMachineError.PRWiperError]: "PR Wiper Error",
[SewingMachineError.HoopError]: "Hoop Error",
[SewingMachineError.NoHoopError]: "No Hoop Detected",
[SewingMachineError.InitialHoopError]: "Initial Hoop Position Error",
[SewingMachineError.RegularInspectionError]: "Regular Inspection Required",
[SewingMachineError.Setting]: "Settings Error",
[SewingMachineError.Unknown]: "Unknown Error",
[SewingMachineError.OtherError]: "Other Error",
};
/**
@ -334,20 +317,26 @@ export function getErrorMessage(errorCode: number | undefined): string | null {
}
// Unknown error code
return `Machine Error ${errorCode} (0x${errorCode.toString(16).toUpperCase().padStart(2, '0')})`;
return `Machine Error ${errorCode} (0x${errorCode.toString(16).toUpperCase().padStart(2, "0")})`;
}
/**
* Check if error code represents an actual error condition
*/
export function hasError(errorCode: number | undefined): boolean {
return errorCode !== undefined && errorCode !== null && errorCode !== SewingMachineError.None;
return (
errorCode !== undefined &&
errorCode !== null &&
errorCode !== SewingMachineError.None
);
}
/**
* Get detailed error information including title, description, and solutions
*/
export function getErrorDetails(errorCode: number | undefined): ErrorInfo | null {
export function getErrorDetails(
errorCode: number | undefined,
): ErrorInfo | null {
// Handle undefined or null
if (errorCode === undefined || errorCode === null) {
return null;
@ -369,23 +358,24 @@ export function getErrorDetails(errorCode: number | undefined): ErrorInfo | null
if (errorTitle) {
return {
title: errorTitle,
description: 'Please check the machine display for more information.',
description: "Please check the machine display for more information.",
solutions: [
'Consult your machine manual for specific troubleshooting steps',
'Check the error code on the machine display',
'Contact technical support if the problem persists',
"Consult your machine manual for specific troubleshooting steps",
"Check the error code on the machine display",
"Contact technical support if the problem persists",
],
};
}
// Unknown error code
return {
title: `Machine Error 0x${errorCode.toString(16).toUpperCase().padStart(2, '0')}`,
description: 'The machine has reported an error code that is not recognized.',
title: `Machine Error 0x${errorCode.toString(16).toUpperCase().padStart(2, "0")}`,
description:
"The machine has reported an error code that is not recognized.",
solutions: [
'Note the error code and consult your machine manual',
'Turn the machine off and on again',
'If error persists, contact technical support with this error code',
"Note the error code and consult your machine manual",
"Turn the machine off and on again",
"If error persists, contact technical support with this error code",
],
};
}