Browse Source

Merge remote-tracking branch 'upstream/development' into development

croadfeldt 9 years ago
parent
commit
06f767d608

+ 1
- 3
Marlin/ConfigurationStore.cpp View File

@@ -263,8 +263,6 @@ void Config_StoreSettings()  {
263 263
     EEPROM_WRITE_VAR(i, dummy);
264 264
   }
265 265
 
266
-  int storageSize = i;
267
-
268 266
   char ver2[4] = EEPROM_VERSION;
269 267
   int j = EEPROM_OFFSET;
270 268
   EEPROM_WRITE_VAR(j, ver2); // validate data
@@ -446,7 +444,7 @@ void Config_ResetDefault() {
446 444
   float tmp1[] = DEFAULT_AXIS_STEPS_PER_UNIT;
447 445
   float tmp2[] = DEFAULT_MAX_FEEDRATE;
448 446
   long tmp3[] = DEFAULT_MAX_ACCELERATION;
449
-  for (int i = 0; i < NUM_AXIS; i++) {
447
+  for (uint16_t i = 0; i < NUM_AXIS; i++) {
450 448
     axis_steps_per_unit[i] = tmp1[i];
451 449
     max_feedrate[i] = tmp2[i];
452 450
     max_acceleration_units_per_sq_second[i] = tmp3[i];

+ 247
- 289
Marlin/Marlin_main.cpp
File diff suppressed because it is too large
View File


+ 1
- 1
Marlin/cardreader.cpp View File

@@ -489,7 +489,7 @@ void CardReader::updir() {
489 489
   if (workDirDepth > 0) {
490 490
     --workDirDepth;
491 491
     workDir = workDirParents[0];
492
-    for (int d = 0; d < workDirDepth; d++)
492
+    for (uint16_t d = 0; d < workDirDepth; d++)
493 493
       workDirParents[d] = workDirParents[d+1];
494 494
   }
495 495
 }

+ 3
- 2
Marlin/configurator/config/language.h View File

@@ -34,7 +34,6 @@
34 34
 #endif
35 35
 
36 36
 #define PROTOCOL_VERSION "1.0"
37
-#define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
38 37
 
39 38
 #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
40 39
   #define MACHINE_NAME "Ultimaker"
@@ -59,14 +58,16 @@
59 58
   #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html"
60 59
 #else // Default firmware set to Mendel
61 60
   #define MACHINE_NAME "Mendel"
61
+  #define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
62 62
 #endif
63 63
 
64 64
 #ifdef CUSTOM_MENDEL_NAME
65
+  #undef MACHINE_NAME
65 66
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
66 67
 #endif
67 68
 
68 69
 #ifndef MACHINE_UUID
69
-   #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
70
+  #define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
70 71
 #endif
71 72
 
72 73
 

+ 4
- 7
Marlin/dogm_lcd_implementation.h View File

@@ -124,8 +124,6 @@
124 124
 // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
125 125
 // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
126 126
 
127
-int lcd_contrast;
128
-
129 127
 // LCD selection
130 128
 #ifdef U8GLIB_ST7920
131 129
 //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
@@ -143,7 +141,9 @@ U8GLIB_DOGM128 u8g(DOGLCD_CS, DOGLCD_A0);  // HW-SPI Com: CS, A0
143 141
 
144 142
 #include "utf_mapper.h"
145 143
 
146
-char currentfont = 0;
144
+int lcd_contrast;
145
+static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
146
+static char currentfont = 0;
147 147
 
148 148
 static void lcd_setFont(char font_nr) {
149 149
   switch(font_nr) {
@@ -256,9 +256,6 @@ static void _draw_heater_status(int x, int heater) {
256 256
 }
257 257
 
258 258
 static void lcd_implementation_status_screen() {
259
-
260
-  static unsigned char fan_rot = 0;
261
- 
262 259
   u8g.setColorIndex(1); // black on white
263 260
 
264 261
   // Symbols menu graphics, animated fan
@@ -485,7 +482,7 @@ static void _drawmenu_sd(bool isSelected, uint8_t row, const char* pstr, const c
485 482
   lcd_implementation_mark_as_selected(row, isSelected);
486 483
 
487 484
   if (isDir) lcd_print(LCD_STR_FOLDER[0]);
488
-  while (c = *filename) {
485
+  while ((c = *filename)) {
489 486
     n -= lcd_print(c);
490 487
     filename++;
491 488
   }

+ 1
- 5
Marlin/example_configurations/SCARA/Configuration_adv.h View File

@@ -275,13 +275,9 @@
275 275
 
276 276
 #ifdef ADVANCE
277 277
   #define EXTRUDER_ADVANCE_K .0
278
-
279 278
   #define D_FILAMENT 1.75
280 279
   #define STEPS_MM_E 1000
281
-  #define EXTRUSION_AREA (0.25 * D_FILAMENT * D_FILAMENT * 3.14159)
282
-  #define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS]/ EXTRUSION_AREA)
283
-
284
-#endif // ADVANCE
280
+#endif
285 281
 
286 282
 // Arc interpretation settings:
287 283
 #define MM_PER_ARC_SEGMENT 1

+ 10
- 9
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -107,11 +107,11 @@ Here are some standard links for getting your machine calibrated:
107 107
 // Horizontal offset of the universal joints on the carriages.
108 108
 #define DELTA_CARRIAGE_OFFSET 18.0 // mm
109 109
 
110
-// Effective horizontal distance bridged by diagonal push rods.
110
+// Horizontal distance bridged by diagonal push rods when effector is centered.
111 111
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
112 112
 
113 113
 // Print surface diameter/2 minus unreachable space (avoid collisions with vertical towers).
114
-#define DELTA_PRINTABLE_RADIUS 90
114
+#define DELTA_PRINTABLE_RADIUS 140
115 115
 
116 116
 
117 117
 //===========================================================================
@@ -391,10 +391,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
391 391
 #define max_software_endstops true  // If true, axis won't move to coordinates greater than the defined lengths below.
392 392
 
393 393
 // Travel limits after homing (units are in mm)
394
-#define X_MAX_POS 90
395
-#define X_MIN_POS -90
396
-#define Y_MAX_POS 90
397
-#define Y_MIN_POS -90
394
+#define X_MAX_POS DELTA_PRINTABLE_RADIUS
395
+#define X_MIN_POS -DELTA_PRINTABLE_RADIUS
396
+#define Y_MAX_POS DELTA_PRINTABLE_RADIUS
397
+#define Y_MIN_POS -DELTA_PRINTABLE_RADIUS
398 398
 #define Z_MAX_POS MANUAL_Z_HOME_POS
399 399
 #define Z_MIN_POS 0
400 400
 
@@ -441,7 +441,9 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
441 441
   #define LEFT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS
442 442
   #define RIGHT_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
443 443
   #define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
444
-  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS   
444
+  #define FRONT_PROBE_BED_POSITION -DELTA_PROBABLE_RADIUS  
445
+
446
+  #define MIN_PROBE_EDGE 10 // The probe square sides can be no smaller than this      
445 447
 
446 448
   // Non-linear bed leveling will be used.
447 449
   // Compensate by interpolating between the nearest four Z probe values for each point.
@@ -532,7 +534,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
532 534
 #define DEFAULT_RETRACT_ACCELERATION  3000   // E acceleration in mm/s^2 for retracts
533 535
 #define DEFAULT_TRAVEL_ACCELERATION   3000    // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
534 536
 
535
-
536 537
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).
537 538
 // The offset has to be X=0, Y=0 for the extruder 0 hotend (default extruder).
538 539
 // For the other hotends it is their distance from the extruder 0 hotend.
@@ -652,7 +653,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
652 653
 // #define DELTA_CALIBRATION_MENU
653 654
 
654 655
 /**
655
- * I2C PANELS
656
+ * I2C Panels
656 657
  */
657 658
 
658 659
 //#define LCD_I2C_SAINSMART_YWROBOT

+ 2
- 3
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -107,7 +107,6 @@ Here are some standard links for getting your machine calibrated:
107 107
 // Horizontal offset of the universal joints on the carriages.
108 108
 #define DELTA_CARRIAGE_OFFSET 19.5 // mm
109 109
 
110
-
111 110
 // Horizontal distance bridged by diagonal push rods when effector is centered.
112 111
 #define DELTA_RADIUS (DELTA_SMOOTH_ROD_OFFSET-DELTA_EFFECTOR_OFFSET-DELTA_CARRIAGE_OFFSET)
113 112
 
@@ -531,8 +530,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o
531 530
 #define DEFAULT_MAX_FEEDRATE          {500, 500, 500, 25}    // (mm/sec)
532 531
 #define DEFAULT_MAX_ACCELERATION      {9000,9000,9000,10000}    // X, Y, Z, E maximum start speed for accelerated moves. E default values are good for skeinforge 40+, for older versions raise them a lot.
533 532
 
534
-#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E max acceleration in mm/s^2 for printing moves
535
-#define DEFAULT_RETRACT_ACCELERATION  3000   // X, Y, Z and E max acceleration in mm/s^2 for retracts
533
+#define DEFAULT_ACCELERATION          3000    // X, Y, Z and E acceleration in mm/s^2 for printing moves
534
+#define DEFAULT_RETRACT_ACCELERATION  3000   // E acceleration in mm/s^2 for retracts
536 535
 #define DEFAULT_TRAVEL_ACCELERATION   3000    // X, Y, Z acceleration in mm/s^2 for travel (non printing) moves
537 536
 
538 537
 // Offset of the extruders (uncomment if using more than one and relying on firmware to position when changing).

+ 6
- 0
Marlin/language.h View File

@@ -40,12 +40,14 @@
40 40
 #define FIRMWARE_URL "https://github.com/MarlinFirmware/Marlin"
41 41
 
42 42
 #if MB(ULTIMAKER)|| MB(ULTIMAKER_OLD)|| MB(ULTIMAIN_2)
43
+  #undef FIRMWARE_URL
43 44
   #define MACHINE_NAME "Ultimaker"
44 45
   #define FIRMWARE_URL "http://firmware.ultimaker.com"
45 46
 #elif MB(RUMBA)
46 47
   #define MACHINE_NAME "Rumba"
47 48
 #elif MB(3DRAG)
48 49
   #define MACHINE_NAME "3Drag"
50
+  #undef FIRMWARE_URL
49 51
   #define FIRMWARE_URL "http://3dprint.elettronicain.it/"
50 52
 #elif MB(K8200)
51 53
   #define MACHINE_NAME "K8200"
@@ -53,18 +55,22 @@
53 55
   #define MACHINE_NAME "Makibox"
54 56
 #elif MB(SAV_MKI)
55 57
   #define MACHINE_NAME "SAV MkI"
58
+  #undef FIRMWARE_URL
56 59
   #define FIRMWARE_URL "https://github.com/fmalpartida/Marlin/tree/SAV-MkI-config"
57 60
 #elif MB(WITBOX)
58 61
   #define MACHINE_NAME "WITBOX"
62
+  #undef FIRMWARE_URL
59 63
   #define FIRMWARE_URL "http://www.bq.com/gb/downloads-witbox.html"
60 64
 #elif MB(HEPHESTOS)
61 65
   #define MACHINE_NAME "HEPHESTOS"
66
+  #undef FIRMWARE_URL
62 67
   #define FIRMWARE_URL "http://www.bq.com/gb/downloads-prusa-i3-hephestos.html"
63 68
 #else // Default firmware set to Mendel
64 69
   #define MACHINE_NAME "Mendel"
65 70
 #endif
66 71
 
67 72
 #ifdef CUSTOM_MENDEL_NAME
73
+  #undef MACHINE_NAME
68 74
   #define MACHINE_NAME CUSTOM_MENDEL_NAME
69 75
 #endif
70 76
 

+ 9
- 0
Marlin/pins.h View File

@@ -127,10 +127,13 @@
127 127
 #define _E3_PINS
128 128
 
129 129
 #if EXTRUDERS > 1
130
+  #undef _E1_PINS
130 131
   #define _E1_PINS E1_STEP_PIN, E1_DIR_PIN, E1_ENABLE_PIN, HEATER_1_PIN, analogInputToDigitalPin(TEMP_1_PIN),
131 132
   #if EXTRUDERS > 2
133
+    #undef _E2_PINS
132 134
     #define _E2_PINS E2_STEP_PIN, E2_DIR_PIN, E2_ENABLE_PIN, HEATER_2_PIN, analogInputToDigitalPin(TEMP_2_PIN),
133 135
     #if EXTRUDERS > 3
136
+      #undef _E3_PINS
134 137
       #define _E3_PINS E3_STEP_PIN, E3_DIR_PIN, E3_ENABLE_PIN, HEATER_3_PIN, analogInputToDigitalPin(TEMP_3_PIN),
135 138
     #endif
136 139
   #endif
@@ -167,12 +170,18 @@
167 170
 #endif
168 171
 
169 172
 #ifdef DISABLE_MAX_ENDSTOPS
173
+  #undef X_MAX_PIN
174
+  #undef Y_MAX_PIN
175
+  #undef Z_MAX_PIN
170 176
   #define X_MAX_PIN          -1
171 177
   #define Y_MAX_PIN          -1
172 178
   #define Z_MAX_PIN          -1
173 179
 #endif
174 180
 
175 181
 #ifdef DISABLE_MIN_ENDSTOPS
182
+  #undef X_MIN_PIN
183
+  #undef Y_MIN_PIN
184
+  #undef Z_MIN_PIN
176 185
   #define X_MIN_PIN          -1
177 186
   #define Y_MIN_PIN          -1
178 187
   #define Z_MIN_PIN          -1

+ 24
- 2
Marlin/pins_3DRAG.h View File

@@ -4,18 +4,25 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef Z_ENABLE_PIN
7 8
 #define Z_ENABLE_PIN       63
8 9
 
10
+#undef X_MAX_PIN
11
+#undef Y_MAX_PIN
12
+#undef Z_MAX_PIN
9 13
 #define X_MAX_PIN          2
10 14
 #define Y_MAX_PIN          15
11 15
 #define Z_MAX_PIN          -1
12 16
 
17
+#undef SDSS
13 18
 #define SDSS               25//53
14 19
 
15
-#define BEEPER             33
16
-
20
+#undef FAN_PIN
17 21
 #define FAN_PIN            8
18 22
 
23
+#undef HEATER_1_PIN
24
+#undef HEATER_2_PIN
25
+#undef HEATER_BED_PIN
19 26
 #define HEATER_0_PIN       10
20 27
 #define HEATER_1_PIN       12
21 28
 #define HEATER_2_PIN       6
@@ -23,8 +30,15 @@
23 30
 #define HEATER_BED_PIN     9    // BED
24 31
 
25 32
 #if defined(ULTRA_LCD) && defined(NEWPANEL)
33
+  #undef BEEPER
26 34
   #define BEEPER -1
27 35
 
36
+  #undef LCD_PINS_RS
37
+  #undef LCD_PINS_ENABLE
38
+  #undef LCD_PINS_D4
39
+  #undef LCD_PINS_D5
40
+  #undef LCD_PINS_D6
41
+  #undef LCD_PINS_D7
28 42
   #define LCD_PINS_RS 27
29 43
   #define LCD_PINS_ENABLE 29
30 44
   #define LCD_PINS_D4 37
@@ -33,7 +47,15 @@
33 47
   #define LCD_PINS_D7 31
34 48
 
35 49
   // Buttons
50
+  #undef BTN_EN1
51
+  #undef BTN_EN2
52
+  #undef BTN_ENC
36 53
   #define BTN_EN1 16
37 54
   #define BTN_EN2 17
38 55
   #define BTN_ENC 23 //the click
56
+
57
+#else
58
+
59
+  #define BEEPER 33
60
+
39 61
 #endif // ULTRA_LCD && NEWPANEL

+ 9
- 0
Marlin/pins_5DPRINT.h View File

@@ -64,6 +64,15 @@
64 64
 // Microstepping pins
65 65
 // Note that the pin mapping is not from fastio.h
66 66
 // See Sd2PinMap.h for the pin configurations
67
+
68
+#undef X_MS1_PIN
69
+#undef X_MS2_PIN
70
+#undef Y_MS1_PIN
71
+#undef Y_MS2_PIN
72
+#undef Z_MS1_PIN
73
+#undef Z_MS2_PIN
74
+#undef E0_MS1_PIN
75
+#undef E0_MS2_PIN
67 76
 #define X_MS1_PIN 25
68 77
 #define X_MS2_PIN 26
69 78
 #define Y_MS1_PIN 9

+ 24
- 1
Marlin/pins_AZTEEG_X3.h View File

@@ -7,7 +7,30 @@
7 7
 #define FAN_PIN            9 // (Sprinter config)
8 8
 #define HEATER_1_PIN       -1
9 9
 
10
-#ifdef TEMP_STAT_LEDS
10
+//LCD Pins//
11
+
12
+#if defined(VIKI2) || defined(miniVIKI)
13
+ #define BEEPER 33
14
+ // Pins for DOGM SPI LCD Support
15
+ #define DOGLCD_A0  31 
16
+ #define DOGLCD_CS  32 
17
+ #define LCD_SCREEN_ROT_180
18
+ 
19
+ //The encoder and click button 
20
+ #define BTN_EN1 22 
21
+ #define BTN_EN2 7
22
+ #define BTN_ENC 12  //the click switch
23
+ 
24
+ #define SDSS 53
25
+ #define SDCARDDETECT -1 // Pin 49 if using display sd interface   
26
+ 
27
+  #ifdef TEMP_STAT_LEDS
28
+   #define STAT_LED_RED 64
29
+   #define STAT_LED_BLUE 63
30
+  #endif
31
+#endif
32
+
33
+#elif define TEMP_STAT_LEDS
11 34
   #define STAT_LED_RED       6
12 35
   #define STAT_LED_BLUE     11
13 36
 #endif

+ 81
- 2
Marlin/pins_AZTEEG_X3_PRO.h View File

@@ -4,8 +4,36 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
-#define FAN_PIN             9 // (Sprinter config)
7
+#undef FAN_PIN
8
+#define FAN_PIN             6 //Part Cooling System
8 9
 #define BEEPER             33
10
+#define CONTROLLERFAN_PIN   4 //Pin used for the fan to cool motherboard (-1 to disable)
11
+//Fans/Water Pump to cool the hotend cool side.
12
+#define EXTRUDER_0_AUTO_FAN_PIN   5
13
+#define EXTRUDER_1_AUTO_FAN_PIN   5
14
+#define EXTRUDER_2_AUTO_FAN_PIN   5
15
+#define EXTRUDER_3_AUTO_FAN_PIN   5
16
+//
17
+//This section is to swap the MIN and MAX pins because the X3 Pro comes with only
18
+//MIN endstops soldered onto the board. Delta code wants the homing endstops to be 
19
+//the MAX so I swapped them here.
20
+//
21
+ #ifdef DELTA
22
+  #undef X_MIN_PIN
23
+  #undef X_MAX_PIN
24
+  #undef Y_MIN_PIN
25
+  #undef Y_MAX_PIN
26
+  #undef Z_MIN_PIN
27
+  #undef Z_MAX_PIN
28
+
29
+  #define X_MIN_PIN           2
30
+  #define X_MAX_PIN           3
31
+  #define Y_MIN_PIN          15
32
+  #define Y_MAX_PIN          14
33
+  #define Z_MIN_PIN          19
34
+  #define Z_MAX_PIN          18
35
+ #endif
36
+//
9 37
 
10 38
 #define E2_STEP_PIN        23
11 39
 #define E2_DIR_PIN         25
@@ -19,7 +47,10 @@
19 47
 #define E4_DIR_PIN         37
20 48
 #define E4_ENABLE_PIN      42
21 49
 
22
-#define HEATER_1_PIN       -1
50
+#undef HEATER_1_PIN
51
+#undef HEATER_2_PIN
52
+#undef HEATER_3_PIN
53
+#define HEATER_1_PIN        9
23 54
 #define HEATER_2_PIN       16
24 55
 #define HEATER_3_PIN       17
25 56
 #define HEATER_4_PIN        4
@@ -27,8 +58,56 @@
27 58
 #define HEATER_6_PIN        6
28 59
 #define HEATER_7_PIN       11
29 60
 
61
+#undef TEMP_2_PIN
62
+#undef TEMP_3_PIN
30 63
 #define TEMP_2_PIN         12   // ANALOG NUMBERING
31 64
 #define TEMP_3_PIN         11   // ANALOG NUMBERING
32 65
 #define TEMP_4_PIN         10   // ANALOG NUMBERING
33 66
 #define TC1                 4   // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
34 67
 #define TC2                 5   // ANALOG NUMBERING Thermo couple on Azteeg X3Pro
68
+
69
+//
70
+//These Servo pins are for when they are defined. Tested for usage with bed leveling
71
+//on a Delta with 1 servo. Running through the Z servo endstop in code. 
72
+//Physical wire attachment was done on EXT1 on the GND, 5V, and D47 pins.
73
+//
74
+#undef SERVO0_PIN
75
+#undef SERVO1_PIN
76
+#undef SERVO2_PIN
77
+#undef SERVO3_PIN
78
+
79
+#ifdef NUM_SERVOS
80
+  #define SERVO0_PIN         -1
81
+  #if NUM_SERVOS > 1
82
+    #define SERVO1_PIN       -1
83
+    #if NUM_SERVOS > 2
84
+      #define SERVO2_PIN     47
85
+      #if NUM_SERVOS > 3
86
+        #define SERVO3_PIN   -1
87
+      #endif
88
+    #endif
89
+  #endif
90
+#endif
91
+
92
+//LCD Pins//
93
+
94
+#if defined(VIKI2) || defined(miniVIKI)
95
+ #define BEEPER 33
96
+ // Pins for DOGM SPI LCD Support
97
+ #define DOGLCD_A0  44
98
+ #define DOGLCD_CS  45
99
+ #define LCD_SCREEN_ROT_180
100
+ 
101
+ //The encoder and click button
102
+ #define BTN_EN1 22
103
+ #define BTN_EN2 7
104
+ #define BTN_ENC 39  //the click switch
105
+
106
+ #define SDSS 53
107
+ #define SDCARDDETECT 49
108
+ 
109
+ #define KILL_PIN 31
110
+ 
111
+ #define STAT_LED_RED       32
112
+ #define STAT_LED_BLUE      35
113
+#endif

+ 5
- 0
Marlin/pins_BAM_DICE_DUE.h View File

@@ -4,8 +4,13 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef FAN_PIN
7 8
 #define FAN_PIN             9 // (Sprinter config)
9
+
10
+#undef HEATER_1_PIN
8 11
 #define HEATER_1_PIN       -1
9 12
 
13
+#undef TEMP_0_PIN
14
+#undef TEMP_1_PIN
10 15
 #define TEMP_0_PIN          9 // ANALOG NUMBERING
11 16
 #define TEMP_1_PIN         11 // ANALOG NUMBERING

+ 13
- 0
Marlin/pins_FELIX2.h View File

@@ -4,13 +4,23 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef X_MAX_PIN
8
+#undef Y_MAX_PIN
9
+#undef Z_MAX_PIN
7 10
 #define X_MAX_PIN          -1
8 11
 #define Y_MAX_PIN          -1
9 12
 #define Z_MAX_PIN          -1
10 13
 
14
+#undef Y2_STEP_PIN
15
+#undef Y2_DIR_PIN
16
+#undef Y2_ENABLE_PIN
11 17
 #define Y2_STEP_PIN        -1
12 18
 #define Y2_DIR_PIN         -1
13 19
 #define Y2_ENABLE_PIN      -1
20
+
21
+#undef Z2_STEP_PIN
22
+#undef Z2_DIR_PIN
23
+#undef Z2_ENABLE_PIN
14 24
 #define Z2_STEP_PIN        -1
15 25
 #define Z2_DIR_PIN         -1
16 26
 #define Z2_ENABLE_PIN      -1
@@ -19,11 +29,14 @@
19 29
 #define E1_DIR_PIN         34
20 30
 #define E1_ENABLE_PIN      30
21 31
 
32
+#undef SDPOWER
22 33
 #define SDPOWER             1
23 34
 
35
+#undef FAN_PIN
24 36
 #define FAN_PIN             9 // (Sprinter config)
25 37
 #define PS_ON_PIN          12
26 38
 
39
+#undef HEATER_1_PIN
27 40
 #define HEATER_1_PIN        7 // EXTRUDER 2
28 41
 
29 42
 #if defined(ULTRA_LCD) && defined(NEWPANEL)

+ 3
- 0
Marlin/pins_HEPHESTOS.h View File

@@ -4,5 +4,8 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef FAN_PIN
7 8
 #define FAN_PIN             9 // (Sprinter config)
9
+
10
+#undef HEATER_1_PIN
8 11
 #define HEATER_1_PIN       -1

+ 23
- 0
Marlin/pins_PRINTRBOARD.h View File

@@ -59,6 +59,8 @@
59 59
 #define TEMP_1_PIN         -1
60 60
 #define TEMP_2_PIN         -1
61 61
 
62
+////LCD Pin Setup////
63
+
62 64
 #define SDPOWER            -1
63 65
 #define SDSS                8
64 66
 #define LED_PIN            -1
@@ -86,3 +88,24 @@
86 88
   //not connected to a pin
87 89
   #define SDCARDDETECT -1    
88 90
 #endif // ULTRA_LCD && NEWPANEL
91
+
92
+#if defined(VIKI2) || defined(miniVIKI)
93
+ #define BEEPER 32 //FastIO
94
+ // Pins for DOGM SPI LCD Support
95
+ #define DOGLCD_A0  42 //Non-FastIO
96
+ #define DOGLCD_CS  43 //Non-FastIO
97
+ #define LCD_SCREEN_ROT_180
98
+ 
99
+ //The encoder and click button (FastIO Pins)
100
+ #define BTN_EN1 26 
101
+ #define BTN_EN2 27
102
+ #define BTN_ENC 47  //the click switch
103
+
104
+ #define SDSS 45
105
+ #define SDCARDDETECT -1 // FastIO (Manual says 72 I'm not certain cause I can't test) 
106
+
107
+ #ifdef TEMP_STAT_LEDS
108
+  #define STAT_LED_RED      12 //Non-FastIO
109
+  #define STAT_LED_BLUE     10 //Non-FastIO
110
+ #endif  
111
+#endif

+ 32
- 0
Marlin/pins_RAMBO.h View File

@@ -22,6 +22,17 @@
22 22
   #endif
23 23
 #endif
24 24
 
25
+#undef X_MS1_PIN
26
+#undef X_MS2_PIN
27
+#undef Y_MS1_PIN
28
+#undef Y_MS2_PIN
29
+#undef Z_MS1_PIN
30
+#undef Z_MS2_PIN
31
+#undef E0_MS1_PIN
32
+#undef E0_MS2_PIN
33
+#undef E1_MS1_PIN
34
+#undef E1_MS2_PIN
35
+ 
25 36
 #define X_STEP_PIN 37
26 37
 #define X_DIR_PIN 48
27 38
 #define X_MIN_PIN 12
@@ -75,6 +86,7 @@
75 86
 #define E1_MS1_PIN 63
76 87
 #define E1_MS2_PIN 64
77 88
 
89
+#undef DIGIPOTSS_PIN
78 90
 #define DIGIPOTSS_PIN 38
79 91
 #define DIGIPOT_CHANNELS {4,5,3,0,1} // X Y Z E0 E1 digipot channels to stepper driver mapping
80 92
 
@@ -148,6 +160,26 @@
148 160
 
149 161
 #endif // ULTRA_LCD
150 162
 
163
+#if defined(VIKI2) || defined(miniVIKI)
164
+ #define BEEPER 44
165
+ // Pins for DOGM SPI LCD Support
166
+ #define DOGLCD_A0  70 
167
+ #define DOGLCD_CS  71 
168
+ #define LCD_SCREEN_ROT_180
169
+  
170
+ //The encoder and click button 
171
+ #define BTN_EN1 85 
172
+ #define BTN_EN2 84
173
+ #define BTN_ENC 83  //the click switch
174
+
175
+ #define SDCARDDETECT -1 // Pin 72 if using easy adapter board   
176
+
177
+  #ifdef TEMP_STAT_LEDS
178
+   #define STAT_LED_RED      22
179
+   #define STAT_LED_BLUE     32 
180
+  #endif
181
+#endif // VIKI2/miniVIKI
182
+
151 183
 #ifdef FILAMENT_SENSOR
152 184
   //Filip added pin for Filament sensor analog input 
153 185
   #define FILWIDTH_PIN        3

+ 3
- 0
Marlin/pins_WITBOX.h View File

@@ -4,5 +4,8 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef FAN_PIN
7 8
 #define FAN_PIN             9 // (Sprinter config)
9
+
10
+#undef HEATER_1_PIN
8 11
 #define HEATER_1_PIN       -1

+ 19
- 19
Marlin/planner.cpp View File

@@ -342,7 +342,7 @@ void planner_recalculate_trapezoids() {
342 342
 //     b. No speed reduction within one block requires faster deceleration than the one, true constant 
343 343
 //        acceleration.
344 344
 //   2. Go over every block in chronological order and dial down junction speed reduction values if 
345
-//     a. The speed increase within one block would require faster accelleration than the one, true 
345
+//     a. The speed increase within one block would require faster acceleration than the one, true 
346 346
 //        constant acceleration.
347 347
 //
348 348
 // When these stages are complete all blocks have an entry_factor that will allow all speed changes to 
@@ -701,26 +701,26 @@ float junction_deviation = 0.1;
701 701
 
702 702
   int moves_queued = movesplanned();
703 703
 
704
-  // slow down when de buffer starts to empty, rather than wait at the corner for a buffer refill
705
-  bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
706
-  #ifdef OLD_SLOWDOWN
707
-    if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
708
-  #endif
709
-
710
-  #ifdef SLOWDOWN
711
-    //  segment time im micro seconds
712
-    unsigned long segment_time = lround(1000000.0/inverse_second);
713
-    if (mq) {
714
-      if (segment_time < minsegmenttime) {
715
-        // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
716
-        inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued));
717
-        #ifdef XY_FREQUENCY_LIMIT
718
-          segment_time = lround(1000000.0 / inverse_second);
719
-        #endif
704
+  // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
705
+  #if defined(OLD_SLOWDOWN) || defined(SLOWDOWN)
706
+    bool mq = moves_queued > 1 && moves_queued < BLOCK_BUFFER_SIZE / 2;
707
+    #ifdef OLD_SLOWDOWN
708
+      if (mq) feed_rate *= 2.0 * moves_queued / BLOCK_BUFFER_SIZE;
709
+    #endif
710
+    #ifdef SLOWDOWN
711
+      //  segment time im micro seconds
712
+      unsigned long segment_time = lround(1000000.0/inverse_second);
713
+      if (mq) {
714
+        if (segment_time < minsegmenttime) {
715
+          // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
716
+          inverse_second = 1000000.0 / (segment_time + lround(2 * (minsegmenttime - segment_time) / moves_queued));
717
+          #ifdef XY_FREQUENCY_LIMIT
718
+            segment_time = lround(1000000.0 / inverse_second);
719
+          #endif
720
+        }
720 721
       }
721
-    }
722
+    #endif
722 723
   #endif
723
-  //  END OF SLOW DOWN SECTION    
724 724
 
725 725
   block->nominal_speed = block->millimeters * inverse_second; // (mm/sec) Always > 0
726 726
   block->nominal_rate = ceil(block->step_event_count * inverse_second); // (step/sec) Always > 0

+ 21
- 5
Marlin/planner.h View File

@@ -80,21 +80,37 @@ extern volatile unsigned char block_buffer_tail;
80 80
 FORCE_INLINE uint8_t movesplanned() { return BLOCK_MOD(block_buffer_head - block_buffer_tail + BLOCK_BUFFER_SIZE); }
81 81
 
82 82
 #if defined(ENABLE_AUTO_BED_LEVELING) || defined(MESH_BED_LEVELING)
83
+
83 84
   #if defined(ENABLE_AUTO_BED_LEVELING)
84 85
     #include "vector_3.h"
85
-    // this holds the required transform to compensate for bed level
86
+
87
+    // Transform required to compensate for bed level
86 88
     extern matrix_3x3 plan_bed_level_matrix;
87
-    // Get the position applying the bed level matrix if enabled
89
+
90
+    /**
91
+     * Get the position applying the bed level matrix
92
+     */
88 93
     vector_3 plan_get_position();
89 94
   #endif  // ENABLE_AUTO_BED_LEVELING
90
-  // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 
91
-  // millimeters. Feed rate specifies the speed of the motion.
95
+
96
+  /**
97
+   * Add a new linear movement to the buffer. x, y, z are the signed, absolute target position in
98
+   * millimeters. Feed rate specifies the (target) speed of the motion.
99
+   */
92 100
   void plan_buffer_line(float x, float y, float z, const float &e, float feed_rate, const uint8_t &extruder);
93
-  // Set position. Used for G92 instructions.
101
+
102
+  /**
103
+   * Set the planner positions. Used for G92 instructions.
104
+   * Multiplies by axis_steps_per_unit[] to set stepper positions.
105
+   * Clears previous speed values.
106
+   */
94 107
   void plan_set_position(float x, float y, float z, const float &e);
108
+
95 109
 #else
110
+
96 111
   void plan_buffer_line(const float &x, const float &y, const float &z, const float &e, float feed_rate, const uint8_t &extruder);
97 112
   void plan_set_position(const float &x, const float &y, const float &z, const float &e);
113
+
98 114
 #endif // ENABLE_AUTO_BED_LEVELING || MESH_BED_LEVELING
99 115
 
100 116
 void plan_set_e_position(const float &e);

+ 0
- 1
Marlin/qr_solve.cpp View File

@@ -607,7 +607,6 @@ double dnrm2 ( int n, double x[], int incx )
607 607
   double norm;
608 608
   double scale;
609 609
   double ssq;
610
-  double value;
611 610
 
612 611
   if ( n < 1 || incx < 1 )
613 612
   {

+ 186
- 0
Marlin/scripts/g29_auto.py View File

@@ -0,0 +1,186 @@
1
+#!/usr/bin/python3
2
+
3
+# This file is for preprocessing gcode and the new G29 Autobedleveling from Marlin
4
+# It will analyse the first 2 Layer and return the maximum size for this part
5
+# After this it will replace with g29_keyword = ';MarlinG29Script' with the new G29 LRFB
6
+# the new file will be created in the same folder.
7
+
8
+# your gcode-file/folder
9
+folder = './'
10
+my_file = 'test.gcode'
11
+
12
+# this is the minimum of G1 instructions which should be between 2 different heights
13
+min_g1 = 3
14
+
15
+# maximum number of lines to parse, I don't want to parse the complete file
16
+# only the first plane is we are interested in
17
+max_g1 = 100000000
18
+
19
+# g29 keyword
20
+g29_keyword = 'g29'
21
+g29_keyword = g29_keyword.upper()
22
+
23
+# output filename
24
+output_file = folder + 'g29_' + my_file
25
+# input filename
26
+input_file = folder + my_file
27
+
28
+# minimum scan size
29
+min_size = 40
30
+probing_points = 3  # points x points
31
+
32
+# other stuff
33
+min_x = 500
34
+min_y = min_x
35
+max_x = -500
36
+max_y = max_x
37
+last_z = 0.001
38
+
39
+layer = 0
40
+lines_of_g1 = 0
41
+
42
+gcode = []
43
+
44
+
45
+# return only g1-lines
46
+def has_g1(line):
47
+    return line[:2].upper() == "G1"
48
+
49
+
50
+# find position in g1 (x,y,z)
51
+def find_axis(line, axis):
52
+    found = False
53
+    number = ""
54
+    for char in line:
55
+        if found:
56
+            if char == ".":
57
+                number += char
58
+            elif char == "-":
59
+                number += char
60
+            else:
61
+                try:
62
+                    int(char)
63
+                    number += char
64
+                except ValueError:
65
+                    break
66
+        else:
67
+            found = char.upper() == axis.upper()
68
+    try:
69
+        return float(number)
70
+    except ValueError:
71
+        return None
72
+
73
+
74
+# save the min or max-values for each axis
75
+def set_mima(line):
76
+    global min_x, max_x, min_y, max_y, last_z
77
+
78
+    current_x = find_axis(line, 'x')
79
+    current_y = find_axis(line, 'y')
80
+
81
+    if current_x is not None:
82
+        min_x = min(current_x, min_x)
83
+        max_x = max(current_x, max_x)
84
+    if current_y is not None:
85
+        min_y = min(current_y, min_y)
86
+        max_y = max(current_y, max_y)
87
+
88
+    return min_x, max_x, min_y, max_y
89
+
90
+
91
+# find z in the code and return it
92
+def find_z(gcode, start_at_line=0):
93
+    for i in range(start_at_line, len(gcode)):
94
+        my_z = find_axis(gcode[i], 'Z')
95
+        if my_z is not None:
96
+            return my_z, i
97
+
98
+
99
+def z_parse(gcode, start_at_line=0, end_at_line=0):
100
+    i = start_at_line
101
+    all_z = []
102
+    line_between_z = []
103
+    z_at_line = []
104
+    # last_z = 0
105
+    last_i = -1
106
+
107
+    while len(gcode) > i:
108
+        try:
109
+            z, i = find_z(gcode, i + 1)
110
+        except TypeError:
111
+            break
112
+
113
+        all_z.append(z)
114
+        z_at_line.append(i)
115
+        temp_line = i - last_i -1
116
+        line_between_z.append(i - last_i - 1)
117
+        # last_z = z
118
+        last_i = i
119
+        if 0 < end_at_line <= i or temp_line >= min_g1:
120
+            # print('break at line {} at heigth {}'.format(i, z))
121
+            break
122
+
123
+    line_between_z = line_between_z[1:]
124
+    return all_z, line_between_z, z_at_line
125
+
126
+
127
+# get the lines which should be the first layer
128
+def get_lines(gcode, minimum):
129
+    i = 0
130
+    all_z, line_between_z, z_at_line = z_parse(gcode, end_at_line=max_g1)
131
+    for count in line_between_z:
132
+        i += 1
133
+        if count > minimum:
134
+            # print('layer: {}:{}'.format(z_at_line[i-1], z_at_line[i]))
135
+            return z_at_line[i - 1], z_at_line[i]
136
+
137
+
138
+with open(input_file, 'r') as file:
139
+    lines = 0
140
+    for line in file:
141
+        lines += 1
142
+        if lines > 1000:
143
+            break
144
+        if has_g1(line):
145
+            gcode.append(line)
146
+file.close()
147
+
148
+start, end = get_lines(gcode, min_g1)
149
+for i in range(start, end):
150
+    set_mima(gcode[i])
151
+
152
+print('x_min:{} x_max:{}\ny_min:{} y_max:{}'.format(min_x, max_x, min_y, max_y))
153
+
154
+# resize min/max - values for minimum scan
155
+if max_x - min_x < min_size:
156
+    offset_x = int((min_size - (max_x - min_x)) / 2 + 0.5)  # int round up
157
+    # print('min_x! with {}'.format(int(max_x - min_x)))
158
+    min_x = int(min_x) - offset_x
159
+    max_x = int(max_x) + offset_x
160
+if max_y - min_y < min_size:
161
+    offset_y = int((min_size - (max_y - min_y)) / 2 + 0.5)  # int round up
162
+    # print('min_y! with {}'.format(int(max_y - min_y)))
163
+    min_y = int(min_y) - offset_y
164
+    max_y = int(max_y) + offset_y
165
+
166
+
167
+new_command = 'G29 L{0} R{1} F{2} B{3} P{4}\n'.format(min_x,
168
+                                                      max_x,
169
+                                                      min_y,
170
+                                                      max_y,
171
+                                                      probing_points)
172
+
173
+out_file = open(output_file, 'w')
174
+in_file = open(input_file, 'r')
175
+
176
+for line in in_file:
177
+    if line[:len(g29_keyword)].upper() == g29_keyword:
178
+        out_file.write(new_command)
179
+        print('write G29')
180
+    else:
181
+        out_file.write(line)
182
+
183
+file.close()
184
+out_file.close()
185
+
186
+print('auto G29 finished')

+ 34
- 16
Marlin/stepper.cpp View File

@@ -85,18 +85,32 @@ static volatile bool endstop_z_hit = false;
85 85
   int motor_current_setting[3] = DEFAULT_PWM_MOTOR_CURRENT;
86 86
 #endif
87 87
 
88
-static bool old_x_min_endstop = false,
89
-            old_x_max_endstop = false,
90
-            old_y_min_endstop = false,
91
-            old_y_max_endstop = false,
92
-            old_z_min_endstop = false,
93
-            #ifndef Z_DUAL_ENDSTOPS
94
-            old_z_max_endstop = false;
95
-            #else
96
-              old_z_max_endstop = false,
97
-              old_z2_min_endstop = false,
98
-              old_z2_max_endstop = false;
99
-            #endif
88
+#if defined(X_MIN_PIN) && X_MIN_PIN >= 0
89
+  static bool old_x_min_endstop = false;
90
+#endif
91
+#if defined(X_MAX_PIN) && X_MAX_PIN >= 0
92
+  static bool old_x_max_endstop = false;
93
+#endif
94
+#if defined(Y_MIN_PIN) && Y_MIN_PIN >= 0
95
+  static bool old_y_min_endstop = false;
96
+#endif
97
+#if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
98
+  static bool old_y_max_endstop = false;
99
+#endif
100
+#if defined(Z_MIN_PIN) && Z_MIN_PIN >= 0
101
+  static bool old_z_min_endstop = false;
102
+#endif
103
+#if defined(Z_MAX_PIN) && Z_MAX_PIN >= 0
104
+  static bool old_z_max_endstop = false;
105
+#endif
106
+#ifdef Z_DUAL_ENDSTOPS
107
+  #if defined(Z2_MIN_PIN) && Z2_MIN_PIN >= 0
108
+    static bool old_z2_min_endstop = false;
109
+  #endif
110
+  #if defined(Z2_MAX_PIN) && Z2_MAX_PIN >= 0
111
+    static bool old_z2_max_endstop = false;
112
+  #endif
113
+#endif
100 114
 
101 115
 #ifdef Z_PROBE_AND_ENDSTOP
102 116
 static bool old_z_probe_endstop = false;
@@ -449,7 +463,7 @@ ISR(TIMER1_COMPA_vect) {
449 463
       #ifdef COREXY
450 464
         // Head direction in -X axis for CoreXY bots.
451 465
         // If DeltaX == -DeltaY, the movement is only in Y axis
452
-        if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS)))
466
+        if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
453 467
           if (TEST(out_bits, X_HEAD))
454 468
       #else
455 469
           if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular cartesians bot)
@@ -477,9 +491,10 @@ ISR(TIMER1_COMPA_vect) {
477 491
               }
478 492
           }
479 493
       #ifdef COREXY
494
+        }
480 495
         // Head direction in -Y axis for CoreXY bots.
481 496
         // If DeltaX == DeltaY, the movement is only in X axis
482
-        if (current_block->steps[A_AXIS] != current_block->steps[B_AXIS] || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS)))
497
+        if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
483 498
           if (TEST(out_bits, Y_HEAD))
484 499
       #else
485 500
           if (TEST(out_bits, Y_AXIS))   // -direction
@@ -494,6 +509,9 @@ ISR(TIMER1_COMPA_vect) {
494 509
               UPDATE_ENDSTOP(y, Y, max, MAX);
495 510
             #endif
496 511
           }
512
+      #ifdef COREXY
513
+        }
514
+      #endif
497 515
     }
