Przeglądaj źródła

Merge branch '1.1.x' of https://github.com/MarlinFirmware/Marlin into fabrikator-mini

Back-ported Fabrikator Mini config changes. Not tested before commit.
Thomas Buck 7 lat temu
rodzic
commit
2b39a225b6
No account linked to committer's email address
100 zmienionych plików z 66500 dodań i 21179 usunięć
  1. 20
    0
      .gitattributes
  2. 36
    0
      .github/issue_template.md
  3. 24
    2
      .gitignore
  4. 94
    128
      .travis.yml
  5. 210
    91
      Marlin/Conditionals_LCD.h
  6. 397
    204
      Marlin/Conditionals_post.h
  7. 750
    450
      Marlin/Configuration.h
  8. 777
    214
      Marlin/Configuration_adv.h
  9. 890
    0
      Marlin/G26_Mesh_Validation_Tool.cpp
  10. 1132
    0
      Marlin/I2CPositionEncoder.cpp
  11. 359
    0
      Marlin/I2CPositionEncoder.h
  12. 268
    183
      Marlin/M100_Free_Mem_Chk.cpp
  13. 42
    45
      Marlin/Makefile
  14. 262
    177
      Marlin/Marlin.h
  15. 5
    6
      Marlin/Marlin.ino
  16. 415
    437
      Marlin/MarlinSerial.cpp
  17. 95
    102
      Marlin/MarlinSerial.h
  18. 10422
    6017
      Marlin/Marlin_main.cpp
  19. 878
    298
      Marlin/SanityCheck.h
  20. 18
    8
      Marlin/Sd2Card.cpp
  21. 1
    1
      Marlin/Sd2Card.h
  22. 2
    2
      Marlin/SdBaseFile.cpp
  23. 2
    2
      Marlin/SdBaseFile.h
  24. 1
    1
      Marlin/SdFatStructs.h
  25. 5
    6
      Marlin/SdFatUtil.h
  26. 5
    3
      Marlin/Version.h
  27. 1
    1
      Marlin/blinkm.cpp
  28. 8
    5
      Marlin/boards.h
  29. 3
    2
      Marlin/buzzer.h
  30. 326
    65
      Marlin/cardreader.cpp
  31. 62
    3
      Marlin/cardreader.h
  32. 1562
    693
      Marlin/configuration_store.cpp
  33. 55
    17
      Marlin/configuration_store.h
  34. 35
    22
      Marlin/dac_mcp4728.cpp
  35. 6
    5
      Marlin/dac_mcp4728.h
  36. 106
    0
      Marlin/digipot_mcp4018.cpp
  37. 11
    11
      Marlin/digipot_mcp4451.cpp
  38. 184
    0
      Marlin/dogm_font_data_ISO10646_1_PL.h
  39. 197
    0
      Marlin/dogm_font_data_ISO10646_1_tr.h
  40. 192
    0
      Marlin/dogm_font_data_ISO10646_CZ.h
  41. 69
    70
      Marlin/dogm_font_data_ISO10646_Greek.h
  42. 19
    7
      Marlin/duration_t.h
  43. 206
    0
      Marlin/endstop_interrupts.h
  44. 210
    130
      Marlin/endstops.cpp
  45. 8
    1
      Marlin/endstops.h
  46. 61
    65
      Marlin/enum.h
  47. 1786
    0
      Marlin/example_configurations/Anet/A6/Configuration.h
  48. 1361
    0
      Marlin/example_configurations/Anet/A6/Configuration_adv.h
  49. 1636
    0
      Marlin/example_configurations/Anet/A8/Configuration.h
  50. 1361
    0
      Marlin/example_configurations/Anet/A8/Configuration_adv.h
  51. 1625
    0
      Marlin/example_configurations/CL-260/Configuration.h
  52. 15
    0
      Marlin/example_configurations/CL-260/README.txt
  53. 752
    457
      Marlin/example_configurations/Cartesio/Configuration.h
  54. 769
    214
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  55. 62
    62
      Marlin/example_configurations/Cartesio/_Bootscreen.h
  56. 757
    461
      Marlin/example_configurations/Felix/Configuration.h
  57. 769
    214
      Marlin/example_configurations/Felix/Configuration_adv.h
  58. 754
    456
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  59. 1628
    0
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h
  60. 1367
    0
      Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h
  61. 755
    460
      Marlin/example_configurations/Hephestos/Configuration.h
  62. 769
    214
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  63. 774
    478
      Marlin/example_configurations/Hephestos_2/Configuration.h
  64. 760
    222
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  65. 1
    0
      Marlin/example_configurations/Hephestos_2/README.md
  66. 50
    50
      Marlin/example_configurations/Hephestos_2/_Bootscreen.h
  67. 1594
    0
      Marlin/example_configurations/Infitary-i3-M508/Configuration.h
  68. 1260
    0
      Marlin/example_configurations/Infitary-i3-M508/Configuration_adv.h
  69. 812
    493
      Marlin/example_configurations/K8200/Configuration.h
  70. 788
    226
      Marlin/example_configurations/K8200/Configuration_adv.h
  71. 2
    2
      Marlin/example_configurations/K8200/README.md
  72. 755
    458
      Marlin/example_configurations/K8400/Configuration.h
  73. 769
    214
      Marlin/example_configurations/K8400/Configuration_adv.h
  74. 754
    457
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  75. 1
    1
      Marlin/example_configurations/K8400/README.md
  76. 1651
    0
      Marlin/example_configurations/M150/Configuration.h
  77. 1361
    0
      Marlin/example_configurations/M150/Configuration_adv.h
  78. 3
    0
      Marlin/example_configurations/M150/README.md
  79. 104
    0
      Marlin/example_configurations/M150/_Bootscreen.h
  80. 756
    459
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  81. 758
    461
      Marlin/example_configurations/RigidBot/Configuration.h
  82. 769
    214
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  83. 788
    487
      Marlin/example_configurations/SCARA/Configuration.h
  84. 769
    214
      Marlin/example_configurations/SCARA/Configuration_adv.h
  85. 755
    460
      Marlin/example_configurations/TAZ4/Configuration.h
  86. 769
    222
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  87. 1685
    0
      Marlin/example_configurations/TinyBoy2/Configuration.h
  88. 1357
    0
      Marlin/example_configurations/TinyBoy2/Configuration_adv.h
  89. 754
    459
      Marlin/example_configurations/WITBOX/Configuration.h
  90. 769
    214
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  91. 757
    460
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  92. 1749
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h
  93. 1359
    0
      Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
  94. 1743
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h
  95. 1358
    0
      Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
  96. 0
    1420
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  97. 0
    801
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  98. 799
    480
      Marlin/example_configurations/delta/generic/Configuration.h
  99. 770
    215
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  100. 0
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration.h

+ 20
- 0
.gitattributes Wyświetl plik

1
+# Set the default behavior, in case people don't have core.autocrlf set.
2
+* text=auto
3
+
4
+# Files with Unix line endings
5
+*.c   text eol=lf
6
+*.cpp text eol=lf
7
+*.h   text eol=lf
8
+*.ino text eol=lf
9
+*.py  text eol=lf
10
+*.sh  text eol=lf
11
+*.scad text eol=lf
12
+
13
+# Files with native line endings
14
+# *.sln text
15
+
16
+# Binary files
17
+*.png binary
18
+*.jpg binary
19
+*.fon binary
20
+

+ 36
- 0
.github/issue_template.md Wyświetl plik

1
+Thank you for submitting your feedback to the Marlin project.
2
+Please use one of the templates below to fill out this box.
3
+
4
+------------------------------------------------------------
5
+### Feature Request
6
+Please put [FR] in the issue title: `[FR] Add-on that goes 'ping'`
7
+
8
+------------------------------------------------------------
9
+### Compile Error
10
+When I compile with `FEATURE_X` I get an error:
11
+```
12
+Paste_the_error_text_here
13
+```
14
+
15
+------------------------------------------------------------
16
+### Bug Report
17
+- Description: ---
18
+- Expected behaviour: ---
19
+- Actual behaviour: ---
20
+- Steps to reproduce:
21
+  - Do this
22
+  - Do that
23
+
24
+Attach a ZIP of `Configuration.h` and `Configuration_adv.h` by dropping here.
25
+
26
+------------------------------------------------------------
27
+### Bug Report Tips
28
+- When troubleshooting, use `M502` followed by `M500` to reset EEPROM to defaults.
29
+- Use `DEBUG_LEVELING_FEATURE` with `M111 S247` for detailed logging of homing/leveling.
30
+- Format text with: **bold**, _italic_, `code`.
31
+- Format C++ with three backticks, plus "cpp":
32
+```cpp
33
+void my_function(bool do_it) {
34
+  // Hold this spot
35
+}
36
+```

+ 24
- 2
.gitignore Wyświetl plik

1
 #
1
 #
2
 # Marlin 3D Printer Firmware
2
 # Marlin 3D Printer Firmware
3
-# Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
3
+# Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
 #
4
 #
5
 # Based on Sprinter and grbl.
5
 # Based on Sprinter and grbl.
6
 # Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
6
 # Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
42
 *.i
42
 *.i
43
 *.ii
43
 *.ii
44
 *.swp
44
 *.swp
45
-
45
+tags
46
 
46
 
47
 #
47
 #
48
 # C++
48
 # C++
52
 *.lo
52
 *.lo
53
 *.o
53
 *.o
54
 *.obj
54
 *.obj
55
+*.ino.cpp
55
 
56
 
56
 # Precompiled Headers
57
 # Precompiled Headers
57
 *.gch
58
 *.gch
114
 # Debug files
115
 # Debug files
115
 *.dSYM/
116
 *.dSYM/
116
 *.su
117
 *.su
118
+
119
+# PlatformIO files/dirs
120
+.pio*
121
+lib/readme.txt
122
+
123
+#Visual Studio
124
+*.sln
125
+*.vcxproj
126
+*.vcxproj.filters
127
+Marlin/Release/
128
+Marlin/Debug/
129
+Marlin/__vm/
130
+Marlin/.vs/
131
+
132
+#cmake
133
+CMakeLists.txt
134
+Marlin/CMakeLists.txt
135
+CMakeListsPrivate.txt
136
+
137
+#CLion
138
+cmake-build-*

+ 94
- 128
.travis.yml Wyświetl plik

20
   #
20
   #
21
 install:
21
 install:
22
   #
22
   #
23
-  # Install arduino 1.6.9
24
-  - wget http://downloads-02.arduino.cc/arduino-1.6.9-linux64.tar.xz
25
-  - tar xf arduino-1.6.9-linux64.tar.xz
26
-  - sudo mv arduino-1.6.9 /usr/local/share/arduino
23
+  # Install arduino 1.6.10
24
+  - wget http://downloads-02.arduino.cc/arduino-1.6.10-linux64.tar.xz
25
+  - tar xf arduino-1.6.10-linux64.tar.xz
26
+  - sudo mv arduino-1.6.10 /usr/local/share/arduino
27
   - ln -s /usr/local/share/arduino/arduino ${TRAVIS_BUILD_DIR}/buildroot/bin/arduino
27
   - ln -s /usr/local/share/arduino/arduino ${TRAVIS_BUILD_DIR}/buildroot/bin/arduino
28
   #
28
   #
29
   # Install: LiquidCrystal_I2C library
29
   # Install: LiquidCrystal_I2C library
35
   - sudo mv LiquidTWI2 /usr/local/share/arduino/libraries/LiquidTWI2
35
   - sudo mv LiquidTWI2 /usr/local/share/arduino/libraries/LiquidTWI2
36
   #
36
   #
37
   # Install: Monochrome Graphics Library for LCDs and OLEDs
37
   # Install: Monochrome Graphics Library for LCDs and OLEDs
38
-  - arduino --install-library "U8glib"
38
+  - git clone https://github.com/olikraus/U8glib_Arduino.git
39
+  - sudo mv U8glib_Arduino /usr/local/share/arduino/libraries/U8glib
39
   #
40
   #
40
   # Install: L6470 Stepper Motor Driver library
41
   # Install: L6470 Stepper Motor Driver library
41
-  - git clone https://github.com/ameyer/Arduino-L6470.git
42
-  - sudo mv Arduino-L6470/L6470 /usr/local/share/arduino/libraries/L6470
42
+  # - git clone https://github.com/ameyer/Arduino-L6470.git
43
+  # - sudo mv Arduino-L6470/L6470 /usr/local/share/arduino/libraries/L6470
43
   #
44
   #
44
   # Install: TMC26X Stepper Motor Controller library
45
   # Install: TMC26X Stepper Motor Controller library
45
-  - git clone https://github.com/trinamic/TMC26XStepper.git
46
-  - sudo mv TMC26XStepper /usr/local/share/arduino/libraries/TMC26XStepper
46
+  # - git clone https://github.com/trinamic/TMC26XStepper.git
47
+  # - sudo mv TMC26XStepper /usr/local/share/arduino/libraries/TMC26XStepper
48
+  #
49
+  # Install: TMC2130 Stepper Motor Controller library
50
+  - git clone https://github.com/teemuatlut/TMC2130Stepper.git
51
+  - sudo mv TMC2130Stepper /usr/local/share/arduino/libraries/TMC2130Stepper
47
   #
52
   #
48
 before_script:
53
 before_script:
49
   #
54
   #
66
   #
71
   #
67
   - build_marlin
72
   - build_marlin
68
   #
73
   #
69
-  # Test heated bed temperature sensor
70
-  #
71
-  - opt_set TEMP_SENSOR_BED 1
72
-  - build_marlin
73
-  #
74
-  # Test 2 extruders on basic RAMPS 1.4
74
+  # Test 2 extruders (one MAX6675) and heated bed on basic RAMPS 1.4
75
+  #  plus a "Fix Mounted" Probe with Safe Homing and some arc options
75
   #
76
   #
76
   - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
77
   - opt_set MOTHERBOARD BOARD_RAMPS_14_EEB
77
   - opt_set EXTRUDERS 2
78
   - opt_set EXTRUDERS 2
79
+  - opt_set TEMP_SENSOR_0 -2
78
   - opt_set TEMP_SENSOR_1 1
80
   - opt_set TEMP_SENSOR_1 1
81
+  - opt_set TEMP_SENSOR_BED 1
82
+  - opt_enable PIDTEMPBED FIX_MOUNTED_PROBE Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES
79
   - build_marlin
83
   - build_marlin
80
   #
84
   #
81
-  # Test 3 extruders on RUMBA (can use any board with >=3 extruders defined)
82
-  # Include a test for LIN_ADVANCE here also
83
-  #
84
-  - opt_set MOTHERBOARD BOARD_RUMBA
85
-  - opt_set EXTRUDERS 3
86
-  - opt_set TEMP_SENSOR_2 1
87
-  - opt_enable_adv LIN_ADVANCE
88
-  - build_marlin
89
-  #
90
-  # Test PIDTEMPBED
85
+  # ...with AUTO_BED_LEVELING_LINEAR, Z_MIN_PROBE_REPEATABILITY_TEST, and DEBUG_LEVELING_FEATURE
91
   #
86
   #
92
-  - restore_configs
93
-  - opt_enable PIDTEMPBED
87
+  - opt_enable AUTO_BED_LEVELING_LINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE
88
+  - opt_set ABL_GRID_POINTS_X 16
89
+  - opt_set ABL_GRID_POINTS_Y 16
94
   - build_marlin
90
   - build_marlin
95
   #
91
   #
96
-  # Test a "Fix Mounted" Probe along with Safe Homing
92
+  # Test a simple build of AUTO_BED_LEVELING_UBL
97
   #
93
   #
98
   - restore_configs
94
   - restore_configs
99
-  - opt_enable FIX_MOUNTED_PROBE Z_SAFE_HOMING
100
-  - build_marlin
101
-  #
102
-  # ...with AUTO_BED_LEVELING_FEATURE, Z_MIN_PROBE_REPEATABILITY_TEST, & DEBUG_LEVELING_FEATURE
103
-  #
104
-  - opt_enable AUTO_BED_LEVELING_FEATURE Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE
95
+  - opt_enable AUTO_BED_LEVELING_UBL UBL_G26_MESH_EDITING ENABLE_LEVELING_FADE_HEIGHT FIX_MOUNTED_PROBE EEPROM_SETTINGS G3D_PANEL
96
+  - opt_enable_adv CUSTOM_USER_MENUS I2C_POSITION_ENCODERS BABYSTEPPING
105
   - build_marlin
97
   - build_marlin
106
   #
98
   #
107
   # Test a Sled Z Probe
99
   # Test a Sled Z Probe
100
+  # ...with AUTO_BED_LEVELING_LINEAR, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, and EEPROM_CHITCHAT
108
   #
101
   #
109
   - restore_configs
102
   - restore_configs
110
-  - opt_enable Z_PROBE_SLED
111
-  - build_marlin
112
-  #
113
-  # ...with AUTO_BED_LEVELING_FEATURE & DEBUG_LEVELING_FEATURE
114
-  #
115
-  - opt_enable AUTO_BED_LEVELING_FEATURE DEBUG_LEVELING_FEATURE
103
+  - opt_enable Z_PROBE_SLED AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT
116
   - build_marlin
104
   - build_marlin
117
   #
105
   #
118
   # Test a Servo Probe
106
   # Test a Servo Probe
107
+  # ...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES
119
   #
108
   #
120
   - restore_configs
109
   - restore_configs
121
   - opt_enable NUM_SERVOS Z_ENDSTOP_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE
110
   - opt_enable NUM_SERVOS Z_ENDSTOP_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE
111
+  - opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS EEPROM_CHITCHAT
112
+  - opt_enable_adv EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES AUTOTEMP
122
   - build_marlin
113
   - build_marlin
123
   #
114
   #
124
-  # ...with AUTO_BED_LEVELING_FEATURE & DEBUG_LEVELING_FEATURE
115
+  # Test MESH_BED_LEVELING feature, with LCD
125
   #
116
   #
126
-  - opt_enable AUTO_BED_LEVELING_FEATURE DEBUG_LEVELING_FEATURE
117
+  - restore_configs
118
+  - opt_enable MESH_BED_LEVELING MESH_G28_REST_ORIGIN LCD_BED_LEVELING ULTIMAKERCONTROLLER
127
   - build_marlin
119
   - build_marlin
128
   #
120
   #
129
-  # Test MESH_BED_LEVELING feature, with LCD
121
+  # Test PROBE_MANUALLY feature, with LCD support,
122
+  #      EEPROM_SETTINGS, EEPROM_CHITCHAT, M100_FREE_MEMORY_WATCHER,
123
+  #      INCH_MODE_SUPPORT, TEMPERATURE_UNITS_SUPPORT
130
   #
124
   #
131
   - restore_configs
125
   - restore_configs
132
-  - opt_enable MESH_BED_LEVELING MESH_G28_REST_ORIGIN MANUAL_BED_LEVELING ULTIMAKERCONTROLLER
126
+  - opt_set MOTHERBOARD BOARD_MINIRAMBO
127
+  - opt_enable PROBE_MANUALLY AUTO_BED_LEVELING_BILINEAR LCD_BED_LEVELING ULTIMAKERCONTROLLER
128
+  - opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT M100_FREE_MEMORY_WATCHER M100_FREE_MEMORY_DUMPER M100_FREE_MEMORY_CORRUPTOR INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT
133
   - build_marlin
129
   - build_marlin
134
   #
130
   #
135
-  # Test EEPROM_SETTINGS, EEPROM_CHITCHAT, M100_FREE_MEMORY_WATCHER,
136
-  #   INCH_MODE_SUPPORT, TEMPERATURE_UNITS_SUPPORT
131
+  # Test 5 extruders on AZTEEG_X3_PRO (can use any board with >=5 extruders defined)
132
+  # Include a test for LIN_ADVANCE here also
137
   #
133
   #
138
-  - restore_configs
139
-  - opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT M100_FREE_MEMORY_WATCHER INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT
134
+  - opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO
135
+  - opt_set EXTRUDERS 5
136
+  - opt_set TEMP_SENSOR_1 1
137
+  - opt_set TEMP_SENSOR_2 5
138
+  - opt_set TEMP_SENSOR_3 20
139
+  - opt_set TEMP_SENSOR_4 999
140
+  - opt_set TEMP_SENSOR_BED 1
141
+  - opt_enable_adv LIN_ADVANCE
140
   - build_marlin
142
   - build_marlin
141
   #
143
   #
142
-  # Mixing Extruder
144
+  # Mixing Extruder with 5 steppers
143
   #
145
   #
144
   - restore_configs
146
   - restore_configs
147
+  - opt_set MOTHERBOARD BOARD_AZTEEG_X3_PRO
145
   - opt_enable MIXING_EXTRUDER
148
   - opt_enable MIXING_EXTRUDER
146
-  - opt_set MIXING_STEPPERS 2
149
+  - opt_set MIXING_STEPPERS 5
147
   - build_marlin
150
   - build_marlin
148
   #
151
   #
149
   # Test DUAL_X_CARRIAGE
152
   # Test DUAL_X_CARRIAGE
176
   - build_marlin
179
   - build_marlin
177
   #
180
   #
178
   # Test MINIRAMBO for PWM_MOTOR_CURRENT
181
   # Test MINIRAMBO for PWM_MOTOR_CURRENT
182
+  #      ULTIMAKERCONTROLLER, FILAMENT_LCD_DISPLAY, FILAMENT_WIDTH_SENSOR,
183
+  #      PRINTCOUNTER, NOZZLE_PARK_FEATURE, NOZZLE_CLEAN_FEATURE, PCA9632,
184
+  #      Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS, BEZIER_CURVE_SUPPORT, EXPERIMENTAL_I2CBUS,
185
+  #      FILAMENT_CHANGE_FEATURE, PARK_HEAD_ON_PAUSE, LCD_INFO_MENU,
179
   #
186
   #
180
   - restore_configs
187
   - restore_configs
181
-  - opt_set MOTHERBOARD BOARD_MINIRAMBO
182
-  - build_marlin
183
-  #
184
-  # Test FILAMENT_CHANGE_FEATURE and LCD_INFO_MENU
185
-  #
186
-  - restore_configs
187
-  - opt_enable ULTIMAKERCONTROLLER
188
-  - opt_enable_adv FILAMENT_CHANGE_FEATURE LCD_INFO_MENU
189
-  - build_marlin
190
-  #
191
-  # Enable filament sensor
192
-  #
193
-  - restore_configs
194
-  - opt_enable FILAMENT_WIDTH_SENSOR
195
-  - build_marlin
196
-  #
197
-  # Enable filament sensor with LCD display
198
-  #
199
-  - opt_enable ULTIMAKERCONTROLLER FILAMENT_LCD_DISPLAY
200
-  - build_marlin
201
-  #
202
-  # Enable BEZIER_CURVE_SUPPORT
203
-  #
204
-  - restore_configs
205
-  - opt_enable_adv BEZIER_CURVE_SUPPORT
206
-  - build_marlin
207
-  #
208
-  # Enable COREXY
209
-  #
210
-  - restore_configs
211
-  - opt_enable COREXY
212
-  - build_marlin
213
-  #
214
-  # Enable COREXZ
215
-  #
216
-  - restore_configs
217
-  - opt_enable COREXZ
218
-  - build_marlin
219
-  #
220
-  # Enable Z_DUAL_STEPPER_DRIVERS, Z_DUAL_ENDSTOPS
221
-  #
222
-  - restore_configs
223
-  - opt_enable_adv Z_DUAL_STEPPER_DRIVERS Z_DUAL_ENDSTOPS
188
+  - opt_enable ULTIMAKERCONTROLLER FILAMENT_LCD_DISPLAY FILAMENT_WIDTH_SENSOR SDSUPPORT
189
+  - opt_enable PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE PCA9632
190
+  - opt_enable_adv Z_DUAL_STEPPER_DRIVERS Z_DUAL_ENDSTOPS BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS
191
+  - opt_set_adv I2C_SLAVE_ADDRESS 63
192
+  - opt_enable_adv FILAMENT_CHANGE_FEATURE PARK_HEAD_ON_PAUSE LCD_INFO_MENU
224
   - pins_set RAMPS X_MAX_PIN -1
193
   - pins_set RAMPS X_MAX_PIN -1
225
   - opt_set_adv Z2_MAX_PIN 2
194
   - opt_set_adv Z2_MAX_PIN 2
226
   - build_marlin
195
   - build_marlin
227
   #
196
   #
228
-  # Test PRINTCOUNTER
229
-  #
230
-  - restore_configs
231
-  - opt_enable PRINTCOUNTER
232
-  - build_marlin
233
-  #
234
-  # Test NOZZLE_PARK_FEATURE
197
+  # Enable COREXY
235
   #
198
   #
236
   - restore_configs
199
   - restore_configs
237
-  - opt_enable NOZZLE_PARK_FEATURE
200
+  - opt_enable COREXY
238
   - build_marlin
201
   - build_marlin
239
   #
202
   #
240
-  # Test NOZZLE_CLEAN_FEATURE
203
+  # Enable COREYX (swapped)
241
   #
204
   #
242
-  - restore_configs
243
-  - opt_enable NOZZLE_CLEAN_FEATURE
244
-  - build_marlin
205
+  #- restore_configs
206
+  #- opt_enable COREYX
207
+  #- build_marlin
245
   #
208
   #
246
   #
209
   #
247
-  ######## STANDARD LCD/PANELS ##############
210
+  ######## Other Standard LCD/Panels ##############
248
   #
211
   #
249
   # ULTRA_LCD
212
   # ULTRA_LCD
250
   #
213
   #
258
   - opt_enable DOGLCD
221
   - opt_enable DOGLCD
259
   - build_marlin
222
   - build_marlin
260
   #
223
   #
261
-  # ULTIMAKERCONTROLLER
262
-  #
263
-  - restore_configs
264
-  - opt_enable ULTIMAKERCONTROLLER
265
-  - build_marlin
266
-  #
267
   # MAKRPANEL
224
   # MAKRPANEL
268
   # Needs to use Melzi and Sanguino hardware
225
   # Needs to use Melzi and Sanguino hardware
269
   #
226
   #
271
   #- opt_enable MAKRPANEL
228
   #- opt_enable MAKRPANEL
272
   #- build_marlin
229
   #- build_marlin
273
   #
230
   #
274
-  # REPRAP_DISCOUNT_SMART_CONTROLLER, SDSUPPORT, and BABYSTEPPING
231
+  # REPRAP_DISCOUNT_SMART_CONTROLLER, SDSUPPORT, BABYSTEPPING, RIGIDBOARD_V2, and DAC_MOTOR_CURRENT_DEFAULT
275
   #
232
   #
276
   - restore_configs
233
   - restore_configs
277
-  - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT BABYSTEPPING
234
+  - opt_set MOTHERBOARD BOARD_RIGIDBOARD_V2
235
+  - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT BABYSTEPPING DAC_MOTOR_CURRENT_DEFAULT
278
   - build_marlin
236
   - build_marlin
279
   #
237
   #
280
-  # G3D_PANEL
238
+  # G3D_PANEL with SDCARD_SORT_ALPHA and STATUS_MESSAGE_SCROLLING
281
   #
239
   #
282
   - restore_configs
240
   - restore_configs
283
   - opt_enable G3D_PANEL SDSUPPORT
241
   - opt_enable G3D_PANEL SDSUPPORT
242
+  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING
243
+  - opt_set_adv SDSORT_GCODE true
244
+  - opt_set_adv SDSORT_USES_RAM true
245
+  - opt_set_adv SDSORT_USES_STACK true
246
+  - opt_set_adv SDSORT_CACHE_NAMES true
284
   - build_marlin
247
   - build_marlin
285
   #
248
   #
286
-  # REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
249
+  # REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER with SDCARD_SORT_ALPHA and STATUS_MESSAGE_SCROLLING
287
   #
250
   #
288
   - restore_configs
251
   - restore_configs
289
   - opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT
252
   - opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT
253
+  - opt_enable_adv SDCARD_SORT_ALPHA STATUS_MESSAGE_SCROLLING
290
   - build_marlin
254
   - build_marlin
291
   #
255
   #
292
   # REPRAPWORLD_KEYPAD
256
   # REPRAPWORLD_KEYPAD
299
   # RA_CONTROL_PANEL
263
   # RA_CONTROL_PANEL
300
   #
264
   #
301
   - restore_configs
265
   - restore_configs
302
-  - opt_enable RA_CONTROL_PANEL
266
+  - opt_enable RA_CONTROL_PANEL PINS_DEBUGGING
303
   - build_marlin
267
   - build_marlin
304
   #
268
   #
305
   ######## I2C LCD/PANELS ##############
269
   ######## I2C LCD/PANELS ##############
336
   ######## Example Configurations ##############
300
   ######## Example Configurations ##############
337
   #
301
   #
338
   # BQ Hephestos 2
302
   # BQ Hephestos 2
339
-  - restore_configs
340
-  - use_example_configs Hephestos_2
341
-  - build_marlin
303
+  #- restore_configs
304
+  #- use_example_configs Hephestos_2
305
+  #- build_marlin
342
   #
306
   #
343
-  # Delta Config (generic)
344
-  - restore_configs
307
+  # Delta Config (generic) + ABL bilinear + PROBE_MANUALLY
345
   - use_example_configs delta/generic
308
   - use_example_configs delta/generic
309
+  - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER DELTA_CALIBRATION_MENU AUTO_BED_LEVELING_BILINEAR PROBE_MANUALLY
346
   - build_marlin
310
   - build_marlin
347
   #
311
   #
348
-  # Delta Config (generic) + ABL + ALLEN_KEY
312
+  # Delta Config (generic) + UBL + ALLEN_KEY + OLED_PANEL_TINYBOY2 + EEPROM_SETTINGS
349
   #
313
   #
350
   - use_example_configs delta/generic
314
   - use_example_configs delta/generic
351
   - opt_disable DISABLE_MIN_ENDSTOPS
315
   - opt_disable DISABLE_MIN_ENDSTOPS
352
-  - opt_enable AUTO_BED_LEVELING_FEATURE Z_PROBE_ALLEN_KEY
316
+  - opt_enable AUTO_BED_LEVELING_UBL Z_PROBE_ALLEN_KEY EEPROM_SETTINGS EEPROM_CHITCHAT OLED_PANEL_TINYBOY2
353
   - build_marlin
317
   - build_marlin
354
   #
318
   #
355
-  # Delta Config (Mini Kossel)
319
+  # Delta Config (FLSUN AC because it's complex)
356
   #
320
   #
357
-  - use_example_configs delta/kossel_mini
321
+  - use_example_configs delta/FLSUN/auto_calibrate
358
   - build_marlin
322
   - build_marlin
359
   #
323
   #
360
   # Makibox Config  need to check board type for Teensy++ 2.0
324
   # Makibox Config  need to check board type for Teensy++ 2.0
362
   #- use_example_configs makibox
326
   #- use_example_configs makibox
363
   #- build_marlin
327
   #- build_marlin
364
   #
328
   #
365
-  # SCARA Config
329
+  # SCARA with TMC2130
366
   #
330
   #
367
   - use_example_configs SCARA
331
   - use_example_configs SCARA
368
-  - opt_enable AUTO_BED_LEVELING_FEATURE FIX_MOUNTED_PROBE USE_ZMIN_PLUG
332
+  - opt_enable AUTO_BED_LEVELING_BILINEAR FIX_MOUNTED_PROBE USE_ZMIN_PLUG EEPROM_SETTINGS EEPROM_CHITCHAT ULTIMAKERCONTROLLER
333
+  - opt_enable_adv HAVE_TMC2130 X_IS_TMC2130 Y_IS_TMC2130 Z_IS_TMC2130
334
+  - opt_enable_adv AUTOMATIC_CURRENT_CONTROL STEALTHCHOP HYBRID_THRESHOLD SENSORLESS_HOMING
369
   - build_marlin
335
   - build_marlin
370
   #
336
   #
371
   # tvrrug Config need to check board type for sanguino atmega644p
337
   # tvrrug Config need to check board type for sanguino atmega644p

+ 210
- 91
Marlin/Conditionals_LCD.h Wyświetl plik

22
 
22
 
23
 /**
23
 /**
24
  * Conditionals_LCD.h
24
  * Conditionals_LCD.h
25
- * LCD Defines that depend on configuration but are not editable.
25
+ * Conditionals that need to be set before Configuration_adv.h or pins.h
26
  */
26
  */
27
 
27
 
28
 #ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first
28
 #ifndef CONDITIONALS_LCD_H // Get the LCD defines which are needed first
31
   #define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
31
   #define LCD_HAS_DIRECTIONAL_BUTTONS (BUTTON_EXISTS(UP) || BUTTON_EXISTS(DWN) || BUTTON_EXISTS(LFT) || BUTTON_EXISTS(RT))
32
 
32
 
33
   #if ENABLED(CARTESIO_UI)
33
   #if ENABLED(CARTESIO_UI)
34
+
34
     #define DOGLCD
35
     #define DOGLCD
35
     #define ULTIPANEL
36
     #define ULTIPANEL
36
     #define NEWPANEL
37
     #define NEWPANEL
37
     #define DEFAULT_LCD_CONTRAST 90
38
     #define DEFAULT_LCD_CONTRAST 90
38
     #define LCD_CONTRAST_MIN 60
39
     #define LCD_CONTRAST_MIN 60
39
     #define LCD_CONTRAST_MAX 140
40
     #define LCD_CONTRAST_MAX 140
40
-  #endif
41
 
41
 
42
-  #if ENABLED(MAKRPANEL) || ENABLED(MINIPANEL)
42
+  #elif ENABLED(MAKRPANEL) || ENABLED(MINIPANEL)
43
+
43
     #define DOGLCD
44
     #define DOGLCD
44
     #define ULTIPANEL
45
     #define ULTIPANEL
45
     #define NEWPANEL
46
     #define NEWPANEL
46
     #define DEFAULT_LCD_CONTRAST 17
47
     #define DEFAULT_LCD_CONTRAST 17
47
-  #endif
48
 
48
 
49
-  #if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
49
+  #elif ENABLED(ANET_KEYPAD_LCD)
50
+
51
+    #define REPRAPWORLD_KEYPAD
52
+    #define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
53
+    #define ADC_KEYPAD
54
+    #define ADC_KEY_NUM 8
55
+    #define ULTIPANEL
56
+    // this helps to implement ADC_KEYPAD menus
57
+    #define ENCODER_STEPS_PER_MENU_ITEM 1
58
+    #define REVERSE_MENU_DIRECTION
59
+
60
+  #elif ENABLED(ANET_FULL_GRAPHICS_LCD)
61
+
62
+    #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
63
+
64
+  #elif ENABLED(BQ_LCD_SMART_CONTROLLER)
65
+
66
+    #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
67
+    #define LONG_FILENAME_HOST_SUPPORT
68
+
69
+  #elif ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
70
+
50
     #define ULTRA_LCD  //general LCD support, also 16x2
71
     #define ULTRA_LCD  //general LCD support, also 16x2
51
     #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
72
     #define DOGLCD  // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
52
     #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
73
     #define ULTIMAKERCONTROLLER //as available from the Ultimaker online store.
65
       #define SD_DETECT_INVERTED
86
       #define SD_DETECT_INVERTED
66
     #endif
87
     #endif
67
 
88
 
68
-    #ifndef ENCODER_PULSES_PER_STEP
69
-      #define ENCODER_PULSES_PER_STEP 4
70
-    #endif
71
-    #ifndef ENCODER_STEPS_PER_MENU_ITEM
72
-      #define ENCODER_STEPS_PER_MENU_ITEM 1
73
-    #endif
89
+  #elif ENABLED(OLED_PANEL_TINYBOY2)
90
+
91
+    #define U8GLIB_SSD1306
92
+    #define ULTIPANEL
93
+    #define NEWPANEL
94
+    #define REVERSE_ENCODER_DIRECTION
95
+    #define REVERSE_MENU_DIRECTION
96
+
97
+  #elif ENABLED(RA_CONTROL_PANEL)
98
+
99
+    #define LCD_I2C_TYPE_PCA8574
100
+    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
101
+    #define ULTIPANEL
102
+    #define NEWPANEL
103
+
104
+  #elif ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
105
+
106
+    #define DOGLCD
107
+    #define U8GLIB_ST7920
108
+    #define ULTIPANEL
109
+    #define NEWPANEL
110
+
74
   #endif
111
   #endif
75
 
112
 
76
   // Generic support for SSD1306 / SH1106 OLED based LCDs.
113
   // Generic support for SSD1306 / SH1106 OLED based LCDs.
83
     #define ULTIMAKERCONTROLLER
120
     #define ULTIMAKERCONTROLLER
84
   #endif
121
   #endif
85
 
122
 
86
-  #if ENABLED(BQ_LCD_SMART_CONTROLLER)
87
-    #define REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER
88
-
89
-    #ifndef ENCODER_PULSES_PER_STEP
90
-      #define ENCODER_PULSES_PER_STEP 4
91
-    #endif
92
-    #ifndef ENCODER_STEPS_PER_MENU_ITEM
93
-      #define ENCODER_STEPS_PER_MENU_ITEM 1
94
-    #endif
95
-
96
-    #ifndef LONG_FILENAME_HOST_SUPPORT
97
-      #define LONG_FILENAME_HOST_SUPPORT
98
-    #endif
99
-  #endif
100
-
101
-  #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
123
+  #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(LCD_FOR_MELZI)
102
     #define DOGLCD
124
     #define DOGLCD
103
     #define U8GLIB_ST7920
125
     #define U8GLIB_ST7920
104
     #define REPRAP_DISCOUNT_SMART_CONTROLLER
126
     #define REPRAP_DISCOUNT_SMART_CONTROLLER
107
   #if ENABLED(ULTIMAKERCONTROLLER)              \
129
   #if ENABLED(ULTIMAKERCONTROLLER)              \
108
    || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
130
    || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
109
    || ENABLED(G3D_PANEL)                        \
131
    || ENABLED(G3D_PANEL)                        \
110
-   || ENABLED(RIGIDBOT_PANEL)                   \
111
-   || ENABLED(REPRAPWORLD_KEYPAD)
132
+   || ENABLED(RIGIDBOT_PANEL)
112
     #define ULTIPANEL
133
     #define ULTIPANEL
113
     #define NEWPANEL
134
     #define NEWPANEL
114
   #endif
135
   #endif
115
 
136
 
116
-  #if ENABLED(RA_CONTROL_PANEL)
117
-    #define LCD_I2C_TYPE_PCA8574
118
-    #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
119
-    #define ULTIPANEL
120
-    #define NEWPANEL
121
-  #endif
122
-
123
-  #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
124
-    #define DOGLCD
125
-    #define U8GLIB_ST7920
126
-    #define ULTIPANEL
137
+  #if ENABLED(REPRAPWORLD_KEYPAD)
127
     #define NEWPANEL
138
     #define NEWPANEL
139
+    #if ENABLED(ULTIPANEL) && !defined(REPRAPWORLD_KEYPAD_MOVE_STEP)
140
+      #define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0
141
+    #endif
128
   #endif
142
   #endif
129
 
143
 
130
   /**
144
   /**
132
    */
146
    */
133
 
147
 
134
   #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
148
   #if ENABLED(LCD_I2C_SAINSMART_YWROBOT)
135
-    // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
136
-    // Make sure it is placed in the Arduino libraries directory.
149
+
150
+    // Note: This controller requires F.Malpartida's LiquidCrystal_I2C library
151
+    // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
152
+
137
     #define LCD_I2C_TYPE_PCF8575
153
     #define LCD_I2C_TYPE_PCF8575
138
     #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
154
     #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
139
     #define ULTIPANEL
155
     #define ULTIPANEL
140
     #define NEWPANEL
156
     #define NEWPANEL
141
-  #endif
142
 
157
 
143
-  // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
144
-  #if ENABLED(LCD_I2C_PANELOLU2)
158
+  #elif ENABLED(LCD_I2C_PANELOLU2)
159
+
160
+    // PANELOLU2 LCD with status LEDs, separate encoder and click inputs
161
+
145
     #define LCD_I2C_TYPE_MCP23017
162
     #define LCD_I2C_TYPE_MCP23017
146
     #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
163
     #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
147
     #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
164
     #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
148
-
149
-    #ifndef ENCODER_PULSES_PER_STEP
150
-      #define ENCODER_PULSES_PER_STEP 4
151
-    #endif
152
-    #ifndef ENCODER_STEPS_PER_MENU_ITEM
153
-      #define ENCODER_STEPS_PER_MENU_ITEM 1
154
-    #endif
155
-
156
     #define ULTIPANEL
165
     #define ULTIPANEL
157
     #define NEWPANEL
166
     #define NEWPANEL
158
-  #endif
159
 
167
 
160
-  // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
161
-  #if ENABLED(LCD_I2C_VIKI)
162
-    // This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
163
-    // Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
164
-    // Note: The pause/stop/resume LCD button pin should be connected to the Arduino
165
-    //       BTN_ENC pin (or set BTN_ENC to -1 if not used)
168
+  #elif ENABLED(LCD_I2C_VIKI)
169
+
170
+    /**
171
+     * Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
172
+     *
173
+     * This uses the LiquidTWI2 library v1.2.3 or later ( https://github.com/lincomatic/LiquidTWI2 )
174
+     * Make sure the LiquidTWI2 directory is placed in the Arduino or Sketchbook libraries subdirectory.
175
+     * Note: The pause/stop/resume LCD button pin should be connected to the Arduino
176
+     *       BTN_ENC pin (or set BTN_ENC to -1 if not used)
177
+     */
166
     #define LCD_I2C_TYPE_MCP23017
178
     #define LCD_I2C_TYPE_MCP23017
167
     #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
179
     #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
168
     #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
180
     #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
179
     #endif
191
     #endif
180
   #endif
192
   #endif
181
 
193
 
194
+  // Set encoder detents for well-known controllers
195
+  #if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) || ENABLED(OLED_PANEL_TINYBOY2) \
196
+   || ENABLED(BQ_LCD_SMART_CONTROLLER) || ENABLED(LCD_I2C_PANELOLU2) || ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
197
+    #ifndef ENCODER_PULSES_PER_STEP
198
+      #define ENCODER_PULSES_PER_STEP 4
199
+    #endif
200
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
201
+      #define ENCODER_STEPS_PER_MENU_ITEM 1
202
+    #endif
203
+  #endif
204
+
182
   // Shift register panels
205
   // Shift register panels
183
   // ---------------------
206
   // ---------------------
184
   // 2 wire Non-latching LCD SR from:
207
   // 2 wire Non-latching LCD SR from:
208
     #ifndef LCD_HEIGHT
231
     #ifndef LCD_HEIGHT
209
       #define LCD_HEIGHT 4
232
       #define LCD_HEIGHT 4
210
     #endif
233
     #endif
211
-  #else //no panel but just LCD
234
+  #else // no panel but just LCD
212
     #if ENABLED(ULTRA_LCD)
235
     #if ENABLED(ULTRA_LCD)
213
       #ifndef LCD_WIDTH
236
       #ifndef LCD_WIDTH
214
         #define LCD_WIDTH 16
237
         #define LCD_WIDTH 16
233
     #define LCD_STR_DEGREE      "\x09"
256
     #define LCD_STR_DEGREE      "\x09"
234
 
257
 
235
     #define LCD_STR_SPECIAL_MAX '\x09'
258
     #define LCD_STR_SPECIAL_MAX '\x09'
236
-    // Maximum here is 0x1f because 0x20 is ' ' (space) and the normal charsets begin.
259
+    // Maximum here is 0x1F because 0x20 is ' ' (space) and the normal charsets begin.
237
     // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
260
     // Better stay below 0x10 because DISPLAY_CHARSET_HD44780_WESTERN begins here.
261
+
262
+    // Symbol characters
263
+    #define LCD_STR_FILAM_DIA   "\xf8"
264
+    #define LCD_STR_FILAM_MUL   "\xa4"
238
   #else
265
   #else
239
     /* Custom characters defined in the first 8 characters of the LCD */
266
     /* Custom characters defined in the first 8 characters of the LCD */
240
-    #define LCD_STR_BEDTEMP     "\x00"  // Print only as a char. This will have 'unexpected' results when used in a string!
241
-    #define LCD_STR_DEGREE      "\x01"
242
-    #define LCD_STR_THERMOMETER "\x02"
243
-    #define LCD_STR_UPLEVEL     "\x03"
267
+    #define LCD_BEDTEMP_CHAR     0x00  // Print only as a char. This will have 'unexpected' results when used in a string!
268
+    #define LCD_DEGREE_CHAR      0x01
269
+    #define LCD_STR_THERMOMETER "\x02" // Still used with string concatenation
270
+    #define LCD_UPLEVEL_CHAR     0x03
244
     #define LCD_STR_REFRESH     "\x04"
271
     #define LCD_STR_REFRESH     "\x04"
245
     #define LCD_STR_FOLDER      "\x05"
272
     #define LCD_STR_FOLDER      "\x05"
246
-    #define LCD_STR_FEEDRATE    "\x06"
247
-    #define LCD_STR_CLOCK       "\x07"
273
+    #define LCD_FEEDRATE_CHAR    0x06
274
+    #define LCD_CLOCK_CHAR       0x07
248
     #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
275
     #define LCD_STR_ARROW_RIGHT ">"  /* from the default character set */
276
+
277
+    #if ENABLED(AUTO_BED_LEVELING_UBL)
278
+      #define LCD_UBL_BOXTOP_CHAR 0x01
279
+      #define LCD_UBL_BOXBOT_CHAR 0x02
280
+    #endif
281
+
249
   #endif
282
   #endif
250
 
283
 
251
   /**
284
   /**
278
     #define BOOTSCREEN_TIMEOUT 2500
311
     #define BOOTSCREEN_TIMEOUT 2500
279
   #endif
312
   #endif
280
 
313
 
314
+  #define HAS_DEBUG_MENU ENABLED(LCD_PROGRESS_BAR_TEST)
315
+
316
+  // MK2 Multiplexer forces SINGLENOZZLE to be enabled
317
+  #if ENABLED(MK2_MULTIPLEXER)
318
+    #define SINGLENOZZLE
319
+  #endif
320
+
281
   /**
321
   /**
282
    * Extruders have some combination of stepper motors and hotends
322
    * Extruders have some combination of stepper motors and hotends
283
    * so we separate these concepts into the defines:
323
    * so we separate these concepts into the defines:
285
    *  EXTRUDERS    - Number of Selectable Tools
325
    *  EXTRUDERS    - Number of Selectable Tools
286
    *  HOTENDS      - Number of hotends, whether connected or separate
326
    *  HOTENDS      - Number of hotends, whether connected or separate
287
    *  E_STEPPERS   - Number of actual E stepper motors
327
    *  E_STEPPERS   - Number of actual E stepper motors
328
+   *  E_MANUAL     - Number of E steppers for LCD move options
288
    *  TOOL_E_INDEX - Index to use when getting/setting the tool state
329
    *  TOOL_E_INDEX - Index to use when getting/setting the tool state
289
-   *  
330
+   *
290
    */
331
    */
291
-  #if ENABLED(SINGLENOZZLE)             // One hotend, multi-extruder
292
-    #define HOTENDS      1
293
-    #define E_STEPPERS   EXTRUDERS
294
-    #define E_MANUAL     EXTRUDERS
295
-    #define TOOL_E_INDEX current_block->active_extruder
332
+  #if ENABLED(SINGLENOZZLE) || ENABLED(MIXING_EXTRUDER)         // One hotend, one thermistor, no XY offset
333
+    #define HOTENDS       1
296
     #undef TEMP_SENSOR_1_AS_REDUNDANT
334
     #undef TEMP_SENSOR_1_AS_REDUNDANT
297
     #undef HOTEND_OFFSET_X
335
     #undef HOTEND_OFFSET_X
298
     #undef HOTEND_OFFSET_Y
336
     #undef HOTEND_OFFSET_Y
299
-  #elif ENABLED(SWITCHING_EXTRUDER)     // One E stepper, unified E axis, two hotends
300
-    #define HOTENDS      EXTRUDERS
301
-    #define E_STEPPERS   1
302
-    #define E_MANUAL     1
303
-    #define TOOL_E_INDEX 0
304
-    #ifndef HOTEND_OFFSET_Z
337
+  #else                                                         // Two hotends
338
+    #define HOTENDS       EXTRUDERS
339
+    #if ENABLED(SWITCHING_NOZZLE) && !defined(HOTEND_OFFSET_Z)
305
       #define HOTEND_OFFSET_Z { 0 }
340
       #define HOTEND_OFFSET_Z { 0 }
306
     #endif
341
     #endif
307
-  #elif ENABLED(MIXING_EXTRUDER)        // Multi-stepper, unified E axis, one hotend
308
-    #define HOTENDS      1
309
-    #define E_STEPPERS   MIXING_STEPPERS
310
-    #define E_MANUAL     1
311
-    #define TOOL_E_INDEX 0
312
-  #else                                 // One stepper, E axis, and hotend per tool
313
-    #define HOTENDS      EXTRUDERS
314
-    #define E_STEPPERS   EXTRUDERS
315
-    #define E_MANUAL     EXTRUDERS
316
-    #define TOOL_E_INDEX current_block->active_extruder
317
   #endif
342
   #endif
318
 
343
 
319
-#endif //CONDITIONALS_LCD_H
344
+  #if ENABLED(SWITCHING_EXTRUDER) || ENABLED(MIXING_EXTRUDER)   // Unified E axis
345
+    #if ENABLED(MIXING_EXTRUDER)
346
+      #define E_STEPPERS  MIXING_STEPPERS
347
+    #else
348
+      #define E_STEPPERS  1                                     // One E stepper
349
+    #endif
350
+    #define E_MANUAL      1
351
+    #define TOOL_E_INDEX  0
352
+  #else
353
+    #define E_STEPPERS    EXTRUDERS
354
+    #define E_MANUAL      EXTRUDERS
355
+    #define TOOL_E_INDEX  current_block->active_extruder
356
+  #endif
357
+
358
+  /**
359
+   * DISTINCT_E_FACTORS affects how some E factors are accessed
360
+   */
361
+  #if ENABLED(DISTINCT_E_FACTORS) && E_STEPPERS > 1
362
+    #define XYZE_N (XYZ + E_STEPPERS)
363
+    #define E_AXIS_N (E_AXIS + extruder)
364
+  #else
365
+    #undef DISTINCT_E_FACTORS
366
+    #define XYZE_N XYZE
367
+    #define E_AXIS_N E_AXIS
368
+  #endif
369
+
370
+  /**
371
+   * The BLTouch Probe emulates a servo probe
372
+   * and uses "special" angles for its state.
373
+   */
374
+  #if ENABLED(BLTOUCH)
375
+    #ifndef Z_ENDSTOP_SERVO_NR
376
+      #define Z_ENDSTOP_SERVO_NR 0
377
+    #endif
378
+    #ifndef NUM_SERVOS
379
+      #define NUM_SERVOS (Z_ENDSTOP_SERVO_NR + 1)
380
+    #endif
381
+    #undef DEACTIVATE_SERVOS_AFTER_MOVE
382
+    #undef SERVO_DELAY
383
+    #define SERVO_DELAY 50
384
+    #ifndef BLTOUCH_DELAY
385
+      #define BLTOUCH_DELAY 375
386
+    #endif
387
+    #undef Z_SERVO_ANGLES
388
+    #define Z_SERVO_ANGLES { BLTOUCH_DEPLOY, BLTOUCH_STOW }
389
+
390
+    #define BLTOUCH_DEPLOY    10
391
+    #define BLTOUCH_STOW      90
392
+    #define BLTOUCH_SELFTEST 120
393
+    #define BLTOUCH_RESET    160
394
+    #define _TEST_BLTOUCH(P) (READ(P##_PIN) != P##_ENDSTOP_INVERTING)
395
+
396
+    // Always disable probe pin inverting for BLTouch
397
+    #undef Z_MIN_PROBE_ENDSTOP_INVERTING
398
+    #define Z_MIN_PROBE_ENDSTOP_INVERTING false
399
+
400
+    #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
401
+      #undef Z_MIN_ENDSTOP_INVERTING
402
+      #define Z_MIN_ENDSTOP_INVERTING false
403
+      #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN)
404
+    #else
405
+      #define TEST_BLTOUCH() _TEST_BLTOUCH(Z_MIN_PROBE)
406
+    #endif
407
+  #endif
408
+
409
+  /**
410
+   * Set a flag for a servo probe
411
+   */
412
+  #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
413
+
414
+  /**
415
+   * UBL has its own manual probing, so this just causes trouble.
416
+   */
417
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
418
+    #undef PROBE_MANUALLY
419
+  #endif
420
+
421
+  /**
422
+   * Set a flag for any enabled probe
423
+   */
424
+  #define PROBE_SELECTED (ENABLED(PROBE_MANUALLY) || ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED) || ENABLED(SOLENOID_PROBE))
425
+
426
+  /**
427
+   * Clear probe pin settings when no probe is selected
428
+   */
429
+  #if !PROBE_SELECTED || ENABLED(PROBE_MANUALLY)
430
+    #undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
431
+    #undef Z_MIN_PROBE_ENDSTOP
432
+  #endif
433
+
434
+  #define HAS_SOFTWARE_ENDSTOPS (ENABLED(MIN_SOFTWARE_ENDSTOPS) || ENABLED(MAX_SOFTWARE_ENDSTOPS))
435
+  #define HAS_RESUME_CONTINUE (ENABLED(NEWPANEL) || ENABLED(EMERGENCY_PARSER))
436
+  #define HAS_COLOR_LEDS (ENABLED(BLINKM) || ENABLED(RGB_LED) || ENABLED(RGBW_LED) || ENABLED(PCA9632))
437
+
438
+#endif // CONDITIONALS_LCD_H

+ 397
- 204
Marlin/Conditionals_post.h Wyświetl plik

28
 #ifndef CONDITIONALS_POST_H
28
 #ifndef CONDITIONALS_POST_H
29
 #define CONDITIONALS_POST_H
29
 #define CONDITIONALS_POST_H
30
 
30
 
31
-  #if ENABLED(EMERGENCY_PARSER)
32
-    #define EMERGENCY_PARSER_CAPABILITIES " EMERGENCY_CODES:M108,M112,M410"
33
-  #else
34
-    #define EMERGENCY_PARSER_CAPABILITIES ""
35
-  #endif
36
-
37
-  /**
38
-   * Set ENDSTOPPULLUPS for unused endstop switches
39
-   */
40
-  #if ENABLED(ENDSTOPPULLUPS)
41
-    #if ENABLED(USE_XMAX_PLUG)
42
-      #define ENDSTOPPULLUP_XMAX
43
-    #endif
44
-    #if ENABLED(USE_YMAX_PLUG)
45
-      #define ENDSTOPPULLUP_YMAX
46
-    #endif
47
-    #if ENABLED(USE_ZMAX_PLUG)
48
-      #define ENDSTOPPULLUP_ZMAX
49
-    #endif
50
-    #if ENABLED(USE_XMIN_PLUG)
51
-      #define ENDSTOPPULLUP_XMIN
52
-    #endif
53
-    #if ENABLED(USE_YMIN_PLUG)
54
-      #define ENDSTOPPULLUP_YMIN
55
-    #endif
56
-    #if ENABLED(USE_ZMIN_PLUG)
57
-      #define ENDSTOPPULLUP_ZMIN
58
-    #endif
59
-    #if DISABLED(DISABLE_Z_MIN_PROBE_ENDSTOP)
60
-      #define ENDSTOPPULLUP_ZMIN_PROBE
61
-    #endif
62
-  #endif
63
-
64
   /**
31
   /**
65
-   * Axis lengths
32
+   * Axis lengths and center
66
    */
33
    */
67
   #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
34
   #define X_MAX_LENGTH (X_MAX_POS - (X_MIN_POS))
68
   #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
35
   #define Y_MAX_LENGTH (Y_MAX_POS - (Y_MIN_POS))
69
   #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
36
   #define Z_MAX_LENGTH (Z_MAX_POS - (Z_MIN_POS))
37
+  #define X_CENTER float((X_MIN_POS + X_MAX_POS) * 0.5)
38
+  #define Y_CENTER float((Y_MIN_POS + Y_MAX_POS) * 0.5)
39
+  #define Z_CENTER float((Z_MIN_POS + Z_MAX_POS) * 0.5)
70
 
40
 
71
   /**
41
   /**
72
-   * CoreXY and CoreXZ
42
+   * CoreXY, CoreXZ, and CoreYZ - and their reverse
73
    */
43
    */
74
-  #if ENABLED(COREXY)
75
-    #define CORE_AXIS_1 A_AXIS // XY from A + B
76
-    #define CORE_AXIS_2 B_AXIS
77
-    #define NORMAL_AXIS Z_AXIS
78
-  #elif ENABLED(COREXZ)
79
-    #define CORE_AXIS_1 A_AXIS // XZ from A + C
80
-    #define CORE_AXIS_2 C_AXIS
81
-    #define NORMAL_AXIS Y_AXIS
82
-  #elif ENABLED(COREYZ)
83
-    #define CORE_AXIS_1 B_AXIS // YZ from B + C
84
-    #define CORE_AXIS_2 C_AXIS
85
-    #define NORMAL_AXIS X_AXIS
44
+  #define CORE_IS_XY (ENABLED(COREXY) || ENABLED(COREYX))
45
+  #define CORE_IS_XZ (ENABLED(COREXZ) || ENABLED(COREZX))
46
+  #define CORE_IS_YZ (ENABLED(COREYZ) || ENABLED(COREZY))
47
+  #define IS_CORE (CORE_IS_XY || CORE_IS_XZ || CORE_IS_YZ)
48
+  #if IS_CORE
49
+    #if CORE_IS_XY
50
+      #define CORE_AXIS_1 A_AXIS
51
+      #define CORE_AXIS_2 B_AXIS
52
+      #define NORMAL_AXIS Z_AXIS
53
+    #elif CORE_IS_XZ
54
+      #define CORE_AXIS_1 A_AXIS
55
+      #define NORMAL_AXIS Y_AXIS
56
+      #define CORE_AXIS_2 C_AXIS
57
+    #elif CORE_IS_YZ
58
+      #define NORMAL_AXIS X_AXIS
59
+      #define CORE_AXIS_1 B_AXIS
60
+      #define CORE_AXIS_2 C_AXIS
61
+    #endif
62
+    #if (ENABLED(COREYX) || ENABLED(COREZX) || ENABLED(COREZY))
63
+      #define CORESIGN(n) (-(n))
64
+    #else
65
+      #define CORESIGN(n) (n)
66
+    #endif
86
   #endif
67
   #endif
87
 
68
 
69
+  #define IS_SCARA (ENABLED(MORGAN_SCARA) || ENABLED(MAKERARM_SCARA))
70
+  #define IS_KINEMATIC (ENABLED(DELTA) || IS_SCARA)
71
+  #define IS_CARTESIAN !IS_KINEMATIC
72
+
88
   /**
73
   /**
89
-   * SCARA
74
+   * SCARA cannot use SLOWDOWN and requires QUICKHOME
90
    */
75
    */
91
-  #if ENABLED(SCARA)
76
+  #if IS_SCARA
92
     #undef SLOWDOWN
77
     #undef SLOWDOWN
93
-    #define QUICK_HOME //SCARA needs Quickhome
78
+    #define QUICK_HOME
94
   #endif
79
   #endif
95
 
80
 
96
   /**
81
   /**
106
     #endif
91
     #endif
107
   #else
92
   #else
108
     #if ENABLED(DELTA)
93
     #if ENABLED(DELTA)
109
-      #define X_HOME_POS ((X_MAX_LENGTH) * 0.5)
94
+      #define X_HOME_POS (X_MIN_POS + (X_MAX_LENGTH) * 0.5)
110
     #else
95
     #else
111
       #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
96
       #define X_HOME_POS (X_HOME_DIR < 0 ? X_MIN_POS : X_MAX_POS)
112
     #endif
97
     #endif
122
     #endif
107
     #endif
123
   #else
108
   #else
124
     #if ENABLED(DELTA)
109
     #if ENABLED(DELTA)
125
-      #define Y_HOME_POS ((Y_MAX_LENGTH) * 0.5)
110
+      #define Y_HOME_POS (Y_MIN_POS + (Y_MAX_LENGTH) * 0.5)
126
     #else
111
     #else
127
       #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
112
       #define Y_HOME_POS (Y_HOME_DIR < 0 ? Y_MIN_POS : Y_MAX_POS)
128
     #endif
113
     #endif
135
   #endif
120
   #endif
136
 
121
 
137
   /**
122
   /**
138
-   * The BLTouch Probe emulates a servo probe
123
+   * If DELTA_HEIGHT isn't defined use the old setting
139
    */
124
    */
140
-  #if ENABLED(BLTOUCH)
141
-    #undef Z_ENDSTOP_SERVO_NR
142
-    #undef Z_SERVO_ANGLES
143
-    #define Z_ENDSTOP_SERVO_NR 0
144
-    #define Z_SERVO_ANGLES {10,90} // For BLTouch 10=deploy, 90=retract
145
-    #undef DEACTIVATE_SERVOS_AFTER_MOVE
146
-    #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
147
-      #undef Z_MIN_ENDSTOP_INVERTING
148
-      #define Z_MIN_ENDSTOP_INVERTING false
149
-    #endif
125
+  #if ENABLED(DELTA) && !defined(DELTA_HEIGHT)
126
+    #define DELTA_HEIGHT Z_HOME_POS
150
   #endif
127
   #endif
151
 
128
 
152
   /**
129
   /**
153
    * Auto Bed Leveling and Z Probe Repeatability Test
130
    * Auto Bed Leveling and Z Probe Repeatability Test
154
    */
131
    */
155
-  #define HAS_PROBING_PROCEDURE (ENABLED(AUTO_BED_LEVELING_FEATURE) || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
156
-
157
-  // Boundaries for probing based on set limits
158
-  #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
159
-  #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
160
-  #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
161
-  #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
162
-
163
-  #define HAS_Z_SERVO_ENDSTOP (defined(Z_ENDSTOP_SERVO_NR) && Z_ENDSTOP_SERVO_NR >= 0)
132
+  #define HOMING_Z_WITH_PROBE (HAS_BED_PROBE && Z_HOME_DIR < 0 && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN))
164
 
133
 
165
   /**
134
   /**
166
    * Z Sled Probe requires Z_SAFE_HOMING
135
    * Z Sled Probe requires Z_SAFE_HOMING
170
   #endif
139
   #endif
171
 
140
 
172
   /**
141
   /**
173
-   * DELTA should ignore Z_SAFE_HOMING
142
+   * DELTA should ignore Z_SAFE_HOMING and SLOWDOWN
174
    */
143
    */
175
   #if ENABLED(DELTA)
144
   #if ENABLED(DELTA)
176
     #undef Z_SAFE_HOMING
145
     #undef Z_SAFE_HOMING
146
+    #undef SLOWDOWN
177
   #endif
147
   #endif
178
 
148
 
179
   /**
149
   /**
186
     #ifndef Z_SAFE_HOMING_Y_POINT
156
     #ifndef Z_SAFE_HOMING_Y_POINT
187
       #define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2)
157
       #define Z_SAFE_HOMING_Y_POINT ((Y_MIN_POS + Y_MAX_POS) / 2)
188
     #endif
158
     #endif
159
+    #define X_TILT_FULCRUM Z_SAFE_HOMING_X_POINT
160
+    #define Y_TILT_FULCRUM Z_SAFE_HOMING_Y_POINT
161
+  #else
162
+    #define X_TILT_FULCRUM X_HOME_POS
163
+    #define Y_TILT_FULCRUM Y_HOME_POS
189
   #endif
164
   #endif
190
 
165
 
191
   /**
166
   /**
216
    */
191
    */
217
   #if ENABLED(ADVANCE)
192
   #if ENABLED(ADVANCE)
218
     #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
193
     #define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
219
-    #define STEPS_PER_CUBIC_MM_E (axis_steps_per_mm[E_AXIS] / (EXTRUSION_AREA))
194
+    #define STEPS_PER_CUBIC_MM_E (axis_steps_per_mm[E_AXIS_N] / (EXTRUSION_AREA))
220
   #endif
195
   #endif
221
 
196
 
222
   #if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER)
197
   #if ENABLED(ULTIPANEL) && DISABLED(ELB_FULL_GRAPHIC_CONTROLLER)
259
   #if TEMP_SENSOR_0 == -3
234
   #if TEMP_SENSOR_0 == -3
260
     #define HEATER_0_USES_MAX6675
235
     #define HEATER_0_USES_MAX6675
261
     #define MAX6675_IS_MAX31855
236
     #define MAX6675_IS_MAX31855
237
+    #define MAX6675_TMIN -270
238
+    #define MAX6675_TMAX 1800
262
   #elif TEMP_SENSOR_0 == -2
239
   #elif TEMP_SENSOR_0 == -2
263
     #define HEATER_0_USES_MAX6675
240
     #define HEATER_0_USES_MAX6675
241
+    #define MAX6675_TMIN 0
242
+    #define MAX6675_TMAX 1024
264
   #elif TEMP_SENSOR_0 == -1
243
   #elif TEMP_SENSOR_0 == -1
265
     #define HEATER_0_USES_AD595
244
     #define HEATER_0_USES_AD595
266
   #elif TEMP_SENSOR_0 == 0
245
   #elif TEMP_SENSOR_0 == 0
307
     #define HEATER_3_USES_THERMISTOR
286
     #define HEATER_3_USES_THERMISTOR
308
   #endif
287
   #endif
309
 
288
 
289
+  #if TEMP_SENSOR_4 <= -2
290
+    #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_4"
291
+  #elif TEMP_SENSOR_4 == -1
292
+    #define HEATER_4_USES_AD595
293
+  #elif TEMP_SENSOR_4 == 0
294
+    #undef HEATER_4_MINTEMP
295
+    #undef HEATER_4_MAXTEMP
296
+  #elif TEMP_SENSOR_4 > 0
297
+    #define THERMISTORHEATER_4 TEMP_SENSOR_4
298
+    #define HEATER_4_USES_THERMISTOR
299
+  #endif
300
+
310
   #if TEMP_SENSOR_BED <= -2
301
   #if TEMP_SENSOR_BED <= -2
311
     #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED"
302
     #error "MAX6675 / MAX31855 Thermocouples not supported for TEMP_SENSOR_BED"
312
   #elif TEMP_SENSOR_BED == -1
303
   #elif TEMP_SENSOR_BED == -1
335
     #ifndef HOTEND_OFFSET_Y
326
     #ifndef HOTEND_OFFSET_Y
336
       #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
327
       #define HOTEND_OFFSET_Y { 0 } // Y offsets for each extruder
337
     #endif
328
     #endif
338
-    #if !defined(HOTEND_OFFSET_Z) && (ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_EXTRUDER))
329
+    #if !defined(HOTEND_OFFSET_Z) && (ENABLED(DUAL_X_CARRIAGE) || ENABLED(SWITCHING_NOZZLE))
339
       #define HOTEND_OFFSET_Z { 0 }
330
       #define HOTEND_OFFSET_Z { 0 }
340
     #endif
331
     #endif
341
   #endif
332
   #endif
343
   /**
334
   /**
344
    * ARRAY_BY_EXTRUDERS based on EXTRUDERS
335
    * ARRAY_BY_EXTRUDERS based on EXTRUDERS
345
    */
336
    */
346
-  #define ARRAY_BY_EXTRUDERS(args...) ARRAY_N(EXTRUDERS, args)
337
+  #define ARRAY_BY_EXTRUDERS(...) ARRAY_N(EXTRUDERS, __VA_ARGS__)
347
   #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
338
   #define ARRAY_BY_EXTRUDERS1(v1) ARRAY_BY_EXTRUDERS(v1, v1, v1, v1, v1, v1)
348
 
339
 
349
   /**
340
   /**
350
    * ARRAY_BY_HOTENDS based on HOTENDS
341
    * ARRAY_BY_HOTENDS based on HOTENDS
351
    */
342
    */
352
-  #define ARRAY_BY_HOTENDS(args...) ARRAY_N(HOTENDS, args)
343
+  #define ARRAY_BY_HOTENDS(...) ARRAY_N(HOTENDS, __VA_ARGS__)
353
   #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
344
   #define ARRAY_BY_HOTENDS1(v1) ARRAY_BY_HOTENDS(v1, v1, v1, v1, v1, v1)
354
 
345
 
355
   /**
346
   /**
362
     #define _XMAX_ 101
353
     #define _XMAX_ 101
363
     #define _YMAX_ 201
354
     #define _YMAX_ 201
364
     #define _ZMAX_ 301
355
     #define _ZMAX_ 301
365
-    #if Z2_USE_ENDSTOP == _XMAX_
366
-      #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
367
-      #define Z2_MAX_PIN X_MAX_PIN
368
-      #undef USE_XMAX_PLUG
369
-    #elif Z2_USE_ENDSTOP == _YMAX_
370
-      #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
371
-      #define Z2_MAX_PIN Y_MAX_PIN
372
-      #undef USE_YMAX_PLUG
373
-    #elif Z2_USE_ENDSTOP == _ZMAX_
374
-      #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
375
-      #define Z2_MAX_PIN Z_MAX_PIN
376
-      #undef USE_ZMAX_PLUG
377
-    #elif Z2_USE_ENDSTOP == _XMIN_
378
-      #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
379
-      #define Z2_MAX_PIN X_MIN_PIN
380
-      #undef USE_XMIN_PLUG
356
+    #if Z2_USE_ENDSTOP == _XMIN_
357
+      #define USE_XMIN_PLUG
358
+    #elif Z2_USE_ENDSTOP == _XMAX_
359
+      #define USE_XMAX_PLUG
381
     #elif Z2_USE_ENDSTOP == _YMIN_
360
     #elif Z2_USE_ENDSTOP == _YMIN_
382
-      #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
383
-      #define Z2_MAX_PIN Y_MIN_PIN
384
-      #undef USE_YMIN_PLUG
361
+      #define USE_YMIN_PLUG
362
+    #elif Z2_USE_ENDSTOP == _YMAX_
363
+      #define USE_YMAX_PLUG
385
     #elif Z2_USE_ENDSTOP == _ZMIN_
364
     #elif Z2_USE_ENDSTOP == _ZMIN_
386
-      #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
387
-      #define Z2_MAX_PIN Z_MIN_PIN
388
-      #undef USE_ZMIN_PLUG
365
+      #define USE_ZMIN_PLUG
366
+    #elif Z2_USE_ENDSTOP == _ZMAX_
367
+      #define USE_ZMAX_PLUG
368
+    #endif
369
+    #if Z_HOME_DIR > 0
370
+      #if Z2_USE_ENDSTOP == _XMIN_
371
+        #define Z2_MAX_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
372
+        #define Z2_MAX_PIN X_MIN_PIN
373
+      #elif Z2_USE_ENDSTOP == _XMAX_
374
+        #define Z2_MAX_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
375
+        #define Z2_MAX_PIN X_MAX_PIN
376
+      #elif Z2_USE_ENDSTOP == _YMIN_
377
+        #define Z2_MAX_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
378
+        #define Z2_MAX_PIN Y_MIN_PIN
379
+      #elif Z2_USE_ENDSTOP == _YMAX_
380
+        #define Z2_MAX_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
381
+        #define Z2_MAX_PIN Y_MAX_PIN
382
+      #elif Z2_USE_ENDSTOP == _ZMIN_
383
+        #define Z2_MAX_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
384
+        #define Z2_MAX_PIN Z_MIN_PIN
385
+      #elif Z2_USE_ENDSTOP == _ZMAX_
386
+        #define Z2_MAX_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
387
+        #define Z2_MAX_PIN Z_MAX_PIN
388
+      #else
389
+        #define Z2_MAX_ENDSTOP_INVERTING false
390
+      #endif
389
     #else
391
     #else
390
-      #define Z2_MAX_ENDSTOP_INVERTING false
392
+      #if Z2_USE_ENDSTOP == _XMIN_
393
+        #define Z2_MIN_ENDSTOP_INVERTING X_MIN_ENDSTOP_INVERTING
394
+        #define Z2_MIN_PIN X_MIN_PIN
395
+      #elif Z2_USE_ENDSTOP == _XMAX_
396
+        #define Z2_MIN_ENDSTOP_INVERTING X_MAX_ENDSTOP_INVERTING
397
+        #define Z2_MIN_PIN X_MAX_PIN
398
+      #elif Z2_USE_ENDSTOP == _YMIN_
399
+        #define Z2_MIN_ENDSTOP_INVERTING Y_MIN_ENDSTOP_INVERTING
400
+        #define Z2_MIN_PIN Y_MIN_PIN
401
+      #elif Z2_USE_ENDSTOP == _YMAX_
402
+        #define Z2_MIN_ENDSTOP_INVERTING Y_MAX_ENDSTOP_INVERTING
403
+        #define Z2_MIN_PIN Y_MAX_PIN
404
+      #elif Z2_USE_ENDSTOP == _ZMIN_
405
+        #define Z2_MIN_ENDSTOP_INVERTING Z_MIN_ENDSTOP_INVERTING
406
+        #define Z2_MIN_PIN Z_MIN_PIN
407
+      #elif Z2_USE_ENDSTOP == _ZMAX_
408
+        #define Z2_MIN_ENDSTOP_INVERTING Z_MAX_ENDSTOP_INVERTING
409
+        #define Z2_MIN_PIN Z_MAX_PIN
410
+      #else
411
+        #define Z2_MIN_ENDSTOP_INVERTING false
412
+      #endif
413
+    #endif
414
+  #endif
415
+
416
+  // Is an endstop plug used for the Z2 endstop or the bed probe?
417
+  #define IS_Z2_OR_PROBE(A,M) ( \
418
+       (ENABLED(Z_DUAL_ENDSTOPS) && Z2_USE_ENDSTOP == _##A##M##_) \
419
+    || (ENABLED(Z_MIN_PROBE_ENDSTOP) && Z_MIN_PROBE_PIN == A##_##M##_PIN ) )
420
+
421
+  /**
422
+   * Set ENDSTOPPULLUPS for active endstop switches
423
+   */
424
+  #if ENABLED(ENDSTOPPULLUPS)
425
+    #if ENABLED(USE_XMAX_PLUG)
426
+      #define ENDSTOPPULLUP_XMAX
427
+    #endif
428
+    #if ENABLED(USE_YMAX_PLUG)
429
+      #define ENDSTOPPULLUP_YMAX
430
+    #endif
431
+    #if ENABLED(USE_ZMAX_PLUG)
432
+      #define ENDSTOPPULLUP_ZMAX
433
+    #endif
434
+    #if ENABLED(USE_XMIN_PLUG)
435
+      #define ENDSTOPPULLUP_XMIN
436
+    #endif
437
+    #if ENABLED(USE_YMIN_PLUG)
438
+      #define ENDSTOPPULLUP_YMIN
439
+    #endif
440
+    #if ENABLED(USE_ZMIN_PLUG)
441
+      #define ENDSTOPPULLUP_ZMIN
391
     #endif
442
     #endif
392
   #endif
443
   #endif
393
 
444
 
394
   /**
445
   /**
395
    * Shorthand for pin tests, used wherever needed
446
    * Shorthand for pin tests, used wherever needed
396
    */
447
    */
448
+
449
+  // Steppers
450
+  #define HAS_X_ENABLE      (PIN_EXISTS(X_ENABLE))
451
+  #define HAS_X_DIR         (PIN_EXISTS(X_DIR))
452
+  #define HAS_X_STEP        (PIN_EXISTS(X_STEP))
453
+  #define HAS_X_MICROSTEPS  (PIN_EXISTS(X_MS1))
454
+
455
+  #define HAS_X2_ENABLE     (PIN_EXISTS(X2_ENABLE))
456
+  #define HAS_X2_DIR        (PIN_EXISTS(X2_DIR))
457
+  #define HAS_X2_STEP       (PIN_EXISTS(X2_STEP))
458
+  #define HAS_Y_MICROSTEPS  (PIN_EXISTS(Y_MS1))
459
+
460
+  #define HAS_Y_ENABLE      (PIN_EXISTS(Y_ENABLE))
461
+  #define HAS_Y_DIR         (PIN_EXISTS(Y_DIR))
462
+  #define HAS_Y_STEP        (PIN_EXISTS(Y_STEP))
463
+  #define HAS_Z_MICROSTEPS  (PIN_EXISTS(Z_MS1))
464
+
465
+  #define HAS_Y2_ENABLE     (PIN_EXISTS(Y2_ENABLE))
466
+  #define HAS_Y2_DIR        (PIN_EXISTS(Y2_DIR))
467
+  #define HAS_Y2_STEP       (PIN_EXISTS(Y2_STEP))
468
+
469
+  #define HAS_Z_ENABLE      (PIN_EXISTS(Z_ENABLE))
470
+  #define HAS_Z_DIR         (PIN_EXISTS(Z_DIR))
471
+  #define HAS_Z_STEP        (PIN_EXISTS(Z_STEP))
472
+
473
+  #define HAS_Z2_ENABLE     (PIN_EXISTS(Z2_ENABLE))
474
+  #define HAS_Z2_DIR        (PIN_EXISTS(Z2_DIR))
475
+  #define HAS_Z2_STEP       (PIN_EXISTS(Z2_STEP))
476
+
477
+  // Extruder steppers and solenoids
478
+  #define HAS_E0_ENABLE     (PIN_EXISTS(E0_ENABLE))
479
+  #define HAS_E0_DIR        (PIN_EXISTS(E0_DIR))
480
+  #define HAS_E0_STEP       (PIN_EXISTS(E0_STEP))
481
+  #define HAS_E0_MICROSTEPS (PIN_EXISTS(E0_MS1))
482
+  #define HAS_SOLENOID_0    (PIN_EXISTS(SOL0))
483
+
484
+  #define HAS_E1_ENABLE     (PIN_EXISTS(E1_ENABLE))
485
+  #define HAS_E1_DIR        (PIN_EXISTS(E1_DIR))
486
+  #define HAS_E1_STEP       (PIN_EXISTS(E1_STEP))
487
+  #define HAS_E1_MICROSTEPS (PIN_EXISTS(E1_MS1))
488
+  #define HAS_SOLENOID_1    (PIN_EXISTS(SOL1))
489
+
490
+  #define HAS_E2_ENABLE     (PIN_EXISTS(E2_ENABLE))
491
+  #define HAS_E2_DIR        (PIN_EXISTS(E2_DIR))
492
+  #define HAS_E2_STEP       (PIN_EXISTS(E2_STEP))
493
+  #define HAS_E2_MICROSTEPS (PIN_EXISTS(E2_MS1))
494
+  #define HAS_SOLENOID_2    (PIN_EXISTS(SOL2))
495
+
496
+  #define HAS_E3_ENABLE     (PIN_EXISTS(E3_ENABLE))
497
+  #define HAS_E3_DIR        (PIN_EXISTS(E3_DIR))
498
+  #define HAS_E3_STEP       (PIN_EXISTS(E3_STEP))
499
+  #define HAS_E3_MICROSTEPS (PIN_EXISTS(E3_MS1))
500
+  #define HAS_SOLENOID_3    (PIN_EXISTS(SOL3))
501
+
502
+  #define HAS_E4_ENABLE     (PIN_EXISTS(E4_ENABLE))
503
+  #define HAS_E4_DIR        (PIN_EXISTS(E4_DIR))
504
+  #define HAS_E4_STEP       (PIN_EXISTS(E4_STEP))
505
+  #define HAS_E4_MICROSTEPS (PIN_EXISTS(E4_MS1))
506
+  #define HAS_SOLENOID_4    (PIN_EXISTS(SOL4))
507
+
508
+  // Endstops and bed probe
509
+  #define HAS_X_MIN (PIN_EXISTS(X_MIN) && !IS_Z2_OR_PROBE(X,MIN))
510
+  #define HAS_X_MAX (PIN_EXISTS(X_MAX) && !IS_Z2_OR_PROBE(X,MAX))
511
+  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN) && !IS_Z2_OR_PROBE(Y,MIN))
512
+  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX) && !IS_Z2_OR_PROBE(Y,MAX))
513
+  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN) && !IS_Z2_OR_PROBE(Z,MIN))
514
+  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX) && !IS_Z2_OR_PROBE(Z,MAX))
515
+  #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
516
+  #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
517
+  #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
518
+
519
+  // Thermistors
397
   #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
520
   #define HAS_TEMP_0 (PIN_EXISTS(TEMP_0) && TEMP_SENSOR_0 != 0 && TEMP_SENSOR_0 > -2)
398
   #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
521
   #define HAS_TEMP_1 (PIN_EXISTS(TEMP_1) && TEMP_SENSOR_1 != 0 && TEMP_SENSOR_1 > -2)
399
   #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
522
   #define HAS_TEMP_2 (PIN_EXISTS(TEMP_2) && TEMP_SENSOR_2 != 0 && TEMP_SENSOR_2 > -2)
400
   #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
523
   #define HAS_TEMP_3 (PIN_EXISTS(TEMP_3) && TEMP_SENSOR_3 != 0 && TEMP_SENSOR_3 > -2)
524
+  #define HAS_TEMP_4 (PIN_EXISTS(TEMP_4) && TEMP_SENSOR_4 != 0 && TEMP_SENSOR_4 > -2)
525
+  #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
401
   #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
526
   #define HAS_TEMP_BED (PIN_EXISTS(TEMP_BED) && TEMP_SENSOR_BED != 0 && TEMP_SENSOR_BED > -2)
527
+
528
+  // Heaters
402
   #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
529
   #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0))
403
   #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
530
   #define HAS_HEATER_1 (PIN_EXISTS(HEATER_1))
404
   #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
531
   #define HAS_HEATER_2 (PIN_EXISTS(HEATER_2))
405
   #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
532
   #define HAS_HEATER_3 (PIN_EXISTS(HEATER_3))
533
+  #define HAS_HEATER_4 (PIN_EXISTS(HEATER_4))
406
   #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
534
   #define HAS_HEATER_BED (PIN_EXISTS(HEATER_BED))
407
-  #define HAS_AUTO_FAN_0 (PIN_EXISTS(EXTRUDER_0_AUTO_FAN))
408
-  #define HAS_AUTO_FAN_1 (PIN_EXISTS(EXTRUDER_1_AUTO_FAN))
409
-  #define HAS_AUTO_FAN_2 (PIN_EXISTS(EXTRUDER_2_AUTO_FAN))
410
-  #define HAS_AUTO_FAN_3 (PIN_EXISTS(EXTRUDER_3_AUTO_FAN))
535
+
536
+  // Thermal protection
537
+  #define HAS_THERMALLY_PROTECTED_BED (ENABLED(THERMAL_PROTECTION_BED) && HAS_TEMP_BED && HAS_HEATER_BED)
538
+  #define WATCH_HOTENDS (ENABLED(THERMAL_PROTECTION_HOTENDS) && WATCH_TEMP_PERIOD > 0)
539
+  #define WATCH_THE_BED (HAS_THERMALLY_PROTECTED_BED && WATCH_BED_TEMP_PERIOD > 0)
540
+
541
+  // Auto fans
542
+  #define HAS_AUTO_FAN_0 (PIN_EXISTS(E0_AUTO_FAN))
543
+  #define HAS_AUTO_FAN_1 (HOTENDS > 1 && PIN_EXISTS(E1_AUTO_FAN))
544
+  #define HAS_AUTO_FAN_2 (HOTENDS > 2 && PIN_EXISTS(E2_AUTO_FAN))
545
+  #define HAS_AUTO_FAN_3 (HOTENDS > 3 && PIN_EXISTS(E3_AUTO_FAN))
546
+  #define HAS_AUTO_FAN_4 (HOTENDS > 4 && PIN_EXISTS(E4_AUTO_FAN))
411
   #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
547
   #define HAS_AUTO_FAN (HAS_AUTO_FAN_0 || HAS_AUTO_FAN_1 || HAS_AUTO_FAN_2 || HAS_AUTO_FAN_3)
548
+  #define AUTO_1_IS_0 (E1_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
549
+  #define AUTO_2_IS_0 (E2_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
550
+  #define AUTO_2_IS_1 (E2_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
551
+  #define AUTO_3_IS_0 (E3_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
552
+  #define AUTO_3_IS_1 (E3_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
553
+  #define AUTO_3_IS_2 (E3_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
554
+  #define AUTO_4_IS_0 (E4_AUTO_FAN_PIN == E0_AUTO_FAN_PIN)
555
+  #define AUTO_4_IS_1 (E4_AUTO_FAN_PIN == E1_AUTO_FAN_PIN)
556
+  #define AUTO_4_IS_2 (E4_AUTO_FAN_PIN == E2_AUTO_FAN_PIN)
557
+  #define AUTO_4_IS_3 (E4_AUTO_FAN_PIN == E3_AUTO_FAN_PIN)
558
+
559
+  // Other fans
412
   #define HAS_FAN0 (PIN_EXISTS(FAN))
560
   #define HAS_FAN0 (PIN_EXISTS(FAN))
413
-  #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLERFAN_PIN != FAN1_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN1_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN1_PIN)
414
-  #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLERFAN_PIN != FAN2_PIN && EXTRUDER_0_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_1_AUTO_FAN_PIN != FAN2_PIN && EXTRUDER_2_AUTO_FAN_PIN != FAN2_PIN)
415
-  #define HAS_CONTROLLERFAN (PIN_EXISTS(CONTROLLERFAN))
561
+  #define HAS_FAN1 (PIN_EXISTS(FAN1) && CONTROLLER_FAN_PIN != FAN1_PIN && E0_AUTO_FAN_PIN != FAN1_PIN && E1_AUTO_FAN_PIN != FAN1_PIN && E2_AUTO_FAN_PIN != FAN1_PIN && E3_AUTO_FAN_PIN != FAN1_PIN)
562
+  #define HAS_FAN2 (PIN_EXISTS(FAN2) && CONTROLLER_FAN_PIN != FAN2_PIN && E0_AUTO_FAN_PIN != FAN2_PIN && E1_AUTO_FAN_PIN != FAN2_PIN && E2_AUTO_FAN_PIN != FAN2_PIN && E3_AUTO_FAN_PIN != FAN2_PIN)
563
+  #define HAS_CONTROLLER_FAN (PIN_EXISTS(CONTROLLER_FAN))
564
+
565
+  // Servos
416
   #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0)
566
   #define HAS_SERVOS (defined(NUM_SERVOS) && NUM_SERVOS > 0)
417
   #define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
567
   #define HAS_SERVO_0 (PIN_EXISTS(SERVO0))
418
   #define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
568
   #define HAS_SERVO_1 (PIN_EXISTS(SERVO1))
419
   #define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
569
   #define HAS_SERVO_2 (PIN_EXISTS(SERVO2))
420
   #define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
570
   #define HAS_SERVO_3 (PIN_EXISTS(SERVO3))
571
+
572
+  // Sensors
421
   #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
573
   #define HAS_FILAMENT_WIDTH_SENSOR (PIN_EXISTS(FILWIDTH))
422
   #define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT))
574
   #define HAS_FIL_RUNOUT (PIN_EXISTS(FIL_RUNOUT))
575
+
576
+  // User Interface
423
   #define HAS_HOME (PIN_EXISTS(HOME))
577
   #define HAS_HOME (PIN_EXISTS(HOME))
424
   #define HAS_KILL (PIN_EXISTS(KILL))
578
   #define HAS_KILL (PIN_EXISTS(KILL))
425
   #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
579
   #define HAS_SUICIDE (PIN_EXISTS(SUICIDE))
426
   #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
580
   #define HAS_PHOTOGRAPH (PIN_EXISTS(PHOTOGRAPH))
427
-  #define HAS_X_MIN (PIN_EXISTS(X_MIN))
428
-  #define HAS_X_MAX (PIN_EXISTS(X_MAX))
429
-  #define HAS_Y_MIN (PIN_EXISTS(Y_MIN))
430
-  #define HAS_Y_MAX (PIN_EXISTS(Y_MAX))
431
-  #define HAS_Z_MIN (PIN_EXISTS(Z_MIN))
432
-  #define HAS_Z_MAX (PIN_EXISTS(Z_MAX))
433
-  #define HAS_Z2_MIN (PIN_EXISTS(Z2_MIN))
434
-  #define HAS_Z2_MAX (PIN_EXISTS(Z2_MAX))
435
-  #define HAS_Z_MIN_PROBE_PIN (PIN_EXISTS(Z_MIN_PROBE))
436
-  #define HAS_SOLENOID_1 (PIN_EXISTS(SOL1))
437
-  #define HAS_SOLENOID_2 (PIN_EXISTS(SOL2))
438
-  #define HAS_SOLENOID_3 (PIN_EXISTS(SOL3))
439
-  #define HAS_MICROSTEPS (PIN_EXISTS(X_MS1))
440
-  #define HAS_MICROSTEPS_E0 (PIN_EXISTS(E0_MS1))
441
-  #define HAS_MICROSTEPS_E1 (PIN_EXISTS(E1_MS1))
442
-  #define HAS_MICROSTEPS_E2 (PIN_EXISTS(E2_MS1))
443
-  #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
444
-  #define HAS_X_ENABLE (PIN_EXISTS(X_ENABLE))
445
-  #define HAS_X2_ENABLE (PIN_EXISTS(X2_ENABLE))
446
-  #define HAS_Y_ENABLE (PIN_EXISTS(Y_ENABLE))
447
-  #define HAS_Y2_ENABLE (PIN_EXISTS(Y2_ENABLE))
448
-  #define HAS_Z_ENABLE (PIN_EXISTS(Z_ENABLE))
449
-  #define HAS_Z2_ENABLE (PIN_EXISTS(Z2_ENABLE))
450
-  #define HAS_E0_ENABLE (PIN_EXISTS(E0_ENABLE))
451
-  #define HAS_E1_ENABLE (PIN_EXISTS(E1_ENABLE))
452
-  #define HAS_E2_ENABLE (PIN_EXISTS(E2_ENABLE))
453
-  #define HAS_E3_ENABLE (PIN_EXISTS(E3_ENABLE))
454
-  #define HAS_E4_ENABLE (PIN_EXISTS(E4_ENABLE))
455
-  #define HAS_X_DIR (PIN_EXISTS(X_DIR))
456
-  #define HAS_X2_DIR (PIN_EXISTS(X2_DIR))
457
-  #define HAS_Y_DIR (PIN_EXISTS(Y_DIR))
458
-  #define HAS_Y2_DIR (PIN_EXISTS(Y2_DIR))
459
-  #define HAS_Z_DIR (PIN_EXISTS(Z_DIR))
460
-  #define HAS_Z2_DIR (PIN_EXISTS(Z2_DIR))
461
-  #define HAS_E0_DIR (PIN_EXISTS(E0_DIR))
462
-  #define HAS_E1_DIR (PIN_EXISTS(E1_DIR))
463
-  #define HAS_E2_DIR (PIN_EXISTS(E2_DIR))
464
-  #define HAS_E3_DIR (PIN_EXISTS(E3_DIR))
465
-  #define HAS_E4_DIR (PIN_EXISTS(E4_DIR))
466
-  #define HAS_X_STEP (PIN_EXISTS(X_STEP))
467
-  #define HAS_X2_STEP (PIN_EXISTS(X2_STEP))
468
-  #define HAS_Y_STEP (PIN_EXISTS(Y_STEP))
469
-  #define HAS_Y2_STEP (PIN_EXISTS(Y2_STEP))
470
-  #define HAS_Z_STEP (PIN_EXISTS(Z_STEP))
471
-  #define HAS_Z2_STEP (PIN_EXISTS(Z2_STEP))
472
-  #define HAS_E0_STEP (PIN_EXISTS(E0_STEP))
473
-  #define HAS_E1_STEP (PIN_EXISTS(E1_STEP))
474
-  #define HAS_E2_STEP (PIN_EXISTS(E2_STEP))
475
-  #define HAS_E3_STEP (PIN_EXISTS(E3_STEP))
476
-  #define HAS_E4_STEP (PIN_EXISTS(E4_STEP))
477
-  #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
478
   #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
581
   #define HAS_BUZZER (PIN_EXISTS(BEEPER) || ENABLED(LCD_USE_I2C_BUZZER))
582
+  #define HAS_CASE_LIGHT (PIN_EXISTS(CASE_LIGHT) && ENABLED(CASE_LIGHT_ENABLE))
479
 
583
 
584
+  // Digital control
585
+  #define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS)
586
+  #define HAS_STEPPER_RESET (PIN_EXISTS(STEPPER_RESET))
587
+  #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS))
480
   #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
588
   #define HAS_MOTOR_CURRENT_PWM (PIN_EXISTS(MOTOR_CURRENT_PWM_XY) || PIN_EXISTS(MOTOR_CURRENT_PWM_Z) || PIN_EXISTS(MOTOR_CURRENT_PWM_E))
481
 
589
 
482
-  #define HAS_TEMP_HOTEND (HAS_TEMP_0 || ENABLED(HEATER_0_USES_MAX6675))
483
-
484
-  #define HAS_THERMALLY_PROTECTED_BED (HAS_TEMP_BED && HAS_HEATER_BED && ENABLED(THERMAL_PROTECTION_BED))
485
-
486
   /**
590
   /**
487
-   * This value is used by M109 when trying to calculate a ballpark safe margin
488
-   * to prevent wait-forever situation.
591
+   * This setting is also used by M109 when trying to calculate
592
+   * a ballpark safe margin to prevent wait-forever situation.
489
    */
593
    */
490
   #ifndef EXTRUDE_MINTEMP
594
   #ifndef EXTRUDE_MINTEMP
491
-   #define EXTRUDE_MINTEMP 170
595
+    #define EXTRUDE_MINTEMP 170
492
   #endif
596
   #endif
493
 
597
 
494
   /**
598
   /**
501
       #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
605
       #define WRITE_HEATER_2(v) WRITE(HEATER_2_PIN, v)
502
       #if HOTENDS > 3
606
       #if HOTENDS > 3
503
         #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
607
         #define WRITE_HEATER_3(v) WRITE(HEATER_3_PIN, v)
504
-      #endif
505
-    #endif
506
-  #endif
608
+        #if HOTENDS > 4
609
+          #define WRITE_HEATER_4(v) WRITE(HEATER_4_PIN, v)
610
+        #endif // HOTENDS > 4
611
+      #endif // HOTENDS > 3
612
+    #endif // HOTENDS > 2
613
+  #endif // HOTENDS > 1
507
   #if ENABLED(HEATERS_PARALLEL)
614
   #if ENABLED(HEATERS_PARALLEL)
508
     #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
615
     #define WRITE_HEATER_0(v) { WRITE_HEATER_0P(v); WRITE_HEATER_1(v); }
509
   #else
616
   #else
538
   #endif
645
   #endif
539
   #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
646
   #define WRITE_FAN_N(n, v) WRITE_FAN##n(v)
540
 
647
 
648
+
649
+  /**
650
+   * Heater & Fan Pausing
651
+   */
652
+  #if FAN_COUNT == 0
653
+    #undef PROBING_FANS_OFF
654
+  #endif
655
+  #define QUIET_PROBING (HAS_BED_PROBE && (ENABLED(PROBING_HEATERS_OFF) || ENABLED(PROBING_FANS_OFF)))
656
+  #define HEATER_IDLE_HANDLER (ENABLED(ADVANCED_PAUSE_FEATURE) || ENABLED(PROBING_HEATERS_OFF))
657
+
541
   /**
658
   /**
542
    * Servos and probes
659
    * Servos and probes
543
    */
660
    */
548
     #endif
665
     #endif
549
   #endif
666
   #endif
550
 
667
 
551
-  #define PROBE_SELECTED (ENABLED(FIX_MOUNTED_PROBE) || ENABLED(Z_PROBE_ALLEN_KEY) || HAS_Z_SERVO_ENDSTOP || ENABLED(Z_PROBE_SLED))
552
-
553
   #define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))
668
   #define PROBE_PIN_CONFIGURED (HAS_Z_MIN_PROBE_PIN || (HAS_Z_MIN && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)))
554
 
669
 
555
-  #define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED)
670
+  #define HAS_BED_PROBE (PROBE_SELECTED && PROBE_PIN_CONFIGURED && DISABLED(PROBE_MANUALLY))
556
 
671
 
557
   #if ENABLED(Z_PROBE_ALLEN_KEY)
672
   #if ENABLED(Z_PROBE_ALLEN_KEY)
558
     #define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST
673
     #define PROBE_IS_TRIGGERED_WHEN_STOWED_TEST
562
    * Bed Probe dependencies
677
    * Bed Probe dependencies
563
    */
678
    */
564
   #if HAS_BED_PROBE
679
   #if HAS_BED_PROBE
680
+    #if ENABLED(ENDSTOPPULLUPS) && HAS_Z_MIN_PROBE_PIN
681
+      #define ENDSTOPPULLUP_ZMIN_PROBE
682
+    #endif
565
     #ifndef Z_PROBE_OFFSET_RANGE_MIN
683
     #ifndef Z_PROBE_OFFSET_RANGE_MIN
566
       #define Z_PROBE_OFFSET_RANGE_MIN -20
684
       #define Z_PROBE_OFFSET_RANGE_MIN -20
567
     #endif
685
     #endif
575
         #define XY_PROBE_SPEED 4000
693
         #define XY_PROBE_SPEED 4000
576
       #endif
694
       #endif
577
     #endif
695
     #endif
578
-    #if Z_PROBE_TRAVEL_HEIGHT > Z_PROBE_DEPLOY_HEIGHT
579
-      #define _Z_PROBE_DEPLOY_HEIGHT Z_PROBE_TRAVEL_HEIGHT
696
+    #if Z_CLEARANCE_BETWEEN_PROBES > Z_CLEARANCE_DEPLOY_PROBE
697
+      #define _Z_CLEARANCE_DEPLOY_PROBE Z_CLEARANCE_BETWEEN_PROBES
580
     #else
698
     #else
581
-      #define _Z_PROBE_DEPLOY_HEIGHT Z_PROBE_DEPLOY_HEIGHT
699
+      #define _Z_CLEARANCE_DEPLOY_PROBE Z_CLEARANCE_DEPLOY_PROBE
582
     #endif
700
     #endif
583
   #else
701
   #else
584
     #undef X_PROBE_OFFSET_FROM_EXTRUDER
702
     #undef X_PROBE_OFFSET_FROM_EXTRUDER
590
   #endif
708
   #endif
591
 
709
 
592
   /**
710
   /**
593
-   * Delta radius/rod trimmers
711
+   * Delta radius/rod trimmers/angle trimmers
594
    */
712
    */
595
   #if ENABLED(DELTA)
713
   #if ENABLED(DELTA)
596
-    #ifndef DELTA_RADIUS_TRIM_TOWER_1
597
-      #define DELTA_RADIUS_TRIM_TOWER_1 0.0
598
-    #endif
599
-    #ifndef DELTA_RADIUS_TRIM_TOWER_2
600
-      #define DELTA_RADIUS_TRIM_TOWER_2 0.0
714
+    #ifndef DELTA_CALIBRATION_RADIUS
715
+      #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - 10
601
     #endif
716
     #endif
602
-    #ifndef DELTA_RADIUS_TRIM_TOWER_3
603
-      #define DELTA_RADIUS_TRIM_TOWER_3 0.0
717
+    #ifndef DELTA_ENDSTOP_ADJ
718
+      #define DELTA_ENDSTOP_ADJ { 0, 0, 0 }
604
     #endif
719
     #endif
605
-    #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_1
606
-      #define DELTA_DIAGONAL_ROD_TRIM_TOWER_1 0.0
720
+    #ifndef DELTA_TOWER_ANGLE_TRIM
721
+      #define DELTA_TOWER_ANGLE_TRIM {0, 0, 0}
607
     #endif
722
     #endif
608
-    #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_2
609
-      #define DELTA_DIAGONAL_ROD_TRIM_TOWER_2 0.0
723
+    #ifndef DELTA_RADIUS_TRIM_TOWER
724
+      #define DELTA_RADIUS_TRIM_TOWER {0, 0, 0}
610
     #endif
725
     #endif
611
-    #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER_3
612
-      #define DELTA_DIAGONAL_ROD_TRIM_TOWER_3 0.0
613
-    #endif
614
-    #if ENABLED(AUTO_BED_LEVELING_GRID)
615
-      #define DELTA_BED_LEVELING_GRID
726
+    #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER
727
+      #define DELTA_DIAGONAL_ROD_TRIM_TOWER {0, 0, 0}
616
     #endif
728
     #endif
617
   #endif
729
   #endif
618
 
730
 
619
   /**
731
   /**
620
-   * When not using other bed leveling...
732
+   * Set granular options based on the specific type of leveling
621
    */
733
    */
622
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE) && DISABLED(AUTO_BED_LEVELING_GRID) && DISABLED(DELTA_BED_LEVELING_GRID)
623
-    #define AUTO_BED_LEVELING_3POINT
734
+
735
+  #define UBL_DELTA  (ENABLED(AUTO_BED_LEVELING_UBL) && (ENABLED(DELTA) || ENABLED(UBL_GRANULAR_SEGMENTATION_FOR_CARTESIAN)))
736
+  #define ABL_PLANAR (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
737
+  #define ABL_GRID   (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
738
+  #define HAS_ABL    (ABL_PLANAR || ABL_GRID || ENABLED(AUTO_BED_LEVELING_UBL))
739
+  #define HAS_LEVELING          (HAS_ABL || ENABLED(MESH_BED_LEVELING))
740
+  #define PLANNER_LEVELING      (ABL_PLANAR || ABL_GRID || ENABLED(MESH_BED_LEVELING) || UBL_DELTA)
741
+  #define HAS_PROBING_PROCEDURE (HAS_ABL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
742
+  #if HAS_PROBING_PROCEDURE
743
+    #define PROBE_BED_WIDTH abs(RIGHT_PROBE_BED_POSITION - (LEFT_PROBE_BED_POSITION))
744
+    #define PROBE_BED_HEIGHT abs(BACK_PROBE_BED_POSITION - (FRONT_PROBE_BED_POSITION))
624
   #endif
745
   #endif
625
 
746
 
626
   /**
747
   /**
633
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
754
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
634
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
755
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100
635
     #endif
756
     #endif
636
-  #elif PIN_EXISTS(BEEPER)
757
+  #else
637
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
758
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
638
       #define LCD_FEEDBACK_FREQUENCY_HZ 5000
759
       #define LCD_FEEDBACK_FREQUENCY_HZ 5000
639
     #endif
760
     #endif
640
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
761
     #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
641
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
762
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
642
     #endif
763
     #endif
643
-  #else
644
-    #ifndef LCD_FEEDBACK_FREQUENCY_DURATION_MS
645
-      #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
646
-    #endif
647
   #endif
764
   #endif
648
 
765
 
649
   /**
766
   /**
650
-   * Z_HOMING_HEIGHT / Z_PROBE_TRAVEL_HEIGHT
767
+   * Z_HOMING_HEIGHT / Z_CLEARANCE_BETWEEN_PROBES
651
    */
768
    */
652
   #ifndef Z_HOMING_HEIGHT
769
   #ifndef Z_HOMING_HEIGHT
653
-    #ifndef Z_PROBE_TRAVEL_HEIGHT
770
+    #ifndef Z_CLEARANCE_BETWEEN_PROBES
654
       #define Z_HOMING_HEIGHT 0
771
       #define Z_HOMING_HEIGHT 0
655
     #else
772
     #else
656
-      #define Z_HOMING_HEIGHT Z_PROBE_TRAVEL_HEIGHT
773
+      #define Z_HOMING_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
657
     #endif
774
     #endif
658
   #endif
775
   #endif
659
-  #ifndef Z_PROBE_TRAVEL_HEIGHT
660
-    #define Z_PROBE_TRAVEL_HEIGHT Z_HOMING_HEIGHT
776
+  #ifndef Z_CLEARANCE_BETWEEN_PROBES
777
+    #define Z_CLEARANCE_BETWEEN_PROBES Z_HOMING_HEIGHT
778
+  #endif
779
+  #if Z_CLEARANCE_BETWEEN_PROBES > Z_HOMING_HEIGHT
780
+    #define MANUAL_PROBE_HEIGHT Z_CLEARANCE_BETWEEN_PROBES
781
+  #else
782
+    #define MANUAL_PROBE_HEIGHT Z_HOMING_HEIGHT
783
+  #endif
784
+
785
+  #if ENABLED(DELTA)
786
+    // These will be further constrained in code, but UBL_PROBE_PT values
787
+    // cannot be compile-time verified within the radius.
788
+    #define MIN_PROBE_X (-DELTA_PRINTABLE_RADIUS)
789
+    #define MAX_PROBE_X ( DELTA_PRINTABLE_RADIUS)
790
+    #define MIN_PROBE_Y (-DELTA_PRINTABLE_RADIUS)
791
+    #define MAX_PROBE_Y ( DELTA_PRINTABLE_RADIUS)
792
+  #elif IS_SCARA
793
+    #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
794
+    #define MIN_PROBE_X (-SCARA_PRINTABLE_RADIUS)
795
+    #define MAX_PROBE_X ( SCARA_PRINTABLE_RADIUS)
796
+    #define MIN_PROBE_Y (-SCARA_PRINTABLE_RADIUS)
797
+    #define MAX_PROBE_Y ( SCARA_PRINTABLE_RADIUS)
798
+  #else
799
+    // Boundaries for probing based on set limits
800
+    #define MIN_PROBE_X (max(X_MIN_POS, X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
801
+    #define MAX_PROBE_X (min(X_MAX_POS, X_MAX_POS + X_PROBE_OFFSET_FROM_EXTRUDER))
802
+    #define MIN_PROBE_Y (max(Y_MIN_POS, Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
803
+    #define MAX_PROBE_Y (min(Y_MAX_POS, Y_MAX_POS + Y_PROBE_OFFSET_FROM_EXTRUDER))
804
+  #endif
805
+
806
+  // Stepper pulse duration, in cycles
807
+  #define STEP_PULSE_CYCLES ((MINIMUM_STEPPER_PULSE) * CYCLES_PER_MICROSECOND)
808
+
809
+  #if ENABLED(SDCARD_SORT_ALPHA)
810
+    #define HAS_FOLDER_SORTING (FOLDER_SORTING || ENABLED(SDSORT_GCODE))
811
+  #endif
812
+
813
+  // Updated G92 behavior shifts the workspace
814
+  #define HAS_POSITION_SHIFT DISABLED(NO_WORKSPACE_OFFSETS)
815
+  // The home offset also shifts the coordinate space
816
+  #define HAS_HOME_OFFSET (DISABLED(NO_WORKSPACE_OFFSETS) || ENABLED(DELTA))
817
+  // Either offset yields extra calculations on all moves
818
+  #define HAS_WORKSPACE_OFFSET (HAS_POSITION_SHIFT || HAS_HOME_OFFSET)
819
+  // M206 doesn't apply to DELTA
820
+  #define HAS_M206_COMMAND (HAS_HOME_OFFSET && DISABLED(DELTA))
821
+
822
+  // LCD timeout to status screen default is 15s
823
+  #ifndef LCD_TIMEOUT_TO_STATUS
824
+    #define LCD_TIMEOUT_TO_STATUS 15000
825
+  #endif
826
+
827
+  /**
828
+   * DELTA_SEGMENT_MIN_LENGTH and DELTA_PROBEABLE_RADIUS for UBL_DELTA
829
+   */
830
+  #if UBL_DELTA
831
+    #ifndef DELTA_SEGMENT_MIN_LENGTH
832
+      #if IS_SCARA
833
+        #define DELTA_SEGMENT_MIN_LENGTH 0.25 // SCARA minimum segment size is 0.25mm
834
+      #elif ENABLED(DELTA)
835
+        #define DELTA_SEGMENT_MIN_LENGTH 0.10 // mm (still subject to DELTA_SEGMENTS_PER_SECOND)
836
+      #else // CARTESIAN
837
+        #define DELTA_SEGMENT_MIN_LENGTH 1.00 // mm (similar to G2/G3 arc segmentation)
838
+      #endif
839
+    #endif
840
+    #ifndef DELTA_PROBEABLE_RADIUS
841
+      #define DELTA_PROBEABLE_RADIUS DELTA_PRINTABLE_RADIUS
842
+    #endif
843
+  #endif
844
+
845
+  // Shorthand
846
+  #define GRID_MAX_POINTS ((GRID_MAX_POINTS_X) * (GRID_MAX_POINTS_Y))
847
+
848
+  // Add commands that need sub-codes to this list
849
+  #define USE_GCODE_SUBCODES ENABLED(G38_PROBE_TARGET)
850
+
851
+  // MESH_BED_LEVELING overrides PROBE_MANUALLY
852
+  #if ENABLED(MESH_BED_LEVELING)
853
+    #undef PROBE_MANUALLY
661
   #endif
854
   #endif
662
 
855
 
663
 #endif // CONDITIONALS_POST_H
856
 #endif // CONDITIONALS_POST_H

+ 750
- 450
Marlin/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 777
- 214
Marlin/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 890
- 0
Marlin/G26_Mesh_Validation_Tool.cpp Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Marlin Firmware -- G26 - Mesh Validation Tool
25
+ */
26
+
27
+#include "MarlinConfig.h"
28
+
29
+#if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(UBL_G26_MESH_VALIDATION)
30
+
31
+  #include "ubl.h"
32
+  #include "Marlin.h"
33
+  #include "planner.h"
34
+  #include "stepper.h"
35
+  #include "temperature.h"
36
+  #include "ultralcd.h"
37
+  #include "gcode.h"
38
+
39
+  #define EXTRUSION_MULTIPLIER 1.0
40
+  #define RETRACTION_MULTIPLIER 1.0
41
+  #define NOZZLE 0.4
42
+  #define FILAMENT 1.75
43
+  #define LAYER_HEIGHT 0.2
44
+  #define PRIME_LENGTH 10.0
45
+  #define BED_TEMP 60.0
46
+  #define HOTEND_TEMP 205.0
47
+  #define OOZE_AMOUNT 0.3
48
+
49
+  #define SIZE_OF_INTERSECTION_CIRCLES 5
50
+  #define SIZE_OF_CROSSHAIRS 3
51
+
52
+  #if SIZE_OF_CROSSHAIRS >= SIZE_OF_INTERSECTION_CIRCLES
53
+    #error "SIZE_OF_CROSSHAIRS must be less than SIZE_OF_INTERSECTION_CIRCLES."
54
+  #endif
55
+
56
+  /**
57
+   *   G26 Mesh Validation Tool
58
+   *
59
+   *   G26 is a Mesh Validation Tool intended to provide support for the Marlin Unified Bed Leveling System.
60
+   *   In order to fully utilize and benefit from the Marlin Unified Bed Leveling System an accurate Mesh must
61
+   *   be defined.  G29 is designed to allow the user to quickly validate the correctness of her Mesh.  It will
62
+   *   first heat the bed and nozzle. It will then print lines and circles along the Mesh Cell boundaries and
63
+   *   the intersections of those lines (respectively).
64
+   *
65
+   *   This action allows the user to immediately see where the Mesh is properly defined and where it needs to
66
+   *   be edited.  The command will generate the Mesh lines closest to the nozzle's starting position.  Alternatively
67
+   *   the user can specify the X and Y position of interest with command parameters.  This allows the user to
68
+   *   focus on a particular area of the Mesh where attention is needed.
69
+   *
70
+   *   B #  Bed         Set the Bed Temperature.  If not specified, a default of 60 C. will be assumed.
71
+   *
72
+   *   C    Current     When searching for Mesh Intersection points to draw, use the current nozzle location
73
+   *                    as the base for any distance comparison.
74
+   *
75
+   *   D    Disable     Disable the Unified Bed Leveling System.  In the normal case the user is invoking this
76
+   *                    command to see how well a Mesh as been adjusted to match a print surface.  In order to do
77
+   *                    this the Unified Bed Leveling System is turned on by the G26 command.  The D parameter
78
+   *                    alters the command's normal behaviour and disables the Unified Bed Leveling System even if
79
+   *                    it is on.
80
+   *
81
+   *   H #  Hotend      Set the Nozzle Temperature.  If not specified, a default of 205 C. will be assumed.
82
+   *
83
+   *   F #  Filament    Used to specify the diameter of the filament being used.  If not specified
84
+   *                    1.75mm filament is assumed.  If you are not getting acceptable results by using the
85
+   *                    'correct' numbers, you can scale this number up or down a little bit to change the amount
86
+   *                    of filament that is being extruded during the printing of the various lines on the bed.
87
+   *
88
+   *   K    Keep-On     Keep the heaters turned on at the end of the command.
89
+   *
90
+   *   L #  Layer       Layer height.  (Height of nozzle above bed)  If not specified .20mm will be used.
91
+   *
92
+   *   O #  Ooooze      How much your nozzle will Ooooze filament while getting in position to print.  This
93
+   *                    is over kill, but using this parameter will let you get the very first 'circle' perfect
94
+   *                    so you have a trophy to peel off of the bed and hang up to show how perfectly you have your
95
+   *                    Mesh calibrated.  If not specified, a filament length of .3mm is assumed.
96
+   *
97
+   *   P #  Prime       Prime the nozzle with specified length of filament.  If this parameter is not
98
+   *                    given, no prime action will take place.  If the parameter specifies an amount, that much
99
+   *                    will be purged before continuing.  If no amount is specified the command will start
100
+   *                    purging filament until the user provides an LCD Click and then it will continue with
101
+   *                    printing the Mesh.  You can carefully remove the spent filament with a needle nose
102
+   *                    pliers while holding the LCD Click wheel in a depressed state.  If you do not have
103
+   *                    an LCD, you must specify a value if you use P.
104
+   *
105
+   *   Q #  Multiplier  Retraction Multiplier.  Normally not needed.  Retraction defaults to 1.0mm and
106
+   *                    un-retraction is at 1.2mm   These numbers will be scaled by the specified amount
107
+   *
108
+   *   R #  Repeat      Prints the number of patterns given as a parameter, starting at the current location.
109
+   *                    If a parameter isn't given, every point will be printed unless G26 is interrupted.
110
+   *                    This works the same way that the UBL G29 P4 R parameter works.
111
+   *
112
+   *                    NOTE:  If you do not have an LCD, you -must- specify R.  This is to ensure that you are
113
+   *                    aware that there's some risk associated with printing without the ability to abort in
114
+   *                    cases where mesh point Z value may be inaccurate.  As above, if you do not include a
115
+   *                    parameter, every point will be printed.
116
+   *
117
+   *   S #  Nozzle      Used to control the size of nozzle diameter.  If not specified, a .4mm nozzle is assumed.
118
+   *
119
+   *   U #  Random      Randomize the order that the circles are drawn on the bed.  The search for the closest
120
+   *                    undrawn cicle is still done.  But the distance to the location for each circle has a
121
+   *                    random number of the size specified added to it.  Specifying S50 will give an interesting
122
+   *                    deviation from the normal behaviour on a 10 x 10 Mesh.
123
+   *
124
+   *   X #  X Coord.    Specify the starting location of the drawing activity.
125
+   *
126
+   *   Y #  Y Coord.    Specify the starting location of the drawing activity.
127
+   */
128
+
129
+  // External references
130
+
131
+  extern float feedrate_mm_s; // must set before calling prepare_move_to_destination
132
+  extern Planner planner;
133
+  #if ENABLED(ULTRA_LCD)
134
+    extern char lcd_status_message[];
135
+  #endif
136
+  extern float destination[XYZE];
137
+  void set_destination_to_current();
138
+  void prepare_move_to_destination();
139
+  #if AVR_AT90USB1286_FAMILY  // Teensyduino & Printrboard IDE extensions have compile errors without this
140
+    inline void sync_plan_position_e() { planner.set_e_position_mm(current_position[E_AXIS]); }
141
+    inline void set_current_to_destination() { COPY(current_position, destination); }
142
+  #else
143
+    void sync_plan_position_e();
144
+    void set_current_to_destination();
145
+  #endif
146
+  #if ENABLED(NEWPANEL)
147
+    void lcd_setstatusPGM(const char* const message, const int8_t level);
148
+    void chirp_at_user();
149
+  #endif
150
+
151
+  // Private functions
152
+
153
+  static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16];
154
+  float g26_e_axis_feedrate = 0.020,
155
+        random_deviation = 0.0;
156
+
157
+  static bool g26_retracted = false; // Track the retracted state of the nozzle so mismatched
158
+                                     // retracts/recovers won't result in a bad state.
159
+
160
+  float valid_trig_angle(float);
161
+
162
+  float unified_bed_leveling::g26_extrusion_multiplier,
163
+        unified_bed_leveling::g26_retraction_multiplier,
164
+        unified_bed_leveling::g26_nozzle,
165
+        unified_bed_leveling::g26_filament_diameter,
166
+        unified_bed_leveling::g26_layer_height,
167
+        unified_bed_leveling::g26_prime_length,
168
+        unified_bed_leveling::g26_x_pos,
169
+        unified_bed_leveling::g26_y_pos,
170
+        unified_bed_leveling::g26_ooze_amount;
171
+
172
+  int16_t unified_bed_leveling::g26_bed_temp,
173
+          unified_bed_leveling::g26_hotend_temp;
174
+
175
+  int8_t unified_bed_leveling::g26_prime_flag;
176
+
177
+  bool unified_bed_leveling::g26_continue_with_closest,
178
+       unified_bed_leveling::g26_keep_heaters_on;
179
+
180
+  int16_t unified_bed_leveling::g26_repeats;
181
+
182
+  void unified_bed_leveling::G26_line_to_destination(const float &feed_rate) {
183
+    const float save_feedrate = feedrate_mm_s;
184
+    feedrate_mm_s = feed_rate;      // use specified feed rate
185
+    prepare_move_to_destination();  // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_DELTA
186
+    feedrate_mm_s = save_feedrate;  // restore global feed rate
187
+  }
188
+
189
+  #if ENABLED(NEWPANEL)
190
+    /**
191
+     * Detect ubl_lcd_clicked, debounce it, and return true for cancel
192
+     */
193
+    bool user_canceled() {
194
+      if (!ubl_lcd_clicked()) return false;
195
+      safe_delay(10);                       // Wait for click to settle
196
+
197
+      #if ENABLED(ULTRA_LCD)
198
+        lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99);
199
+        lcd_quick_feedback();
200
+      #endif
201
+
202
+      while (!ubl_lcd_clicked()) idle();    // Wait for button release
203
+
204
+      // If the button is suddenly pressed again,
205
+      // ask the user to resolve the issue
206
+      lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear...
207
+      while (ubl_lcd_clicked()) idle();             // unless this loop happens
208
+      lcd_reset_status();
209
+
210
+      return true;
211
+    }
212
+  #endif
213
+
214
+  /**
215
+   * G26: Mesh Validation Pattern generation.
216
+   *
217
+   * Used to interactively edit UBL's Mesh by placing the
218
+   * nozzle in a problem area and doing a G29 P4 R command.
219
+   */
220
+  void unified_bed_leveling::G26() {
221
+    SERIAL_ECHOLNPGM("G26 command started.  Waiting for heater(s).");
222
+    float tmp, start_angle, end_angle;
223
+    int   i, xi, yi;
224
+    mesh_index_pair location;
225
+
226
+    // Don't allow Mesh Validation without homing first,
227
+    // or if the parameter parsing did not go OK, abort
228
+    if (axis_unhomed_error() || parse_G26_parameters()) return;
229
+
230
+    if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) {
231
+      do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
232
+      stepper.synchronize();
233
+      set_current_to_destination();
234
+    }
235
+
236
+    if (turn_on_heaters()) goto LEAVE;
237
+
238
+    current_position[E_AXIS] = 0.0;
239
+    sync_plan_position_e();
240
+
241
+    if (g26_prime_flag && prime_nozzle()) goto LEAVE;
242
+
243
+    /**
244
+     *  Bed is preheated
245
+     *
246
+     *  Nozzle is at temperature
247
+     *
248
+     *  Filament is primed!
249
+     *
250
+     *  It's  "Show Time" !!!
251
+     */
252
+
253
+    ZERO(circle_flags);
254
+    ZERO(horizontal_mesh_line_flags);
255
+    ZERO(vertical_mesh_line_flags);
256
+
257
+    // Move nozzle to the specified height for the first layer
258
+    set_destination_to_current();
259
+    destination[Z_AXIS] = g26_layer_height;
260
+    move_to(destination, 0.0);
261
+    move_to(destination, g26_ooze_amount);
262
+
263
+    has_control_of_lcd_panel = true;
264
+    //debug_current_and_destination(PSTR("Starting G26 Mesh Validation Pattern."));
265
+
266
+    /**
267
+     * Declare and generate a sin() & cos() table to be used during the circle drawing.  This will lighten
268
+     * the CPU load and make the arc drawing faster and more smooth
269
+     */
270
+    float sin_table[360 / 30 + 1], cos_table[360 / 30 + 1];
271
+    for (i = 0; i <= 360 / 30; i++) {
272
+      cos_table[i] = SIZE_OF_INTERSECTION_CIRCLES * cos(RADIANS(valid_trig_angle(i * 30.0)));
273
+      sin_table[i] = SIZE_OF_INTERSECTION_CIRCLES * sin(RADIANS(valid_trig_angle(i * 30.0)));
274
+    }
275
+
276
+    do {
277
+      location = g26_continue_with_closest
278
+        ? find_closest_circle_to_print(current_position[X_AXIS], current_position[Y_AXIS])
279
+        : find_closest_circle_to_print(g26_x_pos, g26_y_pos); // Find the closest Mesh Intersection to where we are now.
280
+
281
+      if (location.x_index >= 0 && location.y_index >= 0) {
282
+        const float circle_x = mesh_index_to_xpos(location.x_index),
283
+                    circle_y = mesh_index_to_ypos(location.y_index);
284
+
285
+        // If this mesh location is outside the printable_radius, skip it.
286
+
287
+        if (!position_is_reachable_raw_xy(circle_x, circle_y)) continue;
288
+
289
+        xi = location.x_index;  // Just to shrink the next few lines and make them easier to understand
290
+        yi = location.y_index;
291
+
292
+        if (g26_debug_flag) {
293
+          SERIAL_ECHOPAIR("   Doing circle at: (xi=", xi);
294
+          SERIAL_ECHOPAIR(", yi=", yi);
295
+          SERIAL_CHAR(')');
296
+          SERIAL_EOL();
297
+        }
298
+
299
+        start_angle = 0.0;    // assume it is going to be a full circle
300
+        end_angle   = 360.0;
301
+        if (xi == 0) {       // Check for bottom edge
302
+          start_angle = -90.0;
303
+          end_angle   =  90.0;
304
+          if (yi == 0)        // it is an edge, check for the two left corners
305
+            start_angle = 0.0;
306
+          else if (yi == GRID_MAX_POINTS_Y - 1)
307
+            end_angle = 0.0;
308
+        }
309
+        else if (xi == GRID_MAX_POINTS_X - 1) { // Check for top edge
310
+          start_angle =  90.0;
311
+          end_angle   = 270.0;
312
+          if (yi == 0)                  // it is an edge, check for the two right corners
313
+            end_angle = 180.0;
314
+          else if (yi == GRID_MAX_POINTS_Y - 1)
315
+            start_angle = 180.0;
316
+        }
317
+        else if (yi == 0) {
318
+          start_angle =   0.0;         // only do the top   side of the cirlce
319
+          end_angle   = 180.0;
320
+        }
321
+        else if (yi == GRID_MAX_POINTS_Y - 1) {
322
+          start_angle = 180.0;         // only do the bottom side of the cirlce
323
+          end_angle   = 360.0;
324
+        }
325
+
326
+        for (tmp = start_angle; tmp < end_angle - 0.1; tmp += 30.0) {
327
+
328
+          #if ENABLED(NEWPANEL)
329
+            if (user_canceled()) goto LEAVE;              // Check if the user wants to stop the Mesh Validation
330
+          #endif
331
+
332
+          int tmp_div_30 = tmp / 30.0;
333
+          if (tmp_div_30 < 0) tmp_div_30 += 360 / 30;
334
+          if (tmp_div_30 > 11) tmp_div_30 -= 360 / 30;
335
+
336
+          float x = circle_x + cos_table[tmp_div_30],    // for speed, these are now a lookup table entry
337
+                y = circle_y + sin_table[tmp_div_30],
338
+                xe = circle_x + cos_table[tmp_div_30 + 1],
339
+                ye = circle_y + sin_table[tmp_div_30 + 1];
340
+          #if IS_KINEMATIC
341
+            // Check to make sure this segment is entirely on the bed, skip if not.
342
+            if (!position_is_reachable_raw_xy(x, y) || !position_is_reachable_raw_xy(xe, ye)) continue;
343
+          #else                                              // not, we need to skip
344
+            x  = constrain(x, X_MIN_POS + 1, X_MAX_POS - 1); // This keeps us from bumping the endstops
345
+            y  = constrain(y, Y_MIN_POS + 1, Y_MAX_POS - 1);
346
+            xe = constrain(xe, X_MIN_POS + 1, X_MAX_POS - 1);
347
+            ye = constrain(ye, Y_MIN_POS + 1, Y_MAX_POS - 1);
348
+          #endif
349
+
350
+          //if (g26_debug_flag) {
351
+          //  char ccc, *cptr, seg_msg[50], seg_num[10];
352
+          //  strcpy(seg_msg, "   segment: ");
353
+          //  strcpy(seg_num, "    \n");
354
+          //  cptr = (char*) "01234567890ABCDEF????????";
355
+          //  ccc = cptr[tmp_div_30];
356
+          //  seg_num[1] = ccc;
357
+          //  strcat(seg_msg, seg_num);
358
+          //  debug_current_and_destination(seg_msg);
359
+          //}
360
+
361
+          print_line_from_here_to_there(LOGICAL_X_POSITION(x), LOGICAL_Y_POSITION(y), g26_layer_height, LOGICAL_X_POSITION(xe), LOGICAL_Y_POSITION(ye), g26_layer_height);
362
+
363
+        }
364
+        if (look_for_lines_to_connect())
365
+          goto LEAVE;
366
+      }
367
+    } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
368
+
369
+    LEAVE:
370
+    lcd_setstatusPGM(PSTR("Leaving G26"), -1);
371
+
372
+    retract_filament(destination);
373
+    destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;
374
+
375
+    //debug_current_and_destination(PSTR("ready to do Z-Raise."));
376
+    move_to(destination, 0); // Raise the nozzle
377
+    //debug_current_and_destination(PSTR("done doing Z-Raise."));
378
+
379
+    destination[X_AXIS] = g26_x_pos;                                               // Move back to the starting position
380
+    destination[Y_AXIS] = g26_y_pos;
381
+    //destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES;                        // Keep the nozzle where it is
382
+
383
+    move_to(destination, 0); // Move back to the starting position
384
+    //debug_current_and_destination(PSTR("done doing X/Y move."));
385
+
386
+    has_control_of_lcd_panel = false;     // Give back control of the LCD Panel!
387
+
388
+    if (!g26_keep_heaters_on) {
389
+      #if HAS_TEMP_BED
390
+        thermalManager.setTargetBed(0);
391
+      #endif
392
+      thermalManager.setTargetHotend(0, 0);
393
+    }
394
+  }
395
+
396
+  float valid_trig_angle(float d) {
397
+    while (d > 360.0) d -= 360.0;
398
+    while (d < 0.0) d += 360.0;
399
+    return d;
400
+  }
401
+
402
+  mesh_index_pair unified_bed_leveling::find_closest_circle_to_print(const float &X, const float &Y) {
403
+    float closest = 99999.99;
404
+    mesh_index_pair return_val;
405
+
406
+    return_val.x_index = return_val.y_index = -1;
407
+
408
+    for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
409
+      for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
410
+        if (!is_bit_set(circle_flags, i, j)) {
411
+          const float mx = mesh_index_to_xpos(i),  // We found a circle that needs to be printed
412
+                      my = mesh_index_to_ypos(j);
413
+
414
+          // Get the distance to this intersection
415
+          float f = HYPOT(X - mx, Y - my);
416
+
417
+          // It is possible that we are being called with the values
418
+          // to let us find the closest circle to the start position.
419
+          // But if this is not the case, add a small weighting to the
420
+          // distance calculation to help it choose a better place to continue.
421
+          f += HYPOT(g26_x_pos - mx, g26_y_pos - my) / 15.0;
422
+
423
+          // Add in the specified amount of Random Noise to our search
424
+          if (random_deviation > 1.0)
425
+            f += random(0.0, random_deviation);
426
+
427
+          if (f < closest) {
428
+            closest = f;              // We found a closer location that is still
429
+            return_val.x_index = i;   // un-printed  --- save the data for it
430
+            return_val.y_index = j;
431
+            return_val.distance = closest;
432
+          }
433
+        }
434
+      }
435
+    }
436
+    bit_set(circle_flags, return_val.x_index, return_val.y_index);   // Mark this location as done.
437
+    return return_val;
438
+  }
439
+
440
+  bool unified_bed_leveling::look_for_lines_to_connect() {
441
+    float sx, sy, ex, ey;
442
+
443
+    for (uint8_t i = 0; i < GRID_MAX_POINTS_X; i++) {
444
+      for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++) {
445
+
446
+        #if ENABLED(NEWPANEL)
447
+          if (user_canceled()) return true;     // Check if the user wants to stop the Mesh Validation
448
+        #endif
449
+
450
+        if (i < GRID_MAX_POINTS_X) { // We can't connect to anything to the right than GRID_MAX_POINTS_X.
451
+                                     // This is already a half circle because we are at the edge of the bed.
452
+
453
+          if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i + 1, j)) { // check if we can do a line to the left
454
+            if (!is_bit_set(horizontal_mesh_line_flags, i, j)) {
455
+
456
+              //
457
+              // We found two circles that need a horizontal line to connect them
458
+              // Print it!
459
+              //
460
+              sx = mesh_index_to_xpos(  i  ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // right edge
461
+              ex = mesh_index_to_xpos(i + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // left edge
462
+
463
+              sx = constrain(sx, X_MIN_POS + 1, X_MAX_POS - 1);
464
+              sy = ey = constrain(mesh_index_to_ypos(j), Y_MIN_POS + 1, Y_MAX_POS - 1);
465
+              ex = constrain(ex, X_MIN_POS + 1, X_MAX_POS - 1);
466
+
467
+              if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
468
+
469
+                if (g26_debug_flag) {
470
+                  SERIAL_ECHOPAIR(" Connecting with horizontal line (sx=", sx);
471
+                  SERIAL_ECHOPAIR(", sy=", sy);
472
+                  SERIAL_ECHOPAIR(") -> (ex=", ex);
473
+                  SERIAL_ECHOPAIR(", ey=", ey);
474
+                  SERIAL_CHAR(')');
475
+                  SERIAL_EOL();
476
+                  //debug_current_and_destination(PSTR("Connecting horizontal line."));
477
+                }
478
+
479
+                print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
480
+              }
481
+              bit_set(horizontal_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if we skipped it
482
+            }
483
+          }
484
+
485
+          if (j < GRID_MAX_POINTS_Y) { // We can't connect to anything further back than GRID_MAX_POINTS_Y.
486
+                                           // This is already a half circle because we are at the edge  of the bed.
487
+
488
+            if (is_bit_set(circle_flags, i, j) && is_bit_set(circle_flags, i, j + 1)) { // check if we can do a line straight down
489
+              if (!is_bit_set( vertical_mesh_line_flags, i, j)) {
490
+                //
491
+                // We found two circles that need a vertical line to connect them
492
+                // Print it!
493
+                //
494
+                sy = mesh_index_to_ypos(  j  ) + (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // top edge
495
+                ey = mesh_index_to_ypos(j + 1) - (SIZE_OF_INTERSECTION_CIRCLES - (SIZE_OF_CROSSHAIRS)); // bottom edge
496
+
497
+                sx = ex = constrain(mesh_index_to_xpos(i), X_MIN_POS + 1, X_MAX_POS - 1);
498
+                sy = constrain(sy, Y_MIN_POS + 1, Y_MAX_POS - 1);
499
+                ey = constrain(ey, Y_MIN_POS + 1, Y_MAX_POS - 1);
500
+
501
+                if (position_is_reachable_raw_xy(sx, sy) && position_is_reachable_raw_xy(ex, ey)) {
502
+
503
+                  if (g26_debug_flag) {
504
+                    SERIAL_ECHOPAIR(" Connecting with vertical line (sx=", sx);
505
+                    SERIAL_ECHOPAIR(", sy=", sy);
506
+                    SERIAL_ECHOPAIR(") -> (ex=", ex);
507
+                    SERIAL_ECHOPAIR(", ey=", ey);
508
+                    SERIAL_CHAR(')');
509
+                    SERIAL_EOL();
510
+                    debug_current_and_destination(PSTR("Connecting vertical line."));
511
+                  }
512
+                  print_line_from_here_to_there(LOGICAL_X_POSITION(sx), LOGICAL_Y_POSITION(sy), g26_layer_height, LOGICAL_X_POSITION(ex), LOGICAL_Y_POSITION(ey), g26_layer_height);
513
+                }
514
+                bit_set(vertical_mesh_line_flags, i, j);   // Mark it as done so we don't do it again, even if skipped
515
+              }
516
+            }
517
+          }
518
+        }
519
+      }
520
+    }
521
+    return false;
522
+  }
523
+
524
+  void unified_bed_leveling::move_to(const float &x, const float &y, const float &z, const float &e_delta) {
525
+    float feed_value;
526
+    static float last_z = -999.99;
527
+
528
+    bool has_xy_component = (x != current_position[X_AXIS] || y != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
529
+
530
+    if (z != last_z) {
531
+      last_z = z;
532
+      feed_value = planner.max_feedrate_mm_s[Z_AXIS]/(3.0);  // Base the feed rate off of the configured Z_AXIS feed rate
533
+
534
+      destination[X_AXIS] = current_position[X_AXIS];
535
+      destination[Y_AXIS] = current_position[Y_AXIS];
536
+      destination[Z_AXIS] = z;                          // We know the last_z==z or we wouldn't be in this block of code.
537
+      destination[E_AXIS] = current_position[E_AXIS];
538
+
539
+      G26_line_to_destination(feed_value);
540
+
541
+      stepper.synchronize();
542
+      set_destination_to_current();
543
+    }
544
+
545
+    // Check if X or Y is involved in the movement.
546
+    // Yes: a 'normal' movement. No: a retract() or recover()
547
+    feed_value = has_xy_component ? PLANNER_XY_FEEDRATE() / 10.0 : planner.max_feedrate_mm_s[E_AXIS] / 1.5;
548
+
549
+    if (g26_debug_flag) SERIAL_ECHOLNPAIR("in move_to() feed_value for XY:", feed_value);
550
+
551
+    destination[X_AXIS] = x;
552
+    destination[Y_AXIS] = y;
553
+    destination[E_AXIS] += e_delta;
554
+
555
+    G26_line_to_destination(feed_value);
556
+
557
+    stepper.synchronize();
558
+    set_destination_to_current();
559
+
560
+  }
561
+
562
+  void unified_bed_leveling::retract_filament(const float where[XYZE]) {
563
+    if (!g26_retracted) { // Only retract if we are not already retracted!
564
+      g26_retracted = true;
565
+      move_to(where, -1.0 * g26_retraction_multiplier);
566
+    }
567
+  }
568
+
569
+  void unified_bed_leveling::recover_filament(const float where[XYZE]) {
570
+    if (g26_retracted) { // Only un-retract if we are retracted.
571
+      move_to(where, 1.2 * g26_retraction_multiplier);
572
+      g26_retracted = false;
573
+    }
574
+  }
575
+
576
+  /**
577
+   * print_line_from_here_to_there() takes two cartesian coordinates and draws a line from one
578
+   * to the other.  But there are really three sets of coordinates involved.  The first coordinate
579
+   * is the present location of the nozzle.  We don't necessarily want to print from this location.
580
+   * We first need to move the nozzle to the start of line segment where we want to print.  Once
581
+   * there, we can use the two coordinates supplied to draw the line.
582
+   *
583
+   * Note:  Although we assume the first set of coordinates is the start of the line and the second
584
+   * set of coordinates is the end of the line, it does not always work out that way.  This function
585
+   * optimizes the movement to minimize the travel distance before it can start printing.  This saves
586
+   * a lot of time and eleminates a lot of non-sensical movement of the nozzle.   However, it does
587
+   * cause a lot of very little short retracement of th nozzle when it draws the very first line
588
+   * segment of a 'circle'.   The time this requires is very short and is easily saved by the other
589
+   * cases where the optimization comes into play.
590
+   */
591
+  void unified_bed_leveling::print_line_from_here_to_there(const float &sx, const float &sy, const float &sz, const float &ex, const float &ey, const float &ez) {
592
+    const float dx_s = current_position[X_AXIS] - sx,   // find our distance from the start of the actual line segment
593
+                dy_s = current_position[Y_AXIS] - sy,
594
+                dist_start = HYPOT2(dx_s, dy_s),        // We don't need to do a sqrt(), we can compare the distance^2
595
+                                                        // to save computation time
596
+                dx_e = current_position[X_AXIS] - ex,   // find our distance from the end of the actual line segment
597
+                dy_e = current_position[Y_AXIS] - ey,
598
+                dist_end = HYPOT2(dx_e, dy_e),
599
+
600
+                line_length = HYPOT(ex - sx, ey - sy);
601
+
602
+    // If the end point of the line is closer to the nozzle, flip the direction,
603
+    // moving from the end to the start. On very small lines the optimization isn't worth it.
604
+    if (dist_end < dist_start && (SIZE_OF_INTERSECTION_CIRCLES) < FABS(line_length)) {
605
+      return print_line_from_here_to_there(ex, ey, ez, sx, sy, sz);
606
+    }
607
+
608
+    // Decide whether to retract & bump
609
+
610
+    if (dist_start > 2.0) {
611
+      retract_filament(destination);
612
+      //todo:  parameterize the bump height with a define
613
+      move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 0.500, 0.0);  // Z bump to minimize scraping
614
+      move_to(sx, sy, sz + 0.500, 0.0); // Get to the starting point with no extrusion while bumped
615
+    }
616
+
617
+    move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion / un-Z bump
618
+
619
+    const float e_pos_delta = line_length * g26_e_axis_feedrate * g26_extrusion_multiplier;
620
+
621
+    recover_filament(destination);
622
+    move_to(ex, ey, ez, e_pos_delta);  // Get to the ending point with an appropriate amount of extrusion
623
+  }
624
+
625
+  /**
626
+   * This function used to be inline code in G26. But there are so many
627
+   * parameters it made sense to turn them into static globals and get
628
+   * this code out of sight of the main routine.
629
+   */
630
+  bool unified_bed_leveling::parse_G26_parameters() {
631
+
632
+    g26_extrusion_multiplier  = EXTRUSION_MULTIPLIER;
633
+    g26_retraction_multiplier = RETRACTION_MULTIPLIER;
634
+    g26_nozzle                = NOZZLE;
635
+    g26_filament_diameter     = FILAMENT;
636
+    g26_layer_height          = LAYER_HEIGHT;
637
+    g26_prime_length          = PRIME_LENGTH;
638
+    g26_bed_temp              = BED_TEMP;
639
+    g26_hotend_temp           = HOTEND_TEMP;
640
+    g26_prime_flag            = 0;
641
+
642
+    g26_ooze_amount           = parser.linearval('O', OOZE_AMOUNT);
643
+    g26_keep_heaters_on       = parser.boolval('K');
644
+    g26_continue_with_closest = parser.boolval('C');
645
+
646
+    if (parser.seenval('B')) {
647
+      g26_bed_temp = parser.value_celsius();
648
+      if (!WITHIN(g26_bed_temp, 15, 140)) {
649
+        SERIAL_PROTOCOLLNPGM("?Specified bed temperature not plausible.");
650
+        return UBL_ERR;
651
+      }
652
+    }
653
+
654
+    if (parser.seenval('L')) {
655
+      g26_layer_height = parser.value_linear_units();
656
+      if (!WITHIN(g26_layer_height, 0.0, 2.0)) {
657
+        SERIAL_PROTOCOLLNPGM("?Specified layer height not plausible.");
658
+        return UBL_ERR;
659
+      }
660
+    }
661
+
662
+    if (parser.seen('Q')) {
663
+      if (parser.has_value()) {
664
+        g26_retraction_multiplier = parser.value_float();
665
+        if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
666
+          SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
667
+          return UBL_ERR;
668
+        }
669
+      }
670
+      else {
671
+        SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
672
+        return UBL_ERR;
673
+      }
674
+    }
675
+
676
+    if (parser.seenval('S')) {
677
+      g26_nozzle = parser.value_float();
678
+      if (!WITHIN(g26_nozzle, 0.1, 1.0)) {
679
+        SERIAL_PROTOCOLLNPGM("?Specified nozzle size not plausible.");
680
+        return UBL_ERR;
681
+      }
682
+    }
683
+
684
+    if (parser.seen('P')) {
685
+      if (!parser.has_value()) {
686
+        #if ENABLED(NEWPANEL)
687
+          g26_prime_flag = -1;
688
+        #else
689
+          SERIAL_PROTOCOLLNPGM("?Prime length must be specified when not using an LCD.");
690
+          return UBL_ERR;
691
+        #endif
692
+      }
693
+      else {
694
+        g26_prime_flag++;
695
+        g26_prime_length = parser.value_linear_units();
696
+        if (!WITHIN(g26_prime_length, 0.0, 25.0)) {
697
+          SERIAL_PROTOCOLLNPGM("?Specified prime length not plausible.");
698
+          return UBL_ERR;
699
+        }
700
+      }
701
+    }
702
+
703
+    if (parser.seenval('F')) {
704
+      g26_filament_diameter = parser.value_linear_units();
705
+      if (!WITHIN(g26_filament_diameter, 1.0, 4.0)) {
706
+        SERIAL_PROTOCOLLNPGM("?Specified filament size not plausible.");
707
+        return UBL_ERR;
708
+      }
709
+    }
710
+    g26_extrusion_multiplier *= sq(1.75) / sq(g26_filament_diameter); // If we aren't using 1.75mm filament, we need to
711
+                                                                      // scale up or down the length needed to get the
712
+                                                                      // same volume of filament
713
+
714
+    g26_extrusion_multiplier *= g26_filament_diameter * sq(g26_nozzle) / sq(0.3); // Scale up by nozzle size
715
+
716
+    if (parser.seenval('H')) {
717
+      g26_hotend_temp = parser.value_celsius();
718
+      if (!WITHIN(g26_hotend_temp, 165, 280)) {
719
+        SERIAL_PROTOCOLLNPGM("?Specified nozzle temperature not plausible.");
720
+        return UBL_ERR;
721
+      }
722
+    }
723
+
724
+    if (parser.seen('U')) {
725
+      randomSeed(millis());
726
+      // This setting will persist for the next G26
727
+      random_deviation = parser.has_value() ? parser.value_float() : 50.0;
728
+    }
729
+
730
+    #if ENABLED(NEWPANEL)
731
+      g26_repeats = parser.intval('R', GRID_MAX_POINTS + 1);
732
+    #else
733
+      if (!parser.seen('R')) {
734
+        SERIAL_PROTOCOLLNPGM("?(R)epeat must be specified when not using an LCD.");
735
+        return UBL_ERR;
736
+      }
737
+      else
738
+        g26_repeats = parser.has_value() ? parser.value_int() : GRID_MAX_POINTS + 1;
739
+    #endif
740
+    if (g26_repeats < 1) {
741
+      SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1.");
742
+      return UBL_ERR;
743
+    }
744
+
745
+    g26_x_pos = parser.linearval('X', current_position[X_AXIS]);
746
+    g26_y_pos = parser.linearval('Y', current_position[Y_AXIS]);
747
+    if (!position_is_reachable_xy(g26_x_pos, g26_y_pos)) {
748
+      SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
749
+      return UBL_ERR;
750
+    }
751
+
752
+    /**
753
+     * Wait until all parameters are verified before altering the state!
754
+     */
755
+    set_bed_leveling_enabled(!parser.seen('D'));
756
+
757
+    return UBL_OK;
758
+  }
759
+
760
+  #if ENABLED(NEWPANEL)
761
+    bool unified_bed_leveling::exit_from_g26() {
762
+      lcd_setstatusPGM(PSTR("Leaving G26"), -1);
763
+      while (ubl_lcd_clicked()) idle();
764
+      return UBL_ERR;
765
+    }
766
+  #endif
767
+
768
+  /**
769
+   * Turn on the bed and nozzle heat and
770
+   * wait for them to get up to temperature.
771
+   */
772
+  bool unified_bed_leveling::turn_on_heaters() {
773
+    millis_t next = millis() + 5000UL;
774
+    #if HAS_TEMP_BED
775
+      #if ENABLED(ULTRA_LCD)
776
+        if (g26_bed_temp > 25) {
777
+          lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99);
778
+          lcd_quick_feedback();
779
+      #endif
780
+          has_control_of_lcd_panel = true;
781
+          thermalManager.setTargetBed(g26_bed_temp);
782
+          while (abs(thermalManager.degBed() - g26_bed_temp) > 3) {
783
+
784
+            #if ENABLED(NEWPANEL)
785
+              if (ubl_lcd_clicked()) return exit_from_g26();
786
+            #endif
787
+
788
+            if (PENDING(millis(), next)) {
789
+              next = millis() + 5000UL;
790
+              print_heaterstates();
791
+            }
792
+            idle();
793
+          }
794
+      #if ENABLED(ULTRA_LCD)
795
+        }
796
+        lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99);
797
+        lcd_quick_feedback();
798
+      #endif
799
+    #endif
800
+
801
+    // Start heating the nozzle and wait for it to reach temperature.
802
+    thermalManager.setTargetHotend(g26_hotend_temp, 0);
803
+    while (abs(thermalManager.degHotend(0) - g26_hotend_temp) > 3) {
804
+
805
+      #if ENABLED(NEWPANEL)
806
+        if (ubl_lcd_clicked()) return exit_from_g26();
807
+      #endif
808
+
809
+      if (PENDING(millis(), next)) {
810
+        next = millis() + 5000UL;
811
+        print_heaterstates();
812
+      }
813
+      idle();
814
+    }
815
+
816
+    #if ENABLED(ULTRA_LCD)
817
+      lcd_reset_status();
818
+      lcd_quick_feedback();
819
+    #endif
820
+
821
+    return UBL_OK;
822
+  }
823
+
824
+  /**
825
+   * Prime the nozzle if needed. Return true on error.
826
+   */
827
+  bool unified_bed_leveling::prime_nozzle() {
828
+
829
+    #if ENABLED(NEWPANEL)
830
+      float Total_Prime = 0.0;
831
+
832
+      if (g26_prime_flag == -1) {  // The user wants to control how much filament gets purged
833
+
834
+        has_control_of_lcd_panel = true;
835
+        lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99);
836
+        chirp_at_user();
837
+
838
+        set_destination_to_current();
839
+
840
+        recover_filament(destination); // Make sure G26 doesn't think the filament is retracted().
841
+
842
+        while (!ubl_lcd_clicked()) {
843
+          chirp_at_user();
844
+          destination[E_AXIS] += 0.25;
845
+          #ifdef PREVENT_LENGTHY_EXTRUDE
846
+            Total_Prime += 0.25;
847
+            if (Total_Prime >= EXTRUDE_MAXLENGTH) return UBL_ERR;
848
+          #endif
849
+          G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0);
850
+
851
+          stepper.synchronize();    // Without this synchronize, the purge is more consistent,
852
+                                    // but because the planner has a buffer, we won't be able
853
+                                    // to stop as quickly.  So we put up with the less smooth
854
+                                    // action to give the user a more responsive 'Stop'.
855
+          set_destination_to_current();
856
+          idle();
857
+        }
858
+
859
+        while (ubl_lcd_clicked()) idle();           // Debounce Encoder Wheel
860
+
861
+        #if ENABLED(ULTRA_LCD)
862
+          strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue;
863
+                                                              // So...  We cheat to get a message up.
864
+          lcd_setstatusPGM(PSTR("Done Priming"), 99);
865
+          lcd_quick_feedback();
866
+        #endif
867
+
868
+        has_control_of_lcd_panel = false;
869
+
870
+      }
871
+      else {
872
+    #else
873
+    {
874
+    #endif
875
+      #if ENABLED(ULTRA_LCD)
876
+        lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99);
877
+        lcd_quick_feedback();
878
+      #endif
879
+      set_destination_to_current();
880
+      destination[E_AXIS] += g26_prime_length;
881
+      G26_line_to_destination(planner.max_feedrate_mm_s[E_AXIS] / 15.0);
882
+      stepper.synchronize();
883
+      set_destination_to_current();
884
+      retract_filament(destination);
885
+    }
886
+
887
+    return UBL_OK;
888
+  }
889
+
890
+#endif // AUTO_BED_LEVELING_UBL && UBL_G26_MESH_VALIDATION

+ 1132
- 0
Marlin/I2CPositionEncoder.cpp
Plik diff jest za duży
Wyświetl plik


+ 359
- 0
Marlin/I2CPositionEncoder.h Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016, 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef I2CPOSENC_H
24
+#define I2CPOSENC_H
25
+
26
+#include "MarlinConfig.h"
27
+
28
+#if ENABLED(I2C_POSITION_ENCODERS)
29
+
30
+  #include "enum.h"
31
+  #include "macros.h"
32
+  #include "types.h"
33
+  #include <Wire.h>
34
+
35
+  //=========== Advanced / Less-Common Encoder Configuration Settings ==========
36
+
37
+  #define I2CPE_EC_THRESH_PROPORTIONAL                    // if enabled adjusts the error correction threshold
38
+                                                          // proportional to the current speed of the axis allows
39
+                                                          // for very small error margin at low speeds without
40
+                                                          // stuttering due to reading latency at high speeds
41
+
42
+  #define I2CPE_DEBUG                                     // enable encoder-related debug serial echos
43
+
44
+  #define I2CPE_REBOOT_TIME             5000              // time we wait for an encoder module to reboot
45
+                                                          // after changing address.
46
+
47
+  #define I2CPE_MAG_SIG_GOOD            0
48
+  #define I2CPE_MAG_SIG_MID             1
49
+  #define I2CPE_MAG_SIG_BAD             2
50
+  #define I2CPE_MAG_SIG_NF              255
51
+
52
+  #define I2CPE_REQ_REPORT              0
53
+  #define I2CPE_RESET_COUNT             1
54
+  #define I2CPE_SET_ADDR                2
55
+  #define I2CPE_SET_REPORT_MODE         3
56
+  #define I2CPE_CLEAR_EEPROM            4
57
+
58
+  #define I2CPE_LED_PAR_MODE            10
59
+  #define I2CPE_LED_PAR_BRT             11
60
+  #define I2CPE_LED_PAR_RATE            14
61
+
62
+  #define I2CPE_REPORT_DISTANCE         0
63
+  #define I2CPE_REPORT_STRENGTH         1
64
+  #define I2CPE_REPORT_VERSION          2
65
+
66
+  // Default I2C addresses
67
+  #define I2CPE_PRESET_ADDR_X           30
68
+  #define I2CPE_PRESET_ADDR_Y           31
69
+  #define I2CPE_PRESET_ADDR_Z           32
70
+  #define I2CPE_PRESET_ADDR_E           33
71
+
72
+  #define I2CPE_DEF_AXIS                X_AXIS
73
+  #define I2CPE_DEF_ADDR                I2CPE_PRESET_ADDR_X
74
+
75
+  // Error event counter; tracks how many times there is an error exceeding a certain threshold
76
+  #define I2CPE_ERR_CNT_THRESH          3.00
77
+  #define I2CPE_ERR_CNT_DEBOUNCE_MS     2000
78
+
79
+  #if ENABLED(I2CPE_ERR_ROLLING_AVERAGE)
80
+    #define I2CPE_ERR_ARRAY_SIZE        32
81
+  #endif
82
+
83
+  // Error Correction Methods
84
+  #define I2CPE_ECM_NONE                0
85
+  #define I2CPE_ECM_MICROSTEP           1
86
+  #define I2CPE_ECM_PLANNER             2
87
+  #define I2CPE_ECM_STALLDETECT         3
88
+
89
+  // Encoder types
90
+  #define I2CPE_ENC_TYPE_ROTARY         0
91
+  #define I2CPE_ENC_TYPE_LINEAR         1
92
+
93
+  // Parser
94
+  #define I2CPE_PARSE_ERR               1
95
+  #define I2CPE_PARSE_OK                0
96
+
97
+  #define LOOP_PE(VAR) LOOP_L_N(VAR, I2CPE_ENCODER_CNT)
98
+  #define CHECK_IDX() do{ if (!WITHIN(idx, 0, I2CPE_ENCODER_CNT - 1)) return; }while(0)
99
+
100
+  extern const char axis_codes[XYZE];
101
+
102
+  typedef union {
103
+    volatile int32_t val = 0;
104
+    uint8_t          bval[4];
105
+  } i2cLong;
106
+
107
+  class I2CPositionEncoder {
108
+  private:
109
+    AxisEnum  encoderAxis         = I2CPE_DEF_AXIS;
110
+
111
+    uint8_t   i2cAddress          = I2CPE_DEF_ADDR,
112
+              ecMethod            = I2CPE_DEF_EC_METHOD,
113
+              type                = I2CPE_DEF_TYPE,
114
+              H                   = I2CPE_MAG_SIG_NF;    // Magnetic field strength
115
+
116
+    int       encoderTicksPerUnit = I2CPE_DEF_ENC_TICKS_UNIT,
117
+              stepperTicks        = I2CPE_DEF_TICKS_REV,
118
+              errorCount          = 0,
119
+              errorPrev           = 0;
120
+
121
+    float     ecThreshold         = I2CPE_DEF_EC_THRESH;
122
+
123
+    bool      homed               = false,
124
+              trusted             = false,
125
+              initialised         = false,
126
+              active              = false,
127
+              invert              = false,
128
+              ec                  = true;
129
+
130
+    float     axisOffset          = 0;
131
+
132
+    int32_t   axisOffsetTicks     = 0,
133
+              zeroOffset          = 0,
134
+              lastPosition        = 0,
135
+              position;
136
+
137
+    millis_t  lastPositionTime    = 0,
138
+              nextErrorCountTime  = 0,
139
+              lastErrorTime;
140
+
141
+    //double        positionMm; //calculate
142
+
143
+    #if ENABLED(I2CPE_ERR_ROLLING_AVERAGE)
144
+      uint8_t errIdx = 0;
145
+      int     err[I2CPE_ERR_ARRAY_SIZE] = { 0 };
146
+    #endif
147
+
148
+    //float        positionMm; //calculate
149
+
150
+  public:
151
+    void init(const uint8_t address, const AxisEnum axis);
152
+    void reset();
153
+
154
+    void update();
155
+
156
+    void set_homed();
157
+
158
+    int32_t get_raw_count();
159
+
160
+    FORCE_INLINE float mm_from_count(const int32_t count) {
161
+      switch (type) {
162
+        default: return -1;
163
+        case I2CPE_ENC_TYPE_LINEAR:
164
+          return count / encoderTicksPerUnit;
165
+        case I2CPE_ENC_TYPE_ROTARY:
166
+          return (count * stepperTicks) / (encoderTicksPerUnit * planner.axis_steps_per_mm[encoderAxis]);
167
+      }
168
+    }
169
+
170
+    FORCE_INLINE float get_position_mm() { return mm_from_count(get_position()); }
171
+    FORCE_INLINE int32_t get_position() { return get_raw_count() - zeroOffset - axisOffsetTicks; }
172
+
173
+    int32_t get_axis_error_steps(const bool report);
174
+    float get_axis_error_mm(const bool report);
175
+
176
+    void calibrate_steps_mm(const uint8_t iter);
177
+
178
+    bool passes_test(const bool report);
179
+
180
+    bool test_axis(void);
181
+
182
+    FORCE_INLINE int get_error_count(void) { return errorCount; }
183
+    FORCE_INLINE void set_error_count(const int newCount) { errorCount = newCount; }
184
+
185
+    FORCE_INLINE uint8_t get_address() { return i2cAddress; }
186
+    FORCE_INLINE void set_address(const uint8_t addr) { i2cAddress = addr; }
187
+
188
+    FORCE_INLINE bool get_active(void) { return active; }
189
+    FORCE_INLINE void set_active(const bool a) { active = a; }
190
+
191
+    FORCE_INLINE void set_inverted(const bool i) { invert = i; }
192
+
193
+    FORCE_INLINE AxisEnum get_axis() { return encoderAxis; }
194
+
195
+    FORCE_INLINE bool get_ec_enabled() { return ec; }
196
+    FORCE_INLINE void set_ec_enabled(const bool enabled) { ec = enabled; }
197
+
198
+    FORCE_INLINE uint8_t get_ec_method() { return ecMethod; }
199
+    FORCE_INLINE void set_ec_method(const byte method) { ecMethod = method; }
200
+
201
+    FORCE_INLINE float get_ec_threshold() { return ecThreshold; }
202
+    FORCE_INLINE void set_ec_threshold(const float newThreshold) { ecThreshold = newThreshold; }
203
+
204
+    FORCE_INLINE int get_encoder_ticks_mm() {
205
+      switch (type) {
206
+        default: return 0;
207
+        case I2CPE_ENC_TYPE_LINEAR:
208
+          return encoderTicksPerUnit;
209
+        case I2CPE_ENC_TYPE_ROTARY:
210
+          return (int)((encoderTicksPerUnit / stepperTicks) * planner.axis_steps_per_mm[encoderAxis]);
211
+      }
212
+    }
213
+
214
+    FORCE_INLINE int get_ticks_unit() { return encoderTicksPerUnit; }
215
+    FORCE_INLINE void set_ticks_unit(const int ticks) { encoderTicksPerUnit = ticks; }
216
+
217
+    FORCE_INLINE uint8_t get_type() { return type; }
218
+    FORCE_INLINE void set_type(const byte newType) { type = newType; }
219
+
220
+    FORCE_INLINE int get_stepper_ticks() { return stepperTicks; }
221
+    FORCE_INLINE void set_stepper_ticks(const int ticks) { stepperTicks = ticks; }
222
+
223
+    FORCE_INLINE float get_axis_offset() { return axisOffset; }
224
+    FORCE_INLINE void set_axis_offset(const float newOffset) {
225
+      axisOffset = newOffset;
226
+      axisOffsetTicks = int32_t(axisOffset * get_encoder_ticks_mm());
227
+    }
228
+
229
+    FORCE_INLINE void set_current_position(const float newPositionMm) {
230
+      set_axis_offset(get_position_mm() - newPositionMm + axisOffset);
231
+    }
232
+  };
233
+
234
+  class I2CPositionEncodersMgr {
235
+  private:
236
+    static bool I2CPE_anyaxis;
237
+    static uint8_t I2CPE_addr, I2CPE_idx;
238
+
239
+  public:
240
+
241
+    static void init(void);
242
+
243
+    // consider only updating one endoder per call / tick if encoders become too time intensive
244
+    static void update(void) { LOOP_PE(i) encoders[i].update(); }
245
+
246
+    static void homed(const AxisEnum axis) {
247
+      LOOP_PE(i)
248
+        if (encoders[i].get_axis() == axis) encoders[i].set_homed();
249
+    }
250
+
251
+    static void report_position(const int8_t idx, const bool units, const bool noOffset);
252
+
253
+    static void report_status(const int8_t idx) {
254
+      CHECK_IDX();
255
+      SERIAL_ECHOPAIR("Encoder ",idx);
256
+      SERIAL_ECHOPGM(": ");
257
+      encoders[idx].get_raw_count();
258
+      encoders[idx].passes_test(true);
259
+    }
260
+
261
+    static void report_error(const int8_t idx) {
262
+      CHECK_IDX();
263
+      encoders[idx].get_axis_error_steps(true);
264
+    }
265
+
266
+    static void test_axis(const int8_t idx) {
267
+      CHECK_IDX();
268
+      encoders[idx].test_axis();
269
+    }
270
+
271
+    static void calibrate_steps_mm(const int8_t idx, const int iterations) {
272
+      CHECK_IDX();
273
+      encoders[idx].calibrate_steps_mm(iterations);
274
+    }
275
+
276
+    static void change_module_address(const uint8_t oldaddr, const uint8_t newaddr);
277
+    static void report_module_firmware(const uint8_t address);
278
+
279
+    static void report_error_count(const int8_t idx, const AxisEnum axis) {
280
+      CHECK_IDX();
281
+      SERIAL_ECHOPAIR("Error count on ", axis_codes[axis]);
282
+      SERIAL_ECHOLNPAIR(" axis is ", encoders[idx].get_error_count());
283
+    }
284
+
285
+    static void reset_error_count(const int8_t idx, const AxisEnum axis) {
286
+      CHECK_IDX();
287
+      encoders[idx].set_error_count(0);
288
+      SERIAL_ECHOPAIR("Error count on ", axis_codes[axis]);
289
+      SERIAL_ECHOLNPGM(" axis has been reset.");
290
+    }
291
+
292
+    static void enable_ec(const int8_t idx, const bool enabled, const AxisEnum axis) {
293
+      CHECK_IDX();
294
+      encoders[idx].set_ec_enabled(enabled);
295
+      SERIAL_ECHOPAIR("Error correction on ", axis_codes[axis]);
296
+      SERIAL_ECHOPGM(" axis is ");
297
+      serialprintPGM(encoders[idx].get_ec_enabled() ? PSTR("en") : PSTR("dis"));
298
+      SERIAL_ECHOLNPGM("abled.");
299
+    }
300
+
301
+    static void set_ec_threshold(const int8_t idx, const float newThreshold, const AxisEnum axis) {
302
+      CHECK_IDX();
303
+      encoders[idx].set_ec_threshold(newThreshold);
304
+      SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
305
+      SERIAL_ECHOPAIR_F(" axis set to ", newThreshold);
306
+      SERIAL_ECHOLNPGM("mm.");
307
+    }
308
+
309
+    static void get_ec_threshold(const int8_t idx, const AxisEnum axis) {
310
+      CHECK_IDX();
311
+      const float threshold = encoders[idx].get_ec_threshold();
312
+      SERIAL_ECHOPAIR("Error correct threshold for ", axis_codes[axis]);
313
+      SERIAL_ECHOPAIR_F(" axis is ", threshold);
314
+      SERIAL_ECHOLNPGM("mm.");
315
+    }
316
+
317
+    static int8_t idx_from_axis(const AxisEnum axis) {
318
+      LOOP_PE(i)
319
+        if (encoders[i].get_axis() == axis) return i;
320
+      return -1;
321
+    }
322
+
323
+    static int8_t idx_from_addr(const uint8_t addr) {
324
+      LOOP_PE(i)
325
+        if (encoders[i].get_address() == addr) return i;
326
+      return -1;
327
+    }
328
+
329
+    static int8_t parse();
330
+
331
+    static void M860();
332
+    static void M861();
333
+    static void M862();
334
+    static void M863();
335
+    static void M864();
336
+    static void M865();
337
+    static void M866();
338
+    static void M867();
339
+    static void M868();
340
+    static void M869();
341
+
342
+    static I2CPositionEncoder encoders[I2CPE_ENCODER_CNT];
343
+  };
344
+
345
+  extern I2CPositionEncodersMgr I2CPEM;
346
+
347
+  FORCE_INLINE static void gcode_M860() { I2CPEM.M860(); }
348
+  FORCE_INLINE static void gcode_M861() { I2CPEM.M861(); }
349
+  FORCE_INLINE static void gcode_M862() { I2CPEM.M862(); }
350
+  FORCE_INLINE static void gcode_M863() { I2CPEM.M863(); }
351
+  FORCE_INLINE static void gcode_M864() { I2CPEM.M864(); }
352
+  FORCE_INLINE static void gcode_M865() { I2CPEM.M865(); }
353
+  FORCE_INLINE static void gcode_M866() { I2CPEM.M866(); }
354
+  FORCE_INLINE static void gcode_M867() { I2CPEM.M867(); }
355
+  FORCE_INLINE static void gcode_M868() { I2CPEM.M868(); }
356
+  FORCE_INLINE static void gcode_M869() { I2CPEM.M869(); }
357
+
358
+#endif //I2C_POSITION_ENCODERS
359
+#endif //I2CPOSENC_H

+ 268
- 183
Marlin/M100_Free_Mem_Chk.cpp Wyświetl plik

22
 
22
 
23
 /**
23
 /**
24
  * M100 Free Memory Watcher
24
  * M100 Free Memory Watcher
25
- * 
25
+ *
26
  * This code watches the free memory block between the bottom of the heap and the top of the stack.
26
  * This code watches the free memory block between the bottom of the heap and the top of the stack.
27
  * This memory block is initialized and watched via the M100 command.
27
  * This memory block is initialized and watched via the M100 command.
28
- * 
29
- * M100 I Initializes the free memory block and prints vitals statistics about the area
30
- * M100 F Identifies how much of the free memory block remains free and unused.  It also
31
- *    detects and reports any corruption within the free memory block that may have
32
- *    happened due to errant firmware.
33
- * M100 D Does a hex display of the free memory block along with a flag for any errant
34
- *    data that does not match the expected value.
35
- * M100 C x Corrupts x locations within the free memory block.   This is useful to check the
36
- *    correctness of the M100 F and M100 D commands.
37
- * 
38
- * Initial version by Roxy-3DPrintBoard
28
+ *
29
+ * M100 I   Initializes the free memory block and prints vitals statistics about the area
30
+ *
31
+ * M100 F   Identifies how much of the free memory block remains free and unused. It also
32
+ *          detects and reports any corruption within the free memory block that may have
33
+ *          happened due to errant firmware.
34
+ *
35
+ * M100 D   Does a hex display of the free memory block along with a flag for any errant
36
+ *          data that does not match the expected value.
37
+ *
38
+ * M100 C x Corrupts x locations within the free memory block. This is useful to check the
39
+ *          correctness of the M100 F and M100 D commands.
40
+ *
41
+ * Also, there are two support functions that can be called from a developer's C code.
42
+ *
43
+ *    uint16_t check_for_free_memory_corruption(const char * const ptr);
44
+ *    void M100_dump_routine(const char * const title, const char *start, const char *end);
45
+ *
46
+ * Initial version by Roxy-3D
39
  */
47
  */
40
-#define M100_FREE_MEMORY_DUMPER     // Comment out to remove Dump sub-command
41
-#define M100_FREE_MEMORY_CORRUPTOR    // Comment out to remove Corrupt sub-command
48
+#define M100_FREE_MEMORY_DUMPER     // Enable for the `M110 D` Dump sub-command
49
+#define M100_FREE_MEMORY_CORRUPTOR  // Enable for the `M100 C` Corrupt sub-command
42
 
50
 
43
-#include "Marlin.h"
51
+#include "MarlinConfig.h"
44
 
52
 
45
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
53
 #if ENABLED(M100_FREE_MEMORY_WATCHER)
54
+
55
+#define TEST_BYTE ((char) 0xE5)
56
+
57
+extern char command_queue[BUFSIZE][MAX_CMD_SIZE];
58
+
46
 extern char* __brkval;
59
 extern char* __brkval;
47
 extern size_t  __heap_start, __heap_end, __flp;
60
 extern size_t  __heap_start, __heap_end, __flp;
48
 extern char __bss_end;
61
 extern char __bss_end;
49
 
62
 
63
+#include "Marlin.h"
64
+#include "gcode.h"
65
+#include "hex_print_routines.h"
66
+
50
 //
67
 //
51
-// Utility functions used by M100 to get its work done.
68
+// Utility functions
52
 //
69
 //
53
 
70
 
54
-char* top_of_stack();
55
-void prt_hex_nibble(unsigned int);
56
-void prt_hex_byte(unsigned int);
57
-void prt_hex_word(unsigned int);
58
-int how_many_E5s_are_here(char*);
71
+#define END_OF_HEAP() (__brkval ? __brkval : &__bss_end)
72
+int check_for_free_memory_corruption(const char * const title);
59
 
73
 
60
-void gcode_M100() {
61
-  static bool m100_not_initialized = true;
62
-  char* sp, *ptr;
63
-  int i, j, n;
64
-  //
65
-  // M100 D dumps the free memory block from __brkval to the stack pointer.
66
-  // malloc() eats memory from the start of the block and the stack grows
67
-  // up from the bottom of the block.    Solid 0xE5's indicate nothing has
68
-  // used that memory yet.   There should not be anything but 0xE5's within
69
-  // the block of 0xE5's.  If there is, that would indicate memory corruption
70
-  // probably caused by bad pointers.  Any unexpected values will be flagged in
71
-  // the right hand column to help spotting them.
72
-  //
73
-  #if ENABLED(M100_FREE_MEMORY_DUMPER) // Disable to remove Dump sub-command
74
-    if (code_seen('D')) {
75
-      ptr = __brkval ? __brkval : &__bss_end;
76
-      //
77
-      // We want to start and end the dump on a nice 16 byte boundry even though
78
-      // the values we are using are not 16 byte aligned.
79
-      //
80
-      SERIAL_ECHOPGM("\nbss_end : ");
81
-      prt_hex_word((unsigned int) ptr);
82
-      ptr = (char*)((unsigned long) ptr & 0xfff0);
83
-      sp = top_of_stack();
84
-      SERIAL_ECHOPGM("\nStack Pointer : ");
85
-      prt_hex_word((unsigned int) sp);
86
-      SERIAL_EOL;
87
-      sp = (char*)((unsigned long) sp | 0x000f);
88
-      n = sp - ptr;
89
-      //
90
-      // This is the main loop of the Dump command.
91
-      //
92
-      while (ptr < sp) {
93
-        prt_hex_word((unsigned int) ptr); // Print the address
94
-        SERIAL_CHAR(':');
95
-        for (i = 0; i < 16; i++) {      // and 16 data bytes
96
-          prt_hex_byte(*(ptr + i));
97
-          SERIAL_CHAR(' ');
74
+// Location of a variable on its stack frame. Returns a value above
75
+// the stack (once the function returns to the caller).
76
+char* top_of_stack() {
77
+  char x;
78
+  return &x + 1; // x is pulled on return;
79
+}
80
+
81
+// Count the number of test bytes at the specified location.
82
+int16_t count_test_bytes(const char * const ptr) {
83
+  for (uint16_t i = 0; i < 32000; i++)
84
+    if (((char) ptr[i]) != TEST_BYTE)
85
+      return i - 1;
86
+
87
+  return -1;
88
+}
89
+
90
+//
91
+// M100 sub-commands
92
+//
93
+
94
+#if ENABLED(M100_FREE_MEMORY_DUMPER)
95
+  /**
96
+   * M100 D
97
+   *  Dump the free memory block from __brkval to the stack pointer.
98
+   *  malloc() eats memory from the start of the block and the stack grows
99
+   *  up from the bottom of the block. Solid test bytes indicate nothing has
100
+   *  used that memory yet. There should not be anything but test bytes within
101
+   *  the block. If so, it may indicate memory corruption due to a bad pointer.
102
+   *  Unexpected bytes are flagged in the right column.
103
+   */
104
+  void dump_free_memory(const char *ptr, const char *sp) {
105
+    //
106
+    // Start and end the dump on a nice 16 byte boundary
107
+    // (even though the values are not 16-byte aligned).
108
+    //
109
+    ptr = (char *)((uint16_t)ptr & 0xFFF0); // Align to 16-byte boundary
110
+    sp  = (char *)((uint16_t)sp  | 0x000F); // Align sp to the 15th byte (at or above sp)
111
+
112
+    // Dump command main loop
113
+    while (ptr < sp) {
114
+      print_hex_word((uint16_t)ptr);      // Print the address
115
+      SERIAL_CHAR(':');
116
+      for (uint8_t i = 0; i < 16; i++) {  // and 16 data bytes
117
+        if (i == 8) SERIAL_CHAR('-');
118
+        print_hex_byte(ptr[i]);
119
+        SERIAL_CHAR(' ');
120
+      }
121
+      safe_delay(25);
122
+      SERIAL_CHAR('|');                   // Point out non test bytes
123
+      for (uint8_t i = 0; i < 16; i++) {
124
+        char ccc = (char)ptr[i]; // cast to char before automatically casting to char on assignment, in case the compiler is broken
125
+        if (&ptr[i] >= (const char*)command_queue && &ptr[i] < (const char*)(command_queue + sizeof(command_queue))) { // Print out ASCII in the command buffer area
126
+          if (!WITHIN(ccc, ' ', 0x7E)) ccc = ' ';
98
         }
127
         }
99
-        SERIAL_CHAR('|');         // now show where non 0xE5's are
100
-        for (i = 0; i < 16; i++) {
101
-          if (*(ptr + i) == (char)0xe5)
102
-            SERIAL_CHAR(' ');
103
-          else
104
-            SERIAL_CHAR('?');
128
+        else { // If not in the command buffer area, flag bytes that don't match the test byte
129
+          ccc = (ccc == TEST_BYTE) ? ' ' : '?';
105
         }
130
         }
106
-        SERIAL_EOL;
107
-        ptr += 16;
131
+        SERIAL_CHAR(ccc);
108
       }
132
       }
109
-      return;
133
+      SERIAL_EOL();
134
+      ptr += 16;
135
+      safe_delay(25);
136
+      idle();
110
     }
137
     }
111
-  #endif
138
+  }
139
+
140
+void M100_dump_routine(const char * const title, const char *start, const char *end) {
141
+  SERIAL_ECHOLN(title);
112
   //
142
   //
113
-  // M100 F   requests the code to return the number of free bytes in the memory pool along with
114
-  // other vital statistics that define the memory pool.
143
+  // Round the start and end locations to produce full lines of output
115
   //
144
   //
116
-  if (code_seen('F')) {
117
-    #if 0
118
-      int max_addr = (int)  __brkval ? __brkval : &__bss_end;
119
-      int max_cnt = 0;
120
-    #endif
121
-    int block_cnt = 0;
122
-    ptr =  __brkval ? __brkval : &__bss_end;
123
-    sp = top_of_stack();
124
-    n = sp - ptr;
125
-    // Scan through the range looking for the biggest block of 0xE5's we can find
126
-    for (i = 0; i < n; i++) {
127
-      if (*(ptr + i) == (char)0xe5) {
128
-        j = how_many_E5s_are_here(ptr + i);
129
-        if (j > 8) {
130
-          SERIAL_ECHOPAIR("Found ", j);
131
-          SERIAL_ECHOPGM(" bytes free at 0x");
132
-          prt_hex_word((int) ptr + i);
133
-          SERIAL_EOL;
134
-          i += j;
135
-          block_cnt++;
145
+  start = (char*)((uint16_t) start & 0xFFF0);
146
+  end   = (char*)((uint16_t) end   | 0x000F);
147
+  dump_free_memory(start, end);
148
+}
149
+
150
+#endif // M100_FREE_MEMORY_DUMPER
151
+
152
+/**
153
+ * M100 F
154
+ *  Return the number of free bytes in the memory pool,
155
+ *  with other vital statistics defining the pool.
156
+ */
157
+void free_memory_pool_report(char * const ptr, const int16_t size) {
158
+  int16_t max_cnt = -1, block_cnt = 0;
159
+  char *max_addr = NULL;
160
+  // Find the longest block of test bytes in the buffer
161
+  for (int16_t i = 0; i < size; i++) {
162
+    char *addr = ptr + i;
163
+    if (*addr == TEST_BYTE) {
164
+      const int16_t j = count_test_bytes(addr);
165
+      if (j > 8) {
166
+        SERIAL_ECHOPAIR("Found ", j);
167
+        SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(addr));
168
+        if (j > max_cnt) {
169
+          max_cnt  = j;
170
+          max_addr = addr;
136
         }
171
         }
137
-        #if 0
138
-          if (j > max_cnt) {      // We don't do anything with this information yet
139
-            max_cnt  = j;     // but we do know where the biggest free memory block is.
140
-            max_addr = (int) ptr + i;
141
-          }
142
-        #endif
172
+        i += j;
173
+        block_cnt++;
143
       }
174
       }
144
     }
175
     }
145
-    if (block_cnt > 1)
146
-      SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
147
-    return;
148
   }
176
   }
149
-  //
150
-  // M100 C x  Corrupts x locations in the free memory pool and reports the locations of the corruption.
151
-  // This is useful to check the correctness of the M100 D and the M100 F commands.
152
-  //
153
-  #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
154
-    if (code_seen('C')) {
155
-      int x = code_value_int(); // x gets the # of locations to corrupt within the memory pool
156
-      SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
157
-      ptr = __brkval ? __brkval : &__bss_end;
158
-      SERIAL_ECHOPAIR("\nbss_end : ", ptr);
159
-      ptr += 8;
160
-      sp = top_of_stack();
161
-      SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
162
-      SERIAL_ECHOLNPGM("\n");
163
-      n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
164
-      // has altered the stack.
165
-      j = n / (x + 1);
166
-      for (i = 1; i <= x; i++) {
167
-        *(ptr + (i * j)) = i;
168
-        SERIAL_ECHOPGM("\nCorrupting address: 0x");
169
-        prt_hex_word((unsigned int)(ptr + (i * j)));
170
-      }
171
-      SERIAL_ECHOLNPGM("\n");
172
-      return;
173
-    }
174
-  #endif
175
-  //
176
-  // M100 I    Initializes the free memory pool so it can be watched and prints vital
177
-  // statistics that define the free memory pool.
178
-  //
179
-  if (m100_not_initialized || code_seen('I')) {            // If no sub-command is specified, the first time
180
-    SERIAL_ECHOLNPGM("Initializing free memory block.\n"); // this happens, it will Initialize.
181
-    ptr = __brkval ? __brkval : &__bss_end;                // Repeated M100 with no sub-command will not destroy the
182
-    SERIAL_ECHOPAIR("\nbss_end : ", ptr);                  // state of the initialized free memory pool.
177
+  if (block_cnt > 1) {
178
+    SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
179
+    SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
180
+    SERIAL_ECHOLNPAIR(" bytes at ", hex_address(max_addr));
181
+  }
182
+  SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption("M100 F "));
183
+}
184
+
185
+#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
186
+  /**
187
+   * M100 C<num>
188
+   *  Corrupt <num> locations in the free memory pool and report the corrupt addresses.
189
+   *  This is useful to check the correctness of the M100 D and the M100 F commands.
190
+   */
191
+  void corrupt_free_memory(char *ptr, const uint16_t size) {
183
     ptr += 8;
192
     ptr += 8;
184
-    sp = top_of_stack();
185
-    SERIAL_ECHOPAIR("\nStack Pointer : ", sp);
186
-    SERIAL_ECHOLNPGM("\n");
187
-    n = sp - ptr - 64;    // -64 just to keep us from finding interrupt activity that
188
-    // has altered the stack.
189
-    SERIAL_ECHO(n);
190
-    SERIAL_ECHOLNPGM(" bytes of memory initialized.\n");
191
-    for (i = 0; i < n; i++)
192
-      *(ptr + i) = (char)0xe5;
193
-    for (i = 0; i < n; i++) {
194
-      if (*(ptr + i) != (char)0xe5) {
195
-        SERIAL_ECHOPAIR("? address : ", ptr + i);
196
-        SERIAL_ECHOPAIR("=", *(ptr + i));
197
-        SERIAL_ECHOLNPGM("\n");
198
-      }
193
+    const uint16_t near_top = top_of_stack() - ptr - 250, // -250 to avoid interrupt activity that's altered the stack.
194
+                   j = near_top / (size + 1);
195
+
196
+    SERIAL_ECHOLNPGM("Corrupting free memory block.\n");
197
+    for (uint16_t i = 1; i <= size; i++) {
198
+      char * const addr = ptr + i * j;
199
+      *addr = i;
200
+      SERIAL_ECHOPAIR("\nCorrupting address: ", hex_address(addr));
199
     }
201
     }
200
-    m100_not_initialized = false;
202
+    SERIAL_EOL();
203
+  }
204
+#endif // M100_FREE_MEMORY_CORRUPTOR
205
+
206
+/**
207
+ * M100 I
208
+ *  Init memory for the M100 tests. (Automatically applied on the first M100.)
209
+ */
210
+void init_free_memory(char *ptr, int16_t size) {
211
+  SERIAL_ECHOLNPGM("Initializing free memory block.\n\n");
212
+
213
+  size -= 250;    // -250 to avoid interrupt activity that's altered the stack.
214
+  if (size < 0) {
215
+    SERIAL_ECHOLNPGM("Unable to initialize.\n");
201
     return;
216
     return;
202
   }
217
   }
203
-  return;
204
-}
205
 
218
 
206
-// top_of_stack() returns the location of a variable on its stack frame.  The value returned is above
207
-// the stack once the function returns to the caller.
219
+  ptr += 8;       // move a few bytes away from the heap just because we don't want
220
+                  // to be altering memory that close to it.
221
+  memset(ptr, TEST_BYTE, size);
208
 
222
 
209
-char* top_of_stack() {
210
-  char x;
211
-  return &x + 1; // x is pulled on return;
223
+  SERIAL_ECHO(size);
224
+  SERIAL_ECHOLNPGM(" bytes of memory initialized.\n");
225
+
226
+  for (int16_t i = 0; i < size; i++) {
227
+    if (ptr[i] != TEST_BYTE) {
228
+      SERIAL_ECHOPAIR("? address : ", hex_address(ptr + i));
229
+      SERIAL_ECHOLNPAIR("=", hex_byte(ptr[i]));
230
+      SERIAL_EOL();
231
+    }
232
+  }
212
 }
233
 }
213
 
234
 
214
-//
215
-// 3 support routines to print hex numbers.  We can print a nibble, byte and word
216
-//
235
+/**
236
+ * M100: Free Memory Check
237
+ */
238
+void gcode_M100() {
239
+  SERIAL_ECHOPAIR("\n__brkval : ", hex_address(__brkval));
240
+  SERIAL_ECHOPAIR("\n__bss_end : ", hex_address(&__bss_end));
217
 
241
 
218
-void prt_hex_nibble(unsigned int n) {
219
-  if (n <= 9)
220
-    SERIAL_ECHO(n);
221
-  else
222
-    SERIAL_ECHO((char)('A' + n - 10));
223
-}
242
+  char *ptr = END_OF_HEAP(), *sp = top_of_stack();
224
 
243
 
225
-void prt_hex_byte(unsigned int b) {
226
-  prt_hex_nibble((b & 0xf0) >> 4);
227
-  prt_hex_nibble(b & 0x0f);
228
-}
244
+  SERIAL_ECHOPAIR("\nstart of free space : ", hex_address(ptr));
245
+  SERIAL_ECHOLNPAIR("\nStack Pointer : ", hex_address(sp));
246
+
247
+  // Always init on the first invocation of M100
248
+  static bool m100_not_initialized = true;
249
+  if (m100_not_initialized || parser.seen('I')) {
250
+    m100_not_initialized = false;
251
+    init_free_memory(ptr, sp - ptr);
252
+  }
229
 
253
 
230
-void prt_hex_word(unsigned int w) {
231
-  prt_hex_byte((w & 0xff00) >> 8);
232
-  prt_hex_byte(w & 0x0ff);
254
+  #if ENABLED(M100_FREE_MEMORY_DUMPER)
255
+    if (parser.seen('D'))
256
+      return dump_free_memory(ptr, sp);
257
+  #endif
258
+
259
+  if (parser.seen('F'))
260
+    return free_memory_pool_report(ptr, sp - ptr);
261
+
262
+  #if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
263
+
264
+    if (parser.seen('C'))
265
+      return corrupt_free_memory(ptr, parser.value_int());
266
+
267
+  #endif
233
 }
268
 }
234
 
269
 
235
-// how_many_E5s_are_here() is a utility function to easily find out how many 0xE5's are
236
-// at the specified location.  Having this logic as a function simplifies the search code.
237
-//
238
-int how_many_E5s_are_here(char* p) {
239
-  int n;
240
-  for (n = 0; n < 32000; n++) {
241
-    if (*(p + n) != (char)0xe5)
242
-      return n - 1;
270
+int check_for_free_memory_corruption(const char * const title) {
271
+  SERIAL_ECHO(title);
272
+
273
+  char *ptr = END_OF_HEAP(), *sp = top_of_stack();
274
+  int n = sp - ptr;
275
+
276
+  SERIAL_ECHOPAIR("\nfmc() n=", n);
277
+  SERIAL_ECHOPAIR("\n&__brkval: ", hex_address(&__brkval));
278
+  SERIAL_ECHOPAIR("=",             hex_address(__brkval));
279
+  SERIAL_ECHOPAIR("\n__bss_end: ", hex_address(&__bss_end));
280
+  SERIAL_ECHOPAIR(" sp=",          hex_address(sp));
281
+
282
+  if (sp < ptr)  {
283
+    SERIAL_ECHOPGM(" sp < Heap ");
284
+    // SET_INPUT_PULLUP(63);           // if the developer has a switch wired up to their controller board
285
+    // safe_delay(5);                  // this code can be enabled to pause the display as soon as the
286
+    // while ( READ(63))               // malfunction is detected.   It is currently defaulting to a switch
287
+    //   idle();                       // being on pin-63 which is unassigend and available on most controller
288
+    // safe_delay(20);                 // boards.
289
+    // while ( !READ(63))
290
+    //   idle();
291
+    safe_delay(20);
292
+    #ifdef M100_FREE_MEMORY_DUMPER
293
+      M100_dump_routine("   Memory corruption detected with sp<Heap\n", (char*)0x1B80, (char*)0x21FF);
294
+    #endif
243
   }
295
   }
244
-  return -1;
296
+
297
+  // Scan through the range looking for the biggest block of 0xE5's we can find
298
+  int block_cnt = 0;
299
+  for (int i = 0; i < n; i++) {
300
+    if (ptr[i] == TEST_BYTE) {
301
+      int16_t j = count_test_bytes(ptr + i);
302
+      if (j > 8) {
303
+        // SERIAL_ECHOPAIR("Found ", j);
304
+        // SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(ptr + i));
305
+        i += j;
306
+        block_cnt++;
307
+        SERIAL_ECHOPAIR(" (", block_cnt);
308
+        SERIAL_ECHOPAIR(") found=", j);
309
+        SERIAL_ECHOPGM("   ");
310
+      }
311
+    }
312
+  }
313
+  SERIAL_ECHOPAIR("  block_found=", block_cnt);
314
+
315
+  if (block_cnt != 1 || __brkval != 0x0000)
316
+    SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
317
+
318
+  if (block_cnt == 0)       // Make sure the special case of no free blocks shows up as an
319
+    block_cnt = -1;         // error to the calling code!
320
+
321
+  SERIAL_ECHOPGM(" return=");
322
+  if (block_cnt == 1) {
323
+    SERIAL_CHAR('0');       // if the block_cnt is 1, nothing has broken up the free memory
324
+    SERIAL_EOL();             // area and it is appropriate to say 'no corruption'.
325
+    return 0;
326
+  }
327
+  SERIAL_ECHOLNPGM("true");
328
+  return block_cnt;
245
 }
329
 }
246
 
330
 
247
-#endif
331
+#endif // M100_FREE_MEMORY_WATCHER
332
+
248
 
333
 

+ 42
- 45
Marlin/Makefile Wyświetl plik

33
 #  5. Type "make upload", reset your Arduino board, and press enter to
33
 #  5. Type "make upload", reset your Arduino board, and press enter to
34
 #     upload your program to the Arduino board.
34
 #     upload your program to the Arduino board.
35
 #
35
 #
36
-# Note that all settings are set with ?=, this means you can override them
37
-# from the commandline with "make HARDWARE_MOTHERBOARD=71" for example
36
+# Note that all settings at the top of this file can be overriden from
37
+# the command line with, for example, "make HARDWARE_MOTHERBOARD=71"
38
+#
39
+# To compile for RAMPS (atmega2560) with Arduino 1.6.9 at root/arduino you would use...
40
+#
41
+#   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
42
+#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino
43
+#
44
+# To compile and upload simply add "upload" to the end of the line...
45
+#
46
+#   make ARDUINO_VERSION=10609 AVR_TOOLS_PATH=/root/arduino/hardware/tools/avr/bin/ \
47
+#   HARDWARE_MOTHERBOARD=33 ARDUINO_INSTALL_DIR=/root/arduino upload
48
+#
49
+# If uploading doesn't work try adding the parameter "AVRDUDE_PROGRAMMER=wiring" or
50
+# start upload manually (using stk500) like so:
51
+#
52
+#   avrdude -C /root/arduino/hardware/tools/avr/etc/avrdude.conf -v -p m2560 -c stk500 \
53
+#   -U flash:w:applet/Marlin.hex:i -P /dev/ttyUSB0
54
+#
55
+# Or, try disconnecting USB to power down and then reconnecting before running avrdude.
56
+#
38
 
57
 
39
-# This defined the board you are compiling for (see boards.h for the options)
58
+# This defines the board to compile for (see boards.h for your board's ID)
40
 HARDWARE_MOTHERBOARD ?= 11
59
 HARDWARE_MOTHERBOARD ?= 11
41
 
60
 
42
 # Arduino source install directory, and version number
61
 # Arduino source install directory, and version number
50
 #Programmer configuration
69
 #Programmer configuration
51
 UPLOAD_RATE        ?= 57600
70
 UPLOAD_RATE        ?= 57600
52
 AVRDUDE_PROGRAMMER ?= arduino
71
 AVRDUDE_PROGRAMMER ?= arduino
53
-# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1 
72
+# on most linuxes this will be /dev/ttyACM0 or /dev/ttyACM1
54
 UPLOAD_PORT        ?= /dev/ttyUSB0
73
 UPLOAD_PORT        ?= /dev/ttyUSB0
55
 
74
 
56
 #Directory used to build files in, contains all the build files, from object files to the final hex file
75
 #Directory used to build files in, contains all the build files, from object files to the final hex file
228
 # Libraries, the "hardware variant" are for boards
247
 # Libraries, the "hardware variant" are for boards
229
 # that derives from that, and their source are present in
248
 # that derives from that, and their source are present in
230
 # the main Marlin source directory
249
 # the main Marlin source directory
231
-ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Sanguino))
232
-HARDWARE_DIR = $(ARDUINO_INSTALL_DIR)/hardware
233
-else
234
-ifeq ($(shell [ $(ARDUINO_VERSION) -ge 100 ] && echo true), true)
235
-HARDWARE_DIR = ../ArduinoAddons/Arduino_1.x.x
236
-else
237
-HARDWARE_DIR = ../ArduinoAddons/Arduino_0.xx
238
-endif
239
-endif
240
-HARDWARE_SRC = $(HARDWARE_DIR)/marlin/avr/cores/arduino
241
 
250
 
242
 TARGET = $(notdir $(CURDIR))
251
 TARGET = $(notdir $(CURDIR))
243
 
252
 
247
 
256
 
248
 VPATH = .
257
 VPATH = .
249
 VPATH += $(BUILD_DIR)
258
 VPATH += $(BUILD_DIR)
250
-VPATH += $(HARDWARE_SRC)
251
-ifeq ($(HARDWARE_VARIANT), $(filter $(HARDWARE_VARIANT),arduino Teensy Sanguino))
252
-VPATH += $(HARDWARE_DIR)/marlin/avr/libraries/LiquidCrystal/src
253
-VPATH += $(HARDWARE_DIR)/marlin/avr/libraries/SPI
259
+VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/cores/arduino
260
+
261
+VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI
262
+VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/libraries/SPI/src
263
+VPATH += $(ARDUINO_INSTALL_DIR)/libraries/LiquidCrystal/src
254
 ifeq ($(LIQUID_TWI2), 1)
264
 ifeq ($(LIQUID_TWI2), 1)
255
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
265
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
256
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
266
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
260
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
270
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire
261
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
271
 VPATH += $(ARDUINO_INSTALL_DIR)/libraries/Wire/utility
262
 endif
272
 endif
263
-else
264
-VPATH += $(HARDWARE_DIR)/libraries/LiquidCrystal
265
-VPATH += $(HARDWARE_DIR)/libraries/SPI
266
-ifeq ($(LIQUID_TWI2), 1)
267
-VPATH += $(HARDWARE_DIR)/libraries/Wire
268
-VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
269
-VPATH += $(HARDWARE_DIR)/libraries/LiquidTWI2
270
-endif
271
-ifeq ($(WIRE), 1)
272
-VPATH += $(HARDWARE_DIR)/libraries/Wire
273
-VPATH += $(HARDWARE_DIR)/libraries/Wire/utility
274
-endif
275
-endif
273
+
276
 ifeq ($(HARDWARE_VARIANT), arduino)
274
 ifeq ($(HARDWARE_VARIANT), arduino)
277
 HARDWARE_SUB_VARIANT ?= mega
275
 HARDWARE_SUB_VARIANT ?= mega
278
-VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/variants/$(HARDWARE_SUB_VARIANT)
276
+VPATH += $(ARDUINO_INSTALL_DIR)/hardware/arduino/avr/variants/$(HARDWARE_SUB_VARIANT)
279
 else
277
 else
280
 ifeq ($(HARDWARE_VARIANT), Sanguino)
278
 ifeq ($(HARDWARE_VARIANT), Sanguino)
281
 VPATH += $(HARDWARE_DIR)/marlin/avr/variants/sanguino
279
 VPATH += $(HARDWARE_DIR)/marlin/avr/variants/sanguino
292
 SRC = wiring.c
290
 SRC = wiring.c
293
 VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
291
 VPATH += $(ARDUINO_INSTALL_DIR)/hardware/teensy/cores/teensy
294
 endif
292
 endif
295
-CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp	\
296
-	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp	\
293
+CXXSRC = WMath.cpp WString.cpp Print.cpp Marlin_main.cpp \
294
+	MarlinSerial.cpp Sd2Card.cpp SdBaseFile.cpp SdFatUtil.cpp \
297
 	SdFile.cpp SdVolume.cpp planner.cpp stepper.cpp \
295
 	SdFile.cpp SdVolume.cpp planner.cpp stepper.cpp \
298
 	temperature.cpp cardreader.cpp configuration_store.cpp \
296
 	temperature.cpp cardreader.cpp configuration_store.cpp \
299
 	watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
297
 	watchdog.cpp SPI.cpp servo.cpp Tone.cpp ultralcd.cpp digipot_mcp4451.cpp \
300
-	dac_mcp4728.cpp vector_3.cpp qr_solve.cpp buzzer.cpp
298
+	dac_mcp4728.cpp vector_3.cpp qr_solve.cpp endstops.cpp stopwatch.cpp utility.cpp \
299
+	printcounter.cpp nozzle.cpp serial.cpp
301
 ifeq ($(LIQUID_TWI2), 0)
300
 ifeq ($(LIQUID_TWI2), 0)
302
 CXXSRC += LiquidCrystal.cpp
301
 CXXSRC += LiquidCrystal.cpp
303
 else
302
 else
357
 CINCS = ${addprefix -I ,${VPATH}}
356
 CINCS = ${addprefix -I ,${VPATH}}
358
 CXXINCS = ${addprefix -I ,${VPATH}}
357
 CXXINCS = ${addprefix -I ,${VPATH}}
359
 
358
 
360
-# Compiler flag to set the C Standard level.
361
-# c89   - "ANSI" C
362
-# gnu89 - c89 plus GCC extensions
363
-# c99   - ISO C99 standard (not yet fully implemented)
364
-# gnu99 - c99 plus GCC extensions
365
-#CSTANDARD = -std=gnu99
359
+# Compiler flag to set the C/CPP Standard level.
360
+CSTANDARD = -std=gnu99
361
+CXXSTANDARD = -std=gnu++11
366
 CDEBUG = -g$(DEBUG)
362
 CDEBUG = -g$(DEBUG)
367
 CWARN = -Wall -Wstrict-prototypes
363
 CWARN = -Wall -Wstrict-prototypes
368
 CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \
364
 CTUNING = -funsigned-char -funsigned-bitfields -fpack-struct \
369
 	-fshort-enums -w -ffunction-sections -fdata-sections \
365
 	-fshort-enums -w -ffunction-sections -fdata-sections \
366
+	-flto \
370
 	-DARDUINO=$(ARDUINO_VERSION)
367
 	-DARDUINO=$(ARDUINO_VERSION)
371
 ifneq ($(HARDWARE_MOTHERBOARD),)
368
 ifneq ($(HARDWARE_MOTHERBOARD),)
372
 CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
369
 CTUNING += -DMOTHERBOARD=${HARDWARE_MOTHERBOARD}
373
 endif
370
 endif
374
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
371
 #CEXTRA = -Wa,-adhlns=$(<:.c=.lst)
375
-CEXTRA = -fno-use-cxa-atexit
372
+CEXTRA = -fno-use-cxa-atexit -fno-threadsafe-statics
376
 
373
 
377
-CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING)
378
-CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING)
374
+CFLAGS := $(CDEBUG) $(CDEFS) $(CINCS) -O$(OPT) $(CWARN) $(CEXTRA) $(CTUNING) $(CSTANDARD)
375
+CXXFLAGS :=         $(CDEFS) $(CINCS) -O$(OPT) -Wall    $(CEXTRA) $(CTUNING) $(CXXSTANDARD)
379
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
376
 #ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs
380
 LDFLAGS = -lm
377
 LDFLAGS = -lm
381
 
378
 
490
 	# Link: create ELF output file from library.
487
 	# Link: create ELF output file from library.
491
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
488
 $(BUILD_DIR)/$(TARGET).elf: $(OBJ) Configuration.h
492
 	$(Pecho) "  CXX   $@"
489
 	$(Pecho) "  CXX   $@"
493
-	$P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections -o $@ -L. $(OBJ) $(LDFLAGS)
490
+	$P $(CC) $(ALL_CXXFLAGS) -Wl,--gc-sections,--relax -o $@ -L. $(OBJ) $(LDFLAGS)
494
 
491
 
495
 $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
492
 $(BUILD_DIR)/%.o: %.c Configuration.h Configuration_adv.h $(MAKEFILE)
496
 	$(Pecho) "  CC    $<"
493
 	$(Pecho) "  CC    $<"

+ 262
- 177
Marlin/Marlin.h Wyświetl plik

35
 
35
 
36
 #include "MarlinConfig.h"
36
 #include "MarlinConfig.h"
37
 
37
 
38
+#ifdef DEBUG_GCODE_PARSER
39
+  #include "gcode.h"
40
+#endif
41
+
38
 #include "enum.h"
42
 #include "enum.h"
39
 #include "types.h"
43
 #include "types.h"
40
 #include "fastio.h"
44
 #include "fastio.h"
41
 #include "utility.h"
45
 #include "utility.h"
42
-
43
-#ifdef USBCON
44
-  #include "HardwareSerial.h"
45
-  #if ENABLED(BLUETOOTH)
46
-    #define MYSERIAL bluetoothSerial
47
-  #else
48
-    #define MYSERIAL Serial
49
-  #endif // BLUETOOTH
50
-#else
51
-  #include "MarlinSerial.h"
52
-  #define MYSERIAL customizedSerial
53
-#endif
54
-
55
-#include "WString.h"
46
+#include "serial.h"
56
 
47
 
57
 #if ENABLED(PRINTCOUNTER)
48
 #if ENABLED(PRINTCOUNTER)
58
   #include "printcounter.h"
49
   #include "printcounter.h"
60
   #include "stopwatch.h"
51
   #include "stopwatch.h"
61
 #endif
52
 #endif
62
 
53
 
63
-#define SERIAL_CHAR(x) MYSERIAL.write(x)
64
-#define SERIAL_EOL SERIAL_CHAR('\n')
65
-
66
-#define SERIAL_PROTOCOLCHAR(x) SERIAL_CHAR(x)
67
-#define SERIAL_PROTOCOL(x) MYSERIAL.print(x)
68
-#define SERIAL_PROTOCOL_F(x,y) MYSERIAL.print(x,y)
69
-#define SERIAL_PROTOCOLPGM(x) serialprintPGM(PSTR(x))
70
-#define SERIAL_PROTOCOLLN(x) do{ MYSERIAL.print(x); SERIAL_EOL; }while(0)
71
-#define SERIAL_PROTOCOLLNPGM(x) do{ serialprintPGM(PSTR(x "\n")); }while(0)
72
-
73
-#define SERIAL_PROTOCOLPAIR(name, value) SERIAL_ECHOPAIR(name, value)
74
-
75
-extern const char errormagic[] PROGMEM;
76
-extern const char echomagic[] PROGMEM;
77
-
78
-#define SERIAL_ERROR_START serialprintPGM(errormagic)
79
-#define SERIAL_ERROR(x) SERIAL_PROTOCOL(x)
80
-#define SERIAL_ERRORPGM(x) SERIAL_PROTOCOLPGM(x)
81
-#define SERIAL_ERRORLN(x) SERIAL_PROTOCOLLN(x)
82
-#define SERIAL_ERRORLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
83
-
84
-#define SERIAL_ECHO_START serialprintPGM(echomagic)
85
-#define SERIAL_ECHO(x) SERIAL_PROTOCOL(x)
86
-#define SERIAL_ECHOPGM(x) SERIAL_PROTOCOLPGM(x)
87
-#define SERIAL_ECHOLN(x) SERIAL_PROTOCOLLN(x)
88
-#define SERIAL_ECHOLNPGM(x) SERIAL_PROTOCOLLNPGM(x)
89
-
90
-#define SERIAL_ECHOPAIR(name,value) (serial_echopair_P(PSTR(name),(value)))
91
-
92
-void serial_echopair_P(const char* s_P, char v);
93
-void serial_echopair_P(const char* s_P, int v);
94
-void serial_echopair_P(const char* s_P, long v);
95
-void serial_echopair_P(const char* s_P, float v);
96
-void serial_echopair_P(const char* s_P, double v);
97
-void serial_echopair_P(const char* s_P, unsigned long v);
98
-FORCE_INLINE void serial_echopair_P(const char* s_P, uint8_t v) { serial_echopair_P(s_P, (int)v); }
99
-FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopair_P(s_P, (int)v); }
100
-FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); }
101
-FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); }
102
-
103
-// Things to write to serial from Program memory. Saves 400 to 2k of RAM.
104
-FORCE_INLINE void serialprintPGM(const char* str) {
105
-  char ch;
106
-  while ((ch = pgm_read_byte(str))) {
107
-    MYSERIAL.write(ch);
108
-    str++;
109
-  }
110
-}
111
-
112
 void idle(
54
 void idle(
113
-  #if ENABLED(FILAMENT_CHANGE_FEATURE)
55
+  #if ENABLED(ADVANCED_PAUSE_FEATURE)
114
     bool no_stepper_sleep = false  // pass true to keep steppers from disabling on timeout
56
     bool no_stepper_sleep = false  // pass true to keep steppers from disabling on timeout
115
   #endif
57
   #endif
116
 );
58
 );
122
 #endif
64
 #endif
123
 
65
 
124
 #if HAS_X2_ENABLE
66
 #if HAS_X2_ENABLE
125
-  #define  enable_x() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
126
-  #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
67
+  #define  enable_X() do{ X_ENABLE_WRITE( X_ENABLE_ON); X2_ENABLE_WRITE( X_ENABLE_ON); }while(0)
68
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
127
 #elif HAS_X_ENABLE
69
 #elif HAS_X_ENABLE
128
-  #define  enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
129
-  #define disable_x() do{ X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
70
+  #define  enable_X() X_ENABLE_WRITE( X_ENABLE_ON)
71
+  #define disable_X() do{ X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }while(0)
130
 #else
72
 #else
131
-  #define  enable_x() NOOP
132
-  #define disable_x() NOOP
73
+  #define  enable_X() NOOP
74
+  #define disable_X() NOOP
133
 #endif
75
 #endif
134
 
76
 
135
 #if HAS_Y2_ENABLE
77
 #if HAS_Y2_ENABLE
136
-  #define  enable_y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
137
-  #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
78
+  #define  enable_Y() do{ Y_ENABLE_WRITE( Y_ENABLE_ON); Y2_ENABLE_WRITE(Y_ENABLE_ON); }while(0)
79
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); Y2_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
138
 #elif HAS_Y_ENABLE
80
 #elif HAS_Y_ENABLE
139
-  #define  enable_y() Y_ENABLE_WRITE( Y_ENABLE_ON)
140
-  #define disable_y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
81
+  #define  enable_Y() Y_ENABLE_WRITE( Y_ENABLE_ON)
82
+  #define disable_Y() do{ Y_ENABLE_WRITE(!Y_ENABLE_ON); axis_known_position[Y_AXIS] = false; }while(0)
141
 #else
83
 #else
142
-  #define  enable_y() NOOP
143
-  #define disable_y() NOOP
84
+  #define  enable_Y() NOOP
85
+  #define disable_Y() NOOP
144
 #endif
86
 #endif
145
 
87
 
146
 #if HAS_Z2_ENABLE
88
 #if HAS_Z2_ENABLE
147
-  #define  enable_z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
148
-  #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
89
+  #define  enable_Z() do{ Z_ENABLE_WRITE( Z_ENABLE_ON); Z2_ENABLE_WRITE(Z_ENABLE_ON); }while(0)
90
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); Z2_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
149
 #elif HAS_Z_ENABLE
91
 #elif HAS_Z_ENABLE
150
-  #define  enable_z() Z_ENABLE_WRITE( Z_ENABLE_ON)
151
-  #define disable_z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
92
+  #define  enable_Z() Z_ENABLE_WRITE( Z_ENABLE_ON)
93
+  #define disable_Z() do{ Z_ENABLE_WRITE(!Z_ENABLE_ON); axis_known_position[Z_AXIS] = false; }while(0)
152
 #else
94
 #else
153
-  #define  enable_z() NOOP
154
-  #define disable_z() NOOP
95
+  #define  enable_Z() NOOP
96
+  #define disable_Z() NOOP
155
 #endif
97
 #endif
156
 
98
 
157
 #if ENABLED(MIXING_EXTRUDER)
99
 #if ENABLED(MIXING_EXTRUDER)
160
    * Mixing steppers synchronize their enable (and direction) together
102
    * Mixing steppers synchronize their enable (and direction) together
161
    */
103
    */
162
   #if MIXING_STEPPERS > 3
104
   #if MIXING_STEPPERS > 3
163
-    #define  enable_e0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
164
-    #define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
105
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); E3_ENABLE_WRITE( E_ENABLE_ON); }
106
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); E3_ENABLE_WRITE(!E_ENABLE_ON); }
165
   #elif MIXING_STEPPERS > 2
107
   #elif MIXING_STEPPERS > 2
166
-    #define  enable_e0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
167
-    #define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
108
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); E2_ENABLE_WRITE( E_ENABLE_ON); }
109
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); E2_ENABLE_WRITE(!E_ENABLE_ON); }
168
   #else
110
   #else
169
-    #define  enable_e0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
170
-    #define disable_e0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
111
+    #define  enable_E0() { E0_ENABLE_WRITE( E_ENABLE_ON); E1_ENABLE_WRITE( E_ENABLE_ON); }
112
+    #define disable_E0() { E0_ENABLE_WRITE(!E_ENABLE_ON); E1_ENABLE_WRITE(!E_ENABLE_ON); }
171
   #endif
113
   #endif
172
-  #define  enable_e1() NOOP
173
-  #define disable_e1() NOOP
174
-  #define  enable_e2() NOOP
175
-  #define disable_e2() NOOP
176
-  #define  enable_e3() NOOP
177
-  #define disable_e3() NOOP
114
+  #define  enable_E1() NOOP
115
+  #define disable_E1() NOOP
116
+  #define  enable_E2() NOOP
117
+  #define disable_E2() NOOP
118
+  #define  enable_E3() NOOP
119
+  #define disable_E3() NOOP
120
+  #define  enable_E4() NOOP
121
+  #define disable_E4() NOOP
178
 
122
 
179
 #else // !MIXING_EXTRUDER
123
 #else // !MIXING_EXTRUDER
180
 
124
 
181
   #if HAS_E0_ENABLE
125
   #if HAS_E0_ENABLE
182
-    #define  enable_e0() E0_ENABLE_WRITE( E_ENABLE_ON)
183
-    #define disable_e0() E0_ENABLE_WRITE(!E_ENABLE_ON)
126
+    #define  enable_E0() E0_ENABLE_WRITE( E_ENABLE_ON)
127
+    #define disable_E0() E0_ENABLE_WRITE(!E_ENABLE_ON)
184
   #else
128
   #else
185
-    #define  enable_e0() NOOP
186
-    #define disable_e0() NOOP
129
+    #define  enable_E0() NOOP
130
+    #define disable_E0() NOOP
187
   #endif
131
   #endif
188
 
132
 
189
   #if E_STEPPERS > 1 && HAS_E1_ENABLE
133
   #if E_STEPPERS > 1 && HAS_E1_ENABLE
190
-    #define  enable_e1() E1_ENABLE_WRITE( E_ENABLE_ON)
191
-    #define disable_e1() E1_ENABLE_WRITE(!E_ENABLE_ON)
134
+    #define  enable_E1() E1_ENABLE_WRITE( E_ENABLE_ON)
135
+    #define disable_E1() E1_ENABLE_WRITE(!E_ENABLE_ON)
192
   #else
136
   #else
193
-    #define  enable_e1() NOOP
194
-    #define disable_e1() NOOP
137
+    #define  enable_E1() NOOP
138
+    #define disable_E1() NOOP
195
   #endif
139
   #endif
196
 
140
 
197
   #if E_STEPPERS > 2 && HAS_E2_ENABLE
141
   #if E_STEPPERS > 2 && HAS_E2_ENABLE
198
-    #define  enable_e2() E2_ENABLE_WRITE( E_ENABLE_ON)
199
-    #define disable_e2() E2_ENABLE_WRITE(!E_ENABLE_ON)
142
+    #define  enable_E2() E2_ENABLE_WRITE( E_ENABLE_ON)
143
+    #define disable_E2() E2_ENABLE_WRITE(!E_ENABLE_ON)
200
   #else
144
   #else
201
-    #define  enable_e2() NOOP
202
-    #define disable_e2() NOOP
145
+    #define  enable_E2() NOOP
146
+    #define disable_E2() NOOP
203
   #endif
147
   #endif
204
 
148
 
205
   #if E_STEPPERS > 3 && HAS_E3_ENABLE
149
   #if E_STEPPERS > 3 && HAS_E3_ENABLE
206
-    #define  enable_e3() E3_ENABLE_WRITE( E_ENABLE_ON)
207
-    #define disable_e3() E3_ENABLE_WRITE(!E_ENABLE_ON)
150
+    #define  enable_E3() E3_ENABLE_WRITE( E_ENABLE_ON)
151
+    #define disable_E3() E3_ENABLE_WRITE(!E_ENABLE_ON)
208
   #else
152
   #else
209
-    #define  enable_e3() NOOP
210
-    #define disable_e3() NOOP
153
+    #define  enable_E3() NOOP
154
+    #define disable_E3() NOOP
155
+  #endif
156
+
157
+  #if E_STEPPERS > 4 && HAS_E4_ENABLE
158
+    #define  enable_E4() E4_ENABLE_WRITE( E_ENABLE_ON)
159
+    #define disable_E4() E4_ENABLE_WRITE(!E_ENABLE_ON)
160
+  #else
161
+    #define  enable_E4() NOOP
162
+    #define disable_E4() NOOP
211
   #endif
163
   #endif
212
 
164
 
213
 #endif // !MIXING_EXTRUDER
165
 #endif // !MIXING_EXTRUDER
214
 
166
 
167
+#if ENABLED(G38_PROBE_TARGET)
168
+  extern bool G38_move,        // flag to tell the interrupt handler that a G38 command is being run
169
+              G38_endstop_hit; // flag from the interrupt handler to indicate if the endstop went active
170
+#endif
171
+
215
 /**
172
 /**
216
  * The axis order in all axis related arrays is X, Y, Z, E
173
  * The axis order in all axis related arrays is X, Y, Z, E
217
  */
174
  */
218
 #define _AXIS(AXIS) AXIS ##_AXIS
175
 #define _AXIS(AXIS) AXIS ##_AXIS
219
 
176
 
220
 void enable_all_steppers();
177
 void enable_all_steppers();
178
+void disable_e_steppers();
221
 void disable_all_steppers();
179
 void disable_all_steppers();
222
 
180
 
223
 void FlushSerialRequestResend();
181
 void FlushSerialRequestResend();
224
 void ok_to_send();
182
 void ok_to_send();
225
 
183
 
226
-void reset_bed_level();
227
 void kill(const char*);
184
 void kill(const char*);
228
 
185
 
229
 void quickstop_stepper();
186
 void quickstop_stepper();
239
 inline bool IsRunning() { return  Running; }
196
 inline bool IsRunning() { return  Running; }
240
 inline bool IsStopped() { return !Running; }
197
 inline bool IsStopped() { return !Running; }
241
 
198
 
242
-bool enqueue_and_echo_command(const char* cmd, bool say_ok=false); //put a single ASCII command at the end of the current buffer or return false when it is full
243
-void enqueue_and_echo_command_now(const char* cmd); // enqueue now, only return when the command has been enqueued
244
-void enqueue_and_echo_commands_P(const char* cmd); //put one or many ASCII commands at the end of the current buffer, read from flash
199
+bool enqueue_and_echo_command(const char* cmd, bool say_ok=false); // Add a single command to the end of the buffer. Return false on failure.
200
+void enqueue_and_echo_commands_P(const char * const cmd);          // Set one or more commands to be prioritized over the next Serial/SD command.
245
 void clear_command_queue();
201
 void clear_command_queue();
246
 
202
 
247
-void clamp_to_software_endstops(float target[3]);
248
-
249
 extern millis_t previous_cmd_ms;
203
 extern millis_t previous_cmd_ms;
250
 inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
204
 inline void refresh_cmd_timeout() { previous_cmd_ms = millis(); }
251
 
205
 
256
 /**
210
 /**
257
  * Feedrate scaling and conversion
211
  * Feedrate scaling and conversion
258
  */
212
  */
259
-extern int feedrate_percentage;
213
+extern int16_t feedrate_percentage;
260
 
214
 
261
 #define MMM_TO_MMS(MM_M) ((MM_M)/60.0)
215
 #define MMM_TO_MMS(MM_M) ((MM_M)/60.0)
262
 #define MMS_TO_MMM(MM_S) ((MM_S)*60.0)
216
 #define MMS_TO_MMM(MM_S) ((MM_S)*60.0)
263
-#define MMM_SCALED(MM_M) ((MM_M)*feedrate_percentage*0.01)
264
-#define MMS_SCALED(MM_S) MMM_SCALED(MM_S)
265
-#define MMM_TO_MMS_SCALED(MM_M) (MMS_SCALED(MMM_TO_MMS(MM_M)))
217
+#define MMS_SCALED(MM_S) ((MM_S)*feedrate_percentage*0.01)
266
 
218
 
267
 extern bool axis_relative_modes[];
219
 extern bool axis_relative_modes[];
268
 extern bool volumetric_enabled;
220
 extern bool volumetric_enabled;
269
-extern int extruder_multiplier[EXTRUDERS]; // sets extrude multiply factor (in percent) for each extruder individually
221
+extern int16_t flow_percentage[EXTRUDERS]; // Extrusion factor for each extruder
270
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
222
 extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder.
271
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
223
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
272
-extern bool axis_known_position[3]; // axis[n].is_known
273
-extern bool axis_homed[3]; // axis[n].is_homed
224
+extern bool axis_known_position[XYZ];
225
+extern bool axis_homed[XYZ];
274
 extern volatile bool wait_for_heatup;
226
 extern volatile bool wait_for_heatup;
275
 
227
 
228
+#if HAS_RESUME_CONTINUE
229
+  extern volatile bool wait_for_user;
230
+#endif
231
+
276
 extern float current_position[NUM_AXIS];
232
 extern float current_position[NUM_AXIS];
277
-extern float position_shift[3];
278
-extern float home_offset[3];
279
-extern float sw_endstop_min[3];
280
-extern float sw_endstop_max[3];
281
-
282
-#define LOGICAL_POSITION(POS, AXIS) (POS + home_offset[AXIS] + position_shift[AXIS])
283
-#define RAW_POSITION(POS, AXIS)     (POS - home_offset[AXIS] - position_shift[AXIS])
284
-#define LOGICAL_X_POSITION(POS)     LOGICAL_POSITION(POS, X_AXIS)
285
-#define LOGICAL_Y_POSITION(POS)     LOGICAL_POSITION(POS, Y_AXIS)
233
+
234
+// Workspace offsets
235
+#if HAS_WORKSPACE_OFFSET
236
+  #if HAS_HOME_OFFSET
237
+    extern float home_offset[XYZ];
238
+  #endif
239
+  #if HAS_POSITION_SHIFT
240
+    extern float position_shift[XYZ];
241
+  #endif
242
+#endif
243
+
244
+#if HAS_HOME_OFFSET && HAS_POSITION_SHIFT
245
+  extern float workspace_offset[XYZ];
246
+  #define WORKSPACE_OFFSET(AXIS) workspace_offset[AXIS]
247
+#elif HAS_HOME_OFFSET
248
+  #define WORKSPACE_OFFSET(AXIS) home_offset[AXIS]
249
+#elif HAS_POSITION_SHIFT
250
+  #define WORKSPACE_OFFSET(AXIS) position_shift[AXIS]
251
+#else
252
+  #define WORKSPACE_OFFSET(AXIS) 0
253
+#endif
254
+
255
+#define LOGICAL_POSITION(POS, AXIS) ((POS) + WORKSPACE_OFFSET(AXIS))
256
+#define RAW_POSITION(POS, AXIS)     ((POS) - WORKSPACE_OFFSET(AXIS))
257
+
258
+#if HAS_POSITION_SHIFT || DISABLED(DELTA)
259
+  #define LOGICAL_X_POSITION(POS)   LOGICAL_POSITION(POS, X_AXIS)
260
+  #define LOGICAL_Y_POSITION(POS)   LOGICAL_POSITION(POS, Y_AXIS)
261
+  #define RAW_X_POSITION(POS)       RAW_POSITION(POS, X_AXIS)
262
+  #define RAW_Y_POSITION(POS)       RAW_POSITION(POS, Y_AXIS)
263
+#else
264
+  #define LOGICAL_X_POSITION(POS)   (POS)
265
+  #define LOGICAL_Y_POSITION(POS)   (POS)
266
+  #define RAW_X_POSITION(POS)       (POS)
267
+  #define RAW_Y_POSITION(POS)       (POS)
268
+#endif
269
+
286
 #define LOGICAL_Z_POSITION(POS)     LOGICAL_POSITION(POS, Z_AXIS)
270
 #define LOGICAL_Z_POSITION(POS)     LOGICAL_POSITION(POS, Z_AXIS)
287
-#define RAW_X_POSITION(POS)         RAW_POSITION(POS, X_AXIS)
288
-#define RAW_Y_POSITION(POS)         RAW_POSITION(POS, Y_AXIS)
289
 #define RAW_Z_POSITION(POS)         RAW_POSITION(POS, Z_AXIS)
271
 #define RAW_Z_POSITION(POS)         RAW_POSITION(POS, Z_AXIS)
290
-#define RAW_CURRENT_POSITION(AXIS)  RAW_POSITION(current_position[AXIS], AXIS)
272
+#define RAW_CURRENT_POSITION(A)     RAW_##A##_POSITION(current_position[A##_AXIS])
273
+
274
+// Hotend Offsets
275
+#if HOTENDS > 1
276
+  extern float hotend_offset[XYZ][HOTENDS];
277
+#endif
291
 
278
 
292
-// GCode support for external objects
293
-bool code_seen(char);
294
-int code_value_int();
295
-float code_value_temp_abs();
296
-float code_value_temp_diff();
279
+// Software Endstops
280
+extern float soft_endstop_min[XYZ], soft_endstop_max[XYZ];
281
+
282
+#if HAS_SOFTWARE_ENDSTOPS
283
+  extern bool soft_endstops_enabled;
284
+  void clamp_to_software_endstops(float target[XYZ]);
285
+#else
286
+  #define soft_endstops_enabled false
287
+  #define clamp_to_software_endstops(x) NOOP
288
+#endif
289
+
290
+#if HAS_WORKSPACE_OFFSET || ENABLED(DUAL_X_CARRIAGE)
291
+  void update_software_endstops(const AxisEnum axis);
292
+#endif
293
+
294
+#if IS_KINEMATIC
295
+  extern float delta[ABC];
296
+  void inverse_kinematics(const float logical[XYZ]);
297
+#endif
297
 
298
 
298
 #if ENABLED(DELTA)
299
 #if ENABLED(DELTA)
299
-  extern float delta[3];
300
-  extern float endstop_adj[3]; // axis[n].endstop_adj
301
-  extern float delta_radius;
302
-  extern float delta_diagonal_rod;
303
-  extern float delta_segments_per_second;
304
-  extern float delta_diagonal_rod_trim_tower_1;
305
-  extern float delta_diagonal_rod_trim_tower_2;
306
-  extern float delta_diagonal_rod_trim_tower_3;
307
-  void inverse_kinematics(const float cartesian[3]);
300
+  extern float endstop_adj[ABC],
301
+               delta_radius,
302
+               delta_diagonal_rod,
303
+               delta_calibration_radius,
304
+               delta_segments_per_second,
305
+               delta_tower_angle_trim[2],
306
+               delta_clip_start_height;
308
   void recalc_delta_settings(float radius, float diagonal_rod);
307
   void recalc_delta_settings(float radius, float diagonal_rod);
309
-  #if ENABLED(AUTO_BED_LEVELING_FEATURE)
310
-    extern int delta_grid_spacing[2];
311
-    void adjust_delta(float cartesian[3]);
312
-  #endif
313
-#elif ENABLED(SCARA)
314
-  extern float delta[3];
315
-  extern float axis_scaling[3];  // Build size scaling
316
-  void inverse_kinematics(const float cartesian[3]);
317
-  void forward_kinematics_SCARA(float f_scara[3]);
308
+#elif IS_SCARA
309
+  void forward_kinematics_SCARA(const float &a, const float &b);
310
+#endif
311
+
312
+#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
313
+  extern int bilinear_grid_spacing[2], bilinear_start[2];
314
+  extern float bilinear_grid_factor[2],
315
+               z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y];
316
+  float bilinear_z_offset(const float logical[XYZ]);
317
+#endif
318
+
319
+#if ENABLED(AUTO_BED_LEVELING_UBL)
320
+  typedef struct { double A, B, D; } linear_fit;
321
+  linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
322
+#endif
323
+
324
+#if HAS_LEVELING
325
+  bool leveling_is_valid();
326
+  bool leveling_is_active();
327
+  void set_bed_leveling_enabled(const bool enable=true);
328
+  void reset_bed_level();
329
+#endif
330
+
331
+#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
332
+  void set_z_fade_height(const float zfh);
318
 #endif
333
 #endif
319
 
334
 
320
 #if ENABLED(Z_DUAL_ENDSTOPS)
335
 #if ENABLED(Z_DUAL_ENDSTOPS)
323
 
338
 
324
 #if HAS_BED_PROBE
339
 #if HAS_BED_PROBE
325
   extern float zprobe_zoffset;
340
   extern float zprobe_zoffset;
341
+  void refresh_zprobe_zoffset(const bool no_babystep=false);
342
+  #define DEPLOY_PROBE() set_probe_deployed(true)
343
+  #define STOW_PROBE() set_probe_deployed(false)
344
+#else
345
+  #define DEPLOY_PROBE()
346
+  #define STOW_PROBE()
326
 #endif
347
 #endif
327
 
348
 
328
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
349
 #if ENABLED(HOST_KEEPALIVE_FEATURE)
329
-  extern uint8_t host_keepalive_interval;
350
+  extern MarlinBusyState busy_state;
351
+  #define KEEPALIVE_STATE(n) do{ busy_state = n; }while(0)
352
+#else
353
+  #define KEEPALIVE_STATE(n) NOOP
330
 #endif
354
 #endif
331
 
355
 
332
 #if FAN_COUNT > 0
356
 #if FAN_COUNT > 0
333
-  extern int fanSpeeds[FAN_COUNT];
357
+  extern int16_t fanSpeeds[FAN_COUNT];
358
+  #if ENABLED(PROBING_FANS_OFF)
359
+    extern bool fans_paused;
360
+    extern int16_t paused_fanSpeeds[FAN_COUNT];
361
+  #endif
334
 #endif
362
 #endif
335
 
363
 
336
 #if ENABLED(BARICUDA)
364
 #if ENABLED(BARICUDA)
339
 #endif
367
 #endif
340
 
368
 
341
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
369
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
342
-  extern float filament_width_nominal;  //holds the theoretical filament diameter i.e., 3.00 or 1.75
343
-  extern bool filament_sensor;  //indicates that filament sensor readings should control extrusion
344
-  extern float filament_width_meas; //holds the filament diameter as accurately measured
345
-  extern int8_t measurement_delay[];  //ring buffer to delay measurement
346
-  extern int filwidth_delay_index1, filwidth_delay_index2;  //ring buffer index. used by planner, temperature, and main code
347
-  extern int meas_delay_cm; //delay distance
370
+  extern bool filament_sensor;         // Flag that filament sensor readings should control extrusion
371
+  extern float filament_width_nominal, // Theoretical filament diameter i.e., 3.00 or 1.75
372
+               filament_width_meas;    // Measured filament diameter
373
+  extern uint8_t meas_delay_cm,        // Delay distance
374
+                 measurement_delay[];  // Ring buffer to delay measurement
375
+  extern int8_t filwidth_delay_index[2]; // Ring buffer indexes. Used by planner, temperature, and main code
348
 #endif
376
 #endif
349
 
377
 
350
-#if ENABLED(FILAMENT_CHANGE_FEATURE)
351
-  extern FilamentChangeMenuResponse filament_change_menu_response;
378
+#if ENABLED(ADVANCED_PAUSE_FEATURE)
379
+  extern AdvancedPauseMenuResponse advanced_pause_menu_response;
352
 #endif
380
 #endif
353
 
381
 
354
 #if ENABLED(PID_EXTRUSION_SCALING)
382
 #if ENABLED(PID_EXTRUSION_SCALING)
382
 
410
 
383
 void calculate_volumetric_multipliers();
411
 void calculate_volumetric_multipliers();
384
 
412
 
385
-// Buzzer
386
-#if HAS_BUZZER && PIN_EXISTS(BEEPER)
387
-  #include "buzzer.h"
413
+/**
414
+ * Blocking movement and shorthand functions
415
+ */
416
+void do_blocking_move_to(const float &x, const float &y, const float &z, const float &fr_mm_s=0.0);
417
+void do_blocking_move_to_x(const float &x, const float &fr_mm_s=0.0);
418
+void do_blocking_move_to_z(const float &z, const float &fr_mm_s=0.0);
419
+void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0);
420
+
421
+#if ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE)
422
+  bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
388
 #endif
423
 #endif
389
 
424
 
390
 /**
425
 /**
391
- * Blocking movement and shorthand functions
426
+ * position_is_reachable family of functions
392
  */
427
  */
393
-inline void do_blocking_move_to(float x, float y, float z, float fr_mm_m=0.0);
394
-inline void do_blocking_move_to_x(float x, float fr_mm_m=0.0);
395
-inline void do_blocking_move_to_z(float z, float fr_mm_m=0.0);
396
-inline void do_blocking_move_to_xy(float x, float y, float fr_mm_m=0.0);
397
 
428
 
398
-#endif //MARLIN_H
429
+#if IS_KINEMATIC // (DELTA or SCARA)
430
+
431
+  #if IS_SCARA
432
+    extern const float L1, L2;
433
+  #endif
434
+
435
+  inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
436
+    #if ENABLED(DELTA)
437
+      return HYPOT2(rx, ry) <= sq(DELTA_PRINTABLE_RADIUS);
438
+    #elif IS_SCARA
439
+      #if MIDDLE_DEAD_ZONE_R > 0
440
+        const float R2 = HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y);
441
+        return R2 >= sq(float(MIDDLE_DEAD_ZONE_R)) && R2 <= sq(L1 + L2);
442
+      #else
443
+        return HYPOT2(rx - SCARA_OFFSET_X, ry - SCARA_OFFSET_Y) <= sq(L1 + L2);
444
+      #endif
445
+    #else // CARTESIAN
446
+      // To be migrated from MakerArm branch in future
447
+    #endif
448
+  }
449
+
450
+  inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
451
+
452
+    // Both the nozzle and the probe must be able to reach the point.
453
+    // This won't work on SCARA since the probe offset rotates with the arm.
454
+
455
+    return position_is_reachable_raw_xy(rx, ry)
456
+        && position_is_reachable_raw_xy(rx - X_PROBE_OFFSET_FROM_EXTRUDER, ry - Y_PROBE_OFFSET_FROM_EXTRUDER);
457
+  }
458
+
459
+#else // CARTESIAN
460
+
461
+  inline bool position_is_reachable_raw_xy(const float &rx, const float &ry) {
462
+      // Add 0.001 margin to deal with float imprecision
463
+      return WITHIN(rx, X_MIN_POS - 0.001, X_MAX_POS + 0.001)
464
+          && WITHIN(ry, Y_MIN_POS - 0.001, Y_MAX_POS + 0.001);
465
+  }
466
+
467
+  inline bool position_is_reachable_by_probe_raw_xy(const float &rx, const float &ry) {
468
+      // Add 0.001 margin to deal with float imprecision
469
+      return WITHIN(rx, MIN_PROBE_X - 0.001, MAX_PROBE_X + 0.001)
470
+          && WITHIN(ry, MIN_PROBE_Y - 0.001, MAX_PROBE_Y + 0.001);
471
+  }
472
+
473
+#endif // CARTESIAN
474
+
475
+FORCE_INLINE bool position_is_reachable_by_probe_xy(const float &lx, const float &ly) {
476
+  return position_is_reachable_by_probe_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
477
+}
478
+
479
+FORCE_INLINE bool position_is_reachable_xy(const float &lx, const float &ly) {
480
+  return position_is_reachable_raw_xy(RAW_X_POSITION(lx), RAW_Y_POSITION(ly));
481
+}
482
+
483
+#endif // MARLIN_H

+ 5
- 6
Marlin/Marlin.ino Wyświetl plik

26
  * This firmware is a mashup between Sprinter and grbl.
26
  * This firmware is a mashup between Sprinter and grbl.
27
  *  - https://github.com/kliment/Sprinter
27
  *  - https://github.com/kliment/Sprinter
28
  *  - https://github.com/simen/grbl/tree
28
  *  - https://github.com/simen/grbl/tree
29
- *
30
- * It has preliminary support for Matthew Roberts advance algorithm
31
- *  - http://reprap.org/pipermail/reprap-dev/2011-May/003323.html
32
  */
29
  */
33
 
30
 
34
-/* All the implementation is done in *.cpp files to get better compatibility with avr-gcc without the Arduino IDE */
35
-/* Use this file to help the Arduino IDE find which Arduino libraries are needed and to keep documentation on GCode */
36
-
37
 #include "MarlinConfig.h"
31
 #include "MarlinConfig.h"
38
 
32
 
39
 #if ENABLED(ULTRA_LCD)
33
 #if ENABLED(ULTRA_LCD)
67
   #include <TMC26XStepper.h>
61
   #include <TMC26XStepper.h>
68
 #endif
62
 #endif
69
 
63
 
64
+#if ENABLED(HAVE_TMC2130)
65
+  #include <SPI.h>
66
+  #include <TMC2130Stepper.h>
67
+#endif
68
+
70
 #if ENABLED(HAVE_L6470DRIVER)
69
 #if ENABLED(HAVE_L6470DRIVER)
71
   #include <SPI.h>
70
   #include <SPI.h>
72
   #include <L6470.h>
71
   #include <L6470.h>

+ 415
- 437
Marlin/MarlinSerial.cpp Wyświetl plik

21
  */
21
  */
22
 
22
 
23
 /**
23
 /**
24
-  MarlinSerial.cpp - Hardware serial library for Wiring
25
-  Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
26
-
27
-  Modified 23 November 2006 by David A. Mellis
28
-  Modified 28 September 2010 by Mark Sproul
29
-  Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
30
-*/
24
+ * MarlinSerial.cpp - Hardware serial library for Wiring
25
+ * Copyright (c) 2006 Nicholas Zambetti.  All right reserved.
26
+ *
27
+ * Modified 23 November 2006 by David A. Mellis
28
+ * Modified 28 September 2010 by Mark Sproul
29
+ * Modified 14 February 2016 by Andreas Hardtung (added tx buffer)
30
+ */
31
 
31
 
32
 #include "MarlinSerial.h"
32
 #include "MarlinSerial.h"
33
-
34
-#include "stepper.h"
35
-
36
 #include "Marlin.h"
33
 #include "Marlin.h"
37
 
34
 
38
-#ifndef USBCON
39
-// this next line disables the entire HardwareSerial.cpp,
40
-// this is so I can support Attiny series and any other chip without a UART
41
-#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H)
35
+// Disable HardwareSerial.cpp to support chips without a UART (Attiny, etc.)
42
 
36
 
43
-#if UART_PRESENT(SERIAL_PORT)
44
-  ring_buffer_r rx_buffer  =  { { 0 }, 0, 0 };
45
-  #if TX_BUFFER_SIZE > 0
46
-    ring_buffer_t tx_buffer  =  { { 0 }, 0, 0 };
47
-    static bool _written;
37
+#if !defined(USBCON) && (defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H))
38
+
39
+  #if UART_PRESENT(SERIAL_PORT)
40
+    ring_buffer_r rx_buffer = { { 0 }, 0, 0 };
41
+    #if TX_BUFFER_SIZE > 0
42
+      ring_buffer_t tx_buffer = { { 0 }, 0, 0 };
43
+      static bool _written;
44
+    #endif
48
   #endif
45
   #endif
49
-#endif
50
 
46
 
47
+  #if ENABLED(EMERGENCY_PARSER)
51
 
48
 
52
-FORCE_INLINE void store_char(unsigned char c) {
53
-  CRITICAL_SECTION_START;
54
-    uint8_t h = rx_buffer.head;
55
-    uint8_t i = (uint8_t)(h + 1)  & (RX_BUFFER_SIZE - 1);
49
+    #include "stepper.h"
50
+    #include "language.h"
56
 
51
 
57
-    // if we should be storing the received character into the location
58
-    // just before the tail (meaning that the head would advance to the
59
-    // current location of the tail), we're about to overflow the buffer
60
-    // and so we don't write the character or advance the head.
61
-    if (i != rx_buffer.tail) {
62
-      rx_buffer.buffer[h] = c;
63
-      rx_buffer.head = i;
64
-    }
65
-  CRITICAL_SECTION_END;
52
+    // Currently looking for: M108, M112, M410
53
+    // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
66
 
54
 
67
-  #if ENABLED(EMERGENCY_PARSER)
68
-    emergency_parser(c);
69
-  #endif
70
-}
71
-
72
-#if TX_BUFFER_SIZE > 0
73
-  FORCE_INLINE void _tx_udr_empty_irq(void)
74
-  {
75
-    // If interrupts are enabled, there must be more data in the output
76
-    // buffer. Send the next byte
77
-    uint8_t t = tx_buffer.tail;
78
-    uint8_t c = tx_buffer.buffer[t];
79
-    tx_buffer.tail = (t + 1) & (TX_BUFFER_SIZE - 1);
80
-
81
-    M_UDRx = c;
82
-
83
-    // clear the TXC bit -- "can be cleared by writing a one to its bit
84
-    // location". This makes sure flush() won't return until the bytes
85
-    // actually got written
86
-    SBI(M_UCSRxA, M_TXCx);
87
-
88
-    if (tx_buffer.head == tx_buffer.tail) {
89
-      // Buffer empty, so disable interrupts
90
-      CBI(M_UCSRxB, M_UDRIEx);
91
-    }
92
-  }
55
+    FORCE_INLINE void emergency_parser(const unsigned char c) {
93
 
56
 
94
-  #if defined(M_USARTx_UDRE_vect)
95
-    ISR(M_USARTx_UDRE_vect) {
96
-      _tx_udr_empty_irq();
57
+      static e_parser_state state = state_RESET;
58
+
59
+      switch (state) {
60
+        case state_RESET:
61
+          switch (c) {
62
+            case ' ': break;
63
+            case 'N': state = state_N;      break;
64
+            case 'M': state = state_M;      break;
65
+            default: state = state_IGNORE;
66
+          }
67
+          break;
68
+
69
+        case state_N:
70
+          switch (c) {
71
+            case '0': case '1': case '2':
72
+            case '3': case '4': case '5':
73
+            case '6': case '7': case '8':
74
+            case '9': case '-': case ' ':   break;
75
+            case 'M': state = state_M;      break;
76
+            default:  state = state_IGNORE;
77
+          }
78
+          break;
79
+
80
+        case state_M:
81
+          switch (c) {
82
+            case ' ': break;
83
+            case '1': state = state_M1;     break;
84
+            case '4': state = state_M4;     break;
85
+            default: state = state_IGNORE;
86
+          }
87
+          break;
88
+
89
+        case state_M1:
90
+          switch (c) {
91
+            case '0': state = state_M10;    break;
92
+            case '1': state = state_M11;    break;
93
+            default: state = state_IGNORE;
94
+          }
95
+          break;
96
+
97
+        case state_M10:
98
+          state = (c == '8') ? state_M108 : state_IGNORE;
99
+          break;
100
+
101
+        case state_M11:
102
+          state = (c == '2') ? state_M112 : state_IGNORE;
103
+          break;
104
+
105
+        case state_M4:
106
+          state = (c == '1') ? state_M41 : state_IGNORE;
107
+          break;
108
+
109
+        case state_M41:
110
+          state = (c == '0') ? state_M410 : state_IGNORE;
111
+          break;
112
+
113
+        case state_IGNORE:
114
+          if (c == '\n') state = state_RESET;
115
+          break;
116
+
117
+        default:
118
+          if (c == '\n') {
119
+            switch (state) {
120
+              case state_M108:
121
+                wait_for_user = wait_for_heatup = false;
122
+                break;
123
+              case state_M112:
124
+                kill(PSTR(MSG_KILLED));
125
+                break;
126
+              case state_M410:
127
+                quickstop_stepper();
128
+                break;
129
+              default:
130
+                break;
131
+            }
132
+            state = state_RESET;
133
+          }
134
+      }
97
     }
135
     }
98
-  #endif
99
 
136
 
100
-#endif
137
+  #endif // EMERGENCY_PARSER
101
 
138
 
102
-#if defined(M_USARTx_RX_vect)
103
-  ISR(M_USARTx_RX_vect) {
104
-    unsigned char c  =  M_UDRx;
105
-    store_char(c);
139
+  FORCE_INLINE void store_char(unsigned char c) {
140
+    CRITICAL_SECTION_START;
141
+      const uint8_t h = rx_buffer.head,
142
+                    i = (uint8_t)(h + 1) & (RX_BUFFER_SIZE - 1);
143
+
144
+      // if we should be storing the received character into the location
145
+      // just before the tail (meaning that the head would advance to the
146
+      // current location of the tail), we're about to overflow the buffer
147
+      // and so we don't write the character or advance the head.
148
+      if (i != rx_buffer.tail) {
149
+        rx_buffer.buffer[h] = c;
150
+        rx_buffer.head = i;
151
+      }
152
+    CRITICAL_SECTION_END;
153
+
154
+    #if ENABLED(EMERGENCY_PARSER)
155
+      emergency_parser(c);
156
+    #endif
106
   }
157
   }
107
-#endif
108
 
158
 
109
-// Constructors ////////////////////////////////////////////////////////////////
159
+  #if TX_BUFFER_SIZE > 0
110
 
160
 
111
-MarlinSerial::MarlinSerial() { }
161
+    FORCE_INLINE void _tx_udr_empty_irq(void) {
162
+      // If interrupts are enabled, there must be more data in the output
163
+      // buffer. Send the next byte
164
+      const uint8_t t = tx_buffer.tail,
165
+                    c = tx_buffer.buffer[t];
166
+      tx_buffer.tail = (t + 1) & (TX_BUFFER_SIZE - 1);
112
 
167
 
113
-// Public Methods //////////////////////////////////////////////////////////////
168
+      M_UDRx = c;
114
 
169
 
115
-void MarlinSerial::begin(long baud) {
116
-  uint16_t baud_setting;
117
-  bool useU2X = true;
170
+      // clear the TXC bit -- "can be cleared by writing a one to its bit
171
+      // location". This makes sure flush() won't return until the bytes
172
+      // actually got written
173
+      SBI(M_UCSRxA, M_TXCx);
118
 
174
 
119
-  #if F_CPU == 16000000UL && SERIAL_PORT == 0
120
-    // hard-coded exception for compatibility with the bootloader shipped
121
-    // with the Duemilanove and previous boards and the firmware on the 8U2
122
-    // on the Uno and Mega 2560.
123
-    if (baud == 57600) {
124
-      useU2X = false;
175
+      if (tx_buffer.head == tx_buffer.tail) {
176
+        // Buffer empty, so disable interrupts
177
+        CBI(M_UCSRxB, M_UDRIEx);
178
+      }
125
     }
179
     }
126
-  #endif
127
 
180
 
128
-  if (useU2X) {
129
-    M_UCSRxA = _BV(M_U2Xx);
130
-    baud_setting = (F_CPU / 4 / baud - 1) / 2;
131
-  }
132
-  else {
133
-    M_UCSRxA = 0;
134
-    baud_setting = (F_CPU / 8 / baud - 1) / 2;
135
-  }
181
+    #ifdef M_USARTx_UDRE_vect
182
+      ISR(M_USARTx_UDRE_vect) {
183
+        _tx_udr_empty_irq();
184
+      }
185
+    #endif
136
 
186
 
137
-  // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
138
-  M_UBRRxH = baud_setting >> 8;
139
-  M_UBRRxL = baud_setting;
187
+  #endif // TX_BUFFER_SIZE
140
 
188
 
141
-  SBI(M_UCSRxB, M_RXENx);
142
-  SBI(M_UCSRxB, M_TXENx);
143
-  SBI(M_UCSRxB, M_RXCIEx);
144
-  #if TX_BUFFER_SIZE > 0
145
-    CBI(M_UCSRxB, M_UDRIEx);
146
-    _written = false;
189
+  #ifdef M_USARTx_RX_vect
190
+    ISR(M_USARTx_RX_vect) {
191
+      const unsigned char c = M_UDRx;
192
+      store_char(c);
193
+    }
147
   #endif
194
   #endif
148
-}
149
-
150
-void MarlinSerial::end() {
151
-  CBI(M_UCSRxB, M_RXENx);
152
-  CBI(M_UCSRxB, M_TXENx);
153
-  CBI(M_UCSRxB, M_RXCIEx);
154
-  CBI(M_UCSRxB, M_UDRIEx);
155
-}
156
-
157
-void MarlinSerial::checkRx(void) {
158
-  if (TEST(M_UCSRxA, M_RXCx)) {
159
-    uint8_t c  =  M_UDRx;
160
-    store_char(c);
195
+
196
+  // Public Methods
197
+
198
+  void MarlinSerial::begin(const long baud) {
199
+    uint16_t baud_setting;
200
+    bool useU2X = true;
201
+
202
+    #if F_CPU == 16000000UL && SERIAL_PORT == 0
203
+      // hard-coded exception for compatibility with the bootloader shipped
204
+      // with the Duemilanove and previous boards and the firmware on the 8U2
205
+      // on the Uno and Mega 2560.
206
+      if (baud == 57600) useU2X = false;
207
+    #endif
208
+
209
+    if (useU2X) {
210
+      M_UCSRxA = _BV(M_U2Xx);
211
+      baud_setting = (F_CPU / 4 / baud - 1) / 2;
212
+    }
213
+    else {
214
+      M_UCSRxA = 0;
215
+      baud_setting = (F_CPU / 8 / baud - 1) / 2;
216
+    }
217
+
218
+    // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register)
219
+    M_UBRRxH = baud_setting >> 8;
220
+    M_UBRRxL = baud_setting;
221
+
222
+    SBI(M_UCSRxB, M_RXENx);
223
+    SBI(M_UCSRxB, M_TXENx);
224
+    SBI(M_UCSRxB, M_RXCIEx);
225
+    #if TX_BUFFER_SIZE > 0
226
+      CBI(M_UCSRxB, M_UDRIEx);
227
+      _written = false;
228
+    #endif
161
   }
229
   }
162
-}
163
-
164
-int MarlinSerial::peek(void) {
165
-  int v;
166
-  CRITICAL_SECTION_START;
167
-  uint8_t t = rx_buffer.tail;
168
-  if (rx_buffer.head == t) {
169
-    v = -1;
230
+
231
+  void MarlinSerial::end() {
232
+    CBI(M_UCSRxB, M_RXENx);
233
+    CBI(M_UCSRxB, M_TXENx);
234
+    CBI(M_UCSRxB, M_RXCIEx);
235
+    CBI(M_UCSRxB, M_UDRIEx);
170
   }
236
   }
171
-  else {
172
-    v = rx_buffer.buffer[t];
237
+
238
+  void MarlinSerial::checkRx(void) {
239
+    if (TEST(M_UCSRxA, M_RXCx)) {
240
+      const uint8_t c = M_UDRx;
241
+      store_char(c);
242
+    }
173
   }
243
   }
174
-  CRITICAL_SECTION_END;
175
-  return v;
176
-}
177
-
178
-int MarlinSerial::read(void) {
179
-  int v;
180
-  CRITICAL_SECTION_START;
181
-  uint8_t t = rx_buffer.tail;
182
-  if (rx_buffer.head == t) {
183
-    v = -1;
244
+
245
+  int MarlinSerial::peek(void) {
246
+    CRITICAL_SECTION_START;
247
+      const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail];
248
+    CRITICAL_SECTION_END;
249
+    return v;
184
   }
250
   }
185
-  else {
186
-    v = rx_buffer.buffer[t];
187
-    rx_buffer.tail = (uint8_t)(t + 1) & (RX_BUFFER_SIZE - 1);
251
+
252
+  int MarlinSerial::read(void) {
253
+    int v;
254
+    CRITICAL_SECTION_START;
255
+      const uint8_t t = rx_buffer.tail;
256
+      if (rx_buffer.head == t)
257
+        v = -1;
258
+      else {
259
+        v = rx_buffer.buffer[t];
260
+        rx_buffer.tail = (uint8_t)(t + 1) & (RX_BUFFER_SIZE - 1);
261
+      }
262
+    CRITICAL_SECTION_END;
263
+    return v;
188
   }
264
   }
189
-  CRITICAL_SECTION_END;
190
-  return v;
191
-}
192
-
193
-uint8_t MarlinSerial::available(void) {
194
-  CRITICAL_SECTION_START;
195
-    uint8_t h = rx_buffer.head;
196
-    uint8_t t = rx_buffer.tail;
197
-  CRITICAL_SECTION_END;
198
-  return (uint8_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1);
199
-}
200
-
201
-void MarlinSerial::flush(void) {
202
-  // RX
203
-  // don't reverse this or there may be problems if the RX interrupt
204
-  // occurs after reading the value of rx_buffer_head but before writing
205
-  // the value to rx_buffer_tail; the previous value of rx_buffer_head
206
-  // may be written to rx_buffer_tail, making it appear as if the buffer
207
-  // were full, not empty.
208
-  CRITICAL_SECTION_START;
209
-    rx_buffer.head = rx_buffer.tail;
210
-  CRITICAL_SECTION_END;
211
-}
212
-
213
-#if TX_BUFFER_SIZE > 0
214
-  uint8_t MarlinSerial::availableForWrite(void) {
265
+
266
+  uint8_t MarlinSerial::available(void) {
215
     CRITICAL_SECTION_START;
267
     CRITICAL_SECTION_START;
216
-      uint8_t h = tx_buffer.head;
217
-      uint8_t t = tx_buffer.tail;
268
+      const uint8_t h = rx_buffer.head,
269
+                    t = rx_buffer.tail;
218
     CRITICAL_SECTION_END;
270
     CRITICAL_SECTION_END;
219
-    return (uint8_t)(TX_BUFFER_SIZE + h - t) & (TX_BUFFER_SIZE - 1);
271
+    return (uint8_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1);
220
   }
272
   }
221
 
273
 
222
-  void MarlinSerial::write(uint8_t c) {
223
-    _written = true;
274
+  void MarlinSerial::flush(void) {
275
+    // RX
276
+    // don't reverse this or there may be problems if the RX interrupt
277
+    // occurs after reading the value of rx_buffer_head but before writing
278
+    // the value to rx_buffer_tail; the previous value of rx_buffer_head
279
+    // may be written to rx_buffer_tail, making it appear as if the buffer
280
+    // were full, not empty.
224
     CRITICAL_SECTION_START;
281
     CRITICAL_SECTION_START;
225
-      bool emty = (tx_buffer.head == tx_buffer.tail);
282
+      rx_buffer.head = rx_buffer.tail;
226
     CRITICAL_SECTION_END;
283
     CRITICAL_SECTION_END;
227
-    // If the buffer and the data register is empty, just write the byte
228
-    // to the data register and be done. This shortcut helps
229
-    // significantly improve the effective datarate at high (>
230
-    // 500kbit/s) bitrates, where interrupt overhead becomes a slowdown.
231
-    if (emty && TEST(M_UCSRxA, M_UDREx)) {
284
+  }
285
+
286
+  #if TX_BUFFER_SIZE > 0
287
+    uint8_t MarlinSerial::availableForWrite(void) {
232
       CRITICAL_SECTION_START;
288
       CRITICAL_SECTION_START;
233
-        M_UDRx = c;
234
-        SBI(M_UCSRxA, M_TXCx);
289
+        const uint8_t h = tx_buffer.head,
290
+                      t = tx_buffer.tail;
235
       CRITICAL_SECTION_END;
291
       CRITICAL_SECTION_END;
236
-      return;
237
-    }
238
-    uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1);
239
-
240
-    // If the output buffer is full, there's nothing for it other than to
241
-    // wait for the interrupt handler to empty it a bit
242
-    while (i == tx_buffer.tail) {
243
-      if (!TEST(SREG, SREG_I)) {
244
-        // Interrupts are disabled, so we'll have to poll the data
245
-        // register empty flag ourselves. If it is set, pretend an
246
-        // interrupt has happened and call the handler to free up
247
-        // space for us.
248
-        if (TEST(M_UCSRxA, M_UDREx))
249
-          _tx_udr_empty_irq();
250
-      } else {
251
-        // nop, the interrupt handler will free up space for us
252
-      }
292
+      return (uint8_t)(TX_BUFFER_SIZE + h - t) & (TX_BUFFER_SIZE - 1);
253
     }
293
     }
254
 
294
 
255
-    tx_buffer.buffer[tx_buffer.head] = c;
256
-    { CRITICAL_SECTION_START;
257
-        tx_buffer.head = i;
258
-        SBI(M_UCSRxB, M_UDRIEx);
295
+    void MarlinSerial::write(const uint8_t c) {
296
+      _written = true;
297
+      CRITICAL_SECTION_START;
298
+        bool emty = (tx_buffer.head == tx_buffer.tail);
259
       CRITICAL_SECTION_END;
299
       CRITICAL_SECTION_END;
260
-    }
261
-    return;
262
-  }
300
+      // If the buffer and the data register is empty, just write the byte
301
+      // to the data register and be done. This shortcut helps
302
+      // significantly improve the effective datarate at high (>
303
+      // 500kbit/s) bitrates, where interrupt overhead becomes a slowdown.
304
+      if (emty && TEST(M_UCSRxA, M_UDREx)) {
305
+        CRITICAL_SECTION_START;
306
+          M_UDRx = c;
307
+          SBI(M_UCSRxA, M_TXCx);
308
+        CRITICAL_SECTION_END;
309
+        return;
310
+      }
311
+      const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1);
312
+
313
+      // If the output buffer is full, there's nothing for it other than to
314
+      // wait for the interrupt handler to empty it a bit
315
+      while (i == tx_buffer.tail) {
316
+        if (!TEST(SREG, SREG_I)) {
317
+          // Interrupts are disabled, so we'll have to poll the data
318
+          // register empty flag ourselves. If it is set, pretend an
319
+          // interrupt has happened and call the handler to free up
320
+          // space for us.
321
+          if (TEST(M_UCSRxA, M_UDREx))
322
+            _tx_udr_empty_irq();
323
+        }
324
+        else {
325
+          // nop, the interrupt handler will free up space for us
326
+        }
327
+      }
263
 
328
 
264
-  void MarlinSerial::flushTX(void) {
265
-    // TX
266
-    // If we have never written a byte, no need to flush. This special
267
-    // case is needed since there is no way to force the TXC (transmit
268
-    // complete) bit to 1 during initialization
269
-    if (!_written)
329
+      tx_buffer.buffer[tx_buffer.head] = c;
330
+      { CRITICAL_SECTION_START;
331
+          tx_buffer.head = i;
332
+          SBI(M_UCSRxB, M_UDRIEx);
333
+        CRITICAL_SECTION_END;
334
+      }
270
       return;
335
       return;
271
-
272
-    while (TEST(M_UCSRxB, M_UDRIEx) || !TEST(M_UCSRxA, M_TXCx)) {
273
-      if (!TEST(SREG, SREG_I) && TEST(M_UCSRxB, M_UDRIEx))
274
-        // Interrupts are globally disabled, but the DR empty
275
-        // interrupt should be enabled, so poll the DR empty flag to
276
-        // prevent deadlock
277
-        if (TEST(M_UCSRxA, M_UDREx))
278
-          _tx_udr_empty_irq();
279
     }
336
     }
280
-    // If we get here, nothing is queued anymore (DRIE is disabled) and
281
-    // the hardware finished tranmission (TXC is set).
282
-}
283
-
284
-#else
285
-  void MarlinSerial::write(uint8_t c) {
286
-    while (!TEST(M_UCSRxA, M_UDREx))
287
-      ;
288
-    M_UDRx = c;
337
+
338
+    void MarlinSerial::flushTX(void) {
339
+      // TX
340
+      // If we have never written a byte, no need to flush. This special
341
+      // case is needed since there is no way to force the TXC (transmit
342
+      // complete) bit to 1 during initialization
343
+      if (!_written)
344
+        return;
345
+
346
+      while (TEST(M_UCSRxB, M_UDRIEx) || !TEST(M_UCSRxA, M_TXCx)) {
347
+        if (!TEST(SREG, SREG_I) && TEST(M_UCSRxB, M_UDRIEx))
348
+          // Interrupts are globally disabled, but the DR empty
349
+          // interrupt should be enabled, so poll the DR empty flag to
350
+          // prevent deadlock
351
+          if (TEST(M_UCSRxA, M_UDREx))
352
+            _tx_udr_empty_irq();
353
+      }
354
+      // If we get here, nothing is queued anymore (DRIE is disabled) and
355
+      // the hardware finished tranmission (TXC is set).
289
   }
356
   }
290
-#endif
291
 
357
 
292
-// end NEW
358
+  #else
359
+    void MarlinSerial::write(uint8_t c) {
360
+      while (!TEST(M_UCSRxA, M_UDREx))
361
+        ;
362
+      M_UDRx = c;
363
+    }
364
+  #endif
293
 
365
 
294
-/// imports from print.h
366
+  // end NEW
295
 
367
 
368
+  /// imports from print.h
296
 
369
 
297
-void MarlinSerial::print(char c, int base) {
298
-  print((long) c, base);
299
-}
300
 
370
 
301
-void MarlinSerial::print(unsigned char b, int base) {
302
-  print((unsigned long) b, base);
303
-}
371
+  void MarlinSerial::print(char c, int base) {
372
+    print((long)c, base);
373
+  }
304
 
374
 
305
-void MarlinSerial::print(int n, int base) {
306
-  print((long) n, base);
307
-}
375
+  void MarlinSerial::print(unsigned char b, int base) {
376
+    print((unsigned long)b, base);
377
+  }
308
 
378
 
309
-void MarlinSerial::print(unsigned int n, int base) {
310
-  print((unsigned long) n, base);
311
-}
379
+  void MarlinSerial::print(int n, int base) {
380
+    print((long)n, base);
381
+  }
312
 
382
 
313
-void MarlinSerial::print(long n, int base) {
314
-  if (base == 0) {
315
-    write(n);
383
+  void MarlinSerial::print(unsigned int n, int base) {
384
+    print((unsigned long)n, base);
316
   }
385
   }
317
-  else if (base == 10) {
318
-    if (n < 0) {
319
-      print('-');
320
-      n = -n;
386
+
387
+  void MarlinSerial::print(long n, int base) {
388
+    if (base == 0)
389
+      write(n);
390
+    else if (base == 10) {
391
+      if (n < 0) {
392
+        print('-');
393
+        n = -n;
394
+      }
395
+      printNumber(n, 10);
321
     }
396
     }
322
-    printNumber(n, 10);
397
+    else
398
+      printNumber(n, base);
323
   }
399
   }
324
-  else {
325
-    printNumber(n, base);
400
+
401
+  void MarlinSerial::print(unsigned long n, int base) {
402
+    if (base == 0) write(n);
403
+    else printNumber(n, base);
326
   }
404
   }
327
-}
328
-
329
-void MarlinSerial::print(unsigned long n, int base) {
330
-  if (base == 0) write(n);
331
-  else printNumber(n, base);
332
-}
333
-
334
-void MarlinSerial::print(double n, int digits) {
335
-  printFloat(n, digits);
336
-}
337
-
338
-void MarlinSerial::println(void) {
339
-  print('\r');
340
-  print('\n');
341
-}
342
-
343
-void MarlinSerial::println(const String& s) {
344
-  print(s);
345
-  println();
346
-}
347
-
348
-void MarlinSerial::println(const char c[]) {
349
-  print(c);
350
-  println();
351
-}
352
-
353
-void MarlinSerial::println(char c, int base) {
354
-  print(c, base);
355
-  println();
356
-}
357
-
358
-void MarlinSerial::println(unsigned char b, int base) {
359
-  print(b, base);
360
-  println();
361
-}
362
-
363
-void MarlinSerial::println(int n, int base) {
364
-  print(n, base);
365
-  println();
366
-}
367
-
368
-void MarlinSerial::println(unsigned int n, int base) {
369
-  print(n, base);
370
-  println();
371
-}
372
-
373
-void MarlinSerial::println(long n, int base) {
374
-  print(n, base);
375
-  println();
376
-}
377
-
378
-void MarlinSerial::println(unsigned long n, int base) {
379
-  print(n, base);
380
-  println();
381
-}
382
-
383
-void MarlinSerial::println(double n, int digits) {
384
-  print(n, digits);
385
-  println();
386
-}
387
-
388
-// Private Methods /////////////////////////////////////////////////////////////
389
-
390
-void MarlinSerial::printNumber(unsigned long n, uint8_t base) {
391
-  unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
392
-  unsigned long i = 0;
393
-
394
-  if (n == 0) {
395
-    print('0');
396
-    return;
405
+
406
+  void MarlinSerial::print(double n, int digits) {
407
+    printFloat(n, digits);
397
   }
408
   }
398
 
409
 
399
-  while (n > 0) {
400
-    buf[i++] = n % base;
401
-    n /= base;
410
+  void MarlinSerial::println(void) {
411
+    print('\r');
412
+    print('\n');
402
   }
413
   }
403
 
414
 
404
-  for (; i > 0; i--)
405
-    print((char)(buf[i - 1] < 10 ?
406
-                 '0' + buf[i - 1] :
407
-                 'A' + buf[i - 1] - 10));
408
-}
409
-
410
-void MarlinSerial::printFloat(double number, uint8_t digits) {
411
-  // Handle negative numbers
412
-  if (number < 0.0) {
413
-    print('-');
414
-    number = -number;
415
+  void MarlinSerial::println(const String& s) {
416
+    print(s);
417
+    println();
415
   }
418
   }
416
 
419
 
417
-  // Round correctly so that print(1.999, 2) prints as "2.00"
418
-  double rounding = 0.5;
419
-  for (uint8_t i = 0; i < digits; ++i)
420
-    rounding /= 10.0;
420
+  void MarlinSerial::println(const char c[]) {
421
+    print(c);
422
+    println();
423
+  }
421
 
424
 
422
-  number += rounding;
425
+  void MarlinSerial::println(char c, int base) {
426
+    print(c, base);
427
+    println();
428
+  }
423
 
429
 
424
-  // Extract the integer part of the number and print it
425
-  unsigned long int_part = (unsigned long)number;
426
-  double remainder = number - (double)int_part;
427
-  print(int_part);
430
+  void MarlinSerial::println(unsigned char b, int base) {
431
+    print(b, base);
432
+    println();
433
+  }
428
 
434
 
429
-  // Print the decimal point, but only if there are digits beyond
430
-  if (digits > 0) print('.');
435
+  void MarlinSerial::println(int n, int base) {
436
+    print(n, base);
437
+    println();
438
+  }
431
 
439
 
432
-  // Extract digits from the remainder one at a time
433
-  while (digits-- > 0) {
434
-    remainder *= 10.0;
435
-    int toPrint = int(remainder);
436
-    print(toPrint);
437
-    remainder -= toPrint;
440
+  void MarlinSerial::println(unsigned int n, int base) {
441
+    print(n, base);
442
+    println();
438
   }
443
   }
439
-}
440
-// Preinstantiate Objects //////////////////////////////////////////////////////
441
 
444
 
445
+  void MarlinSerial::println(long n, int base) {
446
+    print(n, base);
447
+    println();
448
+  }
442
 
449
 
443
-MarlinSerial customizedSerial;
450
+  void MarlinSerial::println(unsigned long n, int base) {
451
+    print(n, base);
452
+    println();
453
+  }
444
 
454
 
445
-#endif // whole file
446
-#endif // !USBCON
455
+  void MarlinSerial::println(double n, int digits) {
456
+    print(n, digits);
457
+    println();
458
+  }
447
 
459
 
448
-// For AT90USB targets use the UART for BT interfacing
449
-#if defined(USBCON) && ENABLED(BLUETOOTH)
450
-  HardwareSerial bluetoothSerial;
451
-#endif
460
+  // Private Methods
452
 
461
 
453
-#if ENABLED(EMERGENCY_PARSER)
462
+  void MarlinSerial::printNumber(unsigned long n, uint8_t base) {
463
+    if (n) {
464
+      unsigned char buf[8 * sizeof(long)]; // Enough space for base 2
465
+      int8_t i = 0;
466
+      while (n) {
467
+        buf[i++] = n % base;
468
+        n /= base;
469
+      }
470
+      while (i--)
471
+        print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10)));
472
+    }
473
+    else
474
+      print('0');
475
+  }
454
 
476
 
455
-  // Currently looking for: M108, M112, M410
456
-  // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
477
+  void MarlinSerial::printFloat(double number, uint8_t digits) {
478
+    // Handle negative numbers
479
+    if (number < 0.0) {
480
+      print('-');
481
+      number = -number;
482
+    }
457
 
483
 
458
-  FORCE_INLINE void emergency_parser(unsigned char c) {
484
+    // Round correctly so that print(1.999, 2) prints as "2.00"
485
+    double rounding = 0.5;
486
+    for (uint8_t i = 0; i < digits; ++i)
487
+      rounding *= 0.1;
488
+
489
+    number += rounding;
490
+
491
+    // Extract the integer part of the number and print it
492
+    unsigned long int_part = (unsigned long)number;
493
+    double remainder = number - (double)int_part;
494
+    print(int_part);
495
+
496
+    // Print the decimal point, but only if there are digits beyond
497
+    if (digits) {
498
+      print('.');
499
+      // Extract digits from the remainder one at a time
500
+      while (digits--) {
501
+        remainder *= 10.0;
502
+        int toPrint = int(remainder);
503
+        print(toPrint);
504
+        remainder -= toPrint;
505
+      }
506
+    }
507
+  }
459
 
508
 
460
-    static e_parser_state state = state_RESET;
509
+  // Preinstantiate
510
+  MarlinSerial customizedSerial;
461
 
511
 
462
-    switch (state) {
463
-      case state_RESET:
464
-        switch (c) {
465
-          case ' ': break;
466
-          case 'N': state = state_N;      break;
467
-          case 'M': state = state_M;      break;
468
-          default: state = state_IGNORE;
469
-        }
470
-        break;
471
-
472
-      case state_N:
473
-        switch (c) {
474
-          case '0': case '1': case '2':
475
-          case '3': case '4': case '5':
476
-          case '6': case '7': case '8':
477
-          case '9': case '-': case ' ':   break;
478
-          case 'M': state = state_M;      break;
479
-          default:  state = state_IGNORE;
480
-        }
481
-        break;
482
-
483
-      case state_M:
484
-        switch (c) {
485
-          case ' ': break;
486
-          case '1': state = state_M1;     break;
487
-          case '4': state = state_M4;     break;
488
-          default: state = state_IGNORE;
489
-        }
490
-        break;
512
+#endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H)
491
 
513
 
492
-      case state_M1:
493
-        switch (c) {
494
-          case '0': state = state_M10;    break;
495
-          case '1': state = state_M11;    break;
496
-          default: state = state_IGNORE;
497
-        }
498
-        break;
499
-
500
-      case state_M10:
501
-        state = (c == '8') ? state_M108 : state_IGNORE;
502
-        break;
503
-
504
-      case state_M11:
505
-        state = (c == '2') ? state_M112 : state_IGNORE;
506
-        break;
507
-
508
-      case state_M4:
509
-        state = (c == '1') ? state_M41 : state_IGNORE;
510
-        break;
511
-
512
-      case state_M41:
513
-        state = (c == '0') ? state_M410 : state_IGNORE;
514
-        break;
515
-
516
-      case state_IGNORE:
517
-        if (c == '\n') state = state_RESET;
518
-        break;
519
-
520
-      default:
521
-        if (c == '\n') {
522
-          switch (state) {
523
-            case state_M108:
524
-              wait_for_heatup = false;
525
-              break;
526
-            case state_M112:
527
-              kill(PSTR(MSG_KILLED));
528
-              break;
529
-            case state_M410:
530
-              quickstop_stepper();
531
-              break;
532
-            default:
533
-              break;
534
-          }
535
-          state = state_RESET;
536
-        }
537
-    }
538
-  }
514
+// For AT90USB targets use the UART for BT interfacing
515
+#if defined(USBCON) && ENABLED(BLUETOOTH)
516
+  HardwareSerial bluetoothSerial;
539
 #endif
517
 #endif

+ 95
- 102
Marlin/MarlinSerial.h Wyświetl plik

29
 
29
 
30
 */
30
 */
31
 
31
 
32
-#ifndef MarlinSerial_h
33
-#define MarlinSerial_h
32
+#ifndef MARLINSERIAL_H
33
+#define MARLINSERIAL_H
34
 
34
 
35
 #include "MarlinConfig.h"
35
 #include "MarlinConfig.h"
36
 
36
 
52
   #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
52
   #define SERIAL_REGNAME_INTERNAL(registerbase,number,suffix) registerbase##number##suffix
53
 #endif
53
 #endif
54
 
54
 
55
-// Registers used by MarlinSerial class (these are expanded
56
-// depending on selected serial port
57
-#define M_UCSRxA SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number
58
-#define M_UCSRxB SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
59
-#define M_RXENx SERIAL_REGNAME(RXEN,SERIAL_PORT,)
60
-#define M_TXENx SERIAL_REGNAME(TXEN,SERIAL_PORT,)
61
-#define M_TXCx SERIAL_REGNAME(TXC,SERIAL_PORT,)
62
-#define M_RXCIEx SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
63
-#define M_UDREx SERIAL_REGNAME(UDRE,SERIAL_PORT,)
64
-#define M_UDRIEx SERIAL_REGNAME(UDRIE,SERIAL_PORT,)
65
-#define M_UDRx SERIAL_REGNAME(UDR,SERIAL_PORT,)
66
-#define M_UBRRxH SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
67
-#define M_UBRRxL SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
68
-#define M_RXCx SERIAL_REGNAME(RXC,SERIAL_PORT,)
69
-#define M_USARTx_RX_vect SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)
70
-#define M_U2Xx SERIAL_REGNAME(U2X,SERIAL_PORT,)
55
+// Registers used by MarlinSerial class (expanded depending on selected serial port)
56
+#define M_UCSRxA           SERIAL_REGNAME(UCSR,SERIAL_PORT,A) // defines M_UCSRxA to be UCSRnA where n is the serial port number
57
+#define M_UCSRxB           SERIAL_REGNAME(UCSR,SERIAL_PORT,B)
58
+#define M_RXENx            SERIAL_REGNAME(RXEN,SERIAL_PORT,)
59
+#define M_TXENx            SERIAL_REGNAME(TXEN,SERIAL_PORT,)
60
+#define M_TXCx             SERIAL_REGNAME(TXC,SERIAL_PORT,)
61
+#define M_RXCIEx           SERIAL_REGNAME(RXCIE,SERIAL_PORT,)
62
+#define M_UDREx            SERIAL_REGNAME(UDRE,SERIAL_PORT,)
63
+#define M_UDRIEx           SERIAL_REGNAME(UDRIE,SERIAL_PORT,)
64
+#define M_UDRx             SERIAL_REGNAME(UDR,SERIAL_PORT,)
65
+#define M_UBRRxH           SERIAL_REGNAME(UBRR,SERIAL_PORT,H)
66
+#define M_UBRRxL           SERIAL_REGNAME(UBRR,SERIAL_PORT,L)
67
+#define M_RXCx             SERIAL_REGNAME(RXC,SERIAL_PORT,)
68
+#define M_USARTx_RX_vect   SERIAL_REGNAME(USART,SERIAL_PORT,_RX_vect)
69
+#define M_U2Xx             SERIAL_REGNAME(U2X,SERIAL_PORT,)
71
 #define M_USARTx_UDRE_vect SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)
70
 #define M_USARTx_UDRE_vect SERIAL_REGNAME(USART,SERIAL_PORT,_UDRE_vect)
72
 
71
 
73
-
74
 #define DEC 10
72
 #define DEC 10
75
 #define HEX 16
73
 #define HEX 16
76
 #define OCT 8
74
 #define OCT 8
77
 #define BIN 2
75
 #define BIN 2
78
 #define BYTE 0
76
 #define BYTE 0
79
 
77
 
80
-
81
 #ifndef USBCON
78
 #ifndef USBCON
82
-// Define constants and variables for buffering incoming serial data.  We're
83
-// using a ring buffer (I think), in which rx_buffer_head is the index of the
84
-// location to which to write the next incoming character and rx_buffer_tail
85
-// is the index of the location from which to read.
86
-// 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
87
-#ifndef RX_BUFFER_SIZE
88
-  #define RX_BUFFER_SIZE 128
89
-#endif
90
-#ifndef TX_BUFFER_SIZE
91
-  #define TX_BUFFER_SIZE 32
92
-#endif
93
-#if !((RX_BUFFER_SIZE == 256) ||(RX_BUFFER_SIZE == 128) ||(RX_BUFFER_SIZE == 64) ||(RX_BUFFER_SIZE == 32) ||(RX_BUFFER_SIZE == 16) ||(RX_BUFFER_SIZE == 8) ||(RX_BUFFER_SIZE == 4) ||(RX_BUFFER_SIZE == 2))
94
-  #error "RX_BUFFER_SIZE has to be a power of 2 and >= 2"
95
-#endif
96
-#if !((TX_BUFFER_SIZE == 256) ||(TX_BUFFER_SIZE == 128) ||(TX_BUFFER_SIZE == 64) ||(TX_BUFFER_SIZE == 32) ||(TX_BUFFER_SIZE == 16) ||(TX_BUFFER_SIZE == 8) ||(TX_BUFFER_SIZE == 4) ||(TX_BUFFER_SIZE == 2) ||(TX_BUFFER_SIZE == 0))
97
-  #error TX_BUFFER_SIZE has to be a power of 2 or 0
98
-#endif
99
-
100
-struct ring_buffer_r {
101
-  unsigned char buffer[RX_BUFFER_SIZE];
102
-  volatile uint8_t head;
103
-  volatile uint8_t tail;
104
-};
79
+  // Define constants and variables for buffering incoming serial data.  We're
80
+  // using a ring buffer (I think), in which rx_buffer_head is the index of the
81
+  // location to which to write the next incoming character and rx_buffer_tail
82
+  // is the index of the location from which to read.
83
+  // 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256)
84
+  #ifndef RX_BUFFER_SIZE
85
+    #define RX_BUFFER_SIZE 128
86
+  #endif
87
+  #ifndef TX_BUFFER_SIZE
88
+    #define TX_BUFFER_SIZE 32
89
+  #endif
90
+  #if !((RX_BUFFER_SIZE == 256) ||(RX_BUFFER_SIZE == 128) ||(RX_BUFFER_SIZE == 64) ||(RX_BUFFER_SIZE == 32) ||(RX_BUFFER_SIZE == 16) ||(RX_BUFFER_SIZE == 8) ||(RX_BUFFER_SIZE == 4) ||(RX_BUFFER_SIZE == 2))
91
+    #error "RX_BUFFER_SIZE has to be a power of 2 and >= 2"
92
+  #endif
93
+  #if !((TX_BUFFER_SIZE == 256) ||(TX_BUFFER_SIZE == 128) ||(TX_BUFFER_SIZE == 64) ||(TX_BUFFER_SIZE == 32) ||(TX_BUFFER_SIZE == 16) ||(TX_BUFFER_SIZE == 8) ||(TX_BUFFER_SIZE == 4) ||(TX_BUFFER_SIZE == 2) ||(TX_BUFFER_SIZE == 0))
94
+    #error TX_BUFFER_SIZE has to be a power of 2 or 0
95
+  #endif
105
 
96
 
106
-#if TX_BUFFER_SIZE > 0
107
-  struct ring_buffer_t {
108
-    unsigned char buffer[TX_BUFFER_SIZE];
97
+  struct ring_buffer_r {
98
+    unsigned char buffer[RX_BUFFER_SIZE];
109
     volatile uint8_t head;
99
     volatile uint8_t head;
110
     volatile uint8_t tail;
100
     volatile uint8_t tail;
111
   };
101
   };
112
-#endif
113
 
102
 
114
-#if UART_PRESENT(SERIAL_PORT)
115
-  extern ring_buffer_r rx_buffer;
116
   #if TX_BUFFER_SIZE > 0
103
   #if TX_BUFFER_SIZE > 0
117
-    extern ring_buffer_t tx_buffer;
104
+    struct ring_buffer_t {
105
+      unsigned char buffer[TX_BUFFER_SIZE];
106
+      volatile uint8_t head;
107
+      volatile uint8_t tail;
108
+    };
118
   #endif
109
   #endif
119
-#endif
120
-
121
-#if ENABLED(EMERGENCY_PARSER)
122
-  #include "language.h"
123
-  void emergency_parser(unsigned char c);
124
-#endif
125
 
110
 
126
-class MarlinSerial { //: public Stream
127
-
128
-  public:
129
-    MarlinSerial();
130
-    void begin(long);
131
-    void end();
132
-    int peek(void);
133
-    int read(void);
134
-    void flush(void);
135
-    uint8_t available(void);
136
-    void checkRx(void);
137
-    void write(uint8_t c);
111
+  #if UART_PRESENT(SERIAL_PORT)
112
+    extern ring_buffer_r rx_buffer;
138
     #if TX_BUFFER_SIZE > 0
113
     #if TX_BUFFER_SIZE > 0
139
-      uint8_t availableForWrite(void);
140
-      void flushTX(void);
114
+      extern ring_buffer_t tx_buffer;
141
     #endif
115
     #endif
116
+  #endif
117
+
118
+  class MarlinSerial { //: public Stream
119
+
120
+    public:
121
+      MarlinSerial() {};
122
+      static void begin(const long);
123
+      static void end();
124
+      static int peek(void);
125
+      static int read(void);
126
+      static void flush(void);
127
+      static uint8_t available(void);
128
+      static void checkRx(void);
129
+      static void write(const uint8_t c);
130
+      #if TX_BUFFER_SIZE > 0
131
+        static uint8_t availableForWrite(void);
132
+        static void flushTX(void);
133
+      #endif
134
+
135
+    private:
136
+      static void printNumber(unsigned long, const uint8_t);
137
+      static void printFloat(double, uint8_t);
138
+
139
+    public:
140
+      static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); }
141
+      static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
142
+      static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
143
+      static FORCE_INLINE void print(const char* str) { write(str); }
144
+
145
+      static void print(char, int = BYTE);
146
+      static void print(unsigned char, int = BYTE);
147
+      static void print(int, int = DEC);
148
+      static void print(unsigned int, int = DEC);
149
+      static void print(long, int = DEC);
150
+      static void print(unsigned long, int = DEC);
151
+      static void print(double, int = 2);
152
+
153
+      static void println(const String& s);
154
+      static void println(const char[]);
155
+      static void println(char, int = BYTE);
156
+      static void println(unsigned char, int = BYTE);
157
+      static void println(int, int = DEC);
158
+      static void println(unsigned int, int = DEC);
159
+      static void println(long, int = DEC);
160
+      static void println(unsigned long, int = DEC);
161
+      static void println(double, int = 2);
162
+      static void println(void);
163
+  };
164
+
165
+  extern MarlinSerial customizedSerial;
142
 
166
 
143
-  private:
144
-    void printNumber(unsigned long, uint8_t);
145
-    void printFloat(double, uint8_t);
146
-
147
-  public:
148
-    FORCE_INLINE void write(const char* str) { while (*str) write(*str++); }
149
-    FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); }
150
-    FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); }
151
-    FORCE_INLINE void print(const char* str) { write(str); }
152
-
153
-    void print(char, int = BYTE);
154
-    void print(unsigned char, int = BYTE);
155
-    void print(int, int = DEC);
156
-    void print(unsigned int, int = DEC);
157
-    void print(long, int = DEC);
158
-    void print(unsigned long, int = DEC);
159
-    void print(double, int = 2);
160
-
161
-    void println(const String& s);
162
-    void println(const char[]);
163
-    void println(char, int = BYTE);
164
-    void println(unsigned char, int = BYTE);
165
-    void println(int, int = DEC);
166
-    void println(unsigned int, int = DEC);
167
-    void println(long, int = DEC);
168
-    void println(unsigned long, int = DEC);
169
-    void println(double, int = 2);
170
-    void println(void);
171
-};
172
-
173
-extern MarlinSerial customizedSerial;
174
 #endif // !USBCON
167
 #endif // !USBCON
175
 
168
 
176
 // Use the UART for Bluetooth in AT90USB configurations
169
 // Use the UART for Bluetooth in AT90USB configurations
178
   extern HardwareSerial bluetoothSerial;
171
   extern HardwareSerial bluetoothSerial;
179
 #endif
172
 #endif
180
 
173
 
181
-#endif
174
+#endif // MARLINSERIAL_H

+ 10422
- 6017
Marlin/Marlin_main.cpp
Plik diff jest za duży
Wyświetl plik


+ 878
- 298
Marlin/SanityCheck.h
Plik diff jest za duży
Wyświetl plik


+ 18
- 8
Marlin/Sd2Card.cpp Wyświetl plik

31
 #if ENABLED(SDSUPPORT)
31
 #if ENABLED(SDSUPPORT)
32
 #include "Sd2Card.h"
32
 #include "Sd2Card.h"
33
 
33
 
34
+#if ENABLED(USE_WATCHDOG)
35
+  #include "watchdog.h"
36
+#endif
37
+
34
 //------------------------------------------------------------------------------
38
 //------------------------------------------------------------------------------
35
 #if DISABLED(SOFTWARE_SPI)
39
 #if DISABLED(SOFTWARE_SPI)
36
   // functions for hardware SPI
40
   // functions for hardware SPI
299
   uint16_t t0 = (uint16_t)millis();
303
   uint16_t t0 = (uint16_t)millis();
300
   uint32_t arg;
304
   uint32_t arg;
301
 
305
 
306
+  // If init takes more than 4s it could trigger
307
+  // watchdog leading to a reboot loop.
308
+  #if ENABLED(USE_WATCHDOG)
309
+    watchdog_reset();
310
+  #endif
311
+
302
   // set pin modes
312
   // set pin modes
303
   pinMode(chipSelectPin_, OUTPUT);
313
   pinMode(chipSelectPin_, OUTPUT);
304
   chipSelectHigh();
314
   chipSelectHigh();
305
-  pinMode(SPI_MISO_PIN, INPUT);
306
-  pinMode(SPI_MOSI_PIN, OUTPUT);
307
-  pinMode(SPI_SCK_PIN, OUTPUT);
315
+  SET_INPUT(SPI_MISO_PIN);
316
+  SET_OUTPUT(SPI_MOSI_PIN);
317
+  SET_OUTPUT(SPI_SCK_PIN);
308
 
318
 
309
   #if DISABLED(SOFTWARE_SPI)
319
   #if DISABLED(SOFTWARE_SPI)
310
     // SS must be in output mode even it is not chip select
320
     // SS must be in output mode even it is not chip select
311
-    pinMode(SS_PIN, OUTPUT);
321
+    SET_OUTPUT(SS_PIN);
312
     // set SS high - may be chip select for another SPI device
322
     // set SS high - may be chip select for another SPI device
313
     #if SET_SPI_SS_HIGH
323
     #if SET_SPI_SS_HIGH
314
-      digitalWrite(SS_PIN, HIGH);
324
+      WRITE(SS_PIN, HIGH);
315
     #endif  // SET_SPI_SS_HIGH
325
     #endif  // SET_SPI_SS_HIGH
316
     // set SCK rate for initialization commands
326
     // set SCK rate for initialization commands
317
     spiRate_ = SPI_SD_INIT_RATE;
327
     spiRate_ = SPI_SD_INIT_RATE;
396
       else
406
       else
397
         error(SD_CARD_ERROR_CMD17);
407
         error(SD_CARD_ERROR_CMD17);
398
 
408
 
399
-      if (--retryCnt) break;
409
+      if (!--retryCnt) break;
400
 
410
 
401
       chipSelectHigh();
411
       chipSelectHigh();
402
       cardCommand(CMD12, 0); // Try sending a stop command, ignore the result.
412
       cardCommand(CMD12, 0); // Try sending a stop command, ignore the result.
654
 bool Sd2Card::writeData(uint8_t token, const uint8_t* src) {
664
 bool Sd2Card::writeData(uint8_t token, const uint8_t* src) {
655
   spiSendBlock(token, src);
665
   spiSendBlock(token, src);
656
 
666
 
657
-  spiSend(0xff);  // dummy crc
658
-  spiSend(0xff);  // dummy crc
667
+  spiSend(0xFF);  // dummy crc
668
+  spiSend(0xFF);  // dummy crc
659
 
669
 
660
   status_ = spiRec();
670
   status_ = spiRec();
661
   if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) {
671
   if ((status_ & DATA_RES_MASK) != DATA_RES_ACCEPTED) {

+ 1
- 1
Marlin/Sd2Card.h Wyświetl plik

125
  * define SOFTWARE_SPI to use bit-bang SPI
125
  * define SOFTWARE_SPI to use bit-bang SPI
126
  */
126
  */
127
 //------------------------------------------------------------------------------
127
 //------------------------------------------------------------------------------
128
-#if MEGA_SOFT_SPI && (defined(__AVR_ATmega1280__)||defined(__AVR_ATmega2560__))
128
+#if MEGA_SOFT_SPI
129
   #define SOFTWARE_SPI
129
   #define SOFTWARE_SPI
130
 #elif USE_SOFTWARE_SPI
130
 #elif USE_SOFTWARE_SPI
131
   #define SOFTWARE_SPI
131
   #define SOFTWARE_SPI

+ 2
- 2
Marlin/SdBaseFile.cpp Wyświetl plik

674
       index = 0;
674
       index = 0;
675
     }
675
     }
676
     // initialize as empty file
676
     // initialize as empty file
677
-    memset(p, 0, sizeof(dir_t));
677
+    memset(p, 0, sizeof(*p));
678
     memcpy(p->name, dname, 11);
678
     memcpy(p->name, dname, 11);
679
 
679
 
680
     // set timestamps
680
     // set timestamps
1819
 //------------------------------------------------------------------------------
1819
 //------------------------------------------------------------------------------
1820
 // suppress cpplint warnings with NOLINT comment
1820
 // suppress cpplint warnings with NOLINT comment
1821
 #if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
1821
 #if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
1822
-  void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0;  // NOLINT
1822
+  void (*SdBaseFile::oldDateTime_)(uint16_t &date, uint16_t &time) = 0;  // NOLINT
1823
 #endif  // ALLOW_DEPRECATED_FUNCTIONS
1823
 #endif  // ALLOW_DEPRECATED_FUNCTIONS
1824
 
1824
 
1825
 
1825
 

+ 2
- 2
Marlin/SdBaseFile.h Wyświetl plik

402
    * \param[in] dateTime The user's call back function.
402
    * \param[in] dateTime The user's call back function.
403
    */
403
    */
404
   static void dateTimeCallback(
404
   static void dateTimeCallback(
405
-    void (*dateTime)(uint16_t& date, uint16_t& time)) {  // NOLINT
405
+    void (*dateTime)(uint16_t &date, uint16_t &time)) {  // NOLINT
406
     oldDateTime_ = dateTime;
406
     oldDateTime_ = dateTime;
407
     dateTime_ = dateTime ? oldToNew : 0;
407
     dateTime_ = dateTime ? oldToNew : 0;
408
   }
408
   }
477
   //------------------------------------------------------------------------------
477
   //------------------------------------------------------------------------------
478
   // rest are private
478
   // rest are private
479
  private:
479
  private:
480
-  static void (*oldDateTime_)(uint16_t& date, uint16_t& time);  // NOLINT
480
+  static void (*oldDateTime_)(uint16_t &date, uint16_t &time);  // NOLINT
481
   static void oldToNew(uint16_t* date, uint16_t* time) {
481
   static void oldToNew(uint16_t* date, uint16_t* time) {
482
     uint16_t d;
482
     uint16_t d;
483
     uint16_t t;
483
     uint16_t t;

+ 1
- 1
Marlin/SdFatStructs.h Wyświetl plik

523
   uint8_t  reservedNT;
523
   uint8_t  reservedNT;
524
           /**
524
           /**
525
            * The granularity of the seconds part of creationTime is 2 seconds
525
            * The granularity of the seconds part of creationTime is 2 seconds
526
-           * so this field is a count of tenths of a second and its valid
526
+           * so this field is a count of tenths of a second and it's valid
527
            * value range is 0-199 inclusive. (WHG note - seems to be hundredths)
527
            * value range is 0-199 inclusive. (WHG note - seems to be hundredths)
528
            */
528
            */
529
   uint8_t  creationTimeTenths;
529
   uint8_t  creationTimeTenths;

+ 5
- 6
Marlin/SdFatUtil.h Wyświetl plik

26
  *
26
  *
27
  * This file is part of the Arduino Sd2Card Library
27
  * This file is part of the Arduino Sd2Card Library
28
  */
28
  */
29
+#ifndef SdFatUtil_h
30
+#define SdFatUtil_h
31
+
29
 #include "Marlin.h"
32
 #include "Marlin.h"
30
 #if ENABLED(SDSUPPORT)
33
 #if ENABLED(SDSUPPORT)
31
 
34
 
32
-#ifndef SdFatUtil_h
33
-#define SdFatUtil_h
34
 /**
35
 /**
35
  * \file
36
  * \file
36
  * \brief Useful utility functions.
37
  * \brief Useful utility functions.
37
  */
38
  */
38
-#include "Marlin.h"
39
-#include "MarlinSerial.h"
40
 /** Store and print a string in flash memory.*/
39
 /** Store and print a string in flash memory.*/
41
 #define PgmPrint(x) SerialPrint_P(PSTR(x))
40
 #define PgmPrint(x) SerialPrint_P(PSTR(x))
42
 /** Store and print a string in flash memory followed by a CR/LF.*/
41
 /** Store and print a string in flash memory followed by a CR/LF.*/
51
 }
50
 }
52
 
51
 
53
 using namespace SdFatUtil;  // NOLINT
52
 using namespace SdFatUtil;  // NOLINT
54
-#endif  //#define SdFatUtil_h
55
 
53
 
54
+#endif // SDSUPPORT
56
 
55
 
57
-#endif
56
+#endif // SdFatUtil_h

+ 5
- 3
Marlin/Version.h Wyświetl plik

35
   /**
35
   /**
36
    * Marlin release version identifier
36
    * Marlin release version identifier
37
    */
37
    */
38
-  #define SHORT_BUILD_VERSION "1.1.0-RC7"
38
+  #define SHORT_BUILD_VERSION "1.1.4"
39
 
39
 
40
   /**
40
   /**
41
    * Verbose version identifier which should contain a reference to the location
41
    * Verbose version identifier which should contain a reference to the location
48
    * here we define this default string as the date where the latest release
48
    * here we define this default string as the date where the latest release
49
    * version was tagged.
49
    * version was tagged.
50
    */
50
    */
51
-  #define STRING_DISTRIBUTION_DATE "2016-07-31 12:00"
51
+  #define STRING_DISTRIBUTION_DATE "2017-07-04 12:00"
52
 
52
 
53
   /**
53
   /**
54
    * Required minimum Configuration.h and Configuration_adv.h file versions.
54
    * Required minimum Configuration.h and Configuration_adv.h file versions.
61
   #define REQUIRED_CONFIGURATION_ADV_H_VERSION 010100
61
   #define REQUIRED_CONFIGURATION_ADV_H_VERSION 010100
62
 
62
 
63
   /**
63
   /**
64
-   * @todo: Missing documentation block
64
+   * The protocol for communication to the host. Protocol indicates communication
65
+   * standards such as the use of ASCII, "echo:" and "error:" line prefixes, etc.
66
+   * (Other behaviors are given by the firmware version and capabilities report.)
65
    */
67
    */
66
   #define PROTOCOL_VERSION "1.0"
68
   #define PROTOCOL_VERSION "1.0"
67
 
69
 

+ 1
- 1
Marlin/blinkm.cpp Wyświetl plik

42
   Wire.endTransmission();
42
   Wire.endTransmission();
43
 }
43
 }
44
 
44
 
45
-#endif //BLINKM
45
+#endif // BLINKM
46
 
46
 

+ 8
- 5
Marlin/boards.h Wyświetl plik

32
 #define BOARD_CNCONTROLS_11     111  // Cartesio CN Controls V11
32
 #define BOARD_CNCONTROLS_11     111  // Cartesio CN Controls V11
33
 #define BOARD_CNCONTROLS_12     112  // Cartesio CN Controls V12
33
 #define BOARD_CNCONTROLS_12     112  // Cartesio CN Controls V12
34
 #define BOARD_CHEAPTRONIC       2    // Cheaptronic v1.0
34
 #define BOARD_CHEAPTRONIC       2    // Cheaptronic v1.0
35
+#define BOARD_CHEAPTRONIC_V2    21   // Cheaptronic v2.0
35
 #define BOARD_SETHI             20   // Sethi 3D_1
36
 #define BOARD_SETHI             20   // Sethi 3D_1
37
+#define BOARD_MIGHTYBOARD_REVE  200  // Makerbot Mightyboard Revision E
36
 #define BOARD_RAMPS_OLD         3    // MEGA/RAMPS up to 1.2
38
 #define BOARD_RAMPS_OLD         3    // MEGA/RAMPS up to 1.2
37
 #define BOARD_RAMPS_13_EFB      33   // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
39
 #define BOARD_RAMPS_13_EFB      33   // RAMPS 1.3 (Power outputs: Hotend, Fan, Bed)
38
 #define BOARD_RAMPS_13_EEB      34   // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
40
 #define BOARD_RAMPS_13_EEB      34   // RAMPS 1.3 (Power outputs: Hotend0, Hotend1, Bed)
57
 #define BOARD_MELZI_MAKR3D      66   // Melzi with ATmega1284 (MaKr3d version)
59
 #define BOARD_MELZI_MAKR3D      66   // Melzi with ATmega1284 (MaKr3d version)
58
 #define BOARD_AZTEEG_X3         67   // Azteeg X3
60
 #define BOARD_AZTEEG_X3         67   // Azteeg X3
59
 #define BOARD_AZTEEG_X3_PRO     68   // Azteeg X3 Pro
61
 #define BOARD_AZTEEG_X3_PRO     68   // Azteeg X3 Pro
62
+#define BOARD_ANET_10           69   // Anet 1.0 (Melzi clone)
60
 #define BOARD_ULTIMAKER         7    // Ultimaker
63
 #define BOARD_ULTIMAKER         7    // Ultimaker
61
 #define BOARD_ULTIMAKER_OLD     71   // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
64
 #define BOARD_ULTIMAKER_OLD     71   // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
62
 #define BOARD_ULTIMAIN_2        72   // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
65
 #define BOARD_ULTIMAIN_2        72   // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
69
 #define BOARD_PRINTRBOARD_REVF  811  // Printrboard Revision F (AT90USB1286)
72
 #define BOARD_PRINTRBOARD_REVF  811  // Printrboard Revision F (AT90USB1286)
70
 #define BOARD_BRAINWAVE         82   // Brainwave (AT90USB646)
73
 #define BOARD_BRAINWAVE         82   // Brainwave (AT90USB646)
71
 #define BOARD_SAV_MKI           83   // SAV Mk-I (AT90USB1286)
74
 #define BOARD_SAV_MKI           83   // SAV Mk-I (AT90USB1286)
72
-#define BOARD_TEENSY2           84   // Teensy++2.0 (AT90USB1286) - CLI compile: DEFINES=AT90USBxx_TEENSYPP_ASSIGNMENTS HARDWARE_MOTHERBOARD=84  make
75
+#define BOARD_TEENSY2           84   // Teensy++2.0 (AT90USB1286) - CLI compile: HARDWARE_MOTHERBOARD=84  make
73
 #define BOARD_BRAINWAVE_PRO     85   // Brainwave Pro (AT90USB1286)
76
 #define BOARD_BRAINWAVE_PRO     85   // Brainwave Pro (AT90USB1286)
74
 #define BOARD_GEN3_PLUS         9    // Gen3+
77
 #define BOARD_GEN3_PLUS         9    // Gen3+
75
 #define BOARD_GEN3_MONOLITHIC   22   // Gen3 Monolithic Electronics
78
 #define BOARD_GEN3_MONOLITHIC   22   // Gen3 Monolithic Electronics
77
 #define BOARD_MEGATRONICS_2     701  // Megatronics v2.0
80
 #define BOARD_MEGATRONICS_2     701  // Megatronics v2.0
78
 #define BOARD_MINITRONICS       702  // Minitronics v1.0/1.1
81
 #define BOARD_MINITRONICS       702  // Minitronics v1.0/1.1
79
 #define BOARD_MEGATRONICS_3     703  // Megatronics v3.0
82
 #define BOARD_MEGATRONICS_3     703  // Megatronics v3.0
83
+#define BOARD_MEGATRONICS_31    704  // Megatronics v3.1
80
 #define BOARD_OMCA_A            90   // Alpha OMCA board
84
 #define BOARD_OMCA_A            90   // Alpha OMCA board
81
 #define BOARD_OMCA              91   // Final OMCA board
85
 #define BOARD_OMCA              91   // Final OMCA board
82
 #define BOARD_RAMBO             301  // Rambo
86
 #define BOARD_RAMBO             301  // Rambo
83
 #define BOARD_MINIRAMBO         302  // Mini-Rambo
87
 #define BOARD_MINIRAMBO         302  // Mini-Rambo
84
-#define BOARD_AJ4P              303  // AJ4P
88
+#define BOARD_SCOOVO_X9H        303  // abee Scoovo X9H
85
 #define BOARD_MEGACONTROLLER    310  // Mega controller
89
 #define BOARD_MEGACONTROLLER    310  // Mega controller
86
 #define BOARD_ELEFU_3           21   // Elefu Ra Board (v3)
90
 #define BOARD_ELEFU_3           21   // Elefu Ra Board (v3)
87
 #define BOARD_5DPRINT           88   // 5DPrint D8 Driver Board
91
 #define BOARD_5DPRINT           88   // 5DPrint D8 Driver Board
92
 #define BOARD_BAM_DICE          401  // 2PrintBeta BAM&DICE with STK drivers
96
 #define BOARD_BAM_DICE          401  // 2PrintBeta BAM&DICE with STK drivers
93
 #define BOARD_BAM_DICE_DUE      402  // 2PrintBeta BAM&DICE Due with STK drivers
97
 #define BOARD_BAM_DICE_DUE      402  // 2PrintBeta BAM&DICE Due with STK drivers
94
 #define BOARD_BQ_ZUM_MEGA_3D    503  // bq ZUM Mega 3D
98
 #define BOARD_BQ_ZUM_MEGA_3D    503  // bq ZUM Mega 3D
95
-
96
-#define BOARD_99                99   // This is in pins.h but...?
99
+#define BOARD_ZRIB_V20          504  // zrib V2.0 control board (Chinese knock off RAMPS replica)
97
 
100
 
98
 #define MB(board) (MOTHERBOARD==BOARD_##board)
101
 #define MB(board) (MOTHERBOARD==BOARD_##board)
99
 
102
 
100
-#endif //__BOARDS_H
103
+#endif // __BOARDS_H

+ 3
- 2
Marlin/buzzer.h Wyświetl plik

104
      * @param duration Duration of the tone in milliseconds
104
      * @param duration Duration of the tone in milliseconds
105
      * @param frequency Frequency of the tone in hertz
105
      * @param frequency Frequency of the tone in hertz
106
      */
106
      */
107
-    void tone(uint16_t const &duration, uint16_t const &frequency = 0) {
107
+    void tone(const uint16_t &duration, const uint16_t &frequency = 0) {
108
       while (buffer.isFull()) {
108
       while (buffer.isFull()) {
109
         this->tick();
109
         this->tick();
110
         thermalManager.manage_heater();
110
         thermalManager.manage_heater();
111
       }
111
       }
112
-      this->buffer.enqueue((tone_t) { duration, frequency });
112
+      tone_t tone = { duration, frequency };
113
+      this->buffer.enqueue(tone);
113
     }
114
     }
114
 
115
 
115
     /**
116
     /**

+ 326
- 65
Marlin/cardreader.cpp Wyświetl plik

24
 
24
 
25
 #include "ultralcd.h"
25
 #include "ultralcd.h"
26
 #include "stepper.h"
26
 #include "stepper.h"
27
-#include "temperature.h"
28
 #include "language.h"
27
 #include "language.h"
29
 
28
 
30
 #include "Marlin.h"
29
 #include "Marlin.h"
31
 
30
 
32
 #if ENABLED(SDSUPPORT)
31
 #if ENABLED(SDSUPPORT)
33
 
32
 
33
+#define LONGEST_FILENAME (longFilename[0] ? longFilename : filename)
34
+
34
 CardReader::CardReader() {
35
 CardReader::CardReader() {
36
+  #if ENABLED(SDCARD_SORT_ALPHA)
37
+    sort_count = 0;
38
+    #if ENABLED(SDSORT_GCODE)
39
+      sort_alpha = true;
40
+      sort_folders = FOLDER_SORTING;
41
+      //sort_reverse = false;
42
+    #endif
43
+  #endif
44
+  sdprinting = cardOK = saving = logging = false;
35
   filesize = 0;
45
   filesize = 0;
36
   sdpos = 0;
46
   sdpos = 0;
37
-  sdprinting = false;
38
-  cardOK = false;
39
-  saving = false;
40
-  logging = false;
41
   workDirDepth = 0;
47
   workDirDepth = 0;
42
   file_subcall_ctr = 0;
48
   file_subcall_ctr = 0;
43
-  memset(workDirParents, 0, sizeof(workDirParents));
49
+  ZERO(workDirParents);
44
 
50
 
45
   autostart_stilltocheck = true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
51
   autostart_stilltocheck = true; //the SD start is delayed, because otherwise the serial cannot answer fast enough to make contact with the host software.
46
   autostart_index = 0;
52
   autostart_index = 0;
48
   //power to SD reader
54
   //power to SD reader
49
   #if SDPOWER > -1
55
   #if SDPOWER > -1
50
     OUT_WRITE(SDPOWER, HIGH);
56
     OUT_WRITE(SDPOWER, HIGH);
51
-  #endif //SDPOWER
57
+  #endif // SDPOWER
52
 
58
 
53
   next_autostart_ms = millis() + 5000;
59
   next_autostart_ms = millis() + 5000;
54
 }
60
 }
68
  * Dive into a folder and recurse depth-first to perform a pre-set operation lsAction:
74
  * Dive into a folder and recurse depth-first to perform a pre-set operation lsAction:
69
  *   LS_Count       - Add +1 to nrFiles for every file within the parent
75
  *   LS_Count       - Add +1 to nrFiles for every file within the parent
70
  *   LS_GetFilename - Get the filename of the file indexed by nrFiles
76
  *   LS_GetFilename - Get the filename of the file indexed by nrFiles
71
- *   LS_SerialPrint - Print the full path of each file to serial output
77
+ *   LS_SerialPrint - Print the full path and size of each file to serial output
72
  */
78
  */
73
 void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/) {
79
 void CardReader::lsDive(const char *prepend, SdFile parent, const char * const match/*=NULL*/) {
74
   dir_t p;
80
   dir_t p;
85
       createFilename(lfilename, p);
91
       createFilename(lfilename, p);
86
 
92
 
87
       // Allocate enough stack space for the full path to a folder, trailing slash, and nul
93
       // Allocate enough stack space for the full path to a folder, trailing slash, and nul
88
-      boolean prepend_is_empty = (prepend[0] == '\0');
94
+      bool prepend_is_empty = (prepend[0] == '\0');
89
       int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(lfilename) + 1 + 1;
95
       int len = (prepend_is_empty ? 1 : strlen(prepend)) + strlen(lfilename) + 1 + 1;
90
       char path[len];
96
       char path[len];
91
 
97
 
103
       SdFile dir;
109
       SdFile dir;
104
       if (!dir.open(parent, lfilename, O_READ)) {
110
       if (!dir.open(parent, lfilename, O_READ)) {
105
         if (lsAction == LS_SerialPrint) {
111
         if (lsAction == LS_SerialPrint) {
106
-          SERIAL_ECHO_START;
112
+          SERIAL_ECHO_START();
107
           SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
113
           SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
108
           SERIAL_ECHOLN(lfilename);
114
           SERIAL_ECHOLN(lfilename);
109
         }
115
         }
117
       if (pn0 == DIR_NAME_DELETED || pn0 == '.') continue;
123
       if (pn0 == DIR_NAME_DELETED || pn0 == '.') continue;
118
       if (longFilename[0] == '.') continue;
124
       if (longFilename[0] == '.') continue;
119
 
125
 
120
-      if (!DIR_IS_FILE_OR_SUBDIR(&p)) continue;
126
+      if (!DIR_IS_FILE_OR_SUBDIR(&p) || (p.attributes & DIR_ATT_HIDDEN)) continue;
121
 
127
 
122
       filenameIsDir = DIR_IS_SUBDIR(&p);
128
       filenameIsDir = DIR_IS_SUBDIR(&p);
123
 
129
 
127
         case LS_Count:
133
         case LS_Count:
128
           nrFiles++;
134
           nrFiles++;
129
           break;
135
           break;
136
+
130
         case LS_SerialPrint:
137
         case LS_SerialPrint:
131
           createFilename(filename, p);
138
           createFilename(filename, p);
132
           SERIAL_PROTOCOL(prepend);
139
           SERIAL_PROTOCOL(prepend);
133
-          SERIAL_PROTOCOLLN(filename);
140
+          SERIAL_PROTOCOL(filename);
141
+          SERIAL_PROTOCOLCHAR(' ');
142
+          SERIAL_PROTOCOLLN(p.fileSize);
134
           break;
143
           break;
144
+
135
         case LS_GetFilename:
145
         case LS_GetFilename:
136
           createFilename(filename, p);
146
           createFilename(filename, p);
137
           if (match != NULL) {
147
           if (match != NULL) {
146
   } // while readDir
156
   } // while readDir
147
 }
157
 }
148
 
158
 
149
-void CardReader::ls()  {
159
+void CardReader::ls() {
150
   lsAction = LS_SerialPrint;
160
   lsAction = LS_SerialPrint;
151
   root.rewind();
161
   root.rewind();
152
   lsDive("", root);
162
   lsDive("", root);
198
       // Open the sub-item as the new dive parent
208
       // Open the sub-item as the new dive parent
199
       SdFile dir;
209
       SdFile dir;
200
       if (!dir.open(diveDir, segment, O_READ)) {
210
       if (!dir.open(diveDir, segment, O_READ)) {
201
-        SERIAL_EOL;
202
-        SERIAL_ECHO_START;
211
+        SERIAL_EOL();
212
+        SERIAL_ECHO_START();
203
         SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
213
         SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR);
204
         SERIAL_ECHO(segment);
214
         SERIAL_ECHO(segment);
205
         break;
215
         break;
210
 
220
 
211
     } // while i<pathLen
221
     } // while i<pathLen
212
 
222
 
213
-    SERIAL_EOL;
223
+    SERIAL_EOL();
214
   }
224
   }
215
 
225
 
216
 #endif // LONG_FILENAME_HOST_SUPPORT
226
 #endif // LONG_FILENAME_HOST_SUPPORT
223
     #define SPI_SPEED SPI_FULL_SPEED
233
     #define SPI_SPEED SPI_FULL_SPEED
224
   #endif
234
   #endif
225
 
235
 
226
-  if (!card.init(SPI_SPEED,SDSS)
236
+  if (!card.init(SPI_SPEED, SDSS)
227
     #if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
237
     #if defined(LCD_SDSS) && (LCD_SDSS != SDSS)
228
       && !card.init(SPI_SPEED, LCD_SDSS)
238
       && !card.init(SPI_SPEED, LCD_SDSS)
229
     #endif
239
     #endif
230
   ) {
240
   ) {
231
     //if (!card.init(SPI_HALF_SPEED,SDSS))
241
     //if (!card.init(SPI_HALF_SPEED,SDSS))
232
-    SERIAL_ECHO_START;
242
+    SERIAL_ECHO_START();
233
     SERIAL_ECHOLNPGM(MSG_SD_INIT_FAIL);
243
     SERIAL_ECHOLNPGM(MSG_SD_INIT_FAIL);
234
   }
244
   }
235
   else if (!volume.init(&card)) {
245
   else if (!volume.init(&card)) {
236
-    SERIAL_ERROR_START;
246
+    SERIAL_ERROR_START();
237
     SERIAL_ERRORLNPGM(MSG_SD_VOL_INIT_FAIL);
247
     SERIAL_ERRORLNPGM(MSG_SD_VOL_INIT_FAIL);
238
   }
248
   }
239
   else if (!root.openRoot(&volume)) {
249
   else if (!root.openRoot(&volume)) {
240
-    SERIAL_ERROR_START;
250
+    SERIAL_ERROR_START();
241
     SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL);
251
     SERIAL_ERRORLNPGM(MSG_SD_OPENROOT_FAIL);
242
   }
252
   }
243
   else {
253
   else {
244
     cardOK = true;
254
     cardOK = true;
245
-    SERIAL_ECHO_START;
255
+    SERIAL_ECHO_START();
246
     SERIAL_ECHOLNPGM(MSG_SD_CARD_OK);
256
     SERIAL_ECHOLNPGM(MSG_SD_CARD_OK);
247
   }
257
   }
248
   workDir = root;
258
   workDir = root;
249
   curDir = &root;
259
   curDir = &root;
260
+  #if ENABLED(SDCARD_SORT_ALPHA)
261
+    presort();
262
+  #endif
250
   /**
263
   /**
251
   if (!workDir.openRoot(&volume)) {
264
   if (!workDir.openRoot(&volume)) {
252
     SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL);
265
     SERIAL_ECHOLNPGM(MSG_SD_WORKDIR_FAIL);
260
   }*/
273
   }*/
261
   workDir = root;
274
   workDir = root;
262
   curDir = &workDir;
275
   curDir = &workDir;
276
+  #if ENABLED(SDCARD_SORT_ALPHA)
277
+    presort();
278
+  #endif
263
 }
279
 }
264
 
280
 
265
 void CardReader::release() {
281
 void CardReader::release() {
276
 }
292
 }
277
 
293
 
278
 void CardReader::startFileprint() {
294
 void CardReader::startFileprint() {
279
-  if (cardOK)
295
+  if (cardOK) {
280
     sdprinting = true;
296
     sdprinting = true;
281
-}
282
-
283
-void CardReader::pauseSDPrint() {
284
-  if (sdprinting) sdprinting = false;
297
+    #if ENABLED(SDCARD_SORT_ALPHA)
298
+      flush_presort();
299
+    #endif
300
+  }
285
 }
301
 }
286
 
302
 
287
 void CardReader::stopSDPrint() {
303
 void CardReader::stopSDPrint() {
288
-  if (sdprinting) {
289
-    sdprinting = false;
290
-    file.close();
291
-  }
304
+  sdprinting = false;
305
+  if (isFileOpen()) file.close();
292
 }
306
 }
293
 
307
 
294
 void CardReader::openLogFile(char* name) {
308
 void CardReader::openLogFile(char* name) {
310
 }
324
 }
311
 
325
 
312
 void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
326
 void CardReader::openFile(char* name, bool read, bool push_current/*=false*/) {
327
+
313
   if (!cardOK) return;
328
   if (!cardOK) return;
314
-  if (file.isOpen()) { //replacing current file by new file, or subfile call
329
+
330
+  uint8_t doing = 0;
331
+  if (isFileOpen()) { //replacing current file by new file, or subfile call
315
     if (push_current) {
332
     if (push_current) {
316
       if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
333
       if (file_subcall_ctr > SD_PROCEDURE_DEPTH - 1) {
317
-        SERIAL_ERROR_START;
334
+        SERIAL_ERROR_START();
318
         SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
335
         SERIAL_ERRORPGM("trying to call sub-gcode files with too many levels. MAX level is:");
319
         SERIAL_ERRORLN(SD_PROCEDURE_DEPTH);
336
         SERIAL_ERRORLN(SD_PROCEDURE_DEPTH);
320
         kill(PSTR(MSG_KILLED));
337
         kill(PSTR(MSG_KILLED));
321
         return;
338
         return;
322
       }
339
       }
323
 
340
 
324
-      SERIAL_ECHO_START;
325
-      SERIAL_ECHOPGM("SUBROUTINE CALL target:\"");
326
-      SERIAL_ECHO(name);
327
-      SERIAL_ECHOPGM("\" parent:\"");
328
-
329
-      //store current filename and position
341
+      // Store current filename and position
330
       getAbsFilename(proc_filenames[file_subcall_ctr]);
342
       getAbsFilename(proc_filenames[file_subcall_ctr]);
331
 
343
 
332
-      SERIAL_ECHO(proc_filenames[file_subcall_ctr]);
333
-      SERIAL_ECHOPGM("\" pos");
334
-      SERIAL_ECHOLN(sdpos);
344
+      SERIAL_ECHO_START();
345
+      SERIAL_ECHOPAIR("SUBROUTINE CALL target:\"", name);
346
+      SERIAL_ECHOPAIR("\" parent:\"", proc_filenames[file_subcall_ctr]);
347
+      SERIAL_ECHOLNPAIR("\" pos", sdpos);
335
       filespos[file_subcall_ctr] = sdpos;
348
       filespos[file_subcall_ctr] = sdpos;
336
       file_subcall_ctr++;
349
       file_subcall_ctr++;
337
     }
350
     }
338
     else {
351
     else {
339
-     SERIAL_ECHO_START;
340
-     SERIAL_ECHOPGM("Now doing file: ");
341
-     SERIAL_ECHOLN(name);
352
+      doing = 1;
342
     }
353
     }
343
-    file.close();
344
   }
354
   }
345
-  else { //opening fresh file
346
-    file_subcall_ctr = 0; //resetting procedure depth in case user cancels print while in procedure
347
-    SERIAL_ECHO_START;
348
-    SERIAL_ECHOPGM("Now fresh file: ");
349
-    SERIAL_ECHOLN(name);
355
+  else { // Opening fresh file
356
+    doing = 2;
357
+    file_subcall_ctr = 0; // Reset procedure depth in case user cancels print while in procedure
350
   }
358
   }
351
-  sdprinting = false;
359
+
360
+  if (doing) {
361
+    SERIAL_ECHO_START();
362
+    SERIAL_ECHOPGM("Now ");
363
+    SERIAL_ECHO(doing == 1 ? "doing" : "fresh");
364
+    SERIAL_ECHOLNPAIR(" file: ", name);
365
+  }
366
+
367
+  stopSDPrint();
352
 
368
 
353
   SdFile myDir;
369
   SdFile myDir;
354
   curDir = &root;
370
   curDir = &root;
355
   char *fname = name;
371
   char *fname = name;
356
-
357
   char *dirname_start, *dirname_end;
372
   char *dirname_start, *dirname_end;
373
+
358
   if (name[0] == '/') {
374
   if (name[0] == '/') {
359
     dirname_start = &name[1];
375
     dirname_start = &name[1];
360
     while (dirname_start != NULL) {
376
     while (dirname_start != NULL) {
395
     if (file.open(curDir, fname, O_READ)) {
411
     if (file.open(curDir, fname, O_READ)) {
396
       filesize = file.fileSize();
412
       filesize = file.fileSize();
397
       SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
413
       SERIAL_PROTOCOLPAIR(MSG_SD_FILE_OPENED, fname);
398
-      SERIAL_PROTOCOLPAIR(MSG_SD_SIZE, filesize);
399
-      SERIAL_EOL;
414
+      SERIAL_PROTOCOLLNPAIR(MSG_SD_SIZE, filesize);
400
       sdpos = 0;
415
       sdpos = 0;
401
 
416
 
402
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
417
       SERIAL_PROTOCOLLNPGM(MSG_SD_FILE_SELECTED);
406
     else {
421
     else {
407
       SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
422
       SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
408
       SERIAL_PROTOCOLCHAR('.');
423
       SERIAL_PROTOCOLCHAR('.');
409
-      SERIAL_EOL;
424
+      SERIAL_EOL();
410
     }
425
     }
411
   }
426
   }
412
   else { //write
427
   else { //write
413
     if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
428
     if (!file.open(curDir, fname, O_CREAT | O_APPEND | O_WRITE | O_TRUNC)) {
414
       SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
429
       SERIAL_PROTOCOLPAIR(MSG_SD_OPEN_FILE_FAIL, fname);
415
       SERIAL_PROTOCOLCHAR('.');
430
       SERIAL_PROTOCOLCHAR('.');
416
-      SERIAL_EOL;
431
+      SERIAL_EOL();
417
     }
432
     }
418
     else {
433
     else {
419
       saving = true;
434
       saving = true;
420
-      SERIAL_PROTOCOLPAIR(MSG_SD_WRITE_TO_FILE, name);
421
-      SERIAL_EOL;
435
+      SERIAL_PROTOCOLLNPAIR(MSG_SD_WRITE_TO_FILE, name);
422
       lcd_setstatus(fname);
436
       lcd_setstatus(fname);
423
     }
437
     }
424
   }
438
   }
427
 void CardReader::removeFile(char* name) {
441
 void CardReader::removeFile(char* name) {
428
   if (!cardOK) return;
442
   if (!cardOK) return;
429
 
443
 
430
-  file.close();
431
-  sdprinting = false;
444
+  stopSDPrint();
432
 
445
 
433
   SdFile myDir;
446
   SdFile myDir;
434
   curDir = &root;
447
   curDir = &root;
449
         if (!myDir.open(curDir, subdirname, O_READ)) {
462
         if (!myDir.open(curDir, subdirname, O_READ)) {
450
           SERIAL_PROTOCOLPAIR("open failed, File: ", subdirname);
463
           SERIAL_PROTOCOLPAIR("open failed, File: ", subdirname);
451
           SERIAL_PROTOCOLCHAR('.');
464
           SERIAL_PROTOCOLCHAR('.');
465
+          SERIAL_EOL();
452
           return;
466
           return;
453
         }
467
         }
454
         else {
468
         else {
474
     SERIAL_PROTOCOLPGM("File deleted:");
488
     SERIAL_PROTOCOLPGM("File deleted:");
475
     SERIAL_PROTOCOLLN(fname);
489
     SERIAL_PROTOCOLLN(fname);
476
     sdpos = 0;
490
     sdpos = 0;
491
+    #if ENABLED(SDCARD_SORT_ALPHA)
492
+      presort();
493
+    #endif
477
   }
494
   }
478
   else {
495
   else {
479
     SERIAL_PROTOCOLPGM("Deletion failed, File: ");
496
     SERIAL_PROTOCOLPGM("Deletion failed, File: ");
509
   end[3] = '\0';
526
   end[3] = '\0';
510
   file.write(begin);
527
   file.write(begin);
511
   if (file.writeError) {
528
   if (file.writeError) {
512
-    SERIAL_ERROR_START;
529
+    SERIAL_ERROR_START();
513
     SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
530
     SERIAL_ERRORLNPGM(MSG_SD_ERR_WRITE_TO_FILE);
514
   }
531
   }
515
 }
532
 }
535
 
552
 
536
   bool found = false;
553
   bool found = false;
537
   while (root.readDir(p, NULL) > 0) {
554
   while (root.readDir(p, NULL) > 0) {
538
-    for (int8_t i = 0; i < (int8_t)strlen((char*)p.name); i++) p.name[i] = tolower(p.name[i]);
555
+    for (int8_t i = (int8_t)strlen((char*)p.name); i--;) p.name[i] = tolower(p.name[i]);
539
     if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) {
556
     if (p.name[9] != '~' && strncmp((char*)p.name, autoname, 5) == 0) {
540
       openAndPrintFile(autoname);
557
       openAndPrintFile(autoname);
541
       found = true;
558
       found = true;
562
  * Get the name of a file in the current directory by index
579
  * Get the name of a file in the current directory by index
563
  */
580
  */
564
 void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) {
581
 void CardReader::getfilename(uint16_t nr, const char * const match/*=NULL*/) {
582
+  #if ENABLED(SDSORT_CACHE_NAMES)
583
+    if (match != NULL) {
584
+      while (nr < sort_count) {
585
+        if (strcasecmp(match, sortshort[nr]) == 0) break;
586
+        nr++;
587
+      }
588
+    }
589
+    if (nr < sort_count) {
590
+      strcpy(filename, sortshort[nr]);
591
+      strcpy(longFilename, sortnames[nr]);
592
+      filenameIsDir = TEST(isDir[nr>>3], nr & 0x07);
593
+      return;
594
+    }
595
+  #endif // SDSORT_CACHE_NAMES
565
   curDir = &workDir;
596
   curDir = &workDir;
566
   lsAction = LS_GetFilename;
597
   lsAction = LS_GetFilename;
567
   nrFiles = nr;
598
   nrFiles = nr;
586
   if (workDir.isOpen()) parent = &workDir;
617
   if (workDir.isOpen()) parent = &workDir;
587
 
618
 
588
   if (!newfile.open(*parent, relpath, O_READ)) {
619
   if (!newfile.open(*parent, relpath, O_READ)) {
589
-    SERIAL_ECHO_START;
620
+    SERIAL_ECHO_START();
590
     SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
621
     SERIAL_ECHOPGM(MSG_SD_CANT_ENTER_SUBDIR);
591
     SERIAL_ECHOLN(relpath);
622
     SERIAL_ECHOLN(relpath);
592
   }
623
   }
594
     if (workDirDepth < MAX_DIR_DEPTH)
625
     if (workDirDepth < MAX_DIR_DEPTH)
595
       workDirParents[workDirDepth++] = *parent;
626
       workDirParents[workDirDepth++] = *parent;
596
     workDir = newfile;
627
     workDir = newfile;
628
+    #if ENABLED(SDCARD_SORT_ALPHA)
629
+      presort();
630
+    #endif
597
   }
631
   }
598
 }
632
 }
599
 
633
 
600
 void CardReader::updir() {
634
 void CardReader::updir() {
601
-  if (workDirDepth > 0)
635
+  if (workDirDepth > 0) {
602
     workDir = workDirParents[--workDirDepth];
636
     workDir = workDirParents[--workDirDepth];
637
+    #if ENABLED(SDCARD_SORT_ALPHA)
638
+      presort();
639
+    #endif
640
+  }
603
 }
641
 }
604
 
642
 
643
+#if ENABLED(SDCARD_SORT_ALPHA)
644
+
645
+  /**
646
+   * Get the name of a file in the current directory by sort-index
647
+   */
648
+  void CardReader::getfilename_sorted(const uint16_t nr) {
649
+    getfilename(
650
+      #if ENABLED(SDSORT_GCODE)
651
+        sort_alpha &&
652
+      #endif
653
+      (nr < sort_count) ? sort_order[nr] : nr
654
+    );
655
+  }
656
+
657
+  /**
658
+   * Read all the files and produce a sort key
659
+   *
660
+   * We can do this in 3 ways...
661
+   *  - Minimal RAM: Read two filenames at a time sorting along...
662
+   *  - Some RAM: Buffer the directory just for this sort
663
+   *  - Most RAM: Buffer the directory and return filenames from RAM
664
+   */
665
+  void CardReader::presort() {
666
+
667
+    // Sorting may be turned off
668
+    #if ENABLED(SDSORT_GCODE)
669
+      if (!sort_alpha) return;
670
+    #endif
671
+
672
+    // Throw away old sort index
673
+    flush_presort();
674
+
675
+    // If there are files, sort up to the limit
676
+    uint16_t fileCnt = getnrfilenames();
677
+    if (fileCnt > 0) {
678
+
679
+      // Never sort more than the max allowed
680
+      // If you use folders to organize, 20 may be enough
681
+      if (fileCnt > SDSORT_LIMIT) fileCnt = SDSORT_LIMIT;
682
+
683
+      // Sort order is always needed. May be static or dynamic.
684
+      #if ENABLED(SDSORT_DYNAMIC_RAM)
685
+        sort_order = new uint8_t[fileCnt];
686
+      #endif
687
+
688
+      // Use RAM to store the entire directory during pre-sort.
689
+      // SDSORT_LIMIT should be set to prevent over-allocation.
690
+      #if ENABLED(SDSORT_USES_RAM)
691
+
692
+        // If using dynamic ram for names, allocate on the heap.
693
+        #if ENABLED(SDSORT_CACHE_NAMES)
694
+          #if ENABLED(SDSORT_DYNAMIC_RAM)
695
+            sortshort = new char*[fileCnt];
696
+            sortnames = new char*[fileCnt];
697
+          #endif
698
+        #elif ENABLED(SDSORT_USES_STACK)
699
+          char sortnames[fileCnt][LONG_FILENAME_LENGTH];
700
+        #endif
701
+
702
+        // Folder sorting needs 1 bit per entry for flags.
703
+        #if HAS_FOLDER_SORTING
704
+          #if ENABLED(SDSORT_DYNAMIC_RAM)
705
+            isDir = new uint8_t[(fileCnt + 7) >> 3];
706
+          #elif ENABLED(SDSORT_USES_STACK)
707
+            uint8_t isDir[(fileCnt + 7) >> 3];
708
+          #endif
709
+        #endif
710
+
711
+      #else // !SDSORT_USES_RAM
712
+
713
+        // By default re-read the names from SD for every compare
714
+        // retaining only two filenames at a time. This is very
715
+        // slow but is safest and uses minimal RAM.
716
+        char name1[LONG_FILENAME_LENGTH + 1];
717
+
718
+      #endif
719
+
720
+      if (fileCnt > 1) {
721
+
722
+        // Init sort order.
723
+        for (uint16_t i = 0; i < fileCnt; i++) {
724
+          sort_order[i] = i;
725
+          // If using RAM then read all filenames now.
726
+          #if ENABLED(SDSORT_USES_RAM)
727
+            getfilename(i);
728
+            #if ENABLED(SDSORT_DYNAMIC_RAM)
729
+              // Use dynamic method to copy long filename
730
+              sortnames[i] = strdup(LONGEST_FILENAME);
731
+              #if ENABLED(SDSORT_CACHE_NAMES)
732
+                // When caching also store the short name, since
733
+                // we're replacing the getfilename() behavior.
734
+                sortshort[i] = strdup(filename);
735
+              #endif
736
+            #else
737
+              // Copy filenames into the static array
738
+              strcpy(sortnames[i], LONGEST_FILENAME);
739
+              #if ENABLED(SDSORT_CACHE_NAMES)
740
+                strcpy(sortshort[i], filename);
741
+              #endif
742
+            #endif
743
+            // char out[30];
744
+            // sprintf_P(out, PSTR("---- %i %s %s"), i, filenameIsDir ? "D" : " ", sortnames[i]);
745
+            // SERIAL_ECHOLN(out);
746
+            #if HAS_FOLDER_SORTING
747
+              const uint16_t bit = i & 0x07, ind = i >> 3;
748
+              if (bit == 0) isDir[ind] = 0x00;
749
+              if (filenameIsDir) isDir[ind] |= _BV(bit);
750
+            #endif
751
+          #endif
752
+        }
753
+
754
+        // Bubble Sort
755
+        for (uint16_t i = fileCnt; --i;) {
756
+          bool didSwap = false;
757
+          for (uint16_t j = 0; j < i; ++j) {
758
+            const uint16_t o1 = sort_order[j], o2 = sort_order[j + 1];
759
+
760
+            // Compare names from the array or just the two buffered names
761
+            #if ENABLED(SDSORT_USES_RAM)
762
+              #define _SORT_CMP_NODIR() (strcasecmp(sortnames[o1], sortnames[o2]) > 0)
763
+            #else
764
+              #define _SORT_CMP_NODIR() (strcasecmp(name1, name2) > 0)
765
+            #endif
766
+
767
+            #if HAS_FOLDER_SORTING
768
+              #if ENABLED(SDSORT_USES_RAM)
769
+                // Folder sorting needs an index and bit to test for folder-ness.
770
+                const uint8_t ind1 = o1 >> 3, bit1 = o1 & 0x07,
771
+                              ind2 = o2 >> 3, bit2 = o2 & 0x07;
772
+                #define _SORT_CMP_DIR(fs) \
773
+                  (((isDir[ind1] & _BV(bit1)) != 0) == ((isDir[ind2] & _BV(bit2)) != 0) \
774
+                    ? _SORT_CMP_NODIR() \
775
+                    : (isDir[fs > 0 ? ind1 : ind2] & (fs > 0 ? _BV(bit1) : _BV(bit2))) != 0)
776
+              #else
777
+                #define _SORT_CMP_DIR(fs) ((dir1 == filenameIsDir) ? _SORT_CMP_NODIR() : (fs > 0 ? dir1 : !dir1))
778
+              #endif
779
+            #endif
780
+
781
+            // The most economical method reads names as-needed
782
+            // throughout the loop. Slow if there are many.
783
+            #if DISABLED(SDSORT_USES_RAM)
784
+              getfilename(o1);
785
+              strcpy(name1, LONGEST_FILENAME); // save (or getfilename below will trounce it)
786
+              #if HAS_FOLDER_SORTING
787
+                bool dir1 = filenameIsDir;
788
+              #endif
789
+              getfilename(o2);
790
+              char *name2 = LONGEST_FILENAME; // use the string in-place
791
+            #endif // !SDSORT_USES_RAM
792
+
793
+            // Sort the current pair according to settings.
794
+            if (
795
+              #if HAS_FOLDER_SORTING
796
+                #if ENABLED(SDSORT_GCODE)
797
+                  sort_folders ? _SORT_CMP_DIR(sort_folders) : _SORT_CMP_NODIR()
798
+                #else
799
+                  _SORT_CMP_DIR(FOLDER_SORTING)
800
+                #endif
801
+              #else
802
+                _SORT_CMP_NODIR()
803
+              #endif
804
+            ) {
805
+              sort_order[j] = o2;
806
+              sort_order[j + 1] = o1;
807
+              didSwap = true;
808
+            }
809
+          }
810
+          if (!didSwap) break;
811
+        }
812
+        // Using RAM but not keeping names around
813
+        #if ENABLED(SDSORT_USES_RAM) && DISABLED(SDSORT_CACHE_NAMES)
814
+          #if ENABLED(SDSORT_DYNAMIC_RAM)
815
+            for (uint16_t i = 0; i < fileCnt; ++i) free(sortnames[i]);
816
+            #if HAS_FOLDER_SORTING
817
+              free(isDir);
818
+            #endif
819
+          #endif
820
+        #endif
821
+      }
822
+      else {
823
+        sort_order[0] = 0;
824
+        #if ENABLED(SDSORT_USES_RAM) && ENABLED(SDSORT_CACHE_NAMES)
825
+          getfilename(0);
826
+          #if ENABLED(SDSORT_DYNAMIC_RAM)
827
+            sortnames = new char*[1];
828
+            sortnames[0] = strdup(LONGEST_FILENAME); // malloc
829
+            sortshort = new char*[1];
830
+            sortshort[0] = strdup(filename);         // malloc
831
+            isDir = new uint8_t[1];
832
+          #else
833
+            strcpy(sortnames[0], LONGEST_FILENAME);
834
+            strcpy(sortshort[0], filename);
835
+          #endif
836
+          isDir[0] = filenameIsDir ? 0x01 : 0x00;
837
+        #endif
838
+      }
839
+
840
+      sort_count = fileCnt;
841
+    }
842
+  }
843
+
844
+  void CardReader::flush_presort() {
845
+    if (sort_count > 0) {
846
+      #if ENABLED(SDSORT_DYNAMIC_RAM)
847
+        delete sort_order;
848
+        #if ENABLED(SDSORT_CACHE_NAMES)
849
+          for (uint8_t i = 0; i < sort_count; ++i) {
850
+            free(sortshort[i]); // strdup
851
+            free(sortnames[i]); // strdup
852
+          }
853
+          delete sortshort;
854
+          delete sortnames;
855
+        #endif
856
+      #endif
857
+      sort_count = 0;
858
+    }
859
+  }
860
+
861
+#endif // SDCARD_SORT_ALPHA
862
+
605
 void CardReader::printingHasFinished() {
863
 void CardReader::printingHasFinished() {
606
   stepper.synchronize();
864
   stepper.synchronize();
607
   file.close();
865
   file.close();
618
     print_job_timer.stop();
876
     print_job_timer.stop();
619
     if (print_job_timer.duration() > 60)
877
     if (print_job_timer.duration() > 60)
620
       enqueue_and_echo_commands_P(PSTR("M31"));
878
       enqueue_and_echo_commands_P(PSTR("M31"));
879
+    #if ENABLED(SDCARD_SORT_ALPHA)
880
+      presort();
881
+    #endif
621
   }
882
   }
622
 }
883
 }
623
 
884
 
624
-#endif //SDSUPPORT
885
+#endif // SDSUPPORT

+ 62
- 3
Marlin/cardreader.h Wyświetl plik

51
   void release();
51
   void release();
52
   void openAndPrintFile(const char *name);
52
   void openAndPrintFile(const char *name);
53
   void startFileprint();
53
   void startFileprint();
54
-  void pauseSDPrint();
55
   void stopSDPrint();
54
   void stopSDPrint();
56
   void getStatus();
55
   void getStatus();
57
   void printingHasFinished();
56
   void printingHasFinished();
70
   void updir();
69
   void updir();
71
   void setroot();
70
   void setroot();
72
 
71
 
72
+  #if ENABLED(SDCARD_SORT_ALPHA)
73
+    void presort();
74
+    void getfilename_sorted(const uint16_t nr);
75
+    #if ENABLED(SDSORT_GCODE)
76
+      FORCE_INLINE void setSortOn(bool b) { sort_alpha = b; presort(); }
77
+      FORCE_INLINE void setSortFolders(int i) { sort_folders = i; presort(); }
78
+      //FORCE_INLINE void setSortReverse(bool b) { sort_reverse = b; }
79
+    #endif
80
+  #endif
81
+
82
+  FORCE_INLINE void pauseSDPrint() { sdprinting = false; }
73
   FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
83
   FORCE_INLINE bool isFileOpen() { return file.isOpen(); }
74
   FORCE_INLINE bool eof() { return sdpos >= filesize; }
84
   FORCE_INLINE bool eof() { return sdpos >= filesize; }
75
   FORCE_INLINE int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); }
85
   FORCE_INLINE int16_t get() { sdpos = file.curPosition(); return (int16_t)file.read(); }
84
 private:
94
 private:
85
   SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
95
   SdFile root, *curDir, workDir, workDirParents[MAX_DIR_DEPTH];
86
   uint8_t workDirDepth;
96
   uint8_t workDirDepth;
97
+
98
+  // Sort files and folders alphabetically.
99
+  #if ENABLED(SDCARD_SORT_ALPHA)
100
+    uint16_t sort_count;        // Count of sorted items in the current directory
101
+    #if ENABLED(SDSORT_GCODE)
102
+      bool sort_alpha;          // Flag to enable / disable the feature
103
+      int sort_folders;         // Flag to enable / disable folder sorting
104
+      //bool sort_reverse;      // Flag to enable / disable reverse sorting
105
+    #endif
106
+
107
+    // By default the sort index is static
108
+    #if ENABLED(SDSORT_DYNAMIC_RAM)
109
+      uint8_t *sort_order;
110
+    #else
111
+      uint8_t sort_order[SDSORT_LIMIT];
112
+    #endif
113
+
114
+    // Cache filenames to speed up SD menus.
115
+    #if ENABLED(SDSORT_USES_RAM)
116
+
117
+      // If using dynamic ram for names, allocate on the heap.
118
+      #if ENABLED(SDSORT_CACHE_NAMES)
119
+        #if ENABLED(SDSORT_DYNAMIC_RAM)
120
+          char **sortshort, **sortnames;
121
+        #else
122
+          char sortshort[SDSORT_LIMIT][FILENAME_LENGTH];
123
+          char sortnames[SDSORT_LIMIT][FILENAME_LENGTH];
124
+        #endif
125
+      #elif DISABLED(SDSORT_USES_STACK)
126
+        char sortnames[SDSORT_LIMIT][FILENAME_LENGTH];
127
+      #endif
128
+
129
+      // Folder sorting uses an isDir array when caching items.
130
+      #if HAS_FOLDER_SORTING
131
+        #if ENABLED(SDSORT_DYNAMIC_RAM)
132
+          uint8_t *isDir;
133
+        #elif ENABLED(SDSORT_CACHE_NAMES) || DISABLED(SDSORT_USES_STACK)
134
+          uint8_t isDir[(SDSORT_LIMIT+7)>>3];
135
+        #endif
136
+      #endif
137
+
138
+    #endif // SDSORT_USES_RAM
139
+
140
+  #endif // SDCARD_SORT_ALPHA
141
+
87
   Sd2Card card;
142
   Sd2Card card;
88
   SdVolume volume;
143
   SdVolume volume;
89
   SdFile file;
144
   SdFile file;
103
   uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
158
   uint16_t nrFiles; //counter for the files in the current directory and recycled as position counter for getting the nrFiles'th name in the directory.
104
   char* diveDirName;
159
   char* diveDirName;
105
   void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
160
   void lsDive(const char *prepend, SdFile parent, const char * const match=NULL);
161
+
162
+  #if ENABLED(SDCARD_SORT_ALPHA)
163
+    void flush_presort();
164
+  #endif
106
 };
165
 };
107
 
166
 
108
 extern CardReader card;
167
 extern CardReader card;
124
 
183
 
125
 #define IS_SD_PRINTING (false)
184
 #define IS_SD_PRINTING (false)
126
 
185
 
127
-#endif //SDSUPPORT
186
+#endif // SDSUPPORT
128
 
187
 
129
-#endif //__CARDREADER_H
188
+#endif // __CARDREADER_H

+ 1562
- 693
Marlin/configuration_store.cpp
Plik diff jest za duży
Wyświetl plik


+ 55
- 17
Marlin/configuration_store.h Wyświetl plik

25
 
25
 
26
 #include "MarlinConfig.h"
26
 #include "MarlinConfig.h"
27
 
27
 
28
-void Config_ResetDefault();
29
-
30
-#if DISABLED(DISABLE_M503)
31
-  void Config_PrintSettings(bool forReplay=false);
32
-#else
33
-  FORCE_INLINE void Config_PrintSettings(bool forReplay=false) {}
34
-#endif
35
-
36
-#if ENABLED(EEPROM_SETTINGS)
37
-  void Config_StoreSettings();
38
-  void Config_RetrieveSettings();
39
-#else
40
-  FORCE_INLINE void Config_StoreSettings() {}
41
-  FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); }
42
-#endif
43
-
44
-#endif //CONFIGURATION_STORE_H
28
+class MarlinSettings {
29
+  public:
30
+    MarlinSettings() { }
31
+
32
+    static void reset();
33
+    static bool save();
34
+
35
+    #if ENABLED(EEPROM_SETTINGS)
36
+      static bool load();
37
+
38
+      #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
39
+                                         // That can store is enabled
40
+        FORCE_INLINE static int get_start_of_meshes() { return meshes_begin; }
41
+        FORCE_INLINE static int get_end_of_meshes() { return meshes_end; }
42
+        static int calc_num_meshes();
43
+        static void store_mesh(int8_t slot);
44
+        static void load_mesh(int8_t slot, void *into = 0);
45
+
46
+        //static void delete_mesh();    // necessary if we have a MAT
47
+        //static void defrag_meshes();  // "
48
+      #endif
49
+    #else
50
+      FORCE_INLINE
51
+      static bool load() { reset(); report(); return true; }
52
+    #endif
53
+
54
+    #if DISABLED(DISABLE_M503)
55
+      static void report(bool forReplay=false);
56
+    #else
57
+      FORCE_INLINE
58
+      static void report(bool forReplay=false) { UNUSED(forReplay); }
59
+    #endif
60
+
61
+  private:
62
+    static void postprocess();
63
+
64
+    #if ENABLED(EEPROM_SETTINGS)
65
+      static bool eeprom_error;
66
+
67
+      #if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
68
+                                         // That can store is enabled
69
+        static int meshes_begin;
70
+        const static int meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
71
+                                                   // live at the very end of the eeprom
72
+
73
+      #endif
74
+
75
+      static void write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc);
76
+      static void read_data(int &pos, uint8_t *value, uint16_t size, uint16_t *crc);
77
+    #endif
78
+};
79
+
80
+extern MarlinSettings settings;
81
+
82
+#endif // CONFIGURATION_STORE_H

+ 35
- 22
Marlin/dac_mcp4728.cpp Wyświetl plik

31
  */
31
  */
32
 
32
 
33
 #include "dac_mcp4728.h"
33
 #include "dac_mcp4728.h"
34
+#include "enum.h"
34
 
35
 
35
 #if ENABLED(DAC_STEPPER_CURRENT)
36
 #if ENABLED(DAC_STEPPER_CURRENT)
36
 
37
 
37
-uint16_t     mcp4728_values[4];
38
+uint16_t mcp4728_values[XYZE];
38
 
39
 
39
 /**
40
 /**
40
  * Begin I2C, get current values (input register and eeprom) of mcp4728
41
  * Begin I2C, get current values (input register and eeprom) of mcp4728
42
 void mcp4728_init() {
43
 void mcp4728_init() {
43
   Wire.begin();
44
   Wire.begin();
44
   Wire.requestFrom(int(DAC_DEV_ADDRESS), 24);
45
   Wire.requestFrom(int(DAC_DEV_ADDRESS), 24);
45
-  while(Wire.available()) {
46
-    int deviceID = Wire.read();
47
-    int hiByte = Wire.read();
48
-    int loByte = Wire.read();
49
-
50
-    int isEEPROM = (deviceID & 0B00001000) >> 3;
51
-    int channel = (deviceID & 0B00110000) >> 4;
52
-    if (isEEPROM != 1) {
53
-      mcp4728_values[channel] = word((hiByte & 0B00001111), loByte);
54
-    }
46
+  while (Wire.available()) {
47
+    char deviceID = Wire.read(),
48
+         hiByte = Wire.read(),
49
+         loByte = Wire.read();
50
+
51
+    if (!(deviceID & 0x08))
52
+      mcp4728_values[(deviceID & 0x30) >> 4] = word((hiByte & 0x0F), loByte);
55
   }
53
   }
56
 }
54
 }
57
 
55
 
63
   mcp4728_values[channel] = value;
61
   mcp4728_values[channel] = value;
64
   return mcp4728_fastWrite();
62
   return mcp4728_fastWrite();
65
 }
63
 }
64
+
66
 /**
65
 /**
67
  * Write all input resistor values to EEPROM using SequencialWrite method.
66
  * Write all input resistor values to EEPROM using SequencialWrite method.
68
  * This will update both input register and EEPROM value
67
  * This will update both input register and EEPROM value
71
 uint8_t mcp4728_eepromWrite() {
70
 uint8_t mcp4728_eepromWrite() {
72
   Wire.beginTransmission(DAC_DEV_ADDRESS);
71
   Wire.beginTransmission(DAC_DEV_ADDRESS);
73
   Wire.write(SEQWRITE);
72
   Wire.write(SEQWRITE);
74
-  for (uint8_t channel=0; channel <= 3; channel++) {
75
-    Wire.write(DAC_STEPPER_VREF << 7 | 0 << 5 | DAC_STEPPER_GAIN << 4 | highByte(mcp4728_values[channel]));
76
-    Wire.write(lowByte(mcp4728_values[channel]));
73
+  LOOP_XYZE(i) {
74
+    Wire.write(DAC_STEPPER_VREF << 7 | DAC_STEPPER_GAIN << 4 | highByte(mcp4728_values[i]));
75
+    Wire.write(lowByte(mcp4728_values[i]));
77
   }
76
   }
78
   return Wire.endTransmission();
77
   return Wire.endTransmission();
79
 }
78
 }
83
  */
82
  */
84
 uint8_t mcp4728_setVref_all(uint8_t value) {
83
 uint8_t mcp4728_setVref_all(uint8_t value) {
85
   Wire.beginTransmission(DAC_DEV_ADDRESS);
84
   Wire.beginTransmission(DAC_DEV_ADDRESS);
86
-  Wire.write(VREFWRITE | value << 3 | value << 2 | value << 1 | value);
85
+  Wire.write(VREFWRITE | (value ? 0x0F : 0x00));
87
   return Wire.endTransmission();
86
   return Wire.endTransmission();
88
 }
87
 }
89
 /**
88
 /**
91
  */
90
  */
92
 uint8_t mcp4728_setGain_all(uint8_t value) {
91
 uint8_t mcp4728_setGain_all(uint8_t value) {
93
   Wire.beginTransmission(DAC_DEV_ADDRESS);
92
   Wire.beginTransmission(DAC_DEV_ADDRESS);
94
-  Wire.write(GAINWRITE | value << 3 | value << 2 | value << 1 | value);
93
+  Wire.write(GAINWRITE | (value ? 0x0F : 0x00));
95
   return Wire.endTransmission();
94
   return Wire.endTransmission();
96
 }
95
 }
97
 
96
 
98
 /**
97
 /**
99
- * Return Input Regiter value
98
+ * Return Input Register value
100
  */
99
  */
101
 uint16_t mcp4728_getValue(uint8_t channel) { return mcp4728_values[channel]; }
100
 uint16_t mcp4728_getValue(uint8_t channel) { return mcp4728_values[channel]; }
102
 
101
 
105
  * Return Vout
104
  * Return Vout
106
  *
105
  *
107
 uint16_t mcp4728_getVout(uint8_t channel) {
106
 uint16_t mcp4728_getVout(uint8_t channel) {
108
-  uint32_t vref = 2048;
109
-  uint32_t vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
107
+  uint32_t vref = 2048,
108
+           vOut = (vref * mcp4728_values[channel] * (_DAC_STEPPER_GAIN + 1)) / 4096;
110
   if (vOut > defaultVDD) vOut = defaultVDD;
109
   if (vOut > defaultVDD) vOut = defaultVDD;
111
   return vOut;
110
   return vOut;
112
 }
111
 }
113
 */
112
 */
114
 
113
 
115
 /**
114
 /**
115
+ * Returns DAC values as a 0-100 percentage of drive strength
116
+ */
117
+uint8_t mcp4728_getDrvPct(uint8_t channel) { return uint8_t(100.0 * mcp4728_values[channel] / (DAC_STEPPER_MAX) + 0.5); }
118
+
119
+/**
120
+ * Receives all Drive strengths as 0-100 percent values, updates
121
+ * DAC Values array and calls fastwrite to update the DAC.
122
+ */
123
+void mcp4728_setDrvPct(uint8_t pct[XYZE]) {
124
+  LOOP_XYZE(i) mcp4728_values[i] = 0.01 * pct[i] * (DAC_STEPPER_MAX);
125
+  mcp4728_fastWrite();
126
+}
127
+
128
+/**
116
  * FastWrite input register values - All DAC ouput update. refer to DATASHEET 5.6.1
129
  * FastWrite input register values - All DAC ouput update. refer to DATASHEET 5.6.1
117
  * DAC Input and PowerDown bits update.
130
  * DAC Input and PowerDown bits update.
118
  * No EEPROM update
131
  * No EEPROM update
119
  */
132
  */
120
 uint8_t mcp4728_fastWrite() {
133
 uint8_t mcp4728_fastWrite() {
121
   Wire.beginTransmission(DAC_DEV_ADDRESS);
134
   Wire.beginTransmission(DAC_DEV_ADDRESS);
122
-  for (uint8_t channel=0; channel <= 3; channel++) {
123
-    Wire.write(highByte(mcp4728_values[channel]));
124
-    Wire.write(lowByte(mcp4728_values[channel]));
135
+  LOOP_XYZE(i) {
136
+    Wire.write(highByte(mcp4728_values[i]));
137
+    Wire.write(lowByte(mcp4728_values[i]));
125
   }
138
   }
126
   return Wire.endTransmission();
139
   return Wire.endTransmission();
127
 }
140
 }

+ 6
- 5
Marlin/dac_mcp4728.h Wyświetl plik

24
  * Arduino library for MicroChip MCP4728 I2C D/A converter.
24
  * Arduino library for MicroChip MCP4728 I2C D/A converter.
25
  */
25
  */
26
 
26
 
27
-#ifndef mcp4728_h
28
-#define mcp4728_h
27
+#ifndef DAC_MCP4728_H
28
+#define DAC_MCP4728_H
29
 
29
 
30
 #include "MarlinConfig.h"
30
 #include "MarlinConfig.h"
31
 
31
 
32
 #if ENABLED(DAC_STEPPER_CURRENT)
32
 #if ENABLED(DAC_STEPPER_CURRENT)
33
 #include "Wire.h"
33
 #include "Wire.h"
34
 
34
 
35
-#define defaultVDD     5000
35
+#define defaultVDD     DAC_STEPPER_MAX //was 5000 but differs with internal Vref
36
 #define BASE_ADDR      0x60
36
 #define BASE_ADDR      0x60
37
 #define RESET          0B00000110
37
 #define RESET          0B00000110
38
 #define WAKE           0B00001001
38
 #define WAKE           0B00001001
59
 uint16_t mcp4728_getValue(uint8_t channel);
59
 uint16_t mcp4728_getValue(uint8_t channel);
60
 uint8_t mcp4728_fastWrite();
60
 uint8_t mcp4728_fastWrite();
61
 uint8_t mcp4728_simpleCommand(byte simpleCommand);
61
 uint8_t mcp4728_simpleCommand(byte simpleCommand);
62
+uint8_t mcp4728_getDrvPct(uint8_t channel);
63
+void mcp4728_setDrvPct(uint8_t pct[XYZE]);
62
 
64
 
63
 #endif
65
 #endif
64
-#endif
65
-
66
+#endif // DAC_MCP4728_H

+ 106
- 0
Marlin/digipot_mcp4018.cpp Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "MarlinConfig.h"
24
+
25
+#if ENABLED(DIGIPOT_I2C) && ENABLED(DIGIPOT_MCP4018)
26
+
27
+#include "enum.h"
28
+#include "Stream.h"
29
+#include "utility/twi.h"
30
+#include <SlowSoftI2CMaster.h>  //https://github.com/stawel/SlowSoftI2CMaster
31
+
32
+// Settings for the I2C based DIGIPOT (MCP4018) based on WT150
33
+
34
+#define DIGIPOT_I2C_ADDRESS             0x2F
35
+
36
+#define DIGIPOT_A4988_Rsx               0.250
37
+#define DIGIPOT_A4988_Vrefmax           1.666
38
+#define DIGIPOT_A4988_MAX_VALUE         127
39
+
40
+#define DIGIPOT_A4988_Itripmax(Vref)    ((Vref)/(8.0*DIGIPOT_A4988_Rsx))
41
+
42
+#define DIGIPOT_A4988_FACTOR            ((DIGIPOT_A4988_MAX_VALUE)/DIGIPOT_A4988_Itripmax(DIGIPOT_A4988_Vrefmax))
43
+#define DIGIPOT_A4988_MAX_CURRENT       2.0
44
+
45
+static byte current_to_wiper(const float current) {
46
+  const int16_t value = ceil(float(DIGIPOT_A4988_FACTOR) * current);
47
+  return byte(constrain(value, 0, DIGIPOT_A4988_MAX_VALUE));
48
+}
49
+
50
+const uint8_t sda_pins[DIGIPOT_I2C_NUM_CHANNELS] = {
51
+  DIGIPOTS_I2C_SDA_X
52
+  #if DIGIPOT_I2C_NUM_CHANNELS > 1
53
+    , DIGIPOTS_I2C_SDA_Y
54
+    #if DIGIPOT_I2C_NUM_CHANNELS > 2
55
+      , DIGIPOTS_I2C_SDA_Z
56
+      #if DIGIPOT_I2C_NUM_CHANNELS > 3
57
+        , DIGIPOTS_I2C_SDA_E0
58
+        #if DIGIPOT_I2C_NUM_CHANNELS > 4
59
+          , DIGIPOTS_I2C_SDA_E1
60
+        #endif
61
+      #endif
62
+    #endif
63
+  #endif
64
+};
65
+
66
+static SlowSoftI2CMaster pots[DIGIPOT_I2C_NUM_CHANNELS] = {
67
+  SlowSoftI2CMaster { sda_pins[X_AXIS], DIGIPOTS_I2C_SCL }
68
+  #if DIGIPOT_I2C_NUM_CHANNELS > 1
69
+    , SlowSoftI2CMaster { sda_pins[Y_AXIS], DIGIPOTS_I2C_SCL }
70
+    #if DIGIPOT_I2C_NUM_CHANNELS > 2
71
+      , SlowSoftI2CMaster { sda_pins[Z_AXIS], DIGIPOTS_I2C_SCL }
72
+      #if DIGIPOT_I2C_NUM_CHANNELS > 3
73
+        , SlowSoftI2CMaster { sda_pins[E_AXIS], DIGIPOTS_I2C_SCL }
74
+        #if DIGIPOT_I2C_NUM_CHANNELS > 4
75
+          , SlowSoftI2CMaster { sda_pins[E_AXIS + 1], DIGIPOTS_I2C_SCL }
76
+        #endif
77
+      #endif
78
+    #endif
79
+  #endif
80
+};
81
+
82
+static void i2c_send(const uint8_t channel, const byte v) {
83
+  if (WITHIN(channel, 0, DIGIPOT_I2C_NUM_CHANNELS - 1)) {
84
+    pots[channel].i2c_start(((DIGIPOT_I2C_ADDRESS) << 1) | I2C_WRITE);
85
+    pots[channel].i2c_write(v);
86
+    pots[channel].i2c_stop();
87
+  }
88
+}
89
+
90
+// This is for the MCP4018 I2C based digipot
91
+void digipot_i2c_set_current(uint8_t channel, float current) {
92
+  i2c_send(channel, current_to_wiper(min(max(current, 0.0f), float(DIGIPOT_A4988_MAX_CURRENT))));
93
+}
94
+
95
+void digipot_i2c_init() {
96
+  static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS;
97
+
98
+  for (uint8_t i = 0; i < DIGIPOT_I2C_NUM_CHANNELS; i++)
99
+    pots[i].i2c_init();
100
+
101
+  // setup initial currents as defined in Configuration_adv.h
102
+  for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++)
103
+    digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
104
+}
105
+
106
+#endif // DIGIPOT_I2C && DIGIPOT_MCP4018

+ 11
- 11
Marlin/digipot_mcp4451.cpp Wyświetl plik

22
 
22
 
23
 #include "MarlinConfig.h"
23
 #include "MarlinConfig.h"
24
 
24
 
25
-#if ENABLED(DIGIPOT_I2C)
25
+#if ENABLED(DIGIPOT_I2C) && DISABLED(DIGIPOT_MCP4018)
26
 
26
 
27
 #include "Stream.h"
27
 #include "Stream.h"
28
 #include "utility/twi.h"
28
 #include "utility/twi.h"
37
   #define DIGIPOT_I2C_MAX_CURRENT 2.5
37
   #define DIGIPOT_I2C_MAX_CURRENT 2.5
38
 #endif
38
 #endif
39
 
39
 
40
-static byte current_to_wiper(float current) {
41
-  return byte(ceil(float((DIGIPOT_I2C_FACTOR * current))));
40
+static byte current_to_wiper(const float current) {
41
+  return byte(CEIL(float((DIGIPOT_I2C_FACTOR * current))));
42
 }
42
 }
43
 
43
 
44
-static void i2c_send(byte addr, byte a, byte b) {
44
+static void i2c_send(const byte addr, const byte a, const byte b) {
45
   Wire.beginTransmission(addr);
45
   Wire.beginTransmission(addr);
46
   Wire.write(a);
46
   Wire.write(a);
47
   Wire.write(b);
47
   Wire.write(b);
49
 }
49
 }
50
 
50
 
51
 // This is for the MCP4451 I2C based digipot
51
 // This is for the MCP4451 I2C based digipot
52
-void digipot_i2c_set_current(int channel, float current) {
52
+void digipot_i2c_set_current(uint8_t channel, float current) {
53
   current = min((float) max(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT);
53
   current = min((float) max(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT);
54
   // these addresses are specific to Azteeg X3 Pro, can be set to others,
54
   // these addresses are specific to Azteeg X3 Pro, can be set to others,
55
   // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
55
   // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1
60
   }
60
   }
61
 
61
 
62
   // Initial setup
62
   // Initial setup
63
-  i2c_send(addr, 0x40, 0xff);
64
-  i2c_send(addr, 0xA0, 0xff);
63
+  i2c_send(addr, 0x40, 0xFF);
64
+  i2c_send(addr, 0xA0, 0xFF);
65
 
65
 
66
   // Set actual wiper value
66
   // Set actual wiper value
67
   byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
67
   byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 };
69
 }
69
 }
70
 
70
 
71
 void digipot_i2c_init() {
71
 void digipot_i2c_init() {
72
-  const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS;
72
+  static const float digipot_motor_current[] PROGMEM = DIGIPOT_I2C_MOTOR_CURRENTS;
73
   Wire.begin();
73
   Wire.begin();
74
   // setup initial currents as defined in Configuration_adv.h
74
   // setup initial currents as defined in Configuration_adv.h
75
-  for (int i = 0; i < COUNT(digipot_motor_current); i++)
76
-    digipot_i2c_set_current(i, digipot_motor_current[i]);
75
+  for (uint8_t i = 0; i < COUNT(digipot_motor_current); i++)
76
+    digipot_i2c_set_current(i, pgm_read_float(&digipot_motor_current[i]));
77
 }
77
 }
78
 
78
 
79
-#endif //DIGIPOT_I2C
79
+#endif // DIGIPOT_I2C

+ 184
- 0
Marlin/dogm_font_data_ISO10646_1_PL.h Wyświetl plik

1
+/*
2
+  Fontname: ISO10646-1-PL
3
+  Copyright: A.Hardtung, public domain
4
+  Capital A Height: 7, '1' Height: 7
5
+  Calculated Max Values w= 5 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9
6
+  Font Bounding box     w= 6 h= 9 x= 0 y=-2
7
+  Calculated Min Values           x= 0 y=-2 dx= 0 dy= 0
8
+  Pure Font   ascent = 7 descent=-1
9
+  X Font      ascent = 7 descent=-1
10
+  Max Font    ascent = 8 descent=-2
11
+*/
12
+#include <U8glib.h>
13
+const u8g_fntpgm_uint8_t ISO10646_1_PL_5x7[2732] U8G_FONT_SECTION(".progmem.ISO10646_1_PL_5x7") = {
14
+  0,6,9,0,254,7,1,146,3,33,32,255,255,8,254,7,
15
+  255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
16
+  128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
17
+  0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
18
+  120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32,
19
+  64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104,
20
+  2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32,
21
+  64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32,
22
+  32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5,
23
+  5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192,
24
+  64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192,
25
+  192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6,
26
+  0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64,
27
+  192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112,
28
+  128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240,
29
+  5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7,
30
+  6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0,
31
+  112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16,
32
+  32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136,
33
+  112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5,
34
+  5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192,
35
+  192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64,
36
+  32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1,
37
+  0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136,
38
+  8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168,
39
+  168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,
40
+  7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,
41
+  0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240,
42
+  136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240,
43
+  128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,
44
+  5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,
45
+  6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,
46
+  128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,
47
+  16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,
48
+  136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,
49
+  7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,
50
+  0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,
51
+  136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,
52
+  128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,
53
+  7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,
54
+  0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,
55
+  32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,
56
+  136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,
57
+  5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,
58
+  6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,
59
+  136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,
60
+  32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,
61
+  224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,
62
+  1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,
63
+  80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,
64
+  64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,
65
+  0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,
66
+  128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,
67
+  120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,
68
+  0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,
69
+  136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,
70
+  136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,
71
+  8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,
72
+  6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,
73
+  192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,
74
+  168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,
75
+  6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,
76
+  136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,
77
+  5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,
78
+  0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64,
79
+  64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5,
80
+  5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,
81
+  136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,
82
+  6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,
83
+  0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,
84
+  64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,
85
+  3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,
86
+  6,0,2,104,144,0,0,0,6,0,0,5,9,9,6,0,
87
+  254,112,136,136,248,136,136,136,16,32,5,7,7,6,0,254,
88
+  112,8,120,136,120,16,32,5,8,8,6,0,0,16,32,112,
89
+  136,128,128,136,112,5,7,7,6,0,0,16,32,112,128,128,
90
+  136,112,5,9,9,6,0,254,248,128,128,240,128,128,248,8,
91
+  16,5,7,7,6,0,254,112,136,248,128,112,16,32,5,7,
92
+  7,6,0,0,128,144,160,192,128,128,248,5,7,7,6,0,
93
+  0,96,40,48,96,160,32,112,5,8,8,6,0,0,16,168,
94
+  136,200,168,152,136,136,5,8,8,6,0,0,8,16,0,176,
95
+  200,136,136,136,5,8,8,6,0,0,16,32,112,136,136,136,
96
+  136,112,5,8,8,6,0,0,16,32,0,112,136,136,136,112,
97
+  5,8,8,6,0,0,16,120,128,128,112,8,8,240,5,8,
98
+  8,6,0,0,16,32,0,112,128,112,8,240,5,8,8,6,
99
+  0,0,32,248,8,16,32,64,128,248,5,8,8,6,0,0,
100
+  16,32,0,248,16,32,64,248,5,7,7,6,0,0,248,8,
101
+  16,248,64,128,248,5,8,8,6,0,0,48,48,0,248,16,
102
+  32,64,248,0,0,0,6,0,0,0,0,0,6,0,0,0,
103
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
104
+  0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
105
+  6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
106
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
107
+  0,0,0,0,6,0,0,0,0,0,6,0,0,1,7,7,
108
+  6,2,0,128,0,128,128,128,128,128,5,7,7,6,0,0,
109
+  32,112,168,160,168,112,32,5,7,7,6,0,0,48,64,64,
110
+  224,64,80,168,5,5,5,6,0,0,136,112,80,112,136,5,
111
+  7,7,6,0,0,136,80,32,248,32,248,32,1,7,7,6,
112
+  2,0,128,128,128,0,128,128,128,5,8,8,6,0,0,48,
113
+  72,32,80,80,32,144,96,3,1,1,6,1,7,160,5,7,
114
+  7,6,0,0,248,136,184,184,184,136,248,5,7,7,6,0,
115
+  1,112,8,120,136,120,0,248,5,5,5,6,0,1,40,80,
116
+  160,80,40,5,3,3,6,0,1,248,8,8,2,2,2,6,
117
+  2,6,64,128,5,7,7,6,0,0,248,136,168,136,152,168,
118
+  248,5,1,1,6,0,6,248,4,4,4,6,0,3,96,144,
119
+  144,96,5,7,7,6,0,0,32,32,248,32,32,0,248,4,
120
+  5,5,6,0,3,96,144,32,64,240,3,5,5,6,0,3,
121
+  224,32,224,32,224,2,2,2,6,2,6,64,128,5,8,8,
122
+  6,0,255,136,136,136,136,152,232,128,128,5,7,7,6,0,
123
+  0,120,152,152,120,24,24,24,2,2,2,6,2,2,192,192,
124
+  2,2,2,6,2,255,64,128,3,5,5,6,0,3,64,192,
125
+  64,64,224,5,7,7,6,0,1,112,136,136,136,112,0,248,
126
+  5,5,5,6,0,1,160,80,40,80,160,5,7,7,6,0,
127
+  0,136,144,168,88,184,8,8,5,7,7,6,0,0,136,144,
128
+  184,72,152,32,56,5,8,8,6,0,0,192,64,192,72,216,
129
+  56,8,8,5,7,7,6,0,0,32,0,32,64,128,136,112,
130
+  5,8,8,6,0,0,64,32,0,112,136,248,136,136,5,8,
131
+  8,6,0,0,16,32,0,112,136,248,136,136,5,8,8,6,
132
+  0,0,32,80,0,112,136,248,136,136,5,8,8,6,0,0,
133
+  104,144,0,112,136,248,136,136,5,8,8,6,0,0,80,0,
134
+  112,136,136,248,136,136,5,8,8,6,0,0,32,80,32,112,
135
+  136,248,136,136,5,7,7,6,0,0,56,96,160,184,224,160,
136
+  184,5,8,8,6,0,255,112,136,128,128,136,112,32,96,5,
137
+  8,8,6,0,0,64,32,0,248,128,240,128,248,5,8,8,
138
+  6,0,0,8,16,0,248,128,240,128,248,5,8,8,6,0,
139
+  0,32,80,0,248,128,240,128,248,5,7,7,6,0,0,80,
140
+  0,248,128,240,128,248,3,8,8,6,1,0,128,64,0,224,
141
+  64,64,64,224,3,8,8,6,1,0,32,64,0,224,64,64,
142
+  64,224,3,8,8,6,1,0,64,160,0,224,64,64,64,224,
143
+  3,7,7,6,1,0,160,0,224,64,64,64,224,5,7,7,
144
+  6,0,0,112,72,72,232,72,72,112,5,8,8,6,0,0,
145
+  104,144,0,136,200,168,152,136,5,8,8,6,0,0,64,32,
146
+  112,136,136,136,136,112,5,8,8,6,0,0,16,32,112,136,
147
+  136,136,136,112,5,8,8,6,0,0,32,80,0,112,136,136,
148
+  136,112,5,8,8,6,0,0,104,144,0,112,136,136,136,112,
149
+  5,8,8,6,0,0,80,0,112,136,136,136,136,112,5,5,
150
+  5,6,0,1,136,80,32,80,136,5,8,8,6,0,255,16,
151
+  112,168,168,168,168,112,64,5,8,8,6,0,0,64,32,136,
152
+  136,136,136,136,112,5,8,8,6,0,0,16,32,136,136,136,
153
+  136,136,112,5,8,8,6,0,0,32,80,0,136,136,136,136,
154
+  112,5,8,8,6,0,0,80,0,136,136,136,136,136,112,5,
155
+  8,8,6,0,0,16,32,136,80,32,32,32,32,5,9,9,
156
+  6,0,255,192,64,112,72,72,112,64,64,224,4,8,8,6,
157
+  1,255,96,144,144,160,144,144,224,128,5,8,8,6,0,0,
158
+  64,32,0,112,8,120,136,120,5,8,8,6,0,0,16,32,
159
+  0,112,8,120,136,120,5,8,8,6,0,0,32,80,0,112,
160
+  8,120,136,120,5,8,8,6,0,0,104,144,0,112,8,120,
161
+  136,120,5,7,7,6,0,0,80,0,112,8,120,136,120,5,
162
+  8,8,6,0,0,32,80,32,112,8,120,136,120,5,6,6,
163
+  6,0,0,208,40,120,160,168,80,5,6,6,6,0,255,112,
164
+  128,136,112,32,96,5,8,8,6,0,0,64,32,0,112,136,
165
+  248,128,112,5,8,8,6,0,0,16,32,0,112,136,248,128,
166
+  112,5,8,8,6,0,0,32,80,0,112,136,248,128,112,5,
167
+  7,7,6,0,0,80,0,112,136,248,128,112,3,8,8,6,
168
+  1,0,128,64,0,64,192,64,64,224,3,8,8,6,1,0,
169
+  32,64,0,64,192,64,64,224,3,8,8,6,1,0,64,160,
170
+  0,64,192,64,64,224,3,7,7,6,1,0,160,0,64,192,
171
+  64,64,224,5,7,7,6,0,0,160,64,160,16,120,136,112,
172
+  5,8,8,6,0,0,104,144,0,176,200,136,136,136,5,8,
173
+  8,6,0,0,64,32,0,112,136,136,136,112,5,8,8,6,
174
+  0,0,16,32,0,112,136,136,136,112,5,8,8,6,0,0,
175
+  32,80,0,112,136,136,136,112,5,8,8,6,0,0,104,144,
176
+  0,112,136,136,136,112,5,7,7,6,0,0,80,0,112,136,
177
+  136,136,112,5,5,5,6,0,1,32,0,248,0,32,5,7,
178
+  7,6,0,255,16,112,168,168,168,112,64,5,8,8,6,0,
179
+  0,64,32,0,136,136,136,152,104,5,8,8,6,0,0,16,
180
+  32,0,136,136,136,152,104,5,8,8,6,0,0,32,80,0,
181
+  136,136,136,152,104,5,7,7,6,0,0,80,0,136,136,136,
182
+  152,104,5,9,9,6,0,255,16,32,0,136,136,136,248,8,
183
+  112,4,7,7,6,1,255,192,64,96,80,96,64,224,5,8,
184
+  8,6,0,255,80,0,136,136,136,120,8,112};

+ 197
- 0
Marlin/dogm_font_data_ISO10646_1_tr.h Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/*
24
+  Fontname: ISO10646-1-tr
25
+  Copyright: public domain
26
+  Capital A Height: 7, '1' Height: 7
27
+  Calculated Max Values w= 5 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9
28
+  Font Bounding box     w= 6 h= 9 x= 0 y=-2
29
+  Calculated Min Values           x= 0 y=-1 dx= 0 dy= 0
30
+  Pure Font   ascent = 7 descent=-1
31
+  X Font      ascent = 7 descent=-1
32
+  Max Font    ascent = 8 descent=-1
33
+*/
34
+#include <U8glib.h>
35
+const u8g_fntpgm_uint8_t ISO10646_TR[2591] U8G_SECTION(".progmem.ISO10646_TR") = {
36
+  0,6,9,0,254,7,1,146,3,33,32,255,255,8,255,7,
37
+  255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
38
+  128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
39
+  0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
40
+  120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32,
41
+  64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104,
42
+  2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32,
43
+  64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32,
44
+  32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5,
45
+  5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192,
46
+  64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192,
47
+  192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6,
48
+  0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64,
49
+  192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112,
50
+  128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240,
51
+  5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7,
52
+  6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0,
53
+  112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16,
54
+  32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136,
55
+  112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5,
56
+  5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192,
57
+  192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64,
58
+  32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1,
59
+  0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136,
60
+  8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168,
61
+  168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,
62
+  7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,
63
+  0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240,
64
+  136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240,
65
+  128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,
66
+  5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,
67
+  6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,
68
+  128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,
69
+  16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,
70
+  136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,
71
+  7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,
72
+  0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,
73
+  136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,
74
+  128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,
75
+  7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,
76
+  0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,
77
+  32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,
78
+  136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,
79
+  5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,
80
+  6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,
81
+  136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,
82
+  32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,
83
+  224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,
84
+  1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,
85
+  80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,
86
+  64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,
87
+  0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,
88
+  128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,
89
+  120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,
90
+  0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,
91
+  136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,
92
+  136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,
93
+  8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,
94
+  6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,
95
+  192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,
96
+  168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,
97
+  6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,
98
+  136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,
99
+  5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,
100
+  0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64,
101
+  64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5,
102
+  5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,
103
+  136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,
104
+  6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,
105
+  0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,
106
+  64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,
107
+  3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,
108
+  6,0,2,104,144,0,0,0,6,0,0,0,0,0,6,0,
109
+  0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
110
+  6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
111
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
112
+  0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
113
+  6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
114
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
115
+  0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
116
+  6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
117
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
118
+  0,0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,
119
+  6,0,0,0,0,0,6,0,0,0,0,0,6,0,0,0,
120
+  0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,0,
121
+  0,1,7,7,6,2,0,128,0,128,128,128,128,128,5,7,
122
+  7,6,0,0,32,112,168,160,168,112,32,5,7,7,6,0,
123
+  0,48,64,64,224,64,80,168,5,5,5,6,0,0,136,112,
124
+  80,112,136,5,7,7,6,0,0,136,80,32,248,32,248,32,
125
+  1,7,7,6,2,0,128,128,128,0,128,128,128,5,8,8,
126
+  6,0,0,48,72,32,80,80,32,144,96,3,1,1,6,1,
127
+  7,160,5,7,7,6,0,0,248,136,184,184,184,136,248,5,
128
+  7,7,6,0,1,112,8,120,136,120,0,248,5,5,5,6,
129
+  0,1,40,80,160,80,40,5,3,3,6,0,1,248,8,8,
130
+  2,2,2,6,2,6,64,128,5,7,7,6,0,0,248,136,
131
+  168,136,152,168,248,5,1,1,6,0,6,248,4,4,4,6,
132
+  0,3,96,144,144,96,5,7,7,6,0,0,32,32,248,32,
133
+  32,0,248,4,5,5,6,0,3,96,144,32,64,240,3,5,
134
+  5,6,0,3,224,32,224,32,224,2,2,2,6,2,6,64,
135
+  128,5,8,8,6,0,255,136,136,136,136,152,232,128,128,5,
136
+  7,7,6,0,0,120,152,152,120,24,24,24,2,2,2,6,
137
+  2,2,192,192,2,2,2,6,2,255,64,128,3,5,5,6,
138
+  0,3,64,192,64,64,224,5,7,7,6,0,1,112,136,136,
139
+  136,112,0,248,5,5,5,6,0,1,160,80,40,80,160,5,
140
+  7,7,6,0,0,136,144,168,88,184,8,8,5,7,7,6,
141
+  0,0,136,144,184,72,152,32,56,5,8,8,6,0,0,192,
142
+  64,192,72,216,56,8,8,5,7,7,6,0,0,32,0,32,
143
+  64,128,136,112,5,8,8,6,0,0,64,32,0,112,136,248,
144
+  136,136,5,8,8,6,0,0,16,32,0,112,136,248,136,136,
145
+  5,8,8,6,0,0,32,80,0,112,136,248,136,136,5,8,
146
+  8,6,0,0,104,144,0,112,136,248,136,136,5,8,8,6,
147
+  0,0,80,0,112,136,136,248,136,136,5,8,8,6,0,0,
148
+  32,80,32,112,136,248,136,136,5,7,7,6,0,0,56,96,
149
+  160,184,224,160,184,5,8,8,6,0,255,112,136,128,128,136,
150
+  112,32,96,5,8,8,6,0,0,64,32,0,248,128,240,128,
151
+  248,5,8,8,6,0,0,8,16,0,248,128,240,128,248,5,
152
+  8,8,6,0,0,32,80,0,248,128,240,128,248,5,7,7,
153
+  6,0,0,80,0,248,128,240,128,248,3,8,8,6,1,0,
154
+  128,64,0,224,64,64,64,224,3,8,8,6,1,0,32,64,
155
+  0,224,64,64,64,224,3,8,8,6,1,0,64,160,0,224,
156
+  64,64,64,224,3,7,7,6,1,0,160,0,224,64,64,64,
157
+  224,5,9,9,6,0,255,80,32,112,136,128,184,136,136,112,
158
+  5,8,8,6,0,0,104,144,0,136,200,168,152,136,5,8,
159
+  8,6,0,0,64,32,112,136,136,136,136,112,5,8,8,6,
160
+  0,0,16,32,112,136,136,136,136,112,5,8,8,6,0,0,
161
+  32,80,0,112,136,136,136,112,5,8,8,6,0,0,104,144,
162
+  0,112,136,136,136,112,5,8,8,6,0,0,80,0,112,136,
163
+  136,136,136,112,5,5,5,6,0,1,136,80,32,80,136,5,
164
+  8,8,6,0,255,16,112,168,168,168,168,112,64,5,8,8,
165
+  6,0,0,64,32,136,136,136,136,136,112,5,8,8,6,0,
166
+  0,16,32,136,136,136,136,136,112,5,8,8,6,0,0,32,
167
+  80,0,136,136,136,136,112,5,8,8,6,0,0,80,0,136,
168
+  136,136,136,136,112,1,7,7,6,2,0,128,0,128,128,128,
169
+  128,128,5,9,9,6,0,255,120,128,128,112,8,8,240,32,
170
+  96,4,8,8,6,1,255,96,144,144,160,144,144,224,128,5,
171
+  8,8,6,0,0,64,32,0,112,8,120,136,120,5,8,8,
172
+  6,0,0,16,32,0,112,8,120,136,120,5,8,8,6,0,
173
+  0,32,80,0,112,8,120,136,120,5,8,8,6,0,0,104,
174
+  144,0,112,8,120,136,120,5,7,7,6,0,0,80,0,112,
175
+  8,120,136,120,5,8,8,6,0,0,32,80,32,112,8,120,
176
+  136,120,5,6,6,6,0,0,208,40,120,160,168,80,5,7,
177
+  7,6,0,255,112,128,128,136,112,32,96,5,8,8,6,0,
178
+  0,64,32,0,112,136,248,128,112,5,8,8,6,0,0,16,
179
+  32,0,112,136,248,128,112,5,8,8,6,0,0,32,80,0,
180
+  112,136,248,128,112,5,7,7,6,0,0,80,0,112,136,248,
181
+  128,112,3,8,8,6,1,0,128,64,0,64,192,64,64,224,
182
+  3,8,8,6,1,0,32,64,0,64,192,64,64,224,3,8,
183
+  8,6,1,0,64,160,0,64,192,64,64,224,3,7,7,6,
184
+  1,0,160,0,64,192,64,64,224,5,8,8,6,0,255,80,
185
+  32,112,136,136,120,8,112,5,8,8,6,0,0,104,144,0,
186
+  176,200,136,136,136,5,8,8,6,0,0,64,32,0,112,136,
187
+  136,136,112,5,8,8,6,0,0,16,32,0,112,136,136,136,
188
+  112,5,8,8,6,0,0,32,80,0,112,136,136,136,112,5,
189
+  8,8,6,0,0,104,144,0,112,136,136,136,112,5,7,7,
190
+  6,0,0,80,0,112,136,136,136,112,5,5,5,6,0,1,
191
+  32,0,248,0,32,5,7,7,6,0,255,16,112,168,168,168,
192
+  112,64,5,8,8,6,0,0,64,32,0,136,136,136,152,104,
193
+  5,8,8,6,0,0,16,32,0,136,136,136,152,104,5,8,
194
+  8,6,0,0,32,80,0,136,136,136,152,104,5,7,7,6,
195
+  0,0,80,0,136,136,136,152,104,1,5,5,6,2,0,128,
196
+  128,128,128,128,5,7,7,6,0,255,112,128,112,8,240,32,
197
+  96,5,8,8,6,0,255,80,0,136,136,136,120,8,112};

+ 192
- 0
Marlin/dogm_font_data_ISO10646_CZ.h Wyświetl plik

1
+/*
2
+  Fontname: ISO10646_CZ
3
+  Copyright: A. Hardtung, public domain
4
+  Modified for Czech accents by Petr Zahradnik, http://www.zahradniksebavi.cz
5
+  Capital A Height: 7, '1' Height: 7
6
+  Calculated Max Values w= 6 h= 9 x= 2 y= 7 dx= 6 dy= 0 ascent= 8 len= 9
7
+  Font Bounding box     w= 6 h= 9 x= 0 y=-2
8
+  Calculated Min Values           x= 0 y=-1 dx= 0 dy= 0
9
+  Pure Font   ascent = 7 descent=-1
10
+  X Font      ascent = 7 descent=-1
11
+  Max Font    ascent = 8 descent=-1
12
+*/
13
+#include <U8glib.h>
14
+const u8g_fntpgm_uint8_t ISO10646_CZ[2832] U8G_SECTION(".progmem.ISO10646_CZ") = {
15
+  0,6,9,0,254,7,1,146,3,33,32,255,255,8,255,7,
16
+  255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
17
+  128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
18
+  0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
19
+  120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32,
20
+  64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104,
21
+  2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32,
22
+  64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32,
23
+  32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5,
24
+  5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192,
25
+  64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192,
26
+  192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6,
27
+  0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64,
28
+  192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112,
29
+  128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240,
30
+  5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7,
31
+  6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0,
32
+  112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16,
33
+  32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136,
34
+  112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5,
35
+  5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192,
36
+  192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64,
37
+  32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1,
38
+  0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136,
39
+  8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168,
40
+  168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5,
41
+  7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6,
42
+  0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240,
43
+  136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240,
44
+  128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128,
45
+  5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7,
46
+  6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0,
47
+  128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16,
48
+  16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144,
49
+  136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7,
50
+  7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0,
51
+  0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136,
52
+  136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128,
53
+  128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5,
54
+  7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6,
55
+  0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248,
56
+  32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136,
57
+  136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32,
58
+  5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7,
59
+  6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0,
60
+  136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16,
61
+  32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128,
62
+  224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6,
63
+  1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32,
64
+  80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128,
65
+  64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6,
66
+  0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112,
67
+  128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136,
68
+  120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6,
69
+  0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112,
70
+  136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136,
71
+  136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3,
72
+  8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7,
73
+  6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0,
74
+  192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168,
75
+  168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5,
76
+  6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136,
77
+  136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8,
78
+  5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0,
79
+  0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64,
80
+  64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5,
81
+  5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136,
82
+  136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5,
83
+  6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0,
84
+  0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128,
85
+  64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128,
86
+  3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2,
87
+  6,0,2,104,144,0,0,0,6,0,0,5,8,8,6,0,
88
+  0,16,32,112,136,136,248,136,136,5,8,8,6,0,0,8,
89
+  16,248,128,128,240,128,248,3,8,8,6,1,0,32,64,224,
90
+  64,64,64,64,224,5,8,8,6,0,0,16,32,112,136,136,
91
+  136,136,112,5,8,8,6,0,0,16,32,136,136,136,136,136,
92
+  112,5,8,8,6,0,0,16,32,136,136,80,32,32,32,5,
93
+  8,8,6,0,0,16,32,0,112,8,120,136,120,5,8,8,
94
+  6,0,0,16,32,0,112,136,248,128,112,2,8,8,6,2,
95
+  0,64,128,0,128,128,128,128,128,5,8,8,6,0,0,16,
96
+  32,0,112,136,136,136,112,5,8,8,6,0,0,16,32,0,
97
+  136,136,136,152,104,5,9,9,6,0,255,16,32,0,136,136,
98
+  136,120,8,112,5,8,8,6,0,0,80,32,112,136,128,128,
99
+  136,112,5,8,8,6,0,0,80,32,0,112,128,128,136,112,
100
+  5,8,8,6,0,0,80,32,240,136,136,136,136,240,6,8,
101
+  8,6,0,0,4,20,24,112,144,144,144,112,5,8,8,6,
102
+  0,0,80,32,248,128,128,240,128,248,5,8,8,6,0,0,
103
+  80,32,0,112,136,248,128,112,5,8,8,6,0,0,80,32,
104
+  136,200,168,152,136,136,5,8,8,6,0,0,80,32,0,176,
105
+  200,136,136,136,5,8,8,6,0,0,80,32,240,136,240,160,
106
+  144,136,5,8,8,6,0,0,80,32,0,176,200,128,128,128,
107
+  5,8,8,6,0,0,80,32,120,128,128,112,8,240,5,8,
108
+  8,6,0,0,80,32,0,112,128,112,8,240,5,8,8,6,
109
+  0,0,80,32,248,32,32,32,32,32,6,8,8,6,0,0,
110
+  4,68,72,224,64,64,64,48,5,8,8,6,0,0,32,80,
111
+  168,136,136,136,136,112,5,8,8,6,0,0,32,80,32,136,
112
+  136,136,152,104,5,8,8,6,0,0,80,32,248,8,48,64,
113
+  128,248,5,8,8,6,0,0,80,32,0,248,16,32,64,248,
114
+  0,0,0,6,0,0,0,0,0,6,0,0,0,0,0,6,
115
+  0,0,1,7,7,6,2,0,128,0,128,128,128,128,128,5,
116
+  7,7,6,0,0,32,112,168,160,168,112,32,5,7,7,6,
117
+  0,0,48,64,64,224,64,80,168,5,5,5,6,0,0,136,
118
+  112,80,112,136,5,7,7,6,0,0,136,80,32,248,32,248,
119
+  32,1,7,7,6,2,0,128,128,128,0,128,128,128,5,8,
120
+  8,6,0,0,48,72,32,80,80,32,144,96,3,1,1,6,
121
+  1,7,160,5,7,7,6,0,0,248,136,184,184,184,136,248,
122
+  5,7,7,6,0,1,112,8,120,136,120,0,248,5,5,5,
123
+  6,0,1,40,80,160,80,40,5,3,3,6,0,1,248,8,
124
+  8,2,2,2,6,2,6,64,128,5,7,7,6,0,0,248,
125
+  136,168,136,152,168,248,5,1,1,6,0,6,248,4,4,4,
126
+  6,0,3,96,144,144,96,5,7,7,6,0,0,32,32,248,
127
+  32,32,0,248,4,5,5,6,0,3,96,144,32,64,240,3,
128
+  5,5,6,0,3,224,32,224,32,224,2,2,2,6,2,6,
129
+  64,128,5,8,8,6,0,255,136,136,136,136,152,232,128,128,
130
+  5,7,7,6,0,0,120,152,152,120,24,24,24,2,2,2,
131
+  6,2,2,192,192,2,2,2,6,2,255,64,128,3,5,5,
132
+  6,0,3,64,192,64,64,224,5,7,7,6,0,1,112,136,
133
+  136,136,112,0,248,5,5,5,6,0,1,160,80,40,80,160,
134
+  5,7,7,6,0,0,136,144,168,88,184,8,8,5,7,7,
135
+  6,0,0,136,144,184,72,152,32,56,5,8,8,6,0,0,
136
+  192,64,192,72,216,56,8,8,5,7,7,6,0,0,32,0,
137
+  32,64,128,136,112,5,8,8,6,0,0,64,32,0,112,136,
138
+  248,136,136,5,8,8,6,0,0,16,32,0,112,136,248,136,
139
+  136,5,8,8,6,0,0,32,80,0,112,136,248,136,136,5,
140
+  8,8,6,0,0,104,144,0,112,136,248,136,136,5,8,8,
141
+  6,0,0,80,0,112,136,136,248,136,136,5,8,8,6,0,
142
+  0,32,80,32,112,136,248,136,136,5,7,7,6,0,0,56,
143
+  96,160,184,224,160,184,5,8,8,6,0,255,112,136,128,128,
144
+  136,112,32,96,5,8,8,6,0,0,64,32,0,248,128,240,
145
+  128,248,5,8,8,6,0,0,8,16,0,248,128,240,128,248,
146
+  5,8,8,6,0,0,32,80,0,248,128,240,128,248,5,7,
147
+  7,6,0,0,80,0,248,128,240,128,248,3,8,8,6,1,
148
+  0,128,64,0,224,64,64,64,224,3,8,8,6,1,0,32,
149
+  64,0,224,64,64,64,224,3,8,8,6,1,0,64,160,0,
150
+  224,64,64,64,224,3,7,7,6,1,0,160,0,224,64,64,
151
+  64,224,5,9,9,6,0,255,80,32,112,136,128,184,136,136,
152
+  112,5,8,8,6,0,0,104,144,0,136,200,168,152,136,5,
153
+  8,8,6,0,0,64,32,112,136,136,136,136,112,5,8,8,
154
+  6,0,0,16,32,112,136,136,136,136,112,5,8,8,6,0,
155
+  0,32,80,0,112,136,136,136,112,5,8,8,6,0,0,104,
156
+  144,0,112,136,136,136,112,5,8,8,6,0,0,80,0,112,
157
+  136,136,136,136,112,5,5,5,6,0,1,136,80,32,80,136,
158
+  5,8,8,6,0,255,16,112,168,168,168,168,112,64,5,8,
159
+  8,6,0,0,64,32,136,136,136,136,136,112,5,8,8,6,
160
+  0,0,16,32,136,136,136,136,136,112,5,8,8,6,0,0,
161
+  32,80,0,136,136,136,136,112,5,8,8,6,0,0,80,0,
162
+  136,136,136,136,136,112,1,7,7,6,2,0,128,0,128,128,
163
+  128,128,128,5,9,9,6,0,255,120,128,128,112,8,8,240,
164
+  32,96,4,8,8,6,1,255,96,144,144,160,144,144,224,128,
165
+  5,8,8,6,0,0,64,32,0,112,8,120,136,120,5,8,
166
+  8,6,0,0,16,32,0,112,8,120,136,120,5,8,8,6,
167
+  0,0,32,80,0,112,8,120,136,120,5,8,8,6,0,0,
168
+  104,144,0,112,8,120,136,120,5,7,7,6,0,0,80,0,
169
+  112,8,120,136,120,5,8,8,6,0,0,32,80,32,112,8,
170
+  120,136,120,5,6,6,6,0,0,208,40,120,160,168,80,5,
171
+  7,7,6,0,255,112,128,128,136,112,32,96,5,8,8,6,
172
+  0,0,64,32,0,112,136,248,128,112,5,8,8,6,0,0,
173
+  16,32,0,112,136,248,128,112,5,8,8,6,0,0,32,80,
174
+  0,112,136,248,128,112,5,7,7,6,0,0,80,0,112,136,
175
+  248,128,112,3,8,8,6,1,0,128,64,0,64,192,64,64,
176
+  224,3,8,8,6,1,0,32,64,0,64,192,64,64,224,3,
177
+  8,8,6,1,0,64,160,0,64,192,64,64,224,3,7,7,
178
+  6,1,0,160,0,64,192,64,64,224,5,8,8,6,0,255,
179
+  80,32,112,136,136,120,8,112,5,8,8,6,0,0,104,144,
180
+  0,176,200,136,136,136,5,8,8,6,0,0,64,32,0,112,
181
+  136,136,136,112,5,8,8,6,0,0,16,32,0,112,136,136,
182
+  136,112,5,8,8,6,0,0,32,80,0,112,136,136,136,112,
183
+  5,8,8,6,0,0,104,144,0,112,136,136,136,112,5,7,
184
+  7,6,0,0,80,0,112,136,136,136,112,5,5,5,6,0,
185
+  1,32,0,248,0,32,5,7,7,6,0,255,16,112,168,168,
186
+  168,112,64,5,8,8,6,0,0,64,32,0,136,136,136,152,
187
+  104,5,8,8,6,0,0,16,32,0,136,136,136,152,104,5,
188
+  8,8,6,0,0,32,80,0,136,136,136,152,104,5,7,7,
189
+  6,0,0,80,0,136,136,136,152,104,1,5,5,6,2,0,
190
+  128,128,128,128,128,5,7,7,6,0,255,112,128,112,8,240,
191
+  32,96,5,8,8,6,0,255,80,0,136,136,136,120,8,112
192
+  };

+ 69
- 70
Marlin/dogm_font_data_ISO10646_Greek.h Wyświetl plik

24
   Fontname: ISO10646_4_Greek
24
   Fontname: ISO10646_4_Greek
25
   Copyright: A. Hardtung, public domain
25
   Copyright: A. Hardtung, public domain
26
   Capital A Height: 7, '1' Height: 7
26
   Capital A Height: 7, '1' Height: 7
27
-  Calculated Max Values w= 5 h=10 x= 2 y= 6 dx= 6 dy= 0 ascent= 8 len=10
27
+  Calculated Max Values w= 5 h= 9 x= 2 y= 6 dx= 6 dy= 0 ascent= 8 len= 9
28
   Font Bounding box     w= 6 h= 9 x= 0 y=-2
28
   Font Bounding box     w= 6 h= 9 x= 0 y=-2
29
-  Calculated Min Values           x= 0 y=-2 dx= 0 dy= 0
29
+  Calculated Min Values           x= 0 y=-1 dx= 0 dy= 0
30
   Pure Font   ascent = 7 descent=-1
30
   Pure Font   ascent = 7 descent=-1
31
   X Font      ascent = 7 descent=-1
31
   X Font      ascent = 7 descent=-1
32
-  Max Font    ascent = 8 descent=-2
32
+  Max Font    ascent = 8 descent=-1
33
 */
33
 */
34
 #include <U8glib.h>
34
 #include <U8glib.h>
35
-const u8g_fntpgm_uint8_t ISO10646_Greek_5x7[2728] U8G_SECTION(".progmem.ISO10646_Greek_5x7") = {
36
-  0,6,9,0,254,7,1,145,3,32,32,255,255,8,254,7,
35
+const u8g_fntpgm_uint8_t ISO10646_Greek_5x7[2715] U8G_SECTION(".progmem.ISO10646_Greek_5x7") = {
36
+  0,6,9,0,254,7,1,145,3,32,32,255,255,8,255,7,
37
   255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
37
   255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128,
38
   128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
38
   128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6,
39
   0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
39
   0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32,
139
   80,80,216,3,8,8,6,1,0,160,0,224,64,64,64,64,
139
   80,80,216,3,8,8,6,1,0,160,0,224,64,64,64,64,
140
   224,5,8,8,6,0,0,80,0,136,136,136,80,32,32,5,
140
   224,5,8,8,6,0,0,80,0,136,136,136,80,32,32,5,
141
   8,8,6,0,0,32,64,8,104,152,144,144,104,5,8,8,
141
   8,8,6,0,0,32,64,8,104,152,144,144,104,5,8,8,
142
-  6,0,0,32,64,0,112,136,224,136,112,5,10,10,6,0,
143
-  254,32,64,0,112,136,136,136,136,8,8,2,8,8,6,1,
144
-  0,64,128,0,128,128,128,128,64,5,8,8,6,0,0,16,
145
-  32,80,0,136,136,136,112,5,6,6,6,0,0,8,104,152,
146
-  144,144,104,4,7,7,6,0,254,96,144,240,144,224,128,128,
147
-  5,6,6,6,0,255,136,72,80,32,32,64,5,6,6,6,
148
-  0,0,48,64,112,136,136,112,5,5,5,6,0,0,112,136,
149
-  224,136,112,5,9,9,6,0,254,128,112,64,128,128,128,112,
150
-  8,112,5,7,7,6,0,254,184,200,136,136,136,8,8,5,
151
-  5,5,6,0,0,112,136,248,136,112,3,5,5,6,1,0,
152
-  128,128,128,128,96,4,5,5,6,0,0,144,160,192,160,144,
153
-  5,6,6,6,0,0,64,32,32,80,80,136,5,7,7,6,
154
-  0,254,136,136,136,216,168,128,128,5,5,5,6,0,0,136,
155
-  136,80,96,32,5,10,10,6,0,254,128,224,128,112,32,64,
156
-  128,112,8,112,5,5,5,6,0,0,112,136,136,136,112,5,
157
-  5,5,6,0,0,248,80,80,80,80,5,7,7,6,0,254,
158
-  112,136,136,200,176,128,128,5,7,7,6,0,254,48,64,128,
159
-  64,48,8,112,5,5,5,6,0,0,104,144,144,144,96,4,
160
-  5,5,6,0,0,240,64,64,64,48,5,5,5,6,0,0,
161
-  136,136,144,144,224,5,8,8,6,0,254,48,168,168,168,168,
162
-  112,32,32,5,6,6,6,0,255,136,80,32,32,80,136,5,
163
-  7,7,6,0,254,168,168,168,168,112,32,32,5,5,5,6,
164
-  0,0,80,136,136,168,112,4,7,7,6,0,0,160,0,64,
165
-  64,64,64,48,5,7,7,6,0,0,80,0,136,136,144,144,
166
-  224,4,8,8,6,0,0,32,64,0,96,144,144,144,96,5,
167
-  8,8,6,0,0,32,64,0,136,136,144,144,96,5,8,8,
168
-  6,0,0,32,64,0,80,136,136,168,112,5,7,7,6,0,
169
-  255,144,160,192,160,144,136,16,5,8,8,6,0,0,96,144,
170
-  160,128,240,136,136,112,5,7,7,6,0,0,112,80,56,144,
171
-  144,144,96,5,6,6,6,0,0,152,80,32,32,32,32,5,
172
-  8,8,6,0,0,64,128,152,80,32,32,32,32,5,8,8,
173
-  6,0,0,80,0,152,80,32,32,32,32,5,7,7,6,0,
174
-  255,48,168,168,168,168,112,32,5,5,5,6,0,0,248,80,
175
-  80,80,88,5,6,6,6,0,255,136,80,112,80,136,16,5,
176
-  7,7,6,0,255,112,136,136,136,112,32,112,5,6,6,6,
177
-  0,255,112,136,136,112,32,112,5,6,6,6,0,0,112,136,
178
-  128,112,32,112,5,7,7,6,0,254,8,112,128,128,112,16,
179
-  96,5,6,6,6,0,0,248,128,128,240,128,128,4,5,5,
180
-  6,0,0,240,128,224,128,128,5,6,6,6,0,0,248,0,
181
-  0,112,0,248,4,5,5,6,0,0,64,128,240,16,32,5,
182
-  7,7,6,0,0,224,80,40,40,8,8,16,5,7,7,6,
183
-  0,0,192,32,80,40,8,8,8,5,8,8,6,0,254,168,
184
-  168,168,168,168,88,8,112,5,7,7,6,0,254,168,168,168,
185
-  168,88,8,112,5,6,6,6,0,0,104,136,136,120,8,8,
186
-  5,6,6,6,0,255,104,136,136,120,8,8,4,8,8,6,
187
-  0,254,128,224,144,144,144,144,32,192,5,5,5,6,0,0,
188
-  104,144,112,16,224,5,6,6,6,0,0,96,144,16,96,136,
189
-  112,4,6,6,6,0,0,96,144,16,96,128,112,5,6,6,
190
-  6,0,0,136,80,32,80,136,248,5,5,5,6,0,0,136,
191
-  80,32,80,112,5,6,6,6,0,0,120,128,240,136,136,112,
192
-  4,5,5,6,0,0,240,128,224,144,96,3,6,6,6,1,
193
-  0,64,224,64,64,64,64,3,6,6,6,1,255,64,224,64,
194
-  64,64,128,5,5,5,6,0,0,136,80,112,80,136,5,7,
195
-  7,6,0,254,112,136,136,136,240,128,112,4,5,5,6,0,
196
-  0,112,128,128,128,112,2,8,8,6,1,255,64,0,192,64,
197
-  64,64,64,128,5,7,7,6,0,0,112,136,136,248,136,136,
198
-  112,4,5,5,6,0,0,112,128,224,128,112,4,5,5,6,
199
-  0,0,224,16,112,16,224,5,7,7,6,0,0,128,240,136,
200
-  136,136,240,128,4,7,7,6,0,255,128,224,144,144,144,224,
201
-  128,5,6,6,6,0,0,112,136,128,128,136,112,5,6,6,
202
-  6,0,0,136,216,168,136,136,136,5,7,7,6,0,254,136,
203
-  216,168,136,136,128,128,5,8,8,6,0,254,112,136,136,136,
204
-  112,64,224,64,5,6,6,6,0,0,112,136,8,8,136,112,
205
-  5,6,6,6,0,0,112,136,160,128,136,112,5,6,6,6,
206
-  0,0,112,136,40,8,136,112};
142
+  6,0,0,32,64,0,112,136,224,136,112,5,9,9,6,0,
143
+  255,32,64,0,112,136,136,136,136,8,2,8,8,6,1,0,
144
+  64,128,0,128,128,128,128,64,5,8,8,6,0,0,16,32,
145
+  80,0,136,136,136,112,5,6,6,6,0,0,8,104,152,144,
146
+  144,104,4,6,6,6,0,255,96,144,240,144,224,128,5,6,
147
+  6,6,0,255,136,72,80,32,32,64,5,6,6,6,0,0,
148
+  48,64,112,136,136,112,5,5,5,6,0,0,112,136,224,136,
149
+  112,5,8,8,6,0,255,128,112,64,128,128,112,8,112,5,
150
+  6,6,6,0,255,184,200,136,136,136,8,5,5,5,6,0,
151
+  0,112,136,248,136,112,3,5,5,6,1,0,128,128,128,128,
152
+  96,4,5,5,6,0,0,144,160,192,160,144,5,6,6,6,
153
+  0,0,64,32,32,80,80,136,5,6,6,6,0,255,136,136,
154
+  136,216,168,128,5,5,5,6,0,0,136,136,80,96,32,5,
155
+  9,9,6,0,255,128,224,128,112,32,64,240,8,112,5,5,
156
+  5,6,0,0,112,136,136,136,112,5,5,5,6,0,0,248,
157
+  80,80,80,80,5,6,6,6,0,255,112,136,136,200,176,128,
158
+  5,7,7,6,0,255,48,64,128,64,48,8,112,5,5,5,
159
+  6,0,0,104,144,144,144,96,4,5,5,6,0,0,240,64,
160
+  64,64,48,5,5,5,6,0,0,136,136,144,144,224,5,7,
161
+  7,6,0,255,32,168,168,168,112,32,32,5,6,6,6,0,
162
+  255,136,80,32,32,80,136,5,6,6,6,0,255,168,168,168,
163
+  168,112,32,5,5,5,6,0,0,80,136,136,168,112,4,7,
164
+  7,6,0,0,160,0,64,64,64,64,48,5,7,7,6,0,
165
+  0,80,0,136,136,144,144,224,4,8,8,6,0,0,32,64,
166
+  0,96,144,144,144,96,5,8,8,6,0,0,32,64,0,136,
167
+  136,144,144,96,5,8,8,6,0,0,32,64,0,80,136,136,
168
+  168,112,5,7,7,6,0,255,144,160,192,160,144,136,16,5,
169
+  8,8,6,0,0,96,144,160,128,240,136,136,112,5,7,7,
170
+  6,0,0,112,80,56,144,144,144,96,5,6,6,6,0,0,
171
+  152,80,32,32,32,32,5,8,8,6,0,0,64,128,152,80,
172
+  32,32,32,32,5,8,8,6,0,0,80,0,152,80,32,32,
173
+  32,32,5,7,7,6,0,255,48,168,168,168,168,112,32,5,
174
+  5,5,6,0,0,248,80,80,80,88,5,6,6,6,0,255,
175
+  136,80,112,80,136,16,5,7,7,6,0,255,112,136,136,136,
176
+  112,32,112,5,6,6,6,0,255,112,136,136,112,32,112,5,
177
+  6,6,6,0,0,112,136,128,112,32,112,5,7,7,6,0,
178
+  255,8,8,112,128,112,16,96,5,6,6,6,0,0,248,128,
179
+  128,240,128,128,4,5,5,6,0,0,240,128,224,128,128,5,
180
+  6,6,6,0,0,248,0,0,112,0,248,4,5,5,6,0,
181
+  0,64,128,240,16,32,5,7,7,6,0,0,224,80,40,40,
182
+  8,8,16,5,7,7,6,0,0,192,32,80,40,8,8,8,
183
+  5,7,7,6,0,255,168,168,168,168,88,8,112,5,6,6,
184
+  6,0,255,168,168,168,88,8,112,5,6,6,6,0,0,104,
185
+  136,136,120,8,8,5,6,6,6,0,255,104,136,136,120,8,
186
+  8,4,8,8,6,0,255,128,224,144,144,144,144,32,192,5,
187
+  5,5,6,0,0,104,144,112,16,224,5,6,6,6,0,0,
188
+  96,144,16,96,136,112,4,6,6,6,0,0,96,144,16,96,
189
+  128,112,5,6,6,6,0,0,136,80,32,80,136,248,5,5,
190
+  5,6,0,0,136,80,32,80,112,5,6,6,6,0,0,120,
191
+  128,240,136,136,112,4,5,5,6,0,0,240,128,224,144,96,
192
+  3,6,6,6,1,0,64,224,64,64,64,64,3,6,6,6,
193
+  1,255,64,224,64,64,64,128,5,5,5,6,0,0,136,80,
194
+  112,80,136,5,6,6,6,0,255,112,136,136,240,128,112,4,
195
+  5,5,6,0,0,112,128,128,128,112,2,8,8,6,1,255,
196
+  64,0,192,64,64,64,64,128,5,7,7,6,0,0,112,136,
197
+  136,248,136,136,112,4,5,5,6,0,0,112,128,224,128,112,
198
+  4,5,5,6,0,0,224,16,112,16,224,5,7,7,6,0,
199
+  0,128,240,136,136,136,240,128,4,7,7,6,0,255,128,224,
200
+  144,144,144,224,128,5,6,6,6,0,0,112,136,128,128,136,
201
+  112,5,6,6,6,0,0,136,216,168,136,136,136,5,6,6,
202
+  6,0,255,136,216,168,136,136,128,5,8,8,6,0,255,112,
203
+  136,136,136,112,64,224,64,5,6,6,6,0,0,112,136,8,
204
+  8,136,112,5,6,6,6,0,0,112,136,160,128,136,112,5,
205
+  6,6,6,0,0,112,136,40,8,136,112};

+ 19
- 7
Marlin/duration_t.h Wyświetl plik

141
    * @param buffer The array pointed to must be able to accommodate 10 bytes
141
    * @param buffer The array pointed to must be able to accommodate 10 bytes
142
    *
142
    *
143
    * Output examples:
143
    * Output examples:
144
-   *  1234567890 (strlen)
145
-   *  1193046:59
144
+   *  123456789 (strlen)
145
+   *  99:59
146
+   *  11d 12:33
146
    */
147
    */
147
-  void toDigital(char *buffer) const {
148
-    int h = this->hour() % 24,
149
-        m = this->minute() % 60;
150
-
151
-    sprintf_P(buffer, PSTR("%02i:%02i"), h, m);
148
+  uint8_t toDigital(char *buffer, bool with_days=false) const {
149
+    uint16_t h = uint16_t(this->hour()),
150
+             m = uint16_t(this->minute() % 60UL);
151
+    if (with_days) {
152
+      uint16_t d = this->day();
153
+      sprintf_P(buffer, PSTR("%ud %02u:%02u"), d, h % 24, m);
154
+      return d >= 10 ? 8 : 7;
155
+    }
156
+    else if (h < 100) {
157
+      sprintf_P(buffer, PSTR("%02u:%02u"), h % 24, m);
158
+      return 5;
159
+    }
160
+    else {
161
+      sprintf_P(buffer, PSTR("%u:%02u"), h, m);
162
+      return 6;
163
+    }
152
   }
164
   }
153
 };
165
 };
154
 
166
 

+ 206
- 0
Marlin/endstop_interrupts.h Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Endstop Interrupts
25
+ *
26
+ * Without endstop interrupts the endstop pins must be polled continually in
27
+ * the stepper-ISR via endstops.update(), most of the time finding no change.
28
+ * With this feature endstops.update() is called only when we know that at
29
+ * least one endstop has changed state, saving valuable CPU cycles.
30
+ *
31
+ * This feature only works when all used endstop pins can generate either an
32
+ * 'external interrupt' or a 'pin change interrupt'.
33
+ *
34
+ * Test whether pins issue interrupts on your board by flashing 'pin_interrupt_test.ino'.
35
+ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
36
+ */
37
+
38
+#ifndef _ENDSTOP_INTERRUPTS_H_
39
+#define _ENDSTOP_INTERRUPTS_H_
40
+
41
+#include "macros.h"
42
+
43
+/**
44
+ * Patch for pins_arduino.h (...\Arduino\hardware\arduino\avr\variants\mega\pins_arduino.h)
45
+ *
46
+ * These macros for the Arduino MEGA do not include the two connected pins on Port J (D13, D14).
47
+ * So we extend them here because these are the normal pins for Y_MIN and Y_MAX on RAMPS.
48
+ * There are more PCI-enabled processor pins on Port J, but they are not connected to Arduino MEGA.
49
+ */
50
+#if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
51
+  #undef  digitalPinToPCICR
52
+  #define digitalPinToPCICR(p)    ( WITHIN(p, 10, 15) || \
53
+                                    WITHIN(p, 50, 53) || \
54
+                                    WITHIN(p, 62, 69) ? &PCICR : (uint8_t*)0 )
55
+  #undef  digitalPinToPCICRbit
56
+  #define digitalPinToPCICRbit(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? 0 : \
57
+                                    WITHIN(p, 14, 15) ? 1 : \
58
+                                    WITHIN(p, 62, 69) ? 2 : \
59
+                                    0 )
60
+  #undef  digitalPinToPCMSK
61
+  #define digitalPinToPCMSK(p)    ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? &PCMSK0 : \
62
+                                    WITHIN(p, 14, 15) ? &PCMSK1 : \
63
+                                    WITHIN(p, 62, 69) ? &PCMSK2 : \
64
+                                    (uint8_t *)0 )
65
+  #undef  digitalPinToPCMSKbit
66
+  #define digitalPinToPCMSKbit(p) ( WITHIN(p, 10, 13) ? ((p) - 6) : \
67
+                                    (p) == 14 || (p) == 51 ? 2 : \
68
+                                    (p) == 15 || (p) == 52 ? 1 : \
69
+                                    (p) == 50 ? 3 : \
70
+                                    (p) == 53 ? 0 : \
71
+                                    WITHIN(p, 62, 69) ? ((p) - 62) : \
72
+                                    0 )
73
+#endif
74
+
75
+volatile uint8_t e_hit = 0; // Different from 0 when the endstops should be tested in detail.
76
+                            // Must be reset to 0 by the test function when finished.
77
+
78
+// Install Pin change interrupt for a pin. Can be called multiple times.
79
+void pciSetup(byte pin) {
80
+  SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin));  // enable pin
81
+  SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
82
+  SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
83
+}
84
+
85
+// This is what is really done inside the interrupts.
86
+FORCE_INLINE void endstop_ISR_worker( void ) {
87
+  e_hit = 2; // Because the detection of a e-stop hit has a 1 step debouncer it has to be called at least twice.
88
+}
89
+
90
+// Use one Routine to handle each group
91
+// One ISR for all EXT-Interrupts
92
+void endstop_ISR(void) { endstop_ISR_worker(); }
93
+
94
+// Handlers for pin change interrupts
95
+#ifdef PCINT0_vect
96
+  ISR(PCINT0_vect) { endstop_ISR_worker(); }
97
+#endif
98
+
99
+#ifdef PCINT1_vect
100
+  ISR(PCINT1_vect) { endstop_ISR_worker(); }
101
+#endif
102
+
103
+#ifdef PCINT2_vect
104
+  ISR(PCINT2_vect) { endstop_ISR_worker(); }
105
+#endif
106
+
107
+#ifdef PCINT3_vect
108
+  ISR(PCINT3_vect) { endstop_ISR_worker(); }
109
+#endif
110
+
111
+void setup_endstop_interrupts( void ) {
112
+
113
+  #if HAS_X_MAX
114
+    #if (digitalPinToInterrupt(X_MAX_PIN) != NOT_AN_INTERRUPT) // if pin has an external interrupt
115
+      attachInterrupt(digitalPinToInterrupt(X_MAX_PIN), endstop_ISR, CHANGE); // assign it
116
+    #else
117
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
118
+      static_assert(digitalPinToPCICR(X_MAX_PIN) != NULL, "X_MAX_PIN is not interrupt-capable"); // if pin has no pin change interrupt - error
119
+      pciSetup(X_MAX_PIN);                                                            // assign it
120
+    #endif
121
+  #endif
122
+
123
+  #if HAS_X_MIN
124
+    #if (digitalPinToInterrupt(X_MIN_PIN) != NOT_AN_INTERRUPT)
125
+      attachInterrupt(digitalPinToInterrupt(X_MIN_PIN), endstop_ISR, CHANGE);
126
+    #else
127
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
128
+      static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
129
+      pciSetup(X_MIN_PIN);
130
+    #endif
131
+  #endif
132
+
133
+  #if HAS_Y_MAX
134
+    #if (digitalPinToInterrupt(Y_MAX_PIN) != NOT_AN_INTERRUPT)
135
+      attachInterrupt(digitalPinToInterrupt(Y_MAX_PIN), endstop_ISR, CHANGE);
136
+    #else
137
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
138
+      static_assert(digitalPinToPCICR(Y_MAX_PIN) != NULL, "Y_MAX_PIN is not interrupt-capable");
139
+      pciSetup(Y_MAX_PIN);
140
+    #endif
141
+  #endif
142
+
143
+  #if HAS_Y_MIN
144
+    #if (digitalPinToInterrupt(Y_MIN_PIN) != NOT_AN_INTERRUPT)
145
+      attachInterrupt(digitalPinToInterrupt(Y_MIN_PIN), endstop_ISR, CHANGE);
146
+    #else
147
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
148
+      static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
149
+      pciSetup(Y_MIN_PIN);
150
+    #endif
151
+  #endif
152
+
153
+  #if HAS_Z_MAX
154
+    #if (digitalPinToInterrupt(Z_MAX_PIN) != NOT_AN_INTERRUPT)
155
+      attachInterrupt(digitalPinToInterrupt(Z_MAX_PIN), endstop_ISR, CHANGE);
156
+    #else
157
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
158
+      static_assert(digitalPinToPCICR(Z_MAX_PIN) != NULL, "Z_MAX_PIN is not interrupt-capable");
159
+      pciSetup(Z_MAX_PIN);
160
+    #endif
161
+  #endif
162
+
163
+  #if HAS_Z_MIN
164
+    #if (digitalPinToInterrupt(Z_MIN_PIN) != NOT_AN_INTERRUPT)
165
+      attachInterrupt(digitalPinToInterrupt(Z_MIN_PIN), endstop_ISR, CHANGE);
166
+    #else
167
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
168
+      static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
169
+      pciSetup(Z_MIN_PIN);
170
+    #endif
171
+  #endif
172
+
173
+  #if HAS_Z2_MAX
174
+    #if (digitalPinToInterrupt(Z2_MAX_PIN) != NOT_AN_INTERRUPT)
175
+      attachInterrupt(digitalPinToInterrupt(Z2_MAX_PIN), endstop_ISR, CHANGE);
176
+    #else
177
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
178
+      static_assert(digitalPinToPCICR(Z2_MAX_PIN) != NULL, "Z2_MAX_PIN is not interrupt-capable");
179
+      pciSetup(Z2_MAX_PIN);
180
+    #endif
181
+  #endif
182
+
183
+  #if HAS_Z2_MIN
184
+    #if (digitalPinToInterrupt(Z2_MIN_PIN) != NOT_AN_INTERRUPT)
185
+      attachInterrupt(digitalPinToInterrupt(Z2_MIN_PIN), endstop_ISR, CHANGE);
186
+    #else
187
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
188
+      static_assert(digitalPinToPCICR(Z2_MIN_PIN) != NULL, "Z2_MIN_PIN is not interrupt-capable");
189
+      pciSetup(Z2_MIN_PIN);
190
+    #endif
191
+  #endif
192
+
193
+  #if HAS_Z_MIN_PROBE_PIN
194
+    #if (digitalPinToInterrupt(Z_MIN_PROBE_PIN) != NOT_AN_INTERRUPT)
195
+      attachInterrupt(digitalPinToInterrupt(Z_MIN_PROBE_PIN), endstop_ISR, CHANGE);
196
+    #else
197
+      // Not all used endstop/probe -pins can raise interrupts. Please deactivate ENDSTOP_INTERRUPTS or change the pin configuration!
198
+      static_assert(digitalPinToPCICR(Z_MIN_PROBE_PIN) != NULL, "Z_MIN_PROBE_PIN is not interrupt-capable");
199
+      pciSetup(Z_MIN_PROBE_PIN);
200
+    #endif
201
+  #endif
202
+
203
+  // If we arrive here without raising an assertion, each pin has either an EXT-interrupt or a PCI.
204
+}
205
+
206
+#endif // _ENDSTOP_INTERRUPTS_H_

+ 210
- 130
Marlin/endstops.cpp Wyświetl plik

67
 void Endstops::init() {
67
 void Endstops::init() {
68
 
68
 
69
   #if HAS_X_MIN
69
   #if HAS_X_MIN
70
-    SET_INPUT(X_MIN_PIN);
71
     #if ENABLED(ENDSTOPPULLUP_XMIN)
70
     #if ENABLED(ENDSTOPPULLUP_XMIN)
72
-      WRITE(X_MIN_PIN,HIGH);
71
+      SET_INPUT_PULLUP(X_MIN_PIN);
72
+    #else
73
+      SET_INPUT(X_MIN_PIN);
73
     #endif
74
     #endif
74
   #endif
75
   #endif
75
 
76
 
76
   #if HAS_Y_MIN
77
   #if HAS_Y_MIN
77
-    SET_INPUT(Y_MIN_PIN);
78
     #if ENABLED(ENDSTOPPULLUP_YMIN)
78
     #if ENABLED(ENDSTOPPULLUP_YMIN)
79
-      WRITE(Y_MIN_PIN,HIGH);
79
+      SET_INPUT_PULLUP(Y_MIN_PIN);
80
+    #else
81
+      SET_INPUT(Y_MIN_PIN);
80
     #endif
82
     #endif
81
   #endif
83
   #endif
82
 
84
 
83
   #if HAS_Z_MIN
85
   #if HAS_Z_MIN
84
-    SET_INPUT(Z_MIN_PIN);
85
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
86
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
86
-      WRITE(Z_MIN_PIN,HIGH);
87
+      SET_INPUT_PULLUP(Z_MIN_PIN);
88
+    #else
89
+      SET_INPUT(Z_MIN_PIN);
87
     #endif
90
     #endif
88
   #endif
91
   #endif
89
 
92
 
90
   #if HAS_Z2_MIN
93
   #if HAS_Z2_MIN
91
-    SET_INPUT(Z2_MIN_PIN);
92
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
94
     #if ENABLED(ENDSTOPPULLUP_ZMIN)
93
-      WRITE(Z2_MIN_PIN,HIGH);
95
+      SET_INPUT_PULLUP(Z2_MIN_PIN);
96
+    #else
97
+      SET_INPUT(Z2_MIN_PIN);
94
     #endif
98
     #endif
95
   #endif
99
   #endif
96
 
100
 
97
   #if HAS_X_MAX
101
   #if HAS_X_MAX
98
-    SET_INPUT(X_MAX_PIN);
99
     #if ENABLED(ENDSTOPPULLUP_XMAX)
102
     #if ENABLED(ENDSTOPPULLUP_XMAX)
100
-      WRITE(X_MAX_PIN,HIGH);
103
+      SET_INPUT_PULLUP(X_MAX_PIN);
104
+    #else
105
+      SET_INPUT(X_MAX_PIN);
101
     #endif
106
     #endif
102
   #endif
107
   #endif
103
 
108
 
104
   #if HAS_Y_MAX
109
   #if HAS_Y_MAX
105
-    SET_INPUT(Y_MAX_PIN);
106
     #if ENABLED(ENDSTOPPULLUP_YMAX)
110
     #if ENABLED(ENDSTOPPULLUP_YMAX)
107
-      WRITE(Y_MAX_PIN,HIGH);
111
+      SET_INPUT_PULLUP(Y_MAX_PIN);
112
+    #else
113
+      SET_INPUT(Y_MAX_PIN);
108
     #endif
114
     #endif
109
   #endif
115
   #endif
110
 
116
 
111
   #if HAS_Z_MAX
117
   #if HAS_Z_MAX
112
-    SET_INPUT(Z_MAX_PIN);
113
     #if ENABLED(ENDSTOPPULLUP_ZMAX)
118
     #if ENABLED(ENDSTOPPULLUP_ZMAX)
114
-      WRITE(Z_MAX_PIN,HIGH);
119
+      SET_INPUT_PULLUP(Z_MAX_PIN);
120
+    #else
121
+      SET_INPUT(Z_MAX_PIN);
115
     #endif
122
     #endif
116
   #endif
123
   #endif
117
 
124
 
118
   #if HAS_Z2_MAX
125
   #if HAS_Z2_MAX
119
-    SET_INPUT(Z2_MAX_PIN);
120
     #if ENABLED(ENDSTOPPULLUP_ZMAX)
126
     #if ENABLED(ENDSTOPPULLUP_ZMAX)
121
-      WRITE(Z2_MAX_PIN,HIGH);
127
+      SET_INPUT_PULLUP(Z2_MAX_PIN);
128
+    #else
129
+      SET_INPUT(Z2_MAX_PIN);
122
     #endif
130
     #endif
123
   #endif
131
   #endif
124
 
132
 
125
-  #if HAS_Z_MIN_PROBE_PIN && ENABLED(Z_MIN_PROBE_ENDSTOP) // Check for Z_MIN_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
126
-    SET_INPUT(Z_MIN_PROBE_PIN);
133
+  #if ENABLED(Z_MIN_PROBE_ENDSTOP)
127
     #if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
134
     #if ENABLED(ENDSTOPPULLUP_ZMIN_PROBE)
128
-      WRITE(Z_MIN_PROBE_PIN,HIGH);
135
+      SET_INPUT_PULLUP(Z_MIN_PROBE_PIN);
136
+    #else
137
+      SET_INPUT(Z_MIN_PROBE_PIN);
129
     #endif
138
     #endif
130
   #endif
139
   #endif
131
 
140
 
148
       if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
157
       if (TEST(endstop_hit_bits, A ##_MIN) || TEST(endstop_hit_bits, A ##_MAX)) \
149
         _ENDSTOP_HIT_ECHO(A,C)
158
         _ENDSTOP_HIT_ECHO(A,C)
150
 
159
 
151
-    SERIAL_ECHO_START;
160
+    #define ENDSTOP_HIT_TEST_X() _ENDSTOP_HIT_TEST(X,'X')
161
+    #define ENDSTOP_HIT_TEST_Y() _ENDSTOP_HIT_TEST(Y,'Y')
162
+    #define ENDSTOP_HIT_TEST_Z() _ENDSTOP_HIT_TEST(Z,'Z')
163
+
164
+    SERIAL_ECHO_START();
152
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
165
     SERIAL_ECHOPGM(MSG_ENDSTOPS_HIT);
153
-    _ENDSTOP_HIT_TEST(X, 'X');
154
-    _ENDSTOP_HIT_TEST(Y, 'Y');
155
-    _ENDSTOP_HIT_TEST(Z, 'Z');
166
+    ENDSTOP_HIT_TEST_X();
167
+    ENDSTOP_HIT_TEST_Y();
168
+    ENDSTOP_HIT_TEST_Z();
156
 
169
 
157
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
170
     #if ENABLED(Z_MIN_PROBE_ENDSTOP)
158
       #define P_AXIS Z_AXIS
171
       #define P_AXIS Z_AXIS
159
       if (TEST(endstop_hit_bits, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P');
172
       if (TEST(endstop_hit_bits, Z_MIN_PROBE)) _ENDSTOP_HIT_ECHO(P, 'P');
160
     #endif
173
     #endif
161
-    SERIAL_EOL;
174
+    SERIAL_EOL();
162
 
175
 
163
     #if ENABLED(ULTRA_LCD)
176
     #if ENABLED(ULTRA_LCD)
164
-      char msg[3 * strlen(MSG_LCD_ENDSTOPS) + 8 + 1]; // Room for a UTF 8 string
165
-      sprintf_P(msg, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
166
-      lcd_setstatus(msg);
177
+      lcd_status_printf_P(0, PSTR(MSG_LCD_ENDSTOPS " %c %c %c %c"), chrX, chrY, chrZ, chrP);
167
     #endif
178
     #endif
168
 
179
 
169
     hit_on_purpose();
180
     hit_on_purpose();
201
     SERIAL_PROTOCOLPGM(MSG_Z_MIN);
212
     SERIAL_PROTOCOLPGM(MSG_Z_MIN);
202
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
213
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PIN)^Z_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
203
   #endif
214
   #endif
215
+  #if HAS_Z2_MIN
216
+    SERIAL_PROTOCOLPGM(MSG_Z2_MIN);
217
+    SERIAL_PROTOCOLLN(((READ(Z2_MIN_PIN)^Z2_MIN_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
218
+  #endif
204
   #if HAS_Z_MAX
219
   #if HAS_Z_MAX
205
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
220
     SERIAL_PROTOCOLPGM(MSG_Z_MAX);
206
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
221
     SERIAL_PROTOCOLLN(((READ(Z_MAX_PIN)^Z_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
209
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
224
     SERIAL_PROTOCOLPGM(MSG_Z2_MAX);
210
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
225
     SERIAL_PROTOCOLLN(((READ(Z2_MAX_PIN)^Z2_MAX_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
211
   #endif
226
   #endif
212
-  #if HAS_Z_MIN_PROBE_PIN
227
+  #if ENABLED(Z_MIN_PROBE_ENDSTOP)
213
     SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
228
     SERIAL_PROTOCOLPGM(MSG_Z_PROBE);
214
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PROBE_PIN)^Z_MIN_PROBE_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
229
     SERIAL_PROTOCOLLN(((READ(Z_MIN_PROBE_PIN)^Z_MIN_PROBE_ENDSTOP_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
215
   #endif
230
   #endif
231
+  #if ENABLED(FILAMENT_RUNOUT_SENSOR)
232
+    SERIAL_PROTOCOLPGM(MSG_FILAMENT_RUNOUT_SENSOR);
233
+    SERIAL_PROTOCOLLN(((READ(FIL_RUNOUT_PIN)^FIL_RUNOUT_INVERTING) ? MSG_ENDSTOP_HIT : MSG_ENDSTOP_OPEN));
234
+  #endif
216
 } // Endstops::M119
235
 } // Endstops::M119
217
 
236
 
218
 #if ENABLED(Z_DUAL_ENDSTOPS)
237
 #if ENABLED(Z_DUAL_ENDSTOPS)
219
 
238
 
220
   // Pass the result of the endstop test
239
   // Pass the result of the endstop test
221
-  void Endstops::test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2) {
240
+  void Endstops::test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2) {
222
     byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
241
     byte z_test = TEST_ENDSTOP(es1) | (TEST_ENDSTOP(es2) << 1); // bit 0 for Z, bit 1 for Z2
223
-    if (stepper.current_block->steps[Z_AXIS] > 0) {
224
-      stepper.endstop_triggered(Z_AXIS);
242
+    if (z_test && stepper.current_block->steps[Z_AXIS] > 0) {
225
       SBI(endstop_hit_bits, Z_MIN);
243
       SBI(endstop_hit_bits, Z_MIN);
226
       if (!stepper.performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
244
       if (!stepper.performing_homing || (z_test == 0x3))  //if not performing home or if both endstops were trigged during homing...
227
         stepper.kill_current_block();
245
         stepper.kill_current_block();
233
 // Check endstops - Called from ISR!
251
 // Check endstops - Called from ISR!
234
 void Endstops::update() {
252
 void Endstops::update() {
235
 
253
 
254
+  #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
236
   #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
255
   #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
237
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
256
   #define _ENDSTOP_INVERTING(AXIS, MINMAX) AXIS ##_## MINMAX ##_ENDSTOP_INVERTING
238
   #define _ENDSTOP_HIT(AXIS) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MIN))
257
   #define _ENDSTOP_HIT(AXIS) SBI(endstop_hit_bits, _ENDSTOP(AXIS, MIN))
239
-  #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
240
 
258
 
241
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
259
   // UPDATE_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
242
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
260
   #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
243
-  // COPY_BIT: copy the value of COPY_BIT to BIT in bits
244
-  #define COPY_BIT(bits, COPY_BIT, BIT) SET_BIT(bits, BIT, TEST(bits, COPY_BIT))
261
+  // COPY_BIT: copy the value of SRC_BIT to DST_BIT in DST
262
+  #define COPY_BIT(DST, SRC_BIT, DST_BIT) SET_BIT(DST, DST_BIT, TEST(DST, SRC_BIT))
245
 
263
 
246
   #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
264
   #define UPDATE_ENDSTOP(AXIS,MINMAX) do { \
247
       UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
265
       UPDATE_ENDSTOP_BIT(AXIS, MINMAX); \
251
       } \
269
       } \
252
     } while(0)
270
     } while(0)
253
 
271
 
254
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
255
-    // Head direction in -X axis for CoreXY and CoreXZ bots.
256
-    // If DeltaA == -DeltaB, the movement is only in Y or Z axis
257
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) == stepper.motor_direction(CORE_AXIS_2))) {
258
-      if (stepper.motor_direction(X_HEAD))
259
-  #else
260
-    if (stepper.motor_direction(X_AXIS))   // stepping along -X axis (regular Cartesian bot)
261
-  #endif
262
-      { // -direction
263
-        #if ENABLED(DUAL_X_CARRIAGE)
264
-          // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
265
-          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR == -1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == -1))
266
-        #endif
267
-          {
268
-            #if HAS_X_MIN
269
-              UPDATE_ENDSTOP(X, MIN);
270
-            #endif
271
-          }
272
+  #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
273
+    // If G38 command is active check Z_MIN_PROBE for ALL movement
274
+    if (G38_move) {
275
+      UPDATE_ENDSTOP_BIT(Z, MIN_PROBE);
276
+      if (TEST_ENDSTOP(_ENDSTOP(Z, MIN_PROBE))) {
277
+        if      (stepper.current_block->steps[_AXIS(X)] > 0) { _ENDSTOP_HIT(X); stepper.endstop_triggered(_AXIS(X)); }
278
+        else if (stepper.current_block->steps[_AXIS(Y)] > 0) { _ENDSTOP_HIT(Y); stepper.endstop_triggered(_AXIS(Y)); }
279
+        else if (stepper.current_block->steps[_AXIS(Z)] > 0) { _ENDSTOP_HIT(Z); stepper.endstop_triggered(_AXIS(Z)); }
280
+        G38_endstop_hit = true;
272
       }
281
       }
273
-      else { // +direction
274
-        #if ENABLED(DUAL_X_CARRIAGE)
275
-          // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
276
-          if ((stepper.current_block->active_extruder == 0 && X_HOME_DIR == 1) || (stepper.current_block->active_extruder != 0 && X2_HOME_DIR == 1))
277
-        #endif
278
-          {
279
-            #if HAS_X_MAX
280
-              UPDATE_ENDSTOP(X, MAX);
281
-            #endif
282
-          }
283
-      }
284
-  #if ENABLED(COREXY) || ENABLED(COREXZ)
285
     }
282
     }
286
   #endif
283
   #endif
287
 
284
 
288
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
289
-    // Head direction in -Y axis for CoreXY / CoreYZ bots.
290
-    // If DeltaA == DeltaB, the movement is only in X or Y axis
291
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
292
-      if (stepper.motor_direction(Y_HEAD))
285
+  /**
286
+   * Define conditions for checking endstops
287
+   */
288
+
289
+  #if IS_CORE
290
+    #define S_(N) stepper.current_block->steps[CORE_AXIS_##N]
291
+    #define D_(N) stepper.motor_direction(CORE_AXIS_##N)
292
+  #endif
293
+
294
+  #if CORE_IS_XY || CORE_IS_XZ
295
+    /**
296
+     * Head direction in -X axis for CoreXY and CoreXZ bots.
297
+     *
298
+     * If steps differ, both axes are moving.
299
+     * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z, handled below)
300
+     * If DeltaA ==  DeltaB, the movement is only in the 1st axis (X)
301
+     */
302
+    #if ENABLED(COREXY) || ENABLED(COREXZ)
303
+      #define X_CMP ==
304
+    #else
305
+      #define X_CMP !=
306
+    #endif
307
+    #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) X_CMP D_(2)) )
308
+    #define X_AXIS_HEAD X_HEAD
293
   #else
309
   #else
294
-      if (stepper.motor_direction(Y_AXIS))   // -direction
310
+    #define X_MOVE_TEST stepper.current_block->steps[X_AXIS] > 0
311
+    #define X_AXIS_HEAD X_AXIS
295
   #endif
312
   #endif
296
-      { // -direction
297
-        #if HAS_Y_MIN
298
-          UPDATE_ENDSTOP(Y, MIN);
299
-        #endif
300
-      }
301
-      else { // +direction
302
-        #if HAS_Y_MAX
303
-          UPDATE_ENDSTOP(Y, MAX);
304
-        #endif
305
-      }
306
-  #if ENABLED(COREXY) || ENABLED(COREYZ)
307
-    }
313
+
314
+  #if CORE_IS_XY || CORE_IS_YZ
315
+    /**
316
+     * Head direction in -Y axis for CoreXY / CoreYZ bots.
317
+     *
318
+     * If steps differ, both axes are moving
319
+     * If DeltaA ==  DeltaB, the movement is only in the 1st axis (X or Y)
320
+     * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Y or Z)
321
+     */
322
+    #if ENABLED(COREYX) || ENABLED(COREYZ)
323
+      #define Y_CMP ==
324
+    #else
325
+      #define Y_CMP !=
326
+    #endif
327
+    #define Y_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Y_CMP D_(2)) )
328
+    #define Y_AXIS_HEAD Y_HEAD
329
+  #else
330
+    #define Y_MOVE_TEST stepper.current_block->steps[Y_AXIS] > 0
331
+    #define Y_AXIS_HEAD Y_AXIS
332
+  #endif
333
+
334
+  #if CORE_IS_XZ || CORE_IS_YZ
335
+    /**
336
+     * Head direction in -Z axis for CoreXZ or CoreYZ bots.
337
+     *
338
+     * If steps differ, both axes are moving
339
+     * If DeltaA ==  DeltaB, the movement is only in the 1st axis (X or Y, already handled above)
340
+     * If DeltaA == -DeltaB, the movement is only in the 2nd axis (Z)
341
+     */
342
+    #if ENABLED(COREZX) || ENABLED(COREZY)
343
+      #define Z_CMP ==
344
+    #else
345
+      #define Z_CMP !=
346
+    #endif
347
+    #define Z_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && D_(1) Z_CMP D_(2)) )
348
+    #define Z_AXIS_HEAD Z_HEAD
349
+  #else
350
+    #define Z_MOVE_TEST stepper.current_block->steps[Z_AXIS] > 0
351
+    #define Z_AXIS_HEAD Z_AXIS
308
   #endif
352
   #endif
309
 
353
 
310
-  #if ENABLED(COREXZ) || ENABLED(COREYZ)
311
-    // Head direction in -Z axis for CoreXZ or CoreYZ bots.
312
-    // If DeltaA == DeltaB, the movement is only in X or Y axis
313
-    if ((stepper.current_block->steps[CORE_AXIS_1] != stepper.current_block->steps[CORE_AXIS_2]) || (stepper.motor_direction(CORE_AXIS_1) != stepper.motor_direction(CORE_AXIS_2))) {
314
-      if (stepper.motor_direction(Z_HEAD))
354
+  // With Dual X, endstops are only checked in the homing direction for the active extruder
355
+  #if ENABLED(DUAL_X_CARRIAGE)
356
+    #define E0_ACTIVE stepper.current_block->active_extruder == 0
357
+    #define X_MIN_TEST ((X_HOME_DIR < 0 && E0_ACTIVE) || (X2_HOME_DIR < 0 && !E0_ACTIVE))
358
+    #define X_MAX_TEST ((X_HOME_DIR > 0 && E0_ACTIVE) || (X2_HOME_DIR > 0 && !E0_ACTIVE))
315
   #else
359
   #else
316
-      if (stepper.motor_direction(Z_AXIS))
360
+    #define X_MIN_TEST true
361
+    #define X_MAX_TEST true
317
   #endif
362
   #endif
318
-      { // z -direction
319
-        #if HAS_Z_MIN
320
 
363
 
321
-          #if ENABLED(Z_DUAL_ENDSTOPS)
364
+  /**
365
+   * Check and update endstops according to conditions
366
+   */
367
+
368
+  if (X_MOVE_TEST) {
369
+    if (stepper.motor_direction(X_AXIS_HEAD)) {
370
+      if (X_MIN_TEST) { // -direction
371
+        #if HAS_X_MIN
372
+          UPDATE_ENDSTOP(X, MIN);
373
+        #endif
374
+      }
375
+    }
376
+    else if (X_MAX_TEST) { // +direction
377
+      #if HAS_X_MAX
378
+        UPDATE_ENDSTOP(X, MAX);
379
+      #endif
380
+    }
381
+  }
382
+
383
+  if (Y_MOVE_TEST) {
384
+    if (stepper.motor_direction(Y_AXIS_HEAD)) { // -direction
385
+      #if HAS_Y_MIN
386
+        UPDATE_ENDSTOP(Y, MIN);
387
+      #endif
388
+    }
389
+    else { // +direction
390
+      #if HAS_Y_MAX
391
+        UPDATE_ENDSTOP(Y, MAX);
392
+      #endif
393
+    }
394
+  }
395
+
396
+  if (Z_MOVE_TEST) {
397
+    if (stepper.motor_direction(Z_AXIS_HEAD)) { // Z -direction. Gantry down, bed up.
398
+      #if HAS_Z_MIN
399
+        #if ENABLED(Z_DUAL_ENDSTOPS)
322
 
400
 
323
-            UPDATE_ENDSTOP_BIT(Z, MIN);
324
-            #if HAS_Z2_MIN
325
-              UPDATE_ENDSTOP_BIT(Z2, MIN);
326
-            #else
327
-              COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
328
-            #endif
401
+          UPDATE_ENDSTOP_BIT(Z, MIN);
402
+          #if HAS_Z2_MIN
403
+            UPDATE_ENDSTOP_BIT(Z2, MIN);
404
+          #else
405
+            COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN);
406
+          #endif
329
 
407
 
330
-            test_dual_z_endstops(Z_MIN, Z2_MIN);
408
+          test_dual_z_endstops(Z_MIN, Z2_MIN);
331
 
409
 
332
-          #else // !Z_DUAL_ENDSTOPS
410
+        #else // !Z_DUAL_ENDSTOPS
333
 
411
 
334
-            #if HAS_BED_PROBE && ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
335
-              if (z_probe_enabled) UPDATE_ENDSTOP(Z, MIN);
336
-            #else
337
-              UPDATE_ENDSTOP(Z, MIN);
338
-            #endif
412
+          #if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
413
+            if (z_probe_enabled) UPDATE_ENDSTOP(Z, MIN);
414
+          #else
415
+            UPDATE_ENDSTOP(Z, MIN);
416
+          #endif
339
 
417
 
340
-          #endif // !Z_DUAL_ENDSTOPS
418
+        #endif // !Z_DUAL_ENDSTOPS
341
 
419
 
342
-        #endif // HAS_Z_MIN
420
+      #endif // HAS_Z_MIN
343
 
421
 
344
-        #if HAS_BED_PROBE && ENABLED(Z_MIN_PROBE_ENDSTOP) && DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
345
-          if (z_probe_enabled) {
346
-            UPDATE_ENDSTOP(Z, MIN_PROBE);
347
-            if (TEST_ENDSTOP(Z_MIN_PROBE)) SBI(endstop_hit_bits, Z_MIN_PROBE);
348
-          }
349
-        #endif
350
-      }
351
-      else { // z +direction
352
-        #if HAS_Z_MAX
422
+      // When closing the gap check the enabled probe
423
+      #if ENABLED(Z_MIN_PROBE_ENDSTOP)
424
+        if (z_probe_enabled) {
425
+          UPDATE_ENDSTOP(Z, MIN_PROBE);
426
+          if (TEST_ENDSTOP(Z_MIN_PROBE)) SBI(endstop_hit_bits, Z_MIN_PROBE);
427
+        }
428
+      #endif
429
+    }
430
+    else { // Z +direction. Gantry up, bed down.
431
+      #if HAS_Z_MAX
353
 
432
 
354
-          #if ENABLED(Z_DUAL_ENDSTOPS)
433
+        // Check both Z dual endstops
434
+        #if ENABLED(Z_DUAL_ENDSTOPS)
355
 
435
 
356
-            UPDATE_ENDSTOP_BIT(Z, MAX);
357
-            #if HAS_Z2_MAX
358
-              UPDATE_ENDSTOP_BIT(Z2, MAX);
359
-            #else
360
-              COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
361
-            #endif
436
+          UPDATE_ENDSTOP_BIT(Z, MAX);
437
+          #if HAS_Z2_MAX
438
+            UPDATE_ENDSTOP_BIT(Z2, MAX);
439
+          #else
440
+            COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX);
441
+          #endif
362
 
442
 
363
-            test_dual_z_endstops(Z_MAX, Z2_MAX);
443
+          test_dual_z_endstops(Z_MAX, Z2_MAX);
364
 
444
 
365
-          #else // !Z_DUAL_ENDSTOPS
445
+        // If this pin is not hijacked for the bed probe
446
+        // then it belongs to the Z endstop
447
+        #elif DISABLED(Z_MIN_PROBE_ENDSTOP) || Z_MAX_PIN != Z_MIN_PROBE_PIN
366
 
448
 
367
-            UPDATE_ENDSTOP(Z, MAX);
449
+          UPDATE_ENDSTOP(Z, MAX);
368
 
450
 
369
-          #endif // !Z_DUAL_ENDSTOPS
370
-        #endif // Z_MAX_PIN
371
-      }
372
-  #if ENABLED(COREXZ)
451
+        #endif // !Z_MIN_PROBE_PIN...
452
+      #endif // Z_MAX_PIN
373
     }
453
     }
374
-  #endif
454
+  }
375
 
455
 
376
   old_endstop_bits = current_endstop_bits;
456
   old_endstop_bits = current_endstop_bits;
377
 
457
 

+ 8
- 1
Marlin/endstops.h Wyświetl plik

86
   private:
86
   private:
87
 
87
 
88
     #if ENABLED(Z_DUAL_ENDSTOPS)
88
     #if ENABLED(Z_DUAL_ENDSTOPS)
89
-      static void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2);
89
+      static void test_dual_z_endstops(const EndstopEnum es1, const EndstopEnum es2);
90
     #endif
90
     #endif
91
 };
91
 };
92
 
92
 
93
 extern Endstops endstops;
93
 extern Endstops endstops;
94
 
94
 
95
+#if HAS_BED_PROBE
96
+  #define ENDSTOPS_ENABLED  (endstops.enabled || endstops.z_probe_enabled)
97
+#else
98
+  #define ENDSTOPS_ENABLED  endstops.enabled
99
+#endif
100
+
101
+
95
 #endif // ENDSTOPS_H
102
 #endif // ENDSTOPS_H

+ 61
- 65
Marlin/enum.h Wyświetl plik

23
 #ifndef __ENUM_H__
23
 #ifndef __ENUM_H__
24
 #define __ENUM_H__
24
 #define __ENUM_H__
25
 
25
 
26
+#include "MarlinConfig.h"
27
+
26
 /**
28
 /**
27
  * Axis indices as enumerated constants
29
  * Axis indices as enumerated constants
28
  *
30
  *
32
  *    between X_AXIS and X Head movement, like CoreXY bots
34
  *    between X_AXIS and X Head movement, like CoreXY bots
33
  */
35
  */
34
 enum AxisEnum {
36
 enum AxisEnum {
35
-  NO_AXIS = -1,
36
-  X_AXIS  = 0,
37
-  A_AXIS  = 0,
38
-  Y_AXIS  = 1,
39
-  B_AXIS  = 1,
40
-  Z_AXIS  = 2,
41
-  C_AXIS  = 2,
42
-  E_AXIS  = 3,
43
-  X_HEAD  = 4,
44
-  Y_HEAD  = 5,
45
-  Z_HEAD  = 6
37
+  NO_AXIS   = -1,
38
+  X_AXIS    = 0,
39
+  A_AXIS    = 0,
40
+  Y_AXIS    = 1,
41
+  B_AXIS    = 1,
42
+  Z_AXIS    = 2,
43
+  C_AXIS    = 2,
44
+  E_AXIS    = 3,
45
+  X_HEAD    = 4,
46
+  Y_HEAD    = 5,
47
+  Z_HEAD    = 6,
48
+  ALL_AXES  = 100
46
 };
49
 };
47
 
50
 
48
-#define LOOP_XYZ(VAR)  for (uint8_t VAR=X_AXIS; VAR<=Z_AXIS; VAR++)
49
-#define LOOP_XYZE(VAR) for (uint8_t VAR=X_AXIS; VAR<=E_AXIS; VAR++)
51
+#define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=S; VAR<=N; VAR++)
52
+#define LOOP_S_L_N(VAR, S, N) for (uint8_t VAR=S; VAR<N; VAR++)
53
+#define LOOP_LE_N(VAR, N) LOOP_S_LE_N(VAR, 0, N)
54
+#define LOOP_L_N(VAR, N) LOOP_S_L_N(VAR, 0, N)
55
+
56
+#define LOOP_NA(VAR) LOOP_L_N(VAR, NUM_AXIS)
57
+#define LOOP_XYZ(VAR) LOOP_S_LE_N(VAR, X_AXIS, Z_AXIS)
58
+#define LOOP_XYZE(VAR) LOOP_S_LE_N(VAR, X_AXIS, E_AXIS)
59
+#define LOOP_XYZE_N(VAR) LOOP_S_L_N(VAR, X_AXIS, XYZE_N)
50
 
60
 
51
 typedef enum {
61
 typedef enum {
52
   LINEARUNIT_MM,
62
   LINEARUNIT_MM,
70
   DEBUG_ERRORS        = _BV(2), ///< Not implemented
80
   DEBUG_ERRORS        = _BV(2), ///< Not implemented
71
   DEBUG_DRYRUN        = _BV(3), ///< Ignore temperature setting and E movement commands
81
   DEBUG_DRYRUN        = _BV(3), ///< Ignore temperature setting and E movement commands
72
   DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
82
   DEBUG_COMMUNICATION = _BV(4), ///< Not implemented
73
-  DEBUG_LEVELING      = _BV(5)  ///< Print detailed output for homing and leveling
83
+  DEBUG_LEVELING      = _BV(5), ///< Print detailed output for homing and leveling
84
+  DEBUG_MESH_ADJUST   = _BV(6), ///< UBL bed leveling
85
+  DEBUG_ALL           = 0xFF
74
 };
86
 };
75
 
87
 
76
 enum EndstopEnum {
88
 enum EndstopEnum {
85
   Z2_MAX
97
   Z2_MAX
86
 };
98
 };
87
 
99
 
88
-/**
89
- * Temperature
90
- * Stages in the ISR loop
91
- */
92
-enum TempState {
93
-  PrepareTemp_0,
94
-  MeasureTemp_0,
95
-  PrepareTemp_BED,
96
-  MeasureTemp_BED,
97
-  PrepareTemp_1,
98
-  MeasureTemp_1,
99
-  PrepareTemp_2,
100
-  MeasureTemp_2,
101
-  PrepareTemp_3,
102
-  MeasureTemp_3,
103
-  Prepare_FILWIDTH,
104
-  Measure_FILWIDTH,
105
-  StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
106
-};
107
-
108
 #if ENABLED(EMERGENCY_PARSER)
100
 #if ENABLED(EMERGENCY_PARSER)
109
   enum e_parser_state {
101
   enum e_parser_state {
110
     state_RESET,
102
     state_RESET,
122
   };
114
   };
123
 #endif
115
 #endif
124
 
116
 
125
-#if ENABLED(FILAMENT_CHANGE_FEATURE)
126
-  enum FilamentChangeMenuResponse {
127
-    FILAMENT_CHANGE_RESPONSE_WAIT_FOR,
128
-    FILAMENT_CHANGE_RESPONSE_EXTRUDE_MORE,
129
-    FILAMENT_CHANGE_RESPONSE_RESUME_PRINT
117
+#if ENABLED(ADVANCED_PAUSE_FEATURE)
118
+  enum AdvancedPauseMenuResponse {
119
+    ADVANCED_PAUSE_RESPONSE_WAIT_FOR,
120
+    ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE,
121
+    ADVANCED_PAUSE_RESPONSE_RESUME_PRINT
130
   };
122
   };
131
 
123
 
132
   #if ENABLED(ULTIPANEL)
124
   #if ENABLED(ULTIPANEL)
133
-    enum FilamentChangeMessage {
134
-      FILAMENT_CHANGE_MESSAGE_INIT,
135
-      FILAMENT_CHANGE_MESSAGE_UNLOAD,
136
-      FILAMENT_CHANGE_MESSAGE_INSERT,
137
-      FILAMENT_CHANGE_MESSAGE_LOAD,
138
-      FILAMENT_CHANGE_MESSAGE_EXTRUDE,
139
-      FILAMENT_CHANGE_MESSAGE_OPTION,
140
-      FILAMENT_CHANGE_MESSAGE_RESUME,
141
-      FILAMENT_CHANGE_MESSAGE_STATUS
125
+    enum AdvancedPauseMessage {
126
+      ADVANCED_PAUSE_MESSAGE_INIT,
127
+      ADVANCED_PAUSE_MESSAGE_UNLOAD,
128
+      ADVANCED_PAUSE_MESSAGE_INSERT,
129
+      ADVANCED_PAUSE_MESSAGE_LOAD,
130
+      ADVANCED_PAUSE_MESSAGE_EXTRUDE,
131
+      ADVANCED_PAUSE_MESSAGE_OPTION,
132
+      ADVANCED_PAUSE_MESSAGE_RESUME,
133
+      ADVANCED_PAUSE_MESSAGE_STATUS,
134
+      ADVANCED_PAUSE_MESSAGE_CLICK_TO_HEAT_NOZZLE,
135
+      ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT
142
     };
136
     };
143
   #endif
137
   #endif
144
 #endif
138
 #endif
157
   };
151
   };
158
 #endif
152
 #endif
159
 
153
 
160
-#if ENABLED(MESH_BED_LEVELING)
161
-  enum MeshLevelingState {
162
-    MeshReport,
163
-    MeshStart,
164
-    MeshNext,
165
-    MeshSet,
166
-    MeshSetZOffset,
167
-    MeshReset
168
-  };
169
-
170
-  enum MBLStatus {
171
-    MBL_STATUS_NONE = 0,
172
-    MBL_STATUS_HAS_MESH_BIT = 0,
173
-    MBL_STATUS_ACTIVE_BIT = 1
174
-  };
175
-#endif
176
-
177
 /**
154
 /**
178
  * SD Card
155
  * SD Card
179
  */
156
  */
190
   LCDVIEW_CALL_NO_REDRAW
167
   LCDVIEW_CALL_NO_REDRAW
191
 };
168
 };
192
 
169
 
170
+/**
171
+ * Dual X Carriage modes. A Dual Nozzle can also do duplication.
172
+ */
173
+#if ENABLED(DUAL_X_CARRIAGE) || ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
174
+  enum DualXMode {
175
+    DXC_FULL_CONTROL_MODE,  // DUAL_X_CARRIAGE only
176
+    DXC_AUTO_PARK_MODE,     // DUAL_X_CARRIAGE only
177
+    DXC_DUPLICATION_MODE
178
+  };
179
+#endif
180
+
181
+/**
182
+ * Workspace planes only apply to G2/G3 moves
183
+ * (and "canned cycles" - not a current feature)
184
+ */
185
+#if ENABLED(CNC_WORKSPACE_PLANES)
186
+  enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
187
+#endif
188
+
193
 #endif // __ENUM_H__
189
 #endif // __ENUM_H__

+ 1786
- 0
Marlin/example_configurations/Anet/A6/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1361
- 0
Marlin/example_configurations/Anet/A6/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 1636
- 0
Marlin/example_configurations/Anet/A8/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1361
- 0
Marlin/example_configurations/Anet/A8/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 1625
- 0
Marlin/example_configurations/CL-260/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 15
- 0
Marlin/example_configurations/CL-260/README.txt Wyświetl plik

1
+This is an example configuration for the CL-260.
2
+Change Z_MAX_POS to 300 for the CL-260MAX.
3
+
4
+(The printer is available on AliExpress; be aware that this is not a beginner's
5
+printer -- it needs tweaking and some parts replaced before being decent.)
6
+
7
+The printer comes with a quite old Marlin, the sources are available here:
8
+http://www.thingiverse.com/thing:1635830/ and I recommend replacing them.
9
+
10
+The setting "works" for my printer and the extruder using my calibration value.
11
+You might want to tweak some settings, e.g enable EEPROM, increase default Z speed, adjust homing speeds,...
12
+
13
+Have fun!
14
+--
15
+tobi

+ 752
- 457
Marlin/example_configurations/Cartesio/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/Cartesio/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 62
- 62
Marlin/example_configurations/Cartesio/_Bootscreen.h Wyświetl plik

37
 
37
 
38
 const unsigned char custom_start_bmp[512] PROGMEM = {
38
 const unsigned char custom_start_bmp[512] PROGMEM = {
39
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
41
-  0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00,
42
-  0x00, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x00,
43
-  0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00,
44
-  0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00,
45
-  0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
46
-  0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
47
-  0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
48
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
49
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
50
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
51
-  0x00, 0x0f, 0x07, 0x87, 0xff, 0xff, 0xe0, 0x00,
52
-  0x00, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0x00,
53
-  0x01, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0x80,
54
-  0x03, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0x80,
55
-  0x07, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xe1, 0xc0,
56
-  0x07, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xe0,
57
-  0x0f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xe0,
58
-  0x0f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xf0,
59
-  0x1f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xf0,
60
-  0x1f, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xe1, 0xf0,
61
-  0x3f, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0xf8,
62
-  0x3f, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0xf8,
63
-  0x3f, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xf1, 0xf8,
64
-  0x3f, 0x1f, 0x8f, 0xc7, 0xff, 0xff, 0xe1, 0xf8,
65
-  0x7f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xfc,
66
-  0x7f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xfc,
67
-  0x7f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xfc,
68
-  0x7f, 0x1f, 0x8f, 0xc7, 0xc0, 0x00, 0x01, 0xfc,
69
-  0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
70
-  0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
71
-  0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
72
-  0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
73
-  0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc,
74
-  0x7f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xfc,
75
-  0x7f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xfc,
76
-  0x7f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xfc,
77
-  0x3f, 0x0f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf8,
78
-  0x3f, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf8,
79
-  0x3f, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf8,
80
-  0x3f, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf8,
81
-  0x1f, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf0,
82
-  0x1f, 0x0f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xf0,
83
-  0x1f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xe0,
84
-  0x0f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xe0,
85
-  0x0f, 0x00, 0x00, 0x07, 0xc7, 0xe3, 0xf1, 0xc0,
86
-  0x07, 0x0f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0xc0,
87
-  0x03, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0x80,
88
-  0x03, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf1, 0x00,
89
-  0x01, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf0, 0x00,
90
-  0x00, 0x1f, 0xff, 0xff, 0xc7, 0xe3, 0xf0, 0x00,
91
-  0x00, 0x0f, 0xff, 0xff, 0xc3, 0xc1, 0xe0, 0x00,
92
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
93
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
94
-  0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
95
-  0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00,
96
-  0x00, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00,
97
-  0x00, 0x01, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00,
98
-  0x00, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x00, 0x00,
99
-  0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00,
100
-  0x00, 0x00, 0x07, 0xff, 0xff, 0x80, 0x00, 0x00,
101
-  0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00, 0x00,
40
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
41
+  0x00, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x00,
42
+  0x00, 0x00, 0x03, 0xFF, 0xFF, 0xC0, 0x00, 0x00,
43
+  0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
44
+  0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFC, 0x00, 0x00,
45
+  0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
46
+  0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00,
47
+  0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
48
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
49
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
50
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
51
+  0x00, 0x0F, 0x07, 0x87, 0xFF, 0xFF, 0xE0, 0x00,
52
+  0x00, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0x00,
53
+  0x01, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0x80,
54
+  0x03, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0x80,
55
+  0x07, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xE1, 0xC0,
56
+  0x07, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xE0,
57
+  0x0F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xE0,
58
+  0x0F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xF0,
59
+  0x1F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xF0,
60
+  0x1F, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xE1, 0xF0,
61
+  0x3F, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0xF8,
62
+  0x3F, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0xF8,
63
+  0x3F, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xF1, 0xF8,
64
+  0x3F, 0x1F, 0x8F, 0xC7, 0xFF, 0xFF, 0xE1, 0xF8,
65
+  0x7F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xFC,
66
+  0x7F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xFC,
67
+  0x7F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xFC,
68
+  0x7F, 0x1F, 0x8F, 0xC7, 0xC0, 0x00, 0x01, 0xFC,
69
+  0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
70
+  0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
71
+  0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
72
+  0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
73
+  0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC,
74
+  0x7F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xFC,
75
+  0x7F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xFC,
76
+  0x7F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xFC,
77
+  0x3F, 0x0F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF8,
78
+  0x3F, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF8,
79
+  0x3F, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF8,
80
+  0x3F, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF8,
81
+  0x1F, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF0,
82
+  0x1F, 0x0F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xF0,
83
+  0x1F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xE0,
84
+  0x0F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xE0,
85
+  0x0F, 0x00, 0x00, 0x07, 0xC7, 0xE3, 0xF1, 0xC0,
86
+  0x07, 0x0F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0xC0,
87
+  0x03, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0x80,
88
+  0x03, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF1, 0x00,
89
+  0x01, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF0, 0x00,
90
+  0x00, 0x1F, 0xFF, 0xFF, 0xC7, 0xE3, 0xF0, 0x00,
91
+  0x00, 0x0F, 0xFF, 0xFF, 0xC3, 0xC1, 0xE0, 0x00,
92
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
93
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
94
+  0x00, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x00, 0x00,
95
+  0x00, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0x00,
96
+  0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00,
97
+  0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00,
98
+  0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFC, 0x00, 0x00,
99
+  0x00, 0x00, 0x1F, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
100
+  0x00, 0x00, 0x07, 0xFF, 0xFF, 0x80, 0x00, 0x00,
101
+  0x00, 0x00, 0x00, 0x7F, 0xF8, 0x00, 0x00, 0x00,
102
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
102
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
103
 };
103
 };

+ 757
- 461
Marlin/example_configurations/Felix/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/Felix/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 754
- 456
Marlin/example_configurations/Felix/DUAL/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1628
- 0
Marlin/example_configurations/FolgerTech-i3-2020/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1367
- 0
Marlin/example_configurations/FolgerTech-i3-2020/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 755
- 460
Marlin/example_configurations/Hephestos/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/Hephestos/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 774
- 478
Marlin/example_configurations/Hephestos_2/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 760
- 222
Marlin/example_configurations/Hephestos_2/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 1
- 0
Marlin/example_configurations/Hephestos_2/README.md Wyświetl plik

12
                 SD printing now disables the heater when finished
12
                 SD printing now disables the heater when finished
13
  * 2016/07/13 - Update the `DEFAULT_AXIS_STEPS_PER_UNIT` for the Z axis
13
  * 2016/07/13 - Update the `DEFAULT_AXIS_STEPS_PER_UNIT` for the Z axis
14
                 Increased the `DEFAULT_XYJERK`
14
                 Increased the `DEFAULT_XYJERK`
15
+ * 2016/12/13 - Configuration updated.

+ 50
- 50
Marlin/example_configurations/Hephestos_2/_Bootscreen.h Wyświetl plik

36
 #define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
36
 #define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
37
 
37
 
38
 const unsigned char custom_start_bmp[512] PROGMEM = {
38
 const unsigned char custom_start_bmp[512] PROGMEM = {
39
-  0x00, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00,
40
-  0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00,
41
-  0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00,
42
-  0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00,
43
-  0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00,
44
-  0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00,
45
-  0x00, 0x03, 0xc0, 0x0f, 0xf0, 0x07, 0x80, 0x00,
46
-  0x00, 0x07, 0xe0, 0x07, 0xe0, 0x0f, 0xc0, 0x00,
47
-  0x00, 0x0f, 0xf0, 0x03, 0xc0, 0x1f, 0xe0, 0x00,
48
-  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0xf0, 0x00,
49
-  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0xf0, 0x00,
50
-  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0xf0, 0x00,
51
-  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0xf0, 0x00,
52
-  0x00, 0x1f, 0xf8, 0x00, 0x00, 0x3f, 0xf0, 0x00,
53
-  0x00, 0x0f, 0xf0, 0x00, 0x00, 0x1f, 0xe0, 0x00,
54
-  0x00, 0x07, 0xe0, 0x00, 0x00, 0x0f, 0xc0, 0x00,
55
-  0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0x80, 0x00,
39
+  0x00, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x00, 0x00,
40
+  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00,
41
+  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00,
42
+  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00,
43
+  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00,
44
+  0x00, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x00,
45
+  0x00, 0x03, 0xC0, 0x0F, 0xF0, 0x07, 0x80, 0x00,
46
+  0x00, 0x07, 0xE0, 0x07, 0xE0, 0x0F, 0xC0, 0x00,
47
+  0x00, 0x0F, 0xF0, 0x03, 0xC0, 0x1F, 0xE0, 0x00,
48
+  0x00, 0x1F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00,
49
+  0x00, 0x1F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00,
50
+  0x00, 0x1F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00,
51
+  0x00, 0x1F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00,
52
+  0x00, 0x1F, 0xF8, 0x00, 0x00, 0x3F, 0xF0, 0x00,
53
+  0x00, 0x0F, 0xF0, 0x00, 0x00, 0x1F, 0xE0, 0x00,
54
+  0x00, 0x07, 0xE0, 0x00, 0x00, 0x0F, 0xC0, 0x00,
55
+  0x00, 0x03, 0xC0, 0x00, 0x00, 0x07, 0x80, 0x00,
56
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
58
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf8,
59
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfc,
60
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc,
61
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc,
62
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc,
63
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc,
64
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfc,
65
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfc,
66
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf8,
67
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0,
57
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
58
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8,
59
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFC,
60
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC,
61
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC,
62
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC,
63
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC,
64
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFC,
65
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFC,
66
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xF8,
67
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0,
68
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
75
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
76
-  0x1e, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
77
-  0x3f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
78
-  0x7f, 0x80, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
79
-  0xff, 0xc0, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
80
-  0xff, 0xc0, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
81
-  0xff, 0xc0, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00,
82
-  0xff, 0xc0, 0x00, 0x00, 0xf7, 0xc0, 0x1f, 0x80,
83
-  0xff, 0xc0, 0x00, 0x00, 0xff, 0xf0, 0x7f, 0xc0,
84
-  0x7f, 0x80, 0x00, 0x00, 0xff, 0xf8, 0xff, 0xe0,
85
-  0x3f, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0xf0, 0xf8,
86
-  0x1e, 0x00, 0x00, 0x00, 0xf8, 0x7d, 0xe0, 0x78,
87
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
88
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
89
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
90
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
91
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
92
-  0x00, 0x00, 0x00, 0x00, 0xf0, 0x3d, 0xe0, 0x78,
93
-  0x00, 0x00, 0x00, 0x00, 0xf8, 0x79, 0xf0, 0xf8,
94
-  0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0xff, 0xf8,
95
-  0x00, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x7f, 0xf8,
96
-  0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x3f, 0xf8,
97
-  0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x0e, 0x78,
76
+  0x1E, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
77
+  0x3F, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
78
+  0x7F, 0x80, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
79
+  0xFF, 0xC0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
80
+  0xFF, 0xC0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
81
+  0xFF, 0xC0, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
82
+  0xFF, 0xC0, 0x00, 0x00, 0xF7, 0xC0, 0x1F, 0x80,
83
+  0xFF, 0xC0, 0x00, 0x00, 0xFF, 0xF0, 0x7F, 0xC0,
84
+  0x7F, 0x80, 0x00, 0x00, 0xFF, 0xF8, 0xFF, 0xE0,
85
+  0x3F, 0x00, 0x00, 0x00, 0xFC, 0xF8, 0xF0, 0xF8,
86
+  0x1E, 0x00, 0x00, 0x00, 0xF8, 0x7D, 0xE0, 0x78,
87
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
88
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
89
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
90
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
91
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
92
+  0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D, 0xE0, 0x78,
93
+  0x00, 0x00, 0x00, 0x00, 0xF8, 0x79, 0xF0, 0xF8,
94
+  0x00, 0x00, 0x00, 0x00, 0xFF, 0xF8, 0xFF, 0xF8,
95
+  0x00, 0x00, 0x00, 0x00, 0x3F, 0xF0, 0x7F, 0xF8,
96
+  0x00, 0x00, 0x00, 0x00, 0x0F, 0xE0, 0x3F, 0xF8,
97
+  0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x0E, 0x78,
98
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
98
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
99
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
99
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
100
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,
100
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78,

+ 1594
- 0
Marlin/example_configurations/Infitary-i3-M508/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1260
- 0
Marlin/example_configurations/Infitary-i3-M508/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 812
- 493
Marlin/example_configurations/K8200/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 788
- 226
Marlin/example_configurations/K8200/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 2
- 2
Marlin/example_configurations/K8200/README.md Wyświetl plik

4
 
4
 
5
 * updated manually with parameters from genuine Vellemann Firmware "firmware_k8200_marlinv2" based on the recent development branch
5
 * updated manually with parameters from genuine Vellemann Firmware "firmware_k8200_marlinv2" based on the recent development branch
6
 
6
 
7
-* VM8201 uses "DISPLAY_CHARSET_HD44870_JAPAN" and "ULTIMAKERCONTROLLER"
7
+* VM8201 uses "DISPLAY_CHARSET_HD44870 JAPANESE" and "ULTIMAKERCONTROLLER"
8
 * german (de) translation with umlaut is supported now - thanks to @AnHardt for the great hardware based umlaut support
8
 * german (de) translation with umlaut is supported now - thanks to @AnHardt for the great hardware based umlaut support
9
 
9
 
10
-I [@CONSULitAS](https://github.com/CONSULitAS) tested the changes on my K8200 with 20x4-LCD and Arduino 1.6.1 for Windows (SD library added to IDE manually) - everything works well.
10
+I [@CONSULitAS](https://github.com/CONSULitAS) tested the changes on my K8200 with 20x4-LCD and Arduino 1.6.12 for Mac (SD library added to IDE manually), 2016-11-18 - everything works well.
11
 
11
 
12
 **Source for genuine [Vellemann Firmware](http://www.k8200.eu/support/downloads/)**
12
 **Source for genuine [Vellemann Firmware](http://www.k8200.eu/support/downloads/)**
13
 * V2.1.1 (for z axis upgrade, date branched: 2013-06-05): [firmware_k8200_v2.1.1.zip](http://www.k8200.eu/downloads/files/downloads/firmware_k8200_v2.1.1.zip)
13
 * V2.1.1 (for z axis upgrade, date branched: 2013-06-05): [firmware_k8200_v2.1.1.zip](http://www.k8200.eu/downloads/files/downloads/firmware_k8200_v2.1.1.zip)

+ 755
- 458
Marlin/example_configurations/K8400/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/K8400/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 754
- 457
Marlin/example_configurations/K8400/Dual-head/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1
- 1
Marlin/example_configurations/K8400/README.md Wyświetl plik

2
 http://www.k8400.eu/
2
 http://www.k8400.eu/
3
 
3
 
4
 Configuration files for the K8400, ported upstream from the official Velleman firmware.
4
 Configuration files for the K8400, ported upstream from the official Velleman firmware.
5
-Like it's predecessor, (K8200), the K8400 is a 3Drag clone. There are some minor differences, documented in pins_K8400.h.
5
+Like its predecessor, (K8200), the K8400 is a 3Drag clone. There are some minor differences, documented in pins_K8400.h.
6
 
6
 
7
 Single and dual head configurations provided. Copy the correct Configuration.h and Configuration_adv.h to the /Marlin/ directory.
7
 Single and dual head configurations provided. Copy the correct Configuration.h and Configuration_adv.h to the /Marlin/ directory.
8
 
8
 

+ 1651
- 0
Marlin/example_configurations/M150/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1361
- 0
Marlin/example_configurations/M150/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 3
- 0
Marlin/example_configurations/M150/README.md Wyświetl plik

1
+# Configuration for Malyan M150 hobbyking printer
2
+# config without automatic bed level sensor
3
+# or in other words, "as stock"

+ 104
- 0
Marlin/example_configurations/M150/_Bootscreen.h Wyświetl plik

1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+/**
24
+ * Custom Bitmap for splashscreen
25
+ *
26
+ * You may use one of the following tools to generate the C++ bitmap array from
27
+ * a black and white image:
28
+ *
29
+ *  - http://www.marlinfw.org/tools/u8glib/converter.html
30
+ *  - http://www.digole.com/tools/PicturetoC_Hex_converter.php
31
+ */
32
+#include <avr/pgmspace.h>
33
+
34
+#define CUSTOM_BOOTSCREEN_TIMEOUT   1000
35
+#define CUSTOM_BOOTSCREEN_BMPWIDTH  128
36
+#define CUSTOM_BOOTSCREEN_BMPHEIGHT 64
37
+
38
+const unsigned char custom_start_bmp[1024] PROGMEM = {
39
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
40
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
41
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
42
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
43
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
44
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
45
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
46
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
47
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
48
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
49
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
50
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
51
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
52
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
53
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
54
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
55
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
56
+,0x07,0x00,0x00,0x03,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
57
+,0x1f,0xc0,0x00,0x0f,0xe0,0x7c,0x03,0xe0,0x78,0x1c,0x07,0x81,0xe0,0xf0,0x3e,0x0e
58
+,0x7f,0xe0,0x00,0x3f,0xf0,0x7e,0x07,0xe0,0xfc,0x1c,0x03,0x81,0xc1,0xf8,0x3f,0x0e
59
+,0x7f,0xf8,0x00,0x7f,0xf0,0x7e,0x07,0xe0,0xfc,0x1c,0x03,0xc3,0xc1,0xf8,0x3f,0x0e
60
+,0x7b,0xfe,0x01,0xfe,0xf0,0x7f,0x0f,0xe1,0xfe,0x1c,0x01,0xc3,0x83,0xfc,0x3f,0x8e
61
+,0x7c,0xff,0x87,0xf9,0xf0,0x77,0x0e,0xe1,0xfe,0x1c,0x01,0xe7,0x83,0xfc,0x3b,0x8e
62
+,0x7f,0x7f,0xcf,0xf7,0xf0,0x77,0x9e,0xe1,0xce,0x1c,0x00,0xe7,0x03,0x9c,0x3b,0xce
63
+,0x7f,0x9f,0xff,0xcf,0xf0,0x73,0x9c,0xe3,0xcf,0x1c,0x00,0xff,0x07,0x9e,0x39,0xce
64
+,0x7f,0xe7,0xff,0x3f,0xf0,0x73,0xfc,0xe3,0x87,0x1c,0x00,0x7e,0x07,0x0e,0x39,0xee
65
+,0x7f,0xfb,0xfe,0xff,0xf0,0x71,0xf8,0xe3,0x87,0x1c,0x00,0x7e,0x0f,0x0f,0x38,0xee
66
+,0x7f,0xfc,0xf9,0xff,0xf0,0x71,0xf8,0xe7,0xff,0x9c,0x00,0x3c,0x0f,0xff,0x38,0xfe
67
+,0x7f,0xff,0x27,0xff,0xf0,0x70,0xf0,0xe7,0xff,0x9c,0x00,0x3c,0x0f,0xff,0x38,0x7e
68
+,0x7f,0xff,0xdf,0xff,0xf0,0x70,0xf0,0xef,0xff,0xdc,0x00,0x3c,0x1f,0xff,0xb8,0x7e
69
+,0x7f,0xdf,0xff,0xdf,0xf0,0x70,0x60,0xef,0x03,0xdf,0xf8,0x3c,0x1e,0x07,0xb8,0x3e
70
+,0x7f,0xc7,0xff,0x1f,0xf0,0x70,0x60,0xee,0x01,0xdf,0xf8,0x3c,0x1c,0x03,0xb8,0x3e
71
+,0x7f,0xc3,0xfe,0x1f,0xf0,0x70,0x00,0xee,0x01,0xdf,0xf8,0x3c,0x1c,0x03,0xb8,0x1e
72
+,0x7f,0xc3,0xfe,0x1f,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
73
+,0x7f,0xc3,0xde,0x1f,0xf0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe
74
+,0x7f,0xc3,0xde,0x1f,0xf0,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe
75
+,0x7f,0xc3,0xde,0x1f,0xf0,0x7c,0x3f,0xfa,0xfb,0xff,0xff,0xff,0xfd,0x7a,0xbf,0xfe
76
+,0x7f,0xc3,0xde,0x1f,0xf0,0x7d,0x9f,0xfb,0xff,0xff,0xff,0xff,0xff,0x7e,0xf7,0xfe
77
+,0x7f,0xc3,0xde,0x1f,0xf0,0x7d,0x93,0x1a,0x8a,0x18,0xe3,0x8c,0x45,0x1a,0xa2,0xde
78
+,0x3f,0xc3,0xde,0x0f,0xf0,0x7c,0x2d,0xca,0xca,0xd6,0xe9,0x24,0xcd,0x6a,0xb6,0xbe
79
+,0x1f,0x83,0xde,0x07,0xe0,0x7d,0xa3,0x6a,0x9a,0xd6,0xe9,0x26,0x65,0x6a,0xb6,0x3e
80
+,0x06,0x03,0xde,0x01,0x80,0x7d,0x91,0x0a,0x8a,0xd8,0xe3,0x8c,0x45,0x1a,0xb3,0x7e
81
+,0x00,0x03,0xde,0x00,0x00,0x7f,0xff,0xff,0xff,0xfe,0xef,0xff,0xff,0xff,0xff,0x7e
82
+,0x00,0x03,0xde,0x00,0x00,0x7f,0xff,0xff,0xff,0xf1,0xef,0xff,0xff,0xff,0xfe,0xfe
83
+,0x00,0x03,0xde,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe
84
+,0x00,0x03,0xde,0x00,0x00,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe
85
+,0x00,0x03,0xde,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
86
+,0x00,0x01,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
87
+,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
88
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
89
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
90
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
91
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
92
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
93
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
94
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
95
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
96
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
97
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
98
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
99
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
100
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
101
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
102
+,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
103
+
104
+};

+ 756
- 459
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 758
- 461
Marlin/example_configurations/RigidBot/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/RigidBot/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 788
- 487
Marlin/example_configurations/SCARA/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/SCARA/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 755
- 460
Marlin/example_configurations/TAZ4/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 222
Marlin/example_configurations/TAZ4/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 1685
- 0
Marlin/example_configurations/TinyBoy2/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1357
- 0
Marlin/example_configurations/TinyBoy2/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 754
- 459
Marlin/example_configurations/WITBOX/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 769
- 214
Marlin/example_configurations/WITBOX/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 757
- 460
Marlin/example_configurations/adafruit/ST7565/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1749
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1359
- 0
Marlin/example_configurations/delta/FLSUN/auto_calibrate/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 1743
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 1358
- 0
Marlin/example_configurations/delta/FLSUN/kossel_mini/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 0
- 1420
Marlin/example_configurations/delta/biv2.5/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 0
- 801
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h Wyświetl plik

1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-/**
24
- * Configuration_adv.h
25
- *
26
- * Advanced settings.
27
- * Only change these if you know exactly what you're doing.
28
- * Some of these settings can damage your printer if improperly set!
29
- *
30
- * Basic settings can be found in Configuration.h
31
- *
32
- */
33
-#ifndef CONFIGURATION_ADV_H
34
-#define CONFIGURATION_ADV_H
35
-
36
-/**
37
- *
38
- *  ***********************************
39
- *  **  ATTENTION TO ALL DEVELOPERS  **
40
- *  ***********************************
41
- *
42
- * You must increment this version number for every significant change such as,
43
- * but not limited to: ADD, DELETE RENAME OR REPURPOSE any directive/option.
44
- *
45
- * Note: Update also Version.h !
46
- */
47
-#define CONFIGURATION_ADV_H_VERSION 010100
48
-
49
-// @section temperature
50
-
51
-//===========================================================================
52
-//=============================Thermal Settings  ============================
53
-//===========================================================================
54
-
55
-#if DISABLED(PIDTEMPBED)
56
-  #define BED_CHECK_INTERVAL 5000 // ms between checks in bang-bang control
57
-  #if ENABLED(BED_LIMIT_SWITCHING)
58
-    #define BED_HYSTERESIS 2 // Only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
59
-  #endif
60
-#endif
61
-
62
-/**
63
- * Thermal Protection protects your printer from damage and fire if a
64
- * thermistor falls out or temperature sensors fail in any way.
65
- *
66
- * The issue: If a thermistor falls out or a temperature sensor fails,
67
- * Marlin can no longer sense the actual temperature. Since a disconnected
68
- * thermistor reads as a low temperature, the firmware will keep the heater on.
69
- *
70
- * The solution: Once the temperature reaches the target, start observing.
71
- * If the temperature stays too far below the target (hysteresis) for too long (period),
72
- * the firmware will halt the machine as a safety precaution.
73
- *
74
- * If you get false positives for "Thermal Runaway" increase THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
75
- */
76
-#if ENABLED(THERMAL_PROTECTION_HOTENDS)
77
-  #define THERMAL_PROTECTION_PERIOD 40        // Seconds
78
-  #define THERMAL_PROTECTION_HYSTERESIS 4     // Degrees Celsius
79
-
80
-  /**
81
-   * Whenever an M104 or M109 increases the target temperature the firmware will wait for the
82
-   * WATCH_TEMP_PERIOD to expire, and if the temperature hasn't increased by WATCH_TEMP_INCREASE
83
-   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
84
-   * but only if the current temperature is far enough below the target for a reliable test.
85
-   *
86
-   * If you get false positives for "Heating failed" increase WATCH_TEMP_PERIOD and/or decrease WATCH_TEMP_INCREASE
87
-   * WATCH_TEMP_INCREASE should not be below 2.
88
-   */
89
-  #define WATCH_TEMP_PERIOD 20                // Seconds
90
-  #define WATCH_TEMP_INCREASE 2               // Degrees Celsius
91
-#endif
92
-
93
-/**
94
- * Thermal Protection parameters for the bed are just as above for hotends.
95
- */
96
-#if ENABLED(THERMAL_PROTECTION_BED)
97
-  #define THERMAL_PROTECTION_BED_PERIOD 120   // Seconds
98
-  #define THERMAL_PROTECTION_BED_HYSTERESIS 4 // Degrees Celsius
99
-
100
-  /**
101
-   * Whenever an M140 or M190 increases the target temperature the firmware will wait for the
102
-   * WATCH_BED_TEMP_PERIOD to expire, and if the temperature hasn't increased by WATCH_BED_TEMP_INCREASE
103
-   * degrees, the machine is halted, requiring a hard reset. This test restarts with any M140/M190,
104
-   * but only if the current temperature is far enough below the target for a reliable test.
105
-   *
106
-   * If you get too many "Heating failed" errors, increase WATCH_BED_TEMP_PERIOD and/or decrease
107
-   * WATCH_BED_TEMP_INCREASE. (WATCH_BED_TEMP_INCREASE should not be below 2.)
108
-   */
109
-  #define WATCH_BED_TEMP_PERIOD 60                // Seconds
110
-  #define WATCH_BED_TEMP_INCREASE 2               // Degrees Celsius
111
-#endif
112
-
113
-#if ENABLED(PIDTEMP)
114
-  // this adds an experimental additional term to the heating power, proportional to the extrusion speed.
115
-  // if Kc is chosen well, the additional required power due to increased melting should be compensated.
116
-  //#define PID_EXTRUSION_SCALING
117
-  #if ENABLED(PID_EXTRUSION_SCALING)
118
-    #define DEFAULT_Kc (100) //heating power=Kc*(e_speed)
119
-    #define LPQ_MAX_LEN 50
120
-  #endif
121
-#endif
122
-
123
-/**
124
- * Automatic Temperature:
125
- * The hotend target temperature is calculated by all the buffered lines of gcode.
126
- * The maximum buffered steps/sec of the extruder motor is called "se".
127
- * Start autotemp mode with M109 S<mintemp> B<maxtemp> F<factor>
128
- * The target temperature is set to mintemp+factor*se[steps/sec] and is limited by
129
- * mintemp and maxtemp. Turn this off by executing M109 without F*
130
- * Also, if the temperature is set to a value below mintemp, it will not be changed by autotemp.
131
- * On an Ultimaker, some initial testing worked with M109 S215 B260 F1 in the start.gcode
132
- */
133
-#define AUTOTEMP
134
-#if ENABLED(AUTOTEMP)
135
-  #define AUTOTEMP_OLDWEIGHT 0.98
136
-#endif
137
-
138
-//Show Temperature ADC value
139
-//The M105 command return, besides traditional information, the ADC value read from temperature sensors.
140
-//#define SHOW_TEMP_ADC_VALUES
141
-
142
-/**
143
- * High Temperature Thermistor Support
144
- *
145
- * Thermistors able to support high temperature tend to have a hard time getting
146
- * good readings at room and lower temperatures. This means HEATER_X_RAW_LO_TEMP
147
- * will probably be caught when the heating element first turns on during the
148
- * preheating process, which will trigger a min_temp_error as a safety measure
149
- * and force stop everything.
150
- * To circumvent this limitation, we allow for a preheat time (during which,
151
- * min_temp_error won't be triggered) and add a min_temp buffer to handle
152
- * aberrant readings.
153
- *
154
- * If you want to enable this feature for your hotend thermistor(s)
155
- * uncomment and set values > 0 in the constants below
156
- */
157
-
158
-// The number of consecutive low temperature errors that can occur
159
-// before a min_temp_error is triggered. (Shouldn't be more than 10.)
160
-//#define MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED 0
161
-
162
-// The number of milliseconds a hotend will preheat before starting to check
163
-// the temperature. This value should NOT be set to the time it takes the
164
-// hot end to reach the target temperature, but the time it takes to reach
165
-// the minimum temperature your thermistor can read. The lower the better/safer.
166
-// This shouldn't need to be more than 30 seconds (30000)
167
-//#define MILLISECONDS_PREHEAT_TIME 0
168
-
169
-// @section extruder
170
-
171
-//  extruder run-out prevention.
172
-//if the machine is idle, and the temperature over MINTEMP, every couple of SECONDS some filament is extruded
173
-//#define EXTRUDER_RUNOUT_PREVENT
174
-#define EXTRUDER_RUNOUT_MINTEMP 190
175
-#define EXTRUDER_RUNOUT_SECONDS 30
176
-#define EXTRUDER_RUNOUT_ESTEPS 14   // mm filament
177
-#define EXTRUDER_RUNOUT_SPEED 1500  // extrusion speed
178
-#define EXTRUDER_RUNOUT_EXTRUDE 100
179
-
180
-// @section temperature
181
-
182
-//These defines help to calibrate the AD595 sensor in case you get wrong temperature measurements.
183
-//The measured temperature is defined as "actualTemp = (measuredTemp * TEMP_SENSOR_AD595_GAIN) + TEMP_SENSOR_AD595_OFFSET"
184
-#define TEMP_SENSOR_AD595_OFFSET 0.0
185
-#define TEMP_SENSOR_AD595_GAIN   1.0
186
-
187
-//This is for controlling a fan to cool down the stepper drivers
188
-//it will turn on when any driver is enabled
189
-//and turn off after the set amount of seconds from last driver being disabled again
190
-#define CONTROLLERFAN_PIN -1 //Pin used for the fan to cool controller (-1 to disable)
191
-#define CONTROLLERFAN_SECS 60 //How many seconds, after all motors were disabled, the fan should run
192
-#define CONTROLLERFAN_SPEED 255  // == full speed
193
-
194
-// When first starting the main fan, run it at full speed for the
195
-// given number of milliseconds.  This gets the fan spinning reliably
196
-// before setting a PWM value. (Does not work with software PWM for fan on Sanguinololu)
197
-//#define FAN_KICKSTART_TIME 100
198
-
199
-// This defines the minimal speed for the main fan, run in PWM mode
200
-// to enable uncomment and set minimal PWM speed for reliable running (1-255)
201
-// if fan speed is [1 - (FAN_MIN_PWM-1)] it is set to FAN_MIN_PWM
202
-//#define FAN_MIN_PWM 50
203
-
204
-// @section extruder
205
-
206
-// Extruder cooling fans
207
-// Configure fan pin outputs to automatically turn on/off when the associated
208
-// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
209
-// Multiple extruders can be assigned to the same pin in which case
210
-// the fan will turn on when any selected extruder is above the threshold.
211
-#define EXTRUDER_0_AUTO_FAN_PIN -1
212
-#define EXTRUDER_1_AUTO_FAN_PIN -1
213
-#define EXTRUDER_2_AUTO_FAN_PIN -1
214
-#define EXTRUDER_3_AUTO_FAN_PIN -1
215
-#define EXTRUDER_AUTO_FAN_TEMPERATURE 50
216
-#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed
217
-
218
-//===========================================================================
219
-//============================ Mechanical Settings ==========================
220
-//===========================================================================
221
-
222
-// @section homing
223
-
224
-// If you want endstops to stay on (by default) even when not homing
225
-// enable this option. Override at any time with M120, M121.
226
-//#define ENDSTOPS_ALWAYS_ON_DEFAULT
227
-
228
-// @section extras
229
-
230
-//#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
231
-
232
-// Dual X Steppers
233
-// Uncomment this option to drive two X axis motors.
234
-// The next unused E driver will be assigned to the second X stepper.
235
-//#define X_DUAL_STEPPER_DRIVERS
236
-#if ENABLED(X_DUAL_STEPPER_DRIVERS)
237
-  // Set true if the two X motors need to rotate in opposite directions
238
-  #define INVERT_X2_VS_X_DIR true
239
-#endif
240
-
241
-
242
-// Dual Y Steppers
243
-// Uncomment this option to drive two Y axis motors.
244
-// The next unused E driver will be assigned to the second Y stepper.
245
-//#define Y_DUAL_STEPPER_DRIVERS
246
-#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
247
-  // Set true if the two Y motors need to rotate in opposite directions
248
-  #define INVERT_Y2_VS_Y_DIR true
249
-#endif
250
-
251
-// A single Z stepper driver is usually used to drive 2 stepper motors.
252
-// Uncomment this option to use a separate stepper driver for each Z axis motor.
253
-// The next unused E driver will be assigned to the second Z stepper.
254
-//#define Z_DUAL_STEPPER_DRIVERS
255
-
256
-#if ENABLED(Z_DUAL_STEPPER_DRIVERS)
257
-
258
-  // Z_DUAL_ENDSTOPS is a feature to enable the use of 2 endstops for both Z steppers - Let's call them Z stepper and Z2 stepper.
259
-  // That way the machine is capable to align the bed during home, since both Z steppers are homed.
260
-  // There is also an implementation of M666 (software endstops adjustment) to this feature.
261
-  // After Z homing, this adjustment is applied to just one of the steppers in order to align the bed.
262
-  // One just need to home the Z axis and measure the distance difference between both Z axis and apply the math: Z adjust = Z - Z2.
263
-  // If the Z stepper axis is closer to the bed, the measure Z > Z2 (yes, it is.. think about it) and the Z adjust would be positive.
264
-  // Play a little bit with small adjustments (0.5mm) and check the behaviour.
265
-  // The M119 (endstops report) will start reporting the Z2 Endstop as well.
266
-
267
-  //#define Z_DUAL_ENDSTOPS
268
-
269
-  #if ENABLED(Z_DUAL_ENDSTOPS)
270
-    #define Z2_USE_ENDSTOP _XMAX_
271
-  #endif
272
-
273
-#endif // Z_DUAL_STEPPER_DRIVERS
274
-
275
-// Enable this for dual x-carriage printers.
276
-// A dual x-carriage design has the advantage that the inactive extruder can be parked which
277
-// prevents hot-end ooze contaminating the print. It also reduces the weight of each x-carriage
278
-// allowing faster printing speeds. Connect your X2 stepper to the first unused E plug.
279
-//#define DUAL_X_CARRIAGE
280
-#if ENABLED(DUAL_X_CARRIAGE)
281
-  // Configuration for second X-carriage
282
-  // Note: the first x-carriage is defined as the x-carriage which homes to the minimum endstop;
283
-  // the second x-carriage always homes to the maximum endstop.
284
-  #define X2_MIN_POS 80     // set minimum to ensure second x-carriage doesn't hit the parked first X-carriage
285
-  #define X2_MAX_POS 353    // set maximum to the distance between toolheads when both heads are homed
286
-  #define X2_HOME_DIR 1     // the second X-carriage always homes to the maximum endstop position
287
-  #define X2_HOME_POS X2_MAX_POS // default home position is the maximum carriage position
288
-      // However: In this mode the HOTEND_OFFSET_X value for the second extruder provides a software
289
-      // override for X2_HOME_POS. This also allow recalibration of the distance between the two endstops
290
-      // without modifying the firmware (through the "M218 T1 X???" command).
291
-      // Remember: you should set the second extruder x-offset to 0 in your slicer.
292
-
293
-  // There are a few selectable movement modes for dual x-carriages using M605 S<mode>
294
-  //    Mode 0: Full control. The slicer has full control over both x-carriages and can achieve optimal travel results
295
-  //                           as long as it supports dual x-carriages. (M605 S0)
296
-  //    Mode 1: Auto-park mode. The firmware will automatically park and unpark the x-carriages on tool changes so
297
-  //                           that additional slicer support is not required. (M605 S1)
298
-  //    Mode 2: Duplication mode. The firmware will transparently make the second x-carriage and extruder copy all
299
-  //                           actions of the first x-carriage. This allows the printer to print 2 arbitrary items at
300
-  //                           once. (2nd extruder x offset and temp offset are set using: M605 S2 [Xnnn] [Rmmm])
301
-
302
-  // This is the default power-up mode which can be later using M605.
303
-  #define DEFAULT_DUAL_X_CARRIAGE_MODE 0
304
-
305
-  // Default settings in "Auto-park Mode"
306
-  #define TOOLCHANGE_PARK_ZLIFT   0.2      // the distance to raise Z axis when parking an extruder
307
-  #define TOOLCHANGE_UNPARK_ZLIFT 1        // the distance to raise Z axis when unparking an extruder
308
-
309
-  // Default x offset in duplication mode (typically set to half print bed width)
310
-  #define DEFAULT_DUPLICATION_X_OFFSET 100
311
-
312
-#endif //DUAL_X_CARRIAGE
313
-
314
-// @section homing
315
-
316
-//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
317
-#define X_HOME_BUMP_MM 5
318
-#define Y_HOME_BUMP_MM 5
319
-#define Z_HOME_BUMP_MM 5 // deltas need the same for all three axis
320
-#define HOMING_BUMP_DIVISOR {10, 10, 10}  // Re-Bump Speed Divisor (Divides the Homing Feedrate)
321
-//#define QUICK_HOME  //if this is defined, if both x and y are to be homed, a diagonal move will be performed initially.
322
-
323
-// When G28 is called, this option will make Y home before X
324
-//#define HOME_Y_BEFORE_X
325
-
326
-// @section machine
327
-
328
-#define AXIS_RELATIVE_MODES {false, false, false, false}
329
-
330
-// Allow duplication mode with a basic dual-nozzle extruder
331
-//#define DUAL_NOZZLE_DUPLICATION_MODE
332
-
333
-// By default pololu step drivers require an active high signal. However, some high power drivers require an active low signal as step.
334
-#define INVERT_X_STEP_PIN false
335
-#define INVERT_Y_STEP_PIN false
336
-#define INVERT_Z_STEP_PIN false
337
-#define INVERT_E_STEP_PIN false
338
-
339
-// Default stepper release if idle. Set to 0 to deactivate.
340
-// Steppers will shut down DEFAULT_STEPPER_DEACTIVE_TIME seconds after the last move when DISABLE_INACTIVE_? is true.
341
-// Time can be set by M18 and M84.
342
-#define DEFAULT_STEPPER_DEACTIVE_TIME 0
343
-#define DISABLE_INACTIVE_X true
344
-#define DISABLE_INACTIVE_Y true
345
-#define DISABLE_INACTIVE_Z true  // set to false if the nozzle will fall down on your printed part when print has finished.
346
-#define DISABLE_INACTIVE_E true
347
-
348
-#define DEFAULT_MINIMUMFEEDRATE       0.0     // minimum feedrate
349
-#define DEFAULT_MINTRAVELFEEDRATE     0.0
350
-
351
-// @section lcd
352
-
353
-#if ENABLED(ULTIPANEL)
354
-  #define MANUAL_FEEDRATE_XYZ 50*60
355
-  #define MANUAL_FEEDRATE { MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, MANUAL_FEEDRATE_XYZ, 60 } // Feedrates for manual moves along X, Y, Z, E from panel
356
-  #define ULTIPANEL_FEEDMULTIPLY  // Comment to disable setting feedrate multiplier via encoder
357
-#endif
358
-
359
-// @section extras
360
-
361
-// minimum time in microseconds that a movement needs to take if the buffer is emptied.
362
-#define DEFAULT_MINSEGMENTTIME        20000
363
-
364
-// If defined the movements slow down when the look ahead buffer is only half full
365
-// (don't use SLOWDOWN with DELTA because DELTA generates hundreds of segments per second)
366
-//#define SLOWDOWN
367
-
368
-// Frequency limit
369
-// See nophead's blog for more info
370
-// Not working O
371
-//#define XY_FREQUENCY_LIMIT  15
372
-
373
-// Minimum planner junction speed. Sets the default minimum speed the planner plans for at the end
374
-// of the buffer and all stops. This should not be much greater than zero and should only be changed
375
-// if unwanted behavior is observed on a user's machine when running at very slow speeds.
376
-#define MINIMUM_PLANNER_SPEED 0.05// (mm/sec)
377
-
378
-// Microstep setting (Only functional when stepper driver microstep pins are connected to MCU.
379
-#define MICROSTEP_MODES {16,16,16,16,16} // [1,2,4,8,16]
380
-
381
-// Motor Current setting (Only functional when motor driver current ref pins are connected to a digital trimpot on supported boards)
382
-#define DIGIPOT_MOTOR_CURRENT {135,135,135,135,135} // Values 0-255 (RAMBO 135 = ~0.75A, 185 = ~1A)
383
-
384
-// Motor Current controlled via PWM (Overridable on supported boards with PWM-driven motor driver current)
385
-//#define PWM_MOTOR_CURRENT {1300, 1300, 1250} // Values in milliamps
386
-
387
-// uncomment to enable an I2C based DIGIPOT like on the Azteeg X3 Pro
388
-//#define DIGIPOT_I2C
389
-// Number of channels available for I2C digipot, For Azteeg X3 Pro we have 8
390
-#define DIGIPOT_I2C_NUM_CHANNELS 8
391
-// actual motor currents in Amps, need as many here as DIGIPOT_I2C_NUM_CHANNELS
392
-#define DIGIPOT_I2C_MOTOR_CURRENTS {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}
393
-
394
-//===========================================================================
395
-//=============================Additional Features===========================
396
-//===========================================================================
397
-
398
-#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
399
-#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceeds this value, multiply steps moved x10 to quickly advance the value
400
-#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceeds this value, multiply steps moved x100 to really quickly advance the value
401
-
402
-//#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
403
-#define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
404
-
405
-// @section lcd
406
-
407
-// Include a page of printer information in the LCD Main Menu
408
-//#define LCD_INFO_MENU
409
-
410
-#if ENABLED(SDSUPPORT)
411
-
412
-  // Some RAMPS and other boards don't detect when an SD card is inserted. You can work
413
-  // around this by connecting a push button or single throw switch to the pin defined
414
-  // as SD_DETECT_PIN in your board's pins definitions.
415
-  // This setting should be disabled unless you are using a push button, pulling the pin to ground.
416
-  // Note: This is always disabled for ULTIPANEL (except ELB_FULL_GRAPHIC_CONTROLLER).
417
-  #define SD_DETECT_INVERTED
418
-
419
-  #define SD_FINISHED_STEPPERRELEASE true  //if sd support and the file is finished: disable steppers?
420
-  #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the z enabled so your bed stays in place.
421
-
422
-  #define SDCARD_RATHERRECENTFIRST  //reverse file order of sd card menu display. Its sorted practically after the file system block order.
423
-  // if a file is deleted, it frees a block. hence, the order is not purely chronological. To still have auto0.g accessible, there is again the option to do that.
424
-  // using:
425
-  //#define MENU_ADDAUTOSTART
426
-
427
-  // Show a progress bar on HD44780 LCDs for SD printing
428
-  //#define LCD_PROGRESS_BAR
429
-
430
-  #if ENABLED(LCD_PROGRESS_BAR)
431
-    // Amount of time (ms) to show the bar
432
-    #define PROGRESS_BAR_BAR_TIME 2000
433
-    // Amount of time (ms) to show the status message
434
-    #define PROGRESS_BAR_MSG_TIME 3000
435
-    // Amount of time (ms) to retain the status message (0=forever)
436
-    #define PROGRESS_MSG_EXPIRE   0
437
-    // Enable this to show messages for MSG_TIME then hide them
438
-    //#define PROGRESS_MSG_ONCE
439
-  #endif
440
-
441
-  // This allows hosts to request long names for files and folders with M33
442
-  //#define LONG_FILENAME_HOST_SUPPORT
443
-
444
-  // This option allows you to abort SD printing when any endstop is triggered.
445
-  // This feature must be enabled with "M540 S1" or from the LCD menu.
446
-  // To have any effect, endstops must be enabled during SD printing.
447
-  //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
448
-
449
-#endif // SDSUPPORT
450
-
451
-// for dogm lcd displays you can choose some additional fonts:
452
-#if ENABLED(DOGLCD)
453
-  // save 3120 bytes of PROGMEM by commenting out #define USE_BIG_EDIT_FONT
454
-  // we don't have a big font for Cyrillic, Kana
455
-  //#define USE_BIG_EDIT_FONT
456
-
457
-  // If you have spare 2300Byte of progmem and want to use a
458
-  // smaller font on the Info-screen uncomment the next line.
459
-  //#define USE_SMALL_INFOFONT
460
-#endif // DOGLCD
461
-
462
-// @section safety
463
-
464
-// The hardware watchdog should reset the microcontroller disabling all outputs,
465
-// in case the firmware gets stuck and doesn't do temperature regulation.
466
-#define USE_WATCHDOG
467
-
468
-#if ENABLED(USE_WATCHDOG)
469
-  // If you have a watchdog reboot in an ArduinoMega2560 then the device will hang forever, as a watchdog reset will leave the watchdog on.
470
-  // The "WATCHDOG_RESET_MANUAL" goes around this by not using the hardware reset.
471
-  //  However, THIS FEATURE IS UNSAFE!, as it will only work if interrupts are disabled. And the code could hang in an interrupt routine with interrupts disabled.
472
-  //#define WATCHDOG_RESET_MANUAL
473
-#endif
474
-
475
-// @section lcd
476
-
477
-// Babystepping enables the user to control the axis in tiny amounts, independently from the normal printing process
478
-// it can e.g. be used to change z-positions in the print startup phase in real-time
479
-// does not respect endstops!
480
-//#define BABYSTEPPING
481
-#if ENABLED(BABYSTEPPING)
482
-  #define BABYSTEP_XY  //not only z, but also XY in the menu. more clutter, more functions
483
-                       //not implemented for deltabots!
484
-  #define BABYSTEP_INVERT_Z false  //true for inverse movements in Z
485
-  #define BABYSTEP_MULTIPLICATOR 1 //faster movements
486
-#endif
487
-
488
-// @section extruder
489
-
490
-// extruder advance constant (s2/mm3)
491
-//
492
-// advance (steps) = STEPS_PER_CUBIC_MM_E * EXTRUDER_ADVANCE_K * cubic mm per second ^ 2
493
-//
494
-// Hooke's law says:    force = k * distance
495
-// Bernoulli's principle says:  v ^ 2 / 2 + g . h + pressure / density = constant
496
-// so: v ^ 2 is proportional to number of steps we advance the extruder
497
-//#define ADVANCE
498
-
499
-#if ENABLED(ADVANCE)
500
-  #define EXTRUDER_ADVANCE_K .0
501
-  #define D_FILAMENT 2.85
502
-#endif
503
-
504
-// Implementation of a linear pressure control
505
-// Assumption: advance = k * (delta velocity)
506
-// K=0 means advance disabled. A good value for a gregs wade extruder will be around K=75
507
-//#define LIN_ADVANCE
508
-
509
-#if ENABLED(LIN_ADVANCE)
510
-  #define LIN_ADVANCE_K 75
511
-#endif
512
-
513
-// @section leveling
514
-
515
-// Default mesh area is an area with an inset margin on the print area.
516
-// Below are the macros that are used to define the borders for the mesh area,
517
-// made available here for specialized needs, ie dual extruder setup.
518
-#if ENABLED(MESH_BED_LEVELING)
519
-  #define MESH_MIN_X (X_MIN_POS + MESH_INSET)
520
-  #define MESH_MAX_X (X_MAX_POS - (MESH_INSET))
521
-  #define MESH_MIN_Y (Y_MIN_POS + MESH_INSET)
522
-  #define MESH_MAX_Y (Y_MAX_POS - (MESH_INSET))
523
-#endif
524
-
525
-// @section extras
526
-
527
-// Arc interpretation settings:
528
-#define ARC_SUPPORT  // Disabling this saves ~2738 bytes
529
-#define MM_PER_ARC_SEGMENT 1
530
-#define N_ARC_CORRECTION 25
531
-
532
-// Support for G5 with XYZE destination and IJPQ offsets. Requires ~2666 bytes.
533
-//#define BEZIER_CURVE_SUPPORT
534
-
535
-const unsigned int dropsegments = 5; //everything with less than this number of steps will be ignored as move and joined with the next movement
536
-
537
-// @section temperature
538
-
539
-// Control heater 0 and heater 1 in parallel.
540
-//#define HEATERS_PARALLEL
541
-
542
-//===========================================================================
543
-//================================= Buffers =================================
544
-//===========================================================================
545
-
546
-// @section hidden
547
-
548
-// The number of linear motions that can be in the plan at any give time.
549
-// THE BLOCK_BUFFER_SIZE NEEDS TO BE A POWER OF 2, i.g. 8,16,32 because shifts and ors are used to do the ring-buffering.
550
-#if ENABLED(SDSUPPORT)
551
-  #define BLOCK_BUFFER_SIZE 16   // SD,LCD,Buttons take more memory, block buffer needs to be smaller
552
-#else
553
-  #define BLOCK_BUFFER_SIZE 16 // maximize block buffer
554
-#endif
555
-
556
-// @section serial
557
-
558
-// The ASCII buffer for serial input
559
-#define MAX_CMD_SIZE 96
560
-#define BUFSIZE 4
561
-
562
-// Transfer Buffer Size
563
-// To save 386 bytes of PROGMEM (and TX_BUFFER_SIZE+3 bytes of RAM) set to 0.
564
-// To buffer a simple "ok" you need 4 bytes.
565
-// For ADVANCED_OK (M105) you need 32 bytes.
566
-// For debug-echo: 128 bytes for the optimal speed.
567
-// Other output doesn't need to be that speedy.
568
-// :[0,2,4,8,16,32,64,128,256]
569
-#define TX_BUFFER_SIZE 0
570
-
571
-// Enable an emergency-command parser to intercept certain commands as they
572
-// enter the serial receive buffer, so they cannot be blocked.
573
-// Currently handles M108, M112, M410
574
-// Does not work on boards using AT90USB (USBCON) processors!
575
-//#define EMERGENCY_PARSER
576
-
577
-// Bad Serial-connections can miss a received command by sending an 'ok'
578
-// Therefore some clients abort after 30 seconds in a timeout.
579
-// Some other clients start sending commands while receiving a 'wait'.
580
-// This "wait" is only sent when the buffer is empty. 1 second is a good value here.
581
-//#define NO_TIMEOUTS 1000 // Milliseconds
582
-
583
-// Some clients will have this feature soon. This could make the NO_TIMEOUTS unnecessary.
584
-//#define ADVANCED_OK
585
-
586
-// @section fwretract
587
-
588
-// Firmware based and LCD controlled retract
589
-// M207 and M208 can be used to define parameters for the retraction.
590
-// The retraction can be called by the slicer using G10 and G11
591
-// until then, intended retractions can be detected by moves that only extrude and the direction.
592
-// the moves are than replaced by the firmware controlled ones.
593
-
594
-#define FWRETRACT  //ONLY PARTIALLY TESTED
595
-#if ENABLED(FWRETRACT)
596
-  #define MIN_RETRACT 0.1                //minimum extruded mm to accept a automatic gcode retraction attempt
597
-  #define RETRACT_LENGTH 5               //default retract length (positive mm)
598
-  #define RETRACT_LENGTH_SWAP 13         //default swap retract length (positive mm), for extruder change
599
-  #define RETRACT_FEEDRATE 100           //default feedrate for retracting (mm/s)
600
-  #define RETRACT_ZLIFT 0                //default retract Z-lift
601
-  #define RETRACT_RECOVER_LENGTH 0       //default additional recover length (mm, added to retract length when recovering)
602
-  #define RETRACT_RECOVER_LENGTH_SWAP 0  //default additional swap recover length (mm, added to retract length when recovering from extruder change)
603
-  #define RETRACT_RECOVER_FEEDRATE 100   //default feedrate for recovering from retraction (mm/s)
604
-#endif
605
-
606
-// Add support for experimental filament exchange support M600; requires display
607
-#if ENABLED(ULTIPANEL)
608
-  // #define FILAMENT_CHANGE_FEATURE             // Enable filament exchange menu and M600 g-code (used for runout sensor too)
609
-  #if ENABLED(FILAMENT_CHANGE_FEATURE)
610
-    #define FILAMENT_CHANGE_X_POS 3             // X position of hotend
611
-    #define FILAMENT_CHANGE_Y_POS 3             // Y position of hotend
612
-    #define FILAMENT_CHANGE_Z_ADD 10            // Z addition of hotend (lift)
613
-    #define FILAMENT_CHANGE_XY_FEEDRATE 100     // X and Y axes feedrate in mm/s (also used for delta printers Z axis)
614
-    #define FILAMENT_CHANGE_Z_FEEDRATE 5        // Z axis feedrate in mm/s (not used for delta printers)
615
-    #define FILAMENT_CHANGE_RETRACT_LENGTH 2    // Initial retract in mm
616
-                                                // It is a short retract used immediately after print interrupt before move to filament exchange position
617
-    #define FILAMENT_CHANGE_RETRACT_FEEDRATE 60 // Initial retract feedrate in mm/s
618
-    #define FILAMENT_CHANGE_UNLOAD_LENGTH 100   // Unload filament length from hotend in mm
619
-                                                // Longer length for bowden printers to unload filament from whole bowden tube,
620
-                                                // shorter lenght for printers without bowden to unload filament from extruder only,
621
-                                                // 0 to disable unloading for manual unloading
622
-    #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10  // Unload filament feedrate in mm/s - filament unloading can be fast
623
-    #define FILAMENT_CHANGE_LOAD_LENGTH 0       // Load filament length over hotend in mm
624
-                                                // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend,
625
-                                                // Short or zero length for printers without bowden where loading is not used
626
-    #define FILAMENT_CHANGE_LOAD_FEEDRATE 10    // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast
627
-    #define FILAMENT_CHANGE_EXTRUDE_LENGTH 50   // Extrude filament length in mm after filament is load over the hotend,
628
-                                                // 0 to disable for manual extrusion
629
-                                                // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend,
630
-                                                // or until outcoming filament color is not clear for filament color change
631
-    #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3  // Extrude filament feedrate in mm/s - must be slower than load feedrate
632
-  #endif
633
-#endif
634
-
635
-/******************************************************************************\
636
- * enable this section if you have TMC26X motor drivers.
637
- * you need to import the TMC26XStepper library into the Arduino IDE for this
638
- ******************************************************************************/
639
-
640
-// @section tmc
641
-
642
-//#define HAVE_TMCDRIVER
643
-#if ENABLED(HAVE_TMCDRIVER)
644
-
645
-  //#define X_IS_TMC
646
-  #define X_MAX_CURRENT 1000  //in mA
647
-  #define X_SENSE_RESISTOR 91 //in mOhms
648
-  #define X_MICROSTEPS 16     //number of microsteps
649
-
650
-  //#define X2_IS_TMC
651
-  #define X2_MAX_CURRENT 1000  //in mA
652
-  #define X2_SENSE_RESISTOR 91 //in mOhms
653
-  #define X2_MICROSTEPS 16     //number of microsteps
654
-
655
-  //#define Y_IS_TMC
656
-  #define Y_MAX_CURRENT 1000  //in mA
657
-  #define Y_SENSE_RESISTOR 91 //in mOhms
658
-  #define Y_MICROSTEPS 16     //number of microsteps
659
-
660
-  //#define Y2_IS_TMC
661
-  #define Y2_MAX_CURRENT 1000  //in mA
662
-  #define Y2_SENSE_RESISTOR 91 //in mOhms
663
-  #define Y2_MICROSTEPS 16     //number of microsteps
664
-
665
-  //#define Z_IS_TMC
666
-  #define Z_MAX_CURRENT 1000  //in mA
667
-  #define Z_SENSE_RESISTOR 91 //in mOhms
668
-  #define Z_MICROSTEPS 16     //number of microsteps
669
-
670
-  //#define Z2_IS_TMC
671
-  #define Z2_MAX_CURRENT 1000  //in mA
672
-  #define Z2_SENSE_RESISTOR 91 //in mOhms
673
-  #define Z2_MICROSTEPS 16     //number of microsteps
674
-
675
-  //#define E0_IS_TMC
676
-  #define E0_MAX_CURRENT 1000  //in mA
677
-  #define E0_SENSE_RESISTOR 91 //in mOhms
678
-  #define E0_MICROSTEPS 16     //number of microsteps
679
-
680
-  //#define E1_IS_TMC
681
-  #define E1_MAX_CURRENT 1000  //in mA
682
-  #define E1_SENSE_RESISTOR 91 //in mOhms
683
-  #define E1_MICROSTEPS 16     //number of microsteps
684
-
685
-  //#define E2_IS_TMC
686
-  #define E2_MAX_CURRENT 1000  //in mA
687
-  #define E2_SENSE_RESISTOR 91 //in mOhms
688
-  #define E2_MICROSTEPS 16     //number of microsteps
689
-
690
-  //#define E3_IS_TMC
691
-  #define E3_MAX_CURRENT 1000  //in mA
692
-  #define E3_SENSE_RESISTOR 91 //in mOhms
693
-  #define E3_MICROSTEPS 16     //number of microsteps
694
-
695
-#endif
696
-
697
-/******************************************************************************\
698
- * enable this section if you have L6470  motor drivers.
699
- * you need to import the L6470 library into the Arduino IDE for this
700
- ******************************************************************************/
701
-
702
-// @section l6470
703
-
704
-//#define HAVE_L6470DRIVER
705
-#if ENABLED(HAVE_L6470DRIVER)
706
-
707
-  //#define X_IS_L6470
708
-  #define X_MICROSTEPS 16     //number of microsteps
709
-  #define X_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
710
-  #define X_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
711
-  #define X_STALLCURRENT 1500 //current in mA where the driver will detect a stall
712
-
713
-  //#define X2_IS_L6470
714
-  #define X2_MICROSTEPS 16     //number of microsteps
715
-  #define X2_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
716
-  #define X2_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
717
-  #define X2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
718
-
719
-  //#define Y_IS_L6470
720
-  #define Y_MICROSTEPS 16     //number of microsteps
721
-  #define Y_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
722
-  #define Y_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
723
-  #define Y_STALLCURRENT 1500 //current in mA where the driver will detect a stall
724
-
725
-  //#define Y2_IS_L6470
726
-  #define Y2_MICROSTEPS 16     //number of microsteps
727
-  #define Y2_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
728
-  #define Y2_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
729
-  #define Y2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
730
-
731
-  //#define Z_IS_L6470
732
-  #define Z_MICROSTEPS 16     //number of microsteps
733
-  #define Z_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
734
-  #define Z_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
735
-  #define Z_STALLCURRENT 1500 //current in mA where the driver will detect a stall
736
-
737
-  //#define Z2_IS_L6470
738
-  #define Z2_MICROSTEPS 16     //number of microsteps
739
-  #define Z2_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
740
-  #define Z2_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
741
-  #define Z2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
742
-
743
-  //#define E0_IS_L6470
744
-  #define E0_MICROSTEPS 16     //number of microsteps
745
-  #define E0_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
746
-  #define E0_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
747
-  #define E0_STALLCURRENT 1500 //current in mA where the driver will detect a stall
748
-
749
-  //#define E1_IS_L6470
750
-  #define E1_MICROSTEPS 16     //number of microsteps
751
-  #define E1_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
752
-  #define E1_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
753
-  #define E1_STALLCURRENT 1500 //current in mA where the driver will detect a stall
754
-
755
-  //#define E2_IS_L6470
756
-  #define E2_MICROSTEPS 16     //number of microsteps
757
-  #define E2_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
758
-  #define E2_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
759
-  #define E2_STALLCURRENT 1500 //current in mA where the driver will detect a stall
760
-
761
-  //#define E3_IS_L6470
762
-  #define E3_MICROSTEPS 16     //number of microsteps
763
-  #define E3_K_VAL 50          // 0 - 255, Higher values, are higher power. Be careful not to go too high
764
-  #define E3_OVERCURRENT 2000  //maxc current in mA. If the current goes over this value, the driver will switch off
765
-  #define E3_STALLCURRENT 1500 //current in mA where the driver will detect a stall
766
-
767
-#endif
768
-
769
-/**
770
- * TWI/I2C BUS
771
- *
772
- * This feature is an EXPERIMENTAL feature so it shall not be used on production
773
- * machines. Enabling this will allow you to send and receive I2C data from slave
774
- * devices on the bus.
775
- *
776
- * ; Example #1
777
- * ; This macro send the string "Marlin" to the slave device with address 0x63 (99)
778
- * ; It uses multiple M155 commands with one B<base 10> arg
779
- * M155 A99  ; Target slave address
780
- * M155 B77  ; M
781
- * M155 B97  ; a
782
- * M155 B114 ; r
783
- * M155 B108 ; l
784
- * M155 B105 ; i
785
- * M155 B110 ; n
786
- * M155 S1   ; Send the current buffer
787
- *
788
- * ; Example #2
789
- * ; Request 6 bytes from slave device with address 0x63 (99)
790
- * M156 A99 B5
791
- *
792
- * ; Example #3
793
- * ; Example serial output of a M156 request
794
- * echo:i2c-reply: from:99 bytes:5 data:hello
795
- */
796
-
797
-// @section i2cbus
798
-
799
-//#define EXPERIMENTAL_I2CBUS
800
-
801
-#endif // CONFIGURATION_ADV_H

+ 799
- 480
Marlin/example_configurations/delta/generic/Configuration.h
Plik diff jest za duży
Wyświetl plik


+ 770
- 215
Marlin/example_configurations/delta/generic/Configuration_adv.h
Plik diff jest za duży
Wyświetl plik


+ 0
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h Wyświetl plik


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików

Ładowanie…
Anuluj
Zapisz