Skip to content

Commit

Permalink
PrinterRailSettings: use printer rail defaults for settings not yet m…
Browse files Browse the repository at this point in the history
…anaged by the frontend
  • Loading branch information
miklschmidt committed Dec 27, 2024
1 parent fc6bf31 commit d5c197f
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions src/components/setup-steps/printer-rail-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,17 @@ export const PrinterRailSettings: React.FC<PrinterRailSettingsProps> = (props) =

useEffect(() => {
const newState: Zod.infer<typeof BasePrinterRail> = {
axis: props.printerRail.axis,
axisDescription: props.printerRail.axisDescription,
rotationDistance: props.printerRail.rotationDistance,
invertStepperDirection: props.printerRail.invertStepperDirection,
axisMinimum: props.printerRail.axisMinimum,
axisMaximum: props.printerRail.axisMaximum,
axisEndstop: props.printerRail.axisEndstop,
axis: props.printerRailDefault.axis,
axisDescription: props.printerRailDefault.axisDescription,
rotationDistance: props.printerRailDefault.rotationDistance,
invertStepperDirection: props.printerRailDefault.invertStepperDirection,
axisMinimum: props.printerRailDefault.axisMinimum,
axisMaximum: props.printerRailDefault.axisMaximum,
axisEndstop: props.printerRailDefault.axisEndstop,
homingSpeed: homingSpeed,
motorSlot: motorSlot,
microstepping: props.printerRail.microstepping,
gearRatio: props.printerRail.gearRatio,
microstepping: props.printerRailDefault.microstepping,
gearRatio: props.printerRailDefault.gearRatio,
driver,
voltage: voltage.id,
stepper,
Expand All @@ -269,7 +269,25 @@ export const PrinterRailSettings: React.FC<PrinterRailSettingsProps> = (props) =
setPrinterRail(serializedNew);
});
}
}, [current, driver, props.printerRail, homingSpeed, setPrinterRail, stepper, voltage.id, motorSlot]);
}, [
current,
driver,
props.printerRail,
homingSpeed,
setPrinterRail,
stepper,
voltage.id,
motorSlot,
props.printerRailDefault.axis,
props.printerRailDefault.axisDescription,
props.printerRailDefault.rotationDistance,
props.printerRailDefault.invertStepperDirection,
props.printerRailDefault.axisMinimum,
props.printerRailDefault.axisMaximum,
props.printerRailDefault.axisEndstop,
props.printerRailDefault.microstepping,
props.printerRailDefault.gearRatio,
]);

const isRecommendedPresetCompatible = recommendedPreset && recommendedPreset.run_current === current;
const railName =
Expand Down

0 comments on commit d5c197f

Please sign in to comment.