Skip to content

Commit

Permalink
Read info abouy abrasive material and high-flow nozzle
Browse files Browse the repository at this point in the history
  • Loading branch information
fiksupojka committed Sep 3, 2024
1 parent dcb8f7b commit 9e174a1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pybgcode/pybgcode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def read_metadata(gcodefile: FILEWrapper, type: str = 'printer'):
"support_material", "ironing", "quiet_percent_present",
"quiet_left_present", "quiet_change_in_present", "normal_percent_present",
"normal_left_present", "normal_change_in_present", "layer_info_present",
"max_layer_z", "objects_info", "extruder_colour"]
"max_layer_z", "objects_info", "extruder_colour", "filament_abrasive",
"nozzle_high_flow"]


def filter_connect_metadata(output: dict) -> dict:
Expand All @@ -157,7 +158,7 @@ def filter_connect_metadata(output: dict) -> dict:

def read_connect_metadata(wrapper: FILEWrapper):
"""Read metadata from binary gcode file."""
output = {'print': None, 'thumbnails': [], 'printer': None}
output: dict = {'print': {}, 'thumbnails': [], 'printer': {}}

# read file header
res, header = get_header(wrapper)
Expand Down Expand Up @@ -185,7 +186,7 @@ def read_connect_metadata(wrapper: FILEWrapper):
if res != EResult.Success:
raise ResultError(res)
output['printer'] = dict(
metadata_block.raw_data) if metadata_block else None
metadata_block.raw_data) if metadata_block else {}
elif block_header.type == 4:
# print metdata - we need them
metadata_block = PrintMetadataBlock()
Expand All @@ -194,8 +195,7 @@ def read_connect_metadata(wrapper: FILEWrapper):
if res != EResult.Success:
raise ResultError(res)
output['print'] = dict(
metadata_block.raw_data) if metadata_block else None
return filter_connect_metadata(output)
metadata_block.raw_data) if metadata_block else {}
elif block_header.type == 5:
# thumbnails block
thumbnail_block = ThumbnailBlock()
Expand Down

0 comments on commit 9e174a1

Please sign in to comment.