Skip to content

Commit

Permalink
Version 1.5.14
Browse files Browse the repository at this point in the history
- removed all type hinting for 2.7
  • Loading branch information
scottmudge committed Jan 27, 2021
1 parent 5bc0565 commit a741f96
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions OctoPrint_MeatPack/meatpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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] == ';':
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -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")

Expand Down
18 changes: 9 additions & 9 deletions OctoPrint_MeatPack/packing_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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():

Expand Down
6 changes: 3 additions & 3 deletions OctoPrint_MeatPack/song_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))))


Expand Down Expand Up @@ -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:
Expand All @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a741f96

Please sign in to comment.