diff --git a/OctoPrint_MeatPack/meatpack.py b/OctoPrint_MeatPack/meatpack.py index a106b65..8bdc829 100644 --- a/OctoPrint_MeatPack/meatpack.py +++ b/OctoPrint_MeatPack/meatpack.py @@ -77,17 +77,17 @@ def initialize(): # ------------------------------------------------------------------------------- -def pack_chars(low: str, high: str) -> int: +def pack_chars(low, high): return int(((MeatPackLookupTableValue[ord(high)] & 0xF) << 4) | (MeatPackLookupTableValue[ord(low)] & 0xF)) # ------------------------------------------------------------------------------- -def is_packable(char) -> bool: +def is_packable(char): return False if MeatPackLookupTablePackable[ord(char)] == 0 else True # ------------------------------------------------------------------------------- -def set_no_spaces(no_spaces: bool): +def set_no_spaces(no_spaces): global MeatPackOmitWhitespaces global MeatPackLookupTablePackable global MeatPackLookupTableValue @@ -103,7 +103,7 @@ def set_no_spaces(no_spaces: bool): # ------------------------------------------------------------------------------- -def get_command_bytes(command) -> bytearray: +def get_command_bytes(command): out = bytearray() out.append(MPCommand_SignalByte) out.append(MPCommand_SignalByte) @@ -112,7 +112,7 @@ def get_command_bytes(command) -> bytearray: # ------------------------------------------------------------------------------- -def _unified_method(line: str) -> str: +def _unified_method(line): # If it's an "M" command, leave it unchanged. m_idx = line.find('M') if m_idx >= 0: @@ -143,7 +143,7 @@ def _unified_method(line: str) -> str: # ------------------------------------------------------------------------------- -def pack_line(line: str, logger=None) -> bytearray: +def pack_line(line, logger=None): bts = bytearray() if line[0] == ';': @@ -197,7 +197,7 @@ def pack_line(line: str, logger=None) -> bytearray: # ------------------------------------------------------------------------------- -def pack_file(in_filename: str, out_filename: str): +def pack_file(in_filename, out_filename): in_file = open(in_filename, "r") out_file = open(out_filename, "wb") @@ -227,7 +227,7 @@ def pack_file(in_filename: str, out_filename: str): # ------------------------------------------------------------------------------- -def strip_comments(in_filename: str, out_filename: str): +def strip_comments(in_filename, out_filename): in_file = open(in_filename, "r") out_file = open(out_filename, "wb") diff --git a/OctoPrint_MeatPack/packing_serial.py b/OctoPrint_MeatPack/packing_serial.py index 222f99c..0f06a8d 100644 --- a/OctoPrint_MeatPack/packing_serial.py +++ b/OctoPrint_MeatPack/packing_serial.py @@ -21,7 +21,7 @@ def __init__(self, serial_obj): def terminate(self): self._running = False - def is_running(self) -> bool: + def is_running(self): return self._running def run(self): @@ -103,7 +103,7 @@ def packing_enabled(self): return self._packing_enabled @packing_enabled.setter - def packing_enabled(self, value: bool): + def packing_enabled(self, value): # Set before anything else, to buffer data while state is synchronized. self._sync_pending = True self._packing_enabled = value @@ -115,7 +115,7 @@ def omit_all_spaces(self): return self._no_spaces @omit_all_spaces.setter - def omit_all_spaces(self, value: bool): + def omit_all_spaces(self, value): # Set before anything else, to buffer data while state is synchronized. self._sync_pending = True self._no_spaces = value @@ -127,7 +127,7 @@ def log_transmission_stats(self): return self._log_transmission_stats @log_transmission_stats.setter - def log_transmission_stats(self, value: bool): + def log_transmission_stats(self, value): if self._log_transmission_stats != value: self._log_transmission_stats = value self._diagBytesSent = 0 @@ -172,13 +172,13 @@ def _reset_config_sync_state(self): self._config_sync_flags[i] = 0 # ------------------------------------------------------------------------------- - def _stable_state(self) -> bool: + def _stable_state(self): if not self._sync_pending and self._confirmed_sync: return True return False # ------------------------------------------------------------------------------- - def readline(self, **kwargs) -> bytes: + def readline(self, **kwargs): read = super(PackingSerial, self).readline(**kwargs) read_str = read.decode("UTF-8") @@ -303,7 +303,7 @@ def _play_song_thread(self): self._song_player_thread.start() # ------------------------------------------------------------------------------- - def get_transmission_stats(self) -> dict: + def get_transmission_stats(self): return { 'totalBytes': self._diagBytesSentTotal, 'packedBytes': self._diagBytesSentActualTotal, @@ -343,7 +343,7 @@ def _flush_buffer(self): self._buffer.clear() # ------------------------------------------------------------------------------- - def _process_line_bytes(self, line: bytes): + def _process_line_bytes(self, line): if not self._packing_enabled: return line str_line = line.decode("UTF-8") @@ -373,7 +373,7 @@ def write(self, data): return total_bytes # ------------------------------------------------------------------------------- - def query_config_state(self, force: bool = False): + def query_config_state(self, force = False): """Queries the packing state from the system. Sends command and awaits response""" if self.isOpen(): diff --git a/OctoPrint_MeatPack/song_player.py b/OctoPrint_MeatPack/song_player.py index 991db99..abdf77c 100644 --- a/OctoPrint_MeatPack/song_player.py +++ b/OctoPrint_MeatPack/song_player.py @@ -9,7 +9,7 @@ } -def get_note_freq(note: str, octave: int) -> int: +def get_note_freq(note, octave): return int(round(BaseNotes[note] * (2**(octave-1)))) @@ -47,7 +47,7 @@ def get_note_freq(note: str, octave: int) -> int: ) -def get_note_str(freq: int, length: int): +def get_note_str(freq, length): if freq < 0: freq = 0 elif freq > 20000: @@ -61,7 +61,7 @@ def get_note_str(freq: int, length: int): return "M300 S{} P{} \n".format(str(freq), str(length)) -def get_song_in_gcode() -> list: +def get_song_in_gcode(): out = list() for note in MeatBallSongNotes: note_str = note[0] diff --git a/README.md b/README.md index 2a62792..e662d38 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Getting to the **meat** of g-code. Easy, fast, effective, and automatic g-code c ## Firmware with MeatPack Support: -* Marlin (merged Jan. 25, 2021) - check to make sure the build you are using has the `MEATPACK` option enabled during build. Some build servers do not have this enabled, so if the plugin does not work or it fails to connnect, this is likely why. +* Marlin (merged Jan. 25, 2021) - this is still being tested. It is officially merged, but check to make sure the build you are using has the `MEATPACK` option enabled during build. Some build servers do not have this enabled, so if the plugin does not work or it fails to connnect, this is likely why. * Prusa (official build reviewing support, unofficial build with support available at https://github.com/scottmudge/Prusa-Firmware-MeatPack) ## OctoPrint Support: -Should be compatible with any OctoPrint installation providing access to the `serial_factory_hook()`. According to the API documentation, this wasintoruced in OctoPrint version 1.2. As far as Python is concerned, version 1.5.9 should be compatible back to 2.7 (only tested from 3.5 onward), but it is **highly** recommended to update to Python 3 if you have not yet done so. +Should be compatible with any OctoPrint installation providing access to the `serial_factory_hook()`. According to the API documentation, this wasintoruced in OctoPrint version 1.2. As far as Python is concerned, version 1.5.14 should be compatible back to 2.7, but it is **highly** recommended to update to Python 3 if you have not yet done so. -## Current Features (v1.5.9) +## Current Features (v1.5.14) 1. Fully working g-code compression ("MeatPack") support for compatible printer firmwares. Marlin FW now officially supprots MeatPack, but **[NOTE]** until **Prusa** approves these changes, please find builds of the official Prusa Firmware with compression support here: https://github.com/scottmudge/Prusa-Firmware-MeatPack 2. Added extra data to the "State" side-bar content, updated in real time. It shows transmission statistics: diff --git a/setup.py b/setup.py index 0d18bcc..b0c3ce6 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ plugin_name = "OctoPrint-MeatPack" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "1.5.9" +plugin_version = "1.5.14" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module