Browse Source

Fix compiler warnings

- Patched up for most included configurations
Scott Lahteine 9 years ago
parent
commit
ba871e46bf

+ 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];

+ 67
- 70
Marlin/Marlin_main.cpp View File

@@ -937,19 +937,22 @@ void get_command()
937 937
 
938 938
 }
939 939
 
940
-
941
-float code_value()
942
-{
943
-  return (strtod(strchr_pointer + 1, NULL));
940
+float code_value() {
941
+  float ret;
942
+  char *e = strchr(strchr_pointer, 'E');
943
+  if (e) {
944
+    *e = 0;
945
+    ret = strtod(strchr_pointer+1, NULL);
946
+    *e = 'E';
947
+  }
948
+  else
949
+    ret = strtod(strchr_pointer+1, NULL);
950
+  return ret;
944 951
 }
945 952
 
946
-long code_value_long()
947
-{
948
-  return (strtol(strchr_pointer + 1, NULL, 10));
949
-}
953
+long code_value_long() { return (strtol(strchr_pointer + 1, NULL, 10)); }
950 954
 
951
-bool code_seen(char code)
952
-{
955
+bool code_seen(char code) {
953 956
   strchr_pointer = strchr(cmdbuffer[bufindr], code);
954 957
   return (strchr_pointer != NULL);  //Return True if a character was found
955 958
 }
@@ -1008,76 +1011,70 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
1008 1011
 #endif //DUAL_X_CARRIAGE
1009 1012
 
1010 1013
 static void axis_is_at_home(int axis) {
1011
-#ifdef DUAL_X_CARRIAGE
1012
-  if (axis == X_AXIS) {
1013
-    if (active_extruder != 0) {
1014
-      current_position[X_AXIS] = x_home_pos(active_extruder);
1015
-      min_pos[X_AXIS] =          X2_MIN_POS;
1016
-      max_pos[X_AXIS] =          max(extruder_offset[X_AXIS][1], X2_MAX_POS);
1017
-      return;
1018
-    }
1019
-    else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
1020
-      current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
1021
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + home_offset[X_AXIS];
1022
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
1023
-                                  max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
1024
-      return;
1014
+
1015
+  #ifdef DUAL_X_CARRIAGE
1016
+    if (axis == X_AXIS) {
1017
+      if (active_extruder != 0) {
1018
+        current_position[X_AXIS] = x_home_pos(active_extruder);
1019
+        min_pos[X_AXIS] = X2_MIN_POS;
1020
+        max_pos[X_AXIS] = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
1021
+        return;
1022
+      }
1023
+      else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1024
+        current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
1025
+        min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS];
1026
+        max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
1027
+                                max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
1028
+        return;
1029
+      }
1025 1030
     }
1026
-  }
1027
-#endif
1028
-#ifdef SCARA
1029
-   float homeposition[3];
1030
-   char i;
1031
-   
1032
-   if (axis < 2)
1033
-   {
1031
+  #endif
1032
+
1033
+  #ifdef SCARA
1034
+    float homeposition[3];
1034 1035
    
1035
-     for (i=0; i<3; i++)
1036
-     {
1037
-        homeposition[i] = base_home_pos(i); 
1038
-     }  
1039
-  // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
1040
-   //  SERIAL_ECHOPGM("homeposition[y]= "); SERIAL_ECHOLN(homeposition[1]);
1041
-   // Works out real Homeposition angles using inverse kinematics, 
1042
-   // and calculates homing offset using forward kinematics
1043
-     calculate_delta(homeposition);
1036
+    if (axis < 2) {
1037
+
1038
+      for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i);
1039
+
1040
+      // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
1041
+      // SERIAL_ECHOPGM("homeposition[y]= "); SERIAL_ECHOLN(homeposition[1]);
1042
+      // Works out real Homeposition angles using inverse kinematics, 
1043
+      // and calculates homing offset using forward kinematics
1044
+      calculate_delta(homeposition);
1044 1045
      
1045
-    // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]);
1046
-    // SERIAL_ECHOPGM(" base Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1046
+      // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]);
1047
+      // SERIAL_ECHOPGM(" base Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1047 1048
      
1048
-     for (i=0; i<2; i++)
1049
-     {
1050
-        delta[i] -= home_offset[i];
1051
-     } 
1049
+      for (int i = 0; i < 2; i++) delta[i] -= home_offset[i];
1052 1050
      
1053
-    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]);
1054
-  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]);
1055
-    // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
1056
-    // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1051
+      // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]);
1052
+      // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]);
1053
+      // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
1054
+      // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]);
1057 1055
       
