Sfoglia il codice sorgente

Merge pull request #1717 from thinkyhead/fixup_warnings

Fixup warnings
Scott Lahteine 9 anni fa
parent
commit
f47fc879fe

+ 1
- 3
Marlin/ConfigurationStore.cpp Vedi 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];

+ 75
- 90
Marlin/Marlin_main.cpp Vedi File

@@ -388,7 +388,11 @@ const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
388 388
 static float destination[NUM_AXIS] = { 0, 0, 0, 0 };
389 389
 
390 390
 static float offset[3] = { 0, 0, 0 };
391
-static bool home_all_axis = true;
391
+
392
+#ifndef DELTA
393
+  static bool home_all_axis = true;
394
+#endif
395
+
392 396
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
393 397
 static long gcode_N, gcode_LastN, Stopped_gcode_LastN = 0;
394 398
 
@@ -396,8 +400,8 @@ static bool relative_mode = false;  //Determines Absolute or Relative Coordinate
396 400
 
397 401
 static char cmdbuffer[BUFSIZE][MAX_CMD_SIZE];
398 402
 #ifdef SDSUPPORT
399
-static bool fromsd[BUFSIZE];
400
-#endif //!SDSUPPORT
403
+  static bool fromsd[BUFSIZE];
404
+#endif
401 405
 static int bufindr = 0;
402 406
 static int bufindw = 0;
403 407
 static int buflen = 0;
@@ -933,24 +937,22 @@ void get_command()
933 937
 
934 938
 }
935 939
 
936
-
937
-float code_value()
938
-{
940
+float code_value() {
939 941
   float ret;
940 942
   char *e = strchr(strchr_pointer, 'E');
941
-  if (e != NULL) *e = 0;
942
-  ret = strtod(strchr_pointer+1, NULL);
943
-  if (e != NULL) *e = '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);
944 950
   return ret;
945 951
 }
946 952
 
947
-long code_value_long()
948
-{
949
-  return (strtol(strchr_pointer + 1, NULL, 10));
950
-}
953
+long code_value_long() { return (strtol(strchr_pointer + 1, NULL, 10)); }
951 954
 
952
-bool code_seen(char code)
953
-{
955
+bool code_seen(char code) {
954 956
   strchr_pointer = strchr(cmdbuffer[bufindr], code);
955 957
   return (strchr_pointer != NULL);  //Return True if a character was found
956 958
 }
@@ -1009,76 +1011,70 @@ XYZ_CONSTS_FROM_CONFIG(signed char, home_dir,  HOME_DIR);
1009 1011
 #endif //DUAL_X_CARRIAGE
1010 1012
 
1011 1013
 static void axis_is_at_home(int axis) {
1012
-#ifdef DUAL_X_CARRIAGE
1013
-  if (axis == X_AXIS) {
1014
-    if (active_extruder != 0) {
1015
-      current_position[X_AXIS] = x_home_pos(active_extruder);
1016
-      min_pos[X_AXIS] =          X2_MIN_POS;
1017
-      max_pos[X_AXIS] =          max(extruder_offset[X_AXIS][1], X2_MAX_POS);
1018
-      return;
1019
-    }
1020
-    else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) {
1021
-      current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS];
1022
-      min_pos[X_AXIS] =          base_min_pos(X_AXIS) + home_offset[X_AXIS];
1023
-      max_pos[X_AXIS] =          min(base_max_pos(X_AXIS) + home_offset[X_AXIS],
1024
-                                  max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset);
1025
-      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
+      }
1026 1030
     }
1027
-  }
1028
-#endif
1029
-#ifdef SCARA
1030
-   float homeposition[3];
1031
-   char i;
1032
-   
1033
-   if (axis < 2)
1034
-   {
1031
+  #endif
1032
+
1033
+  #ifdef SCARA
1034
+    float homeposition[3];
1035 1035
    
1036
-     for (i=0; i<3; i++)
1037
-     {
1038
-        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);
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);
1045 1045
      
1046
-    // SERIAL_ECHOPGM("base Theta= "); SERIAL_ECHO(delta[X_AXIS]);
1047
-    // 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]);
1048 1048
      
1049
-     for (i=0; i<2; i++)
1050
-     {
1051
-        delta[i] -= home_offset[i];
1052
-     } 
1049
+      for (int i = 0; i < 2; i++) delta[i] -= home_offset[i];
1053 1050
      
1054
-    // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]);
1055
-  // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]);
1056
-    // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]);
1057
-    // 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]);
1058 1055
       
1059
-     calculate_SCARA_forward_Transform(delta);
1056
+      calculate_SCARA_forward_Transform(delta);
1060 1057
      
1061
-    // SERIAL_ECHOPGM("Delta X="); SERIAL_ECHO(delta[X_AXIS]);
1062
-    // 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]);
1063 1060
      
1064
-    current_position[axis] = delta[axis];
1061
+      current_position[axis] = delta[axis];
1065 1062
     
