|
@@ -8,6 +8,8 @@
|
8
|
8
|
#include "stepper.h"
|
9
|
9
|
#include "ConfigurationStore.h"
|
10
|
10
|
|
|
11
|
+int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
|
|
12
|
+
|
11
|
13
|
/* Configuration settings */
|
12
|
14
|
int plaPreheatHotendTemp;
|
13
|
15
|
int plaPreheatHPBTemp;
|
|
@@ -122,13 +124,11 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
|
122
|
124
|
#ifndef REPRAPWORLD_KEYPAD
|
123
|
125
|
volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
|
124
|
126
|
#else
|
125
|
|
-volatile uint16_t buttons;//Contains the bits of the currently pressed buttons (extended).
|
|
127
|
+volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shiftregister values
|
126
|
128
|
#endif
|
127
|
|
-
|
128
|
129
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
129
|
130
|
uint32_t blocking_enc;
|
130
|
131
|
uint8_t lastEncoderBits;
|
131
|
|
-int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
|
132
|
132
|
uint32_t encoderPosition;
|
133
|
133
|
#if (SDCARDDETECT > 0)
|
134
|
134
|
bool lcd_oldcardstatus;
|
|
@@ -410,7 +410,7 @@ static void lcd_move_z()
|
410
|
410
|
if (current_position[Z_AXIS] > Z_MAX_POS)
|
411
|
411
|
current_position[Z_AXIS] = Z_MAX_POS;
|
412
|
412
|
encoderPosition = 0;
|
413
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], 60, active_extruder);
|
|
413
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS]/60, active_extruder);
|
414
|
414
|
lcdDrawUpdate = 1;
|
415
|
415
|
}
|
416
|
416
|
if (lcdDrawUpdate)
|
|
@@ -736,21 +736,39 @@ menu_edit_type(float, float52, ftostr52, 100)
|
736
|
736
|
menu_edit_type(unsigned long, long5, ftostr5, 0.01)
|
737
|
737
|
|
738
|
738
|
#ifdef REPRAPWORLD_KEYPAD
|
739
|
|
- static void reprapworld_keypad_move_y_down() {
|
740
|
|
- encoderPosition = 1;
|
741
|
|
- move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
742
|
|
- lcd_move_y();
|
743
|
|
- }
|
744
|
|
- static void reprapworld_keypad_move_y_up() {
|
745
|
|
- encoderPosition = -1;
|
746
|
|
- move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
747
|
|
- lcd_move_y();
|
748
|
|
- }
|
749
|
|
- static void reprapworld_keypad_move_home() {
|
750
|
|
- //enquecommand_P((PSTR("G28"))); // move all axis home
|
751
|
|
- // TODO gregor: move all axis home, i have currently only one axis on my prusa i3
|
752
|
|
- enquecommand_P((PSTR("G28 Y")));
|
753
|
|
- }
|
|
739
|
+ static void reprapworld_keypad_move_z_up() {
|
|
740
|
+ encoderPosition = 1;
|
|
741
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
742
|
+ lcd_move_z();
|
|
743
|
+ }
|
|
744
|
+ static void reprapworld_keypad_move_z_down() {
|
|
745
|
+ encoderPosition = -1;
|
|
746
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
747
|
+ lcd_move_z();
|
|
748
|
+ }
|
|
749
|
+ static void reprapworld_keypad_move_x_left() {
|
|
750
|
+ encoderPosition = -1;
|
|
751
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
752
|
+ lcd_move_x();
|
|
753
|
+ }
|
|
754
|
+ static void reprapworld_keypad_move_x_right() {
|
|
755
|
+ encoderPosition = 1;
|
|
756
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
757
|
+ lcd_move_x();
|
|
758
|
+ }
|
|
759
|
+ static void reprapworld_keypad_move_y_down() {
|
|
760
|
+ encoderPosition = 1;
|
|
761
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
762
|
+ lcd_move_y();
|
|
763
|
+ }
|
|
764
|
+ static void reprapworld_keypad_move_y_up() {
|
|
765
|
+ encoderPosition = -1;
|
|
766
|
+ move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
|
|
767
|
+ lcd_move_y();
|
|
768
|
+ }
|
|
769
|
+ static void reprapworld_keypad_move_home() {
|
|
770
|
+ enquecommand_P((PSTR("G28"))); // move all axis home
|
|
771
|
+ }
|
754
|
772
|
#endif
|
755
|
773
|
|
756
|
774
|
/** End of menus **/
|
|
@@ -877,17 +895,29 @@ void lcd_update()
|
877
|
895
|
if (lcd_next_update_millis < millis())
|
878
|
896
|
{
|
879
|
897
|
#ifdef ULTIPANEL
|
880
|
|
- #ifdef REPRAPWORLD_KEYPAD
|
881
|
|
- if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
|
882
|
|
- reprapworld_keypad_move_y_down();
|
883
|
|
- }
|
884
|
|
- if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
|
885
|
|
- reprapworld_keypad_move_y_up();
|
886
|
|
- }
|
887
|
|
- if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
|
888
|
|
- reprapworld_keypad_move_home();
|
889
|
|
- }
|
890
|
|
- #endif
|
|
898
|
+ #ifdef REPRAPWORLD_KEYPAD
|
|
899
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) {
|
|
900
|
+ reprapworld_keypad_move_z_up();
|
|
901
|
+ }
|
|
902
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) {
|
|
903
|
+ reprapworld_keypad_move_z_down();
|
|
904
|
+ }
|
|
905
|
+ if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) {
|
|
906
|
+ reprapworld_keypad_move_x_left();
|
|
907
|
+ }
|
|
908
|
+ if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) {
|
|
909
|
+ reprapworld_keypad_move_x_right();
|
|
910
|
+ }
|
|
911
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) {
|
|
912
|
+ reprapworld_keypad_move_y_down();
|
|
913
|
+ }
|
|
914
|
+ if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) {
|
|
915
|
+ reprapworld_keypad_move_y_up();
|
|
916
|
+ }
|
|
917
|
+ if (REPRAPWORLD_KEYPAD_MOVE_HOME) {
|
|
918
|
+ reprapworld_keypad_move_home();
|
|
919
|
+ }
|
|
920
|
+ #endif
|
891
|
921
|
if (encoderDiff)
|
892
|
922
|
{
|
893
|
923
|
lcdDrawUpdate = 1;
|
|
@@ -973,22 +1003,21 @@ void lcd_buttons_update()
|
973
|
1003
|
#if BTN_ENC > 0
|
974
|
1004
|
if((blocking_enc<millis()) && (READ(BTN_ENC)==0))
|
975
|
1005
|
newbutton |= EN_C;
|
976
|
|
- #endif
|
977
|
|
- #ifdef REPRAPWORLD_KEYPAD
|
978
|
|
- // for the reprapworld_keypad
|
979
|
|
- uint8_t newbutton_reprapworld_keypad=0;
|
980
|
|
- WRITE(SHIFT_LD,LOW);
|
981
|
|
- WRITE(SHIFT_LD,HIGH);
|
982
|
|
- for(int8_t i=0;i<8;i++) {
|
983
|
|
- newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
|
984
|
|
- if(READ(SHIFT_OUT))
|
985
|
|
- newbutton_reprapworld_keypad|=(1<<7);
|
986
|
|
- WRITE(SHIFT_CLK,HIGH);
|
987
|
|
- WRITE(SHIFT_CLK,LOW);
|
988
|
|
- }
|
989
|
|
- newbutton |= ((~newbutton_reprapworld_keypad) << REPRAPWORLD_BTN_OFFSET); //invert it, because a pressed switch produces a logical 0
|
990
|
|
- #endif
|
991
|
1006
|
buttons = newbutton;
|
|
1007
|
+ #ifdef REPRAPWORLD_KEYPAD
|
|
1008
|
+ // for the reprapworld_keypad
|
|
1009
|
+ uint8_t newbutton_reprapworld_keypad=0;
|
|
1010
|
+ WRITE(SHIFT_LD,LOW);
|
|
1011
|
+ WRITE(SHIFT_LD,HIGH);
|
|
1012
|
+ for(int8_t i=0;i<8;i++) {
|
|
1013
|
+ newbutton_reprapworld_keypad = newbutton_reprapworld_keypad>>1;
|
|
1014
|
+ if(READ(SHIFT_OUT))
|
|
1015
|
+ newbutton_reprapworld_keypad|=(1<<7);
|
|
1016
|
+ WRITE(SHIFT_CLK,HIGH);
|
|
1017
|
+ WRITE(SHIFT_CLK,LOW);
|
|
1018
|
+ }
|
|
1019
|
+ buttons_reprapworld_keypad=~newbutton_reprapworld_keypad; //invert it, because a pressed switch produces a logical 0
|
|
1020
|
+ #endif
|
992
|
1021
|
#else //read it from the shift register
|
993
|
1022
|
uint8_t newbutton=0;
|
994
|
1023
|
WRITE(SHIFT_LD,LOW);
|