Bläddra i källkod

Merge pull request #10920 from thinkyhead/bf2_misc_cleanups_jun2

[2.0.x] Clean up ST7565, dual endstops homing
Scott Lahteine 7 år sedan
förälder
incheckning
85914423a1
Inget konto är kopplat till bidragsgivarens mejladress

+ 66
- 54
Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp Visa fil

65
 #define HEIGHT 64
65
 #define HEIGHT 64
66
 #define PAGE_HEIGHT 8
66
 #define PAGE_HEIGHT 8
67
 
67
 
68
+#define ST7565_ADC_REVERSE(N)    (0xA0 | ((N) & 0x1))
69
+#define ST7565_BIAS_MODE(N)      (0xA2 | ((N) & 0x1))
70
+#define ST7565_ALL_PIX(N)        (0xA4 | ((N) & 0x1))
71
+#define ST7565_INVERTED(N)       (0xA6 | ((N) & 0x1))
72
+#define ST7565_ON(N)             (0xAE | ((N) & 0x1))
73
+#define ST7565_OUT_MODE(N)       (0xC0 | ((N) & 0x1) << 3)
74
+#define ST7565_POWER_CONTROL(N)  (0x28 | (N))
75
+#define ST7565_V0_RATIO(N)       (0x20 | ((N) & 0x7))
76
+#define ST7565_CONTRAST(N)       (0x81), (N)
77
+
78
+#define ST7565_COLUMN_ADR(N)     (0x10 | ((N) >> 4) & 0xF), (0x00 | ((N) & 0xF))
79
+#define ST7565_PAGE_ADR(N)       (0xB0 | (N))
80
+#define ST7565_START_LINE(N)     (0x40 | (N))
81
+#define ST7565_SLEEP_MODE()      (0xAC)
82
+#define ST7565_NOOP()            (0xE3)
83
+
68
 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
84
 /* init sequence from https://github.com/adafruit/ST7565-LCD/blob/master/ST7565/ST7565.cpp */
69
 static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
85
 static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = {
70
-  U8G_ESC_CS(0),       // disable chip
71
-  U8G_ESC_ADR(0),     // instruction mode
72
-  U8G_ESC_CS(1),      // enable chip
73
-  U8G_ESC_RST(15),    // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
74
-
75
-  0x0A2,              // 0x0A2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
76
-  0x0A0,              // Normal ADC Select (according to Displaytech 64128N datasheet)
86
+  U8G_ESC_CS(0),              // disable chip
87
+  U8G_ESC_ADR(0),             // instruction mode
88
+  U8G_ESC_CS(1),              // enable chip
89
+  U8G_ESC_RST(15),            // do reset low pulse with (15*16)+2 milliseconds (=maximum delay)*/
77
 
90
 
78
-  0x0C8,              // common output mode: set scan direction normal operation/SHL Select, 0x0C0 --> SHL = 0, normal, 0x0C8 --> SHL = 1
79
-  0x040,              // Display start line for Displaytech 64128N
91
+  ST7565_BIAS_MODE(0),        // 0xA2: LCD bias 1/9 (according to Displaytech 64128N datasheet)
92
+  ST7565_ADC_REVERSE(0),      // Normal ADC Select (according to Displaytech 64128N datasheet)
80
 
93
 
81
-  0x028 | 0x04,       // power control: turn on voltage converter
82
-  U8G_ESC_DLY(50),    // delay 50 ms
94
+  ST7565_OUT_MODE(1),         // common output mode: set scan direction normal operation/SHL Select, 0x0C0 --> SHL = 0, normal, 0x0C8 --> SHL = 1
95
+  ST7565_START_LINE(0),       // Display start line for Displaytech 64128N
83
 
96
 
84
-  0x028 | 0x06,       // power control: turn on voltage regulator
85
-  U8G_ESC_DLY(50),    // delay 50 ms
97
+  //0x028 | 0x04,             // power control: turn on voltage converter
98
+  //U8G_ESC_DLY(50),          // delay 50 ms
86
 
99
 
87
-  0x028 | 0x07,       // power control: turn on voltage follower
88
-  U8G_ESC_DLY(50),    // delay 50 ms
100
+  //0x028 | 0x06,             // power control: turn on voltage regulator
101
+  //U8G_ESC_DLY(50),          // delay 50 ms
89
 
102
 
90
-  0x010,              // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
103
+  ST7565_POWER_CONTROL(0x7),  // power control: turn on voltage follower
104
+  U8G_ESC_DLY(50),            // delay 50 ms
91
 
105
 
92
-  0x0A6,              // display normal, bit val 0: LCD pixel off.
106
+  ST7565_V0_RATIO(0),         // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N
93
 
107
 
94
-  0x081,              // set contrast
95
-  0x01E,              // Contrast value. Setting for controlling brightness of Displaytech 64128N
108
+  ST7565_INVERTED(0),         // display normal, bit val 0: LCD pixel off.
96
 
109
 
110
+  ST7565_CONTRAST(0x1E),      // Contrast value. Setting for controlling brightness of Displaytech 64128N
97
 
111
 
98
-  0x0AF,              // display on
112
+  ST7565_ON(1),               // display on
99
 
113
 
100
-  U8G_ESC_DLY(100),   // delay 100 ms
101
-  0x0A5,              // display all points, ST7565
102
-  U8G_ESC_DLY(100),   // delay 100 ms
103
-  U8G_ESC_DLY(100),   // delay 100 ms
104
-  0x0A4,              // normal display
105
-  U8G_ESC_CS(0),      // disable chip
106
-  U8G_ESC_END         // end of sequence
114
+  U8G_ESC_DLY(100),           // delay 100 ms
115
+  ST7565_ALL_PIX(1),          // display all points, ST7565
116
+  U8G_ESC_DLY(100),           // delay 100 ms
117
+  U8G_ESC_DLY(100),           // delay 100 ms
118
+  ST7565_ALL_PIX(0),          // normal display
119
+  U8G_ESC_CS(0),              // disable chip
120
+  U8G_ESC_END                 // end of sequence
107
 };
