Skip to content
This repository has been archived by the owner on May 16, 2020. It is now read-only.

Added Klipper support #29

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ac33159
Added Klipper memes
mcm001 Sep 24, 2018
3afba8a
Added comments
mcm001 Sep 24, 2018
fdaec91
fixed indent
mcm001 Sep 24, 2018
18f7c26
whackamole
mcm001 Sep 24, 2018
33fbefa
oofOuchMyJson
mcm001 Sep 24, 2018
d055b88
maybe
mcm001 Sep 24, 2018
d8c79df
no me gusta Vim - rolled back indents
mcm001 Sep 24, 2018
5fed225
Update __init__.py
mcm001 Sep 24, 2018
2325e53
Update __init__.py
mcm001 Sep 24, 2018
834e90f
its working for me...
mcm001 Sep 24, 2018
3b13826
Confirmed working with Octoprint, test code commented out
mcm001 Sep 24, 2018
8926edb
Quotation mark
mcm001 Sep 24, 2018
9b8fa54
Fixed line 37 indentation
mcm001 Sep 25, 2018
e47cbab
Indentation fixed
mcm001 Sep 25, 2018
be276e1
Added MK52 Mode
mcm001 Sep 25, 2018
c6d9d0c
MK52 Mode support added
mcm001 Sep 25, 2018
fb0ee3b
MK52 Mode support maybe
mcm001 Sep 25, 2018
6165bc0
Update __init__.py
mcm001 Sep 25, 2018
7888aaf
Fixed syntax
mcm001 Sep 25, 2018
a123d43
Git commit for mk52 testing
mcm001 Sep 25, 2018
ef4424c
Fixed indentation errors
mcm001 Sep 25, 2018
cfcdfb6
Added standoffs
mcm001 Sep 25, 2018
019dd7c
Fixed variable names
mcm001 Sep 25, 2018
66c3e83
Removed unused variables
mcm001 Sep 25, 2018
427d538
Update __init__.py
mcm001 Sep 25, 2018
37c0a96
Update PrusaMeshMap_settings.jinja2
mcm001 Sep 25, 2018
ff02afa
Testing Mode
mcm001 Sep 28, 2018
9a1df7a
Updated test mode
mcm001 Sep 28, 2018
eb0660e
added an error
mcm001 Sep 29, 2018
fca6912
Fixed induced error
mcm001 Sep 29, 2018
87ab913
try clearing the screen after saving klipper fig to fix range bar glitch
mcm001 Oct 1, 2018
2f082a3
add more plt clears to fix glitch
mcm001 Oct 1, 2018
1956e2c
added 2nd subplot with contourf
mcm001 Oct 1, 2018
5f93b32
added 2nd color bar
mcm001 Oct 1, 2018
45f8b6e
Added moure features to contourf including mk52 sheet
mcm001 Oct 1, 2018
af4cd81
Added standoffs, tweaked contourf stuff
mcm001 Oct 1, 2018
9b695ba
inverted y axis
mcm001 Oct 1, 2018
72c6a77
Tight layout
mcm001 Oct 1, 2018
861fea5
Tight layout
mcm001 Oct 1, 2018
d49060f
remove tight lahyout
mcm001 Oct 1, 2018
6ab1de2
try tight layout
mcm001 Oct 1, 2018
a49b274
Merge branch 'master' of https://github.com/mcm001/OctoPrint-PrusaMes…
mcm001 Oct 4, 2018
23fd132
Disabled testing mode
mcm001 Oct 4, 2018
a4c9708
set default bed level gcode to Klipper bed_mesh_map
mcm001 Oct 4, 2018
445f934
Added switchable mode
mcm001 Oct 5, 2018
7b9f14e
added test mode switch
mcm001 Oct 5, 2018
ae3687b
fixed a typo
mcm001 Oct 5, 2018
0a5124d
more UI fixes
mcm001 Oct 5, 2018
25a7f6a
More changes to UI
mcm001 Oct 5, 2018
6608bcc
fixed function call
mcm001 Oct 5, 2018
379030c
Fixed self.get_current_settings()["pluginTestingMode"]
mcm001 Oct 5, 2018
bf95725
fixed typo with self
mcm001 Oct 5, 2018
4eedfd0
reversed array
mcm001 Oct 13, 2018
b31af29
fixed the silly flip, fixed bicubic/contourf reversal
mcm001 Nov 26, 2018
5fcee70
syntax error fixed
mcm001 Nov 26, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Confirmed working with Octoprint, test code commented out
  • Loading branch information
