Browse Source

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

CONSULitAS 9 years ago
parent
commit
8f8824e1d3
36 changed files with 401 additions and 307 deletions
  1. 3
    3
      Documentation/Compilation.md
  2. 9
    9
      Marlin/Configuration.h
  3. 2
    2
      Marlin/Makefile
  4. 12
    0
      Marlin/Marlin.h
  5. 125
    111
      Marlin/Marlin_main.cpp
  6. 2
    2
      Marlin/SanityCheck.h
  7. 2
    2
      Marlin/Servo.cpp
  8. 3
    3
      Marlin/Servo.h
  9. 2
    2
      Marlin/blinkm.cpp
  10. 1
    1
      Marlin/blinkm.h
  11. 2
    2
      Marlin/configuration_store.cpp
  12. 3
    3
      Marlin/configuration_store.h
  13. 3
    2
      Marlin/configurator/config/Configuration.h
  14. 3
    2
      Marlin/configurator/config/language.h
  15. 0
    0
      Marlin/dogm_bitmaps.h
  16. 1
    1
      Marlin/dogm_lcd_implementation.h
  17. 4
    3
      Marlin/example_configurations/Felix/Configuration.h
  18. 3
    2
      Marlin/example_configurations/Felix/Configuration_DUAL.h
  19. 4
    3
      Marlin/example_configurations/Hephestos/Configuration.h
  20. 4
    3
      Marlin/example_configurations/K8200/Configuration.h
  21. 4
    3
      Marlin/example_configurations/SCARA/Configuration.h
  22. 4
    3
      Marlin/example_configurations/WITBOX/Configuration.h
  23. 4
    3
      Marlin/example_configurations/delta/generic/Configuration.h
  24. 4
    3
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  25. 4
    3
      Marlin/example_configurations/makibox/Configuration.h
  26. 4
    3
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  27. 20
    1
      Marlin/fonts/README.fonts
  28. 3
    2
      Marlin/language.h
  29. 1
    3
      Marlin/pins_AZTEEG_X3.h
  30. 1
    1
      Marlin/pins_SAV_MKI.h
  31. 92
    60
      Marlin/stepper.cpp
  32. 3
    0
      Marlin/temperature.cpp
  33. 54
    52
      Marlin/ultralcd.cpp
  34. 4
    2
      Marlin/ultralcd.h
  35. 5
    4
      Marlin/ultralcd_implementation_hitachi_HD44780.h
  36. 6
    8
      README.md

+ 3
- 3
Documentation/Compilation.md View File

3
   1. Install the latest non-beta arduino software IDE/toolset: http://www.arduino.cc/en/Main/Software
3
   1. Install the latest non-beta arduino software IDE/toolset: http://www.arduino.cc/en/Main/Software
4
   2. Download the Marlin firmware
4
   2. Download the Marlin firmware