1058
-     calculate_SCARA_forward_Transform(delta);
1056
+      calculate_SCARA_forward_Transform(delta);
1059 1057
      
1060
-    // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]);
1061
-    // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]);
1058
+      // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]);
1059
+      // SERIAL_ECHOPGM(" Delta Y="); SERIAL_ECHOLN(delta[Y_AXIS]);
1062 1060
      
1063
-    current_position[axis] = delta[axis];
1061
+      current_position[axis] = delta[axis];
1064 1062
     
1065
-    // SCARA home positions are based on configuration since the actual limits are determined by the 
1066
-    // inverse kinematic transform.
1067
-    min_pos[axis] =          base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1068
-    max_pos[axis] =          base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1069
-   } 
1070
-   else
1071
-   {
1063
+      // SCARA home positions are based on configuration since the actual limits are determined by the 
1064
+      // inverse kinematic transform.
1065
+      min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1066
+      max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1067
+    } 
1068
+    else {
1072 1069
       current_position[axis] = base_home_pos(axis) + home_offset[axis];
1073
-      min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1074
-      max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1075
-   }
1076
-#else
1077
-  current_position[axis] = base_home_pos(axis) + home_offset[axis];
1078
-  min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1079
-  max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1080
-#endif
1070
+      min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1071
+      max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1072
+    }
1073
+  #else
1074
+    current_position[axis] = base_home_pos(axis) + home_offset[axis];
1075
+    min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1076
+    max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1077
+  #endif
1081 1078
 }
1082 1079
 
1083 1080
 #ifdef ENABLE_AUTO_BED_LEVELING

+ 1
- 1
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,6 +58,7 @@
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

+ 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

+ 5
- 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,12 +55,15 @@
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"

+ 3
- 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

+ 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

+ 3
- 0
Marlin/pins_AZTEEG_X3.h View File

@@ -4,7 +4,10 @@
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
 
10 13
 #ifdef TEMP_STAT_LEDS

+ 7
- 0
Marlin/pins_AZTEEG_X3_PRO.h View File

@@ -4,7 +4,9 @@
4 4
 
5 5
 #include "pins_RAMPS_13.h"
6 6
 
7
+#undef FAN_PIN
7 8
 #define FAN_PIN             9 // (Sprinter config)
9
+
8 10
 #define BEEPER             33
9 11
 
10 12
 #define E2_STEP_PIN        23
@@ -19,6 +21,9 @@
19 21
 #define E4_DIR_PIN         37
20 22
 #define E4_ENABLE_PIN      42
21 23
 
24
+#undef HEATER_1_PIN
25
+#undef HEATER_2_PIN
26
+#undef HEATER_3_PIN
22 27
 #define HEATER_1_PIN       -1
23 28
 #define HEATER_2_PIN       16
24 29
 #define HEATER_3_PIN       17
@@ -27,6 +32,8 @@
27 32
 #define HEATER_6_PIN        6
28 33
 #define HEATER_7_PIN       11
29 34
 
35
+#undef TEMP_2_PIN
36
+#undef TEMP_3_PIN
30 37
 #define TEMP_2_PIN         12   // ANALOG NUMBERING
31 38
 #define TEMP_3_PIN         11   // ANALOG NUMBERING
32 39
 #define TEMP_4_PIN         10   // ANALOG NUMBERING

+ 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

+ 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

+ 12
- 4
Marlin/stepper.cpp View File

@@ -97,11 +97,19 @@ static volatile bool endstop_z_hit = false;
97 97
 #if defined(Y_MAX_PIN) && Y_MAX_PIN >= 0
98 98
   static bool old_y_max_endstop = false;
99 99
 #endif
100
-
101
-static bool old_z_min_endstop = false, old_z_max_endstop = false;
102
-
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
103 106
 #ifdef Z_DUAL_ENDSTOPS
104
-  static bool old_z2_min_endstop = false, old_z2_max_endstop = false;
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
105 113
 #endif
106 114
 
107 115
 static bool check_endstops = true;

+ 3
- 1
Marlin/temperature.cpp View File

@@ -586,7 +586,9 @@ void manage_heater() {
586 586
     if (ct < max(HEATER_0_MINTEMP, 0.01)) min_temp_error(0);
587 587
   #endif //HEATER_0_USES_MAX6675
588 588
 
589
-  unsigned long ms = millis();
589
+  #if defined(WATCH_TEMP_PERIOD) || !defined(PIDTEMPBED) || HAS_AUTO_FAN
590
+    unsigned long ms = millis();
591
+  #endif
590 592
 
591 593
   // Loop through all extruders
592 594
   for (int e = 0; e < EXTRUDERS; e++) {

+ 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

Loading…
Cancel
Save