mcm001 committed Sep 24, 2018
commit 3b138260d3b29b85ba1b6d582cfc0e08e109b2d6
21 changes: 16 additions & 5 deletions octoprint_PrusaMeshMap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import json



class PrusameshmapPlugin(octoprint.plugin.SettingsPlugin,
octoprint.plugin.AssetPlugin,
octoprint.plugin.TemplatePlugin,
Expand Down Expand Up @@ -84,16 +85,17 @@ def get_update_information(self):
)

##~~ GCode Received hook


def mesh_level_check(self, comm, line, *args, **kwargs):
if re.match(r"^( -?\d+.\d+)+$", line):
self.mesh_level_responses.append(line)
self._logger.info("FOUND: " + line)
self.mesh_level_generate() #meme
return line
elif line.startswith("mesh_map_output"):
elif line.startswith(""mesh_map_output"):
klipper_json_line = line
self._logger.info("Klipper meme aquired. Ready the matplotlibs: " + line)
self._logger.info("Klipper line found. Ready the matplotlibs: " + line)
self.generate_graph_klipper_mode(klipper_json_line)
return line
else:
Expand All @@ -102,7 +104,11 @@ def mesh_level_check(self, comm, line, *args, **kwargs):
# Klipper mode heatmap generation. Above brig's stuff because it's better :D

def generate_graph_klipper_mode(self,klipper_json_line):
#Remove the first 16 charicters of the line and import to a dictionary

self._logger.info("Processing in Klipper mode...")
#Remove the first 16 charicters of the line and import to a dictionary
#use this line for testing
#klipper_json_line = 'mesh_map_output {"max_point": [212.0, 204.0], "z_positions": [[-0.12499999999999833, -0.10999999999999777, -0.09750000000000203, -0.1399999999999989, -0.2200000000000043], [0.014999999999995128, 0.02749999999999797, 0.012499999999997402, -0.016249999999997766, -0.0500000000000026], [0.02749999999999797, 0.03250000000000053, 0.02875000000000394, 0.046250000000002234, 0.034999999999998255], [0.04000000000000081, 0.07750000000000223, 0.07999999999999996, 0.0787500000000011, 0.08124999999999882], [-0.01000000000000345, 0.05249999999999655, 0.11750000000000138, 0.11750000000000138, 0.10250000000000081]], "xy_offset": [24.0, 5.0], "min_point": [2.0, 0.0]}'
klipper_json_line = klipper_json_line[16:]
jsonDict = json.loads(klipper_json_line)
xyOffset = jsonDict["xy_offset"]
Expand Down Expand Up @@ -142,7 +148,10 @@ def generate_graph_klipper_mode(self,klipper_json_line):
x, y = np.meshgrid(x,y)

#Plot all of the things, including the mk52 back
img = mpimg.imread(r'C:\Users\matth\Documents\GitHub\OctoPrint-PrusaMeshMap\octoprint_PrusaMeshMap\static\img\mk52_steel_sheet.png')


img = mpimg.imread(self.get_asset_folder() + '/img/mk52_steel_sheet.png')
#img = mpimg.imread(r'C:\Users\matth\Documents\GitHub\OctoPrint-PrusaMeshMap\octoprint_PrusaMeshMap\static\img\mk52_steel_sheet.png')
plt.imshow(img, extent=[sheet_left_x, sheet_right_x, sheet_front_y, sheet_back_y], interpolation="lanczos", cmap=plt.cm.get_cmap('viridis'))

#plot the interpolated mesh, bar, and probed points
Expand All @@ -156,7 +165,9 @@ def generate_graph_klipper_mode(self,klipper_json_line):
plt.ylabel("Y Axis (mm)")

# Save our graph as an image in the current directory.
fig.savefig(self.get_asset_folder() + '/img/heatmap.png', bbox_inches="tight")
plt.savefig(self.get_asset_folder() + '/img/heatmap.png', bbox_inches="tight")
#plt.savefig('/home/pi/heatmap.png', bbox_inches="tight")

self._logger.info("Heatmap updated")


Expand Down