Commit c1a533b authored Aug 8, 2021 Verified
1 parent 0f3e938 commit c1a533b Copy full SHA for c1a533b
File tree 14 files changed +179
-54
lines changed
14 files changed +179
-54
lines changed Original file line number Diff line number Diff line change 26
26
27
27
#include " ../gcode.h"
28
28
29
- #if ENABLED(TFT_LVGL_UI)
29
+ #if HAS_TFT_LVGL_UI
30
30
#include " ../../lcd/extui/mks_ui/draw_touch_calibration.h"
31
31
#else
32
32
#include " ../../lcd/menu/menu.h"
37
37
*/
38
38
void GcodeSuite::M995 () {
39
39
40
- #if ENABLED(TFT_LVGL_UI)
40
+ #if HAS_TFT_LVGL_UI
41
41
lv_draw_touch_calibration_screen ();
42
42
#else
43
43
ui.goto_screen (touch_screen_calibration);
Original file line number Diff line number Diff line change 136
136
#endif
137
137
138
138
//
139
- // Misc. Functions
139
+ // Power Supply Control
140
140
//
141
- #define PS_ON_PIN P0_25 // TH3 Connector
141
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
142
+ #ifndef PS_ON_PIN
143
+ #define PS_ON_PIN P0_25 // SERVO
144
+ #endif
145
+ #ifndef KILL_PIN
146
+ #define KILL_PIN P1_29 // Z+
147
+ #define KILL_PIN_STATE HIGH
148
+ #endif
149
+ #endif
142
150
143
151
//
144
152
// Ethernet pins
Original file line number Diff line number Diff line change 215
215
#define FAN_PIN P2_04
216
216
#endif
217
217
218
+ //
219
+ // Power Supply Control
220
+ //
221
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
222
+ #ifndef PS_ON_PIN
223
+ #define PS_ON_PIN P2_00 // SERVO
224
+ #endif
225
+ #ifndef KILL_PIN
226
+ #define KILL_PIN P1_24 // Z+
227
+ #define KILL_PIN_STATE HIGH
228
+ #endif
229
+ #endif
230
+
218
231
//
219
232
// Misc. Functions
220
233
//
Original file line number Diff line number Diff line change 226
226
//
227
227
#define LED_PIN P1_18 // Used as a status indicator
228
228
229
+ //
230
+ // Power Supply Control
231
+ //
232
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
233
+ #ifndef PS_ON_PIN
234
+ #define PS_ON_PIN P2_00 // Suggestion (SERVO)
235
+ #endif
236
+ #ifndef KILL_PIN
237
+ #define KILL_PIN P1_24 // Suggestion (Z+)
238
+ #define KILL_PIN_STATE HIGH
239
+ #endif
240
+ #endif
241
+
229
242
//
230
243
// RGB LED
231
244
//
Original file line number Diff line number Diff line change 147
147
#define TFT_RS_PIN FSMC_RS_PIN
148
148
#endif
149
149
150
- #if ENABLED ( TFT_LVGL_UI )
150
+ #if HAS_TFT_LVGL_UI
151
151
// LVGL
152
152
#define HAS_SPI_FLASH_FONT 1
153
153
#define HAS_GCODE_PREVIEW 1
Original file line number Diff line number Diff line change 195
195
//
196
196
// Misc. Functions
197
197
//
198
- //#define POWER_LOSS_PIN PA1 // PW_SO
199
198
#if ENABLED (BACKUP_POWER_SUPPLY )
200
199
#define POWER_LOSS_PIN PA2 // PW_DET (UPS) MKSPWC
200
+ #else
201
+ //#define POWER_LOSS_PIN PA1 // PW_SO
201
202
#endif
202
203
203
204
/**
217
218
//
218
219
#if ENABLED (PSU_CONTROL )
219
220
#define KILL_PIN PA2 // PW_DET
220
- #define KILL_PIN_INVERTING true
221
+ #define KILL_PIN_STATE HIGH
221
222
//#define PS_ON_PIN PA3 // PW_CN /PW_OFF
222
223
#endif
223
224
Original file line number Diff line number Diff line change 183
183
// Misc. Functions
184
184
//
185
185
#if HAS_TFT_LVGL_UI
186
- //#define MKSPWC
187
- #ifdef MKSPWC
188
- #define SUICIDE_PIN PB2 // Enable MKSPWC SUICIDE PIN
189
- #define SUICIDE_PIN_INVERTING false // Enable MKSPWC PIN STATE
190
- #define KILL_PIN PA2 // Enable MKSPWC DET PIN
191
- #define KILL_PIN_STATE true // Enable MKSPWC PIN STATE
186
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
187
+ #define SUICIDE_PIN PB2 // PW_OFF
188
+ #define SUICIDE_PIN_INVERTING false
189
+ #define KILL_PIN PA2 // PW_DET
190
+ #define KILL_PIN_STATE HIGH
192
191
#endif
193
192
194
193
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
Original file line number Diff line number Diff line change 126
126
127
127
#define FIL_RUNOUT_PIN PB10 // MT_DET
128
128
129
+ //
130
+ // Power Supply Control
131
+ //
132
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
133
+ #ifndef PS_ON_PIN
134
+ #define PS_ON_PIN PA14 // PW_OFF
135
+ #endif
136
+ #ifndef KILL_PIN
137
+ #define KILL_PIN PB10 // PW_DET
138
+ #define KILL_PIN_STATE HIGH
139
+ #endif
140
+ #endif
141
+
129
142
/**
130
143
* _____ _____ _____
131
144
* (BEEPER) PC1 | 1 2 | PC3 (BTN_ENC) (MISO) PB14 | 1 2 | PB13 (SD_SCK) 5V | 1 2 | GND
158
171
#elif ENABLED (MKS_MINI_12864_V3 )
159
172
#define DOGLCD_CS PA4
160
173
#define DOGLCD_A0 PA5
161
- #define LCD_PINS_DC DOGLCD_A0
174
+ #define LCD_PINS_DC DOGLCD_A0
162
175
#define LCD_BACKLIGHT_PIN -1
163
176
#define LCD_RESET_PIN PA6
164
177
#define NEOPIXEL_PIN PA7
189
202
//
190
203
// SD Card
191
204
//
192
- #define SPI_DEVICE 2
193
- #define ONBOARD_SPI_DEVICE 2
205
+ #define SPI_DEVICE 2
206
+ #define ONBOARD_SPI_DEVICE 2
194
207
#define SDSS SD_SS_PIN
195
208
#define SDCARD_CONNECTION ONBOARD
196
209
#define SD_DETECT_PIN PC10
Original file line number Diff line number Diff line change 128
128
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
129
129
130
130
//
131
- // Misc. Functions
131
+ // Power Supply Control
132
132
//
133
- #if HAS_TFT_LVGL_UI
134
- //#define MKSPWC
135
- #ifdef MKSPWC
136
- #define SUICIDE_PIN PB2 // Enable MKSPWC SUICIDE PIN
137
- #define SUICIDE_PIN_INVERTING false // Enable MKSPWC PIN STATE
138
- #define KILL_PIN PA2 // Enable MKSPWC DET PIN
139
- #define KILL_PIN_STATE true // Enable MKSPWC PIN STATE
133
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
134
+ #if HAS_TFT_LVGL_UI
135
+ #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
136
+ #endif
137
+ #ifndef PS_ON_PIN
138
+ #define PS_ON_PIN PB2 // SUICIDE
140
139
#endif
140
+ #ifndef KILL_PIN
141
+ #define KILL_PIN PA2
142
+ #define KILL_PIN_STATE HIGH
143
+ #endif
144
+ #else
145
+ #define SUICIDE_PIN PB2
146
+ #define SUICIDE_PIN_INVERTING false
147
+ #endif
141
148
149
+ //
150
+ // Misc. Functions
151
+ //
152
+ #if HAS_TFT_LVGL_UI
142
153
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
143
154
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
144
155
#define MT_DET_PIN_INVERTING false // LVGL UI filament RUNOUT PIN STATE
Original file line number Diff line number Diff line change 191
191
//#define TEMP_0_CS_PIN PE5 // TC1 - CS1
192
192
//#define TEMP_0_CS_PIN PE6 // TC2 - CS2
193
193
194
+ //
195
+ // Power Supply Control
196
+ //
197
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
198
+ #if HAS_TFT_LVGL_UI
199
+ #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
200
+ #endif
201
+ #ifndef PS_ON_PIN
202
+ #define PS_ON_PIN PB2 // SUICIDE
203
+ #endif
204
+ #ifndef KILL_PIN
205
+ #define KILL_PIN PA2
206
+ #define KILL_PIN_STATE HIGH
207
+ #endif
208
+ #else
209
+ #define SUICIDE_PIN PB2
210
+ #define SUICIDE_PIN_INVERTING false
211
+ #endif
212
+
194
213
//
195
214
// Misc. Functions
196
215
//
197
216
#if HAS_TFT_LVGL_UI
198
- //#define MKSPWC
199
- #ifdef MKSPWC
200
- #define SUICIDE_PIN PB2 // Enable MKSPWC SUICIDE PIN
201
- #define SUICIDE_PIN_INVERTING false // Enable MKSPWC PIN STATE
202
- #define KILL_PIN PA2 // Enable MKSPWC DET PIN
203
- #define KILL_PIN_STATE true // Enable MKSPWC PIN STATE
204
- #endif
205
217
206
218
#define MT_DET_1_PIN PA4 // LVGL UI FILAMENT RUNOUT1 PIN
207
219
#define MT_DET_2_PIN PE6 // LVGL UI FILAMENT RUNOUT2 PIN
Original file line number Diff line number Diff line change 179
179
//#define TEMP_0_CS_PIN PF11 // TC2 - CS2
180
180
181
181
#define POWER_LOSS_PIN PA2 // PW_DET
182
- #define PS_ON_PIN PG11 // PW_OFF
183
182
#define FIL_RUNOUT_PIN PA4 // MT_DET1
184
- //#define FIL_RUNOUT_PIN PE6 // MT_DET2
185
- //#define FIL_RUNOUT_PIN PG14 // MT_DET3
183
+ #define FIL_RUNOUT2_PIN PE6 // MT_DET2
184
+ #define FIL_RUNOUT3_PIN PG14 // MT_DET3
185
+
186
+ //
187
+ // Power Supply Control
188
+ //
189
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
190
+ #if HAS_TFT_LVGL_UI
191
+ #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
192
+ #endif
193
+ #ifndef PS_ON_PIN
194
+ #define PS_ON_PIN PG11 // SUICIDE
195
+ #endif
196
+ #ifndef KILL_PIN
197
+ #define KILL_PIN PA2
198
+ #define KILL_PIN_STATE HIGH
199
+ #endif
200
+ #else
201
+ #define SUICIDE_PIN PG11
202
+ #define SUICIDE_PIN_INVERTING false
203
+ #endif
186
204
187
205
//
188
206
// SD Card
Original file line number Diff line number Diff line change 210
210
//
211
211
// Misc. Functions
212
212
//
213
- #define MT_DET_1 Y_MAX_PIN
214
- #define MT_DET_2 Z_MAX_PIN
215
- #define PW_DET Y_MAX_PIN
216
- #define PW_OFF Z_MAX_PIN
213
+ #define MT_DET_1 PC5 // Y+
214
+ #define MT_DET_2 PB12 // Z+
217
215
218
216
#ifndef FIL_RUNOUT_PIN
219
217
#define FIL_RUNOUT_PIN MT_DET_1
222
220
#define FIL_RUNOUT2_PIN MT_DET_2
223
221
#endif
224
222
225
- #define POWER_LOSS_PIN PW_DET
226
- #define PS_ON_PIN PW_OFF
223
+ //
224
+ // Power Supply Control
225
+ //
226
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
227
+ #ifndef PS_ON_PIN
228
+ #define PS_ON_PIN MT_DET_2 // Z+
229
+ #endif
230
+ #ifndef KILL_PIN
231
+ #define KILL_PIN MT_DET_1 // Y+
232
+ #define KILL_PIN_STATE HIGH
233
+ #endif
234
+ #else
235
+ #define PW_DET MT_DET_1
236
+ #define PW_OFF MT_DET_2
237
+ #define POWER_LOSS_PIN PW_DET
238
+ #define PS_ON_PIN PW_OFF
239
+ #endif
227
240
228
241
// Random Info
229
242
#define USB_SERIAL -1 // USB Serial
Original file line number Diff line number Diff line change 189
189
#define FIL_RUNOUT2_PIN MT_DET_2_PIN
190
190
#endif
191
191
192
- #ifndef POWER_LOSS_PIN
193
- #define POWER_LOSS_PIN PA13 // PW_DET
194
- #endif
195
- #define PS_ON_PIN PB2 // PW_OFF
196
-
197
192
//
198
193
// Enable MKSPWC support
199
194
//
200
195
//#define SUICIDE_PIN PB2
196
+ //#define LED_PIN PB2
201
197
//#define KILL_PIN PA2
202
- //#define KILL_PIN_INVERTING true
198
+ //#define KILL_PIN_STATE HIGH
203
199
204
- //#define LED_PIN PB2
200
+ //
201
+ // Power Supply Control
202
+ //
203
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
204
+ #if HAS_TFT_LVGL_UI
205
+ #error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
206
+ #endif
207
+ #ifndef PS_ON_PIN
208
+ #define PS_ON_PIN PB2 // SUICIDE
209
+ #endif
210
+ #ifndef KILL_PIN
211
+ #define KILL_PIN PA13 // PW_DET
212
+ #define KILL_PIN_STATE HIGH
213
+ #endif
214
+ #else
215
+ #define SUICIDE_PIN PB2
216
+ #define SUICIDE_PIN_INVERTING false
217
+ #endif
218
+
219
+ #ifndef POWER_LOSS_PIN
220
+ #define POWER_LOSS_PIN PA13 // PW_DET
221
+ #endif
205
222
206
223
// Random Info
207
224
#define USB_SERIAL -1 // USB Serial
222
239
223
240
// MKS TEST
224
241
#if ENABLED (MKS_TEST )
225
- #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET
226
- #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
242
+ #define MKS_TEST_POWER_LOSS_PIN PA13 // PW_DET
243
+ #define MKS_TEST_PS_ON_PIN PB2 // PW_OFF
227
244
#endif
228
245
229
246
//
Original file line number Diff line number Diff line change 195
195
//
196
196
// Misc. Functions
197
197
//
198
- //#define POWER_LOSS_PIN PA2 // PW_DET
199
198
//#define PS_ON_PIN PA3 // PW_OFF
200
- //#define SUICIDE_PIN PB2 // Enable MKSPWC support
201
- //#define KILL_PIN PA2 // Enable MKSPWC support
202
- //#define KILL_PIN_INVERTING true // Enable MKSPWC support
203
- //#define LED_PIN PB2
199
+
200
+ //
201
+ // Power Supply Control
202
+ //
203
+ #if ENABLED (PSU_CONTROL ) // MKSPWC
204
+ //#define SUICIDE_PIN PB2 // LED
205
+ //#define KILL_PIN PA2 // PW_DET
206
+ //#define KILL_PIN_STATE HIGH
207
+ #else
208
+ //#define POWER_LOSS_PIN PA2 // PW_DET
209
+ //#define LED_PIN PB2
210
+ #endif
204
211
205
212
#ifndef SDCARD_CONNECTION
206
213
#define SDCARD_CONNECTION ONBOARD
You can’t perform that action at this time.
3 commit comments
javicarrera commentedon Aug 8, 2021
I have an improvement to this PR.
I have working both PWC and UPS together in my set up (Robin Nano 1.2 + PWC 3.0 + UPS).
UPS is controlled by the definition BACK_POWER_SUPPLY. The signal cable from UPS remains not connected, because the PWC is already controlling this pin.
In this way it is possible to raise Z axis in case of power failure.
I have tried it only on LVGL_UI and all features are working:
Just change in pins_MKS_ROBIN_NANO:
#if ENABLED(PSU_CONTROL) // MKSPWC
#if HAS_TFT_LVGL_UI
#error "PSU_CONTROL cannot be used with TFT_LVGL_UI. Disable PSU_CONTROL to continue."
#endif
#ifndef PS_ON_PIN
#define PS_ON_PIN PB2 // PW_OFF
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2 // PW_DET
#define KILL_PIN_STATE HIGH
#endif
#ifdef BACKUP_POWER_SUPPLY
#define POWER_LOSS_PIN KILL_PIN // PW_DET ALLOWS TO USE MKS PWC & UPS TOGETHER - DO NOT PLUG UPS SIGNAL CABLE TO MAIN BOARD
#endif
#else
#ifndef SUICIDE_PIN
#define SUICIDE_PIN PB2 // LVGL UI MKSPWC SUICIDE PIN PB2 - PW_OFF
#define SUICIDE_PIN_INVERTING false // LVGL UI MKSPWC PIN STATE
#endif
#ifndef KILL_PIN
#define KILL_PIN PA2 // LVGL UI MKSPWC PW_DET PIN
#define KILL_PIN_STATE HIGH // LVGL UI MKSPWC PIN STATE
#endif
#ifdef BACKUP_POWER_SUPPLY
#ifndef POWER_LOSS_PIN
#define POWER_LOSS_PIN KILL_PIN // ALLOWS USING BOTH MKS PWC & UPS TOGETHER - DO NOT PLUG UPS SIGNAL CABLE TO MAIN BOARD
#endif
#endif
#endif
I would delete from misc. functions, as are already controlled in previous code.
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PB2 // PW_OFF
thinkyhead commentedon Aug 11, 2021
I feel like I saw this posted elsewhere and even edited it to neaten up the code.
javicarrera commentedon Aug 12, 2021
Yes, sorry it is actually here: #22534. At least for me is working flawlessly.