🔀 Reimplement maintenance changes

This commit is contained in:
Gina Häußge committed 2021-05-21 14:31:53 +02:00
1 parent 04391495e7
commit c78c2641dd
4 files changed
+47 -1

No files matched your search

@@ -274,6 +274,15 @@ class ReprapGcodeProtocol(
"to the printer. Just the G or M code, comma separated."
),
),
SmallListType(
"ignored_commands",
gettext("Ignored commands"),
help=gettext(
"Use this to specify commands that should never be sent "
"to the printer but not produce a warning either. Just "
"the G or M code, comma separated."
),
),
SmallListType(
"checksum_requiring_commands",
gettext("Checksum requiring commands"),
@@ -3295,6 +3304,14 @@ class ReprapGcodeProtocol(
)
)
return (None,)
elif command.code in self.flavor.ignored_commands:
# TODO evaluate "notify_suppressed_commands" and trigger notification if needed
self._logger.info(
"Not sending {} to printer, it's configured as a blocked command".format(
command
)
)
return (None,)
def _command_phase_sending(self, command, gcode=None):
if gcode is not None and gcode.code in self.flavor.long_running_commands:
@@ -73,6 +73,7 @@ class StandardFlavor(metaclass=FlavorMeta):
]
asynchronous_commands = ["G0", "G1", "G2", "G3"]
blocked_commands = ["M0", "M1"]
ignored_commands = []
pausing_commands = ["M0", "M1", "M25"]
emergency_commands = ["M112", "M108", "M410"]
@@ -128,6 +128,13 @@ class SerialTransport(Transport):
default=True,
advanced=True,
),
BooleanType(
"low_latency",
gettext("Request low latency mode on the serial port (if supported)"),
help=gettext(""),
default=True,
advanced=True,
),
ChoiceType(
"parity",
gettext("Parity"),
@@ -315,6 +322,7 @@ class SerialTransport(Transport):
self._apply_parity_workaround(serial_obj, **kwargs)
serial_obj.open()
self._set_close_exec(serial_obj, **kwargs)
self._set_low_latency(serial_obj, **kwargs)
return serial_obj
@@ -386,6 +394,23 @@ class SerialTransport(Transport):
return serial_obj
@classmethod
def _set_low_latency(cls, serial_obj, **kwargs):
use_low_latency = kwargs.get("low_latency", False)
if hasattr(serial_obj, "set_low_latency_mode"):
if use_low_latency:
try:
serial_obj.set_low_latency_mode(True)
except Exception:
logging.getLogger(__name__).exception(
"Could not set low latency mode on serial port"
)
else:
logging.getLogger(__name__).info(
"Platform doesn't support low latency mode on serial port"
)
return serial_obj
def __str__(self):
return "SerialTransport"
+4 -1
View File
@@ -1337,7 +1337,10 @@ class Server:
storage_managers = {
octoprint.filemanager.FileDestinations.LOCAL: LocalFileStorage(
self._settings.getBaseFolder("uploads")
self._settings.getBaseFolder("uploads"),
really_universal=self._settings.get(
["feature", "enforceReallyUniversalFilenames"]
),
),
octoprint.filemanager.FileDestinations.SDCARD: PrinterSDStorage(),
}