mirror of
https://github.com/jhbruhn/respira.git
synced 2026-01-27 02:13:41 +00:00
fix: slightly shorten homing message
This commit is contained in:
parent
7c2172f52c
commit
a4fc959eb1
1 changed files with 386 additions and 396 deletions
|
|
@ -1,396 +1,386 @@
|
||||||
/**
|
/**
|
||||||
* Brother PP1 Protocol Error Codes
|
* Brother PP1 Protocol Error Codes
|
||||||
* Based on App/Asura.Core/Models/SewingMachineError.cs
|
* Based on App/Asura.Core/Models/SewingMachineError.cs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const SewingMachineError = {
|
export const SewingMachineError = {
|
||||||
NeedlePositionError: 0x00,
|
NeedlePositionError: 0x00,
|
||||||
SafetyError: 0x01,
|
SafetyError: 0x01,
|
||||||
LowerThreadSafetyError: 0x02,
|
LowerThreadSafetyError: 0x02,
|
||||||
LowerThreadFreeError: 0x03,
|
LowerThreadFreeError: 0x03,
|
||||||
RestartError10: 0x10,
|
RestartError10: 0x10,
|
||||||
RestartError11: 0x11,
|
RestartError11: 0x11,
|
||||||
RestartError12: 0x12,
|
RestartError12: 0x12,
|
||||||
RestartError13: 0x13,
|
RestartError13: 0x13,
|
||||||
RestartError14: 0x14,
|
RestartError14: 0x14,
|
||||||
RestartError15: 0x15,
|
RestartError15: 0x15,
|
||||||
RestartError16: 0x16,
|
RestartError16: 0x16,
|
||||||
RestartError17: 0x17,
|
RestartError17: 0x17,
|
||||||
RestartError18: 0x18,
|
RestartError18: 0x18,
|
||||||
RestartError19: 0x19,
|
RestartError19: 0x19,
|
||||||
RestartError1A: 0x1A,
|
RestartError1A: 0x1a,
|
||||||
RestartError1B: 0x1B,
|
RestartError1B: 0x1b,
|
||||||
RestartError1C: 0x1C,
|
RestartError1C: 0x1c,
|
||||||
NeedlePlateError: 0x20,
|
NeedlePlateError: 0x20,
|
||||||
ThreadLeverError: 0x21,
|
ThreadLeverError: 0x21,
|
||||||
UpperThreadError: 0x60,
|
UpperThreadError: 0x60,
|
||||||
LowerThreadError: 0x61,
|
LowerThreadError: 0x61,
|
||||||
UpperThreadSewingStartError: 0x62,
|
UpperThreadSewingStartError: 0x62,
|
||||||
PRWiperError: 0x63,
|
PRWiperError: 0x63,
|
||||||
HoopError: 0x70,
|
HoopError: 0x70,
|
||||||
NoHoopError: 0x71,
|
NoHoopError: 0x71,
|
||||||
InitialHoopError: 0x72,
|
InitialHoopError: 0x72,
|
||||||
RegularInspectionError: 0x80,
|
RegularInspectionError: 0x80,
|
||||||
Setting: 0x98,
|
Setting: 0x98,
|
||||||
None: 0xDD,
|
None: 0xdd,
|
||||||
Unknown: 0xEE,
|
Unknown: 0xee,
|
||||||
OtherError: 0xFF,
|
OtherError: 0xff,
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detailed error information with title, description, and solution steps
|
* Detailed error information with title, description, and solution steps
|
||||||
*/
|
*/
|
||||||
interface ErrorInfo {
|
interface ErrorInfo {
|
||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
solutions: string[];
|
solutions: string[];
|
||||||
/** If true, this "error" is really just an informational step, not a real error */
|
/** If true, this "error" is really just an informational step, not a real error */
|
||||||
isInformational?: boolean;
|
isInformational?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detailed error messages with actionable solutions
|
* Detailed error messages with actionable solutions
|
||||||
* Only errors with verified solutions are included here
|
* Only errors with verified solutions are included here
|
||||||
*/
|
*/
|
||||||
const ERROR_DETAILS: Record<number, ErrorInfo> = {
|
const ERROR_DETAILS: Record<number, ErrorInfo> = {
|
||||||
[SewingMachineError.NeedlePositionError]: {
|
[SewingMachineError.NeedlePositionError]: {
|
||||||
title: 'The Needle is Down',
|
title: "The Needle is Down",
|
||||||
description: 'The needle is in the down position and needs to be raised before continuing.',
|
description:
|
||||||
solutions: [
|
"The needle is in the down position and needs to be raised before continuing.",
|
||||||
'Press the needle position switch to raise the needle',
|
solutions: ["Press the needle position switch to raise the needle"],
|
||||||
],
|
},
|
||||||
},
|
[SewingMachineError.SafetyError]: {
|
||||||
[SewingMachineError.SafetyError]: {
|
title: "Safety Error",
|
||||||
title: 'Safety Error',
|
description: "The machine is sensing an operational issue.",
|
||||||
description: 'The machine is sensing an operational issue.',
|
solutions: [
|
||||||
solutions: [
|
"Remove the thread on the top of the fabric and then remove the needle",
|
||||||
'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",
|
||||||
'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",
|
||||||
'Check the bobbin case for scratches or contamination',
|
"Insert the embroidery needle",
|
||||||
'Insert the embroidery needle',
|
"Check that the bobbin is inserted correctly",
|
||||||
'Check that the bobbin is inserted correctly',
|
],
|
||||||
],
|
},
|
||||||
},
|
[SewingMachineError.LowerThreadSafetyError]: {
|
||||||
[SewingMachineError.LowerThreadSafetyError]: {
|
title: "Lower Thread Safety Error",
|
||||||
title: 'Lower Thread Safety Error',
|
description: "The bobbin winder safety device is activated.",
|
||||||
description: 'The bobbin winder safety device is activated.',
|
solutions: ["Check if the thread is tangled"],
|
||||||
solutions: [
|
},
|
||||||
'Check if the thread is tangled',
|
[SewingMachineError.LowerThreadFreeError]: {
|
||||||
],
|
title: "Lower Thread Free Error",
|
||||||
},
|
description: "Problem with lower thread.",
|
||||||
[SewingMachineError.LowerThreadFreeError]: {
|
solutions: ["Slide the bobbin winder shaft toward the front"],
|
||||||
title: 'Lower Thread Free Error',
|
},
|
||||||
description: 'Problem with lower thread.',
|
[SewingMachineError.RestartError10]: {
|
||||||
solutions: [
|
title: "Restart Required",
|
||||||
'Slide the bobbin winder shaft toward the front',
|
description: "A malfunction occurred.",
|
||||||
],
|
solutions: ["Turn the machine off, then on again"],
|
||||||
},
|
},
|
||||||
[SewingMachineError.RestartError10]: {
|
[SewingMachineError.RestartError11]: {
|
||||||
title: 'Restart Required',
|
title: "Restart Required (M519411)",
|
||||||
description: 'A malfunction occurred.',
|
description: "A malfunction occurred. Error code: M519411",
|
||||||
solutions: [
|
solutions: [
|
||||||
'Turn the machine off, then on again',
|
"Turn the machine off, then on again",
|
||||||
],
|
"If the problem persists, note error code M519411 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError11]: {
|
},
|
||||||
title: 'Restart Required (M519411)',
|
[SewingMachineError.RestartError12]: {
|
||||||
description: 'A malfunction occurred. Error code: M519411',
|
title: "Restart Required (M519412)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519412",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519412 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError12]: {
|
},
|
||||||
title: 'Restart Required (M519412)',
|
[SewingMachineError.RestartError13]: {
|
||||||
description: 'A malfunction occurred. Error code: M519412',
|
title: "Restart Required (M519413)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519413",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519413 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError13]: {
|
},
|
||||||
title: 'Restart Required (M519413)',
|
[SewingMachineError.RestartError14]: {
|
||||||
description: 'A malfunction occurred. Error code: M519413',
|
title: "Restart Required (M519414)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519414",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519414 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError14]: {
|
},
|
||||||
title: 'Restart Required (M519414)',
|
[SewingMachineError.RestartError15]: {
|
||||||
description: 'A malfunction occurred. Error code: M519414',
|
title: "Restart Required (M519415)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519415",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519415 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError15]: {
|
},
|
||||||
title: 'Restart Required (M519415)',
|
[SewingMachineError.RestartError16]: {
|
||||||
description: 'A malfunction occurred. Error code: M519415',
|
title: "Restart Required (M519416)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519416",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519416 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError16]: {
|
},
|
||||||
title: 'Restart Required (M519416)',
|
[SewingMachineError.RestartError17]: {
|
||||||
description: 'A malfunction occurred. Error code: M519416',
|
title: "Restart Required (M519417)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519417",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519417 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError17]: {
|
},
|
||||||
title: 'Restart Required (M519417)',
|
[SewingMachineError.RestartError18]: {
|
||||||
description: 'A malfunction occurred. Error code: M519417',
|
title: "Restart Required (M519418)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519418",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519418 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError18]: {
|
},
|
||||||
title: 'Restart Required (M519418)',
|
[SewingMachineError.RestartError19]: {
|
||||||
description: 'A malfunction occurred. Error code: M519418',
|
title: "Restart Required (M519419)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M519419",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M519419 and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError19]: {
|
},
|
||||||
title: 'Restart Required (M519419)',
|
[SewingMachineError.RestartError1A]: {
|
||||||
description: 'A malfunction occurred. Error code: M519419',
|
title: "Restart Required (M51941A)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M51941A",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M51941A and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError1A]: {
|
},
|
||||||
title: 'Restart Required (M51941A)',
|
[SewingMachineError.RestartError1B]: {
|
||||||
description: 'A malfunction occurred. Error code: M51941A',
|
title: "Restart Required (M51941B)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M51941B",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M51941B and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError1B]: {
|
},
|
||||||
title: 'Restart Required (M51941B)',
|
[SewingMachineError.RestartError1C]: {
|
||||||
description: 'A malfunction occurred. Error code: M51941B',
|
title: "Restart Required (M51941C)",
|
||||||
solutions: [
|
description: "A malfunction occurred. Error code: M51941C",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'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 M51941C and contact technical support",
|
||||||
},
|
],
|
||||||
[SewingMachineError.RestartError1C]: {
|
},
|
||||||
title: 'Restart Required (M51941C)',
|
[SewingMachineError.NeedlePlateError]: {
|
||||||
description: 'A malfunction occurred. Error code: M51941C',
|
title: "Needle Plate Error",
|
||||||
solutions: [
|
description: "Check the needle plate cover.",
|
||||||
'Turn the machine off, then on again',
|
solutions: [
|
||||||
'If the problem persists, note error code M51941C and contact technical support',
|
"Reattach the needle plate cover",
|
||||||
],
|
"Check the bobbin case (for misalignment, scratches, etc.) and then reattach the needle plate cover",
|
||||||
},
|
],
|
||||||
[SewingMachineError.NeedlePlateError]: {
|
},
|
||||||
title: 'Needle Plate Error',
|
[SewingMachineError.ThreadLeverError]: {
|
||||||
description: 'Check the needle plate cover.',
|
title: "Thread Lever Error",
|
||||||
solutions: [
|
description: "The needle threading lever is not in its original position.",
|
||||||
'Reattach the needle plate cover',
|
solutions: ["Return the needle threading lever to its original position"],
|
||||||
'Check the bobbin case (for misalignment, scratches, etc.) and then reattach the needle plate cover',
|
},
|
||||||
],
|
[SewingMachineError.UpperThreadError]: {
|
||||||
},
|
title: "Upper Thread Error",
|
||||||
[SewingMachineError.ThreadLeverError]: {
|
description: "Check and rethread the upper thread.",
|
||||||
title: 'Thread Lever Error',
|
solutions: [
|
||||||
description: 'The needle threading lever is not in its original position.',
|
"Check the upper thread and rethread it",
|
||||||
solutions: [
|
"If the problem persists, replace the embroidery needle, then check the upper thread and rethread it",
|
||||||
'Return the needle threading lever to its original position',
|
],
|
||||||
],
|
},
|
||||||
},
|
[SewingMachineError.LowerThreadError]: {
|
||||||
[SewingMachineError.UpperThreadError]: {
|
title: "Lower Thread Error",
|
||||||
title: 'Upper Thread Error',
|
description: "The bobbin thread is almost empty.",
|
||||||
description: 'Check and rethread the upper thread.',
|
solutions: [
|
||||||
solutions: [
|
"Replace the bobbin thread",
|
||||||
'Check the upper thread and rethread it',
|
"Wind the thread onto the empty bobbin in the correct way, then insert the bobbin",
|
||||||
'If the problem persists, replace the embroidery needle, then check the upper thread and rethread it',
|
],
|
||||||
],
|
},
|
||||||
},
|
[SewingMachineError.UpperThreadSewingStartError]: {
|
||||||
[SewingMachineError.LowerThreadError]: {
|
title: "Upper Thread Error at Sewing Start",
|
||||||
title: 'Lower Thread Error',
|
description: "Check and rethread the upper thread.",
|
||||||
description: 'The bobbin thread is almost empty.',
|
solutions: [
|
||||||
solutions: [
|
"Press the Accept button to resolve the error",
|
||||||
'Replace the bobbin thread',
|
"Check the upper thread and rethread it",
|
||||||
'Wind the thread onto the empty bobbin in the correct way, then insert the bobbin',
|
"If the problem persists, replace the embroidery needle, then check the upper thread and rethread it",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
[SewingMachineError.UpperThreadSewingStartError]: {
|
[SewingMachineError.PRWiperError]: {
|
||||||
title: 'Upper Thread Error at Sewing Start',
|
title: "PR Wiper Error",
|
||||||
description: 'Check and rethread the upper thread.',
|
description: "PR Wiper Error.",
|
||||||
solutions: [
|
solutions: ["Press the Accept button to resolve the error"],
|
||||||
'Press the Accept button to resolve the error',
|
},
|
||||||
'Check the upper thread and rethread it',
|
[SewingMachineError.HoopError]: {
|
||||||
'If the problem persists, replace the embroidery needle, then check the upper thread and rethread it',
|
title: "Hoop Error",
|
||||||
],
|
description: "This embroidery frame cannot be used.",
|
||||||
},
|
solutions: ["Use another frame that fits the pattern"],
|
||||||
[SewingMachineError.PRWiperError]: {
|
},
|
||||||
title: 'PR Wiper Error',
|
[SewingMachineError.NoHoopError]: {
|
||||||
description: 'PR Wiper Error.',
|
title: "No Hoop Detected",
|
||||||
solutions: [
|
description: "No hoop attached.",
|
||||||
'Press the Accept button to resolve the error',
|
solutions: ["Attach the embroidery hoop"],
|
||||||
],
|
},
|
||||||
},
|
[SewingMachineError.InitialHoopError]: {
|
||||||
[SewingMachineError.HoopError]: {
|
title: "Machine Initialization Required",
|
||||||
title: 'Hoop Error',
|
description: "An initial homing procedure must be performed.",
|
||||||
description: 'This embroidery frame cannot be used.',
|
solutions: [
|
||||||
solutions: [
|
"Remove the embroidery hoop from the machine completely",
|
||||||
'Use another frame that fits the pattern',
|
"Press the Accept button",
|
||||||
],
|
"Wait for the machine to complete its initialization (homing)",
|
||||||
},
|
"Once initialization is complete, reattach the hoop",
|
||||||
[SewingMachineError.NoHoopError]: {
|
"The machine should now recognize the hoop correctly",
|
||||||
title: 'No Hoop Detected',
|
],
|
||||||
description: 'No hoop attached.',
|
isInformational: true, // This is a normal initialization step, not an error
|
||||||
solutions: [
|
},
|
||||||
'Attach the embroidery hoop',
|
[SewingMachineError.RegularInspectionError]: {
|
||||||
],
|
title: "Regular Inspection Required",
|
||||||
},
|
description:
|
||||||
[SewingMachineError.InitialHoopError]: {
|
"Preventive maintenance is recommended. This message is displayed when maintenance is due.",
|
||||||
title: 'Machine Initialization Required',
|
solutions: ["Please contact the service center"],
|
||||||
description: 'The hoop needs to be removed and an initial homing procedure must be performed.',
|
},
|
||||||
solutions: [
|
[SewingMachineError.Setting]: {
|
||||||
'Remove the embroidery hoop from the machine completely',
|
title: "Settings Error",
|
||||||
'Press the Accept button',
|
description: "Stitch count cannot be changed.",
|
||||||
'Wait for the machine to complete its initialization (homing)',
|
solutions: ["This setting cannot be modified at this time"],
|
||||||
'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
|
/**
|
||||||
},
|
* Simple error titles for all error codes
|
||||||
[SewingMachineError.RegularInspectionError]: {
|
*/
|
||||||
title: 'Regular Inspection Required',
|
const ERROR_MESSAGES: Record<number, string> = {
|
||||||
description: 'Preventive maintenance is recommended. This message is displayed when maintenance is due.',
|
[SewingMachineError.NeedlePositionError]: "Needle Position Error",
|
||||||
solutions: [
|
[SewingMachineError.SafetyError]: "Safety Error",
|
||||||
'Please contact the service center',
|
[SewingMachineError.LowerThreadSafetyError]: "Lower Thread Safety Error",
|
||||||
],
|
[SewingMachineError.LowerThreadFreeError]: "Lower Thread Free Error",
|
||||||
},
|
[SewingMachineError.RestartError10]: "Restart Required (0x10)",
|
||||||
[SewingMachineError.Setting]: {
|
[SewingMachineError.RestartError11]: "Restart Required (0x11)",
|
||||||
title: 'Settings Error',
|
[SewingMachineError.RestartError12]: "Restart Required (0x12)",
|
||||||
description: 'Stitch count cannot be changed.',
|
[SewingMachineError.RestartError13]: "Restart Required (0x13)",
|
||||||
solutions: [
|
[SewingMachineError.RestartError14]: "Restart Required (0x14)",
|
||||||
'This setting cannot be modified at this time',
|
[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)",
|
||||||
* Simple error titles for all error codes
|
[SewingMachineError.RestartError1B]: "Restart Required (0x1B)",
|
||||||
*/
|
[SewingMachineError.RestartError1C]: "Restart Required (0x1C)",
|
||||||
const ERROR_MESSAGES: Record<number, string> = {
|
[SewingMachineError.NeedlePlateError]: "Needle Plate Error",
|
||||||
[SewingMachineError.NeedlePositionError]: 'Needle Position Error',
|
[SewingMachineError.ThreadLeverError]: "Thread Lever Error",
|
||||||
[SewingMachineError.SafetyError]: 'Safety Error',
|
[SewingMachineError.UpperThreadError]: "Upper Thread Error",
|
||||||
[SewingMachineError.LowerThreadSafetyError]: 'Lower Thread Safety Error',
|
[SewingMachineError.LowerThreadError]: "Lower Thread Error",
|
||||||
[SewingMachineError.LowerThreadFreeError]: 'Lower Thread Free Error',
|
[SewingMachineError.UpperThreadSewingStartError]:
|
||||||
[SewingMachineError.RestartError10]: 'Restart Required (0x10)',
|
"Upper Thread Error at Sewing Start",
|
||||||
[SewingMachineError.RestartError11]: 'Restart Required (0x11)',
|
[SewingMachineError.PRWiperError]: "PR Wiper Error",
|
||||||
[SewingMachineError.RestartError12]: 'Restart Required (0x12)',
|
[SewingMachineError.HoopError]: "Hoop Error",
|
||||||
[SewingMachineError.RestartError13]: 'Restart Required (0x13)',
|
[SewingMachineError.NoHoopError]: "No Hoop Detected",
|
||||||
[SewingMachineError.RestartError14]: 'Restart Required (0x14)',
|
[SewingMachineError.InitialHoopError]: "Initial Hoop Position Error",
|
||||||
[SewingMachineError.RestartError15]: 'Restart Required (0x15)',
|
[SewingMachineError.RegularInspectionError]: "Regular Inspection Required",
|
||||||
[SewingMachineError.RestartError16]: 'Restart Required (0x16)',
|
[SewingMachineError.Setting]: "Settings Error",
|
||||||
[SewingMachineError.RestartError17]: 'Restart Required (0x17)',
|
[SewingMachineError.Unknown]: "Unknown Error",
|
||||||
[SewingMachineError.RestartError18]: 'Restart Required (0x18)',
|
[SewingMachineError.OtherError]: "Other Error",
|
||||||
[SewingMachineError.RestartError19]: 'Restart Required (0x19)',
|
};
|
||||||
[SewingMachineError.RestartError1A]: 'Restart Required (0x1A)',
|
|
||||||
[SewingMachineError.RestartError1B]: 'Restart Required (0x1B)',
|
/**
|
||||||
[SewingMachineError.RestartError1C]: 'Restart Required (0x1C)',
|
* Get human-readable error message for an error code
|
||||||
[SewingMachineError.NeedlePlateError]: 'Needle Plate Error',
|
*/
|
||||||
[SewingMachineError.ThreadLeverError]: 'Thread Lever Error',
|
export function getErrorMessage(errorCode: number | undefined): string | null {
|
||||||
[SewingMachineError.UpperThreadError]: 'Upper Thread Error',
|
// Handle undefined or null
|
||||||
[SewingMachineError.LowerThreadError]: 'Lower Thread Error',
|
if (errorCode === undefined || errorCode === null) {
|
||||||
[SewingMachineError.UpperThreadSewingStartError]: 'Upper Thread Error at Sewing Start',
|
return null;
|
||||||
[SewingMachineError.PRWiperError]: 'PR Wiper Error',
|
}
|
||||||
[SewingMachineError.HoopError]: 'Hoop Error',
|
|
||||||
[SewingMachineError.NoHoopError]: 'No Hoop Detected',
|
// 0xDD (221) is the default "no error" value
|
||||||
[SewingMachineError.InitialHoopError]: 'Initial Hoop Position Error',
|
if (errorCode === SewingMachineError.None) {
|
||||||
[SewingMachineError.RegularInspectionError]: 'Regular Inspection Required',
|
return null; // No error to display
|
||||||
[SewingMachineError.Setting]: 'Settings Error',
|
}
|
||||||
[SewingMachineError.Unknown]: 'Unknown Error',
|
|
||||||
[SewingMachineError.OtherError]: 'Other Error',
|
// Look up known error message
|
||||||
};
|
const message = ERROR_MESSAGES[errorCode];
|
||||||
|
if (message) {
|
||||||
/**
|
return message;
|
||||||
* Get human-readable error message for an error code
|
}
|
||||||
*/
|
|
||||||
export function getErrorMessage(errorCode: number | undefined): string | null {
|
// Unknown error code
|
||||||
// Handle undefined or null
|
return `Machine Error ${errorCode} (0x${errorCode.toString(16).toUpperCase().padStart(2, "0")})`;
|
||||||
if (errorCode === undefined || errorCode === null) {
|
}
|
||||||
return null;
|
|
||||||
}
|
/**
|
||||||
|
* Check if error code represents an actual error condition
|
||||||
// 0xDD (221) is the default "no error" value
|
*/
|
||||||
if (errorCode === SewingMachineError.None) {
|
export function hasError(errorCode: number | undefined): boolean {
|
||||||
return null; // No error to display
|
return (
|
||||||
}
|
errorCode !== undefined &&
|
||||||
|
errorCode !== null &&
|
||||||
// Look up known error message
|
errorCode !== SewingMachineError.None
|
||||||
const message = ERROR_MESSAGES[errorCode];
|
);
|
||||||
if (message) {
|
}
|
||||||
return message;
|
|
||||||
}
|
/**
|
||||||
|
* Get detailed error information including title, description, and solutions
|
||||||
// Unknown error code
|
*/
|
||||||
return `Machine Error ${errorCode} (0x${errorCode.toString(16).toUpperCase().padStart(2, '0')})`;
|
export function getErrorDetails(
|
||||||
}
|
errorCode: number | undefined,
|
||||||
|
): ErrorInfo | null {
|
||||||
/**
|
// Handle undefined or null
|
||||||
* Check if error code represents an actual error condition
|
if (errorCode === undefined || errorCode === null) {
|
||||||
*/
|
return null;
|
||||||
export function hasError(errorCode: number | undefined): boolean {
|
}
|
||||||
return errorCode !== undefined && errorCode !== null && errorCode !== SewingMachineError.None;
|
|
||||||
}
|
// 0xDD (221) is the default "no error" value
|
||||||
|
if (errorCode === SewingMachineError.None) {
|
||||||
/**
|
return null;
|
||||||
* Get detailed error information including title, description, and solutions
|
}
|
||||||
*/
|
|
||||||
export function getErrorDetails(errorCode: number | undefined): ErrorInfo | null {
|
// Look up known error details with solutions
|
||||||
// Handle undefined or null
|
const details = ERROR_DETAILS[errorCode];
|
||||||
if (errorCode === undefined || errorCode === null) {
|
if (details) {
|
||||||
return null;
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 0xDD (221) is the default "no error" value
|
// For errors without detailed solutions, return basic info
|
||||||
if (errorCode === SewingMachineError.None) {
|
const errorTitle = ERROR_MESSAGES[errorCode];
|
||||||
return null;
|
if (errorTitle) {
|
||||||
}
|
return {
|
||||||
|
title: errorTitle,
|
||||||
// Look up known error details with solutions
|
description: "Please check the machine display for more information.",
|
||||||
const details = ERROR_DETAILS[errorCode];
|
solutions: [
|
||||||
if (details) {
|
"Consult your machine manual for specific troubleshooting steps",
|
||||||
return details;
|
"Check the error code on the machine display",
|
||||||
}
|
"Contact technical support if the problem persists",
|
||||||
|
],
|
||||||
// For errors without detailed solutions, return basic info
|
};
|
||||||
const errorTitle = ERROR_MESSAGES[errorCode];
|
}
|
||||||
if (errorTitle) {
|
|
||||||
return {
|
// Unknown error code
|
||||||
title: errorTitle,
|
return {
|
||||||
description: 'Please check the machine display for more information.',
|
title: `Machine Error 0x${errorCode.toString(16).toUpperCase().padStart(2, "0")}`,
|
||||||
solutions: [
|
description:
|
||||||
'Consult your machine manual for specific troubleshooting steps',
|
"The machine has reported an error code that is not recognized.",
|
||||||
'Check the error code on the machine display',
|
solutions: [
|
||||||
'Contact technical support if the problem persists',
|
"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",
|
||||||
}
|
],
|
||||||
|
};
|
||||||
// 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.',
|
* Export ErrorInfo type for use in other files
|
||||||
solutions: [
|
*/
|
||||||
'Note the error code and consult your machine manual',
|
export type { ErrorInfo };
|
||||||
'Turn the machine off and on again',
|
|
||||||
'If error persists, contact technical support with this error code',
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Export ErrorInfo type for use in other files
|
|
||||||
*/
|
|
||||||
export type { ErrorInfo };
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue