dsf-python 3.4.6.post3__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.
Files changed (133) hide show
  1. dsf/commands/code.py +1 -2
  2. dsf/commands/code_channel.py +6 -0
  3. dsf/commands/code_interception.py +2 -2
  4. dsf/commands/code_parameter.py +0 -1
  5. dsf/commands/generic.py +24 -4
  6. dsf/commands/http_endpoints.py +1 -1
  7. dsf/commands/user_sessions.py +1 -17
  8. dsf/connections/__init__.py +2 -2
  9. dsf/connections/base_command_connection.py +1 -2
  10. dsf/connections/base_connection.py +2 -2
  11. dsf/connections/init_messages/client_init_messages.py +10 -5
  12. dsf/connections/intercept_connection.py +15 -5
  13. dsf/http.py +1 -1
  14. dsf/object_model/__init__.py +3 -3
  15. dsf/object_model/boards/__init__.py +5 -5
  16. dsf/object_model/boards/accelerometer.py +13 -0
  17. dsf/object_model/boards/{closed_loop.py → board_closed_loop.py} +2 -2
  18. dsf/object_model/boards/boards.py +69 -28
  19. dsf/object_model/boards/direct_display/__init__.py +8 -0
  20. dsf/object_model/boards/direct_display/direct_display.py +23 -0
  21. dsf/object_model/boards/direct_display/direct_display_controller.py +14 -0
  22. dsf/object_model/boards/direct_display/direct_display_encoder.py +19 -0
  23. dsf/object_model/boards/direct_display/direct_display_screen.py +101 -0
  24. dsf/object_model/boards/direct_display/direct_display_screen_st7567.py +31 -0
  25. dsf/object_model/boards/driver.py +21 -7
  26. dsf/object_model/boards/driver_closed_loop.py +77 -0
  27. dsf/object_model/boards/inductive_sensor.py +9 -0
  28. dsf/object_model/directories/directories.py +7 -18
  29. dsf/object_model/fans/fan_thermostatic_control.py +17 -7
  30. dsf/object_model/fans/fans.py +19 -8
  31. dsf/object_model/heat/heat.py +6 -6
  32. dsf/object_model/heat/heater.py +35 -2
  33. dsf/object_model/heat/heater_model.py +1 -3
  34. dsf/object_model/heat/heater_model_pid.py +5 -5
  35. dsf/object_model/heat/heater_monitor.py +20 -9
  36. dsf/object_model/inputs/__init__.py +2 -1
  37. dsf/object_model/inputs/input_channel.py +64 -20
  38. dsf/object_model/inputs/inputs.py +22 -0
  39. dsf/object_model/job/build.py +5 -5
  40. dsf/object_model/job/build_object.py +10 -10
  41. dsf/object_model/job/gcode_fileinfo.py +19 -20
  42. dsf/object_model/job/job.py +54 -39
  43. dsf/object_model/job/layer.py +6 -6
  44. dsf/object_model/job/thumbnail_info.py +9 -10
  45. dsf/object_model/job/times_left.py +7 -7
  46. dsf/object_model/led_strips/__init__.py +1 -0
  47. dsf/object_model/led_strips/led_strip.py +74 -0
  48. dsf/object_model/limits/limits.py +73 -51
  49. dsf/object_model/messages/messages.py +6 -9
  50. dsf/object_model/model_collection.py +1 -3
  51. dsf/object_model/model_dictionary.py +2 -4
  52. dsf/object_model/model_object.py +3 -3
  53. dsf/object_model/move/axis.py +61 -26
  54. dsf/object_model/move/current_move.py +18 -7
  55. dsf/object_model/move/driver_id.py +2 -3
  56. dsf/object_model/move/extruder.py +34 -23
  57. dsf/object_model/move/extruder_non_linear.py +3 -3
  58. dsf/object_model/move/input_shaping.py +17 -16
  59. dsf/object_model/move/keepout_zone.py +58 -0
  60. dsf/object_model/move/kinematics/delta_kinematics.py +7 -7
  61. dsf/object_model/move/kinematics/delta_tower.py +5 -5
  62. dsf/object_model/move/kinematics/hangprinter_kinematics.py +3 -3
  63. dsf/object_model/move/kinematics/kinematics.py +4 -4
  64. dsf/object_model/move/kinematics/tilt_correction.py +7 -7
  65. dsf/object_model/move/microstepping.py +2 -2
  66. dsf/object_model/move/motors_idle_control.py +2 -2
  67. dsf/object_model/move/move.py +30 -11
  68. dsf/object_model/move/move_calibration.py +1 -1
  69. dsf/object_model/move/move_compensation.py +10 -9
  70. dsf/object_model/move/move_deviations.py +2 -2
  71. dsf/object_model/move/move_queue_item.py +2 -2
  72. dsf/object_model/move/move_rotation.py +3 -3
  73. dsf/object_model/move/move_segmentation.py +6 -6
  74. dsf/object_model/move/probe_grid.py +6 -6
  75. dsf/object_model/move/skew.py +4 -4
  76. dsf/object_model/network/network.py +8 -8
  77. dsf/object_model/network/network_interface.py +79 -54
  78. dsf/object_model/network/network_state.py +3 -0
  79. dsf/object_model/object_model.py +31 -36
  80. dsf/object_model/plugins/plugin_manifest.py +48 -30
  81. dsf/object_model/plugins/plugins.py +5 -5
  82. dsf/object_model/sbc/__init__.py +3 -0
  83. dsf/object_model/sbc/cpu.py +50 -0
  84. dsf/object_model/sbc/dsf/__init__.py +3 -0
  85. dsf/object_model/sbc/dsf/dsf.py +76 -0
  86. dsf/object_model/{http_endpoints/http_endpoints.py → sbc/dsf/http_endpoint.py} +7 -8
  87. dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/user_sessions.py +13 -18
  88. dsf/object_model/sbc/memory.py +30 -0
  89. dsf/object_model/sbc/sbc.py +100 -0
  90. dsf/object_model/sensors/analog_sensor.py +96 -9
  91. dsf/object_model/sensors/analog_sensor_type.py +9 -0
  92. dsf/object_model/sensors/endstop.py +19 -10
  93. dsf/object_model/sensors/filament_monitors/Duet3DFilamentMonitor.py +66 -0
  94. dsf/object_model/sensors/filament_monitors/__init__.py +6 -4
  95. dsf/object_model/sensors/filament_monitors/filament_monitor.py +32 -10
  96. dsf/object_model/sensors/filament_monitors/filament_monitor_enable_type.py +14 -0
  97. dsf/object_model/sensors/filament_monitors/laser_filament_monitor.py +14 -14
  98. dsf/object_model/sensors/filament_monitors/pulsed_filament_monitor.py +8 -8
  99. dsf/object_model/sensors/filament_monitors/rotating_magnet_filament_monitor.py +11 -11
  100. dsf/object_model/sensors/gp_input_port.py +1 -1
  101. dsf/object_model/sensors/probe.py +87 -39
  102. dsf/object_model/sensors/sensors.py +6 -6
  103. dsf/object_model/sensors/temperature_error.py +62 -0
  104. dsf/object_model/spindles/spindles.py +39 -5
  105. dsf/object_model/state/__init__.py +1 -0
  106. dsf/object_model/state/beep_request.py +2 -2
  107. dsf/object_model/state/gp_output_port.py +13 -1
  108. dsf/object_model/state/message_box.py +82 -13
  109. dsf/object_model/state/restore_point.py +10 -10
  110. dsf/object_model/state/startup_error.py +43 -0
  111. dsf/object_model/state/state.py +52 -74
  112. dsf/object_model/tools/tool_retraction.py +5 -5
  113. dsf/object_model/tools/tools.py +22 -21
  114. dsf/object_model/utils.py +2 -2
  115. dsf/object_model/volumes/volumes.py +16 -16
  116. dsf/utils.py +6 -9
  117. {dsf_python-3.4.6.post3.dist-info → dsf_python-3.5.0.dist-info}/METADATA +6 -6
  118. dsf_python-3.5.0.dist-info/RECORD +179 -0
  119. {dsf_python-3.4.6.post3.dist-info → dsf_python-3.5.0.dist-info}/WHEEL +1 -1
  120. dsf/object_model/boards/direct_display.py +0 -40
  121. dsf/object_model/boards/driver_settings.py +0 -27
  122. dsf/object_model/boards/stall_detect_settings.py +0 -62
  123. dsf/object_model/http_endpoints/__init__.py +0 -4
  124. dsf/object_model/scanner/__init__.py +0 -4
  125. dsf/object_model/scanner/scanner.py +0 -39
  126. dsf/object_model/scanner/scanner_status.py +0 -23
  127. dsf_python-3.4.6.post3.dist-info/RECORD +0 -164
  128. /dsf/object_model/{http_endpoints → sbc/dsf}/http_endpoint_type.py +0 -0
  129. /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/__init__.py +0 -0
  130. /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/access_level.py +0 -0
  131. /dsf/object_model/{user_sessions → sbc/dsf/user_sessions}/session_type.py +0 -0
  132. {dsf_python-3.4.6.post3.dist-info → dsf_python-3.5.0.dist-info}/LICENSE +0 -0
  133. {dsf_python-3.4.6.post3.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"""
@@ -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 __future__ import annotations
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 | None = None):
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.
@@ -1,7 +1,6 @@
1
1
  """
2
2
  codeparameter contains all classes and methods dealing with deserialized code parameters.
3
3
  """
4
- from __future__ import annotations
5
4
  import json
6
5
 
7
6
  from ..exceptions import CodeParserException
dsf/commands/generic.py CHANGED
@@ -1,4 +1,4 @@
1
- from __future__ import annotations
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
- return BaseCommand("Flush", **{"Channel": channel})
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 | None = None,
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
@@ -1,5 +1,5 @@
1
1
  from .base_command import BaseCommand
2
- from ..object_model.http_endpoints import HttpEndpointType
2
+ from ..object_model import HttpEndpointType
3
3
 
4
4
 
5
5
  def add_http_endpoint(endpoint_type: HttpEndpointType, namespace: str, path: str, is_upload_request: bool):
@@ -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):
@@ -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 to
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,6 +1,6 @@
1
- from __future__ import annotations
2
1
  import json
3
2
  import socket
3
+ from typing import Optional
4
4
 
5
5
  from .exceptions import IncompatibleVersionException, InternalServerException, TaskCanceledException
6
6
  from .init_messages import client_init_messages, server_init_message
@@ -16,7 +16,7 @@ class BaseConnection:
16
16
  def __init__(self, debug: bool = False, timeout: int = 3):
17
17
  self.debug = debug
18
18
  self.timeout = timeout
19
- self.socket: socket.socket | None = None
19
+ self.socket: Optional[socket.socket] = None
20
20
  self.id = None
21
21
  self.input = ""
22
22
 
@@ -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 __future__ import annotations
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: list[CodeChannel],
42
- filters: list[str],
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
- "PriortyCodes": priority_codes,
78
+ "PriorityCodes": priority_codes,
74
79
  },
75
80
  )
76
81
 
@@ -1,4 +1,4 @@
1
- from __future__ import annotations
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: list[CodeChannel] = None,
32
- filters: list[str] = None,
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, self.channels, self.filters, self.priority_codes, self.auto_flush
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 | None = None):
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
@@ -5,7 +5,7 @@ from concurrent.futures import ThreadPoolExecutor
5
5
  from enum import Enum
6
6
 
7
7
  from . import DEFAULT_BACKLOG
8
- from .object_model.http_endpoints import HttpEndpointType
8
+ from .object_model import HttpEndpointType
9
9
 
10
10
 
11
11
  class HttpResponseType(str, Enum):
@@ -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 .scanner import Scanner, ScannerStatus
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 .closed_loop import ClosedLoop
3
+ from .board_closed_loop import BoardClosedLoop
4
4
  from .direct_display import DirectDisplay
5
- from .driver import Driver, DriverSettings
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', 'ClosedLoop', 'DirectDisplay', 'Driver', 'DriverSettings',
10
- 'MinMaxCurrent', 'StallDetectSettings']
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 ClosedLoop(ModelObject):
4
+ class BoardClosedLoop(ModelObject):
5
5
  """This represents information about closed-loop tuning"""
6
6
  def __init__(self):
7
- super(ClosedLoop, self).__init__()
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
@@ -1,12 +1,16 @@
1
- from __future__ import annotations
2
1
  from enum import Enum
2
+ from typing import List, Optional
3
3
 
4
4
  from .accelerometer import Accelerometer
5
- from .closed_loop import ClosedLoop
5
+ from .board_closed_loop import BoardClosedLoop
6
6
  from .direct_display import DirectDisplay
7
+ from .driver import Driver
8
+ from .inductive_sensor import InductiveSensor
7
9
  from .min_max_current import MinMaxCurrent
10
+ from ..model_collection import ModelCollection
8
11
  from ..model_object import ModelObject
9
12
  from ..utils import wrap_model_property
13
+ from ...utils import deprecated
10
14
 
11
15
 
12
16
  class BoardState(str, Enum):
@@ -36,9 +40,11 @@ class Board(ModelObject):
36
40
  # Accelerometer of this board or None if unknown
37
41
  accelerometer = wrap_model_property('accelerometer', Accelerometer)
38
42
  # Closed loop data of this board or None if unknown
39
- closed_loop = wrap_model_property('closed_loop', ClosedLoop)
43
+ closed_loop = wrap_model_property('closed_loop', BoardClosedLoop)
40
44
  # Details about a connected display or None if none is connected
41
45
  direct_display = wrap_model_property('direct_display', DirectDisplay)
46
+ # Information about an inductive sensor or None if not present
47
+ inductive_sensor = wrap_model_property('inductive_sensor', InductiveSensor)
42
48
  # Minimum, maximum, and current temperatures of the MCU or None if unknown
43
49
  mcu_temp = wrap_model_property('mcu_temp', MinMaxCurrent)
44
50
  # Minimum, maximum, and current voltages on the 12V rail or None if unknown
@@ -59,6 +65,8 @@ class Board(ModelObject):
59
65
  self._closed_loop = None
60
66
  # Details about a connected display or None if none is connected
61
67
  self._direct_display = None
68
+ # Drivers of this board
69
+ self._drivers = None
62
70
  # Date of the firmware build
63
71
  self._firmware_date = ""
64
72
  # Filename of the firmware binary
@@ -67,11 +75,15 @@ class Board(ModelObject):
67
75
  self._firmware_name = ""
68
76
  # Version of the firmware build
69
77
  self._firmware_version = ""
78
+ # Amount of free RAM on this board (in bytes or null if unknown)
79
+ self._free_ram = None
70
80
  # Filename of the IAP binary that is used for updates from the SBC or None if unsupported
71
81
  self._iap_file_name_SBC = None
72
82
  # Filename of the IAP binary that is used for updates from the SD card or None if unsupported
73
83
  # This is only available for the mainboard (first board item)
74
84
  self._iap_file_name_SD = None
85
+ # Information about an inductive sensor or None if not present
86
+ self._inductive_sensor = None
75
87
  # Maximum number of heaters this board can control
76
88
  self._max_heaters = 0
77
89
  # Maximum number of motors this board can drive
@@ -95,32 +107,43 @@ class Board(ModelObject):
95
107
  self._v_12 = None
96
108
  # Minimum, maximum, and current voltages on the input rail or None if unknown
97
109
  self._v_in = None
110
+ # Filename of the on-board WiFi chip or None if not present
111
+ self._wifi_firmware_file_name = None
98
112
 
99
113
  @property
100
- def bootloader_file_name(self) -> str | None:
114
+ def bootloader_file_name(self) -> Optional[str]:
101
115
  """Filename of the bootloader binary or None if unknown"""
102
116
  return self._bootloader_file_name
103
117
 
104
118
  @bootloader_file_name.setter
105
- def bootloader_file_name(self, value: str | None = None):
119
+ def bootloader_file_name(self, value):
106
120
  self._bootloader_file_name = str(value) if value is not None else None
107
121
 
108
122
  @property
109
- def can_address(self) -> int | None:
123
+ def can_address(self) -> Optional[int]:
110
124
  """CAN address of this board or None if not applicable"""
111
125
  return self._can_address
112
126
 
113
127
  @can_address.setter
114
- def can_address(self, value: int | None = None):
128
+ def can_address(self, value):
115
129
  self._can_address = int(value) if value is not None else None
116
130
 
131
+ @property
132
+ def drivers(self) -> Optional[List[Driver]]:
133
+ """Drivers of this board"""
134
+ return self._drivers
135
+
136
+ @drivers.setter
137
+ def drivers(self, value):
138
+ self._drivers = None if value is None else ModelCollection(Driver, value)
139
+
117
140
  @property
118
141
  def firmware_date(self) -> str:
119
142
  """Date of the firmware build"""
120
143
  return self._firmware_date
121
144
 
122
145
  @firmware_date.setter
123
- def firmware_date(self, value: str):
146
+ def firmware_date(self, value):
124
147
  self._firmware_date = str(value)
125
148
 
126
149
  @property
@@ -129,7 +152,7 @@ class Board(ModelObject):
129
152
  return self._firmware_file_name
130
153
 
131
154
  @firmware_file_name.setter
132
- def firmware_file_name(self, value: str):
155
+ def firmware_file_name(self, value):
133
156
  self._firmware_file_name = str(value)
134
157
 
135
158
  @property
@@ -138,7 +161,7 @@ class Board(ModelObject):
138
161
  return self._firmware_name
139
162
 
140
163
  @firmware_name.setter
141
- def firmware_name(self, value: str):
164
+ def firmware_name(self, value):
142
165
  self._firmware_name = str(value)
143
166
 
144
167
  @property
@@ -147,26 +170,35 @@ class Board(ModelObject):
147
170
  return self._firmware_version
148
171
 
149
172
  @firmware_version.setter
150
- def firmware_version(self, value: str):
173
+ def firmware_version(self, value):
151
174
  self._firmware_version = str(value)
152
175
 
153
176
  @property
154
- def iap_file_name_SBC(self) -> str | None:
177
+ def free_ram(self) -> Optional[int]:
178
+ """Amount of free RAM on this board (in bytes or null if unknown)"""
179
+ return self._free_ram
180
+
181
+ @free_ram.setter
182
+ def free_ram(self, value):
183
+ self._free_ram = None if value is None else int(value)
184
+
185
+ @property
186
+ def iap_file_name_SBC(self) -> Optional[str]:
155
187
  """Filename of the IAP binary that is used for updates from the SBC or None if unsupported"""
156
188
  return self._iap_file_name_SBC
157
189
 
158
190
  @iap_file_name_SBC.setter
159
- def iap_file_name_SBC(self, value: str | None = None):
191
+ def iap_file_name_SBC(self, value):
160
192
  self._iap_file_name_SBC = str(value) if value is not None else None
161
193
 
162
194
  @property
163
- def iap_file_name_SD(self) -> str | None:
195
+ def iap_file_name_SD(self) -> Optional[str]:
164
196
  """Filename of the IAP binary that is used for updates from the SD card or None if unsupported
165
197
  This is only available for the mainboard (first board item)"""
166
198
  return self._iap_file_name_SD
167
199
 
168
200
  @iap_file_name_SD.setter
169
- def iap_file_name_SD(self, value: str | None = None):
201
+ def iap_file_name_SD(self, value):
170
202
  self._iap_file_name_SD = str(value) if value is not None else None
171
203
 
172
204
  @property
@@ -175,7 +207,7 @@ class Board(ModelObject):
175
207
  return self._max_heaters
176
208
 
177
209
  @max_heaters.setter
178
- def max_heaters(self, value: int):
210
+ def max_heaters(self, value):
179
211
  self._max_heaters = int(value)
180
212
 
181
213
  @property
@@ -184,7 +216,7 @@ class Board(ModelObject):
184
216
  return self._max_motors
185
217
 
186
218
  @max_motors.setter
187
- def max_motors(self, value: int):
219
+ def max_motors(self, value):
188
220
  self._max_motors = int(value)
189
221
 
190
222
  @property
@@ -193,7 +225,7 @@ class Board(ModelObject):
193
225
  return self._name
194
226
 
195
227
  @name.setter
196
- def name(self, value: str):
228
+ def name(self, value):
197
229
  self._name = str(value)
198
230
 
199
231
  @property
@@ -202,7 +234,7 @@ class Board(ModelObject):
202
234
  return self._short_name
203
235
 
204
236
  @short_name.setter
205
- def short_name(self, value: str):
237
+ def short_name(self, value):
206
238
  self._short_name = str(value)
207
239
 
208
240
  @property
@@ -211,23 +243,23 @@ class Board(ModelObject):
211
243
  return self._state
212
244
 
213
245
  @state.setter
214
- def state(self, value: BoardState):
215
- if isinstance(value, BoardState):
246
+ def state(self, value):
247
+ if value is None or isinstance(value, BoardState):
216
248
  self._state = value
217
249
  elif isinstance(value, str):
218
250
  self._state = BoardState(value)
219
251
  else:
220
- raise TypeError(f"{__name__}.state must be of type BoardState."
221
- f" Got {type(value)}: {value}")
252
+ raise TypeError(f"{__name__}.state must be of type BoardState or None. Got {type(value)}: {value}")
222
253
 
223
254
  @property
255
+ @deprecated(f"Use {__name__}.supports_direct_display instead")
224
256
  def supports_12864(self) -> bool:
225
257
  """Indicates if this board supports external 12864 displays
226
- Obsolete: Replaced with SupportsDirectDisplay"""
258
+ Deprecated: Use supports_direct_display instead"""
227
259
  return self._supports_12864
228
260
 
229
261
  @supports_12864.setter
230
- def supports_12864(self, value: bool):
262
+ def supports_12864(self, value):
231
263
  self._supports_12864 = bool(value)
232
264
 
233
265
  @property
@@ -236,14 +268,23 @@ class Board(ModelObject):
236
268
  return self._supports_direct_display
237
269
 
238
270
  @supports_direct_display.setter
239
- def supports_direct_display(self, value: bool):
271
+ def supports_direct_display(self, value):
240
272
  self._supports_direct_display = bool(value)
241
273
 
242
274
  @property
243
- def unique_id(self) -> str | None:
275
+ def unique_id(self) -> Optional[str]:
244
276
  """Unique identifier of the board or None if unknown"""
245
277
  return self._unique_id
246
278
 
247
279
  @unique_id.setter
248
- def unique_id(self, value: str | None = None):
280
+ def unique_id(self, value):
249
281
  self._unique_id = str(value) if value is not None else None
282
+
283
+ @property
284
+ def wifi_firmware_file_name(self):
285
+ """Filename of the on-board WiFi chip or None if not present"""
286
+ return self._wifi_firmware_file_name
287
+
288
+ @wifi_firmware_file_name.setter
289
+ def wifi_firmware_file_name(self, value):
290
+ self._wifi_firmware_file_name = str(value) if value is not None else None