Salandora / octoprint-customControl

This plugin makes Custom Controls editable through the OctoPrint WebUI
GNU Affero General Public License v3.0
26 stars 15 forks source link

Need help with command creation #7

Closed yanickr1973 closed 7 years ago

yanickr1973 commented 7 years ago

Hi, I have created a couple of commands and it works great.

I created a command to adjust my Z offset and save to eeprom. Works fine M851 Z-%(offset)s M500

But now I need help for this: I made a button to read the current Z off set with M851 but I have to go in terminal view to see the value

How can I have the value displayed beside my button?

I think it has to do with the regex thing but I don't know how to do this.

Thank you!

Salandora commented 7 years ago

Yes that's right in octoprint this feature is called feedback command ^^ You'll need a regex which checks for the response and a template to show the response. If you provide me with en example of what you get back in Terminal and how it Shall look like beneath your button I can try to give you an regex and template for your feedback command button.

yanickr1973 commented 7 years ago

Thank you for the quick answer

I attached pictures of the treminal screen and the control screen

thank you capture2 capture

Salandora commented 7 years ago

Alright. so Here are the steps they work for me:

  1. Go to Settings -> Custom Control Editor
  2. Edit your "READ CURRENT Z OFFSET" Button (Right click on it -> Edit)
  3. Enable "Use Output"
  4. Regex: "Z Offset : ([-+]?[0-9.]+)" without quote marks
  5. Template: "M851 Z{0}" also without quote marks, this produces outputs like: M851 Z-1
  6. Default Message: I set it to "M851 Z" without ... well you know ;-).
  7. Click Confirm and Save 8. IMPORTANT Restart OctoPrint/The whole Server If this won't help well make screens as you already did ^^ (from the edit dialog).
yanickr1973 commented 7 years ago

You are the king!!!

It works!

Thank you very much

razerraz commented 6 years ago

Hi,

Having troubles to get outputs for another feature, I just copy/paste command/regex/template for this example and it doesn't work. Besides, looking at the code I'm unable to figure out how this work

Terminal output : Send: M851 Recv: echo:Probe Z Offset: -0.90 Recv: ok

regex : Probe Z Offset: ([-+]?[0-9.]+)

template (not sure what this is about, I imagine {0) means first valid regex group ?): M851 Z{0}

Default message (not relevant ?) : M851 Z

Octoprint devel branch in sync Thanks

Salandora commented 6 years ago

@razerraz could you provide a serial.log and octoprint.log file please. I checked with M114 (because my Printer does not support M851) and for me it works fine.

Sonsi79 commented 5 years ago

@razerraz could you provide a serial.log and octoprint.log file please. I checked with M114 (because my Printer does not support M851) and for me it works fine.

Could you please post your config for output of Z by using M114? Im trying but did not getting work:

Send: M114 Recv: X:0.00 Y:0.00 Z:0.00 E:0.00 Count X:0 Y:0 Z:0

Im trying with... Regex: Z:([-+]?[0-9.]+) Template: Z:{0} Default Message: Position Z

EDIT: MY FAULT, AFTER RESTART IT WORKS :-)