5
     - [Latest developement version](https://github.com/MarlinFirmware/Marlin/tree/Development)
5
     - [Latest developement version](https://github.com/MarlinFirmware/Marlin/tree/Development)
6
-    - [Stable version](https://github.com/MarlinFirmware/Marlin/tree/Development)
6
+    - [Stable version]()
7
   3. In both cases use the "Download Zip" button on the right.
7
   3. In both cases use the "Download Zip" button on the right.
8
   4. Some boards require special files and/or libraries from the ArduinoAddons directory. Take a look at the dedicated [README](/ArduinoAddons/README.md) for details.
8
   4. Some boards require special files and/or libraries from the ArduinoAddons directory. Take a look at the dedicated [README](/ArduinoAddons/README.md) for details.
9
   5. Start the arduino IDE.
9
   5. Start the arduino IDE.
10
-  6. Select Tools -> Board -> Arduino Mega 2560    or your microcontroller
10
+  6. Select Tools -> Board -> Arduino Mega 2560 or your microcontroller
11
   7. Select the correct serial port in Tools ->Serial Port
11
   7. Select the correct serial port in Tools ->Serial Port
12
   8. Open Marlin.pde or .ino
12
   8. Open Marlin.pde or .ino
13
   9. Click the Verify/Compile button
13
   9. Click the Verify/Compile button
14
   10. Click the Upload button. If all goes well the firmware is uploading
14
   10. Click the Upload button. If all goes well the firmware is uploading
15
 
15
 
16
-That's ok.  Enjoy Silky Smooth Printing.
16
+That's ok.  Enjoy Silky Smooth Printing.

+ 9
- 9
Marlin/Configuration.h View File

364
 #define E_ENABLE_ON 0 // For all extruders
364
 #define E_ENABLE_ON 0 // For all extruders
365
 
365
 
366
 // Disables axis when it's not being used.
366
 // Disables axis when it's not being used.
367
+// WARNING: When motors turn off there is a chance of losing position accuracy!
367
 #define DISABLE_X false
368
 #define DISABLE_X false
368
 #define DISABLE_Y false
369
 #define DISABLE_Y false
369
 #define DISABLE_Z false
370
 #define DISABLE_Z false
661
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
662
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
662
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
663
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
663
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
664
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
664
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
665
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
665
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
666
-                                               // 0 to disable buzzer feedback  
667
-
666
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
667
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
668
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
668
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
669
 // http://reprap.org/wiki/PanelOne
669
 // http://reprap.org/wiki/PanelOne
670
 //#define PANEL_ONE
670
 //#define PANEL_ONE
792
 // Uncomment below to enable
792
 // Uncomment below to enable
793
 //#define FILAMENT_SENSOR
793
 //#define FILAMENT_SENSOR
794
 
794
 
795
-#define FILAMENT_SENSOR_EXTRUDER_NUM	0  //The number of the extruder that has the filament sensor (0,1,2)
796
-#define MEASUREMENT_DELAY_CM			14  //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
795
+#define FILAMENT_SENSOR_EXTRUDER_NUM 0   //The number of the extruder that has the filament sensor (0,1,2)
796
+#define MEASUREMENT_DELAY_CM        14   //measurement delay in cm.  This is the distance from filament sensor to middle of barrel
797
 
797
 
798
-#define DEFAULT_NOMINAL_FILAMENT_DIA  3.0  //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
799
-#define MEASURED_UPPER_LIMIT          3.30  //upper limit factor used for sensor reading validation in mm
800
-#define MEASURED_LOWER_LIMIT          1.90  //lower limit factor for sensor reading validation in mm
801
-#define MAX_MEASUREMENT_DELAY			20  //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
798
+#define DEFAULT_NOMINAL_FILAMENT_DIA 3.0 //Enter the diameter (in mm) of the filament generally used (3.0 mm or 1.75 mm) - this is then used in the slicer software.  Used for sensor reading validation
799
+#define MEASURED_UPPER_LIMIT         3.3 //upper limit factor used for sensor reading validation in mm
800
+#define MEASURED_LOWER_LIMIT         1.9 //lower limit factor for sensor reading validation in mm
801
+#define MAX_MEASUREMENT_DELAY       20   //delay buffer size in bytes (1 byte = 1cm)- limits maximum measurement delay allowable (must be larger than MEASUREMENT_DELAY_CM  and lower number saves RAM)
802
 
802
 
803
 //defines used in the code
803
 //defines used in the code
804
 #define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially
804
 #define DEFAULT_MEASURED_FILAMENT_DIA  DEFAULT_NOMINAL_FILAMENT_DIA  //set measured to nominal initially

+ 2
- 2
Marlin/Makefile View File

267
 CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
267
 CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
268
 	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
268
 	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
269
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
269
 	SdFile.cpp SdVolume.cpp motion_control.cpp planner.cpp		\
270
-	stepper.cpp temperature.cpp cardreader.cpp ConfigurationStore.cpp \
271
-	watchdog.cpp SPI.cpp Servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
270
+	stepper.cpp temperature.cpp cardreader.cpp configuration_store.cpp \
271
+	watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
272
 	vector_3.cpp qr_solve.cpp
272
 	vector_3.cpp qr_solve.cpp
273
 ifeq ($(LIQUID_TWI2), 0)
273
 ifeq ($(LIQUID_TWI2), 0)
274
 CXXSRC += LiquidCrystal.cpp
274
 CXXSRC += LiquidCrystal.cpp

+ 12
- 0
Marlin/Marlin.h View File

223
   void filrunout();
223
   void filrunout();
224
 #endif
224
 #endif
225
 
225
 
226
+/**
227
+ * Debug flags - not yet widely applied
228
+ */
229
+enum DebugFlags {
230
+  DEBUG_ECHO          = BIT(0),
231
+  DEBUG_INFO          = BIT(1),
232
+  DEBUG_ERRORS        = BIT(2),
233
+  DEBUG_DRYRUN        = BIT(3),
234
+  DEBUG_COMMUNICATION = BIT(4)
235
+};
236
+extern uint8_t marlin_debug_flags;
237
+
226
 extern bool Running;
238
 extern bool Running;
227
 inline bool IsRunning() { return  Running; }
239
 inline bool IsRunning() { return  Running; }
228
 inline bool IsStopped() { return !Running; }
240
 inline bool IsStopped() { return !Running; }

+ 125
- 111
Marlin/Marlin_main.cpp View File

49
 #include "motion_control.h"
49
 #include "motion_control.h"
50
 #include "cardreader.h"
50
 #include "cardreader.h"
51
 #include "watchdog.h"
51
 #include "watchdog.h"
52
-#include "ConfigurationStore.h"
52
+#include "configuration_store.h"
53
 #include "language.h"
53
 #include "language.h"
54
 #include "pins_arduino.h"
54
 #include "pins_arduino.h"
55
 #include "math.h"
55
 #include "math.h"
56
 
56
 
57
 #ifdef BLINKM
57
 #ifdef BLINKM
58
-  #include "BlinkM.h"
58
+  #include "blinkm.h"
59
   #include "Wire.h"
59
   #include "Wire.h"
60
 #endif
60
 #endif
61
 
61
 
62
 #if NUM_SERVOS > 0
62
 #if NUM_SERVOS > 0
63
-  #include "Servo.h"
63
+  #include "servo.h"
64
 #endif
64
 #endif
65
 
65
 
66
 #if HAS_DIGIPOTSS
66
 #if HAS_DIGIPOTSS
122
  *        Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
122
  *        Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
123
  *        The '#' is necessary when calling from within sd files, as it stops buffer prereading
123
  *        The '#' is necessary when calling from within sd files, as it stops buffer prereading
124
  * M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
124
  * M42  - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
125
- * M48  - Measure Z_Probe repeatability. M48 [n # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
125
+ * M48  - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
126
  * M80  - Turn on Power Supply
126
  * M80  - Turn on Power Supply
127
  * M81  - Turn off Power Supply
127
  * M81  - Turn off Power Supply
128
  * M82  - Set E codes absolute (default)
128
  * M82  - Set E codes absolute (default)
138
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
138
  * M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
139
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
139
  *        Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
140
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
140
  *        IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
141
+ * M111 - Set debug flags with S<mask>. See flag bits defined in Marlin.h.
141
  * M112 - Emergency stop
142
  * M112 - Emergency stop
142
  * M114 - Output current position to serial port
143
  * M114 - Output current position to serial port
143
  * M115 - Capabilities string
144
  * M115 - Capabilities string
184
  * M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder
185
  * M405 - Turn on Filament Sensor extrusion control.  Optional D<delay in cm> to set delay in centimeters between sensor and extruder
185
  * M406 - Turn off Filament Sensor extrusion control
186
  * M406 - Turn off Filament Sensor extrusion control
186
  * M407 - Display measured filament diameter
187
  * M407 - Display measured filament diameter
188
+ * M410 - Quickstop. Abort all the planned moves
187
  * M500 - Store parameters in EEPROM
189
  * M500 - Store parameters in EEPROM
188
  * M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
190
  * M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
189
  * M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
191
  * M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
217
 
219
 
218
 bool Running = true;
220
 bool Running = true;
219
 
221
 
222
+uint8_t marlin_debug_flags = DEBUG_INFO|DEBUG_ERRORS;
223
+
220
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
224
 static float feedrate = 1500.0, next_feedrate, saved_feedrate;
221
 float current_position[NUM_AXIS] = { 0.0 };
225
 float current_position[NUM_AXIS] = { 0.0 };
222
 static float destination[NUM_AXIS] = { 0.0 };
226
 static float destination[NUM_AXIS] = { 0.0 };
748
         gcode_N = (strtol(strchr_pointer + 1, NULL, 10));
752
         gcode_N = (strtol(strchr_pointer + 1, NULL, 10));
749
         if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) {
753
         if (gcode_N != gcode_LastN + 1 && strstr_P(command, PSTR("M110")) == NULL) {
750
           SERIAL_ERROR_START;
754
           SERIAL_ERROR_START;
751
-          SERIAL_ERRORPGM(MSG_ERR_LINE_NO);
752
-          SERIAL_ERRORLN(gcode_LastN);
753
-          //Serial.println(gcode_N);
755
+          SERIAL_ERRORPGM(MSG_ERR_LINE_NO1);
756
+          SERIAL_ERROR(gcode_LastN + 1);
757
+          SERIAL_ERRORPGM(MSG_ERR_LINE_NO2);
758
+          SERIAL_ERRORLN(gcode_N);
754
           FlushSerialRequestResend();
759
           FlushSerialRequestResend();
755
           serial_count = 0;
760
           serial_count = 0;
756
           return;
761
           return;
889
 }
894
 }
890
 
895
 
891
 bool code_has_value() {
896
 bool code_has_value() {
892
-  char c = strchr_pointer[1];
893
-  return (c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.';
897
+  int i = 1;
898
+  char c = strchr_pointer[i];
899
+  if (c == '-' || c == '+') c = strchr_pointer[++i];
900
+  if (c == '.') c = strchr_pointer[++i];
901
+  return (c >= '0' && c <= '9');
894
 }
902
 }
895
 
903
 
896
 float code_value() {
904
 float code_value() {
989
   #endif
997
   #endif
990
 
998
 
991
   #ifdef SCARA
999
   #ifdef SCARA
992
-    float homeposition[3];
993
    
1000
    
994
-    if (axis < 2) {
1001
+    if (axis == X_AXIS || axis == Y_AXIS) {
995
 
1002
 
1003
+      float homeposition[3];
996
       for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i);
1004
       for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i);
997
 
1005
 
998
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
1006
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
1022
       // inverse kinematic transform.
1030
       // inverse kinematic transform.
1023
       min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1031
       min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1024
       max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1032
       max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1025
-    } 
1026
-    else {
1027
-      current_position[axis] = base_home_pos(axis) + home_offset[axis];
1028
-      min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1029
-      max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1030
     }
1033
     }
1031
-  #else
1034
+    else
1035
+  #endif
1036
+  {
1032
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1037
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1033
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1038
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1034
     max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1039
     max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1035
-  #endif
1040
+
1041
+    #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0
1042
+      if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset;
1043
+    #endif
1044
+  }
1036
 }
1045
 }
1037
 
1046
 
1038
 /**
1047
 /**
1187
       st_synchronize();
1196
       st_synchronize();
1188
       endstops_hit_on_purpose(); // clear endstop hit flags
1197
       endstops_hit_on_purpose(); // clear endstop hit flags
1189
 
1198
 
1199
+      // Get the current stepper position after bumping an endstop
1190
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
1200
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
1191
-      // make sure the planner knows where we are as it may be a bit different than we last said to move to
1192
       sync_plan_position();
1201
       sync_plan_position();
1193
       
1202
       
1194
     #endif // !DELTA
1203
     #endif // !DELTA
1500
 
1509
 
1501
   if (axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : 0) {
1510
   if (axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : 0) {
1502
 
1511
 
1503
-    int axis_home_dir;
1504
-
1505
-    #ifdef DUAL_X_CARRIAGE
1506
-      if (axis == X_AXIS) axis_home_dir = x_home_dir(active_extruder);
1507
-    #else
1508
-      axis_home_dir = home_dir(axis);
1509
-    #endif
1512
+    int axis_home_dir =
1513
+      #ifdef DUAL_X_CARRIAGE
1514
+        (axis == X_AXIS) ? x_home_dir(active_extruder) :
1515
+      #endif
1516
+      home_dir(axis);
1510
 
1517
 
1511
     // Set the axis position as setup for the move
1518
     // Set the axis position as setup for the move
1512
     current_position[axis] = 0;
1519
     current_position[axis] = 0;
1744
 inline void gcode_G4() {
1751
 inline void gcode_G4() {
1745
   millis_t codenum = 0;
1752
   millis_t codenum = 0;
1746
 
1753
 
1747
-  LCD_MESSAGEPGM(MSG_DWELL);
1748
-
1749
   if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait
1754
   if (code_seen('P')) codenum = code_value_long(); // milliseconds to wait
1750
   if (code_seen('S')) codenum = code_value_long() * 1000; // seconds to wait
1755
   if (code_seen('S')) codenum = code_value_long() * 1000; // seconds to wait
1751
 
1756
 
1752
   st_synchronize();
1757
   st_synchronize();
1753
   refresh_cmd_timeout();
1758
   refresh_cmd_timeout();
1754
   codenum += previous_cmd_ms;  // keep track of when we started waiting
1759
   codenum += previous_cmd_ms;  // keep track of when we started waiting
1760
+
1761
+  if (!lcd_hasstatus()) LCD_MESSAGEPGM(MSG_DWELL);
1762
+
1755
   while (millis() < codenum) {
1763
   while (millis() < codenum) {
1756
     manage_heater();
1764
     manage_heater();
1757
     manage_inactivity();
1765
     manage_inactivity();
1794
  *  Y   Home to the Y endstop
1802
  *  Y   Home to the Y endstop
1795
  *  Z   Home to the Z endstop
1803
  *  Z   Home to the Z endstop
1796
  *
1804
  *
1797
- * If numbers are included with XYZ set the position as with G92
1798
- * Currently adds the home_offset, which may be wrong and removed soon.
1799
- *
1800
- *  Xn  Home X, setting X to n + home_offset[X_AXIS]
1801
- *  Yn  Home Y, setting Y to n + home_offset[Y_AXIS]
1802
- *  Zn  Home Z, setting Z to n + home_offset[Z_AXIS]
1803
  */
1805
  */
1804
 inline void gcode_G28() {
1806
 inline void gcode_G28() {
1805
 
1807
 
1859
           homeY = code_seen(axis_codes[Y_AXIS]),
1861
           homeY = code_seen(axis_codes[Y_AXIS]),
1860
           homeZ = code_seen(axis_codes[Z_AXIS]);
1862
           homeZ = code_seen(axis_codes[Z_AXIS]);
1861
 
1863
 
1862
-    home_all_axis = !(homeX || homeY || homeZ) || (homeX && homeY && homeZ);
1864
+    home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
1863
 
1865
 
1864
     if (home_all_axis || homeZ) {
1866
     if (home_all_axis || homeZ) {
1865
 
1867
 
1946
     // Home Y
1948
     // Home Y
1947
     if (home_all_axis || homeY) HOMEAXIS(Y);
1949
     if (home_all_axis || homeY) HOMEAXIS(Y);
1948
 
1950
 
1949
-    // Set the X position, if included
1950
-    if (code_seen(axis_codes[X_AXIS]) && code_has_value())
1951
-      current_position[X_AXIS] = code_value();
1952
-
1953
-    // Set the Y position, if included
1954
-    if (code_seen(axis_codes[Y_AXIS]) && code_has_value())
1955
-      current_position[Y_AXIS] = code_value();
1956
-
1957
     // Home Z last if homing towards the bed
1951
     // Home Z last if homing towards the bed
1958
     #if Z_HOME_DIR < 0
1952
     #if Z_HOME_DIR < 0
1959
 
1953
 
2037
 
2031
 
2038
     #endif // Z_HOME_DIR < 0
2032
     #endif // Z_HOME_DIR < 0
2039
 
2033
 
2040
-    // Set the Z position, if included
2041
-    if (code_seen(axis_codes[Z_AXIS]) && code_has_value())
2042
-      current_position[Z_AXIS] = code_value();
2043
-
2044
-    #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0)
2045
-      if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset;  // Add Z_Probe offset (the distance is negative)
2046
-    #endif
2047
-
2048
     sync_plan_position();
2034
     sync_plan_position();
2049
 
2035
 
2050
   #endif // else DELTA
2036
   #endif // else DELTA
2893
    * M48: Z-Probe repeatability measurement function.
2879
    * M48: Z-Probe repeatability measurement function.
2894
    *
2880
    *
2895
    * Usage:
2881
    * Usage:
2896
-   *   M48 <n#> <X#> <Y#> <V#> <E> <L#>
2882
+   *   M48 <P#> <X#> <Y#> <V#> <E> <L#>
2897
    *     P = Number of sampled points (4-50, default 10)
2883
    *     P = Number of sampled points (4-50, default 10)
2898
    *     X = Sample X position
2884
    *     X = Sample X position
2899
    *     Y = Sample Y position
2885
    *     Y = Sample Y position
2905
    * as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
2891
    * as been issued prior to invoking the M48 Z-Probe repeatability measurement function.
2906
    * Any information generated by a prior G29 Bed leveling command will be lost and need to be
2892
    * Any information generated by a prior G29 Bed leveling command will be lost and need to be
2907
    * regenerated.
2893
    * regenerated.
2908
-   *
2909
-   * The number of samples will default to 10 if not specified.  You can use upper or lower case
2910
-   * letters for any of the options EXCEPT n.  n must be in lower case because Marlin uses a capital
2911
-   * N for its communication protocol and will get horribly confused if you send it a capital N.
2912
    */
2894
    */
2913
   inline void gcode_M48() {
2895
   inline void gcode_M48() {
2914
 
2896
 
2926
     if (verbose_level > 0)
2908
     if (verbose_level > 0)
2927
       SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
2909
       SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
2928
 
2910
 
2929
-    if (code_seen('P') || code_seen('p') || code_seen('n')) { // `n` for legacy support only - please use `P`!
2911
+    if (code_seen('P') || code_seen('p')) {
2930
       n_samples = code_value_short();
2912
       n_samples = code_value_short();
2931
       if (n_samples < 4 || n_samples > 50) {
2913
       if (n_samples < 4 || n_samples > 50) {
2932
         SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
2914
         SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
2934
       }
2916
       }
2935
     }
2917
     }
2936
 
2918
 
2937
-    double X_probe_location, Y_probe_location,
2938
-           X_current = X_probe_location = st_get_position_mm(X_AXIS),
2939
-           Y_current = Y_probe_location = st_get_position_mm(Y_AXIS),
2919
+    double X_current = st_get_position_mm(X_AXIS),
2920
+           Y_current = st_get_position_mm(Y_AXIS),
2940
            Z_current = st_get_position_mm(Z_AXIS),
2921
            Z_current = st_get_position_mm(Z_AXIS),
2941
-           Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING,
2942
-           ext_position = st_get_position_mm(E_AXIS);
2922
+           E_current = st_get_position_mm(E_AXIS),
2923
+           X_probe_location = X_current, Y_probe_location = Y_current,
2924
+           Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
2943
 
2925
 
2944
     bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2926
     bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2945
 
2927
 
2974
 
2956
 
2975
     st_synchronize();
2957
     st_synchronize();
2976
     plan_bed_level_matrix.set_to_identity();
2958
     plan_bed_level_matrix.set_to_identity();
2977
-    plan_buffer_line(X_current, Y_current, Z_start_location,
2978
-        ext_position,
2979
-        homing_feedrate[Z_AXIS] / 60,
2980
-        active_extruder);
2959
+    plan_buffer_line(X_current, Y_current, Z_start_location, E_current, homing_feedrate[Z_AXIS] / 60, active_extruder);
2981
     st_synchronize();
2960
     st_synchronize();
2982
 
2961
 
2983
     //
2962
     //
2989
       SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2968
       SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2990
 
2969
 
2991
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2970
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2992
-        ext_position,
2971
+        E_current,
2993
         homing_feedrate[X_AXIS]/60,
2972
         homing_feedrate[X_AXIS]/60,
2994
         active_extruder);
2973
         active_extruder);
2995
     st_synchronize();
2974
     st_synchronize();
2997
     current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
2976
     current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
2998
     current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
2977
     current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
2999
     current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
2978
     current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
3000
-    current_position[E_AXIS] = ext_position = st_get_position_mm(E_AXIS);
2979
+    current_position[E_AXIS] = E_current = st_get_position_mm(E_AXIS);
3001
 
2980
 
3002
     // 
2981
     // 
3003
     // OK, do the inital probe to get us close to the bed.
2982
     // OK, do the inital probe to get us close to the bed.
3013
     Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
2992
     Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
3014
 
2993
 
3015
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2994
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
3016
-        ext_position,
2995
+        E_current,
3017
         homing_feedrate[X_AXIS]/60,
2996
         homing_feedrate[X_AXIS]/60,
3018
         active_extruder);
2997
         active_extruder);
3019
     st_synchronize();
2998
     st_synchronize();
3043
           if (radius < 0.0) radius = -radius;
3022
           if (radius < 0.0) radius = -radius;
3044
 
3023
 
3045
           X_current = X_probe_location + cos(theta) * radius;
3024
           X_current = X_probe_location + cos(theta) * radius;
3046
-          Y_current = Y_probe_location + sin(theta) * radius;
3047
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
3025
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
3026
+          Y_current = Y_probe_location + sin(theta) * radius;
3048
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
3027
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
3049
 
3028
 
3050
           if (verbose_level > 3) {
3029
           if (verbose_level > 3) {
3160
 inline void gcode_M105() {
3139
 inline void gcode_M105() {
3161
   if (setTargetedHotend(105)) return;
3140
   if (setTargetedHotend(105)) return;
3162
 
3141
 
3163
-  #if HAS_TEMP_0 || HAS_TEMP_BED
3142
+  #if HAS_TEMP_0 || HAS_TEMP_BED || defined(HEATER_0_USES_MAX6675)
3164
     SERIAL_PROTOCOLPGM("ok");
3143
     SERIAL_PROTOCOLPGM("ok");
3165
     #if HAS_TEMP_0
3144
     #if HAS_TEMP_0
3166
       SERIAL_PROTOCOLPGM(" T:");
3145
       SERIAL_PROTOCOLPGM(" T:");
3362
 #endif // HAS_TEMP_BED
3341
 #endif // HAS_TEMP_BED
3363
 
3342
 
3364
 /**
3343
 /**
3365
- * M112: Emergency Stop
3344
+ * M111: Set the debug level
3366
  */
3345
  */
3367
-inline void gcode_M112() {
3368
-  kill();
3346
+inline void gcode_M111() {
3347
+  marlin_debug_flags = code_seen('S') ? code_value_short() : DEBUG_INFO|DEBUG_ERRORS;
3369
 }
3348
 }
3370
 
3349
 
3350
+/**
3351
+ * M112: Emergency Stop
3352
+ */
3353
+inline void gcode_M112() { kill(); }
3354
+
3371
 #ifdef BARICUDA
3355
 #ifdef BARICUDA
3372
 
3356
 
3373
   #if HAS_HEATER_1
3357
   #if HAS_HEATER_1
3809
    * M666: Set delta endstop adjustment
3793
    * M666: Set delta endstop adjustment
3810
    */
3794
    */
3811
   inline void gcode_M666() {
3795
   inline void gcode_M666() {
3812
-    for (int8_t i = 0; i < 3; i++) {
3796
+    for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
3813
       if (code_seen(axis_codes[i])) {
3797
       if (code_seen(axis_codes[i])) {
3814
         endstop_adj[i] = code_value();
3798
         endstop_adj[i] = code_value();
3815
       }
3799
       }
3816
     }
3800
     }
3817
   }
3801
   }
3818
-#elif defined(Z_DUAL_ENDSTOPS)
3802
+#elif defined(Z_DUAL_ENDSTOPS) // !DELTA && defined(Z_DUAL_ENDSTOPS)
3819
   /**
3803
   /**
3820
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
3804
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
3821
    */
3805
    */
3822
   inline void gcode_M666() {
3806
   inline void gcode_M666() {
3823
-   if (code_seen('Z')) z_endstop_adj = code_value();
3824
-   SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj );
3825
-   SERIAL_EOL;
3807
+    if (code_seen('Z')) z_endstop_adj = code_value();
3808
+    SERIAL_ECHOPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
3809
+    SERIAL_EOL;
3826
   }
3810
   }
3827
   
3811
   
3828
-#endif // DELTA
3812
+#endif // !DELTA && defined(Z_DUAL_ENDSTOPS)
3829
 
3813
 
3830
 #ifdef FWRETRACT
3814
 #ifdef FWRETRACT
3831
 
3815
 
4025
   inline void gcode_M300() {
4009
   inline void gcode_M300() {
4026
     uint16_t beepS = code_seen('S') ? code_value_short() : 110;
4010
     uint16_t beepS = code_seen('S') ? code_value_short() : 110;
4027
     uint32_t beepP = code_seen('P') ? code_value_long() : 1000;
4011
     uint32_t beepP = code_seen('P') ? code_value_long() : 1000;
4028
-    if (beepS > 0) {
4029
-      #if BEEPER > 0
4030
-        tone(BEEPER, beepS);
4031
-        delay(beepP);
4032
-        noTone(BEEPER);
4033
-      #elif defined(ULTRALCD)
4034
-        lcd_buzz(beepS, beepP);
4035
-      #elif defined(LCD_USE_I2C_BUZZER)
4036
-        lcd_buzz(beepP, beepS);
4037
-      #endif
4038
-    }
4039
-    else {
4040
-      delay(beepP);
4041
-    }
4012
+    if (beepP > 5000) beepP = 5000; // limit to 5 seconds
4013
+    lcd_buzz(beepP, beepS);
4042
   }
4014
   }
4043
 
4015
 
4044
 #endif // BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER
4016
 #endif // BEEPER>0 || ULTRALCD || LCD_USE_I2C_BUZZER
4313
 
4285
 
4314
 #if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && not defined(Z_PROBE_SLED)
4286
 #if defined(ENABLE_AUTO_BED_LEVELING) && (defined(SERVO_ENDSTOPS) || defined(Z_PROBE_ALLEN_KEY)) && not defined(Z_PROBE_SLED)
4315
 
4287
 
4288
+  #ifdef SERVO_ENDSTOPS
4289
+    void raise_z_for_servo() {
4290
+      float zpos = current_position[Z_AXIS], z_dest = Z_RAISE_BEFORE_HOMING;
4291
+      if (!axis_known_position[Z_AXIS]) z_dest += zpos;
4292
+      if (zpos < z_dest)
4293
+        do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_dest); // also updates current_position
4294
+    }
4295
+  #endif
4296
+
4316
   /**
4297
   /**
4317
    * M401: Engage Z Servo endstop if available
4298
    * M401: Engage Z Servo endstop if available
4318
    */
4299
    */
4319
-  inline void gcode_M401() { deploy_z_probe(); }
4300
+  inline void gcode_M401() {
4301
+    #ifdef SERVO_ENDSTOPS
4302
+      raise_z_for_servo();
4303
+    #endif
4304
+    deploy_z_probe();
4305
+  }
4306
+
4320
   /**
4307
   /**
4321
    * M402: Retract Z Servo endstop if enabled
4308
    * M402: Retract Z Servo endstop if enabled
4322
    */
4309
    */
4323
-  inline void gcode_M402() { stow_z_probe(); }
4310
+  inline void gcode_M402() {
4311
+    #ifdef SERVO_ENDSTOPS
4312
+      raise_z_for_servo();
4313
+    #endif
4314
+    stow_z_probe();
4315
+  }
4324
 
4316
 
4325
 #endif
4317
 #endif
4326
 
4318
 
4381
 #endif // FILAMENT_SENSOR
4373
 #endif // FILAMENT_SENSOR
4382
 
4374
 
4383
 /**
4375
 /**
4376
+ * M410: Quickstop - Abort all planned moves
4377
+ *
4378
+ * This will stop the carriages mid-move, so most likely they
4379
+ * will be out of sync with the stepper position after this.
4380
+ */
4381
+inline void gcode_M410() { quickStop(); }
4382
+
4383
+/**
4384
  * M500: Store settings in EEPROM
4384
  * M500: Store settings in EEPROM
4385
  */
4385
  */
4386
 inline void gcode_M500() {
4386
 inline void gcode_M500() {
4426
     if (code_seen('Z')) {
4426
     if (code_seen('Z')) {
4427
       value = code_value();
4427
       value = code_value();
4428
       if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) {
4428
       if (Z_PROBE_OFFSET_RANGE_MIN <= value && value <= Z_PROBE_OFFSET_RANGE_MAX) {
4429
-        zprobe_zoffset = -value; // compare w/ line 278 of ConfigurationStore.cpp
4429
+        zprobe_zoffset = -value; // compare w/ line 278 of configuration_store.cpp
4430
         SERIAL_ECHO_START;
4430
         SERIAL_ECHO_START;
4431
         SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK);
4431
         SERIAL_ECHOLNPGM(MSG_ZPROBE_ZOFFSET " " MSG_OK);
4432
         SERIAL_EOL;
4432
         SERIAL_EOL;
4790
  * This is called from the main loop()
4790
  * This is called from the main loop()
4791
  */
4791
  */
4792
 void process_commands() {
4792
 void process_commands() {
4793
+
4794
+  if ((marlin_debug_flags & DEBUG_ECHO)) {
4795
+    SERIAL_ECHO_START;
4796
+    SERIAL_ECHOLN(command_queue[cmd_queue_index_r]);
4797
+  }
4798
+
4793
   if (code_seen('G')) {
4799
   if (code_seen('G')) {
4794
 
4800
 
4795
     int gCode = code_value_short();
4801
     int gCode = code_value_short();
4928
         gcode_M104();
4934
         gcode_M104();
4929
         break;
4935
         break;
4930
 
4936
 
4931
-      case 112: //  M112 Emergency Stop
4937
+      case 111: //  M111: Set debug level
4938
+        gcode_M111();
4939
+        break;
4940
+
4941
+      case 112: //  M112: Emergency Stop
4932
         gcode_M112();
4942
         gcode_M112();
4933
         break;
4943
         break;
4934
 
4944
 
4935
-      case 140: // M140 Set bed temp
4945
+      case 140: // M140: Set bed temp
4936
         gcode_M140();
4946
         gcode_M140();
4937
         break;
4947
         break;
4938
 
4948
 
4939
-      case 105: // M105 Read current temperature
4949
+      case 105: // M105: Read current temperature
4940
         gcode_M105();
4950
         gcode_M105();
4941
         return;
4951
         return;
4942
         break;
4952
         break;
4943
 
4953
 
4944
-      case 109: // M109 Wait for temperature
4954
+      case 109: // M109: Wait for temperature
4945
         gcode_M109();
4955
         gcode_M109();
4946
         break;
4956
         break;
4947
 
4957
 
4948
       #if HAS_TEMP_BED
4958
       #if HAS_TEMP_BED
4949
-        case 190: // M190 - Wait for bed heater to reach target.
4959
+        case 190: // M190: Wait for bed heater to reach target
4950
           gcode_M190();
4960
           gcode_M190();
4951
           break;
4961
           break;
4952
       #endif // HAS_TEMP_BED
4962
       #endif // HAS_TEMP_BED
4953
 
4963
 
4954
       #if HAS_FAN
4964
       #if HAS_FAN
4955
-        case 106: //M106 Fan On
4965
+        case 106: // M106: Fan On
4956
           gcode_M106();
4966
           gcode_M106();
4957
           break;
4967
           break;
4958
-        case 107: //M107 Fan Off
4968
+        case 107: // M107: Fan Off
4959
           gcode_M107();
4969
           gcode_M107();
4960
           break;
4970
           break;
4961
       #endif // HAS_FAN
4971
       #endif // HAS_FAN
4963
       #ifdef BARICUDA
4973
       #ifdef BARICUDA
4964
         // PWM for HEATER_1_PIN
4974
         // PWM for HEATER_1_PIN
4965
         #if HAS_HEATER_1
4975
         #if HAS_HEATER_1
4966
-          case 126: // M126 valve open
4976
+          case 126: // M126: valve open
4967
             gcode_M126();
4977
             gcode_M126();
4968
             break;
4978
             break;
4969
-          case 127: // M127 valve closed
4979
+          case 127: // M127: valve closed
4970
             gcode_M127();
4980
             gcode_M127();
4971
             break;
4981
             break;
4972
         #endif // HAS_HEATER_1
4982
         #endif // HAS_HEATER_1
4973
 
4983
 
4974
         // PWM for HEATER_2_PIN
4984
         // PWM for HEATER_2_PIN
4975
         #if HAS_HEATER_2
4985
         #if HAS_HEATER_2
4976
-          case 128: // M128 valve open
4986
+          case 128: // M128: valve open
4977
             gcode_M128();
4987
             gcode_M128();
4978
             break;
4988
             break;
4979
-          case 129: // M129 valve closed
4989
+          case 129: // M129: valve closed
4980
             gcode_M129();
4990
             gcode_M129();
4981
             break;
4991
             break;
4982
         #endif // HAS_HEATER_2
4992
         #endif // HAS_HEATER_2
4984
 
4994
 
4985
       #if HAS_POWER_SWITCH
4995
       #if HAS_POWER_SWITCH
4986
 
4996
 
4987
-        case 80: // M80 - Turn on Power Supply
4997
+        case 80: // M80: Turn on Power Supply
4988
           gcode_M80();
4998
           gcode_M80();
4989
           break;
4999
           break;
4990
 
5000
 
4991
       #endif // HAS_POWER_SWITCH
5001
       #endif // HAS_POWER_SWITCH
4992
 
5002
 
4993
-      case 81: // M81 - Turn off Power, including Power Supply, if possible
5003
+      case 81: // M81: Turn off Power, including Power Supply, if possible
4994
         gcode_M81();
5004
         gcode_M81();
4995
         break;
5005
         break;
4996
 
5006
 
5000
       case 83:
5010
       case 83:
5001
         gcode_M83();
5011
         gcode_M83();
5002
         break;
5012
         break;
5003
-      case 18: //compatibility
5013
+      case 18: // (for compatibility)
5004
       case 84: // M84
5014
       case 84: // M84
5005
         gcode_M18_M84();
5015
         gcode_M18_M84();
5006
         break;
5016
         break;
5199
           break;
5209
           break;
5200
       #endif // FILAMENT_SENSOR
5210
       #endif // FILAMENT_SENSOR
5201
 
5211
 
5212
+      case 410: // M410 quickstop - Abort all the planned moves.
5213
+        gcode_M410();
5214
+        break;
5215
+
5202
       case 500: // M500 Store settings in EEPROM
5216
       case 500: // M500 Store settings in EEPROM
5203
         gcode_M500();
5217
         gcode_M500();
5204
         break;
5218
         break;

+ 2
- 2
Marlin/SanityCheck.h View File

87
   /**
87
   /**
88
    * Required LCD language
88
    * Required LCD language
89
    */
89
    */
90
-  #if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)
91
-    #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN for your LCD controller.
90
+  #if !defined(DOGLCD) && defined(ULTRA_LCD) && !defined(DISPLAY_CHARSET_HD44780_JAPAN) && !defined(DISPLAY_CHARSET_HD44780_WESTERN)&& !defined(DISPLAY_CHARSET_HD44780_CYRILLIC)
91
+    #error You must enable either DISPLAY_CHARSET_HD44780_JAPAN or DISPLAY_CHARSET_HD44780_WESTERN  or DISPLAY_CHARSET_HD44780_CYRILLIC for your LCD controller.
92
   #endif
92
   #endif
93
 
93
 
94
   /**
94
   /**

+ 2
- 2
Marlin/Servo.cpp View File

1
 /*
1
 /*
2
- Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
2
+ servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3
  Copyright (c) 2009 Michael Margolis.  All right reserved.
3
  Copyright (c) 2009 Michael Margolis.  All right reserved.
4
 
4
 
5
  This library is free software; you can redistribute it and/or
5
  This library is free software; you can redistribute it and/or
48
 #include <avr/interrupt.h>
48
 #include <avr/interrupt.h>
49
 #include <Arduino.h>
49
 #include <Arduino.h>
50
 
50
 
51
-#include "Servo.h"
51
+#include "servo.h"
52
 
52
 
53
 #define usToTicks(_us)    (( clockCyclesPerMicrosecond()* _us) / 8)     // converts microseconds to tick (assumes prescale of 8)  // 12 Aug 2009
53
 #define usToTicks(_us)    (( clockCyclesPerMicrosecond()* _us) / 8)     // converts microseconds to tick (assumes prescale of 8)  // 12 Aug 2009
54
 #define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
54
 #define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds

+ 3
- 3
Marlin/Servo.h View File

1
 /*
1
 /*
2
-  Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
2
+  servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3
   Copyright (c) 2009 Michael Margolis.  All right reserved.
3
   Copyright (c) 2009 Michael Margolis.  All right reserved.
4
 
4
 
5
   This library is free software; you can redistribute it and/or
5
   This library is free software; you can redistribute it and/or
42
    detach()    - Stops an attached servos from pulsing its i/o pin.
42
    detach()    - Stops an attached servos from pulsing its i/o pin.
43
  */
43
  */
44
 
44
 
45
-#ifndef Servo_h
46
-#define Servo_h
45
+#ifndef servo_h
46
+#define servo_h
47
 
47
 
48
 #include <inttypes.h>
48
 #include <inttypes.h>
49
 
49
 

Marlin/BlinkM.cpp → Marlin/blinkm.cpp View File

1
 /*
1
 /*
2
-  BlinkM.cpp - Library for controlling a BlinkM over i2c
2
+  blinkm.cpp - Library for controlling a BlinkM over i2c
3
   Created by Tim Koster, August 21 2013.
3
   Created by Tim Koster, August 21 2013.
4
 */
4
 */
5
 #include "Marlin.h"
5
 #include "Marlin.h"
6
 #ifdef BLINKM
6
 #ifdef BLINKM
7
 
7
 
8
-#include "BlinkM.h"
8
+#include "blinkm.h"
9
 
9
 
10
 void SendColors(byte red, byte grn, byte blu) {
10
 void SendColors(byte red, byte grn, byte blu) {
11
   Wire.begin(); 
11
   Wire.begin(); 

Marlin/BlinkM.h → Marlin/blinkm.h View File

1
 /*
1
 /*
2
-  BlinkM.h
2
+  blinkm.h
3
   Library header file for BlinkM library
3
   Library header file for BlinkM library
4
  */
4
  */
5
 #if ARDUINO >= 100
5
 #if ARDUINO >= 100

Marlin/ConfigurationStore.cpp → Marlin/configuration_store.cpp View File

1
 /**
1
 /**
2
- * ConfigurationStore.cpp
2
+ * configuration_store.cpp
3
  *
3
  *
4
  * Configuration and EEPROM storage
4
  * Configuration and EEPROM storage
5
  *
5
  *
93
 #include "planner.h"
93
 #include "planner.h"
94
 #include "temperature.h"
94
 #include "temperature.h"
95
 #include "ultralcd.h"
95
 #include "ultralcd.h"
96
-#include "ConfigurationStore.h"
96
+#include "configuration_store.h"
97
 
97
 
98
 #ifdef MESH_BED_LEVELING
98
 #ifdef MESH_BED_LEVELING
99
    #include "mesh_bed_leveling.h"
99
    #include "mesh_bed_leveling.h"

Marlin/ConfigurationStore.h → Marlin/configuration_store.h View File

1
-#ifndef CONFIGURATIONSTORE_H
2
-#define CONFIGURATIONSTORE_H
1
+#ifndef CONFIGURATION_STORE_H
2
+#define CONFIGURATION_STORE_H
3
 
3
 
4
 #include "Configuration.h"
4
 #include "Configuration.h"
5
 
5
 
19
   FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
19
   FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
20
 #endif
20
 #endif
21
 
21
 
22
-#endif //CONFIGURATIONSTORE_H
22
+#endif //CONFIGURATION_STORE_H

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

364
 #define E_ENABLE_ON 0 // For all extruders
364
 #define E_ENABLE_ON 0 // For all extruders
365
 
365
 
366
 // Disables axis when it's not being used.
366
 // Disables axis when it's not being used.
367
+// WARNING: When motors turn off there is a chance of losing position accuracy!
367
 #define DISABLE_X false
368
 #define DISABLE_X false
368
 #define DISABLE_Y false
369
 #define DISABLE_Y false
369
 #define DISABLE_Z false
370
 #define DISABLE_Z false
660
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
661
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
661
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
662
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
662
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
663
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
663
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
664
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
664
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
665
-                                               // 0 to disable buzzer feedback  
665
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
666
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
666
 
667
 
667
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
668
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
668
 // http://reprap.org/wiki/PanelOne
669
 // http://reprap.org/wiki/PanelOne

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

122
 #define MSG_PLANNER_BUFFER_BYTES            "  PlannerBufferBytes: "
122
 #define MSG_PLANNER_BUFFER_BYTES            "  PlannerBufferBytes: "
123
 #define MSG_OK                              "ok"
123
 #define MSG_OK                              "ok"
124
 #define MSG_FILE_SAVED                      "Done saving file."
124
 #define MSG_FILE_SAVED                      "Done saving file."
125
-#define MSG_ERR_LINE_NO                     "Line Number is not Last Line Number+1, Last Line: "
125
+#define MSG_ERR_LINE_NO1                    "Line Number out of sequence. Expected: "
126
+#define MSG_ERR_LINE_NO2                    " Got: "
126
 #define MSG_ERR_CHECKSUM_MISMATCH           "checksum mismatch, Last Line: "
127
 #define MSG_ERR_CHECKSUM_MISMATCH           "checksum mismatch, Last Line: "
127
 #define MSG_ERR_NO_CHECKSUM                 "No Checksum with line number, Last Line: "
128
 #define MSG_ERR_NO_CHECKSUM                 "No Checksum with line number, Last Line: "
128
 #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "
129
 #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "
209
 #define MSG_OK_B                            "ok B:"
210
 #define MSG_OK_B                            "ok B:"
210
 #define MSG_OK_T                            "ok T:"
211
 #define MSG_OK_T                            "ok T:"
211
 #define MSG_AT                              " @:"
212
 #define MSG_AT                              " @:"
212
-#define MSG_PID_AUTOTUNE_FINISHED           MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"
213
+#define MSG_PID_AUTOTUNE_FINISHED           MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h"
213
 #define MSG_PID_DEBUG                       " PID_DEBUG "
214
 #define MSG_PID_DEBUG                       " PID_DEBUG "
214
 #define MSG_PID_DEBUG_INPUT                 ": Input "
215
 #define MSG_PID_DEBUG_INPUT                 ": Input "
215
 #define MSG_PID_DEBUG_OUTPUT                " Output "
216
 #define MSG_PID_DEBUG_OUTPUT                " Output "

Marlin/DOGMbitmaps.h → Marlin/dogm_bitmaps.h View File


+ 1
- 1
Marlin/dogm_lcd_implementation.h View File

29
 #endif
29
 #endif
30
 
30
 
31
 #include <U8glib.h>
31
 #include <U8glib.h>
32
-#include "DOGMbitmaps.h"
32
+#include "dogm_bitmaps.h"
33
 
33
 
34
 #include "ultralcd.h"
34
 #include "ultralcd.h"
35
 #include "ultralcd_st7920_u8glib_rrd.h"
35
 #include "ultralcd_st7920_u8glib_rrd.h"

+ 4
- 3
Marlin/example_configurations/Felix/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
317
 #define E_ENABLE_ON 0 // For all extruders
317
 #define E_ENABLE_ON 0 // For all extruders
318
 
318
 
319
 // Disables axis when it's not being used.
319
 // Disables axis when it's not being used.
320
+// WARNING: When motors turn off there is a chance of losing position accuracy!
320
 #define DISABLE_X false
321
 #define DISABLE_X false
321
 #define DISABLE_Y false
322
 #define DISABLE_Y false
322
 #define DISABLE_Z false
323
 #define DISABLE_Z false
594
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
595
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
595
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
596
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
596
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
597
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
597
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
598
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
598
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
599
-                                               // 0 to disable buzzer feedback  
599
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
600
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
600
 
601
 
601
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
602
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
602
 // http://reprap.org/wiki/PanelOne
603
 // http://reprap.org/wiki/PanelOne

+ 3
- 2
Marlin/example_configurations/Felix/Configuration_DUAL.h View File

317
 #define E_ENABLE_ON 0 // For all extruders
317
 #define E_ENABLE_ON 0 // For all extruders
318
 
318
 
319
 // Disables axis when it's not being used.
319
 // Disables axis when it's not being used.
320
+// WARNING: When motors turn off there is a chance of losing position accuracy!
320
 #define DISABLE_X false
321
 #define DISABLE_X false
321
 #define DISABLE_Y false
322
 #define DISABLE_Y false
322
 #define DISABLE_Z false
323
 #define DISABLE_Z false
590
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
591
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
591
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
592
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
592
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
593
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
593
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
594
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
594
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
595
-                                               // 0 to disable buzzer feedback  
595
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
596
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
596
 
597
 
597
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
598
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
598
 // http://reprap.org/wiki/PanelOne
599
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/Hephestos/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
338
 #define E_ENABLE_ON 0 // For all extruders
338
 #define E_ENABLE_ON 0 // For all extruders
339
 
339
 
340
 // Disables axis when it's not being used.
340
 // Disables axis when it's not being used.
341
+// WARNING: When motors turn off there is a chance of losing position accuracy!
341
 #define DISABLE_X false
342
 #define DISABLE_X false
342
 #define DISABLE_Y false
343
 #define DISABLE_Y false
343
 #define DISABLE_Z false
344
 #define DISABLE_Z false
614
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
615
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
615
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
616
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
616
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
617
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
617
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
618
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
618
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
619
-                                               // 0 to disable buzzer feedback  
619
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
620
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
620
 
621
 
621
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
622
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
622
 // http://reprap.org/wiki/PanelOne
623
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/K8200/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
375
 #define E_ENABLE_ON 0 // For all extruders
375
 #define E_ENABLE_ON 0 // For all extruders
376
 
376
 
377
 // Disables axis when it's not being used.
377
 // Disables axis when it's not being used.
378
+// WARNING: When motors turn off there is a chance of losing position accuracy!
378
 #define DISABLE_X false
379
 #define DISABLE_X false
379
 #define DISABLE_Y false
380
 #define DISABLE_Y false
380
 #define DISABLE_Z true
381
 #define DISABLE_Z true
672
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
673
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
673
 #define ULTIMAKERCONTROLLER // K8200: for Display VM8201 // as available from the Ultimaker online store.
674
 #define ULTIMAKERCONTROLLER // K8200: for Display VM8201 // as available from the Ultimaker online store.
674
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
675
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
675
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
676
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
676
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
677
-                                               // 0 to disable buzzer feedback  
677
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
678
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
678
 
679
 
679
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
680
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
680
 // http://reprap.org/wiki/PanelOne
681
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/SCARA/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
369
 #define E_ENABLE_ON 0 // For all extruders
369
 #define E_ENABLE_ON 0 // For all extruders
370
 
370
 
371
 // Disables axis when it's not being used.
371
 // Disables axis when it's not being used.
372
+// WARNING: When motors turn off there is a chance of losing position accuracy!
372
 #define DISABLE_X false
373
 #define DISABLE_X false
373
 #define DISABLE_Y false
374
 #define DISABLE_Y false
374
 #define DISABLE_Z false
375
 #define DISABLE_Z false
645
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
646
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
646
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
647
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
647
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
648
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
648
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
649
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
649
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
650
-                                               // 0 to disable buzzer feedback  
650
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
651
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
651
 
652
 
652
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
653
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
653
 // http://reprap.org/wiki/PanelOne
654
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/WITBOX/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
337
 #define E_ENABLE_ON 0 // For all extruders
337
 #define E_ENABLE_ON 0 // For all extruders
338
 
338
 
339
 // Disables axis when it's not being used.
339
 // Disables axis when it's not being used.
340
+// WARNING: When motors turn off there is a chance of losing position accuracy!
340
 #define DISABLE_X false
341
 #define DISABLE_X false
341
 #define DISABLE_Y false
342
 #define DISABLE_Y false
342
 #define DISABLE_Z true
343
 #define DISABLE_Z true
613
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
614
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
614
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
615
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
615
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
616
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
616
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
617
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
617
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
618
-                                               // 0 to disable buzzer feedback  
618
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
619
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
619
 
620
 
620
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
621
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
621
 // http://reprap.org/wiki/PanelOne
622
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/delta/generic/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
367
 #define E_ENABLE_ON 0 // For all extruders
367
 #define E_ENABLE_ON 0 // For all extruders
368
 
368
 
369
 // Disables axis when it's not being used.
369
 // Disables axis when it's not being used.
370
+// WARNING: When motors turn off there is a chance of losing position accuracy!
370
 #define DISABLE_X false
371
 #define DISABLE_X false
371
 #define DISABLE_Y false
372
 #define DISABLE_Y false
372
 #define DISABLE_Z false
373
 #define DISABLE_Z false
662
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
663
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
663
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
664
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
664
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
665
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
665
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
666
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
666
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
667
-                                               // 0 to disable buzzer feedback  
667
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
668
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
668
 
669
 
669
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
670
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
670
 // http://reprap.org/wiki/PanelOne
671
 // http://reprap.org/wiki/PanelOne

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

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
367
 #define E_ENABLE_ON 0 // For all extruders
367
 #define E_ENABLE_ON 0 // For all extruders
368
 
368
 
369
 // Disables axis when it's not being used.
369
 // Disables axis when it's not being used.
370
+// WARNING: When motors turn off there is a chance of losing position accuracy!
370
 #define DISABLE_X false
371
 #define DISABLE_X false
371
 #define DISABLE_Y false
372
 #define DISABLE_Y false
372
 #define DISABLE_Z false
373
 #define DISABLE_Z false
666
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
667
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
667
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
668
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
668
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
669
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
669
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
670
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
670
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
671
-                                               // 0 to disable buzzer feedback  
671
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
672
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
672
 
673
 
673
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
674
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
674
 // http://reprap.org/wiki/PanelOne
675
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/makibox/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
337
 #define E_ENABLE_ON 0 // For all extruders
337
 #define E_ENABLE_ON 0 // For all extruders
338
 
338
 
339
 // Disables axis when it's not being used.
339
 // Disables axis when it's not being used.
340
+// WARNING: When motors turn off there is a chance of losing position accuracy!
340
 #define DISABLE_X false
341
 #define DISABLE_X false
341
 #define DISABLE_Y false
342
 #define DISABLE_Y false
342
 #define DISABLE_Z false
343
 #define DISABLE_Z false
613
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
614
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
614
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
615
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
615
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
616
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
616
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
617
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
617
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
618
-                                               // 0 to disable buzzer feedback  
618
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
619
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
619
 
620
 
620
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
621
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
621
 // http://reprap.org/wiki/PanelOne
622
 // http://reprap.org/wiki/PanelOne

+ 4
- 3
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

1
-#ifndef CONFIGURATION_H
1
+#ifndef CONFIGURATION_H
2
 #define CONFIGURATION_H
2
 #define CONFIGURATION_H
3
 
3
 
4
 #include "boards.h"
4
 #include "boards.h"
339
 #define E_ENABLE_ON 1 // For all extruders
339
 #define E_ENABLE_ON 1 // For all extruders
340
 
340
 
341
 // Disables axis when it's not being used.
341
 // Disables axis when it's not being used.
342
+// WARNING: When motors turn off there is a chance of losing position accuracy!
342
 #define DISABLE_X false
343
 #define DISABLE_X false
343
 #define DISABLE_Y false
344
 #define DISABLE_Y false
344
 #define DISABLE_Z false
345
 #define DISABLE_Z false
619
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
620
 //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking
620
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
621
 //#define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
621
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
622
 //#define ULTIPANEL  //the UltiPanel as on Thingiverse
622
-//#define LCD_FEEDBACK_FREQUENCY_HZ 1000	// this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
623
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
623
 //#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click
624
-                                               // 0 to disable buzzer feedback  
624
+//#define LCD_FEEDBACK_FREQUENCY_HZ 1000         // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click
625
+                                                 // 0 to disable buzzer feedback. Test with M300 S<frequency Hz> P<duration ms>
625
 
626
 
626
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
627
 // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3)
627
 // http://reprap.org/wiki/PanelOne
628
 // http://reprap.org/wiki/PanelOne

+ 20
- 1
Marlin/fonts/README.fonts View File

3
 Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files.
3
 Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files.
4
 The .h files must be edited to replace '#include "u8g.h"' with '#include <utility/u8g.h>', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory.
4
 The .h files must be edited to replace '#include "u8g.h"' with '#include <utility/u8g.h>', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory.
5
 
5
 
6
-Especially the Kana and Cyrillic fonts should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this scripts.
6
+How to integrate a new font:
7
+Currently we are limited to 256 symbols per font. We use a menu system with 5 lines, on a display with 64 pixel height. That means we have 12 pixel for a line. To have some space in between the lines we can't use more then 10 pixel height for the symbols.
8
+We use fixed width fonts. To fit 22 Symbols on the 128 pixel wide screen, the symbols can't be wider than 5 pixel. Maybe you can work with half symbols - two places in the charset will than build one wide symbol.
9
+
10
+ * Get 'Fony.exe'
11
+ * Copy one of the existing *.fon files and work with this.
12
+ * Change the pixels. Don't change width or height.
13
+ * Export as *.bdf
14
+ * Use 'bdf2u8g.exe' to produce the *.h file. Examples for the existing fonts are in 'make_fonts.bat'
15
+ * Edit the produced .h file to match our needs. See hints in 'README.fonts' or the other 'dogm_font_data_.h' files.
16
+ * Make a new entry in the font list in 'dogm_lcd_implementation.h' before the '#else // fall back'
17
+    #elif defined( DISPLAY_CHARSET_NEWNAME )
18
+      #include "dogm_font_data_yourfont.h"
19
+      #define FONT_MENU_NAME YOURFONTNAME
20
+    #else // fall-back
21
+ * Add your font to the list of permitted fonts in 'language_en.h'
22
+    ... || defined(DISPLAY_CHARSET_YOUR_NEW_FONT) ... )
23
+
24
+
25
+Especially the Kana font should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this script.

+ 3
- 2
Marlin/language.h View File

122
 #define MSG_PLANNER_BUFFER_BYTES            "  PlannerBufferBytes: "
122
 #define MSG_PLANNER_BUFFER_BYTES            "  PlannerBufferBytes: "
123
 #define MSG_OK                              "ok"
123
 #define MSG_OK                              "ok"
124
 #define MSG_FILE_SAVED                      "Done saving file."
124
 #define MSG_FILE_SAVED                      "Done saving file."
125
-#define MSG_ERR_LINE_NO                     "Line Number is not Last Line Number+1, Last Line: "
125
+#define MSG_ERR_LINE_NO1                    "Line Number out of sequence. Expected: "
126
+#define MSG_ERR_LINE_NO2                    " Got: "
126
 #define MSG_ERR_CHECKSUM_MISMATCH           "checksum mismatch, Last Line: "
127
 #define MSG_ERR_CHECKSUM_MISMATCH           "checksum mismatch, Last Line: "
127
 #define MSG_ERR_NO_CHECKSUM                 "No Checksum with line number, Last Line: "
128
 #define MSG_ERR_NO_CHECKSUM                 "No Checksum with line number, Last Line: "
128
 #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "
129
 #define MSG_ERR_NO_LINENUMBER_WITH_CHECKSUM "No Line Number with checksum, Last Line: "
209
 #define MSG_OK_B                            "ok B:"
210
 #define MSG_OK_B                            "ok B:"
210
 #define MSG_OK_T                            "ok T:"
211
 #define MSG_OK_T                            "ok T:"
211
 #define MSG_AT                              " @:"
212
 #define MSG_AT                              " @:"
212
-#define MSG_PID_AUTOTUNE_FINISHED           MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"
213
+#define MSG_PID_AUTOTUNE_FINISHED           MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from below into Configuration.h"
213
 #define MSG_PID_DEBUG                       " PID_DEBUG "
214
 #define MSG_PID_DEBUG                       " PID_DEBUG "
214
 #define MSG_PID_DEBUG_INPUT                 ": Input "
215
 #define MSG_PID_DEBUG_INPUT                 ": Input "
215
 #define MSG_PID_DEBUG_OUTPUT                " Output "
216
 #define MSG_PID_DEBUG_OUTPUT                " Output "

+ 1
- 3
Marlin/pins_AZTEEG_X3.h View File

28
    #define STAT_LED_RED 64
28
    #define STAT_LED_RED 64
29
    #define STAT_LED_BLUE 63
29
    #define STAT_LED_BLUE 63
30
   #endif
30
   #endif
31
-#endif
32
-
33
-#elif define TEMP_STAT_LEDS
31
+#elif defined(TEMP_STAT_LEDS)
34
   #define STAT_LED_RED       6
32
   #define STAT_LED_RED       6
35
   #define STAT_LED_BLUE     11
33
   #define STAT_LED_BLUE     11
36
 #endif
34
 #endif

+ 1
- 1
Marlin/pins_SAV_MKI.h View File

82
   #define HOME_PIN          -1 // A4 = marlin 44 - teensy = 42
82
   #define HOME_PIN          -1 // A4 = marlin 44 - teensy = 42
83
 
83
 
84
   #ifdef NUM_SERVOS
84
   #ifdef NUM_SERVOS
85
-    #define SERVO0_PIN       41 // In teensy's pin definition for pinMode (in Servo.cpp)
85
+    #define SERVO0_PIN       41 // In teensy's pin definition for pinMode (in servo.cpp)
86
   #endif
86
   #endif
87
 
87
 
88
 #endif // SAV_3DLCD
88
 #endif // SAV_3DLCD

+ 92
- 60
Marlin/stepper.cpp View File

46
 
46
 
47
 // Variables used by The Stepper Driver Interrupt
47
 // Variables used by The Stepper Driver Interrupt
48
 static unsigned char out_bits;        // The next stepping-bits to be output
48
 static unsigned char out_bits;        // The next stepping-bits to be output
49
-static unsigned int cleaning_buffer_counter;  
49
+static unsigned int cleaning_buffer_counter;
50
 
50
 
51
 #ifdef Z_DUAL_ENDSTOPS
51
 #ifdef Z_DUAL_ENDSTOPS
52
   static bool performing_homing = false, 
52
   static bool performing_homing = false, 
54
               locked_z2_motor = false;
54
               locked_z2_motor = false;
55
 #endif
55
 #endif
56
 
56
 
57
-// Counter variables for the bresenham line tracer
57
+// Counter variables for the Bresenham line tracer
58
 static long counter_x, counter_y, counter_z, counter_e;
58
 static long counter_x, counter_y, counter_z, counter_e;
59
 volatile static unsigned long step_events_completed; // The number of step events executed in the current block
59
 volatile static unsigned long step_events_completed; // The number of step events executed in the current block
60
 
60
 
66
 
66
 
67
 static long acceleration_time, deceleration_time;
67
 static long acceleration_time, deceleration_time;
68
 //static unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
68
 //static unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate;
69
-static unsigned short acc_step_rate; // needed for deccelaration start point
69
+static unsigned short acc_step_rate; // needed for deceleration start point
70
 static char step_loops;
70
 static char step_loops;
71
 static unsigned short OCR1A_nominal;
71
 static unsigned short OCR1A_nominal;
72
 static unsigned short step_loops_nominal;
72
 static unsigned short step_loops_nominal;
205
 // intRes = longIn1 * longIn2 >> 24
205
 // intRes = longIn1 * longIn2 >> 24
206
 // uses:
206
 // uses:
207
 // r26 to store 0
207
 // r26 to store 0
208
-// r27 to store the byte 1 of the 48bit result
209
-#define MultiU24X24toH16(intRes, longIn1, longIn2) \
208
+// r27 to store bits 16-23 of the 48bit result. The top bit is used to round the two byte result.
209
+// note that the lower two bytes and the upper byte of the 48bit result are not calculated.
210
+// this can cause the result to be out by one as the lower bytes may cause carries into the upper ones.
211
+// B0 A0 are bits 24-39 and are the returned value
212
+// C1 B1 A1 is longIn1
213
+// D2 C2 B2 A2 is longIn2
214
+//
215
+#define MultiU24X32toH16(intRes, longIn1, longIn2) \
210
   asm volatile ( \
216
   asm volatile ( \
211
     "clr r26 \n\t" \
217
     "clr r26 \n\t" \
212
     "mul %A1, %B2 \n\t" \
218
     "mul %A1, %B2 \n\t" \
237
     "lsr r27 \n\t" \
243
     "lsr r27 \n\t" \
238
     "adc %A0, r26 \n\t" \
244
     "adc %A0, r26 \n\t" \
239
     "adc %B0, r26 \n\t" \
245
     "adc %B0, r26 \n\t" \
246
+    "mul %D2, %A1 \n\t" \
247
+    "add %A0, r0 \n\t" \
248
+    "adc %B0, r1 \n\t" \
249
+    "mul %D2, %B1 \n\t" \
250
+    "add %B0, r0 \n\t" \
240
     "clr r1 \n\t" \
251
     "clr r1 \n\t" \
241
     : \
252
     : \
242
     "=&r" (intRes) \
253
     "=&r" (intRes) \
274
     }
285
     }
275
     #ifdef Z_PROBE_ENDSTOP
286
     #ifdef Z_PROBE_ENDSTOP
276
     if (endstop_z_probe_hit) {
287
     if (endstop_z_probe_hit) {
277
-    	SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
278
-    	LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
288
+      SERIAL_ECHOPAIR(" Z_PROBE:", (float)endstops_trigsteps[Z_AXIS] / axis_steps_per_unit[Z_AXIS]);
289
+      LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "ZP");
279
     }
290
     }
280
     #endif
291
     #endif
281
     SERIAL_EOL;
292
     SERIAL_EOL;
313
 //  The trapezoid is the shape the speed curve over time. It starts at block->initial_rate, accelerates
324
 //  The trapezoid is the shape the speed curve over time. It starts at block->initial_rate, accelerates
314
 //  first block->accelerate_until step_events_completed, then keeps going at constant speed until
325
 //  first block->accelerate_until step_events_completed, then keeps going at constant speed until
315
 //  step_events_completed reaches block->decelerate_after after which it decelerates until the trapezoid generator is reset.
326
 //  step_events_completed reaches block->decelerate_after after which it decelerates until the trapezoid generator is reset.
316
-//  The slope of acceleration is calculated with the leib ramp alghorithm.
327
+//  The slope of acceleration is calculated using v = u + at where t is the accumulated timer values of the steps so far.
317
 
328
 
318
 void st_wake_up() {
329
 void st_wake_up() {
319
   //  TCNT1 = 0;
330
   //  TCNT1 = 0;
400
     OCR1A = 200;
411
     OCR1A = 200;
401
     return;
412
     return;
402
   }
413
   }
403
-  
414
+
404
   // If there is no current block, attempt to pop one from the buffer
415
   // If there is no current block, attempt to pop one from the buffer
405
   if (!current_block) {
416
   if (!current_block) {
406
     // Anything in the buffer?
417
     // Anything in the buffer?
452
       count_direction[Y_AXIS] = 1;
463
       count_direction[Y_AXIS] = 1;
453
     }
464
     }
454
 
465
 
466
+    #define _ENDSTOP(axis, minmax) axis ##_## minmax ##_endstop
467
+    #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
468
+    #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
469
+    #define _OLD_ENDSTOP(axis, minmax) old_## axis ##_## minmax ##_endstop
470
+    #define _AXIS(AXIS) AXIS ##_AXIS
471
+    #define _ENDSTOP_HIT(axis) endstop_## axis ##_hit
472
+
455
     #define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
473
     #define UPDATE_ENDSTOP(axis,AXIS,minmax,MINMAX) \
456
-      bool axis ##_## minmax ##_endstop = (READ(AXIS ##_## MINMAX ##_PIN) != AXIS ##_## MINMAX ##_ENDSTOP_INVERTING); \
457
-      if (axis ##_## minmax ##_endstop && old_## axis ##_## minmax ##_endstop && (current_block->steps[AXIS ##_AXIS] > 0)) { \
458
-        endstops_trigsteps[AXIS ##_AXIS] = count_position[AXIS ##_AXIS]; \
459
-        endstop_## axis ##_hit = true; \
474
+      bool _ENDSTOP(axis, minmax) = (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)); \
475
+      if (_ENDSTOP(axis, minmax) && _OLD_ENDSTOP(axis, minmax) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
476
+        endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \
477
+        _ENDSTOP_HIT(axis) = true; \
460
         step_events_completed = current_block->step_event_count; \
478
         step_events_completed = current_block->step_event_count; \
461
       } \
479
       } \
462
-      old_## axis ##_## minmax ##_endstop = axis ##_## minmax ##_endstop;
480
+      _OLD_ENDSTOP(axis, minmax) = _ENDSTOP(axis, minmax);
481
+
463
 
482
 
464
     // Check X and Y endstops
483
     // Check X and Y endstops
465
     if (check_endstops) {
484
     if (check_endstops) {
469
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
488
         if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
470
           if (TEST(out_bits, X_HEAD))
489
           if (TEST(out_bits, X_HEAD))
471
       #else
490
       #else
472
-          if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular cartesians bot)
491
+          if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular Cartesian bot)
473
       #endif
492
       #endif
474
           { // -direction
493
           { // -direction
475
             #ifdef DUAL_X_CARRIAGE
494
             #ifdef DUAL_X_CARRIAGE
476
               // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
495
               // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
477
               if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
496
               if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
478
-            #endif          
497
+            #endif
479
               {
498
               {
480
                 #if HAS_X_MIN
499
                 #if HAS_X_MIN
481
                   UPDATE_ENDSTOP(x, X, min, MIN);
500
                   UPDATE_ENDSTOP(x, X, min, MIN);
561
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
580
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
562
           if(z_probe_endstop && old_z_probe_endstop)
581
           if(z_probe_endstop && old_z_probe_endstop)
563
           {
582
           {
564
-        	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
565
-        	  endstop_z_probe_hit=true;
583
+            endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
584
+            endstop_z_probe_hit=true;
566
 
585
 
567
-//        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
586
+//            if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
568
           }
587
           }
569
           old_z_probe_endstop = z_probe_endstop;
588
           old_z_probe_endstop = z_probe_endstop;
570
         #endif
589
         #endif
571
-        
590
+
572
       } // check_endstops
591
       } // check_endstops
573
 
592
 
574
     }
593
     }
614
           #endif // !Z_DUAL_ENDSTOPS
633
           #endif // !Z_DUAL_ENDSTOPS
615
 
634
 
616
         #endif // Z_MAX_PIN
635
         #endif // Z_MAX_PIN
617
-        
636
+
618
         #ifdef Z_PROBE_ENDSTOP
637
         #ifdef Z_PROBE_ENDSTOP
619
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
638
           UPDATE_ENDSTOP(z, Z, probe, PROBE);
620
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
639
           z_probe_endstop=(READ(Z_PROBE_PIN) != Z_PROBE_ENDSTOP_INVERTING);
621
           if(z_probe_endstop && old_z_probe_endstop)
640
           if(z_probe_endstop && old_z_probe_endstop)
622
           {
641
           {
623
-        	  endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
624
-        	  endstop_z_probe_hit=true;
625
-//        	  if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
642
+            endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
643
+            endstop_z_probe_hit=true;
644
+//            if (z_probe_endstop && old_z_probe_endstop) SERIAL_ECHOLN("z_probe_endstop = true");
626
           }
645
           }
627
           old_z_probe_endstop = z_probe_endstop;
646
           old_z_probe_endstop = z_probe_endstop;
628
         #endif
647
         #endif
656
         }
675
         }
657
       #endif //ADVANCE
676
       #endif //ADVANCE
658
 
677
 
678
+      #define _COUNTER(axis) counter_## axis
679
+      #define _WRITE_STEP(AXIS, HIGHLOW) AXIS ##_STEP_WRITE(HIGHLOW)
680
+      #define _APPLY_STEP(AXIS) AXIS ##_APPLY_STEP
681
+      #define _INVERT_STEP_PIN(AXIS) INVERT_## AXIS ##_STEP_PIN
682
+
659
       #ifdef CONFIG_STEPPERS_TOSHIBA
683
       #ifdef CONFIG_STEPPERS_TOSHIBA
660
         /**
684
         /**
661
          * The Toshiba stepper controller require much longer pulses.
685
          * The Toshiba stepper controller require much longer pulses.
664
          * lag to allow it work with without needing NOPs
688
          * lag to allow it work with without needing NOPs
665
          */
689
          */
666
         #define STEP_ADD(axis, AXIS) \
690
         #define STEP_ADD(axis, AXIS) \
667
-         counter_## axis += current_block->steps[AXIS ##_AXIS]; \
668
-         if (counter_## axis > 0) { AXIS ##_STEP_WRITE(HIGH); }
691
+         _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
692
+         if (_COUNTER(axis) > 0) { _WRITE_STEP(AXIS, HIGH); }
669
         STEP_ADD(x,X);
693
         STEP_ADD(x,X);
670
         STEP_ADD(y,Y);
694
         STEP_ADD(y,Y);
671
         STEP_ADD(z,Z);
695
         STEP_ADD(z,Z);
674
         #endif
698
         #endif
675
 
699
 
676
         #define STEP_IF_COUNTER(axis, AXIS) \
700
         #define STEP_IF_COUNTER(axis, AXIS) \
677
-          if (counter_## axis > 0) { \
678
-            counter_## axis -= current_block->step_event_count; \
679
-            count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
680
-            AXIS ##_STEP_WRITE(LOW); \
701
+          if (_COUNTER(axis) > 0) { \
702
+            _COUNTER(axis) -= current_block->step_event_count; \
703
+            count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
704
+            _WRITE_STEP(AXIS, LOW); \
681
           }
705
           }
682
 
706
 
683
         STEP_IF_COUNTER(x, X);
707
         STEP_IF_COUNTER(x, X);
690
       #else // !CONFIG_STEPPERS_TOSHIBA
714
       #else // !CONFIG_STEPPERS_TOSHIBA
691
 
715
 
692
         #define APPLY_MOVEMENT(axis, AXIS) \
716
         #define APPLY_MOVEMENT(axis, AXIS) \
693
-          counter_## axis += current_block->steps[AXIS ##_AXIS]; \
694
-          if (counter_## axis > 0) { \
695
-            AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN,0); \
696
-            counter_## axis -= current_block->step_event_count; \
697
-            count_position[AXIS ##_AXIS] += count_direction[AXIS ##_AXIS]; \
698
-            AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN,0); \
717
+          _COUNTER(axis) += current_block->steps[_AXIS(AXIS)]; \
718
+          if (_COUNTER(axis) > 0) { \
719
+            _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS),0); \
720
+            _COUNTER(axis) -= current_block->step_event_count; \
721
+            count_position[_AXIS(AXIS)] += count_direction[_AXIS(AXIS)]; \
722
+            _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS),0); \
699
           }
723
           }
700
 
724
 
701
         APPLY_MOVEMENT(x, X);
725
         APPLY_MOVEMENT(x, X);
714
     unsigned short step_rate;
738
     unsigned short step_rate;
715
     if (step_events_completed <= (unsigned long)current_block->accelerate_until) {
739
     if (step_events_completed <= (unsigned long)current_block->accelerate_until) {
716
 
740
 
717
-      MultiU24X24toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
741
+      MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
718
       acc_step_rate += current_block->initial_rate;
742
       acc_step_rate += current_block->initial_rate;
719
 
743
 
720
       // upper limit
744
       // upper limit
737
       #endif
761
       #endif
738
     }
762
     }
739
     else if (step_events_completed > (unsigned long)current_block->decelerate_after) {
763
     else if (step_events_completed > (unsigned long)current_block->decelerate_after) {
740
-      MultiU24X24toH16(step_rate, deceleration_time, current_block->acceleration_rate);
764
+      MultiU24X32toH16(step_rate, deceleration_time, current_block->acceleration_rate);
741
 
765
 
742
       if (step_rate > acc_step_rate) { // Check step_rate stays positive
766
       if (step_rate > acc_step_rate) { // Check step_rate stays positive
743
         step_rate = current_block->final_rate;
767
         step_rate = current_block->final_rate;
863
   #ifdef HAVE_L6470DRIVER
887
   #ifdef HAVE_L6470DRIVER
864
     L6470_init();
888
     L6470_init();
865
   #endif
889
   #endif
866
-  
890
+
867
   // Initialize Dir Pins
891
   // Initialize Dir Pins
868
   #if HAS_X_DIR
892
   #if HAS_X_DIR
869
     X_DIR_INIT;
893
     X_DIR_INIT;
909
   #if HAS_Y_ENABLE
933
   #if HAS_Y_ENABLE
910
     Y_ENABLE_INIT;
934
     Y_ENABLE_INIT;
911
     if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
935
     if (!Y_ENABLE_ON) Y_ENABLE_WRITE(HIGH);
912
-	
913
-	#if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
914
-	  Y2_ENABLE_INIT;
915
-	  if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
916
-	#endif
936
+
937
+  #if defined(Y_DUAL_STEPPER_DRIVERS) && HAS_Y2_ENABLE
938
+    Y2_ENABLE_INIT;
939
+    if (!Y_ENABLE_ON) Y2_ENABLE_WRITE(HIGH);
940
+  #endif
917
   #endif
941
   #endif
918
   #if HAS_Z_ENABLE
942
   #if HAS_Z_ENABLE
919
     Z_ENABLE_INIT;
943
     Z_ENABLE_INIT;
990
     #ifdef ENDSTOPPULLUP_ZMAX
1014
     #ifdef ENDSTOPPULLUP_ZMAX
991
       WRITE(Z2_MAX_PIN,HIGH);
1015
       WRITE(Z2_MAX_PIN,HIGH);
992
     #endif
1016
     #endif
993
-  #endif  
994
-  
1017
+  #endif
1018
+
995
 #if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
1019
 #if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
996
   SET_INPUT(Z_PROBE_PIN);
1020
   SET_INPUT(Z_PROBE_PIN);
997
   #ifdef ENDSTOPPULLUP_ZPROBE
1021
   #ifdef ENDSTOPPULLUP_ZPROBE
999
   #endif
1023
   #endif
1000
 #endif
1024
 #endif
1001
 
1025
 
1026
+  #define _STEP_INIT(AXIS) AXIS ##_STEP_INIT
1027
+  #define _DISABLE(axis) disable_## axis()
1028
+
1002
   #define AXIS_INIT(axis, AXIS, PIN) \
1029
   #define AXIS_INIT(axis, AXIS, PIN) \
1003
-    AXIS ##_STEP_INIT; \
1004
-    AXIS ##_STEP_WRITE(INVERT_## PIN ##_STEP_PIN); \
1005
-    disable_## axis()
1030
+    _STEP_INIT(AXIS); \
1031
+    _WRITE_STEP(AXIS, _INVERT_STEP_PIN(PIN)); \
1032
+    _DISABLE(axis)
1006
 
1033
 
1007
   #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
1034
   #define E_AXIS_INIT(NUM) AXIS_INIT(e## NUM, E## NUM, E)
1008
 
1035
 
1135
   // No other ISR should ever interrupt this!
1162
   // No other ISR should ever interrupt this!
1136
   void babystep(const uint8_t axis, const bool direction) {
1163
   void babystep(const uint8_t axis, const bool direction) {
1137
 
1164
 
1165
+    #define _ENABLE(axis) enable_## axis()
1166
+    #define _READ_DIR(AXIS) AXIS ##_DIR_READ
1167
+    #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
1168
+    #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
1169
+
1138
     #define BABYSTEP_AXIS(axis, AXIS, INVERT) { \
1170
     #define BABYSTEP_AXIS(axis, AXIS, INVERT) { \
1139
-        enable_## axis(); \
1140
-        uint8_t old_pin = AXIS ##_DIR_READ; \
1141
-        AXIS ##_APPLY_DIR(INVERT_## AXIS ##_DIR^direction^INVERT, true); \
1142
-        AXIS ##_APPLY_STEP(!INVERT_## AXIS ##_STEP_PIN, true); \
1143
-        _delay_us(1U); \
1144
-        AXIS ##_APPLY_STEP(INVERT_## AXIS ##_STEP_PIN, true); \
1145
-        AXIS ##_APPLY_DIR(old_pin, true); \
1171
+        _ENABLE(axis); \
1172
+        uint8_t old_pin = _READ_DIR(AXIS); \
1173
+        _APPLY_DIR(AXIS, _INVERT_DIR(AXIS)^direction^INVERT); \
1174
+        _APPLY_STEP(AXIS)(!_INVERT_STEP_PIN(AXIS), true); \
1175
+        delayMicroseconds(2); \
1176
+        _APPLY_STEP(AXIS)(_INVERT_STEP_PIN(AXIS), true); \
1177
+        _APPLY_DIR(AXIS, old_pin); \
1146
       }
1178
       }
1147
 
1179
 
1148
     switch(axis) {
1180
     switch(axis) {
1154
       case Y_AXIS:
1186
       case Y_AXIS:
1155
         BABYSTEP_AXIS(y, Y, false);
1187
         BABYSTEP_AXIS(y, Y, false);
1156
         break;
1188
         break;
1157
-     
1189
+ 
1158
       case Z_AXIS: {
1190
       case Z_AXIS: {
1159
 
1191
 
1160
         #ifndef DELTA
1192
         #ifndef DELTA
1179
           X_STEP_WRITE(!INVERT_X_STEP_PIN);
1211
           X_STEP_WRITE(!INVERT_X_STEP_PIN);
1180
           Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
1212
           Y_STEP_WRITE(!INVERT_Y_STEP_PIN);
1181
           Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
1213
           Z_STEP_WRITE(!INVERT_Z_STEP_PIN);
1182
-          _delay_us(1U);
1214
+          delayMicroseconds(2);
1183
           X_STEP_WRITE(INVERT_X_STEP_PIN); 
1215
           X_STEP_WRITE(INVERT_X_STEP_PIN); 
1184
           Y_STEP_WRITE(INVERT_Y_STEP_PIN); 
1216
           Y_STEP_WRITE(INVERT_Y_STEP_PIN); 
1185
           Z_STEP_WRITE(INVERT_Z_STEP_PIN);
1217
           Z_STEP_WRITE(INVERT_Z_STEP_PIN);
1191
         #endif
1223
         #endif
1192
 
1224
 
1193
       } break;
1225
       } break;
1194
-     
1226
+ 
1195
       default: break;
1227
       default: break;
1196
     }
1228
     }
1197
   }
1229
   }
1255
 
1287
 
1256
   #if HAS_MICROSTEPS
1288
   #if HAS_MICROSTEPS
1257
     pinMode(X_MS1_PIN,OUTPUT);
1289
     pinMode(X_MS1_PIN,OUTPUT);
1258
-    pinMode(X_MS2_PIN,OUTPUT);  
1290
+    pinMode(X_MS2_PIN,OUTPUT);
1259
     pinMode(Y_MS1_PIN,OUTPUT);
1291
     pinMode(Y_MS1_PIN,OUTPUT);
1260
     pinMode(Y_MS2_PIN,OUTPUT);
1292
     pinMode(Y_MS2_PIN,OUTPUT);
1261
     pinMode(Z_MS1_PIN,OUTPUT);
1293
     pinMode(Z_MS1_PIN,OUTPUT);

+ 3
- 0
Marlin/temperature.cpp View File

341
     }
341
     }
342
     if (cycles > ncycles) {
342
     if (cycles > ncycles) {
343
       SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
343
       SERIAL_PROTOCOLLNPGM(MSG_PID_AUTOTUNE_FINISHED);
344
+      SERIAL_PROTOCOLPGM("#define  DEFAULT_Kp "); SERIAL_PROTOCOLLN(Kp);
345
+      SERIAL_PROTOCOLPGM("#define  DEFAULT_Ki "); SERIAL_PROTOCOLLN(Ki);
346
+      SERIAL_PROTOCOLPGM("#define  DEFAULT_Kd "); SERIAL_PROTOCOLLN(Kd);
344
       return;
347
       return;
345
     }
348
     }
346
     lcd_update();
349
     lcd_update();

+ 54
- 52
Marlin/ultralcd.cpp View File

5
 #include "cardreader.h"
5
 #include "cardreader.h"
6
 #include "temperature.h"
6
 #include "temperature.h"
7
 #include "stepper.h"
7
 #include "stepper.h"
8
-#include "ConfigurationStore.h"
8
+#include "configuration_store.h"
9
 
9
 
10
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
10
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
11
 
11
 
267
   #ifdef LCD_PROGRESS_BAR
267
   #ifdef LCD_PROGRESS_BAR
268
     millis_t ms = millis();
268
     millis_t ms = millis();
269
     #ifndef PROGRESS_MSG_ONCE
269
     #ifndef PROGRESS_MSG_ONCE
270
-      if (ms > progressBarTick + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
271
-        progressBarTick = ms;
270
+      if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
271
+        progress_bar_ms = ms;
272
       }
272
       }
273
     #endif
273
     #endif
274
     #if PROGRESS_MSG_EXPIRE > 0
274
     #if PROGRESS_MSG_EXPIRE > 0
275
       // Handle message expire
275
       // Handle message expire
276
-      if (expireStatusMillis > 0) {
276
+      if (expire_status_ms > 0) {
277
         if (card.isFileOpen()) {
277
         if (card.isFileOpen()) {
278
           // Expire the message when printing is active
278
           // Expire the message when printing is active
279
           if (IS_SD_PRINTING) {
279
           if (IS_SD_PRINTING) {
280
             // Expire the message when printing is active
280
             // Expire the message when printing is active
281
-            if (ms >= expireStatusMillis) {
281
+            if (ms >= expire_status_ms) {
282
               lcd_status_message[0] = '\0';
282
               lcd_status_message[0] = '\0';
283
-              expireStatusMillis = 0;
283
+              expire_status_ms = 0;
284
             }
284
             }
285
           }
285
           }
286
           else {
286
           else {
287
-            expireStatusMillis += LCD_UPDATE_INTERVAL;
287
+            expire_status_ms += LCD_UPDATE_INTERVAL;
288
           }
288
           }
289
         }
289
         }
290
         else {
290
         else {
291
-          expireStatusMillis = 0;
291
+          expire_status_ms = 0;
292
         }
292
         }
293
       }
293
       }
294
     #endif
294
     #endif
648
 
648
 
649
 #endif // DELTA_CALIBRATION_MENU
649
 #endif // DELTA_CALIBRATION_MENU
650
 
650
 
651
-inline void line_to_current() {
651
+inline void line_to_current(AxisEnum axis) {
652
   #ifdef DELTA
652
   #ifdef DELTA
653
     calculate_delta(current_position);
653
     calculate_delta(current_position);
654
-    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
654
+    plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
655
   #else
655
   #else
656
-    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[X_AXIS]/60, active_extruder);
656
+    plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
657
   #endif
657
   #endif
658
 }
658
 }
659
 
659
 
660
 float move_menu_scale;
660
 float move_menu_scale;
661
 static void lcd_move_menu_axis();
661
 static void lcd_move_menu_axis();
662
 
662
 
663
-static void _lcd_move(const char *name, int axis, int min, int max) {
663
+static void _lcd_move(const char *name, AxisEnum axis, int min, int max) {
664
   if (encoderPosition != 0) {
664
   if (encoderPosition != 0) {
665
     refresh_cmd_timeout();
665
     refresh_cmd_timeout();
666
     current_position[axis] += float((int)encoderPosition) * move_menu_scale;
666
     current_position[axis] += float((int)encoderPosition) * move_menu_scale;
667
     if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
667
     if (min_software_endstops && current_position[axis] < min) current_position[axis] = min;
668
     if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
668
     if (max_software_endstops && current_position[axis] > max) current_position[axis] = max;
669
     encoderPosition = 0;
669
     encoderPosition = 0;
670
-    line_to_current();
670
+    line_to_current(axis);
671
     lcdDrawUpdate = 1;
671
     lcdDrawUpdate = 1;
672
   }
672
   }
673
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
673
   if (lcdDrawUpdate) lcd_implementation_drawedit(name, ftostr31(current_position[axis]));
680
   if (encoderPosition != 0) {
680
   if (encoderPosition != 0) {
681
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
681
     current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale;
682
     encoderPosition = 0;
682
     encoderPosition = 0;
683
-    line_to_current();
683
+    line_to_current(E_AXIS);
684
     lcdDrawUpdate = 1;
684
     lcdDrawUpdate = 1;
685
   }
685
   }
686
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
686
   if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Extruder"), ftostr31(current_position[E_AXIS]));
1131
     #endif    
1131
     #endif    
1132
     lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
1132
     lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
1133
   #elif defined(BEEPER) && BEEPER > -1
1133
   #elif defined(BEEPER) && BEEPER > -1
1134
-    SET_OUTPUT(BEEPER);
1135
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1134
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1136
       #define LCD_FEEDBACK_FREQUENCY_HZ 5000
1135
       #define LCD_FEEDBACK_FREQUENCY_HZ 5000
1137
     #endif
1136
     #endif
1138
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1137
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1139
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
1138
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
1140
     #endif
1139
     #endif
1141
-    const uint16_t delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
1142
-    uint16_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
1143
-    while (i--) {
1144
-      WRITE(BEEPER,HIGH);
1145
-      delayMicroseconds(delay);
1146
-      WRITE(BEEPER,LOW);
1147
-      delayMicroseconds(delay);
1148
-    }
1149
-    const uint16_t j = max(10000 - LCD_FEEDBACK_FREQUENCY_DURATION_MS * 1000, 0);
1150
-    if (j) delayMicroseconds(j);
1140
+    lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
1141
+  #else
1142
+    #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
1143
+      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
1144
+    #endif
1145
+    delay(LCD_FEEDBACK_FREQUENCY_DURATION_MS);
1151
   #endif
1146
   #endif
1152
 }
1147
 }
1153
 
1148
 
1397
 
1392
 
1398
 void lcd_finishstatus(bool persist=false) {
1393
 void lcd_finishstatus(bool persist=false) {
1399
   #ifdef LCD_PROGRESS_BAR
1394
   #ifdef LCD_PROGRESS_BAR
1400
-    progressBarTick = millis();
1395
+    progress_bar_ms = millis();
1401
     #if PROGRESS_MSG_EXPIRE > 0
1396
     #if PROGRESS_MSG_EXPIRE > 0
1402
-      expireStatusMillis = persist ? 0 : progressBarTick + PROGRESS_MSG_EXPIRE;
1397
+      expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
1403
     #endif
1398
     #endif
1404
   #endif
1399
   #endif
1405
   lcdDrawUpdate = 2;
1400
   lcdDrawUpdate = 2;
1410
 }
1405
 }
1411
 
1406
 
1412
 #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
1407
 #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
1413
-  void dontExpireStatus() { expireStatusMillis = 0; }
1408
+  void dontExpireStatus() { expire_status_ms = 0; }
1414
 #endif
1409
 #endif
1415
 
1410
 
1416
 void set_utf_strlen(char *s, uint8_t n) {
1411
 void set_utf_strlen(char *s, uint8_t n) {
1423
   s[i] = 0;
1418
   s[i] = 0;
1424
 }
1419
 }
1425
 
1420
 
1421
+bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
1422
+
1426
 void lcd_setstatus(const char* message, bool persist) {
1423
 void lcd_setstatus(const char* message, bool persist) {
1427
   if (lcd_status_message_level > 0) return;
1424
   if (lcd_status_message_level > 0) return;
1428
   strncpy(lcd_status_message, message, 3*LCD_WIDTH);
1425
   strncpy(lcd_status_message, message, 3*LCD_WIDTH);
1544
 }
1541
 }
1545
 
1542
 
1546
 void lcd_buzz(long duration, uint16_t freq) {
1543
 void lcd_buzz(long duration, uint16_t freq) {
1547
-  #ifdef LCD_USE_I2C_BUZZER
1548
-    lcd.buzz(duration,freq);
1549
-  #endif
1544
+  if (freq > 0) {
1545
+    #if BEEPER > 0
1546
+      SET_OUTPUT(BEEPER);
1547
+      tone(BEEPER, freq, duration);
1548
+      delay(duration);
1549
+    #elif defined(LCD_USE_I2C_BUZZER)
1550
+      lcd.buzz(duration, freq);
1551
+    #else
1552
+      delay(duration);
1553
+    #endif
1554
+  }
1555
+  else {
1556
+    delay(duration);
1557
+  }
1550
 }
1558
 }
1551
 
1559
 
1552
 bool lcd_clicked() { return LCD_CLICKED; }
1560
 bool lcd_clicked() { return LCD_CLICKED; }
1798
       if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1806
       if (min_software_endstops && current_position[Z_AXIS] < Z_MIN_POS) current_position[Z_AXIS] = Z_MIN_POS;
1799
       if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1807
       if (max_software_endstops && current_position[Z_AXIS] > Z_MAX_POS) current_position[Z_AXIS] = Z_MAX_POS;
1800
       encoderPosition = 0;
1808
       encoderPosition = 0;
1801
-      line_to_current();
1809
+      line_to_current(Z_AXIS);
1802
       lcdDrawUpdate = 2;
1810
       lcdDrawUpdate = 2;
1803
     }
1811
     }
1804
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
1812
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("Z"), ftostr43(current_position[Z_AXIS]));
1806
     if (LCD_CLICKED) {
1814
     if (LCD_CLICKED) {
1807
       if (!debounce_click) {
1815
       if (!debounce_click) {
1808
         debounce_click = true;
1816
         debounce_click = true;
1809
-        int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1810
-        int iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1811
-        if (iy&1) { // Zig zag
1812
-          ix = (MESH_NUM_X_POINTS - 1) - ix;
1813
-        }
1817
+        int ix = _lcd_level_bed_position % MESH_NUM_X_POINTS,
1818
+            iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1819
+        if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
1814
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
1820
         mbl.set_z(ix, iy, current_position[Z_AXIS]);
1815
         _lcd_level_bed_position++;
1821
         _lcd_level_bed_position++;
1816
         if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1822
         if (_lcd_level_bed_position == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
1817
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1823
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1818
-          line_to_current();
1824
+          line_to_current(Z_AXIS);
1819
           mbl.active = 1;
1825
           mbl.active = 1;
1820
           enqueuecommands_P(PSTR("G28"));
1826
           enqueuecommands_P(PSTR("G28"));
1821
           lcd_return_to_status();
1827
           lcd_return_to_status();
1822
-        } else {
1828
+        }
1829
+        else {
1823
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1830
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1824
-          line_to_current();
1831
+          line_to_current(Z_AXIS);
1825
           ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1832
           ix = _lcd_level_bed_position % MESH_NUM_X_POINTS;
1826
           iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1833
           iy = _lcd_level_bed_position / MESH_NUM_X_POINTS;
1827
-          if (iy&1) { // Zig zag
1828
-            ix = (MESH_NUM_X_POINTS - 1) - ix;
1829
-          }
1834
+          if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
1830
           current_position[X_AXIS] = mbl.get_x(ix);
1835
           current_position[X_AXIS] = mbl.get_x(ix);
1831
           current_position[Y_AXIS] = mbl.get_y(iy);
1836
           current_position[Y_AXIS] = mbl.get_y(iy);
1832
-          line_to_current();
1837
+          line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
1833
           lcdDrawUpdate = 2;
1838
           lcdDrawUpdate = 2;
1834
         }
1839
         }
1835
       }
1840
       }
1836
-    } else {
1841
+    }
1842
+    else {
1837
       debounce_click = false;
1843
       debounce_click = false;
1838
     }
1844
     }
1839
   }
1845
   }
1840
 
1846
 
1841
   static void _lcd_level_bed_homing() {
1847
   static void _lcd_level_bed_homing() {
1842
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), "Homing");
1848
     if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR("XYZ"), "Homing");
1843
-    if (axis_known_position[X_AXIS] &&
1844
-        axis_known_position[Y_AXIS] &&
1845
-        axis_known_position[Z_AXIS]) {
1849
+    if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS]) {
1846
       current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1850
       current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
1847
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1851
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1848
       current_position[X_AXIS] = MESH_MIN_X;
1852
       current_position[X_AXIS] = MESH_MIN_X;
1849
       current_position[Y_AXIS] = MESH_MIN_Y;
1853
       current_position[Y_AXIS] = MESH_MIN_Y;
1850
-      line_to_current();
1854
+      line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
1851
       _lcd_level_bed_position = 0;
1855
       _lcd_level_bed_position = 0;
1852
       lcd_goto_menu(_lcd_level_bed);
1856
       lcd_goto_menu(_lcd_level_bed);
1853
     }
1857
     }
