flashforge-python-api 1.6.0__py3-none-any.whl → 3.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flashforge/__init__.py +137 -56
- flashforge/_removed.py +65 -0
- flashforge/api/__init__.py +12 -18
- flashforge/api/constants/__init__.py +11 -11
- flashforge/api/constants/commands.py +18 -15
- flashforge/api/constants/endpoints.py +11 -11
- flashforge/api/misc/__init__.py +8 -8
- flashforge/api/network/__init__.py +11 -11
- flashforge/api/network/utils.py +71 -71
- flashforge/backends/__init__.py +80 -0
- flashforge/backends/connect.py +275 -0
- flashforge/backends/creator5_backend.py +191 -0
- flashforge/backends/dual_api_backend.py +170 -0
- flashforge/backends/dual_api_models.py +145 -0
- flashforge/backends/http_core.py +431 -0
- flashforge/backends/http_printer_backend.py +254 -0
- flashforge/backends/legacy_backend.py +436 -0
- flashforge/backends/printer_backend.py +217 -0
- flashforge/backends/types.py +125 -0
- flashforge/capabilities/__init__.py +98 -0
- flashforge/capabilities/models.py +67 -0
- flashforge/capabilities/palettes/__init__.py +28 -0
- flashforge/capabilities/palettes/ad5x_palette.py +70 -0
- flashforge/capabilities/palettes/creator5_palette.py +78 -0
- flashforge/capabilities/palettes/palette.py +54 -0
- flashforge/{api/controls/creator5_palette.py → capabilities/palettes/palette_snap.py} +226 -258
- flashforge/capabilities/printer_capabilities.py +145 -0
- flashforge/capabilities/registry.py +125 -0
- flashforge/capabilities/resolve_model.py +61 -0
- flashforge/discovery/__init__.py +39 -39
- flashforge/discovery/discovery.py +150 -77
- flashforge/exceptions.py +90 -51
- flashforge/models/__init__.py +52 -55
- flashforge/models/machine_info.py +540 -543
- flashforge/{api/controls/info.py → models/machine_info_parser.py} +35 -242
- flashforge/models/responses.py +119 -254
- flashforge/status/__init__.py +43 -0
- flashforge/status/printer_snapshot.py +396 -0
- flashforge/tcp/__init__.py +55 -54
- flashforge/tcp/a3_client.py +427 -427
- flashforge/tcp/a4_client.py +304 -304
- flashforge/tcp/ff_client.py +609 -590
- flashforge/tcp/gcode/__init__.py +15 -13
- flashforge/tcp/gcode/a3_gcode_controller.py +109 -109
- flashforge/tcp/gcode/gcode_controller.py +292 -308
- flashforge/tcp/gcode/gcodes.py +81 -99
- flashforge/tcp/gcode/legacy_gcode_controller.py +56 -0
- flashforge/tcp/parsers/__init__.py +27 -27
- flashforge/tcp/parsers/endstop_status.py +248 -248
- flashforge/tcp/parsers/location_info.py +83 -83
- flashforge/tcp/parsers/print_status.py +180 -180
- flashforge/tcp/parsers/printer_info.py +146 -146
- flashforge/tcp/parsers/temp_info.py +218 -218
- flashforge/tcp/parsers/thumbnail_info.py +274 -274
- flashforge/tcp/tcp_client.py +52 -12
- flashforge/threemf/__init__.py +40 -40
- flashforge/threemf/parser.py +560 -560
- flashforge/threemf/warnings.py +58 -58
- {flashforge_python_api-1.6.0.dist-info → flashforge_python_api-3.1.0.dist-info}/METADATA +46 -47
- flashforge_python_api-3.1.0.dist-info/RECORD +69 -0
- {flashforge_python_api-1.6.0.dist-info → flashforge_python_api-3.1.0.dist-info}/WHEEL +1 -1
- {flashforge_python_api-1.6.0.dist-info → flashforge_python_api-3.1.0.dist-info}/licenses/LICENSE +21 -21
- flashforge/api/controls/__init__.py +0 -17
- flashforge/api/controls/control.py +0 -413
- flashforge/api/controls/files.py +0 -210
- flashforge/api/controls/job_control.py +0 -896
- flashforge/api/controls/temp_control.py +0 -309
- flashforge/client.py +0 -609
- flashforge_python_api-1.6.0.dist-info/RECORD +0 -52
- {flashforge_python_api-1.6.0.dist-info → flashforge_python_api-3.1.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The status model: one normalized snapshot of a printer, the same shape for every family.
|
|
3
|
+
|
|
4
|
+
Backends build it from ``/detail`` (modern printers) or from TCP replies (legacy
|
|
5
|
+
printers). Clients render it and keep only display formatting.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import math
|
|
11
|
+
from dataclasses import dataclass, field
|
|
12
|
+
from datetime import datetime
|
|
13
|
+
from typing import Literal
|
|
14
|
+
|
|
15
|
+
from ..capabilities.printer_capabilities import PrinterCapabilities
|
|
16
|
+
from ..models.machine_info import FFMachineInfo, MachineState, Temperature
|
|
17
|
+
from ..tcp.parsers.endstop_status import MachineStatus as LegacyMachineStatus
|
|
18
|
+
from ..tcp.parsers.endstop_status import MoveMode as LegacyMoveMode
|
|
19
|
+
|
|
20
|
+
#: Run state for a UI. Maps 1:1 from :class:`MachineState`.
|
|
21
|
+
PrinterRunState = Literal[
|
|
22
|
+
"Ready",
|
|
23
|
+
"Printing",
|
|
24
|
+
"Paused",
|
|
25
|
+
"Completed",
|
|
26
|
+
"Error",
|
|
27
|
+
"Busy",
|
|
28
|
+
"Calibrating",
|
|
29
|
+
"Heating",
|
|
30
|
+
"Pausing",
|
|
31
|
+
"Cancelled",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
_RUN_STATE: dict[MachineState, PrinterRunState] = {
|
|
35
|
+
MachineState.READY: "Ready",
|
|
36
|
+
MachineState.BUSY: "Busy",
|
|
37
|
+
MachineState.CALIBRATING: "Calibrating",
|
|
38
|
+
MachineState.ERROR: "Error",
|
|
39
|
+
MachineState.HEATING: "Heating",
|
|
40
|
+
MachineState.PRINTING: "Printing",
|
|
41
|
+
MachineState.PAUSING: "Pausing",
|
|
42
|
+
MachineState.PAUSED: "Paused",
|
|
43
|
+
MachineState.CANCELLED: "Cancelled",
|
|
44
|
+
MachineState.COMPLETED: "Completed",
|
|
45
|
+
MachineState.UNKNOWN: "Busy",
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_run_state(state: MachineState) -> PrinterRunState:
|
|
50
|
+
"""Maps a :class:`MachineState` to the UI run state. ``UNKNOWN`` reads as ``Busy``."""
|
|
51
|
+
return _RUN_STATE.get(state, "Busy")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True)
|
|
55
|
+
class TemperatureReading:
|
|
56
|
+
"""One heater."""
|
|
57
|
+
|
|
58
|
+
current: float
|
|
59
|
+
target: float
|
|
60
|
+
#: Target is set and the heater is more than 2 °C away from it.
|
|
61
|
+
is_heating: bool
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def reading(current: float | None, target: float | None) -> TemperatureReading:
|
|
65
|
+
"""Builds a heater reading. Non-finite values read as 0."""
|
|
66
|
+
c = current if current is not None and math.isfinite(current) else 0.0
|
|
67
|
+
t = target if target is not None and math.isfinite(target) else 0.0
|
|
68
|
+
return TemperatureReading(c, t, t > 0 and abs(c - t) > 2)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _from_temp(temp: Temperature | None) -> TemperatureReading:
|
|
72
|
+
return reading(temp.current if temp else 0.0, temp.set if temp else 0.0)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@dataclass(frozen=True)
|
|
76
|
+
class JobProgress:
|
|
77
|
+
"""Progress of the current job."""
|
|
78
|
+
|
|
79
|
+
#: 0-100.
|
|
80
|
+
percentage: float
|
|
81
|
+
current_layer: int | None
|
|
82
|
+
total_layers: int | None
|
|
83
|
+
#: Remaining time in minutes, or None when not reported.
|
|
84
|
+
time_remaining_minutes: int | None
|
|
85
|
+
#: Elapsed print time in seconds.
|
|
86
|
+
elapsed_seconds: int
|
|
87
|
+
#: Estimated filament used so far, grams.
|
|
88
|
+
weight_used: float
|
|
89
|
+
#: Estimated filament used so far, meters.
|
|
90
|
+
length_used: float
|
|
91
|
+
#: Formatted remaining time ("HH:MM"), empty when unknown.
|
|
92
|
+
formatted_eta: str
|
|
93
|
+
#: Wall-clock completion time. None while the print is not advancing.
|
|
94
|
+
completion_time: datetime | None
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@dataclass(frozen=True)
|
|
98
|
+
class JobSnapshot:
|
|
99
|
+
"""The current job. Kept through the Completed state so a client can notify."""
|
|
100
|
+
|
|
101
|
+
file_name: str
|
|
102
|
+
#: True while the job is printing or paused.
|
|
103
|
+
is_active: bool
|
|
104
|
+
progress: JobProgress
|
|
105
|
+
#: Thumbnail URL from the printer, empty when there is none.
|
|
106
|
+
thumbnail_url: str
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass(frozen=True)
|
|
110
|
+
class MaterialSlotSnapshot:
|
|
111
|
+
"""One material-station slot."""
|
|
112
|
+
|
|
113
|
+
#: The printer's native slot ID, 1-based.
|
|
114
|
+
slot_id: int
|
|
115
|
+
is_empty: bool
|
|
116
|
+
material_type: str | None
|
|
117
|
+
#: "#RRGGBB" or None.
|
|
118
|
+
material_color: str | None
|
|
119
|
+
is_active: bool
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@dataclass(frozen=True)
|
|
123
|
+
class MaterialStationSnapshot:
|
|
124
|
+
"""Material station (AD5X, Creator 5 series)."""
|
|
125
|
+
|
|
126
|
+
connected: bool
|
|
127
|
+
slots: list[MaterialSlotSnapshot]
|
|
128
|
+
#: Native 1-based slot ID of the active slot, or None.
|
|
129
|
+
active_slot: int | None
|
|
130
|
+
#: Load/unload state from the printer.
|
|
131
|
+
state_action: int
|
|
132
|
+
state_step: int
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass(frozen=True)
|
|
136
|
+
class FiltrationSnapshot:
|
|
137
|
+
"""Air filtration (Adventurer 5M Pro)."""
|
|
138
|
+
|
|
139
|
+
#: The printer has filtration the API can control. From the capabilities.
|
|
140
|
+
available: bool
|
|
141
|
+
mode: Literal["external", "internal", "none"]
|
|
142
|
+
#: TVOC level as the printer reports it. Always 0 when the printer has no air-quality sensor
|
|
143
|
+
#: (``capabilities.air_quality_sensor``).
|
|
144
|
+
tvoc_level: float
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@dataclass(frozen=True)
|
|
148
|
+
class Temperatures:
|
|
149
|
+
"""Bed, primary extruder and chamber."""
|
|
150
|
+
|
|
151
|
+
bed: TemperatureReading
|
|
152
|
+
#: Primary extruder (tool 0).
|
|
153
|
+
extruder: TemperatureReading
|
|
154
|
+
#: Chamber, or None when the printer has no chamber heater.
|
|
155
|
+
chamber: TemperatureReading | None
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@dataclass(frozen=True)
|
|
159
|
+
class Fans:
|
|
160
|
+
"""Fan speeds in percent."""
|
|
161
|
+
|
|
162
|
+
cooling_fan: int
|
|
163
|
+
chamber_fan: int
|
|
164
|
+
#: AD5X left cooling fan, None when not reported.
|
|
165
|
+
left_cooling_fan: int | None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@dataclass(frozen=True)
|
|
169
|
+
class PrintSettings:
|
|
170
|
+
"""Print settings. None when unknown."""
|
|
171
|
+
|
|
172
|
+
nozzle_size: float | None
|
|
173
|
+
filament_type: str | None
|
|
174
|
+
speed_offset: int | None
|
|
175
|
+
z_axis_offset: float | None
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@dataclass(frozen=True)
|
|
179
|
+
class CumulativeStats:
|
|
180
|
+
"""Lifetime totals."""
|
|
181
|
+
|
|
182
|
+
total_print_time_minutes: int
|
|
183
|
+
total_filament_meters: float
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
@dataclass(frozen=True)
|
|
187
|
+
class PrinterSnapshot:
|
|
188
|
+
"""A normalized printer status."""
|
|
189
|
+
|
|
190
|
+
state: PrinterRunState
|
|
191
|
+
machine_state: MachineState
|
|
192
|
+
#: The raw status string from the printer, for logs.
|
|
193
|
+
raw_status: str
|
|
194
|
+
temperatures: Temperatures
|
|
195
|
+
#: One entry per tool. One entry on single-nozzle printers.
|
|
196
|
+
tool_temps: list[TemperatureReading]
|
|
197
|
+
fans: Fans
|
|
198
|
+
filtration: FiltrationSnapshot
|
|
199
|
+
settings: PrintSettings
|
|
200
|
+
job: JobSnapshot | None
|
|
201
|
+
material_station: MaterialStationSnapshot | None
|
|
202
|
+
#: Light state, None when unknown.
|
|
203
|
+
lights_on: bool | None
|
|
204
|
+
#: Door state, None when the printer has no real door sensor.
|
|
205
|
+
door_open: bool | None
|
|
206
|
+
error_code: str
|
|
207
|
+
cumulative: CumulativeStats | None
|
|
208
|
+
last_update: datetime = field(default_factory=datetime.now)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
_JOB_STATES = frozenset(
|
|
212
|
+
{
|
|
213
|
+
MachineState.PRINTING,
|
|
214
|
+
MachineState.PAUSED,
|
|
215
|
+
MachineState.PAUSING,
|
|
216
|
+
MachineState.COMPLETED,
|
|
217
|
+
MachineState.HEATING,
|
|
218
|
+
MachineState.CALIBRATING,
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
_ACTIVE_STATES = frozenset({MachineState.PRINTING, MachineState.PAUSED, MachineState.PAUSING})
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def _clamp_percent(value: float) -> float:
|
|
225
|
+
if not math.isfinite(value) or value < 0:
|
|
226
|
+
return 0.0
|
|
227
|
+
return min(value, 100.0)
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def snapshot_from_machine_info(info: FFMachineInfo, caps: PrinterCapabilities) -> PrinterSnapshot:
|
|
231
|
+
"""
|
|
232
|
+
Builds the snapshot from ``/detail`` data. Chamber, filtration and door come from the
|
|
233
|
+
capabilities, not from the payload.
|
|
234
|
+
"""
|
|
235
|
+
tools = [_from_temp(t) for t in info.tool_temps] or [_from_temp(info.extruder)]
|
|
236
|
+
job: JobSnapshot | None = None
|
|
237
|
+
if info.print_file_name and info.machine_state in _JOB_STATES:
|
|
238
|
+
estimated = int(info.estimated_time or 0)
|
|
239
|
+
job = JobSnapshot(
|
|
240
|
+
file_name=info.print_file_name,
|
|
241
|
+
is_active=info.machine_state in _ACTIVE_STATES,
|
|
242
|
+
thumbnail_url=info.print_file_thumb_url,
|
|
243
|
+
progress=JobProgress(
|
|
244
|
+
percentage=_clamp_percent(info.print_progress * 100),
|
|
245
|
+
current_layer=info.current_print_layer or None,
|
|
246
|
+
total_layers=info.total_print_layers or None,
|
|
247
|
+
time_remaining_minutes=round(estimated / 60) if estimated > 0 else None,
|
|
248
|
+
elapsed_seconds=info.print_duration,
|
|
249
|
+
weight_used=info.est_weight,
|
|
250
|
+
length_used=info.est_length,
|
|
251
|
+
formatted_eta=info.print_eta if estimated > 0 else "",
|
|
252
|
+
completion_time=info.completion_time,
|
|
253
|
+
),
|
|
254
|
+
)
|
|
255
|
+
|
|
256
|
+
station: MaterialStationSnapshot | None = None
|
|
257
|
+
if caps.material_station.available:
|
|
258
|
+
ms = info.matl_station_info
|
|
259
|
+
active = ms.current_slot if ms and ms.current_slot > 0 else None
|
|
260
|
+
station = MaterialStationSnapshot(
|
|
261
|
+
connected=ms is not None,
|
|
262
|
+
active_slot=active,
|
|
263
|
+
state_action=ms.state_action if ms else 0,
|
|
264
|
+
state_step=ms.state_step if ms else 0,
|
|
265
|
+
slots=[
|
|
266
|
+
MaterialSlotSnapshot(
|
|
267
|
+
slot_id=slot.slot_id,
|
|
268
|
+
is_empty=not slot.has_filament,
|
|
269
|
+
material_type=(
|
|
270
|
+
slot.material_name if slot.has_filament and slot.material_name else None
|
|
271
|
+
),
|
|
272
|
+
material_color=(
|
|
273
|
+
slot.material_color if slot.has_filament and slot.material_color else None
|
|
274
|
+
),
|
|
275
|
+
is_active=slot.slot_id == active,
|
|
276
|
+
)
|
|
277
|
+
for slot in (ms.slot_infos if ms else [])
|
|
278
|
+
],
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
mode: Literal["external", "internal", "none"] = "none"
|
|
282
|
+
if caps.filtration.available:
|
|
283
|
+
if info.external_fan_on:
|
|
284
|
+
mode = "external"
|
|
285
|
+
elif info.internal_fan_on:
|
|
286
|
+
mode = "internal"
|
|
287
|
+
|
|
288
|
+
try:
|
|
289
|
+
nozzle_size: float | None = float(info.nozzle_size.lower().replace("mm", "").strip())
|
|
290
|
+
except ValueError:
|
|
291
|
+
nozzle_size = None
|
|
292
|
+
|
|
293
|
+
return PrinterSnapshot(
|
|
294
|
+
state=to_run_state(info.machine_state),
|
|
295
|
+
machine_state=info.machine_state,
|
|
296
|
+
raw_status=info.status,
|
|
297
|
+
temperatures=Temperatures(
|
|
298
|
+
bed=_from_temp(info.print_bed),
|
|
299
|
+
extruder=tools[0],
|
|
300
|
+
chamber=_from_temp(info.chamber) if caps.chamber.available else None,
|
|
301
|
+
),
|
|
302
|
+
tool_temps=tools,
|
|
303
|
+
fans=Fans(info.cooling_fan_speed, info.chamber_fan_speed, info.cooling_fan_left_speed),
|
|
304
|
+
filtration=FiltrationSnapshot(
|
|
305
|
+
caps.filtration.available, mode, info.tvoc if caps.air_quality_sensor else 0.0
|
|
306
|
+
),
|
|
307
|
+
settings=PrintSettings(
|
|
308
|
+
nozzle_size=nozzle_size,
|
|
309
|
+
filament_type=info.filament_type or None,
|
|
310
|
+
speed_offset=info.print_speed_adjust,
|
|
311
|
+
z_axis_offset=info.z_axis_compensation,
|
|
312
|
+
),
|
|
313
|
+
job=job,
|
|
314
|
+
material_station=station,
|
|
315
|
+
lights_on=info.lights_on,
|
|
316
|
+
door_open=info.door_open if caps.door_sensor else None,
|
|
317
|
+
error_code=info.error_code,
|
|
318
|
+
cumulative=CumulativeStats(info.cumulative_print_time, info.cumulative_filament),
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
@dataclass(frozen=True)
|
|
323
|
+
class LegacyStatusInput:
|
|
324
|
+
"""Raw values a legacy backend reads over TCP."""
|
|
325
|
+
|
|
326
|
+
#: Machine status from M119. None when M119 failed.
|
|
327
|
+
machine_status: LegacyMachineStatus | None
|
|
328
|
+
move_mode: LegacyMoveMode | None
|
|
329
|
+
bed: tuple[float, float] | None
|
|
330
|
+
extruder: tuple[float, float] | None
|
|
331
|
+
#: Current file from M119, empty when none.
|
|
332
|
+
current_file: str
|
|
333
|
+
#: Percent 0-100 from M27, None when unknown.
|
|
334
|
+
percent: float | None
|
|
335
|
+
current_layer: int | None
|
|
336
|
+
total_layers: int | None
|
|
337
|
+
#: M119 LED state, None when not reported.
|
|
338
|
+
led_on: bool | None
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def legacy_machine_state(
|
|
342
|
+
machine_status: LegacyMachineStatus | None, move_mode: LegacyMoveMode | None
|
|
343
|
+
) -> MachineState:
|
|
344
|
+
"""Maps legacy M119 states to a :class:`MachineState`."""
|
|
345
|
+
if machine_status is None:
|
|
346
|
+
return MachineState.UNKNOWN
|
|
347
|
+
if machine_status == LegacyMachineStatus.PAUSED or move_mode == LegacyMoveMode.PAUSED:
|
|
348
|
+
return MachineState.PAUSED
|
|
349
|
+
return {
|
|
350
|
+
LegacyMachineStatus.BUILDING_FROM_SD: MachineState.PRINTING,
|
|
351
|
+
LegacyMachineStatus.BUILDING_COMPLETED: MachineState.COMPLETED,
|
|
352
|
+
LegacyMachineStatus.READY: MachineState.READY,
|
|
353
|
+
LegacyMachineStatus.BUSY: MachineState.BUSY,
|
|
354
|
+
}.get(machine_status, MachineState.UNKNOWN)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def snapshot_from_legacy(data: LegacyStatusInput) -> PrinterSnapshot:
|
|
358
|
+
"""Builds the snapshot from legacy TCP data."""
|
|
359
|
+
state = legacy_machine_state(data.machine_status, data.move_mode)
|
|
360
|
+
extruder = reading(*(data.extruder or (0.0, 0.0)))
|
|
361
|
+
job: JobSnapshot | None = None
|
|
362
|
+
if data.current_file and state in _JOB_STATES:
|
|
363
|
+
job = JobSnapshot(
|
|
364
|
+
file_name=data.current_file,
|
|
365
|
+
is_active=state in _ACTIVE_STATES,
|
|
366
|
+
thumbnail_url="",
|
|
367
|
+
progress=JobProgress(
|
|
368
|
+
percentage=_clamp_percent(data.percent or 0.0),
|
|
369
|
+
current_layer=data.current_layer if data.current_layer else None,
|
|
370
|
+
total_layers=data.total_layers if data.total_layers else None,
|
|
371
|
+
time_remaining_minutes=None,
|
|
372
|
+
elapsed_seconds=0,
|
|
373
|
+
weight_used=0.0,
|
|
374
|
+
length_used=0.0,
|
|
375
|
+
formatted_eta="",
|
|
376
|
+
completion_time=None,
|
|
377
|
+
),
|
|
378
|
+
)
|
|
379
|
+
return PrinterSnapshot(
|
|
380
|
+
state=to_run_state(state),
|
|
381
|
+
machine_state=state,
|
|
382
|
+
raw_status=data.machine_status.value if data.machine_status else "",
|
|
383
|
+
temperatures=Temperatures(
|
|
384
|
+
bed=reading(*(data.bed or (0.0, 0.0))), extruder=extruder, chamber=None
|
|
385
|
+
),
|
|
386
|
+
tool_temps=[extruder],
|
|
387
|
+
fans=Fans(0, 0, None),
|
|
388
|
+
filtration=FiltrationSnapshot(False, "none", 0.0),
|
|
389
|
+
settings=PrintSettings(None, None, None, None),
|
|
390
|
+
job=job,
|
|
391
|
+
material_station=None,
|
|
392
|
+
lights_on=data.led_on,
|
|
393
|
+
door_open=None,
|
|
394
|
+
error_code="",
|
|
395
|
+
cumulative=None,
|
|
396
|
+
)
|
flashforge/tcp/__init__.py
CHANGED
|
@@ -1,54 +1,55 @@
|
|
|
1
|
-
"""
|
|
2
|
-
TCP communication layer for FlashForge 3D printers.
|
|
3
|
-
|
|
4
|
-
This module provides low-level TCP socket communication and high-level G-code interfaces
|
|
5
|
-
for controlling FlashForge printers via their TCP API.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from .a3_client import A3BuildVolume, A3FileEntry, A3PrinterInfo, A3Thumbnail, FlashForgeA3Client
|
|
9
|
-
from .a4_client import A4BuildVolume, A4FileEntry, A4PrinterInfo, FlashForgeA4Client
|
|
10
|
-
from .ff_client import FlashForgeClient
|
|
11
|
-
from .gcode import A3GCodeController, GCodeController, GCodes
|
|
12
|
-
from .parsers import (
|
|
13
|
-
Endstop,
|
|
14
|
-
EndstopStatus,
|
|
15
|
-
LocationInfo,
|
|
16
|
-
MachineStatus,
|
|
17
|
-
MoveMode,
|
|
18
|
-
PrinterInfo,
|
|
19
|
-
PrintStatus,
|
|
20
|
-
Status,
|
|
21
|
-
TempData,
|
|
22
|
-
TempInfo,
|
|
23
|
-
ThumbnailInfo,
|
|
24
|
-
)
|
|
25
|
-
from .tcp_client import FlashForgeTcpClient, FlashForgeTcpClientOptions
|
|
26
|
-
|
|
27
|
-
__all__ = [
|
|
28
|
-
"FlashForgeTcpClient",
|
|
29
|
-
"FlashForgeTcpClientOptions",
|
|
30
|
-
"FlashForgeClient",
|
|
31
|
-
"FlashForgeA3Client",
|
|
32
|
-
"FlashForgeA4Client",
|
|
33
|
-
"GCodes",
|
|
34
|
-
"GCodeController",
|
|
35
|
-
"A3GCodeController",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
1
|
+
"""
|
|
2
|
+
TCP communication layer for FlashForge 3D printers.
|
|
3
|
+
|
|
4
|
+
This module provides low-level TCP socket communication and high-level G-code interfaces
|
|
5
|
+
for controlling FlashForge printers via their TCP API.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .a3_client import A3BuildVolume, A3FileEntry, A3PrinterInfo, A3Thumbnail, FlashForgeA3Client
|
|
9
|
+
from .a4_client import A4BuildVolume, A4FileEntry, A4PrinterInfo, FlashForgeA4Client
|
|
10
|
+
from .ff_client import FlashForgeClient
|
|
11
|
+
from .gcode import A3GCodeController, GCodeController, GCodes, LegacyGCodeController
|
|
12
|
+
from .parsers import (
|
|
13
|
+
Endstop,
|
|
14
|
+
EndstopStatus,
|
|
15
|
+
LocationInfo,
|
|
16
|
+
MachineStatus,
|
|
17
|
+
MoveMode,
|
|
18
|
+
PrinterInfo,
|
|
19
|
+
PrintStatus,
|
|
20
|
+
Status,
|
|
21
|
+
TempData,
|
|
22
|
+
TempInfo,
|
|
23
|
+
ThumbnailInfo,
|
|
24
|
+
)
|
|
25
|
+
from .tcp_client import FlashForgeTcpClient, FlashForgeTcpClientOptions
|
|
26
|
+
|
|
27
|
+
__all__ = [
|
|
28
|
+
"FlashForgeTcpClient",
|
|
29
|
+
"FlashForgeTcpClientOptions",
|
|
30
|
+
"FlashForgeClient",
|
|
31
|
+
"FlashForgeA3Client",
|
|
32
|
+
"FlashForgeA4Client",
|
|
33
|
+
"GCodes",
|
|
34
|
+
"GCodeController",
|
|
35
|
+
"A3GCodeController",
|
|
36
|
+
"LegacyGCodeController",
|
|
37
|
+
"A3BuildVolume",
|
|
38
|
+
"A3PrinterInfo",
|
|
39
|
+
"A3FileEntry",
|
|
40
|
+
"A3Thumbnail",
|
|
41
|
+
"A4BuildVolume",
|
|
42
|
+
"A4PrinterInfo",
|
|
43
|
+
"A4FileEntry",
|
|
44
|
+
"PrinterInfo",
|
|
45
|
+
"TempInfo",
|
|
46
|
+
"TempData",
|
|
47
|
+
"LocationInfo",
|
|
48
|
+
"EndstopStatus",
|
|
49
|
+
"MachineStatus",
|
|
50
|
+
"MoveMode",
|
|
51
|
+
"Status",
|
|
52
|
+
"Endstop",
|
|
53
|
+
"PrintStatus",
|
|
54
|
+
"ThumbnailInfo",
|
|
55
|
+
]
|