1066
-    // SCARA home positions are based on configuration since the actual limits are determined by the 
1067
-    // inverse kinematic transform.
1068
-    min_pos[axis] =          base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1069
-    max_pos[axis] =          base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1070
-   } 
1071
-   else
1072
-   {
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 {
1073 1069
       current_position[axis] = base_home_pos(axis) + home_offset[axis];
1074
-      min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1075
-      max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1076
-   }
1077
-#else
1078
-  current_position[axis] = base_home_pos(axis) + home_offset[axis];
1079
-  min_pos[axis] =          base_min_pos(axis) + home_offset[axis];
1080
-  max_pos[axis] =          base_max_pos(axis) + home_offset[axis];
1081
-#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
1082 1078
 }
1083 1079
 
1084 1080
 #ifdef ENABLE_AUTO_BED_LEVELING
@@ -1233,10 +1229,6 @@ static void do_blocking_move_to(float x, float y, float z) {
1233 1229
     feedrate = oldFeedRate;
1234 1230
 }
1235 1231
 
1236
-static void do_blocking_move_relative(float offset_x, float offset_y, float offset_z) {
1237
-    do_blocking_move_to(current_position[X_AXIS] + offset_x, current_position[Y_AXIS] + offset_y, current_position[Z_AXIS] + offset_z);
1238
-}
1239
-
1240 1232
 static void setup_for_endstop_move() {
1241 1233
     saved_feedrate = feedrate;
1242 1234
     saved_feedmultiply = feedmultiply;
@@ -2156,7 +2148,6 @@ inline void gcode_G28() {
2156 2148
     }
2157 2149
 
2158 2150
     int verbose_level = 1;
2159
-    float x_tmp, y_tmp, z_tmp, real_z;
2160 2151
 
2161 2152
     if (code_seen('V') || code_seen('v')) {
2162 2153
       verbose_level = code_value_long();
@@ -2444,6 +2435,7 @@ inline void gcode_G28() {
2444 2435
       // When the bed is uneven, this height must be corrected.
2445 2436
       if (!dryrun)
2446 2437
       {
2438
+        float x_tmp, y_tmp, z_tmp, real_z;
2447 2439
         real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS];  //get the real Z (since the auto bed leveling is already correcting the plane)
2448 2440
         x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
2449 2441
         y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
@@ -4590,7 +4582,6 @@ inline void gcode_T() {
4590 4582
     #if EXTRUDERS > 1
4591 4583
       bool make_move = false;
4592 4584
     #endif
4593
-
4594 4585
     if (code_seen('F')) {
4595 4586
       #if EXTRUDERS > 1
4596 4587
         make_move = true;
@@ -5193,16 +5184,10 @@ void ClearToSend()
5193 5184
 
5194 5185
 void get_coordinates() {
5195 5186
   for (int i = 0; i < NUM_AXIS; i++) {
5196
-    float dest;
5197
-    if (code_seen(axis_codes[i])) {
5198
-      dest = code_value();
5199
-      if (axis_relative_modes[i] || relative_mode)
5200
-        dest += current_position[i];
5201
-    }
5187
+    if (code_seen(axis_codes[i]))
5188
+      destination[i] = code_value() + (axis_relative_modes[i] || relative_mode ? current_position[i] : 0);
5202 5189
     else
5203
-      dest = current_position[i];
5204
-
5205
-    destination[i] = dest;
5190
+      destination[i] = current_position[i];
5206 5191
   }
5207 5192
   if (code_seen('F')) {
5208 5193
     next_feedrate = code_value();

+ 1
- 1
Marlin/cardreader.cpp Vedi 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 Vedi 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
 

+ 1
- 5
Marlin/example_configurations/SCARA/Configuration_adv.h Vedi 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

+ 6
- 0
Marlin/language.h Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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 Vedi 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

+ 18
- 18
Marlin/planner.cpp Vedi File

@@ -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

+ 0
- 1
Marlin/qr_solve.cpp Vedi 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
   {

+ 27
- 13
Marlin/stepper.cpp Vedi 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
 static bool check_endstops = true;
102 116
 
@@ -1192,7 +1206,7 @@ void microstep_init() {
1192 1206
     pinMode(E0_MS2_PIN,OUTPUT);
1193 1207
     const uint8_t microstep_modes[] = MICROSTEP_MODES;
1194 1208
     for (int i = 0; i < sizeof(microstep_modes) / sizeof(microstep_modes[0]); i++)
1195
-        microstep_mode(i, microstep_modes[i]);
1209
+      microstep_mode(i, microstep_modes[i]);
1196 1210
   #endif
1197 1211
 }
1198 1212
 

+ 3
- 1
Marlin/temperature.cpp Vedi 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 Vedi 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

+ 1
- 2
Marlin/ultralcd.h Vedi File

@@ -17,10 +17,9 @@
17 17
   #ifdef DOGLCD
18 18
     extern int lcd_contrast;
19 19
     void lcd_setcontrast(uint8_t value);
20
+    static unsigned char blink = 0; // Variable for visualization of fan rotation in GLCD
20 21
   #endif
21 22
 
22
-  static unsigned char blink = 0;	// Variable for visualization of fan rotation in GLCD
23
-
24 23
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
25 24
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
26 25
 

Loading…
Annulla
Salva