Browse Source

Merge pull request #8156 from thinkyhead/bf1_anet_10_servo

[1.1.x] Define a default SERVO0_PIN for Anet 1.0
Scott Lahteine 7 years ago
parent
commit
9288d80613
No account linked to committer's email address

+ 1
- 1
Marlin/Marlin_main.cpp View File

@@ -8797,7 +8797,7 @@ inline void gcode_M204() {
8797 8797
 inline void gcode_M205() {
8798 8798
   if (parser.seen('S')) planner.min_feedrate_mm_s = parser.value_linear_units();
8799 8799
   if (parser.seen('T')) planner.min_travel_feedrate_mm_s = parser.value_linear_units();
8800
-  if (parser.seen('B')) planner.min_segment_time = parser.value_millis();
8800
+  if (parser.seen('B')) planner.min_segment_time_us = parser.value_ulong();
8801 8801
   if (parser.seen('X')) planner.max_jerk[X_AXIS] = parser.value_linear_units();
8802 8802
   if (parser.seen('Y')) planner.max_jerk[Y_AXIS] = parser.value_linear_units();
8803 8803
   if (parser.seen('Z')) planner.max_jerk[Z_AXIS] = parser.value_linear_units();

+ 6
- 6
Marlin/configuration_store.cpp View File

@@ -56,7 +56,7 @@
56 56
  *  163  M204 T    planner.travel_acceleration      (float)
57 57
  *  167  M205 S    planner.min_feedrate_mm_s        (float)
58 58
  *  171  M205 T    planner.min_travel_feedrate_mm_s (float)
59
- *  175  M205 B    planner.min_segment_time         (ulong)
59
+ *  175  M205 B    planner.min_segment_time_us      (ulong)
60 60
  *  179  M205 X    planner.max_jerk[X_AXIS]         (float)
61 61
  *  183  M205 Y    planner.max_jerk[Y_AXIS]         (float)
62 62
  *  187  M205 Z    planner.max_jerk[Z_AXIS]         (float)
@@ -335,7 +335,7 @@ void MarlinSettings::postprocess() {
335 335
     EEPROM_WRITE(planner.travel_acceleration);
336 336
     EEPROM_WRITE(planner.min_feedrate_mm_s);
337 337
     EEPROM_WRITE(planner.min_travel_feedrate_mm_s);
338
-    EEPROM_WRITE(planner.min_segment_time);
338
+    EEPROM_WRITE(planner.min_segment_time_us);
339 339
     EEPROM_WRITE(planner.max_jerk);
340 340
     #if !HAS_HOME_OFFSET
341 341
       const float home_offset[XYZ] = { 0 };
@@ -749,7 +749,7 @@ void MarlinSettings::postprocess() {
749 749
       EEPROM_READ(planner.travel_acceleration);
750 750
       EEPROM_READ(planner.min_feedrate_mm_s);
751 751
       EEPROM_READ(planner.min_travel_feedrate_mm_s);
752
-      EEPROM_READ(planner.min_segment_time);
752
+      EEPROM_READ(planner.min_segment_time_us);
753 753
       EEPROM_READ(planner.max_jerk);
754 754
 
755 755
       #if !HAS_HOME_OFFSET
@@ -1219,7 +1219,7 @@ void MarlinSettings::reset() {
1219 1219
   planner.retract_acceleration = DEFAULT_RETRACT_ACCELERATION;
1220 1220
   planner.travel_acceleration = DEFAULT_TRAVEL_ACCELERATION;
1221 1221
   planner.min_feedrate_mm_s = DEFAULT_MINIMUMFEEDRATE;
1222
-  planner.min_segment_time = DEFAULT_MINSEGMENTTIME;
1222
+  planner.min_segment_time_us = DEFAULT_MINSEGMENTTIME;
1223 1223
   planner.min_travel_feedrate_mm_s = DEFAULT_MINTRAVELFEEDRATE;
1224 1224
   planner.max_jerk[X_AXIS] = DEFAULT_XJERK;
1225 1225
   planner.max_jerk[Y_AXIS] = DEFAULT_YJERK;
@@ -1585,12 +1585,12 @@ void MarlinSettings::reset() {
1585 1585
 
1586 1586
     if (!forReplay) {
1587 1587
       CONFIG_ECHO_START;
1588
-      SERIAL_ECHOLNPGM("Advanced: S<min_feedrate> T<min_travel_feedrate> B<min_segment_time_ms> X<max_xy_jerk> Z<max_z_jerk> E<max_e_jerk>");
1588
+      SERIAL_ECHOLNPGM("Advanced: S<min_feedrate> T<min_travel_feedrate> B<min_segment_time_us> X<max_xy_jerk> Z<max_z_jerk> E<max_e_jerk>");
1589 1589
     }
1590 1590
     CONFIG_ECHO_START;
1591 1591
     SERIAL_ECHOPAIR("  M205 S", LINEAR_UNIT(planner.min_feedrate_mm_s));
1592 1592
     SERIAL_ECHOPAIR(" T", LINEAR_UNIT(planner.min_travel_feedrate_mm_s));
1593
-    SERIAL_ECHOPAIR(" B", planner.min_segment_time);
1593
+    SERIAL_ECHOPAIR(" B", planner.min_segment_time_us);
1594 1594
     SERIAL_ECHOPAIR(" X", LINEAR_UNIT(planner.max_jerk[X_AXIS]));
1595 1595
     SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.max_jerk[Y_AXIS]));
1596 1596
     SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.max_jerk[Z_AXIS]));

+ 22
- 20
Marlin/pins_ANET_10.h View File

@@ -88,7 +88,7 @@
88 88
  *   Many thanks to Hans Raaf (@oderwat) for developing the Anet-specific software and supporting the Anet community.
89 89
 */
90 90
 
91
-#if !defined(__AVR_ATmega1284P__)
91
+#ifndef __AVR_ATmega1284P__
92 92
   #error "Oops!  Make sure you have 'Anet V1.0', 'Anet V1.0 (Optiboot)' or 'Sanguino' selected from the 'Tools -> Boards' menu."
93 93
 #endif
94 94
 
@@ -155,36 +155,38 @@
155 155
 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
156 156
   #define LCD_SDSS           28
157 157
   #if ENABLED(ADC_KEYPAD)
158
-    #define SERVO0_PIN         27 // free for BLTouch/3D-Touch
159
-    #define LCD_PINS_RS        28
160
-    #define LCD_PINS_ENABLE    29
161
-    #define LCD_PINS_D4        10
162
-    #define LCD_PINS_D5        11
163
-    #define LCD_PINS_D6        16
164
-    #define LCD_PINS_D7        17
165
-    #define BTN_EN1            -1
166
-    #define BTN_EN2            -1
167
-    #define BTN_ENC            -1
168
-    #define ADC_KEYPAD_PIN      1
158
+    #define SERVO0_PIN       27 // free for BLTouch/3D-Touch
159
+    #define LCD_PINS_RS      28
160
+    #define LCD_PINS_ENABLE  29
161
+    #define LCD_PINS_D4      10
162
+    #define LCD_PINS_D5      11
163
+    #define LCD_PINS_D6      16
164
+    #define LCD_PINS_D7      17
165
+    #define BTN_EN1          -1
166
+    #define BTN_EN2          -1
167
+    #define BTN_ENC          -1
168
+    #define ADC_KEYPAD_PIN    1
169 169
     #define ENCODER_FEEDRATE_DEADZONE 2
170 170
   #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(ANET_FULL_GRAPHICS_LCD)
171 171
     // Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics
172 172
     // display using an adapter board  // https://go.aisler.net/benlye/anet-lcd-adapter/pcb
173 173
     // See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748
174
-    #define SERVO0_PIN         29 // free for BLTouch/3D-Touch
175
-    #define BEEPER_PIN         17
176
-    #define LCD_PINS_RS        27
177
-    #define LCD_PINS_ENABLE    28
178
-    #define LCD_PINS_D4        30
179
-    #define BTN_EN1            11
180
-    #define BTN_EN2            10
181
-    #define BTN_ENC            16
174
+    #define SERVO0_PIN       29 // free for BLTouch/3D-Touch
175
+    #define BEEPER_PIN       17
176
+    #define LCD_PINS_RS      27
177
+    #define LCD_PINS_ENABLE  28
178
+    #define LCD_PINS_D4      30
179
+    #define BTN_EN1          11
180
+    #define BTN_EN2          10
181
+    #define BTN_ENC          16
182 182
     #define ST7920_DELAY_1 DELAY_0_NOP
183 183
     #define ST7920_DELAY_2 DELAY_1_NOP
184 184
     #define ST7920_DELAY_3 DELAY_2_NOP
185 185
     #define STD_ENCODER_PULSES_PER_STEP 4
186 186
     #define STD_ENCODER_STEPS_PER_MENU_ITEM 1
187 187
   #endif
188
+#else
189
+  #define SERVO0_PIN         27
188 190
 #endif  // ULTRA_LCD && NEWPANEL
189 191
 
190 192
 /**

+ 25
- 25
Marlin/planner.cpp View File

@@ -94,7 +94,7 @@ float Planner::max_feedrate_mm_s[XYZE_N], // Max speeds in mm per second
94 94
 uint32_t Planner::max_acceleration_steps_per_s2[XYZE_N],
95 95
          Planner::max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
96 96
 
97
-millis_t Planner::min_segment_time;
97
+uint32_t Planner::min_segment_time_us;
98 98
 
99 99
 // Initialized by settings.load()
100 100
 float Planner::min_feedrate_mm_s,
@@ -140,7 +140,7 @@ float Planner::previous_speed[NUM_AXIS],
140 140
   // Old direction bits. Used for speed calculations
141 141
   unsigned char Planner::old_direction_bits = 0;
142 142
   // Segment times (in µs). Used for speed calculations
143
-  long Planner::axis_segment_time[2][3] = { {MAX_FREQ_TIME + 1, 0, 0}, {MAX_FREQ_TIME + 1, 0, 0} };
143
+  uint32_t Planner::axis_segment_time_us[2][3] = { { MAX_FREQ_TIME_US + 1, 0, 0 }, { MAX_FREQ_TIME_US + 1, 0, 0 } };
144 144
 #endif
145 145
 
146 146
 #if ENABLED(LIN_ADVANCE)
@@ -1036,15 +1036,15 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
1036 1036
   // Slow down when the buffer starts to empty, rather than wait at the corner for a buffer refill
1037 1037
   #if ENABLED(SLOWDOWN) || ENABLED(ULTRA_LCD) || defined(XY_FREQUENCY_LIMIT)
1038 1038
     // Segment time im micro seconds
1039
-    unsigned long segment_time = LROUND(1000000.0 / inverse_mm_s);
1039
+    uint32_t segment_time_us = LROUND(1000000.0 / inverse_mm_s);
1040 1040
   #endif
1041 1041
   #if ENABLED(SLOWDOWN)
1042 1042
     if (WITHIN(moves_queued, 2, (BLOCK_BUFFER_SIZE) / 2 - 1)) {
1043
-      if (segment_time < min_segment_time) {
1043
+      if (segment_time_us < min_segment_time_us) {
1044 1044
         // buffer is draining, add extra time.  The amount of time added increases if the buffer is still emptied more.
1045
-        inverse_mm_s = 1000000.0 / (segment_time + LROUND(2 * (min_segment_time - segment_time) / moves_queued));
1045
+        inverse_mm_s = 1000000.0 / (segment_time_us + LROUND(2 * (min_segment_time_us - segment_time_us) / moves_queued));
1046 1046
         #if defined(XY_FREQUENCY_LIMIT) || ENABLED(ULTRA_LCD)
1047
-          segment_time = LROUND(1000000.0 / inverse_mm_s);
1047
+          segment_time_us = LROUND(1000000.0 / inverse_mm_s);
1048 1048
         #endif
1049 1049
       }
1050 1050
     }
@@ -1052,7 +1052,7 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
1052 1052
 
1053 1053
   #if ENABLED(ULTRA_LCD)
1054 1054
     CRITICAL_SECTION_START
1055
-      block_buffer_runtime_us += segment_time;
1055
+      block_buffer_runtime_us += segment_time_us;
1056 1056
     CRITICAL_SECTION_END
1057 1057
   #endif
1058 1058
 
@@ -1109,34 +1109,34 @@ void Planner::_buffer_line(const float &a, const float &b, const float &c, const
1109 1109
     // Check and limit the xy direction change frequency
1110 1110
     const unsigned char direction_change = block->direction_bits ^ old_direction_bits;
1111 1111
     old_direction_bits = block->direction_bits;
1112
-    segment_time = LROUND((float)segment_time / speed_factor);
1112
+    segment_time_us = LROUND((float)segment_time_us / speed_factor);
1113 1113
 
1114
-    long xs0 = axis_segment_time[X_AXIS][0],
1115
-         xs1 = axis_segment_time[X_AXIS][1],
1116
-         xs2 = axis_segment_time[X_AXIS][2],
1117
-         ys0 = axis_segment_time[Y_AXIS][0],
1118
-         ys1 = axis_segment_time[Y_AXIS][1],
1119
-         ys2 = axis_segment_time[Y_AXIS][2];
1114
+    uint32_t xs0 = axis_segment_time_us[X_AXIS][0],
1115
+             xs1 = axis_segment_time_us[X_AXIS][1],
1116
+             xs2 = axis_segment_time_us[X_AXIS][2],
1117
+             ys0 = axis_segment_time_us[Y_AXIS][0],
1118
+             ys1 = axis_segment_time_us[Y_AXIS][1],
1119
+             ys2 = axis_segment_time_us[Y_AXIS][2];
1120 1120
 
1121 1121
     if (TEST(direction_change, X_AXIS)) {
1122
-      xs2 = axis_segment_time[X_AXIS][2] = xs1;
1123
-      xs1 = axis_segment_time[X_AXIS][1] = xs0;
1122
+      xs2 = axis_segment_time_us[X_AXIS][2] = xs1;
1123
+      xs1 = axis_segment_time_us[X_AXIS][1] = xs0;
1124 1124
       xs0 = 0;
1125 1125
     }
1126
-    xs0 = axis_segment_time[X_AXIS][0] = xs0 + segment_time;
1126
+    xs0 = axis_segment_time_us[X_AXIS][0] = xs0 + segment_time_us;
1127 1127
 
1128 1128
     if (TEST(direction_change, Y_AXIS)) {
1129
-      ys2 = axis_segment_time[Y_AXIS][2] = axis_segment_time[Y_AXIS][1];
1130
-      ys1 = axis_segment_time[Y_AXIS][1] = axis_segment_time[Y_AXIS][0];
1129
+      ys2 = axis_segment_time_us[Y_AXIS][2] = axis_segment_time_us[Y_AXIS][1];
1130
+      ys1 = axis_segment_time_us[Y_AXIS][1] = axis_segment_time_us[Y_AXIS][0];
1131 1131
       ys0 = 0;
1132 1132
     }
1133
-    ys0 = axis_segment_time[Y_AXIS][0] = ys0 + segment_time;
1133
+    ys0 = axis_segment_time_us[Y_AXIS][0] = ys0 + segment_time_us;
1134 1134
 
1135
-    const long max_x_segment_time = MAX3(xs0, xs1, xs2),
1136
-               max_y_segment_time = MAX3(ys0, ys1, ys2),
1137
-               min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
1138
-    if (min_xy_segment_time < MAX_FREQ_TIME) {
1139
-      const float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME);
1135
+    const uint32_t max_x_segment_time = MAX3(xs0, xs1, xs2),
1136
+                   max_y_segment_time = MAX3(ys0, ys1, ys2),
1137
+                   min_xy_segment_time = min(max_x_segment_time, max_y_segment_time);
1138
+    if (min_xy_segment_time < MAX_FREQ_TIME_US) {
1139
+      const float low_sf = speed_factor * min_xy_segment_time / (MAX_FREQ_TIME_US);
1140 1140
       NOMORE(speed_factor, low_sf);
1141 1141
     }
1142 1142
   #endif // XY_FREQUENCY_LIMIT

+ 6
- 6
Marlin/planner.h View File

@@ -119,7 +119,7 @@ typedef struct {
119 119
     uint8_t valve_pressure, e_to_p_pressure;
120 120
   #endif
121 121
 
122
-  uint32_t segment_time;
122
+  uint32_t segment_time_us;
123 123
 
124 124
 } block_t;
125 125
 
@@ -144,9 +144,9 @@ class Planner {
144 144
                  axis_steps_per_mm[XYZE_N],
145 145
                  steps_to_mm[XYZE_N];
146 146
     static uint32_t max_acceleration_steps_per_s2[XYZE_N],
147
-                    max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override by software
147
+                    max_acceleration_mm_per_s2[XYZE_N]; // Use M201 to override
148 148
 
149
-    static millis_t min_segment_time;
149
+    static uint32_t min_segment_time_us; // Use 'M205 B<µs>' to override
150 150
     static float min_feedrate_mm_s,
151 151
                  acceleration,         // Normal acceleration mm/s^2  DEFAULT ACCELERATION for all printing moves. M204 SXXXX
152 152
                  retract_acceleration, // Retract acceleration mm/s^2 filament pull-back and push-forward while standing still in the other axes M204 TXXXX
@@ -204,11 +204,11 @@ class Planner {
204 204
 
205 205
     #ifdef XY_FREQUENCY_LIMIT
206 206
       // Used for the frequency limit
207
-      #define MAX_FREQ_TIME long(1000000.0/XY_FREQUENCY_LIMIT)
207
+      #define MAX_FREQ_TIME_US (uint32_t)(1000000.0 / XY_FREQUENCY_LIMIT)
208 208
       // Old direction bits. Used for speed calculations
209 209
       static unsigned char old_direction_bits;
210 210
       // Segment times (in µs). Used for speed calculations
211
-      static long axis_segment_time[2][3];
211
+      static uint32_t axis_segment_time_us[2][3];
212 212
     #endif
213 213
 
214 214
     #if ENABLED(LIN_ADVANCE)
@@ -419,7 +419,7 @@ class Planner {
419 419
       if (blocks_queued()) {
420 420
         block_t* block = &block_buffer[block_buffer_tail];
421 421
         #if ENABLED(ULTRA_LCD)
422
-          block_buffer_runtime_us -= block->segment_time; //We can't be sure how long an active block will take, so don't count it.
422
+          block_buffer_runtime_us -= block->segment_time_us; // We can't be sure how long an active block will take, so don't count it.
423 423
         #endif
424 424
         SBI(block->flag, BLOCK_BIT_BUSY);
425 425
         return block;

+ 10
- 4
Marlin/watchdog.cpp View File

@@ -26,16 +26,22 @@
26 26
 
27 27
 #include "watchdog.h"
28 28
 
29
-// Initialize watchdog with a 4 sec interrupt time
29
+// Initialize watchdog with 8s timeout, if possible. Otherwise, make it 4s.
30 30
 void watchdog_init() {
31
+  #if ENABLED(WATCHDOG_DURATION_8S) && defined(WDTO_8S)
32
+    #define WDTO_NS WDTO_8S
33
+  #else
34
+    #define WDTO_NS WDTO_4S
35
+  #endif
31 36
   #if ENABLED(WATCHDOG_RESET_MANUAL)
32 37
     // We enable the watchdog timer, but only for the interrupt.
33
-    // Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details.
38
+    // Take care, as this requires the correct order of operation, with interrupts disabled.
39
+    // See the datasheet of any AVR chip for details.
34 40
     wdt_reset();
35 41
     _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE);
36
-    _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S;
42
+    _WD_CONTROL_REG = _BV(WDIE) | WDTO_NS;
37 43
   #else
38
-    wdt_enable(WDTO_4S);
44
+    wdt_enable(WDTO_NS);
39 45
   #endif
40 46
 }
41 47
 

+ 3
- 0
buildroot/share/git/mfpub View File

@@ -45,6 +45,9 @@ git clean -d -f
45 45
 # Push 'master' to the fork and make a proper PR...
46 46
 if [[ $BRANCH == "master" ]]; then
47 47
 
48
+  # Don't lose upstream changes!
49
+  mfup
50
+
48 51
   # Allow working directly with the main fork
49 52
   echo
50 53
   echo -n "Pushing to origin/master... "

Loading…
Cancel
Save