Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tag/opentag3d/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __to_filament(self, scan_result: ScanResult, data: dict) -> GenericFilament:
weight_grams=data["weight"],
hotend_min_temp_c=hotend_min_temp_c,
hotend_max_temp_c=hotend_max_temp_c,
bed_temp_c=data["bed_temp"],
bed_temp_c=data["bed_temp"] or data["min_bed_temp"] or data["max_bed_temp"],
drying_temp_c=data["max_dry_temp"],
drying_time_hours=data["dry_time"],
# Reuse the other processors' unknown-date sentinel for absent dates.
Expand Down
13 changes: 13 additions & 0 deletions test/test_opentag3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ def test_short_payload_and_target_fallback(processor, scan, payload):
assert decode_payload(payload[:145], SCHEMAS[2])["mfg_time"] is None


def test_bed_temp_falls_back_to_range(processor, scan, payload):
# The spec stores a bed target alongside a min/max pair. A tag that fills in
# only the range should still yield a bed temperature, mirroring the existing
# print-temperature fallback rather than reporting 0.
payload[148] = 0
payload[149:151] = bytes([11, 13])
assert processor.process_tag(scan, tag(record(payload))).bed_temp_c == 55
payload[149] = 0
assert processor.process_tag(scan, tag(record(payload))).bed_temp_c == 65
payload[150] = 0
assert processor.process_tag(scan, tag(record(payload))).bed_temp_c == 0


def test_primary_transparent_black_and_cf_modifier(processor, scan, payload):
payload[60:76] = bytes(16)
payload[7:12] = b"CF\x00\x00\x00"
Expand Down