121
 };
108
 
122
 
109
 static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
123
 static const uint8_t u8g_dev_st7565_64128n_HAL_data_start[] PROGMEM = {
110
-  U8G_ESC_ADR(0),       // instruction mode
111
-  U8G_ESC_CS(1),        // enable chip
112
-  0x010,                // set upper 4 bit of the col adr to 0x10
113
-  0x000,                // set lower 4 bit of the col adr to 0x00. Changed for DisplayTech 64128N
114
-  U8G_ESC_END           // end of sequence
124
+  U8G_ESC_ADR(0),             // instruction mode
125
+  U8G_ESC_CS(1),              // enable chip
126
+  ST7565_COLUMN_ADR(0x00),    // high 4 bits to 0, low 4 bits to 0. Changed for DisplayTech 64128N
127
+  U8G_ESC_END                 // end of sequence
115
 };
128
 };
116
 
129
 
117
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
130
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_on[] PROGMEM = {
118
-  U8G_ESC_ADR(0),       // instruction mode
119
-  U8G_ESC_CS(1),        // enable chip
120
-  0x0AC,                // static indicator off
121
-  0x000,                // indicator register set (not sure if this is required)
122
-  0x0AE,                // display off
123
-  0x0A5,                // all points on
124
-  U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
125
-  U8G_ESC_END           // end of sequence
131
+  U8G_ESC_ADR(0),             // instruction mode
132
+  U8G_ESC_CS(1),              // enable chip
133
+  ST7565_SLEEP_MODE(),        // static indicator off
134
+  //0x000,                    // indicator register set (not sure if this is required)
135
+  ST7565_ON(0),               // display off
136
+  ST7565_ALL_PIX(1),          // all points on
137
+  U8G_ESC_CS(0),              // disable chip, bugfix 12 nov 2014
138
+  U8G_ESC_END                 // end of sequence
126
   };
139
   };
127
 
140
 
128
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
141
 static const uint8_t u8g_dev_st7565_64128n_HAL_sleep_off[] PROGMEM = {
129
-  U8G_ESC_ADR(0),       // instruction mode
130
-  U8G_ESC_CS(1),        // enable chip
131
-  0x0A4,                // all points off
132
-  0x0AF,                // display on
133
-  U8G_ESC_DLY(50),      // delay 50 ms
134
-  U8G_ESC_CS(0),        // disable chip, bugfix 12 nov 2014
135
-  U8G_ESC_END           // end of sequence
142
+  U8G_ESC_ADR(0),             // instruction mode
143
+  U8G_ESC_CS(1),              // enable chip
144
+  ST7565_ALL_PIX(0),          // all points off
145
+  ST7565_ON(1),               // display on
146
+  U8G_ESC_DLY(50),            // delay 50 ms
147
+  U8G_ESC_CS(0),              // disable chip, bugfix 12 nov 2014
148
+  U8G_ESC_END                 // end of sequence
136
 };
149
 };
137
 
150
 
138
-uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
151
+uint8_t u8g_dev_st7565_64128n_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, const uint8_t msg, void *arg) {
139
   switch(msg) {
152
   switch(msg) {
140
     case U8G_DEV_MSG_INIT:
153
     case U8G_DEV_MSG_INIT:
141
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
154
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
146
     case U8G_DEV_MSG_PAGE_NEXT: {
159
     case U8G_DEV_MSG_PAGE_NEXT: {
147
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
160
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
148
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
161
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
149
-        u8g_WriteByte(u8g, dev, 0x0B0 | pb->p.page); /* select current page (ST7565R) */
162
+        u8g_WriteByte(u8g, dev, ST7565_PAGE_ADR(pb->p.page)); /* select current page (ST7565R) */
150
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
163
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
151
-        if ( u8g_pb_WriteBuffer(pb, u8g, dev) == 0 )
152
-          return 0;
164
+        if (!u8g_pb_WriteBuffer(pb, u8g, dev)) return 0;
153
         u8g_SetChipSelect(u8g, dev, 0);
165
         u8g_SetChipSelect(u8g, dev, 0);
154
       }
166
       }
155
       break;
167
       break;
170
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
182
   return u8g_dev_pb8v1_base_fn(u8g, dev, msg, arg);
171
 }
183
 }
172
 
184
 
173
-uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) {
185
+uint8_t u8g_dev_st7565_64128n_HAL_2x_fn(u8g_t *u8g, u8g_dev_t *dev, const uint8_t msg, void *arg) {
174
   switch(msg) {
186
   switch(msg) {
175
     case U8G_DEV_MSG_INIT:
187
     case U8G_DEV_MSG_INIT:
176
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
188
       u8g_InitCom(u8g, dev, U8G_SPI_CLK_CYCLE_400NS);
182
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
194
         u8g_pb_t *pb = (u8g_pb_t *)(dev->dev_mem);
183
 
195
 
184
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
196
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
185
-        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page)); /* select current page (ST7565R) */
197
+        u8g_WriteByte(u8g, dev, ST7565_PAGE_ADR(2 * pb->p.page)); /* select current page (ST7565R) */
186
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
198
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
187
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
199
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)pb->buf);
188
         u8g_SetChipSelect(u8g, dev, 0);
