Skip to content

Commit 9bd3f6f

Browse files
committed
Update for RRF3.6.0-rc1
1 parent 28010a8 commit 9bd3f6f

18 files changed

+348
-84
lines changed

examples/send_simple_code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def send_simple_code():
1414
command_connection.connect()
1515

1616
try:
17+
# res = command_connection.set_plugin_data("ExecOnMcode", "test", "1")
1718
# Perform a simple command and wait for its output
1819
res = command_connection.perform_simple_code("M115")
1920
print("M115 is telling us:", res)

examples/subscribe_object_model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ def subscribe():
2222
# subset of the object model will be updated
2323
for _ in range(0, 3):
2424
update = subscribe_connection.get_object_model_patch()
25+
object_model.update_from_json(update)
2526
print(update)
27+
except Exception as e:
28+
print(f"An error occurred: {e}")
2629
finally:
2730
subscribe_connection.close()
2831

src/dsf/object_model/job/gcode_fileinfo.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class GCodeFileInfo(ModelObject):
1111

1212
def __init__(self):
1313
super().__init__()
14+
self._custom_info = {}
1415
self._filament = []
1516
self._file_name = ""
1617
self._generated_by = ""
@@ -23,6 +24,11 @@ def __init__(self):
2324
self._size = 0
2425
self._thumbnails = ModelCollection(ThumbnailInfo)
2526

27+
@property
28+
def custom_info(self) -> dict:
29+
"""Custom information extracted from the G-code file"""
30+
return self._custom_info
31+
2632
@property
2733
def filament(self) -> List[float]:
2834
"""Filament consumption per extruder drive (in mm)"""

src/dsf/object_model/model_collection.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
1+
from typing import Generic, TypeVar, Type, List, Dict, Any, Union, Optional
12
from .utils import is_model_object
23

4+
T = TypeVar('T')
35

4-
class ModelCollection(list):
6+
7+
class ModelCollection(Generic[T], list):
58
"""
69
Class for storing model object items in a list
710
Useful for updating model object items from JSON data (patches)
811
"""
912

10-
def __init__(self, item_constructor, value=None):
13+
def __init__(self, item_constructor: Type[T], value: Optional[List[T]] = None) -> None:
1114
"""
12-
1315
:param item_constructor: Item constructor type that items must derive from
1416
:param value: Value used to initialize the list from
1517
"""
1618
super().__init__()
17-
self._item_constructor = item_constructor
19+
self._item_constructor: Type[T] = item_constructor
1820

1921
if value is not None:
2022
self[:] = value
2123