498 516
 
499 517
     if (TEST(out_bits, Z_AXIS)) {   // -direction
@@ -1227,8 +1245,8 @@ void microstep_init() {
1227 1245
     pinMode(E0_MS1_PIN,OUTPUT);
1228 1246
     pinMode(E0_MS2_PIN,OUTPUT);
1229 1247
     const uint8_t microstep_modes[] = MICROSTEP_MODES;
1230
-    for (int i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
1231
-        microstep_mode(i, microstep_modes[i]);
1248
+    for (uint16_t i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
1249
+      microstep_mode(i, microstep_modes[i]);
1232 1250
   #endif
1233 1251
 }
1234 1252
 

+ 16
- 3
Marlin/temperature.cpp View File

@@ -83,6 +83,17 @@ unsigned char soft_pwm_bed;
83 83
 #ifdef FILAMENT_SENSOR
84 84
   int current_raw_filwidth = 0;  //Holds measured filament diameter - one extruder only
85 85
 #endif  
86
+#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
87
+void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
88
+static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
89
+static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
90
+static bool thermal_runaway = false;
91
+#if TEMP_SENSOR_BED != 0
92
+  static int thermal_runaway_bed_state_machine;
93
+  static unsigned long thermal_runaway_bed_timer;
94
+#endif
95
+#endif
96
+
86 97
 //===========================================================================
87 98
 //=============================private variables============================
88 99
 //===========================================================================
@@ -586,7 +597,9 @@ void manage_heater() {
586 597
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
587 598
   #endif //HEATER_0_USES_MAX6675
588 599
 
589
-  unsigned long ms = millis();
600
+  #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
601
+    unsigned long ms = millis();
602
+  #endif
590 603
 
591 604
   // Loop through all extruders
592 605
   for (int e = 0; e < EXTRUDERS; e++) {
@@ -1098,8 +1111,8 @@ void disable_heater() {
1098 1111
 }
1099 1112
 
1100 1113
 #ifdef HEATER_0_USES_MAX6675
1101
-  #define MAX6675_HEAT_INTERVAL 250
1102
-  long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
1114
+  #define MAX6675_HEAT_INTERVAL 250u
1115
+  unsigned long max6675_previous_millis = MAX6675_HEAT_INTERVAL;
1103 1116
   int max6675_temp = 2000;
1104 1117
 
1105 1118
   static int read_max6675() {

+ 4
- 14
Marlin/temperature.h View File

@@ -146,16 +146,10 @@ void disable_heater();
146 146
 void setWatch();
147 147
 void updatePID();
148 148
 
149
-#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
150
-void thermal_runaway_protection(int *state, unsigned long *timer, float temperature, float target_temperature, int heater_id, int period_seconds, int hysteresis_degc);
151
-static int thermal_runaway_state_machine[4]; // = {0,0,0,0};
152
-static unsigned long thermal_runaway_timer[4]; // = {0,0,0,0};
153
-static bool thermal_runaway = false;
154
-#if TEMP_SENSOR_BED != 0
155
-  static int thermal_runaway_bed_state_machine;
156
-  static unsigned long thermal_runaway_bed_timer;
157
-#endif
158
-#endif
149
+void PID_autotune(float temp, int extruder, int ncycles);
150
+
151
+void setExtruderAutoFanState(int pin, bool state);
152
+void checkExtruderAutoFans();
159 153
 
160 154
 FORCE_INLINE void autotempShutdown() {
161 155
   #ifdef AUTOTEMP
@@ -167,9 +161,5 @@ FORCE_INLINE void autotempShutdown() {
167 161
   #endif
168 162
 }
169 163
 
170
-void PID_autotune(float temp, int extruder, int ncycles);
171
-
172
-void setExtruderAutoFanState(int pin, bool state);
173
-void checkExtruderAutoFans();
174 164
 
175 165
 #endif

+ 223
- 224
Marlin/ultralcd.cpp View File

@@ -25,10 +25,6 @@ int absPreheatFanSpeed;
25 25
   unsigned long message_millis = 0;
26 26
 #endif
27 27
 
28
-#ifdef ULTIPANEL
29
-  static float manual_feedrate[] = MANUAL_FEEDRATE;
30
-#endif // ULTIPANEL
31
-
32 28
 /* !Configuration settings */
33 29
 
34 30
 //Function pointer to menu functions.
@@ -38,193 +34,197 @@ uint8_t lcd_status_message_level;
38 34
 char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
39 35
 
40 36
 #ifdef DOGLCD
41
-#include "dogm_lcd_implementation.h"
37
+  #include "dogm_lcd_implementation.h"
42 38
 #else
43
-#include "ultralcd_implementation_hitachi_HD44780.h"
39
+  #include "ultralcd_implementation_hitachi_HD44780.h"
44 40
 #endif
45 41
 
46
-/* Different menus */
42
+// The main status screen
47 43
 static void lcd_status_screen();
48
-#ifdef ULTIPANEL
49
-extern bool powersupply;
50
-static void lcd_main_menu();
51
-static void lcd_tune_menu();
52
-static void lcd_prepare_menu();
53
-static void lcd_move_menu();
54
-static void lcd_control_menu();
55
-static void lcd_control_temperature_menu();
56
-static void lcd_control_temperature_preheat_pla_settings_menu();
57
-static void lcd_control_temperature_preheat_abs_settings_menu();
58
-static void lcd_control_motion_menu();
59
-static void lcd_control_volumetric_menu();
60
-#ifdef DOGLCD
61
-static void lcd_set_contrast();
62
-#endif
63
-#ifdef FWRETRACT
64
-static void lcd_control_retract_menu();
65
-#endif
66
-static void lcd_sdcard_menu();
67 44
 
68
-#ifdef DELTA_CALIBRATION_MENU
69
-static void lcd_delta_calibrate_menu();
70
-#endif // DELTA_CALIBRATION_MENU
71
-
72
-#if defined(MANUAL_BED_LEVELING)
73
-#include "mesh_bed_leveling.h"
74
-static void _lcd_level_bed();
75
-static void _lcd_level_bed_homing();
76
-static void lcd_level_bed();
77
-#endif  // MANUAL_BED_LEVELING
45
+#ifdef ULTIPANEL
78 46
 
79
-static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
80
-
81
-/* Different types of actions that can be used in menu items. */
82
-static void menu_action_back(menuFunc_t data);
83
-static void menu_action_submenu(menuFunc_t data);
84
-static void menu_action_gcode(const char* pgcode);
85
-static void menu_action_function(menuFunc_t data);
86
-static void menu_action_sdfile(const char* filename, char* longFilename);
87
-static void menu_action_sddirectory(const char* filename, char* longFilename);
88
-static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
89
-static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
90
-static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
91
-static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
92
-static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
93
-static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
94
-static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
95
-static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
96
-static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
97
-static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
98
-static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
99
-static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
100
-static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
101
-static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
102
-static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
103
-static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
104
-static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
105
-static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
106
-
107
-#define ENCODER_FEEDRATE_DEADZONE 10
108
-
109
-#if !defined(LCD_I2C_VIKI)
110
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
111
-    #define ENCODER_STEPS_PER_MENU_ITEM 5
47
+  extern bool powersupply;
48
+  static float manual_feedrate[] = MANUAL_FEEDRATE;
49
+  static void lcd_main_menu();
50
+  static void lcd_tune_menu();
51
+  static void lcd_prepare_menu();
52
+  static void lcd_move_menu();
53
+  static void lcd_control_menu();
54
+  static void lcd_control_temperature_menu();
55
+  static void lcd_control_temperature_preheat_pla_settings_menu();
56
+  static void lcd_control_temperature_preheat_abs_settings_menu();
57
+  static void lcd_control_motion_menu();
58
+  static void lcd_control_volumetric_menu();
59
+  #ifdef DOGLCD
60
+    static void lcd_set_contrast();
112 61
   #endif
113
-  #ifndef ENCODER_PULSES_PER_STEP
114
-    #define ENCODER_PULSES_PER_STEP 1
62
+  #ifdef FWRETRACT
63
+    static void lcd_control_retract_menu();
115 64
   #endif
116
-#else
117
-  #ifndef ENCODER_STEPS_PER_MENU_ITEM
118
-    #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
65
+  static void lcd_sdcard_menu();
66
+
67
+  #ifdef DELTA_CALIBRATION_MENU
68
+    static void lcd_delta_calibrate_menu();
69
+  #endif
70
+
71
+  #if defined(MANUAL_BED_LEVELING)
72
+    #include "mesh_bed_leveling.h"
73
+    static void _lcd_level_bed();
74
+    static void _lcd_level_bed_homing();
75
+    static void lcd_level_bed();
119 76
   #endif
120
-  #ifndef ENCODER_PULSES_PER_STEP
121
-    #define ENCODER_PULSES_PER_STEP 1
77
+
78
+  static void lcd_quick_feedback();//Cause an LCD refresh, and give the user visual or audible feedback that something has happened
79
+
80
+  /* Different types of actions that can be used in menu items. */
81
+  static void menu_action_back(menuFunc_t data);
82
+  static void menu_action_submenu(menuFunc_t data);
83
+  static void menu_action_gcode(const char* pgcode);
84
+  static void menu_action_function(menuFunc_t data);
85
+  static void menu_action_sdfile(const char* filename, char* longFilename);
86
+  static void menu_action_sddirectory(const char* filename, char* longFilename);
87
+  static void menu_action_setting_edit_bool(const char* pstr, bool* ptr);
88
+  static void menu_action_setting_edit_int3(const char* pstr, int* ptr, int minValue, int maxValue);
89
+  static void menu_action_setting_edit_float3(const char* pstr, float* ptr, float minValue, float maxValue);
90
+  static void menu_action_setting_edit_float32(const char* pstr, float* ptr, float minValue, float maxValue);
91
+  static void menu_action_setting_edit_float43(const char* pstr, float* ptr, float minValue, float maxValue);
92
+  static void menu_action_setting_edit_float5(const char* pstr, float* ptr, float minValue, float maxValue);
93
+  static void menu_action_setting_edit_float51(const char* pstr, float* ptr, float minValue, float maxValue);
94
+  static void menu_action_setting_edit_float52(const char* pstr, float* ptr, float minValue, float maxValue);
95
+  static void menu_action_setting_edit_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue);
96
+  static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr, menuFunc_t callbackFunc);
97
+  static void menu_action_setting_edit_callback_int3(const char* pstr, int* ptr, int minValue, int maxValue, menuFunc_t callbackFunc);
98
+  static void menu_action_setting_edit_callback_float3(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
99
+  static void menu_action_setting_edit_callback_float32(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
100
+  static void menu_action_setting_edit_callback_float43(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
101
+  static void menu_action_setting_edit_callback_float5(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
102
+  static void menu_action_setting_edit_callback_float51(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
103
+  static void menu_action_setting_edit_callback_float52(const char* pstr, float* ptr, float minValue, float maxValue, menuFunc_t callbackFunc);
104
+  static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned long* ptr, unsigned long minValue, unsigned long maxValue, menuFunc_t callbackFunc);
105
+
106
+  #define ENCODER_FEEDRATE_DEADZONE 10
107
+
108
+  #if !defined(LCD_I2C_VIKI)
109
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
110
+      #define ENCODER_STEPS_PER_MENU_ITEM 5
111
+    #endif
112
+    #ifndef ENCODER_PULSES_PER_STEP
113
+      #define ENCODER_PULSES_PER_STEP 1
114
+    #endif
115
+  #else
116
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
117
+      #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
118
+    #endif
119
+    #ifndef ENCODER_PULSES_PER_STEP
120
+      #define ENCODER_PULSES_PER_STEP 1
121
+    #endif
122 122
   #endif
123
-#endif
124 123
 
125 124
 
126
-/* Helper macros for menus */
127
-
128
-/**
129
- * START_MENU generates the init code for a menu function
130
- */
131
-#define START_MENU() do { \
132
-  encoderRateMultiplierEnabled = false; \
133
-  if (encoderPosition > 0x8000) encoderPosition = 0; \
134
-  uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
135
-  if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
136
-  uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
137
-  bool wasClicked = LCD_CLICKED, itemSelected; \
138
-  if (wasClicked) lcd_quick_feedback(); \
139
-  for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
140
-    _menuItemNr = 0;
141
-
142
-/**
143
- * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
144
- *
145
- *   lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
146
- *   menu_action_[type](arg3...)
147
- *
148
- * Examples:
149
- *   MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
150
- *     lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
151
- *     menu_action_back(lcd_status_screen)
152
- *
153
- *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
154
- *     lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
155
- *     menu_action_function(lcd_sdcard_pause)
156
- *
157
- *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999)
158
- *   MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999)
159
- *     lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999)
160
- *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999)
161
- *
162
- */
163
-#define MENU_ITEM(type, label, args...) do { \
164
-  if (_menuItemNr == _lineNr) { \
165
-    itemSelected = encoderLine == _menuItemNr; \
166
-    if (lcdDrawUpdate) \
167
-      lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
168
-    if (wasClicked && itemSelected) { \
169
-      menu_action_ ## type(args); \
170
-      return; \
171
-    } \
172
-  } \
173
-  _menuItemNr++; \
174
-} while(0)
125
+  /* Helper macros for menus */
175 126
 
176
-#ifdef ENCODER_RATE_MULTIPLIER
177 127
   /**
178
-   * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
128
+   * START_MENU generates the init code for a menu function
179 129
    */
180
-  #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
130
+  #define START_MENU() do { \
131
+    encoderRateMultiplierEnabled = false; \
132
+    if (encoderPosition > 0x8000) encoderPosition = 0; \
133
+    uint8_t encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; \
134
+    if (encoderLine < currentMenuViewOffset) currentMenuViewOffset = encoderLine; \
135
+    uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
136
+    bool wasClicked = LCD_CLICKED, itemSelected; \
137
+    if (wasClicked) lcd_quick_feedback(); \
138
+    for (uint8_t _drawLineNr = 0; _drawLineNr < LCD_HEIGHT; _drawLineNr++, _lineNr++) { \
139
+      _menuItemNr = 0;
140
+
141
+  /**
142
+   * MENU_ITEM generates draw & handler code for a menu item, potentially calling:
143
+   *
144
+   *   lcd_implementation_drawmenu_[type](sel, row, label, arg3...)
145
+   *   menu_action_[type](arg3...)
146
+   *
147
+   * Examples:
148
+   *   MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
149
+   *     lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
150
+   *     menu_action_back(lcd_status_screen)
151
+   *
152
+   *   MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
153
+   *     lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
154
+   *     menu_action_function(lcd_sdcard_pause)
155
+   *
156
+   *   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999)
157
+   *   MENU_ITEM(setting_edit_int3, MSG_SPEED, PSTR(MSG_SPEED), &feedmultiply, 10, 999)
158
+   *     lcd_implementation_drawmenu_setting_edit_int3(sel, row, PSTR(MSG_SPEED), PSTR(MSG_SPEED), &feedmultiply, 10, 999)
159
+   *     menu_action_setting_edit_int3(PSTR(MSG_SPEED), &feedmultiply, 10, 999)
160
+   *
161
+   */
162
+  #define MENU_ITEM(type, label, args...) do { \
181 163
     if (_menuItemNr == _lineNr) { \
182 164
       itemSelected = encoderLine == _menuItemNr; \
183 165
       if (lcdDrawUpdate) \
184 166
         lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
185 167
       if (wasClicked && itemSelected) { \
186
-        encoderRateMultiplierEnabled = true; \
187
-        lastEncoderMovementMillis = 0; \
188 168
         menu_action_ ## type(args); \
189 169
         return; \
190 170
       } \
191 171
     } \
192 172
     _menuItemNr++; \
193 173
   } while(0)
194
-#endif //ENCODER_RATE_MULTIPLIER
195
-
196
-#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
197
-#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
198
-#define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
199
-#ifdef ENCODER_RATE_MULTIPLIER
200
-  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
201
-  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
202
-#else //!ENCODER_RATE_MULTIPLIER
203
-  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
204
-  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
205
-#endif //!ENCODER_RATE_MULTIPLIER
206
-#define END_MENU() \
207
-    if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
208
-    if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
209
-    } } while(0)
210
-
211
-/** Used variables to keep track of the menu */
212
-#ifndef REPRAPWORLD_KEYPAD
213
-volatile uint8_t buttons;//Contains the bits of the currently pressed buttons.
214
-#else
215
-volatile uint8_t buttons_reprapworld_keypad; // to store the reprapworld_keypad shift register values
216
-#endif
217
-#ifdef LCD_HAS_SLOW_BUTTONS
218
-volatile uint8_t slow_buttons;//Contains the bits of the currently pressed buttons.
219
-#endif
220
-uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
221
-uint32_t blocking_enc;
222
-uint8_t lastEncoderBits;
223
-uint32_t encoderPosition;
224
-#if (SDCARDDETECT > 0)
225
-bool lcd_oldcardstatus;
226
-#endif
227
-#endif //ULTIPANEL
174
+
175
+  #ifdef ENCODER_RATE_MULTIPLIER
176
+    /**
177
+     * MENU_MULTIPLIER_ITEM generates drawing and handling code for a multiplier menu item
178
+     */
179
+    #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
180
+      if (_menuItemNr == _lineNr) { \
181
+        itemSelected = encoderLine == _menuItemNr; \
182
+        if (lcdDrawUpdate) \
183
+          lcd_implementation_drawmenu_ ## type(itemSelected, _drawLineNr, PSTR(label), ## args); \
184
+        if (wasClicked && itemSelected) { \
185
+          encoderRateMultiplierEnabled = true; \
186
+          lastEncoderMovementMillis = 0; \
187
+          menu_action_ ## type(args); \
188
+          return; \
189
+        } \
190
+      } \
191
+      _menuItemNr++; \
192
+    } while(0)
193
+  #endif //ENCODER_RATE_MULTIPLIER
194
+
195
+  #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
196
+  #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
197
+  #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
198
+  #ifdef ENCODER_RATE_MULTIPLIER
199
+    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
200
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
201
+  #else //!ENCODER_RATE_MULTIPLIER
202
+    #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
203
+    #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
204
+  #endif //!ENCODER_RATE_MULTIPLIER
205
+  #define END_MENU() \
206
+      if (encoderLine >= _menuItemNr) { encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; encoderLine = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM; }\
207
+      if (encoderLine >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = encoderLine - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
208
+      } } while(0)
209
+
210
+  /** Used variables to keep track of the menu */
211
+  #ifndef REPRAPWORLD_KEYPAD
212
+    volatile uint8_t buttons; // Bits of the pressed buttons.
213
+  #else
214
+    volatile uint8_t buttons_reprapworld_keypad; // The reprapworld_keypad shift register values
215
+  #endif
216
+  #ifdef LCD_HAS_SLOW_BUTTONS
217
+    volatile uint8_t slow_buttons; // Bits of the pressed buttons.
218
+  #endif
219
+  uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
220
+  uint32_t blocking_enc;
221
+  uint8_t lastEncoderBits;
222
+  uint32_t encoderPosition;
223
+  #if (SDCARDDETECT > 0)
224
+    bool lcd_oldcardstatus;
225
+  #endif
226
+
227
+#endif // ULTIPANEL
228 228
 
229 229
 menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
230 230
 uint32_t lcd_next_update_millis;
@@ -520,22 +520,21 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
520 520
 void lcd_preheat_pla0() { _lcd_preheat(0, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
521 521
 void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
522 522
 
523
-#if TEMP_SENSOR_1 != 0 //2nd extruder preheat
524
-  void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
525
-  void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
526
-#endif //2nd extruder preheat
523
+#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0 //more than one extruder present
527 524
 
528
-#if TEMP_SENSOR_2 != 0 //3 extruder preheat
529
-  void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
530
-  void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
531
-#endif //3 extruder preheat
532
-
533
-#if TEMP_SENSOR_3 != 0 //4 extruder preheat
534
-  void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
535
-  void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
536
-#endif //4 extruder preheat
525
+  #if TEMP_SENSOR_1 != 0
526
+    void lcd_preheat_pla1() { _lcd_preheat(1, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
527
+    void lcd_preheat_abs1() { _lcd_preheat(1, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
528
+  #endif
529
+  #if TEMP_SENSOR_2 != 0
530
+    void lcd_preheat_pla2() { _lcd_preheat(2, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
531
+    void lcd_preheat_abs2() { _lcd_preheat(2, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
532
+  #endif
533
+  #if TEMP_SENSOR_3 != 0
534
+    void lcd_preheat_pla3() { _lcd_preheat(3, plaPreheatHotendTemp, plaPreheatHPBTemp, plaPreheatFanSpeed); }
535
+    void lcd_preheat_abs3() { _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed); }
536
+  #endif
537 537
 
538
-#if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //more than one extruder present
539 538
   void lcd_preheat_pla0123() {
540 539
     setTargetHotend0(plaPreheatHotendTemp);
541 540
     setTargetHotend1(plaPreheatHotendTemp);
@@ -548,54 +547,54 @@ void lcd_preheat_abs0() { _lcd_preheat(0, absPreheatHotendTemp, absPreheatHPBTem
548 547
     setTargetHotend2(absPreheatHotendTemp);
549 548
     _lcd_preheat(3, absPreheatHotendTemp, absPreheatHPBTemp, absPreheatFanSpeed);
550 549
   }
551
-#endif //more than one extruder present
552 550
 
553
-void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); }
554
-void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); }
551
+  #if TEMP_SENSOR_0 != 0
555 552
 
556
-static void lcd_preheat_pla_menu() {
557
-  START_MENU();
558
-  MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
559
-  MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
560
-  #if TEMP_SENSOR_1 != 0 //2 extruder preheat
561
-    MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
562
-  #endif //2 extruder preheat
563
-  #if TEMP_SENSOR_2 != 0 //3 extruder preheat
564
-    MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
565
-  #endif //3 extruder preheat
566
-  #if TEMP_SENSOR_3 != 0 //4 extruder preheat
567
-    MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
568
-  #endif //4 extruder preheat
569
-  #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
570
-    MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
571
-  #endif //all extruder preheat
572
-  #if TEMP_SENSOR_BED != 0
573
-    MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
574
-  #endif
575
-  END_MENU();
576
-}
553
+    void lcd_preheat_pla_bedonly() { _lcd_preheat(0, 0, plaPreheatHPBTemp, plaPreheatFanSpeed); }
554
+    void lcd_preheat_abs_bedonly() { _lcd_preheat(0, 0, absPreheatHPBTemp, absPreheatFanSpeed); }
577 555
 
578
-static void lcd_preheat_abs_menu() {
579
-  START_MENU();
580
-  MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
581
-  MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
582
-  #if TEMP_SENSOR_1 != 0 //2 extruder preheat
583
-	  MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
584
-  #endif //2 extruder preheat
585
-  #if TEMP_SENSOR_2 != 0 //3 extruder preheat
586
-    MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
587
-  #endif //3 extruder preheat
588
-  #if TEMP_SENSOR_3 != 0 //4 extruder preheat
589
-    MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
590
-  #endif //4 extruder preheat
591
-  #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 //all extruder preheat
592
-    MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
593
-  #endif //all extruder preheat
594
-  #if TEMP_SENSOR_BED != 0
595
-    MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
556
+    static void lcd_preheat_pla_menu() {
557
+      START_MENU();
558
+      MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
559
+      MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H1, lcd_preheat_pla0);
560
+      #if TEMP_SENSOR_1 != 0
561
+        MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H2, lcd_preheat_pla1);
562
+      #endif
563
+      #if TEMP_SENSOR_2 != 0
564
+        MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H3, lcd_preheat_pla2);
565
+      #endif
566
+      #if TEMP_SENSOR_3 != 0
567
+        MENU_ITEM(function, MSG_PREHEAT_PLA_N MSG_H4, lcd_preheat_pla3);
568
+      #endif
569
+      MENU_ITEM(function, MSG_PREHEAT_PLA_ALL, lcd_preheat_pla0123);
570
+      #if TEMP_SENSOR_BED != 0
571
+        MENU_ITEM(function, MSG_PREHEAT_PLA_BEDONLY, lcd_preheat_pla_bedonly);
572
+      #endif
573
+      END_MENU();
574
+    }
575
+
576
+    static void lcd_preheat_abs_menu() {
577
+      START_MENU();
578
+      MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
579
+      MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H1, lcd_preheat_abs0);
580
+      #if TEMP_SENSOR_1 != 0
581
+        MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H2, lcd_preheat_abs1);
582
+      #endif
583
+      #if TEMP_SENSOR_2 != 0
584
+        MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H3, lcd_preheat_abs2);
585
+      #endif
586
+      #if TEMP_SENSOR_3 != 0
587
+        MENU_ITEM(function, MSG_PREHEAT_ABS_N MSG_H4, lcd_preheat_abs3);
588
+      #endif
589
+      MENU_ITEM(function, MSG_PREHEAT_ABS_ALL, lcd_preheat_abs0123);
590
+      #if TEMP_SENSOR_BED != 0
591
+        MENU_ITEM(function, MSG_PREHEAT_ABS_BEDONLY, lcd_preheat_abs_bedonly);
592
+      #endif
593
+      END_MENU();
594
+    }
596 595
   #endif
597
-  END_MENU();
598
-}
596
+
597
+#endif // more than one temperature sensor present
599 598
 
600 599
 void lcd_cooldown() {
601 600
   setTargetHotend0(0);
@@ -618,7 +617,7 @@ static void lcd_prepare_menu() {
618 617
   MENU_ITEM(function, MSG_SET_HOME_OFFSETS, lcd_set_home_offsets);
619 618
   //MENU_ITEM(gcode, MSG_SET_ORIGIN, PSTR("G92 X0 Y0 Z0"));
620 619
   #if TEMP_SENSOR_0 != 0
621
-    #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_BED != 0
620
+    #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_BED != 0
622 621
       MENU_ITEM(submenu, MSG_PREHEAT_PLA, lcd_preheat_pla_menu);
623 622
       MENU_ITEM(submenu, MSG_PREHEAT_ABS, lcd_preheat_abs_menu);
624 623
     #else

+ 0
- 2
Marlin/ultralcd.h View File

@@ -19,8 +19,6 @@
19 19
     void lcd_setcontrast(uint8_t value);
20 20
   #endif
21 21
 
22
-  static unsigned char blink = 0;	// Variable for visualization of fan rotation in GLCD
23
-
24 22
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
25 23
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
26 24
 

+ 1
- 1
Marlin/ultralcd_st7920_u8glib_rrd.h View File

@@ -43,7 +43,7 @@ static void ST7920_SWSPI_SND_8BIT(uint8_t val)
43 43
 #define ST7920_NCS()             {WRITE(ST7920_CS_PIN,0);}
44 44
 #define ST7920_SET_CMD()         {ST7920_SWSPI_SND_8BIT(0xf8);u8g_10MicroDelay();}
45 45
 #define ST7920_SET_DAT()         {ST7920_SWSPI_SND_8BIT(0xfa);u8g_10MicroDelay();}
46
-#define ST7920_WRITE_BYTE(a)     {ST7920_SWSPI_SND_8BIT((a)&0xf0);ST7920_SWSPI_SND_8BIT((a)<<4);u8g_10MicroDelay();}
46
+#define ST7920_WRITE_BYTE(a)     {ST7920_SWSPI_SND_8BIT((uint8_t)((a)&0xf0u));ST7920_SWSPI_SND_8BIT((uint8_t)((a)<<4u));u8g_10MicroDelay();}
47 47
 #define ST7920_WRITE_BYTES(p,l)  {uint8_t i;for(i=0;i<l;i++){ST7920_SWSPI_SND_8BIT(*p&0xf0);ST7920_SWSPI_SND_8BIT(*p<<4);p++;}u8g_10MicroDelay();}
48 48
 
49 49
 uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg)

Loading…
Cancel
Save