Skip to content

Commit 33f1648

Browse files
authored
Fix Enable Pin Logic (#164)
* Fix Enable Pin Logic * Version Increment * Update ConfigurationValidation.hpp * Update ConfigurationValidation.hpp
1 parent 4ec9f29 commit 33f1648

File tree

4 files changed

+50
-52
lines changed

4 files changed

+50
-52
lines changed

Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
**V1.10.6 - Updates**
2+
- Use consistent enable pin logic for all drivers.
3+
- Increase maximum current for TMC2209 to 2A in accordance with BigTreeTech's published maximum continuous drive current.
4+
15
**V1.10.5 - Updates**
26
- Add ability to disable tracking at boot by default
37

ConfigurationValidation.hpp

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@
290290

291291
#if (DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
292292
#if defined(DEC_MOTOR_CURRENT_RATING)
293-
#if (DEC_MOTOR_CURRENT_RATING > 1700)
294-
#error "The TMC2209 driver is only rated up to 1.7A output. Delete this error if you know what youre doing"
293+
#if (DEC_MOTOR_CURRENT_RATING > 2000)
294+
#error "The TMC2209 driver is only rated up to 2A output. Delete this error if you know what youre doing"
295295
#endif
296296
#if (DEC_MOTOR_CURRENT_RATING == 0)
297297
#error \
@@ -313,8 +313,8 @@
313313

314314
#if (RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
315315
#if defined(RA_MOTOR_CURRENT_RATING)
316-
#if (RA_MOTOR_CURRENT_RATING > 1700)
317-
#error "The TMC2209 driver is only rated up to 1.7A output. Delete this error if you know what youre doing"
316+
#if (RA_MOTOR_CURRENT_RATING > 2000)
317+
#error "The TMC2209 driver is only rated up to 2A output. Delete this error if you know what you're doing"
318318
#endif
319319
#if (RA_MOTOR_CURRENT_RATING == 0)
320320
#error \
@@ -340,8 +340,8 @@
340340
#endif
341341
#if (AZ_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
342342
#if defined(AZ_MOTOR_CURRENT_RATING)
343-
#if (AZ_MOTOR_CURRENT_RATING > 1700)
344-
#error "The TMC2209 driver is only rated up to 1.7A output. Delete this error if you know what youre doing"
343+
#if (AZ_MOTOR_CURRENT_RATING > 2000)
344+
#error "The TMC2209 driver is only rated up to 2A output. Delete this error if you know what you're doing"
345345
#endif
346346
#if (AZ_MOTOR_CURRENT_RATING == 0)
347347
#error \
@@ -368,8 +368,8 @@
368368
#endif
369369
#if (ALT_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
370370
#if defined(ALT_MOTOR_CURRENT_RATING)
371-
#if (ALT_MOTOR_CURRENT_RATING > 1700)
372-
#error "The TMC2209 driver is only rated up to 1.7A output. Delete this error if you know what youre doing"
371+
#if (ALT_MOTOR_CURRENT_RATING > 2000)
372+
#error "The TMC2209 driver is only rated up to 2A output. Delete this error if you know what you're doing"
373373
#endif
374374
#if (ALT_MOTOR_CURRENT_RATING == 0)
375375
#error \
@@ -388,4 +388,32 @@
388388
"ALT_OPERATING_CURRENT_SETTING is not defined. Please define the operating percentage of your motor in you local configuration file using the ALT_OPERATING_CURRENT_SETTING keyword."
389389
#endif
390390
#endif
391-
#endif
391+
#endif
392+
393+
#if (FOCUS_STEPPER_TYPE != STEPPER_TYPE_NONE)
394+
#if !defined(FOCUS_MICROSTEPPING)
395+
#error "Focuser microstepping must be defined. Default is 4.0f for 28BYJ steppers, 4.0f for NEMA."
396+
#endif
397+
#if (FOCUS_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART)
398+
#if defined(FOCUS_MOTOR_CURRENT_RATING)
399+
#if (FOCUS_MOTOR_CURRENT_RATING > 2000)
400+
#error "The TMC2209 driver is only rated up to 2A output. Delete this error if you know what you're doing"
401+
#endif
402+
#if (FOCUS_MOTOR_CURRENT_RATING == 0)
403+
#error \
404+
"Focuser current rating/setting cannot be zero. Please configure the current rating of your motor in you local configuration file using the FOCUS_MOTOR_CURRENT_RATING keyword."
405+
#endif
406+
#else
407+
#error \
408+
"FOCUS_MOTOR_CURRENT_RATING is not defined. Please define the current rating of your motor in you local configuration file using the FOCUS_MOTOR_CURRENT_RATING keyword."
409+
#endif
410+
#if defined(FOCUS_OPERATING_CURRENT_SETTING)
411+
#if (FOCUS_OPERATING_CURRENT_SETTING <= 0) || (FOCUS_OPERATING_CURRENT_SETTING > 100)
412+
#error "FOCUS_OPERATING_CURRENT_SETTING is not within acceptable range (0-100)"
413+
#endif
414+
#else
415+
#error \
416+
"FOCUS_OPERATING_CURRENT_SETTING is not defined. Please define the operating percentage of your motor in you local configuration file using the FOCUS_OPERATING_CURRENT_SETTING keyword."
417+
#endif
418+
#endif
419+
#endif

Version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
// Also, numbers are interpreted as simple numbers. _ __ _
44
// So 1.8 is actually 1.08, meaning that 1.12 is a later version than 1.8. \_(..)_/
55

6-
#define VERSION "V1.10.5"
6+
#define VERSION "V1.10.6"

src/b_setup.hpp

Lines changed: 8 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,12 @@ void setup()
114114
digitalWrite(DEW_HEATER_2_PIN, HIGH);
115115
#endif
116116

117-
/////////////////////////////////
118-
// Microstepping/driver pins
119-
/////////////////////////////////
120-
#if RA_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC
121-
// include A4988 microstep pins
122-
//#error "Define Microstep pins and delete this error."
123-
digitalWrite(RA_EN_PIN, HIGH);
124-
#if defined(RA_MS0_PIN)
125-
digitalWrite(RA_MS0_PIN, HIGH); // MS0
126-
#endif
127-
#if defined(RA_MS1_PIN)
128-
digitalWrite(RA_MS1_PIN, HIGH); // MS1
129-
#endif
130-
#if defined(RA_MS2_PIN)
131-
digitalWrite(RA_MS2_PIN, HIGH); // MS2
132-
#endif
133-
#endif
134-
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE
135-
// include TMC2209 Standalone pins
117+
/////////////////////////////////
118+
// Microstepping/driver pins
119+
/////////////////////////////////
136120
pinMode(RA_EN_PIN, OUTPUT);
137121
digitalWrite(RA_EN_PIN, LOW); // ENABLE, LOW to enable
122+
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE || RA_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC
138123
#if defined(RA_MS0_PIN)
139124
digitalWrite(RA_MS0_PIN, HIGH); // MS0
140125
#endif
@@ -148,45 +133,26 @@ void setup()
148133
#if RA_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
149134
// include TMC2209 UART pins
150135
pinMode(RA_DIAG_PIN, INPUT);
151-
pinMode(RA_EN_PIN, OUTPUT);
152-
digitalWrite(RA_EN_PIN, LOW);
153136
#ifdef RA_SERIAL_PORT
154137
RA_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver
155138
#endif
156139
#endif
157-
#if DEC_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC // DEC driver startup (for A4988)
158-
digitalWrite(DEC_EN_PIN, HIGH);
159-
#if defined(RA_MS0_PIN)
160-
digitalWrite(DEC_MS0_PIN, HIGH); // MS1
161-
#endif
162-
#if defined(RA_MS0_PIN)
163-
digitalWrite(DEC_MS1_PIN, HIGH); // MS2
164-
#endif
165-
#if defined(RA_MS0_PIN)
166-
digitalWrite(DEC_MS2_PIN, HIGH); // MS3
167-
#endif
168-
#endif
169-
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE
170-
// include TMC2209 Standalone pins
171140
pinMode(DEC_EN_PIN, OUTPUT);
172141
digitalWrite(DEC_EN_PIN, LOW); // ENABLE, LOW to enable
173-
#if defined(RA_MS0_PIN)
142+
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_STANDALONE || DEC_DRIVER_TYPE == DRIVER_TYPE_A4988_GENERIC
143+
#if defined(DEC_MS0_PIN)
174144
digitalWrite(DEC_MS0_PIN, HIGH); // MS1
175145
#endif
176-
#if defined(RA_MS0_PIN)
146+
#if defined(DEC_MS1_PIN)
177147
digitalWrite(DEC_MS1_PIN, HIGH); // MS2
178148
#endif
179-
#if defined(RA_MS0_PIN)
149+
#if defined(DEC_MS2_PIN)
180150
digitalWrite(DEC_MS2_PIN, HIGH); // MS3
181151
#endif
182152
#endif
183153
#if DEC_DRIVER_TYPE == DRIVER_TYPE_TMC2209_UART
184154
// include TMC2209 UART pins
185155
pinMode(DEC_DIAG_PIN, INPUT);
186-
pinMode(DEC_EN_PIN, OUTPUT);
187-
digitalWrite(DEC_EN_PIN, LOW);
188-
//pinMode(DEC_MS1_PIN, OUTPUT);
189-
//digitalWrite(DEC_MS1_PIN, HIGH); // Logic HIGH to MS1 to get 0b01 address
190156
#ifdef DEC_SERIAL_PORT
191157
DEC_SERIAL_PORT.begin(57600); // Start HardwareSerial comms with driver
192158
#endif

0 commit comments

Comments
 (0)