22-
def update_from_json(self, json_element):
24+
def update_from_json(self, json_element: List[Any]) -> 'ModelCollection[T]':
2325
"""
2426
Update this instance from the given data
2527
:param json_element: JSON data to upgrade this instance from

src/dsf/object_model/move/axis.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def __init__(self):
8686
self._percent_current = 100
8787
# Percentage applied to the motor current during standstill (0..100 or None if not supported)
8888
self._percent_stst_current = None
89+
# Motor jerk during the current print only (in mm/s)
90+
self._printing_jerk = None
8991
# Reduced accelerations used by Z probing and stall homing moves (in mm/s^2)
9092
self._reduced_acceleration = 0
9193
# Maximum speed (in mm/min)
@@ -242,6 +244,15 @@ def percent_stst_current(self) -> Union[int, None]:
242244
def percent_stst_current(self, value):
243245
self._percent_stst_current = int(value) if value is not None else None
244246

247+
@property
248+
def printing_jerk(self) -> Union[float, None]:
249+
"""Motor jerk during the current print only (in mm/s)"""
250+
return self._printing_jerk
251+
252+
@printing_jerk.setter
253+
def printing_jerk(self, value):
254+
self._printing_jerk = float(value) if value is not None else None
255+
245256
@property
246257
def reduced_acceleration(self) -> float:
247258
"""Reduced accelerations used by Z probing and stall homing moves (in mm/s^2)"""

src/dsf/object_model/move/extruder.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def __init__(self):
4141
self._position = 0
4242
# Pressure advance
4343
self._pressure_advance = 0
44+
# Motor jerk during the current print only (in mm/s)
45+
self._printing_jerk = None
4446
# Raw extruder position as commanded by the slicer without extrusion factor applied (in mm)
4547
self._raw_position = 0
4648
# Maximum speed (in mm/s)
@@ -148,6 +150,15 @@ def pressure_advance(self) -> float:
148150
def pressure_advance(self, value):
149151
self._pressure_advance = float(value)
150152

153+
@property
154+
def printing_jerk(self) -> Union[float, None]:
155+
"""Motor jerk during the current print only (in mm/s)"""
156+
return self._printing_jerk
157+
158+
@printing_jerk.setter
159+
def printing_jerk(self, value):
160+
self._printing_jerk = float(value) if value is not None else None
161+
151162
@property
152163
def raw_position(self) -> float:
153164
"""Raw extruder position as commanded by the slicer without extrusion factor applied (in mm)"""

src/dsf/object_model/move/input_shaping.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,10 @@ def __init__(self):
4040
self._amplitudes = []
4141
# Damping factor
4242
self._damping = 0.1
43-
# Input shaper durations (in s)
44-
self._durations = []
43+
# Input shaper delays (in s)
44+
self._delays = []
4545
# Frequency (in Hz)
4646
self._frequency = 40
47-
# Minimum fraction of the original acceleration or feed rate to which the acceleration or
48-
# feed rate may be reduced in order to apply input shaping
49-
self._reduction_limit = 0.25
5047
# Configured input shaping type
5148
self._type = InputShapingType.none
5249

@@ -65,9 +62,9 @@ def damping(self, value):
6562
self._damping = float(value)
6663

6764
@property
68-
def durations(self) -> List[float]:
69-
"""Input shaper durations (in s)"""
70-
return self._durations
65+
def delays(self) -> List[float]:
66+
"""Input shaper delays (in s)"""
67+
return self._delays
7168

7269
@property
7370
def frequency(self) -> float:
@@ -78,16 +75,6 @@ def frequency(self) -> float:
7875
def frequency(self, value):
7976
self._frequency = float(value)
8077

81-
@property
82-
def reduction_limit(self) -> float:
83-
"""Minimum fraction of the original acceleration or feed rate to which the acceleration or
84-
feed rate may be reduced in order to apply input shaping"""
85-
return self._reduction_limit
86-
87-
@reduction_limit.setter
88-
def reduction_limit(self, value):
89-
self._reduction_limit = float(value)
90-
9178
@property
9279
def type(self) -> InputShapingType:
9380
"""Configured input shaping type"""

src/dsf/object_model/network/network_interface.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .network_protocol import NetworkProtocol
55
from .network_state import NetworkState
66
from ..model_object import ModelObject
7+
from ...utils import deprecated
78

89

910
class NetworkInterface(ModelObject):
@@ -27,6 +28,8 @@ def __init__(self):
2728
self._mac = ""
2829
# Number of reconnect attempts or null if unknown
2930
self._num_reconnects = None
31+
# Received signal strength indicator of the WiFi adapter (only WiFi, in dBm, or null if unknown)
32+
self._rssi = None
3033
# Signal of the Wi-Fi adapter (only Wi-Fi, in dBm, or null if unknown)
3134
self._signal = None
3235
# Speed of the network interface (in MBit, null if unknown, 0 if not connected)
@@ -112,10 +115,20 @@ def num_reconnects(self, value):
112115
self._num_reconnects = int(value) if value is not None else None
113116

114117
@property
118+
def rssi(self) -> Union[int, None]:
119+
"""Received signal strength indicator of the WiFi adapter (only WiFi, in dBm, or None if unknown)"""
120+
return self._rssi
121+
122+
@rssi.setter
123+
def rssi(self, value):
124+
self._rssi = int(value) if value is not None else None
125+
126+
@property
127+
@deprecated(f"Use '{__name__}.rssi' instead.")
115128
def signal(self) -> Union[int, None]:
116129
"""Signal of the Wi-Fi adapter (only Wi-Fi, in dBm, or null if unknown)"""
117130
return self._signal
118-
131+
119132
@signal.setter
120133
def signal(self, value):
121134
self._signal = int(value) if value is not None else None

src/dsf/object_model/sensors/analog_sensor.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ def __init__(self):
1212
super(AnalogSensor, self).__init__()
1313
self._beta = None
1414
self._c = None
15+
self._high_reading = None
1516
self._last_reading = None
17+
self._low_reading = None
1618
self._name = None
1719
self._offset_adj = 0.0
1820
self._port = None
@@ -40,6 +42,15 @@ def c(self) -> Union[float, None]:
4042
def c(self, value):
4143
self._c = float(value) if value is not None else None
4244

45+
@property
46+
def high_reading(self) -> Union[float, None]:
47+
"""High sensor reading (only linear analog sensors, otherwise null)"""
48+
return self._high_reading
49+
50+
@high_reading.setter
51+
def high_reading(self, value):
52+
self._high_reading = float(value) if value is not None else None
53+
4354
@property
4455
def last_reading(self) -> Union[float, None]:
4556
"""Last sensor reading (in C) or null if invalid"""
@@ -48,6 +59,15 @@ def last_reading(self) -> Union[float, None]:
4859
@last_reading.setter
4960
def last_reading(self, value):
5061
self._last_reading = float(value) if value is not None else None
62+
63+
@property
64+
def low_reading(self) -> Union[float, None]:
65+
"""Low sensor reading (only linear analog sensors, otherwise null)"""
66+
return self._low_reading
67+
68+
@low_reading.setter
69+
def low_reading(self, value):
70+
self._low_reading = float(value) if value is not None else None
5171

5272
@property
5373
def name(self) -> Union[str, None]:

src/dsf/object_model/sensors/filament_monitors/Duet3DFilamentMonitor.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ def __init__(self, type_: FilamentMonitorType = FilamentMonitorType.Unknown):
1717
self._max_percentage = None
1818
# Minimum ratio of measured vs. commanded movement
1919
self._min_percentage = None
20+
# Position of the sensor (in mm)
21+
self._position = 0
2022
# Total extrusion commanded (in mm)
2123
self._total_extrusion = 0
2224

@@ -55,6 +57,15 @@ def min_percentage(self) -> Union[int, None]:
5557
@min_percentage.setter
5658
def min_percentage(self, value):
5759
self._min_percentage = None if value is None else int(value)
60+
61+
@property
62+
def position(self) -> float:
63+
"""Position of the sensor (in mm)"""
64+
return self._position
65+
66+
@position.setter
67+
def position(self, value):
68+
self._position = float(value)
5869

5970
@property
6071
def total_extrusion(self) -> float:

0 commit comments

Comments
 (0)