|
@@ -819,7 +819,7 @@ void kill_screen(const char* lcd_msg) {
|
819
|
819
|
|
820
|
820
|
float Mesh_Edit_Value, Mesh_Edit_Accumulator; // We round Mesh_Edit_Value to 2.5 decimal places. So we keep a
|
821
|
821
|
// seperate value that doesn't lose precision.
|
822
|
|
- static int loop_cnt=0, last_seen_bits;
|
|
822
|
+ static int loop_cnt=0, last_seen_bits, UBL_encoderPosition=0;
|
823
|
823
|
|
824
|
824
|
static void _lcd_mesh_fine_tune( const char* msg) {
|
825
|
825
|
static unsigned long last_click=0;
|
|
@@ -827,21 +827,24 @@ void kill_screen(const char* lcd_msg) {
|
827
|
827
|
long int rounded;
|
828
|
828
|
|
829
|
829
|
defer_return_to_status = true;
|
830
|
|
- if (encoderPosition) { // If moving the Encoder wheel very slowly, we just go
|
831
|
|
- if ( (millis() - last_click) > 500L) { // up or down by 1 position
|
832
|
|
- if ( ((int32_t)encoderPosition) > 0 ) {
|
833
|
|
- encoderPosition = 1;
|
834
|
|
- }
|
|
830
|
+
|
|
831
|
+ if (G29_encoderDiff) { // If moving the Encoder wheel very slowly, we just go
|
|
832
|
+ if ( (millis() - last_click) > 200L) { // up or down by 1 position
|
|
833
|
+ if ( G29_encoderDiff > 0 )
|
|
834
|
+ UBL_encoderPosition = 1;
|
835
|
835
|
else {
|
836
|
|
- encoderPosition = (uint32_t) -1;
|
|
836
|
+ UBL_encoderPosition = -1;
|
837
|
837
|
}
|
838
|
|
- }
|
|
838
|
+ } else
|
|
839
|
+ UBL_encoderPosition = G29_encoderDiff * 2;
|
|
840
|
+
|
|
841
|
+ G29_encoderDiff = 0;
|
839
|
842
|
last_click = millis();
|
840
|
843
|
|
841
|
|
- Mesh_Edit_Accumulator += ( (float) ((int32_t)encoderPosition)) * .005 / 2.0 ;
|
|
844
|
+ Mesh_Edit_Accumulator += ( (float) (UBL_encoderPosition)) * .005 / 2.0 ;
|
842
|
845
|
Mesh_Edit_Value = Mesh_Edit_Accumulator;
|
843
|
846
|
encoderPosition = 0;
|
844
|
|
- lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
|
847
|
+ lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
|
845
|
848
|
|
846
|
849
|
rounded = (long int) (Mesh_Edit_Value * 1000.0);
|
847
|
850
|
last_digit = rounded % 5L; //10L;
|
|
@@ -853,21 +856,17 @@ void kill_screen(const char* lcd_msg) {
|
853
|
856
|
if (lcdDrawUpdate) {
|
854
|
857
|
lcd_implementation_drawedit(msg, ftostr43sign( (float) Mesh_Edit_Value ));
|
855
|
858
|
}
|
856
|
|
-
|
857
|
|
- if ( !UBL_has_control_of_LCD_Panel && LCD_CLICKED ) {
|
858
|
|
- UBL_has_control_of_LCD_Panel=1; // We need to lock the normal LCD Panel System outbecause G29 (and G26) are looking for
|
859
|
|
- lcd_return_to_status(); // long presses of the Encoder Wheel and the LCD System goes spastic when that happens.
|
860
|
|
- // We will give back control from those routines when the switch is debounced.
|
861
|
|
- }
|
862
|
859
|
}
|
863
|
860
|
|
864
|
861
|
|
865
|
862
|
void _lcd_mesh_edit() {
|
866
|
863
|
_lcd_mesh_fine_tune( PSTR("Mesh Editor: "));
|
|
864
|
+ defer_return_to_status = true;
|
867
|
865
|
}
|
868
|
866
|
|
869
|
867
|
float lcd_mesh_edit() {
|
870
|
868
|
lcd_goto_screen(_lcd_mesh_edit);
|
|
869
|
+ defer_return_to_status = true;
|
871
|
870
|
return Mesh_Edit_Value;
|
872
|
871
|
}
|
873
|
872
|
|
|
@@ -875,6 +874,7 @@ void kill_screen(const char* lcd_msg) {
|
875
|
874
|
Mesh_Edit_Value = inital;
|
876
|
875
|
Mesh_Edit_Accumulator = inital;
|
877
|
876
|
lcd_goto_screen(_lcd_mesh_edit);
|
|
877
|
+ defer_return_to_status = true;
|
878
|
878
|
return ;
|
879
|
879
|
}
|
880
|
880
|
|
|
@@ -884,6 +884,7 @@ void kill_screen(const char* lcd_msg) {
|
884
|
884
|
|
885
|
885
|
float lcd_z_offset_edit() {
|
886
|
886
|
lcd_goto_screen(_lcd_z_offset_edit);
|
|
887
|
+ defer_return_to_status = true;
|
887
|
888
|
return Mesh_Edit_Value;
|
888
|
889
|
}
|
889
|
890
|
|
|
@@ -891,6 +892,7 @@ void kill_screen(const char* lcd_msg) {
|
891
|
892
|
Mesh_Edit_Value = inital;
|
892
|
893
|
Mesh_Edit_Accumulator = inital;
|
893
|
894
|
lcd_goto_screen(_lcd_z_offset_edit);
|
|
895
|
+ defer_return_to_status = true;
|
894
|
896
|
return ;
|
895
|
897
|
}
|
896
|
898
|
|