200
         u8g_SetChipSelect(u8g, dev, 0);
189
 
201
 
190
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
202
         u8g_WriteEscSeqP(u8g, dev, u8g_dev_st7565_64128n_HAL_data_start);
191
-        u8g_WriteByte(u8g, dev, 0x0B0 | (2*pb->p.page+1)); /* select current page (ST7565R) */
203
+        u8g_WriteByte(u8g, dev, ST7565_PAGE_ADR(2 * pb->p.page + 1)); /* select current page (ST7565R) */
192
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
204
         u8g_SetAddress(u8g, dev, 1);           /* data mode */
193
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
205
         u8g_WriteSequence(u8g, dev, pb->width, (uint8_t *)(pb->buf)+pb->width);
194
         u8g_SetChipSelect(u8g, dev, 0);
206
         u8g_SetChipSelect(u8g, dev, 0);

+ 1
- 2
Marlin/src/lcd/language/language_cz.h Visa fil

148
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Postupně")
148
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Postupně")
149
 
149
 
150
 #define MSG_LED_CONTROL                     _UxGT("LED Nastavení")
150
 #define MSG_LED_CONTROL                     _UxGT("LED Nastavení")
151
-#define MSG_LEDS_ON                         _UxGT("Světla Zap")
152
-#define MSG_LEDS_OFF                        _UxGT("Světla Vyp")
151
+#define MSG_LEDS                            _UxGT("Světla")
153
 #define MSG_LED_PRESETS                     _UxGT("Světla Předvolby")
152
 #define MSG_LED_PRESETS                     _UxGT("Světla Předvolby")
154
 #define MSG_SET_LEDS_RED                    _UxGT("Červená")
153
 #define MSG_SET_LEDS_RED                    _UxGT("Červená")
155
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Oranžová")
154
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Oranžová")

+ 1
- 2
Marlin/src/lcd/language/language_de.h Visa fil

309
 #define MSG_UBL_STEP_BY_STEP_MENU         _UxGT("Schrittweises UBL")
309
 #define MSG_UBL_STEP_BY_STEP_MENU         _UxGT("Schrittweises UBL")
310
 
310
 
311
 #define MSG_LED_CONTROL                     _UxGT("LED Kontrolle")
311
 #define MSG_LED_CONTROL                     _UxGT("LED Kontrolle")
312
-#define MSG_LEDS_ON                         _UxGT("Licht an")
313
-#define MSG_LEDS_OFF                        _UxGT("Licht aus")
312
+#define MSG_LEDS                            _UxGT("Licht")
314
 #define MSG_LED_PRESETS                     _UxGT("Licht Einstellungen")
313
 #define MSG_LED_PRESETS                     _UxGT("Licht Einstellungen")
315
 #define MSG_SET_LEDS_RED                    _UxGT("Rot")
314
 #define MSG_SET_LEDS_RED                    _UxGT("Rot")
316
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Orange")
315
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Orange")

+ 2
- 5
Marlin/src/lcd/language/language_en.h Visa fil

371
 #ifndef MSG_LED_CONTROL
371
 #ifndef MSG_LED_CONTROL
372
   #define MSG_LED_CONTROL                     _UxGT("LED Control")
372
   #define MSG_LED_CONTROL                     _UxGT("LED Control")
373
 #endif
373
 #endif
374
-#ifndef MSG_LEDS_ON
375
-  #define MSG_LEDS_ON                         _UxGT("Lights On")
376
-#endif
377
-#ifndef MSG_LEDS_OFF
378
-  #define MSG_LEDS_OFF                        _UxGT("Lights Off")
374
+#ifndef MSG_LEDS   
375
+  #define MSG_LEDS                            _UxGT("Lights")
379
 #endif
376
 #endif
380
 #ifndef MSG_LED_PRESETS
377
 #ifndef MSG_LED_PRESETS
381
   #define MSG_LED_PRESETS                     _UxGT("Light Presets")
378
   #define MSG_LED_PRESETS                     _UxGT("Light Presets")

+ 1
- 2
Marlin/src/lcd/language/language_eu.h Visa fil

142
 //#define MSG_UBL_Z_OFFSET_STOPPED          _UxGT("Z-Offset Stopped")
142
 //#define MSG_UBL_Z_OFFSET_STOPPED          _UxGT("Z-Offset Stopped")
143
 //#define MSG_UBL_STEP_BY_STEP_MENU         _UxGT("Step-By-Step UBL")
143
 //#define MSG_UBL_STEP_BY_STEP_MENU         _UxGT("Step-By-Step UBL")
144
 #define MSG_LED_CONTROL                     _UxGT("LED ezarpenak")
144
 #define MSG_LED_CONTROL                     _UxGT("LED ezarpenak")
145
-#define MSG_LEDS_ON                         _UxGT("Argiak piztu")
146
-#define MSG_LEDS_OFF                        _UxGT("Argiak itzali")
145
+#define MSG_LEDS                            _UxGT("Argiak")
147
 #define MSG_LED_PRESETS                     _UxGT("Argi aurrehautaketak")
146
 #define MSG_LED_PRESETS                     _UxGT("Argi aurrehautaketak")
148
 #define MSG_SET_LEDS_RED                    _UxGT("Gorria")
147
 #define MSG_SET_LEDS_RED                    _UxGT("Gorria")
149
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Laranja")
148
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Laranja")

+ 1
- 2
Marlin/src/lcd/language/language_fr.h Visa fil