1855
   }
1859
   }
1856
 
1860
 
1857
   static void lcd_level_bed() {
1861
   static void lcd_level_bed() {
1858
-    axis_known_position[X_AXIS] = false;
1859
-    axis_known_position[Y_AXIS] = false;
1860
-    axis_known_position[Z_AXIS] = false;
1862
+    axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
1861
     mbl.reset();
1863
     mbl.reset();
1862
     enqueuecommands_P(PSTR("G28"));
1864
     enqueuecommands_P(PSTR("G28"));
1863
     lcdDrawUpdate = 2;
1865
     lcdDrawUpdate = 2;

+ 4
- 2
Marlin/ultralcd.h View File

8
   int lcd_strlen_P(const char *s);
8
   int lcd_strlen_P(const char *s);
9
   void lcd_update();
9
   void lcd_update();
10
   void lcd_init();
10
   void lcd_init();
11
+  bool lcd_hasstatus();
11
   void lcd_setstatus(const char* message, const bool persist=false);
12
   void lcd_setstatus(const char* message, const bool persist=false);
12
   void lcd_setstatuspgm(const char* message, const uint8_t level=0);
13
   void lcd_setstatuspgm(const char* message, const uint8_t level=0);
13
   void lcd_setalertstatuspgm(const char* message);
14
   void lcd_setalertstatuspgm(const char* message);
100
 #else //no LCD
101
 #else //no LCD
101
   FORCE_INLINE void lcd_update() {}
102
   FORCE_INLINE void lcd_update() {}
102
   FORCE_INLINE void lcd_init() {}
103
   FORCE_INLINE void lcd_init() {}
104
+  FORCE_INLINE bool lcd_hasstatus() { return false; }
103
   FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {}
105
   FORCE_INLINE void lcd_setstatus(const char* message, const bool persist=false) {}
104
   FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {}
106
   FORCE_INLINE void lcd_setstatuspgm(const char* message, const uint8_t level=0) {}
105
   FORCE_INLINE void lcd_buttons_update() {}
107
   FORCE_INLINE void lcd_buttons_update() {}
107
   FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
109
   FORCE_INLINE void lcd_buzz(long duration,uint16_t freq) {}
108
   FORCE_INLINE bool lcd_detected(void) { return true; }
110
   FORCE_INLINE bool lcd_detected(void) { return true; }
109
 
111
 
110
-  #define LCD_MESSAGEPGM(x) 
111
-  #define LCD_ALERTMESSAGEPGM(x) 
112
+  #define LCD_MESSAGEPGM(x) do{}while(0)
113
+  #define LCD_ALERTMESSAGEPGM(x) do{}while(0)
112
 
114
 
113
 #endif //ULTRA_LCD
115
 #endif //ULTRA_LCD
114
 
116
 

+ 5
- 4
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

194
 #include "utf_mapper.h"
194
 #include "utf_mapper.h"
195
 
195
 
196
 #ifdef LCD_PROGRESS_BAR
196
 #ifdef LCD_PROGRESS_BAR
197
-  static uint16_t progressBarTick = 0;
197
+  static millis_t progress_bar_ms = 0;
198
   #if PROGRESS_MSG_EXPIRE > 0
198
   #if PROGRESS_MSG_EXPIRE > 0
199
-    static uint16_t expireStatusMillis = 0;
199
+    static millis_t expire_status_ms = 0;
200
   #endif
200
   #endif
201
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
201
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
202
 #endif
202
 #endif
588
   #ifdef LCD_PROGRESS_BAR
588
   #ifdef LCD_PROGRESS_BAR
589
 
589
 
590
     if (card.isFileOpen()) {
590
     if (card.isFileOpen()) {
591
-      if (millis() >= progressBarTick + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
592
-        // draw the progress bar
591
+      // Draw the progress bar if the message has shown long enough
592
+      // or if there is no message set.
593
+      if (millis() >= progress_bar_ms + PROGRESS_BAR_MSG_TIME || !lcd_status_message[0]) {
593
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
594
         int tix = (int)(card.percentDone() * LCD_WIDTH * 3) / 100,
594
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
595
           cel = tix / 3, rem = tix % 3, i = LCD_WIDTH;
595
         char msg[LCD_WIDTH+1], b = ' ';
596
         char msg[LCD_WIDTH+1], b = ' ';

+ 6
- 8
README.md View File

24
 ## Current Status: Bug Fixing
24
 ## Current Status: Bug Fixing
25
 
25
 
26
 The Marlin development is currently revived. There's a long list of reported issues and pull requests, which we are working on currently.
26
 The Marlin development is currently revived. There's a long list of reported issues and pull requests, which we are working on currently.
27
-We are actively looking for testers. So please try the current development version and report new issues and feedback.
28
 
27
 
29
 [![Coverity Scan Build Status](https://scan.coverity.com/projects/2224/badge.svg)](https://scan.coverity.com/projects/2224)
28
 [![Coverity Scan Build Status](https://scan.coverity.com/projects/2224/badge.svg)](https://scan.coverity.com/projects/2224)
30
 [![Travis Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg)](https://travis-ci.org/MarlinFirmware/Marlin)
29
 [![Travis Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg)](https://travis-ci.org/MarlinFirmware/Marlin)
31
 
30
 
32
 ## Contact
31
 ## Contact
33
 
32
 
34
-__Google Hangout:__ <a href="https://plus.google.com/hangouts/_/g2wp5duzb2y6ahikg6tmwao3kua" target="_blank">Hangout</a>
33
+__Google Hangout:__ <a href="https://plus.google.com/hangouts/_/gxn3wrea5gdhoo223yimsiforia" target="_blank">Hangout</a>
35
 
34
 
36
 ## Credits
35
 ## Credits
37
 
36
 
40
  - Scott Lahteine [@thinkyhead]
39
  - Scott Lahteine [@thinkyhead]
41
  - 
40
  - 
42
 
41
 
43
-Sprinters lead developers are Kliment and caru.
44
-Grbl's lead developer is Simen Svale Skogsrud.
45
-Sonney Jeon (Chamnit) improved some parts of grbl.
46
-A fork by bkubicek for the Ultimaker was merged.
42
+## Donation
43
+
44
+If you find our work usefull please consider donating. Donations will be used to pay for our website http://www.marlinfirmware.org/ and to pay some food or rent money for the very active Collaborators
47
 
45
 
48
 More features have been added by:
46
 More features have been added by:
49
   - Lampmaker,
47
   - Lampmaker,
52
 
50
 
53
 ## License
51
 ## License
54
 
52
 
55
-Marlin is published under the [GPL license](/Documentation/COPYING.md) because I believe in open development.
56
-Please do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent.
53
+Marlin is published under the [GPL license](/Documentation/COPYING.md) because We believe in open development.
54
+Do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent.
57
 
55
 
58
 [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software)
56
 [![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=ErikZalm&url=https://github.com/MarlinFirmware/Marlin&title=Marlin&language=&tags=github&category=software)

Loading…
Cancel
Save