dsf-python 3.4.6.post4__py3-none-any.whl → 3.5.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.
- dsf/commands/code.py +1 -2
- dsf/commands/code_channel.py +6 -0
- dsf/commands/code_interception.py +2 -2
- dsf/commands/code_parameter.py +0 -1
- dsf/commands/generic.py +24 -4
- dsf/commands/http_endpoints.py +1 -1
- dsf/commands/user_sessions.py +1 -17
- dsf/connections/__init__.py +2 -2
- dsf/connections/base_command_connection.py +1 -2
- dsf/connections/base_connection.py +6 -13
- dsf/connections/exceptions.py +0 -7
- dsf/connections/init_messages/client_init_messages.py +10 -5
- dsf/connections/intercept_connection.py +15 -5
- dsf/http.py +1 -1
- dsf/object_model/__init__.py +3 -3
- dsf/object_model/boards/__init__.py +5 -5
- dsf/object_model/boards/accelerometer.py +13 -0
- dsf/object_model/boards/{closed_loop.py → board_closed_loop.py} +2 -2
- dsf/object_model/boards/boards.py +69 -28
- dsf/object_model/boards/direct_display/__init__.py +8 -0
- dsf/object_model/boards/direct_display/direct_display.py +23 -0
- dsf/object_model/boards/direct_display/direct_display_controller.py +14 -0
- dsf/object_model/boards/direct_display/direct_display_encoder.py +19 -0
- dsf/object_model/boards/direct_display/direct_display_screen.py +101 -0
- dsf/object_model/boards/direct_display/direct_display_screen_st7567.py +31 -0
- dsf/object_model/boards/driver.py +21 -7
- dsf/object_model/boards/driver_closed_loop.py +77 -0
- dsf/object_model/boards/inductive_sensor.py +9 -0
- dsf/object_model/directories/directories.py +7 -18
- dsf/object_model/fans/fan_thermostatic_control.py +17 -7
- dsf/object_model/fans/fans.py +19 -8
- dsf/object_model/heat/heat.py +6 -6
- dsf/object_model/heat/heater.py +35 -2
- dsf/object_model/heat/heater_model.py +1 -3
- dsf/object_model/heat/heater_model_pid.py +5 -5
- dsf/object_model/heat/heater_monitor.py +20 -9
- dsf/object_model/inputs/__init__.py +2 -1
- dsf/object_model/inputs/input_channel.py +64 -20
- dsf/object_model/inputs/inputs.py +22 -0
- dsf/object_model/job/build.py +5 -5
- dsf/object_model/job/build_object.py +10 -10
- dsf/object_model/job/gcode_fileinfo.py +19 -20
- dsf/object_model/job/job.py +54 -39
- dsf/object_model/job/layer.py +6 -6
- dsf/object_model/job/thumbnail_info.py +9 -10
- dsf/object_model/job/times_left.py +7 -7
- dsf/object_model/led_strips/__init__.py +1 -0
- dsf/object_model/led_strips/led_strip.py +74 -0
- dsf/object_model/limits/limits.py +73 -51
- dsf/object_model/messages/messages.py +6 -9
- dsf/object_model/model_collection.py +1 -3
- dsf/object_model/model_dictionary.py +2 -4
- dsf/object_model/model_object.py +3 -3
- dsf/object_model/move/axis.py +61 -26
- dsf/object_model/move/current_move.py +18 -7
- dsf/object_model/move/driver_id.py +2 -3
- dsf/object_model/move/extruder.py +34 -23
- dsf/object_model/move/extruder_non_linear.py +3 -3
- dsf/object_model/move/input_shaping.py +17 -16
- dsf/object_model/move/keepout_zone.py +58 -0
- dsf/object_model/move/kinematics/delta_kinematics.py +7 -7
- dsf/object_model/move/kinematics/delta_tower.py +5 -5
- dsf/object_model/move/kinematics/hangprinter_kinematics.py +3 -3
- dsf/object_model/move/kinematics/kinematics.py +4 -4
- dsf/object_model/move/kinematics/tilt_correction.py +7 -7
- dsf/object_model/move/microstepping.py +2 -2
- dsf/object_model/move/motors_idle_control.py +2 -2
- dsf/object_model/move/move.py +30 -11
- dsf/object_model/move/move_calibration.py +1 -1
- dsf/object_model/move/move_compensation.py +10 -9
- dsf/object_model/move/move_deviations.py +2 -2
- dsf/object_model/move/move_queue_item.py +2 -2
- dsf/object_model/move/move_rotation.py +3 -3
- dsf/object_model/move/move_segmentation.py +6 -6
- dsf/object_model/move/probe_grid.py +6 -6
- dsf/object_model/move/skew.py +4 -4
- dsf/object_model/network/network.py +8 -8
- dsf/object_model/network/network_interface.py +79 -54
- dsf/object_model/network/network_state.py +3 -0
- dsf/object_model/object_model.py +31 -36
- dsf/object_model/plugins/plugin_manifest.py +48 -30
- dsf/object_model/plugins/plugins.py +5 -5
- dsf/object_model/sbc/__init__.py +3 -0
- dsf/object_model/sbc/cpu.py +50 -0
- dsf/object_model/sbc/dsf/__init__.py +3 -0
- dsf/object_model/sbc/dsf/dsf.py +76 -0
- dsf/object_model/{http_endpoints/http_endpoints.py → sbc/dsf/http_endpoint.py} +7 -8
- dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/user_sessions.py +13 -18
- dsf/object_model/sbc/memory.py +30 -0
- dsf/object_model/sbc/sbc.py +100 -0
- dsf/object_model/sensors/analog_sensor.py +96 -9
- dsf/object_model/sensors/analog_sensor_type.py +9 -0
- dsf/object_model/sensors/endstop.py +19 -10
- dsf/object_model/sensors/filament_monitors/Duet3DFilamentMonitor.py +66 -0
- dsf/object_model/sensors/filament_monitors/__init__.py +6 -4
- dsf/object_model/sensors/filament_monitors/filament_monitor.py +32 -10
- dsf/object_model/sensors/filament_monitors/filament_monitor_enable_type.py +14 -0
- dsf/object_model/sensors/filament_monitors/laser_filament_monitor.py +14 -14
- dsf/object_model/sensors/filament_monitors/pulsed_filament_monitor.py +8 -8
- dsf/object_model/sensors/filament_monitors/rotating_magnet_filament_monitor.py +11 -11
- dsf/object_model/sensors/gp_input_port.py +1 -1
- dsf/object_model/sensors/probe.py +87 -39
- dsf/object_model/sensors/sensors.py +6 -6
- dsf/object_model/sensors/temperature_error.py +62 -0
- dsf/object_model/spindles/spindles.py +39 -5
- dsf/object_model/state/__init__.py +1 -0
- dsf/object_model/state/beep_request.py +2 -2
- dsf/object_model/state/gp_output_port.py +13 -1
- dsf/object_model/state/message_box.py +82 -13
- dsf/object_model/state/restore_point.py +10 -10
- dsf/object_model/state/startup_error.py +43 -0
- dsf/object_model/state/state.py +52 -74
- dsf/object_model/tools/tool_retraction.py +5 -5
- dsf/object_model/tools/tools.py +22 -21
- dsf/object_model/utils.py +2 -2
- dsf/object_model/volumes/volumes.py +16 -16
- dsf/utils.py +6 -9
- {dsf_python-3.4.6.post4.dist-info → dsf_python-3.5.0.dist-info}/METADATA +6 -2
- dsf_python-3.5.0.dist-info/RECORD +179 -0
- {dsf_python-3.4.6.post4.dist-info → dsf_python-3.5.0.dist-info}/WHEEL +1 -1
- dsf/object_model/boards/direct_display.py +0 -40
- dsf/object_model/boards/driver_settings.py +0 -27
- dsf/object_model/boards/stall_detect_settings.py +0 -62
- dsf/object_model/http_endpoints/__init__.py +0 -4
- dsf/object_model/scanner/__init__.py +0 -4
- dsf/object_model/scanner/scanner.py +0 -39
- dsf/object_model/scanner/scanner_status.py +0 -23
- dsf_python-3.4.6.post4.dist-info/RECORD +0 -164
- /dsf/object_model/{http_endpoints → sbc/dsf}/http_endpoint_type.py +0 -0
- /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/__init__.py +0 -0
- /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/access_level.py +0 -0
- /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/session_type.py +0 -0
- {dsf_python-3.4.6.post4.dist-info → dsf_python-3.5.0.dist-info}/LICENSE +0 -0
- {dsf_python-3.4.6.post4.dist-info → dsf_python-3.5.0.dist-info}/top_level.txt +0 -0
dsf/commands/code.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
1
|
from typing import List, Optional
|
|
3
2
|
|
|
4
3
|
from .base_command import BaseCommand
|
|
@@ -79,7 +78,7 @@ class Code(BaseCommand):
|
|
|
79
78
|
@property
|
|
80
79
|
def is_from_file_channel(self) -> bool:
|
|
81
80
|
"""Check if this code is from a file channel"""
|
|
82
|
-
return self.channel is CodeChannel.File
|
|
81
|
+
return self.channel is CodeChannel.File or self.channel is CodeChannel.File2
|
|
83
82
|
|
|
84
83
|
def parameter(self, letter: str, default=None):
|
|
85
84
|
"""Retrieve the parameter whose letter equals c or generate a default parameter"""
|
dsf/commands/code_channel.py
CHANGED
|
@@ -40,6 +40,12 @@ class CodeChannel(str, Enum):
|
|
|
40
40
|
# Code channel that executes macros on power fail, heater faults and filament out
|
|
41
41
|
Autopause = "Autopause"
|
|
42
42
|
|
|
43
|
+
# Code channel for secondary file prints
|
|
44
|
+
File2 = "File2"
|
|
45
|
+
|
|
46
|
+
# Code channel for the code queue that executes a couple of codes in-sync with moves of the primary print file
|
|
47
|
+
Queue2 = "Queue2"
|
|
48
|
+
|
|
43
49
|
# Unknown code channel
|
|
44
50
|
Unknown = "Unknown"
|
|
45
51
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import Optional
|
|
2
2
|
|
|
3
3
|
from .base_command import BaseCommand
|
|
4
4
|
from ..object_model.messages import MessageType
|
|
@@ -17,7 +17,7 @@ def ignore():
|
|
|
17
17
|
return BaseCommand("Ignore")
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
def resolve_code(rtype: MessageType, content: str
|
|
20
|
+
def resolve_code(rtype: MessageType, content: Optional[str]):
|
|
21
21
|
"""
|
|
22
22
|
Resolve the code to intercept and return the given message details for its completion.
|
|
23
23
|
This command is only permitted in ConnectionMode.Intercept mode.
|
dsf/commands/code_parameter.py
CHANGED
dsf/commands/generic.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import Optional
|
|
2
2
|
|
|
3
3
|
from .base_command import BaseCommand
|
|
4
4
|
from .code_channel import CodeChannel
|
|
@@ -10,7 +10,9 @@ def check_password(password: str):
|
|
|
10
10
|
"""
|
|
11
11
|
Check if the given password is correct and matches the previously set value from M551.
|
|
12
12
|
If no password was configured before or if it was set to "reprap", this will always return true
|
|
13
|
+
|
|
13
14
|
:param password: Password to check
|
|
15
|
+
|
|
14
16
|
:returns: true if the password matches or is not set
|
|
15
17
|
"""
|
|
16
18
|
if not isinstance(password, str) or not password:
|
|
@@ -23,6 +25,7 @@ def evaluate_expression(channel: CodeChannel, expression: str):
|
|
|
23
25
|
Evaluate an arbitrary expression on the given channel in RepRapFirmware.
|
|
24
26
|
Do not use this call to evaluate file-based and network-related fields because the
|
|
25
27
|
DSF and RRF models diverge in this regard.
|
|
28
|
+
|
|
26
29
|
:param channel: Code channel where the expression is evaluated
|
|
27
30
|
:param expression: Expression to evaluate
|
|
28
31
|
"""
|
|
@@ -33,22 +36,36 @@ def evaluate_expression(channel: CodeChannel, expression: str):
|
|
|
33
36
|
return BaseCommand("EvaluateExpression", **{"Channel": channel, "Expression": expression})
|
|
34
37
|
|
|
35
38
|
|
|
36
|
-
def flush(channel: CodeChannel):
|
|
39
|
+
def flush(channel: CodeChannel, sync_file_streams: bool = False, if_executing: bool = True):
|
|
37
40
|
"""
|
|
38
41
|
Wait for all pending (macro) codes on the given channel to finish.
|
|
39
42
|
This effectively guarantees that all buffered codes are processed by RRF before this command finishes.
|
|
43
|
+
|
|
40
44
|
:param channel: Code channel to flush
|
|
45
|
+
:param sync_file_streams: Whether the File and File2 streams are supposed to synchronize if a code is being
|
|
46
|
+
intercepted. This option should be used with care, under certain circumstances this can lead to a deadlock!
|
|
47
|
+
:param if_executing: Check if the corresponding channel is actually executing codes (i.e. if it is active).
|
|
48
|
+
If the input channel is not active, this command returns false.
|
|
49
|
+
This option is ignored if SyncFileStreams is true.
|
|
50
|
+
|
|
41
51
|
:returns: true if the flush request is successful
|
|
42
52
|
"""
|
|
43
53
|
if not isinstance(channel, CodeChannel):
|
|
44
54
|
raise TypeError("channel must be a CodeChannel")
|
|
45
|
-
|
|
55
|
+
if not isinstance(sync_file_streams, bool):
|
|
56
|
+
raise TypeError("sync_file_streams must be a boolean")
|
|
57
|
+
if not isinstance(if_executing, bool):
|
|
58
|
+
raise TypeError("if_executing must be a boolean")
|
|
59
|
+
return BaseCommand("Flush",
|
|
60
|
+
**{"Channel": channel, "SyncFileStreams": sync_file_streams, "IfExecuting": if_executing})
|
|
46
61
|
|
|
47
62
|
|
|
48
63
|
def invalidate_channel(channel: CodeChannel):
|
|
49
64
|
"""
|
|
50
65
|
Invalidate all pending codes and files on a given channel (including buffered codes from DSF in RepRapFirmware)
|
|
66
|
+
|
|
51
67
|
:param channel: Code channel to invalidate
|
|
68
|
+
|
|
52
69
|
:returns: true if the invalidate request is successful
|
|
53
70
|
"""
|
|
54
71
|
if not isinstance(channel, CodeChannel):
|
|
@@ -59,6 +76,7 @@ def invalidate_channel(channel: CodeChannel):
|
|
|
59
76
|
def set_update_status(updating: bool):
|
|
60
77
|
"""
|
|
61
78
|
Override the current status as reported by the object model when performing a software update.
|
|
79
|
+
|
|
62
80
|
:param updating: Whether an update is now in progress
|
|
63
81
|
"""
|
|
64
82
|
if not isinstance(updating, bool):
|
|
@@ -73,6 +91,7 @@ def simple_code(code: str, channel: CodeChannel = CodeChannel.DEFAULT_CHANNEL, a
|
|
|
73
91
|
its Code.Result is transformed back into a basic string. This is useful for minimal
|
|
74
92
|
extensions that do not require granular control of the code details. Except for certain cases, it
|
|
75
93
|
is NOT recommended for usage in InterceptionMode because it renders the internal code buffer useless.
|
|
94
|
+
|
|
76
95
|
:param code: Code to parse and execute
|
|
77
96
|
:param channel: Destination channel
|
|
78
97
|
:param async_exec: Whether this code may be executed asynchronously.
|
|
@@ -89,10 +108,11 @@ def write_message(
|
|
|
89
108
|
message_type: MessageType,
|
|
90
109
|
content: str,
|
|
91
110
|
output_message: bool = True,
|
|
92
|
-
log_level: LogLevel
|
|
111
|
+
log_level: Optional[LogLevel] = None,
|
|
93
112
|
):
|
|
94
113
|
"""
|
|
95
114
|
Write an arbitrary generic message
|
|
115
|
+
|
|
96
116
|
:param message_type: Type of the message to write
|
|
97
117
|
:param content: Content of the message to write
|
|
98
118
|
:param output_message: Output the message on the console and via the object model
|
dsf/commands/http_endpoints.py
CHANGED
dsf/commands/user_sessions.py
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
from enum import Enum
|
|
2
|
-
|
|
3
1
|
from .base_command import BaseCommand
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class AccessLevel(str, Enum):
|
|
7
|
-
"""Defines what a user is allowed to do"""
|
|
8
|
-
|
|
9
|
-
ReadOnly = "ReadOnly"
|
|
10
|
-
ReadWrite = "ReadWrite"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class SessionType(str, Enum):
|
|
14
|
-
"""Types of user sessions"""
|
|
15
|
-
|
|
16
|
-
Local = "Local"
|
|
17
|
-
HTTP = "HTTP"
|
|
18
|
-
Telnet = "Telnet"
|
|
2
|
+
from ..object_model import AccessLevel, SessionType
|
|
19
3
|
|
|
20
4
|
|
|
21
5
|
def add_user_session(access_level: AccessLevel, session_type: SessionType, origin: str):
|
dsf/connections/__init__.py
CHANGED
|
@@ -24,8 +24,8 @@ class InterceptionMode(str, Enum):
|
|
|
24
24
|
# Intercept codes before they are internally processed by the control server
|
|
25
25
|
PRE = "Pre"
|
|
26
26
|
|
|
27
|
-
# Intercept codes after the initial processing of the control server but before they are forwarded
|
|
28
|
-
# the RepRapFirmware controller
|
|
27
|
+
# Intercept codes after the initial processing of the control server, but before they are forwarded
|
|
28
|
+
# to the RepRapFirmware controller
|
|
29
29
|
POST = "Post"
|
|
30
30
|
|
|
31
31
|
# Receive a notification for executed codes. In this state the final result can be still changed
|
|
@@ -5,8 +5,7 @@ from .. import commands, DEFAULT_BACKLOG
|
|
|
5
5
|
from ..commands import code
|
|
6
6
|
from ..commands.code_channel import CodeChannel
|
|
7
7
|
from ..http import HttpEndpointUnixSocket
|
|
8
|
-
from ..object_model import ObjectModel
|
|
9
|
-
from ..object_model.http_endpoints import HttpEndpointType
|
|
8
|
+
from ..object_model import HttpEndpointType, ObjectModel
|
|
10
9
|
from ..object_model.job import GCodeFileInfo
|
|
11
10
|
from ..object_model.messages import Message, MessageType
|
|
12
11
|
from ..object_model.state import LogLevel
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
1
|
import json
|
|
3
2
|
import socket
|
|
3
|
+
from typing import Optional
|
|
4
4
|
|
|
5
|
-
from .exceptions import
|
|
6
|
-
TaskCanceledException)
|
|
5
|
+
from .exceptions import IncompatibleVersionException, InternalServerException, TaskCanceledException
|
|
7
6
|
from .init_messages import client_init_messages, server_init_message
|
|
8
7
|
from ..commands import responses
|
|
9
8
|
|
|
@@ -12,16 +11,12 @@ class BaseConnection:
|
|
|
12
11
|
"""
|
|
13
12
|
Base class for connections that access the control server via the Duet API
|
|
14
13
|
using a UNIX socket
|
|
15
|
-
|
|
16
|
-
Constructor arguments:
|
|
17
|
-
:param debug: Whether to print debug information or not
|
|
18
|
-
:param timeout: Set a timeout value on blocking socket operations or None to set the socket in non-blocking mode
|
|
19
14
|
"""
|
|
20
15
|
|
|
21
|
-
def __init__(self, debug: bool = False, timeout: int =
|
|
16
|
+
def __init__(self, debug: bool = False, timeout: int = 3):
|
|
22
17
|
self.debug = debug
|
|
23
18
|
self.timeout = timeout
|
|
24
|
-
self.socket: socket.socket
|
|
19
|
+
self.socket: Optional[socket.socket] = None
|
|
25
20
|
self.id = None
|
|
26
21
|
self.input = ""
|
|
27
22
|
|
|
@@ -30,7 +25,7 @@ class BaseConnection:
|
|
|
30
25
|
|
|
31
26
|
self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
32
27
|
self.socket.connect(socket_file)
|
|
33
|
-
self.socket.
|
|
28
|
+
self.socket.setblocking(True)
|
|
34
29
|
server_init_msg = server_init_message.ServerInitMessage.from_json(
|
|
35
30
|
json.loads(self.socket.recv(50).decode("utf8"))
|
|
36
31
|
)
|
|
@@ -117,9 +112,7 @@ class BaseConnection:
|
|
|
117
112
|
except Exception as e:
|
|
118
113
|
raise e
|
|
119
114
|
# either 0 or end of data
|
|
120
|
-
if part
|
|
121
|
-
raise IPCSocketBrokenException()
|
|
122
|
-
elif len(part) < BUFF_SIZE:
|
|
115
|
+
if len(part) < BUFF_SIZE:
|
|
123
116
|
break
|
|
124
117
|
|
|
125
118
|
json_string += data.decode("utf8")
|
dsf/connections/exceptions.py
CHANGED
|
@@ -14,10 +14,3 @@ class InternalServerException(Exception):
|
|
|
14
14
|
|
|
15
15
|
class TaskCanceledException(Exception):
|
|
16
16
|
"""Exception returned by the server if the task has been cancelled remotely"""
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class IPCSocketBrokenException(Exception):
|
|
20
|
-
"""Exception raised if the IPC connection has been closed on the remote server"""
|
|
21
|
-
|
|
22
|
-
def __init__(self):
|
|
23
|
-
super().__init__("IPC socket connection broken")
|
|
@@ -17,7 +17,7 @@ clientinitmessages holds all messages a client can send to the server to initiat
|
|
|
17
17
|
You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
"""
|
|
20
|
-
from
|
|
20
|
+
from typing import List
|
|
21
21
|
from .server_init_message import ServerInitMessage
|
|
22
22
|
from .. import ConnectionMode, InterceptionMode, SubscriptionMode
|
|
23
23
|
from ...commands.code_channel import CodeChannel
|
|
@@ -38,10 +38,11 @@ class ClientInitMessage:
|
|
|
38
38
|
|
|
39
39
|
def intercept_init_message(
|
|
40
40
|
intercept_mode: InterceptionMode,
|
|
41
|
-
channels:
|
|
42
|
-
filters:
|
|
41
|
+
channels: List[CodeChannel],
|
|
42
|
+
filters: List[str],
|
|
43
43
|
priority_codes: bool,
|
|
44
|
-
auto_flush: bool = True
|
|
44
|
+
auto_flush: bool = True,
|
|
45
|
+
auto_evaluate_expression: bool = True):
|
|
45
46
|
"""
|
|
46
47
|
Enter interception mode
|
|
47
48
|
Whenever a code is received, the connection must respond with one of
|
|
@@ -62,6 +63,9 @@ def intercept_init_message(
|
|
|
62
63
|
is specified.
|
|
63
64
|
This option makes extra Flush calls in the interceptor implementation obsolete.
|
|
64
65
|
It is highly recommended to enable this in order to avoid potential deadlocks when dealing with macros!
|
|
66
|
+
:param auto_evaluate_expression: Automatically evaluate expression parameters to their final values
|
|
67
|
+
before sending it over to the client.
|
|
68
|
+
This requires auto_flush to be True and happens when the remaining codes have been processed.
|
|
65
69
|
"""
|
|
66
70
|
return ClientInitMessage(
|
|
67
71
|
ConnectionMode.INTERCEPT,
|
|
@@ -69,8 +73,9 @@ def intercept_init_message(
|
|
|
69
73
|
"InterceptionMode": intercept_mode,
|
|
70
74
|
"Channels": channels,
|
|
71
75
|
"AutoFlush": auto_flush,
|
|
76
|
+
"AutoEvaluateExpressions": auto_evaluate_expression,
|
|
72
77
|
"Filters": filters,
|
|
73
|
-
"
|
|
78
|
+
"PriorityCodes": priority_codes,
|
|
74
79
|
},
|
|
75
80
|
)
|
|
76
81
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import List, Optional
|
|
2
2
|
|
|
3
3
|
from .base_command_connection import BaseCommandConnection
|
|
4
4
|
from .init_messages import client_init_messages
|
|
@@ -21,6 +21,9 @@ class InterceptConnection(BaseCommandConnection):
|
|
|
21
21
|
in case a code filter is specified.
|
|
22
22
|
This option makes extra Flush calls in the interceptor implementation obsolete.
|
|
23
23
|
It is highly recommended to enable this in order to avoid potential deadlocks when dealing with macros!
|
|
24
|
+
:param auto_evaluate_expression: Automatically evaluate expression parameters to their final values
|
|
25
|
+
before sending it over to the client.
|
|
26
|
+
This requires auto_flush to be True and happens when the remaining codes have been processed.
|
|
24
27
|
:param priority_codes: Defines if priority codes may be intercepted (e.g. M122 or M999)
|
|
25
28
|
:param debug: Whether debugging output is turned on for this connection
|
|
26
29
|
"""
|
|
@@ -28,9 +31,10 @@ class InterceptConnection(BaseCommandConnection):
|
|
|
28
31
|
def __init__(
|
|
29
32
|
self,
|
|
30
33
|
interception_mode: client_init_messages.InterceptionMode,
|
|
31
|
-
channels:
|
|
32
|
-
filters:
|
|
34
|
+
channels: List[CodeChannel] = None,
|
|
35
|
+
filters: List[str] = None,
|
|
33
36
|
auto_flush: bool = True,
|
|
37
|
+
auto_evaluate_expression: bool = True,
|
|
34
38
|
priority_codes: bool = False,
|
|
35
39
|
debug: bool = False,
|
|
36
40
|
):
|
|
@@ -39,12 +43,18 @@ class InterceptConnection(BaseCommandConnection):
|
|
|
39
43
|
self.channels = channels if channels is not None else CodeChannel.list()
|
|
40
44
|
self.filters = filters
|
|
41
45
|
self.auto_flush = auto_flush
|
|
46
|
+
self.auto_evaluate_expression = auto_evaluate_expression
|
|
42
47
|
self.priority_codes = priority_codes
|
|
43
48
|
|
|
44
49
|
def connect(self, socket_file: str = SOCKET_FILE): # noqa
|
|
45
50
|
"""Establishes a connection to the given UNIX socket file"""
|
|
46
51
|
iim = client_init_messages.intercept_init_message(
|
|
47
|
-
self.interception_mode,
|
|
52
|
+
self.interception_mode,
|
|
53
|
+
self.channels,
|
|
54
|
+
self.filters,
|
|
55
|
+
self.priority_codes,
|
|
56
|
+
self.auto_flush,
|
|
57
|
+
self.auto_evaluate_expression
|
|
48
58
|
)
|
|
49
59
|
return super().connect(iim, socket_file)
|
|
50
60
|
|
|
@@ -60,7 +70,7 @@ class InterceptConnection(BaseCommandConnection):
|
|
|
60
70
|
"""Instruct the control server to ignore the last received code (in intercepting mode)"""
|
|
61
71
|
self.send(commands.code_interception.ignore())
|
|
62
72
|
|
|
63
|
-
def resolve_code(self, rtype: MessageType = MessageType.Success, content: str
|
|
73
|
+
def resolve_code(self, rtype: MessageType = MessageType.Success, content: Optional[str] = None):
|
|
64
74
|
"""
|
|
65
75
|
Instruct the control server to resolve the last received code with the given
|
|
66
76
|
message details (in intercepting mode)
|
dsf/http.py
CHANGED
dsf/object_model/__init__.py
CHANGED
|
@@ -2,19 +2,19 @@ from .boards import Board, BoardState
|
|
|
2
2
|
from .directories import Directories
|
|
3
3
|
from .fans import Fan
|
|
4
4
|
from .heat import Heat, Heater, HeaterState
|
|
5
|
-
from .http_endpoints import HttpEndpoint, HttpEndpointType
|
|
6
5
|
from .inputs import InputChannel
|
|
7
6
|
from .job import Job
|
|
7
|
+
from .led_strips import LedStrip, LedStripType
|
|
8
8
|
from .limits import Limits
|
|
9
9
|
from .messages import Message, MessageType
|
|
10
10
|
from .move import DriverId, Move
|
|
11
11
|
from .network import Network, NetworkInterface, NetworkInterfaceType, NetworkProtocol, NetworkState
|
|
12
12
|
from .object_model import ObjectModel
|
|
13
13
|
from .plugins import Plugin, PluginManifest, SbcPermissions
|
|
14
|
-
from .
|
|
14
|
+
from .sbc import CPU, Memory, SBC
|
|
15
|
+
from .sbc.dsf import AccessLevel, HttpEndpoint, HttpEndpointType, SessionType, UserSession
|
|
15
16
|
from .sensors import AnalogSensor, AnalogSensorType, Endstop, EndstopType, GpInputPort, Probe, ProbeType, Sensors
|
|
16
17
|
from .spindles import Spindle, SpindleState
|
|
17
18
|
from .state import LogLevel, MachineStatus, MessageBox, MessageBoxMode, State
|
|
18
19
|
from .tools import Tool, ToolState
|
|
19
|
-
from .user_sessions import AccessLevel, SessionType, UserSession
|
|
20
20
|
from .volumes import Volume
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from .accelerometer import Accelerometer
|
|
2
2
|
from .boards import Board, BoardState
|
|
3
|
-
from .
|
|
3
|
+
from .board_closed_loop import BoardClosedLoop
|
|
4
4
|
from .direct_display import DirectDisplay
|
|
5
|
-
from .driver import Driver
|
|
5
|
+
from .driver import Driver
|
|
6
|
+
from .driver_closed_loop import DriverClosedLoop, ClosedLoopCurrentFraction, ClosedLoopPositionError
|
|
6
7
|
from .min_max_current import MinMaxCurrent
|
|
7
|
-
from .stall_detect_settings import StallDetectSettings
|
|
8
8
|
|
|
9
|
-
__all__ = ['Accelerometer', 'Board', 'BoardState', '
|
|
10
|
-
'
|
|
9
|
+
__all__ = ['Accelerometer', 'Board', 'BoardState', 'BoardClosedLoop', 'DirectDisplay', 'Driver', 'DriverClosedLoop',
|
|
10
|
+
'ClosedLoopCurrentFraction', 'ClosedLoopPositionError', 'MinMaxCurrent']
|
|
@@ -5,11 +5,24 @@ class Accelerometer(ModelObject):
|
|
|
5
5
|
"""This represents an accelerometer"""
|
|
6
6
|
def __init__(self):
|
|
7
7
|
super(Accelerometer, self).__init__()
|
|
8
|
+
# Orientation of the accelerometer
|
|
9
|
+
# See https://docs.duet3d.com/en/Duet3D_hardware/Accessories/Duet3D_Accelerometer#orientation for a list of orientations
|
|
10
|
+
self._orientation = 20
|
|
8
11
|
# Number of collected data points in the last run or 0 if it failed
|
|
9
12
|
self._points = 0
|
|
10
13
|
# Number of completed sampling runs
|
|
11
14
|
self._runs = 0
|
|
12
15
|
|
|
16
|
+
@property
|
|
17
|
+
def orientation(self) -> int:
|
|
18
|
+
"""Orientation of the accelerometer
|
|
19
|
+
See https://docs.duet3d.com/en/Duet3D_hardware/Accessories/Duet3D_Accelerometer#orientation for a list of orientations"""
|
|
20
|
+
return self._orientation
|
|
21
|
+
|
|
22
|
+
@orientation.setter
|
|
23
|
+
def orientation(self, value):
|
|
24
|
+
self._orientation = int(value)
|
|
25
|
+
|
|
13
26
|
@property
|
|
14
27
|
def points(self) -> int:
|
|
15
28
|
"""Number of collected data points in the last run or 0 if it failed"""
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from ..model_object import ModelObject
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class BoardClosedLoop(ModelObject):
|
|
5
5
|
"""This represents information about closed-loop tuning"""
|
|
6
6
|
def __init__(self):
|
|
7
|
-
super(
|
|
7
|
+
super(BoardClosedLoop, self).__init__()
|
|
8
8
|
# Number of collected data points in the last run or 0 if it failed
|
|
9
9
|
self._points = 0
|
|
10
10
|
# Number of completed sampling runs
|