mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-18 21:47:39 +02:00
Fix P2S showing carbon rod maintenance tasks (#640)
P2S uses hardened steel rods, not carbon fiber. Move P2S from carbon rod classification to new steel_rod category with its own "Lubricate Steel Rods" / "Clean Steel Rods" maintenance tasks.
This commit is contained in:
@@ -34,7 +34,7 @@ router = APIRouter(prefix="/maintenance", tags=["maintenance"])
|
||||
|
||||
# Default maintenance types
|
||||
DEFAULT_MAINTENANCE_TYPES = [
|
||||
# Carbon rod models only (X1/P1/P2S)
|
||||
# Carbon rod models only (X1/P1)
|
||||
{
|
||||
"name": "Lubricate Carbon Rods",
|
||||
"description": "Apply lubricant to carbon rods for smooth motion",
|
||||
@@ -47,6 +47,19 @@ DEFAULT_MAINTENANCE_TYPES = [
|
||||
"default_interval_hours": 100.0,
|
||||
"icon": "Sparkles",
|
||||
},
|
||||
# Steel rod models only (P2S)
|
||||
{
|
||||
"name": "Lubricate Steel Rods",
|
||||
"description": "Apply lubricant to steel rods for smooth motion",
|
||||
"default_interval_hours": 50.0,
|
||||
"icon": "Droplet",
|
||||
},
|
||||
{
|
||||
"name": "Clean Steel Rods",
|
||||
"description": "Wipe steel rods with a dry cloth",
|
||||
"default_interval_hours": 100.0,
|
||||
"icon": "Sparkles",
|
||||
},
|
||||
# Linear rail models only (A1/H2)
|
||||
{
|
||||
"name": "Lubricate Linear Rails",
|
||||
@@ -88,11 +101,13 @@ DEFAULT_MAINTENANCE_TYPES = [
|
||||
]
|
||||
|
||||
# System types that only apply to printers with a specific rod/rail type.
|
||||
# "carbon" = X1/P1/P2S series (carbon rods), "linear_rail" = A1/H2 series.
|
||||
# Types not listed here apply to all printers.
|
||||
# "carbon" = X1/P1 series (carbon rods), "steel_rod" = P2S (steel rods),
|
||||
# "linear_rail" = A1/H2 series. Types not listed here apply to all printers.
|
||||
_ROD_TYPE_REQUIREMENTS: dict[str, str] = {
|
||||
"Lubricate Carbon Rods": "carbon",
|
||||
"Clean Carbon Rods": "carbon",
|
||||
"Lubricate Steel Rods": "steel_rod",
|
||||
"Clean Steel Rods": "steel_rod",
|
||||
"Lubricate Linear Rails": "linear_rail",
|
||||
"Clean Linear Rails": "linear_rail",
|
||||
}
|
||||
|
||||
@@ -50,7 +50,8 @@ PRINTER_MODEL_ID_MAP = {
|
||||
|
||||
|
||||
# Rod/rail type classification for maintenance tasks.
|
||||
# Carbon rods: X1, P1, P2S series (CoreXY with carbon fiber rods)
|
||||
# Carbon rods: X1, P1 series (CoreXY with carbon fiber rods)
|
||||
# Steel rods: P2S series (hardened steel linear shafts)
|
||||
# Linear rails: A1, H2 series (linear rail motion system)
|
||||
# Values must be uppercase with spaces stripped for normalized comparison.
|
||||
CARBON_ROD_MODELS = frozenset(
|
||||
@@ -61,11 +62,18 @@ CARBON_ROD_MODELS = frozenset(
|
||||
"X1E",
|
||||
"P1P",
|
||||
"P1S",
|
||||
"P2S",
|
||||
# Internal codes
|
||||
"C11", # X1C
|
||||
"C12", # X1
|
||||
"C13", # X1E
|
||||
]
|
||||
)
|
||||
|
||||
STEEL_ROD_MODELS = frozenset(
|
||||
[
|
||||
# Display names (uppercase, no spaces)
|
||||
"P2S",
|
||||
# Internal codes
|
||||
"N7", # P2S
|
||||
]
|
||||
)
|
||||
@@ -99,7 +107,8 @@ def get_rod_type(model: str | None) -> str | None:
|
||||
"""Return the rod/rail type for a printer model.
|
||||
|
||||
Returns:
|
||||
"carbon" for X1/P1/P2S series (carbon fiber rods),
|
||||
"carbon" for X1/P1 series (carbon fiber rods),
|
||||
"steel_rod" for P2S series (hardened steel rods),
|
||||
"linear_rail" for A1/H2 series (linear rails),
|
||||
None for unknown models.
|
||||
"""
|
||||
@@ -108,6 +117,8 @@ def get_rod_type(model: str | None) -> str | None:
|
||||
normalized = model.strip().upper().replace(" ", "").replace("-", "")
|
||||
if normalized in CARBON_ROD_MODELS:
|
||||
return "carbon"
|
||||
if normalized in STEEL_ROD_MODELS:
|
||||
return "steel_rod"
|
||||
if normalized in LINEAR_RAIL_MODELS:
|
||||
return "linear_rail"
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user