mirror of
https://github.com/RunLit/Bambu-Run.git
synced 2026-06-22 14:09:04 +01:00
Add H2C dual-nozzle and multi-AMS-type support
Schema (migration 0004): - PrinterMetrics: nozzle_temp_left, nozzle_target_temp_left, nozzle_diameter_left, nozzle_type_left (all nullable) - Filament: ams_unit_id (nullable int), ams_type (AMS/AMS 2 Pro/AMS HT) - AMS_INFO_TO_TYPE map and AMS_TYPE_CHOICES on models Parser (mqtt_client.py): - Decode bit-packed temps from device.extruder.info[] for left/right nozzle - Emit per-nozzle fields in get_snapshot(); legacy keys mirror right side - AMS unit type from info code per unit dict Collector (bambu_collector.py): - Write left-nozzle fields to PrinterMetrics - Set ams_unit_id + ams_type on Filament records - Fix: poll MQTTClient.connected before pushall (not BambuPrinter._connected) - Add 5s post-pushall wait in --once mode so response arrives before collect Views: API and dashboard include left-nozzle series; is_dual_nozzle flag Templates: dual-nozzle cards + chart; AMS-type badge + filter on filament list Charts: left nozzle temp chart with conditional render Forms: fix tray_id max=3 → max=15; add ams_unit_id, ams_type fields
This commit is contained in:
90
bambu_run/migrations/0004_h2c_dual_nozzle_and_ams_fields.py
Normal file
90
bambu_run/migrations/0004_h2c_dual_nozzle_and_ams_fields.py
Normal file
@@ -0,0 +1,90 @@
|
||||
# Generated by Django 5.2.8 on 2026-05-07 04:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("bambu_run", "0003_cloud_task"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="filament",
|
||||
name="ams_type",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
("AMS", "AMS"),
|
||||
("AMS 2 Pro", "AMS 2 Pro"),
|
||||
("AMS HT", "AMS HT"),
|
||||
],
|
||||
default="",
|
||||
help_text="Type of the AMS unit this spool is loaded in (AMS / AMS 2 Pro / AMS HT)",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="filament",
|
||||
name="ams_unit_id",
|
||||
field=models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
db_index=True,
|
||||
help_text="Which physical AMS unit this spool is loaded in (matches MQTT ams[i].id; 128 = AMS HT)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="printermetrics",
|
||||
name="nozzle_diameter_left",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
help_text="Left nozzle diameter (mm). H2C only.",
|
||||
max_digits=3,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="printermetrics",
|
||||
name="nozzle_target_temp_left",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
help_text="Left extruder target temperature (°C). H2C only.",
|
||||
max_digits=5,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="printermetrics",
|
||||
name="nozzle_temp_left",
|
||||
field=models.DecimalField(
|
||||
blank=True,
|
||||
decimal_places=2,
|
||||
help_text="Left extruder current temperature (°C). H2C only.",
|
||||
max_digits=5,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name="printermetrics",
|
||||
name="nozzle_type_left",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
help_text="Left nozzle type (e.g. HS01-0.4). H2C only.",
|
||||
max_length=50,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="filament",
|
||||
name="current_tray_id",
|
||||
field=models.IntegerField(
|
||||
blank=True,
|
||||
help_text="Tray slot index within its AMS unit (0-3 for AMS/AMS 2 Pro, 0 for AMS HT)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user