144
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Pas à pas")
144
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Pas à pas")
145
 
145
 
146
 #define MSG_LED_CONTROL                     _UxGT("Contrôle LED")
146
 #define MSG_LED_CONTROL                     _UxGT("Contrôle LED")
147
-#define MSG_LEDS_ON                         _UxGT("Lumière ON")
148
-#define MSG_LEDS_OFF                        _UxGT("Lumière OFF")
147
+#define MSG_LEDS                            _UxGT("Lumière")
149
 #define MSG_LED_PRESETS                     _UxGT("Préregl. LED")
148
 #define MSG_LED_PRESETS                     _UxGT("Préregl. LED")
150
 #define MSG_SET_LEDS_RED                    _UxGT("Rouge")
149
 #define MSG_SET_LEDS_RED                    _UxGT("Rouge")
151
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Orange")
150
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Orange")

+ 1
- 2
Marlin/src/lcd/language/language_it.h Visa fil

143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL passo passo")
143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL passo passo")
144
 
144
 
145
 #define MSG_LED_CONTROL                     _UxGT("Controllo LED")
145
 #define MSG_LED_CONTROL                     _UxGT("Controllo LED")
146
-#define MSG_LEDS_ON                         _UxGT("Luci On")
147
-#define MSG_LEDS_OFF                        _UxGT("Luci Off")
146
+#define MSG_LEDS                            _UxGT("Luci")
148
 #define MSG_LED_PRESETS                     _UxGT("Preset luci")
147
 #define MSG_LED_PRESETS                     _UxGT("Preset luci")
149
 #define MSG_SET_LEDS_RED                    _UxGT("Rosso")
148
 #define MSG_SET_LEDS_RED                    _UxGT("Rosso")
150
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Arancione")
149
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Arancione")

+ 1
- 2
Marlin/src/lcd/language/language_pt-br.h Visa fil

148
 #define MSG_UBL_Z_OFFSET_STOPPED            _UxGT("Compensação Z parou")
148
 #define MSG_UBL_Z_OFFSET_STOPPED            _UxGT("Compensação Z parou")
149
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL passo a passo")
149
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL passo a passo")
150
 #define MSG_LED_CONTROL                     _UxGT("Controle do LED")
150
 #define MSG_LED_CONTROL                     _UxGT("Controle do LED")
151
-#define MSG_LEDS_ON                         _UxGT("Luz Acesa")
152
-#define MSG_LEDS_OFF                        _UxGT("Luz Apagada")
151
+#define MSG_LEDS                            _UxGT("Luz")
153
 #define MSG_LED_PRESETS                     _UxGT("Configuração da Luz")
152
 #define MSG_LED_PRESETS                     _UxGT("Configuração da Luz")
154
 #define MSG_SET_LEDS_RED                    _UxGT("Luz Vermelha")
153
 #define MSG_SET_LEDS_RED                    _UxGT("Luz Vermelha")
155
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Luz Laranja")
154
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Luz Laranja")

+ 1
- 2
Marlin/src/lcd/language/language_ru.h Visa fil

144
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("Пошаговое UBL")
144
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("Пошаговое UBL")
145
 
145
 
146
 #define MSG_LED_CONTROL                     _UxGT("Настройки LED")
146
 #define MSG_LED_CONTROL                     _UxGT("Настройки LED")
147
-#define MSG_LEDS_ON                         _UxGT("Включить подсветку")
148
-#define MSG_LEDS_OFF                        _UxGT("Выключить подсветку")
147
+#define MSG_LEDS                            _UxGT("Подсветку")
149
 #define MSG_LED_PRESETS                     _UxGT("Предустановки света")
148
 #define MSG_LED_PRESETS                     _UxGT("Предустановки света")
150
 #define MSG_SET_LEDS_RED                    _UxGT("Красный свет")
149
 #define MSG_SET_LEDS_RED                    _UxGT("Красный свет")
151
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Оранжевый свет")
150
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Оранжевый свет")

+ 1
- 2
Marlin/src/lcd/language/language_sk.h Visa fil

153
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Postupne")
153
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("UBL Postupne")
154
 
154
 
155
 #define MSG_LED_CONTROL                     _UxGT("Nastavenie LED")
155
 #define MSG_LED_CONTROL                     _UxGT("Nastavenie LED")
156
-#define MSG_LEDS_ON                         _UxGT("Zapnúť svetlo")
157
-#define MSG_LEDS_OFF                        _UxGT("Vypnúť svetlo")
156
+#define MSG_LEDS                            _UxGT("Svetlo")
158
 #define MSG_LED_PRESETS                     _UxGT("Prednastavené farby")
157
 #define MSG_LED_PRESETS                     _UxGT("Prednastavené farby")
159
 #define MSG_SET_LEDS_RED                    _UxGT("Červená")
158
 #define MSG_SET_LEDS_RED                    _UxGT("Červená")
160
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Oranžová")
159
 #define MSG_SET_LEDS_ORANGE                 _UxGT("Oranžová")

+ 1
- 2
Marlin/src/lcd/language/language_zh_CN.h Visa fil

143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("一步步UBL") // "Step-By-Step UBL"
143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("一步步UBL") // "Step-By-Step UBL"
144
 
144
 
145
 #define MSG_LED_CONTROL                     _UxGT("灯管控制") // "LED Control")
145
 #define MSG_LED_CONTROL                     _UxGT("灯管控制") // "LED Control")
