feat: Add temperature ranges for extruder and bed temps (#5)
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled

Store extruder and bed temperatures as min/max ranges instead of
single values for more accurate filament specifications.

Backend changes:
- Add 4 new columns: settings_extruder_temp_min/max, settings_bed_temp_min/max
- Keep old columns for backward compatibility (marked deprecated)
- Alembic migration copies existing values to both min and max
- Update Pydantic models and API endpoints

Frontend changes:
- Filament model updated with new fields
- Create form uses min/max input pairs with Space.Compact
- Import from external DB populates both min and max with same value
- Label template updated to show ranges: "ET: 190-220 °C"
- Template help includes new tags

Labels now display temperature ranges like "190-220°C" which is more
useful for printing than a single recommended value.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-14 20:05:02 -06:00
parent dc166450ce
commit 3451996a8f
9 changed files with 183 additions and 35 deletions

View File

@@ -75,15 +75,39 @@ class FilamentParameters(BaseModel):
settings_extruder_temp: Optional[int] = Field(
None,
ge=0,
description="Overridden extruder temperature, in °C.",
description="Overridden extruder temperature, in °C. Deprecated: use settings_extruder_temp_min/max.",
examples=[210],
)
settings_bed_temp: Optional[int] = Field(
None,
ge=0,
description="Overridden bed temperature, in °C.",
description="Overridden bed temperature, in °C. Deprecated: use settings_bed_temp_min/max.",
examples=[60],
)
settings_extruder_temp_min: Optional[int] = Field(
None,
ge=0,
description="Minimum extruder temperature, in °C.",
examples=[190],
)
settings_extruder_temp_max: Optional[int] = Field(
None,
ge=0,
description="Maximum extruder temperature, in °C.",
examples=[220],
)
settings_bed_temp_min: Optional[int] = Field(
None,
ge=0,
description="Minimum bed temperature, in °C.",
examples=[50],
)
settings_bed_temp_max: Optional[int] = Field(
None,
ge=0,
description="Maximum bed temperature, in °C.",
examples=[70],
)
color_hex: Optional[str] = Field(
None,
description=(
@@ -454,6 +478,10 @@ async def create( # noqa: ANN201
comment=body.comment,
settings_extruder_temp=body.settings_extruder_temp,
settings_bed_temp=body.settings_bed_temp,
settings_extruder_temp_min=body.settings_extruder_temp_min,
settings_extruder_temp_max=body.settings_extruder_temp_max,
settings_bed_temp_min=body.settings_bed_temp_min,
settings_bed_temp_max=body.settings_bed_temp_max,
color_hex=body.color_hex,
multi_color_hexes=body.multi_color_hexes,
multi_color_direction=body.multi_color_direction,

View File

@@ -149,15 +149,39 @@ class Filament(BaseModel):
settings_extruder_temp: Optional[int] = Field(
None,
ge=0,
description="Overridden extruder temperature, in °C.",
description="Overridden extruder temperature, in °C. Deprecated: use settings_extruder_temp_min/max.",
examples=[210],
)
settings_bed_temp: Optional[int] = Field(
None,
ge=0,
description="Overridden bed temperature, in °C.",
description="Overridden bed temperature, in °C. Deprecated: use settings_bed_temp_min/max.",
examples=[60],
)
settings_extruder_temp_min: Optional[int] = Field(
None,
ge=0,
description="Minimum extruder temperature, in °C.",
examples=[190],
)
settings_extruder_temp_max: Optional[int] = Field(
None,
ge=0,
description="Maximum extruder temperature, in °C.",
examples=[220],
)
settings_bed_temp_min: Optional[int] = Field(
None,
ge=0,
description="Minimum bed temperature, in °C.",
examples=[50],
)
settings_bed_temp_max: Optional[int] = Field(
None,
ge=0,
description="Maximum bed temperature, in °C.",
examples=[70],
)
color_hex: Optional[str] = Field(
None,
min_length=6,
@@ -216,6 +240,10 @@ class Filament(BaseModel):
comment=item.comment,
settings_extruder_temp=item.settings_extruder_temp,
settings_bed_temp=item.settings_bed_temp,
settings_extruder_temp_min=item.settings_extruder_temp_min,
settings_extruder_temp_max=item.settings_extruder_temp_max,
settings_bed_temp_min=item.settings_bed_temp_min,
settings_bed_temp_max=item.settings_bed_temp_max,
color_hex=item.color_hex,
multi_color_hexes=item.multi_color_hexes,
multi_color_direction=(

View File

@@ -41,6 +41,10 @@ async def create(
comment: Optional[str] = None,
settings_extruder_temp: Optional[int] = None,
settings_bed_temp: Optional[int] = None,
settings_extruder_temp_min: Optional[int] = None,
settings_extruder_temp_max: Optional[int] = None,
settings_bed_temp_min: Optional[int] = None,
settings_bed_temp_max: Optional[int] = None,
color_hex: Optional[str] = None,
multi_color_hexes: Optional[str] = None,
multi_color_direction: Optional[MultiColorDirection] = None,
@@ -69,6 +73,10 @@ async def create(
comment=comment,
settings_extruder_temp=settings_extruder_temp,
settings_bed_temp=settings_bed_temp,
settings_extruder_temp_min=settings_extruder_temp_min,
settings_extruder_temp_max=settings_extruder_temp_max,
settings_bed_temp_min=settings_bed_temp_min,
settings_bed_temp_max=settings_bed_temp_max,
color_hex=color_hex,
multi_color_hexes=multi_color_hexes,
multi_color_direction=multi_color_direction.value if multi_color_direction is not None else None,

View File

@@ -46,8 +46,12 @@ class Filament(Base):
spool_weight: Mapped[Optional[float]] = mapped_column(comment="The weight of an empty spool.")
article_number: Mapped[Optional[str]] = mapped_column(String(64))
comment: Mapped[Optional[str]] = mapped_column(String(1024))
settings_extruder_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden extruder temperature.")
settings_bed_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden bed temperature.")
settings_extruder_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden extruder temperature (deprecated, use min/max).")
settings_bed_temp: Mapped[Optional[int]] = mapped_column(comment="Overridden bed temperature (deprecated, use min/max).")
settings_extruder_temp_min: Mapped[Optional[int]] = mapped_column(comment="Minimum extruder temperature.")
settings_extruder_temp_max: Mapped[Optional[int]] = mapped_column(comment="Maximum extruder temperature.")
settings_bed_temp_min: Mapped[Optional[int]] = mapped_column(comment="Minimum bed temperature.")
settings_bed_temp_max: Mapped[Optional[int]] = mapped_column(comment="Maximum bed temperature.")
color_hex: Mapped[Optional[str]] = mapped_column(String(8))
multi_color_hexes: Mapped[Optional[str]] = mapped_column(String(128))
multi_color_direction: Mapped[Optional[str]] = mapped_column(String(16))