-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get UBL's G29 P1 (Automated Probing) working again. #6150
Conversation
Incorrect optimizations of data types and ternary operators caused some issues.
What does this mean? // We can't do lcd_setstatuspgm() without having it continue; |
I don't know the full answer. This is something that needs to be better understood. But trying to use lcd_setstatuspgm() to output a message on the LCD Panel some how causes UBL to think the Encoder Wheel has been clicked. And as a result of calling lcd_setstatuspgm(), the UBL logic thinks it should continue.... So... Just to get the G29 P1 automated probing going (and the G26 Mesh Validation Pattern also), I'm not doing any lcd_setstatuspgm() calls until this is better understood. |
Ok. I will investigate the cause by observing the code, and then fix it. |
So… Is it your observation that using Note that if you call |
Yes... It maybe this is at the root of the problem. I should check and see if that is causing it.
Yes... The 99 was just to make sure no other routine declared itself as 'more important'. But I never got to the point of having to use the lcd_reset_alert_level(). After calling the lcd_setstatuspgm() the code thought the Encoder Wheel was clicked and continued. |
Also... Here is something else that is interesting... This logic is going to break once we understand and change what is going on inside lcd_setstatuspgm(). But I did end up getting lcd_setstatuspgm() to work in G26_Mesh_Validation_Tool.cpp. But... It most certainly is not how we want it to be. By calling it multiple times and letting it discard a message... I can get it to do what is needed: do {
if (ubl_lcd_clicked()) { // Check if the user wants to stop the Mesh Validation
#if ENABLED(ULTRA_LCD)
lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), (uint8_t) 99);
lcd_quick_feedback();
#endif
while (!ubl_lcd_clicked()) { // Wait until the user is done pressing the
idle(); // Encoder Wheel if that is why we are leaving
lcd_setstatuspgm(PSTR(" "), (uint8_t) 99);
}
while ( ubl_lcd_clicked()) { // Wait until the user is done pressing the
idle(); // Encoder Wheel if that is why we are leaving
lcd_setstatuspgm(PSTR("Unpress Wheel "), (uint8_t) 99);
}
goto LEAVE;
} (I fully understand this needs to be re-done. I was just trying to get G29 P1 and G26 working again. And probably... the #endif should be moved down to enclose all of the lcd_setstatuspgm() calls.) |
- lcd_setstatuspgm(PSTR(" "), (uint8_t) 99);
+ lcd_reset_alert_level();
+ lcd_setstatuspgm(PSTR("")); |
Oh!!!! OK! I'll try that in the morning. My printer is busy printing right now! |
Cool. Yep, |
The first patch is posted as #6152. |
Also... Can you give me some higher level guidance about what you want me to do to UBL so that it handles things similar to M600. I might be able to start that work tomorrow. |
Let's take a look at a sample of do {
// "Wait for filament extrude"
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_EXTRUDE);
// Extrude filament to get into hotend
destination[E_AXIS] += FILAMENT_CHANGE_EXTRUDE_LENGTH;
RUNPLAN(FILAMENT_CHANGE_EXTRUDE_FEEDRATE);
stepper.synchronize();
// Show "Extrude More" / "Resume" menu and wait for reply
KEEPALIVE_STATE(PAUSED_FOR_USER);
wait_for_user = false;
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_OPTION);
while (filament_change_menu_response == FILAMENT_CHANGE_RESPONSE_WAIT_FOR) idle(true);
KEEPALIVE_STATE(IN_HANDLER);
// Keep looping if "Extrude More" was selected
} while (filament_change_menu_response == FILAMENT_CHANGE_RESPONSE_EXTRUDE_MORE);
This is more-or-less the cleanest way to interface with the LCD controller. Just let the LCD menu code set the current state of the UI, and have the You can see, for example, how some of the LCD screen handlers for |
Wow! I only skimmed this because I'm watching a movie with friends and we have a few empty wine bottles sitting on the coffee table. But for sure, I'm going to re-read this in the morning before I start figuring out how to warm over the UBL code's interface to the LCD Panel. Incidentally.... You might have noticed the mesh_edit() functions are right next to the babystep functions. I was trying to copy how they did things. But something is different and the numbers on the LCD Screen don't get updated if I just count on the ultralcd.cpp to call the function and update things. Right now... the G29 P4 has to call mesh_edit() to force the numbers to get updated. I tried copying what void _lcd_babystep_z() { _lcd_babystep(Z_AXIS, PSTR(MSG_BABYSTEPPING_Z)); }
void lcd_babystep_z() { lcd_goto_screen(_lcd_babystep_z); babysteps_done = 0; defer_return_to_status = true; } does, and it doesn't work when ubl_has_control_of_lcd_panel. If you can take a quick look at that and figure it out.... It would help me clean things up. Some how... my lcd_fine_tune_mesh() function doesn't keep getting called. |
Don't you know that programmers aren't supposed to have a life? ;P |
No... I didn't know that... But I do know not to try to write code when I've had a few drinks. |
Let's work on getting rid of that. The
So, in order to make sure a screen handler keeps getting called, we have to set For example, for the hotend temperature in As for As for your
Alternatively, the wait-for-mesh-value loop can be in float lcd_mesh_edit() {
lcd_goto_screen(_lcd_mesh_edit);
while (currentScreen == _lcd_mesh_edit) idle();
return mesh_edit_value;
} Then you have In any case, all controller event handling should be in Capisce? |
Incorrect optimizations of data types and ternary operators caused some
issues. All fixed now...