146
-#define MSG_LEDS_ON                         _UxGT("灯亮") // "Lights On")
147
-#define MSG_LEDS_OFF                        _UxGT("灯灭") // "Lights Off")
146
+#define MSG_LEDS                            _UxGT("灯") // "Lights")
148
 #define MSG_LED_PRESETS                     _UxGT("灯预置") // "Light Presets")
147
 #define MSG_LED_PRESETS                     _UxGT("灯预置") // "Light Presets")
149
 #define MSG_SET_LEDS_RED                    _UxGT("红") // "Red")
148
 #define MSG_SET_LEDS_RED                    _UxGT("红") // "Red")
150
 #define MSG_SET_LEDS_ORANGE                 _UxGT("橙") // "Orange")
149
 #define MSG_SET_LEDS_ORANGE                 _UxGT("橙") // "Orange")

+ 1
- 2
Marlin/src/lcd/language/language_zh_TW.h Visa fil

143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("一步步UBL") // "Step-By-Step UBL"
143
 #define MSG_UBL_STEP_BY_STEP_MENU           _UxGT("一步步UBL") // "Step-By-Step UBL"
144
 
144
 
145
 #define MSG_LED_CONTROL                     _UxGT("灯管控制") // "LED Control")
145
 #define MSG_LED_CONTROL                     _UxGT("灯管控制") // "LED Control")
146
-#define MSG_LEDS_ON                         _UxGT("灯亮") // "Lights On")
147
-#define MSG_LEDS_OFF                        _UxGT("灯灭") // "Lights Off")
146
+#define MSG_LEDS                            _UxGT("灯") // "Lights")
148
 #define MSG_LED_PRESETS                     _UxGT("灯预置") // "Light Presets")
147
 #define MSG_LED_PRESETS                     _UxGT("灯预置") // "Light Presets")
149
 #define MSG_SET_LEDS_RED                    _UxGT("红") // "Red")
148
 #define MSG_SET_LEDS_RED                    _UxGT("红") // "Red")
150
 #define MSG_SET_LEDS_ORANGE                 _UxGT("橙") // "Orange")
149
 #define MSG_SET_LEDS_ORANGE                 _UxGT("橙") // "Orange")

+ 2
- 4
Marlin/src/lcd/ultralcd.cpp Visa fil

4255
     void lcd_led_menu() {
4255
     void lcd_led_menu() {
4256
       START_MENU();
4256
       START_MENU();
4257
       MENU_BACK(MSG_MAIN);
4257
       MENU_BACK(MSG_MAIN);
4258
-      if (leds.lights_on)
4259
-        MENU_ITEM(function, MSG_LEDS_OFF, leds.toggle);
4260
-      else
4261
-        MENU_ITEM(function, MSG_LEDS_ON, leds.toggle);
4258
+      bool led_on = leds.lights_on;
4259
+      MENU_ITEM_EDIT_CALLBACK(bool, MSG_LEDS, &led_on, leds.toggle);
4262
       MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
4260
       MENU_ITEM(function, MSG_SET_LEDS_DEFAULT, leds.set_default);
4263
       #if ENABLED(LED_COLOR_PRESETS)
4261
       #if ENABLED(LED_COLOR_PRESETS)
4264
         MENU_ITEM(submenu, MSG_LED_PRESETS, lcd_led_presets_menu);
4262
         MENU_ITEM(submenu, MSG_LED_PRESETS, lcd_led_presets_menu);

+ 1
- 2
Marlin/src/module/endstops.cpp Visa fil

396
 // Check endstops - Could be called from ISR!
396
 // Check endstops - Could be called from ISR!
397
 void Endstops::update() {
397
 void Endstops::update() {
398
 
398
 
399
-  #define SET_BIT_TO(N,B,TF) do{ if (TF) SBI(N,B); else CBI(N,B); }while(0)
400
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
399
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
401
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
400
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
402
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
401
   // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
590
     if (dual_hit) { \
589
     if (dual_hit) { \
591
       _ENDSTOP_HIT(AXIS1, MINMAX); \
590
       _ENDSTOP_HIT(AXIS1, MINMAX); \
592
       /* if not performing home or if both endstops were trigged during homing... */ \
591
       /* if not performing home or if both endstops were trigged during homing... */ \
593
-      if (!stepper.performing_homing || dual_hit == 0x3) \
592
+      if (!stepper.homing_dual_axis || dual_hit == 0x3) \
594
         planner.endstop_triggered(_AXIS(AXIS1)); \
593
         planner.endstop_triggered(_AXIS(AXIS1)); \
595
     } \
594
     } \
596
   }while(0)
595
   }while(0)

+ 45
- 39
Marlin/src/module/motion.cpp Visa fil

1052
     if (DEBUGGING(LEVELING)) {
1052
     if (DEBUGGING(LEVELING)) {
1053
       SERIAL_ECHOPAIR(">>> do_homing_move(", axis_codes[axis]);
1053
       SERIAL_ECHOPAIR(">>> do_homing_move(", axis_codes[axis]);
1054
       SERIAL_ECHOPAIR(", ", distance);
1054
       SERIAL_ECHOPAIR(", ", distance);
1055
-      SERIAL_ECHOPAIR(", ", fr_mm_s);
1056
-      SERIAL_ECHOPAIR(" [", fr_mm_s ? fr_mm_s : homing_feedrate(axis));
1057
-      SERIAL_ECHOLNPGM("])");
1055
+      SERIAL_ECHOPGM(", ");
1056
+      if (fr_mm_s)
1057
+        SERIAL_ECHO(fr_mm_s);
1058
+      else {
1059
+        SERIAL_ECHOPAIR("[", homing_feedrate(axis));
1060
+        SERIAL_CHAR(']');
1061
+      }
1062
+      SERIAL_ECHOLNPGM(")");
1058
     }
1063
     }
1059
   #endif
1064
   #endif
1060
 
1065
 
1262
     }
1267
     }
