Skip to content

Conversation

@Surion79
Copy link

@Surion79 Surion79 commented May 16, 2023

Due to the errors with G28 and homing override, I created this PR. This PR consists of two parts:

  • Changes in source code (main.cpp)
  • Functional documentation (described in this PR text)

I added a new part of looking through the API calls for a macro called _KNOMI_STATUS instead of G28 and BED_MESH_CALIBRATE.

It is NOT backwards compatible with the "original" version!
The new _KNOMI_STATUS macro would need to look like this

[gcode_macro _KNOMI_STATUS] 
variable_homing: False  
variable_probing: False  
gcode:  

with this it is now generally possible to set the status whereever it is needed.
Therefore just add the following lines where it is appropriate:

SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=True
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=False

if you use a homing_override you can add it like this: (this is just a technical example!)

SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True
G28
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False

This does not require a G28 override which is not possible when using homing_override.

My KNOMI display ships in a couple days, so i wasn't able to test this with a KNOMI display.

@Surion79 Surion79 changed the title added interface to macro KNOMI_STATUS added interface to macro _KNOMI_STATUS May 16, 2023
@Cyondil
Copy link

Cyondil commented May 18, 2023

I have the Knomi and tested your PR and it doesn't seem to work at all for either homing or probing

First, the variables of true and false need to have the first letter capitalized (True/False) or else Klipper throws up an error.

For homing, still issues with it not updating the status on the Knomi even with the above fix. Seems like G28 is going to be tougher nut to crack.

For probing, this also does not seem to work. I use KAMP so I was able to get it to work by adding the variable under the KAMP cfg and adding the below lines to the beginning and end of the KAMP bed mesh macro. When I pointed them to the _KNOMI_STATUS it also did not reflect correctly.
SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=True
SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=False

Not much of someone who digs into code. but seems to me that there is something specifically looking for the combo of BED_MESH_CALIBRATE/G28 and the variable switch.

@Surion79
Copy link
Author

Surion79 commented May 18, 2023

I have the Knomi and tested your PR and it doesn't seem to work at all for either homing or probing

First, the variables of true and false need to have the first letter capitalized (True/False) or else Klipper throws up an error.

For homing, still issues with it not updating the status on the Knomi even with the above fix. Seems like G28 is going to be tougher nut to crack.

For probing, this also does not seem to work. I use KAMP so I was able to get it to work by adding the variable under the KAMP cfg and adding the below lines to the beginning and end of the KAMP bed mesh macro. When I pointed them to the _KNOMI_STATUS it also did not reflect correctly. SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=True SET_GCODE_VARIABLE MACRO=BED_MESH_CALIBRATE VARIABLE=probing VALUE=False

Not much of someone who digs into code. but seems to me that there is something specifically looking for the combo of BED_MESH_CALIBRATE/G28 and the variable switch.

Thanks, i updated the documentation.
Although i did not grasp your other issue. Can you give a full example of your code where you put it? You commented code, which is not part of my documentation

I just added 1 additional iteration to the original code. so the original documentation still is valid with all it stuff what works and what not.

@Cyondil
Copy link

Cyondil commented May 18, 2023

Editing this comment because I missed the fact you made changes to the codebase itself. Just one of those days here and I realized now what changes you made. Retracting my previous comments as it looks as if you have everything already covered in your code changes. No further comments. Only thing that would be nice is if BTT would release a guide to update the firmware more easily!

@Surion79
Copy link
Author

Editing this comment because I missed the fact you made changes to the codebase itself. Just one of those days here and I realized now what changes you made. Retracting my previous comments as it looks as if you have everything already covered in your code changes. No further comments. Only thing that would be nice is if BTT would release a guide to update the firmware more easily!

have you tried to update the firmware with this fix? does it work? my display takes some time until it arrives

@littleferris
Copy link

Thank you for this, it seems like the homing one works, but the probing does not. Just testing in the console.

@Surion79
Copy link
Author

Surion79 commented May 19, 2023

Thank you for this, it seems like the homing one works, but the probing does not. Just testing in the console.

Have you compiled the firmware and upgraded the knomi display with it?
Can you do it again? i updated it based on your feedback.

You can't set both value to true, otherwise, always the last check "wins".

btw: Old style is no longer working with last commit, as i replaced just the related sections with _KNOMI_STATUS

@Cyondil
Copy link

Cyondil commented May 20, 2023

Editing this comment because I missed the fact you made changes to the codebase itself. Just one of those days here and I realized now what changes you made. Retracting my previous comments as it looks as if you have everything already covered in your code changes. No further comments. Only thing that would be nice is if BTT would release a guide to update the firmware more easily!

have you tried to update the firmware with this fix? does it work? my display takes some time until it arrives

Yeah that's the piece I was missing. I compiled the new firmware with the fix but haven't tried installing it yet. Got tied up with a few things and I'm hoping to get back to it within the next day or so and will report back! I need.to dig up if they have a method to install the firmware as I was running I to dead ends when I tried before, but didn't have a lot of time to spend with it.

