jneilliii / OctoPrint-BedLevelVisualizer

MIT License
373 stars 82 forks source link

[FR]: Adjust Z-range Color Bars #332

Closed dryphi closed 3 years ago

dryphi commented 3 years ago

I recently started using the bed visualizer and it's a neat tool.

For me, the default Z range (-2 to 2) is too large to view small aberrations. A range of -0.5 to 0.5 is better for me but I understand this will vary by printer / print bed / user. Using plotly I figured out how to adjust the Z-range (Axes - Range - Z) but the colormap on the right does not adjust along with the new Z range. I can't figure out how to adjust the Color Bars to match the new Z-range. It should adjust automatically IMO but it doesn't.

Can we set a custom Z-range within the plugin itself? In this way the Color Bars would be adjusted as well and we wouldn't have to use plotly at all.

Thanks

jneilliii commented 3 years ago

You mean this one that already exists?

image

dryphi commented 3 years ago

You mean this one that already exists?

image

Ah, yes. Great. does it adjust the color mapping as well? Also looks like you need to update your mesh again to view the new graph?

EDIT: works perfect after refreshing. Thanks

jneilliii commented 3 years ago

Yeah, looks like you found it.

dryphi commented 3 years ago

Would be nice if there was a way to refresh the graph without reloading the page. For instance if you wanted view the current stored values without running a full ABL, or while a print was running.

jneilliii commented 3 years ago

I think you can actually switch tabs and it will re-draw when you switch back, no need to do a full refresh.

dryphi commented 3 years ago

I think you can actually switch tabs and it will re-draw when you switch back, no need to do a full refresh.

Doesn't seem to for me but I'll double check. The other graphs do refresh though.

Would it be useful to add a "redraw" or "refresh" button? For me, it would be, as I could see the currently stored values without releveling. Also then I could view the new graph (with the current mesh values) after doing something simple like adjusting the Z-limits.

jneilliii commented 3 years ago

Are you using stored mesh in eeprom?

dryphi commented 3 years ago

Are you using stored mesh in eeprom?

Yes I believe so. I'm using the community firmware on a CR6

jneilliii commented 3 years ago

It may make sense to add a refresh button, but the graph will redraw when switching tabs within OctoPrint, the data may not change from any changes that you've performed from the printer directly until you run the next level process though (assuming you're using the setting in the plugin to Save Mesh). If your firmware does support storing the mesh in EEPROM, then you could potentially use the M420 V command in the plugin's settings to graph the mesh that gets created whenever and wherever the mesh is created. It just depends if your firmware returns the mesh data with that command or not. Then it just loads the mesh from EEPROM reporting and doesn't do a full probing process.

dryphi commented 3 years ago

Then it just loads the mesh from EEPROM reporting and doesn't do a full probing process.

Yes exactly. That's the idea. I just want to refresh the graph along with any changes I've made within the OctoPrint plugin (e.g. changing the Z-limits). Currently there's no way to refresh the graph without reprobing. Reprobing is what I want to avoid if I'm happy with the mesh and would just like to view the mesh currently stored in EEPROM and/or refresh the graph itself.

dryphi commented 3 years ago

but the graph will redraw when switching tabs within OctoPrint,

Even if you just change something in the plugin like the Z-limits or edit the mesh outside of the plugin?

What if you generate a mesh on the printer itself using the controls in the firmware? Then you run OctoPrint and this plugin with a mesh already stored in EEPROM. How do you view the graph in that case? If there's some G-code that will grab the mesh values, great, but then how do you make the plugin draw a graph?

Should be a button that just generates the graph using the last values used. Simple. It could also grab the currently stored EEPROM mesh values. Or this could be a separate button. Both would be useful IMO.

jneilliii commented 3 years ago

That's what I'm trying to explain. If your firmware supports it the command M420 V should give you the mesh report from EEPROM and the plugin can use it. So in the plugin's settings for the mesh put in M420 V and it will graph whatever was the last stored mesh in EEPROM. A custom button can be added in the plugin's settings as well to run the probing process outside of the update mesh button. You can also update your start gcode and add the line M118 E1 BEDLEVELVISUALIZER just prior to the leveling command and that should also allow automatic updating of the graph on the plugin side, assuming once again your firmware supports the M118 command. Not all firmware is equal or enabled all the same features as others so I cannot tell you what you have the capabilities of using within the plugin.

dryphi commented 3 years ago

A custom button can be added in the plugin's settings as well to run the probing process outside of the update mesh button.

You can add a custom button? Cool!

I added a button labeled "Grab Mesh from EEPROM" and the only command is M420 V. Is that correct? Can't tell if it's working or not though. Would be nice if it would echo "Grabbing data" so I can tell it's doing something. Does that command disable auto-leveling? Do I need to add M420 S1 somewhere to enable bed leveling after I run this?