1263
   #endif
1268
   #endif
1264
 
1269
 
1265
-  const int axis_home_dir =
1270
+  const int axis_home_dir = (
1266
     #if ENABLED(DUAL_X_CARRIAGE)
1271
     #if ENABLED(DUAL_X_CARRIAGE)
1267
-      (axis == X_AXIS) ? x_home_dir(active_extruder) :
1272
+      axis == X_AXIS ? x_home_dir(active_extruder) :
1268
     #endif
1273
     #endif
1269
-    home_dir(axis);
1274
+    home_dir(axis)
1275
+  );
1270
 
1276
 
1271
   // Homing Z towards the bed? Deploy the Z probe or endstop.
1277
   // Homing Z towards the bed? Deploy the Z probe or endstop.
1272
   #if HOMING_Z_WITH_PROBE
1278
   #if HOMING_Z_WITH_PROBE
1274
   #endif
1280
   #endif
1275
 
1281
 
1276
   // Set flags for X, Y, Z motor locking
1282
   // Set flags for X, Y, Z motor locking
1277
-  #if ENABLED(X_DUAL_ENDSTOPS)
1278
-    if (axis == X_AXIS) stepper.set_homing_flag_x(true);
1279
-  #endif
1280
-  #if ENABLED(Y_DUAL_ENDSTOPS)
1281
-    if (axis == Y_AXIS) stepper.set_homing_flag_y(true);
1282
-  #endif
1283
-  #if ENABLED(Z_DUAL_ENDSTOPS)
1284
-    if (axis == Z_AXIS) stepper.set_homing_flag_z(true);
1283
+  #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
1284
+    switch (axis) {
1285
+      #if ENABLED(X_DUAL_ENDSTOPS)
1286
+        case X_AXIS:
1287
+      #endif
1288
+      #if ENABLED(Y_DUAL_ENDSTOPS)
1289
+        case Y_AXIS:
1290
+      #endif
1291
+      #if ENABLED(Z_DUAL_ENDSTOPS)
1292
+        case Z_AXIS:
1293
+      #endif
1294
+      stepper.set_homing_dual_axis(true);
1295
+      default: break;
1296
+    }
1285
   #endif
1297
   #endif
1286
 
1298
 
1287
   // Fast move towards endstop until triggered
1299
   // Fast move towards endstop until triggered
1321
     const bool pos_dir = axis_home_dir > 0;
1333
     const bool pos_dir = axis_home_dir > 0;
1322
     #if ENABLED(X_DUAL_ENDSTOPS)
1334
     #if ENABLED(X_DUAL_ENDSTOPS)
1323
       if (axis == X_AXIS) {
1335
       if (axis == X_AXIS) {
1324
-        const bool lock_x1 = pos_dir ? (endstops.x_endstop_adj > 0) : (endstops.x_endstop_adj < 0);
1325
-        float adj = ABS(endstops.x_endstop_adj);
1326
-        if (pos_dir) adj = -adj;
1327
-        if (lock_x1) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
1328
-        do_homing_move(axis, adj);
1329
-        if (lock_x1) stepper.set_x_lock(false); else stepper.set_x2_lock(false);
1330
-        stepper.set_homing_flag_x(false);
1336
+        const float adj = ABS(endstops.x_endstop_adj);
1337
+        if (pos_dir ? (endstops.x_endstop_adj > 0) : (endstops.x_endstop_adj < 0)) stepper.set_x_lock(true); else stepper.set_x2_lock(true);
1338
+        do_homing_move(axis, pos_dir ? adj : -adj);
1339
+        stepper.set_x_lock(false);
1340
+        stepper.set_x2_lock(false);
1331
       }
1341
       }
1332
     #endif
1342
     #endif
1333
     #if ENABLED(Y_DUAL_ENDSTOPS)
1343
     #if ENABLED(Y_DUAL_ENDSTOPS)
1334
       if (axis == Y_AXIS) {
1344
       if (axis == Y_AXIS) {
1335
-        const bool lock_y1 = pos_dir ? (endstops.y_endstop_adj > 0) : (endstops.y_endstop_adj < 0);
1336
-        float adj = ABS(endstops.y_endstop_adj);
1337
-        if (pos_dir) adj = -adj;
1338
-        if (lock_y1) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
1339
-        do_homing_move(axis, adj);
1340
-        if (lock_y1) stepper.set_y_lock(false); else stepper.set_y2_lock(false);
1341
-        stepper.set_homing_flag_y(false);
1345
+        const float adj = ABS(endstops.y_endstop_adj);
1346
+        if (pos_dir ? (endstops.y_endstop_adj > 0) : (endstops.y_endstop_adj < 0)) stepper.set_y_lock(true); else stepper.set_y2_lock(true);
1347
+        do_homing_move(axis, pos_dir ? adj : -adj);
1348
+        stepper.set_y_lock(false);
1349
+        stepper.set_y2_lock(false);
1342
       }
1350
       }
1343
     #endif
1351
     #endif
1344
     #if ENABLED(Z_DUAL_ENDSTOPS)
1352
     #if ENABLED(Z_DUAL_ENDSTOPS)
