mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 13:56:24 +00:00
parent
7c7f2d094e
commit
d85411f13a
@ -1228,55 +1228,34 @@ void digipot_current(uint8_t driver, int current)
|
||||
|
||||
void microstep_init()
|
||||
{
|
||||
#if defined(Y_MS1_PIN) && Y_MS1_PIN > -1
|
||||
SET_OUTPUT(Y_MS1_PIN);
|
||||
SET_OUTPUT(Y_MS2_PIN);
|
||||
#endif
|
||||
#if defined(Z_MS1_PIN) && Z_MS1_PIN > -1
|
||||
SET_OUTPUT(Z_MS1_PIN);
|
||||
SET_OUTPUT(Z_MS2_PIN);
|
||||
#endif
|
||||
|
||||
#if defined(E0_MS1_PIN) && E0_MS1_PIN > -1
|
||||
SET_OUTPUT(E0_MS1_PIN);
|
||||
SET_OUTPUT(E0_MS2_PIN);
|
||||
#endif
|
||||
|
||||
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
||||
SET_OUTPUT(E1_MS1_PIN);
|
||||
SET_OUTPUT(E1_MS2_PIN);
|
||||
#endif
|
||||
|
||||
#if defined(X_MS1_PIN) && X_MS1_PIN > -1
|
||||
SET_OUTPUT(X_MS1_PIN);
|
||||
SET_OUTPUT(X_MS2_PIN);
|
||||
|
||||
const uint8_t microstep_modes[] = MICROSTEP_MODES;
|
||||
pinMode(X_MS2_PIN,OUTPUT);
|
||||
pinMode(Y_MS2_PIN,OUTPUT);
|
||||
pinMode(Z_MS2_PIN,OUTPUT);
|
||||
pinMode(E0_MS2_PIN,OUTPUT);
|
||||
pinMode(E1_MS2_PIN,OUTPUT);
|
||||
for(int i=0;i<=4;i++) microstep_mode(i,microstep_modes[i]);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void microstep_ms(uint8_t driver, int8_t ms1, int8_t ms2)
|
||||
{
|
||||
if(ms1 > -1) switch(driver)
|
||||
{
|
||||
case 0: WRITE( X_MS1_PIN,ms1); break;
|
||||
case 1: WRITE( Y_MS1_PIN,ms1); break;
|
||||
case 2: WRITE( Z_MS1_PIN,ms1); break;
|
||||
case 3: WRITE(E0_MS1_PIN,ms1); break;
|
||||
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
||||
case 4: WRITE(E1_MS1_PIN,ms1); break;
|
||||
#endif
|
||||
case 0: digitalWrite( X_MS1_PIN,ms1); break;
|
||||
case 1: digitalWrite( Y_MS1_PIN,ms1); break;
|
||||
case 2: digitalWrite( Z_MS1_PIN,ms1); break;
|
||||
case 3: digitalWrite(E0_MS1_PIN,ms1); break;
|
||||
case 4: digitalWrite(E1_MS1_PIN,ms1); break;
|
||||
}
|
||||
if(ms2 > -1) switch(driver)
|
||||
{
|
||||
case 0: WRITE( X_MS2_PIN,ms2); break;
|
||||
case 1: WRITE( Y_MS2_PIN,ms2); break;
|
||||
case 2: WRITE( Z_MS2_PIN,ms2); break;
|
||||
case 3: WRITE(E0_MS2_PIN,ms2); break;
|
||||
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
||||
case 4: WRITE(E1_MS2_PIN,ms2); break;
|
||||
#endif
|
||||
case 0: digitalWrite( X_MS2_PIN,ms2); break;
|
||||
case 1: digitalWrite( Y_MS2_PIN,ms2); break;
|
||||
case 2: digitalWrite( Z_MS2_PIN,ms2); break;
|
||||
case 3: digitalWrite(E0_MS2_PIN,ms2); break;
|
||||
case 4: digitalWrite(E1_MS2_PIN,ms2); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1307,10 +1286,8 @@ void microstep_readings()
|
||||
SERIAL_PROTOCOLPGM("E0: ");
|
||||
SERIAL_PROTOCOL( digitalRead(E0_MS1_PIN));
|
||||
SERIAL_PROTOCOLLN( digitalRead(E0_MS2_PIN));
|
||||
#if defined(E1_MS1_PIN) && E1_MS1_PIN > -1
|
||||
SERIAL_PROTOCOLPGM("E1: ");
|
||||
SERIAL_PROTOCOL( digitalRead(E1_MS1_PIN));
|
||||
SERIAL_PROTOCOLLN( digitalRead(E1_MS2_PIN));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user