Although creating my own button is an awesome feature, I imagine grabbing the current EEPROM mesh data would be a feature useful to many other people and should perhaps become a standard button.

dryphi commented 3 years ago

You can also update your start gcode and add the line M118 E1 BEDLEVELVISUALIZER just prior to the leveling command and that should also allow automatic updating of the graph on the plugin side, assuming once again your firmware supports the M118 command. Not all firmware is equal or enabled all the same features as others so I cannot tell you what you have the capabilities of using within the plugin.

Are you sure 'M118 E1 BEDLEVELVISUALIZER' is the correct G-code? It just echos "BEDVISUALIZER". https://marlinfw.org/docs/gcode/M118.html

jneilliii commented 3 years ago

I added a button labeled "Grab Mesh from EEPROM" and the only command is M420 V. Is that correct?

You should probably add the @BEDLEVELVIUALIZER command just prior to the M420 V, that way the plugin is instructed to collect mesh data. I was suggesting that you use that command for the update mesh button, not necessarily having a custom button specifically for it. I've tried to leave the plugin as open as possible to work with as many firmware variants as possible.

Are you sure 'M118 E1 BEDLEVELVISUALIZER' is the correct G-code? It just echos "BEDVISUALIZER".

That is correct, but just after that command you should have a G29 T or whatever command you use to probe/report mesh data. The M118 command is just telling the plugin again to start collecting the mesh data that it uses to graph. You should notice on the plugin's tab that when that message is received by your printer that the "processing" happens until an ok is received after the probing process.

dryphi commented 3 years ago

I was suggesting that you use that command for the update mesh button, not necessarily having a custom button specifically for it.

But that would defeat the purpose. I'm trying to avoid doing the probing routine if there's already a mesh stored in EEPROM that I'm happy with. But I'd still like to see the graph for that mesh.

Are you sure 'M118 E1 BEDLEVELVISUALIZER' is the correct G-code? It just echos "BEDVISUALIZER".

That is correct, but just after that command you should have a G29 T or whatever command you use to probe/report mesh data. The M118 command is just telling the plugin again to start collecting the mesh data that it uses to graph.

Is there an @ missing in that G-code then?

jneilliii commented 3 years ago

I'm trying to avoid doing the probing routine if there's already a mesh stored in EEPROM that I'm happy with. But I'd still like to see the graph for that mesh.

open the plugin's settings and put this in...

image

add a custom button that runs these commands and call it "probe my bed" or something else that makes sense to you.

@BEDLEVELVISUALIZER
G29 T

Press the update mesh button to load stored EEPROM mesh data. Press the custom "probe my bed" button to actually run a probing process.

dryphi commented 3 years ago

open the plugin's settings and put this in...

You have the right idea but that's backwards from how I'm envisioning it. I like the default "Update Mesh" button. I want to keep that as it is. I use that frequently. I adjusted the temps, but that's about the only changes I made to the default G-code in the "Update Mesh" button.

However I added a custom button that runs M420 V already. It's working fine. See post: https://github.com/jneilliii/OctoPrint-BedLevelVisualizer/issues/332#issuecomment-745798040

Now I'm just trying to determine what you meant about the M118 command...

jneilliii commented 3 years ago

I understand now. If you use a custom button for the M420 V command, if you want the mesh to update in the graph you also need to add @BEDLEVELVISUALIZER right before it. This basically tells the plugin, get ready you are about to get the mesh report from firmware.

The M118 command was just an aside relative to automatically updating the graph if your start gcode in your slicer runs probing every print. If you don't do that then you can just ignore that comment altogether. There are some users that run probing every print, and the M118 command allows for it to collect the mesh data to graph, even if printing from SD card.

dryphi commented 3 years ago

I understand now. If you use a custom button for the M420 V command, if you want the mesh to update in the graph you also need to add @BEDLEVELVISUALIZER right before it. This basically tells the plugin, get ready you are about to get the mesh report from firmware.

The M118 command was just an aside relative to automatically updating the graph if your start gcode in your slicer runs probing every print. If you don't do that then you can just ignore that comment altogether. There are some users that run probing every print, and the M118 command allows for it to collect the mesh data to graph, even if printing from SD card.

Perfect thanks! Okay I see. Well if I have the "Grab Mesh from EEPROM" button then I won't need the M118 because I'll essentially be doing the same thing anyway. In fact I could probably even run the "grab mesh" code while something was printing from the SD card. Thanks for your patience 👍

dryphi commented 3 years ago

The Move command doesn't seem to work. How do I move the button? I'd like it centered under the other one.

jneilliii commented 3 years ago

Move command? Unfortunately, I don't think I have the ability to position the buttons in the plugin currently. Please open a new issue/feature request if you'd like that implemented. It will probably be a while before I get a chance to even look at it.