1345
       if (axis == Z_AXIS) {
1353
       if (axis == Z_AXIS) {
1346
-        const bool lock_z1 = pos_dir ? (endstops.z_endstop_adj > 0) : (endstops.z_endstop_adj < 0);
1347
-        float adj = ABS(endstops.z_endstop_adj);
1348
-        if (pos_dir) adj = -adj;
1349
-        if (lock_z1) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
1350
-        do_homing_move(axis, adj);
1351
-        if (lock_z1) stepper.set_z_lock(false); else stepper.set_z2_lock(false);
1352
-        stepper.set_homing_flag_z(false);
1354
+        const float adj = ABS(endstops.z_endstop_adj);
1355
+        if (pos_dir ? (endstops.z_endstop_adj > 0) : (endstops.z_endstop_adj < 0)) stepper.set_z_lock(true); else stepper.set_z2_lock(true);
1356
+        do_homing_move(axis, pos_dir ? adj : -adj);
1357
+        stepper.set_z_lock(false);
1358
+        stepper.set_z2_lock(false);
1353
       }
1359
       }
1354
     #endif
1360
     #endif
1361
+    stepper.set_homing_dual_axis(false);
1355
   #endif
1362
   #endif
1356
 
1363
 
1357
   #if IS_SCARA
1364
   #if IS_SCARA
1393
     if (axis == Z_AXIS && STOW_PROBE()) return;
1400
     if (axis == Z_AXIS && STOW_PROBE()) return;
1394
   #endif
1401
   #endif
1395
 
1402
 
1396
-  // Clear z_lift if homing the Z axis
1403
+  // Clear retracted status if homing the Z axis
1397
   #if ENABLED(FWRETRACT)
1404
   #if ENABLED(FWRETRACT)
1398
-    if (axis == Z_AXIS)
1399
-      fwretract.hop_amount = 0.0;
1405
+    if (axis == Z_AXIS) fwretract.hop_amount = 0.0;
1400
   #endif
1406
   #endif
1401
 
1407
 
1402
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1408
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1470
     #endif
1476
     #endif
1471
 
1477
 
1472
     #if ENABLED(DELTA)
1478
     #if ENABLED(DELTA)