Copy link

@Cyondil Cyondil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the code and it did not work. After digging through, I think I see the issue. You originally created a new httpswitch (5) that referenced the new _KNOMI_STATUS macro.

After this recent change where you removed the httpswitch = 5 and then changed the httpswitch =4 and httpswitch = 3 to focus on the _KNOMI_STATUS macro, it broke. It looks like now what happens, in lines 986 and 988, it's still looking for the G0028 and BED_MESH_CALIBRATE to trigger these switches. I edited the code to replace G0028 and BED_MESH_CALIBRATE with _KNOMI_STATUS and then compiled and uploaded the firmware. Both Homing and Probing now show correctly on the display.

Since httpswitch =5 is no longer required the lines 989 and 990 can now be removed as well.

Once I made these changes, compiled and uploaded the firmware, I'm no able to successfully see that Knomi changes for both homing AND probing! Now I just need to figure out how I can change the colors from red to blue. :)

Screenshot attached for reference.
Screenshot 2023-05-20 112755

@Surion79
Copy link
Author

Surion79 commented May 20, 2023

@Cyondil Thanks! Unfortunately i have not my KNOMI yet, so I couldn't test the changes.
I updated the file accordingly and commited it, so it should be now working. As replacement

Copy link
Author

@Surion79 Surion79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i removed http switch 5, so it should not be added and kept as in original. other stuff i changed accordingly. should work now like this

Copy link

@Cyondil Cyondil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good and have been tested as working with the new macro. No recursive issues with homing.

@miweimann
Copy link

hello, i want to test this also. Please can you tell me how to compile and how to load this firmware onto my Knomi. i have tried with ESP-Flasher, but no success. Maybe also the compiled firmware isn´t ok. So i need your help please.

@Cyondil
Copy link

Cyondil commented May 23, 2023

hello, i want to test this also. Please can you tell me how to compile and how to load this firmware onto my Knomi. i have tried with ESP-Flasher, but no success. Maybe also the compiled firmware isn´t ok. So I need your help please.

Easiest is to use VSCode with the Platform.io extension. With the Knomi connected to your computer in boot mode (hold the boot button while plugging it in and release once powered on), you build and then upload using the Platform.io extension.

@miweimann
Copy link

thanks, it worked now. good job

@Paliomalakas
Copy link

which files sould we upload?

@SrgntBallistic
Copy link

BTT has instructions on how to compile here:
https://bigtreetech.github.io/docs/KNOMI.html#customize-ui

@Paliomalakas
Copy link

Paliomalakas commented May 29, 2023 via email

@SrgntBallistic
Copy link

I was able to get this working.

I am currently using the G28 override as I don't have a homing_override.

@appleimperio
Copy link

This works great. Thank you!

@acosano
Copy link

acosano commented Jul 1, 2023

Hi. I run into the same problem. I have a G28 and Homing override and would like to implement your solution. How to get your branch as I can'tfigure it out. Thanks in advance

@appleimperio
Copy link

@acosano At the top of this page click on from Surion79:Knomi_Status_Macro. that will take you to the branch
Screenshot 2023-07-02 at 8 32 08 AM

@acosano
Copy link

acosano commented Jul 2, 2023

So easy. Thanks for that. I will try it this morning. I'm not able to get this to compile. Is there a compiled version that Ijust can upload to the screen?

@3DMat
Copy link

3DMat commented Jul 20, 2023

solved by changing the source code because the package you download still uses the old configuration even if you update the knomi with vscode MASTER FILE NOT UPDATED WITH THE VERSION YOU WRITE

@ah-banny
Copy link

@Surion79 and @Cyondil

thank you very much for your work.
It worked very well on my Voron2.4. now the [quad_gantry_level] doesn't work yet.
But hopefully I can still do that ;)

@Ybalrid
Copy link

Ybalrid commented Sep 10, 2023

Hey, I like this idea!

Something like this may solve the configuration I and another user are experiencing with KAMP and BED_MESH_CALIBRATE (see issue #25 )

@BoothyBoothy
Copy link

Hi Surion79, many thanks for all your hard work on this. I have not tried this on any of my V2s because they now have tap. It does work a treat on my recent Minion upgrade with a Klicky Probe attached. However, for some reason the Knomi finish print macro (usually a green tick icon) does not seem to present itself when the print finishes? Any thoughts?

Thanks again for all your efforts. Best wishes Boothy

Copy link

@TheSin- TheSin- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't the accepted yet? This is a much cleaner way over all!

@bigtreetech
Copy link
Owner

Thank you very much for your PR.
Inspired by this PR, the latest version of firmware has been implemented using this method.
https://github.com/bigtreetech/KNOMI/tree/firmware
https://github.com/bigtreetech/KNOMI/blob/master/KNOMI.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.