1473
-      switch(axis) {
1479
+      switch (axis) {
1474
         #if HAS_SOFTWARE_ENDSTOPS
1480
         #if HAS_SOFTWARE_ENDSTOPS
1475
           case X_AXIS:
1481
           case X_AXIS:
1476
           case Y_AXIS:
1482
           case Y_AXIS:

+ 7
- 10
Marlin/src/module/stepper.cpp Visa fil

87
 block_t* Stepper::current_block = NULL;  // A pointer to the block currently being traced
87
 block_t* Stepper::current_block = NULL;  // A pointer to the block currently being traced
88
 
88
 
89
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
89
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
90
-  bool Stepper::performing_homing = false;
90
+  bool Stepper::homing_dual_axis = false;
91
 #endif
91
 #endif
92
 
92
 
93
 #if HAS_MOTOR_CURRENT_PWM
93
 #if HAS_MOTOR_CURRENT_PWM
166
 uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
166
 uint32_t Stepper::acceleration_time, Stepper::deceleration_time;
167
 
167
 
168
 volatile int32_t Stepper::count_position[NUM_AXIS] = { 0 };
168
 volatile int32_t Stepper::count_position[NUM_AXIS] = { 0 };
169
-volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
169
+int8_t Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
170
 
170
 
171
 #if ENABLED(MIXING_EXTRUDER)
171
 #if ENABLED(MIXING_EXTRUDER)
172
   int32_t Stepper::counter_m[MIXING_STEPPERS];
172
   int32_t Stepper::counter_m[MIXING_STEPPERS];
183
 
183
 
184
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
184
 #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
185
   #define DUAL_ENDSTOP_APPLY_STEP(A,V)                                                                                        \
185
   #define DUAL_ENDSTOP_APPLY_STEP(A,V)                                                                                        \
186
-    if (performing_homing) {                                                                                                  \
186
+    if (homing_dual_axis) {                                                                                                   \
187
       if (A##_HOME_DIR < 0) {                                                                                                 \
187
       if (A##_HOME_DIR < 0) {                                                                                                 \
188
         if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V);    \
188
         if (!(TEST(endstops.state(), A##_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##_motor) A##_STEP_WRITE(V);    \
189
         if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
189
         if (!(TEST(endstops.state(), A##2_MIN) && count_direction[_AXIS(A)] < 0) && !locked_##A##2_motor) A##2_STEP_WRITE(V); \
1144
 HAL_STEP_TIMER_ISR {
1144
 HAL_STEP_TIMER_ISR {
1145
   HAL_timer_isr_prologue(STEP_TIMER_NUM);
1145
   HAL_timer_isr_prologue(STEP_TIMER_NUM);
1146
 
1146
 
1147
-  // Call the ISR
1148
   Stepper::isr();
1147
   Stepper::isr();
1149
 
1148
 
1150
   HAL_timer_isr_epilogue(STEP_TIMER_NUM);
1149
   HAL_timer_isr_epilogue(STEP_TIMER_NUM);
1175
   // We need this variable here to be able to use it in the following loop
1174
   // We need this variable here to be able to use it in the following loop
1176
   hal_timer_t min_ticks;
1175
   hal_timer_t min_ticks;
1177
   do {
1176
   do {
1178
-    // Enable ISRs so the USART processing latency is reduced
1177
+    // Enable ISRs to reduce USART processing latency
1179
     ENABLE_ISRS();
1178
     ENABLE_ISRS();
1180
 
1179
 
1181
     // Run main stepping pulse phase ISR if we have to
1180
     // Run main stepping pulse phase ISR if we have to
1193
 
1192
 
1194
     uint32_t interval =
1193
     uint32_t interval =
1195
       #if ENABLED(LIN_ADVANCE)
1194
       #if ENABLED(LIN_ADVANCE)
1196
-        // Select the closest interval in time
1197
-        MIN(nextAdvanceISR, nextMainISR)
1195
+        MIN(nextAdvanceISR, nextMainISR)  // Nearest time interval
1198
       #else
1196
       #else
1199
-        // The interval is just the remaining time to the stepper ISR
1200
-        nextMainISR
1197
+        nextMainISR                       // Remaining stepper ISR time
1201
       #endif
1198
       #endif
1202
     ;
1199
     ;
1203
 
1200
 
1239
     next_isr_ticks += interval;
1236
     next_isr_ticks += interval;
1240
 
1237
 
1241
     /**
1238
     /**
1242
-     *  The following section must be done with global interrupts disabled.
1239
+     * The following section must be done with global interrupts disabled.
1243
      * We want nothing to interrupt it, as that could mess the calculations
1240
      * We want nothing to interrupt it, as that could mess the calculations
1244
      * we do for the next value to program in the period register of the
1241
      * we do for the next value to program in the period register of the
1245
      * stepper timer and lead to skipped ISRs (if the value we happen to program
1242
      * stepper timer and lead to skipped ISRs (if the value we happen to program

+ 5
- 11
Marlin/src/module/stepper.h Visa fil

63
     static block_t* current_block;  // A pointer to the block currently being traced
63
     static block_t* current_block;  // A pointer to the block currently being traced
64
 
64
 
65
     #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
65
     #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
66
-      static bool performing_homing;
66
+      static bool homing_dual_axis;
67
     #endif
67
     #endif
68
 
68
 
69
     #if HAS_MOTOR_CURRENT_PWM
69
     #if HAS_MOTOR_CURRENT_PWM
143
     //
143
     //
144
     // Current direction of stepper motors (+1 or -1)
144
     // Current direction of stepper motors (+1 or -1)
145
     //
145
     //
146
-    static volatile signed char count_direction[NUM_AXIS];
146
+    static int8_t count_direction[NUM_AXIS];
147
 
147
 
148
     //
148
     //
149
     // Mixing extruder mix counters
149
     // Mixing extruder mix counters
220
       static void microstep_readings();
220
       static void microstep_readings();
221
     #endif
221
     #endif
222
 
222
 
223
+    #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
224
+      FORCE_INLINE static void set_homing_dual_axis(const bool state) { homing_dual_axis = state; }
225
+    #endif
223
     #if ENABLED(X_DUAL_ENDSTOPS)
226
     #if ENABLED(X_DUAL_ENDSTOPS)
224
-      FORCE_INLINE static void set_homing_flag_x(const bool state) { performing_homing = state; }
225
       FORCE_INLINE static void set_x_lock(const bool state) { locked_X_motor = state; }
227
       FORCE_INLINE static void set_x_lock(const bool state) { locked_X_motor = state; }
226
       FORCE_INLINE static void set_x2_lock(const bool state) { locked_X2_motor = state; }
228
       FORCE_INLINE static void set_x2_lock(const bool state) { locked_X2_motor = state; }
227
     #endif
229
     #endif
228
     #if ENABLED(Y_DUAL_ENDSTOPS)
230
     #if ENABLED(Y_DUAL_ENDSTOPS)
229
-      FORCE_INLINE static void set_homing_flag_y(const bool state) { performing_homing = state; }
230
       FORCE_INLINE static void set_y_lock(const bool state) { locked_Y_motor = state; }
231
       FORCE_INLINE static void set_y_lock(const bool state) { locked_Y_motor = state; }
231
       FORCE_INLINE static void set_y2_lock(const bool state) { locked_Y2_motor = state; }
232
       FORCE_INLINE static void set_y2_lock(const bool state) { locked_Y2_motor = state; }
232
     #endif
233
     #endif
233
     #if ENABLED(Z_DUAL_ENDSTOPS)
234
     #if ENABLED(Z_DUAL_ENDSTOPS)
234
-      FORCE_INLINE static void set_homing_flag_z(const bool state) { performing_homing = state; }
235
       FORCE_INLINE static void set_z_lock(const bool state) { locked_Z_motor = state; }
235
       FORCE_INLINE static void set_z_lock(const bool state) { locked_Z_motor = state; }
236
       FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; }
236
       FORCE_INLINE static void set_z2_lock(const bool state) { locked_Z2_motor = state; }
237
     #endif
237
     #endif
247
     // Set the current position in steps
247
     // Set the current position in steps
248
     inline static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
248
     inline static void set_position(const int32_t &a, const int32_t &b, const int32_t &c, const int32_t &e) {
249
       planner.synchronize();
249
       planner.synchronize();
250
-
251
-      // Disable stepper interrupts, to ensure atomic setting of all the position variables
252
       const bool was_enabled = STEPPER_ISR_ENABLED();
250
       const bool was_enabled = STEPPER_ISR_ENABLED();
253
       if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
251
       if (was_enabled) DISABLE_STEPPER_DRIVER_INTERRUPT();
254
-
255
-      // Set position
256
       _set_position(a, b, c, e);
252
       _set_position(a, b, c, e);
257
-
258
-      // Reenable Stepper ISR
259
       if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
253
       if (was_enabled) ENABLE_STEPPER_DRIVER_INTERRUPT();
260
     }
254
     }
261
 
255
 

Laddar…
Avbryt
Spara