Merge branch 'Development' into enhanced_g29

Latest upstream changes
2.0.x
Scott Lahteine 10 years ago
commit 6d9e9a6bef

@ -181,7 +181,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
#endif #endif
enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; enum AxisEnum {X_AXIS=0, Y_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
//X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship between X_AXIS and X Head movement, like CoreXY bots.
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ClearToSend(); void ClearToSend();

@ -154,6 +154,8 @@
// M302 - Allow cold extrudes, or set the minimum extrude S<temperature>. // M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C) // M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
// M304 - Set bed PID parameters P I and D // M304 - Set bed PID parameters P I and D
// M380 - Activate solenoid on active extruder
// M381 - Disable all solenoids
// M400 - Finish all moves // M400 - Finish all moves
// M401 - Lower z-probe if present // M401 - Lower z-probe if present
// M402 - Raise z-probe if present // M402 - Raise z-probe if present
@ -529,23 +531,20 @@ void setup_homepin(void)
void setup_photpin() void setup_photpin()
{ {
#if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1 #if defined(PHOTOGRAPH_PIN) && PHOTOGRAPH_PIN > -1
SET_OUTPUT(PHOTOGRAPH_PIN); OUT_WRITE(PHOTOGRAPH_PIN, LOW);
WRITE(PHOTOGRAPH_PIN, LOW);
#endif #endif
} }
void setup_powerhold() void setup_powerhold()
{ {
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT(SUICIDE_PIN); OUT_WRITE(SUICIDE_PIN, HIGH);
WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if defined(PS_ON_PIN) && PS_ON_PIN > -1
SET_OUTPUT(PS_ON_PIN);
#if defined(PS_DEFAULT_OFF) #if defined(PS_DEFAULT_OFF)
WRITE(PS_ON_PIN, PS_ON_ASLEEP); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#else #else
WRITE(PS_ON_PIN, PS_ON_AWAKE); OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE);
#endif #endif
#endif #endif
} }
@ -553,8 +552,7 @@ void setup_powerhold()
void suicide() void suicide()
{ {
#if defined(SUICIDE_PIN) && SUICIDE_PIN > -1 #if defined(SUICIDE_PIN) && SUICIDE_PIN > -1
SET_OUTPUT(SUICIDE_PIN); OUT_WRITE(SUICIDE_PIN, LOW);
WRITE(SUICIDE_PIN, LOW);
#endif #endif
} }
@ -1437,10 +1435,10 @@ void process_commands()
if(autoretract_enabled) if(autoretract_enabled)
if( !(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) { if( !(code_seen('X') || code_seen('Y') || code_seen('Z')) && code_seen('E')) {
float echange=destination[E_AXIS]-current_position[E_AXIS]; float echange=destination[E_AXIS]-current_position[E_AXIS];
if((echange<-MIN_RETRACT && !retracted) || (echange>MIN_RETRACT && retracted)) { //move appears to be an attempt to retract or recover if((echange<-MIN_RETRACT && !retracted[active_extruder]) || (echange>MIN_RETRACT && retracted[active_extruder])) { //move appears to be an attempt to retract or recover
current_position[E_AXIS] = destination[E_AXIS]; //hide the slicer-generated retract/recover from calculations current_position[E_AXIS] = destination[E_AXIS]; //hide the slicer-generated retract/recover from calculations
plan_set_e_position(current_position[E_AXIS]); //AND from the planner plan_set_e_position(current_position[E_AXIS]); //AND from the planner
retract(!retracted); retract(!retracted[active_extruder]);
return; return;
} }
} }
@ -2865,15 +2863,13 @@ Sigma_Exit:
#if defined(PS_ON_PIN) && PS_ON_PIN > -1 #if defined(PS_ON_PIN) && PS_ON_PIN > -1
case 80: // M80 - Turn on Power Supply case 80: // M80 - Turn on Power Supply
SET_OUTPUT(PS_ON_PIN); //GND OUT_WRITE(PS_ON_PIN, PS_ON_AWAKE); // GND
WRITE(PS_ON_PIN, PS_ON_AWAKE);
// If you have a switch on suicide pin, this is useful // If you have a switch on suicide pin, this is useful
// if you want to start another print with suicide feature after // if you want to start another print with suicide feature after
// a print without suicide... // a print without suicide...
#if defined SUICIDE_PIN && SUICIDE_PIN > -1 #if defined SUICIDE_PIN && SUICIDE_PIN > -1
SET_OUTPUT(SUICIDE_PIN); OUT_WRITE(SUICIDE_PIN, HIGH);
WRITE(SUICIDE_PIN, HIGH);
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
@ -2898,8 +2894,7 @@ Sigma_Exit:
st_synchronize(); st_synchronize();
suicide(); suicide();
#elif defined(PS_ON_PIN) && PS_ON_PIN > -1 #elif defined(PS_ON_PIN) && PS_ON_PIN > -1
SET_OUTPUT(PS_ON_PIN); OUT_WRITE(PS_ON_PIN, PS_ON_ASLEEP);
WRITE(PS_ON_PIN, PS_ON_ASLEEP);
#endif #endif
#ifdef ULTIPANEL #ifdef ULTIPANEL
powersupply = false; powersupply = false;
@ -3263,7 +3258,7 @@ Sigma_Exit:
SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]); SERIAL_ECHO(extruder_offset[Z_AXIS][tmp_extruder]);
#endif #endif
} }
SERIAL_ECHOLN(""); SERIAL_EOL;
}break; }break;
#endif #endif
case 220: // M220 S<factor in percent>- set speed factor override percentage case 220: // M220 S<factor in percent>- set speed factor override percentage
@ -3482,8 +3477,7 @@ Sigma_Exit:
{ {
#ifdef CHDK #ifdef CHDK
SET_OUTPUT(CHDK); OUT_WRITE(CHDK, HIGH);
WRITE(CHDK, HIGH);
chdkHigh = millis(); chdkHigh = millis();
chdkActive = true; chdkActive = true;
@ -3642,6 +3636,17 @@ Sigma_Exit:
} }
break; break;
#endif #endif
#ifdef EXT_SOLENOID
case 380:
enable_solenoid_on_active_extruder();
break;
case 381:
disable_all_solenoids();
break;
#endif //EXT_SOLENOID
case 400: // M400 finish all moves case 400: // M400 finish all moves
{ {
st_synchronize(); st_synchronize();
@ -3883,9 +3888,7 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
if(cnt==0) if(cnt==0)
{ {
#if BEEPER > 0 #if BEEPER > 0
SET_OUTPUT(BEEPER); OUT_WRITE(BEEPER,HIGH);
WRITE(BEEPER,HIGH);
delay(3); delay(3);
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
delay(3); delay(3);
@ -4146,6 +4149,13 @@ case 404: //M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or disp
prepare_move(); prepare_move();
} }
} }
#ifdef EXT_SOLENOID
st_synchronize();
disable_all_solenoids();
enable_solenoid_on_active_extruder();
#endif //EXT_SOLENOID
#endif #endif
SERIAL_ECHO_START; SERIAL_ECHO_START;
SERIAL_ECHO(MSG_ACTIVE_EXTRUDER); SERIAL_ECHO(MSG_ACTIVE_EXTRUDER);
@ -4855,7 +4865,6 @@ bool setTargetedHotend(int code){
return false; return false;
} }
float calculate_volumetric_multiplier(float diameter) { float calculate_volumetric_multiplier(float diameter) {
if (!volumetric_enabled || diameter == 0) return 1.0; if (!volumetric_enabled || diameter == 0) return 1.0;
float d2 = diameter * 0.5; float d2 = diameter * 0.5;
@ -4866,3 +4875,43 @@ void calculate_volumetric_multipliers() {
for (int i=0; i<EXTRUDERS; i++) for (int i=0; i<EXTRUDERS; i++)
volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]); volumetric_multiplier[i] = calculate_volumetric_multiplier(filament_size[i]);
} }
#ifdef EXT_SOLENOID
void enable_solenoid(uint8_t num) {
switch(num) {
case 0:
OUT_WRITE(SOL0_PIN, HIGH);
break;
#if defined(SOL1_PIN) && SOL1_PIN > -1
case 1:
OUT_WRITE(SOL1_PIN, HIGH);
break;
#endif
#if defined(SOL2_PIN) && SOL2_PIN > -1
case 2:
OUT_WRITE(SOL2_PIN, HIGH);
break;
#endif
#if defined(SOL3_PIN) && SOL3_PIN > -1
case 3:
OUT_WRITE(SOL3_PIN, HIGH);
break;
#endif
default:
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_INVALID_SOLENOID);
break;
}
}
void enable_solenoid_on_active_extruder() { enable_solenoid(active_extruder); }
void disable_all_solenoids() {
OUT_WRITE(SOL0_PIN, LOW);
OUT_WRITE(SOL1_PIN, LOW);
OUT_WRITE(SOL2_PIN, LOW);
OUT_WRITE(SOL3_PIN, LOW);
}
#endif //EXT_SOLENOID

@ -22,8 +22,7 @@ CardReader::CardReader() {
autostart_index = 0; autostart_index = 0;
//power to SD reader //power to SD reader
#if SDPOWER > -1 #if SDPOWER > -1
SET_OUTPUT(SDPOWER); OUT_WRITE(SDPOWER, HIGH);
WRITE(SDPOWER, HIGH);
#endif //SDPOWER #endif //SDPOWER
autostart_atmillis = millis() + 5000; autostart_atmillis = millis() + 5000;

@ -27,10 +27,6 @@
#define EN_A (1<<BLEN_A) #define EN_A (1<<BLEN_A)
#define EN_B (1<<BLEN_B) #define EN_B (1<<BLEN_B)
#define EN_C (1<<BLEN_C) #define EN_C (1<<BLEN_C)
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#endif #endif

@ -83,6 +83,9 @@
/// check if pin is an timer wrapper /// check if pin is an timer wrapper
#define GET_TIMER(IO) _GET_TIMER(IO) #define GET_TIMER(IO) _GET_TIMER(IO)
// Shorthand
#define OUT_WRITE(IO, v) { SET_OUTPUT(IO); WRITE(IO, v); }
/* /*
ports and functions ports and functions

@ -121,6 +121,7 @@
#define MSG_UNKNOWN_COMMAND "Unknown command: \"" #define MSG_UNKNOWN_COMMAND "Unknown command: \""
#define MSG_ACTIVE_EXTRUDER "Active Extruder: " #define MSG_ACTIVE_EXTRUDER "Active Extruder: "
#define MSG_INVALID_EXTRUDER "Invalid extruder" #define MSG_INVALID_EXTRUDER "Invalid extruder"
#define MSG_INVALID_SOLENOID "Invalid solenoid"
#define MSG_X_MIN "x_min: " #define MSG_X_MIN "x_min: "
#define MSG_X_MAX "x_max: " #define MSG_X_MAX "x_max: "
#define MSG_Y_MIN "y_min: " #define MSG_Y_MIN "y_min: "

@ -87,9 +87,3 @@
// Cheaptronic v1.0 does not use this port // Cheaptronic v1.0 does not use this port
#define SDCARDDETECT -1 #define SDCARDDETECT -1
// Encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1

@ -74,12 +74,6 @@
#define BLEN_B 1 #define BLEN_B 1
#define BLEN_A 0 #define BLEN_A 0
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif // RA_CONTROL_PANEL #endif // RA_CONTROL_PANEL
#ifdef RA_DISCO #ifdef RA_DISCO

@ -83,10 +83,4 @@
#define SDCARDDETECT -1 // Ramps does not use this port #define SDCARDDETECT -1 // Ramps does not use this port
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif // ULTRA_LCD && NEWPANEL #endif // ULTRA_LCD && NEWPANEL

@ -80,9 +80,3 @@
#define BLEN_A 0 #define BLEN_A 0
#define SDCARDDETECT -1 // Megatronics does not use this port #define SDCARDDETECT -1 // Megatronics does not use this port
// Encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1

@ -95,9 +95,3 @@
#define BLEN_A 0 #define BLEN_A 0
#define SDCARDDETECT -1 // Megatronics does not use this port #define SDCARDDETECT -1 // Megatronics does not use this port
// Encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1

@ -95,9 +95,3 @@
#define BLEN_A 0 #define BLEN_A 0
#define SDCARDDETECT -1 // Megatronics does not use this port #define SDCARDDETECT -1 // Megatronics does not use this port
// Encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1

@ -116,11 +116,6 @@
#define SDCARDDETECT 81 // Ramps does not use this port #define SDCARDDETECT 81 // Ramps does not use this port
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#else //!NEWPANEL - old style panel with shift register #else //!NEWPANEL - old style panel with shift register
//arduino pin witch triggers an piezzo beeper //arduino pin witch triggers an piezzo beeper
#define BEEPER 33 No Beeper added #define BEEPER 33 No Beeper added
@ -138,12 +133,6 @@
#define LCD_PINS_D6 27 #define LCD_PINS_D6 27
#define LCD_PINS_D7 29 #define LCD_PINS_D7 29
//encoder rotation values
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
//bits in the shift register that carry the buttons for: //bits in the shift register that carry the buttons for:
// left up center down right red // left up center down right red
#define BL_LE 7 #define BL_LE 7

@ -187,7 +187,7 @@ void checkHitEndstops()
SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]); SERIAL_ECHOPAIR(" Z:",(float)endstops_trigsteps[Z_AXIS]/axis_steps_per_unit[Z_AXIS]);
LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z"); LCD_MESSAGEPGM(MSG_ENDSTOPS_HIT "Z");
} }
SERIAL_ECHOLN(""); SERIAL_EOL;
endstop_x_hit=false; endstop_x_hit=false;
endstop_y_hit=false; endstop_y_hit=false;
endstop_z_hit=false; endstop_z_hit=false;
@ -399,24 +399,24 @@ ISR(TIMER1_COMPA_vect)
count_direction[Y_AXIS]=1; count_direction[Y_AXIS]=1;
} }
// Set direction en check limit switches if(check_endstops) // check X and Y Endstops
{
#ifndef COREXY #ifndef COREXY
if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis if ((out_bits & (1<<X_AXIS)) != 0) // stepping along -X axis (regular cartesians bot)
#else #else
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS != (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == -DeltaY, the movement is only in Y axis
if ((out_bits & (1<<X_HEAD)) != 0) //AlexBorro: Head direction in -X axis for CoreXY bots. if ((out_bits & (1<<X_HEAD)) != 0) //AlexBorro: Head direction in -X axis for CoreXY bots.
#endif #endif
{ { // -direction
CHECK_ENDSTOPS
{
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
|| (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
#endif #endif
{ {
#if defined(X_MIN_PIN) && X_MIN_PIN > -1 #if defined(X_MIN_PIN) && X_MIN_PIN > -1
bool x_min_endstop=(READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING); bool x_min_endstop=(READ(X_MIN_PIN) != X_MIN_ENDSTOP_INVERTING);
if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0)) { if(x_min_endstop && old_x_min_endstop && (current_block->steps_x > 0))
{
endstops_trigsteps[X_AXIS] = count_position[X_AXIS]; endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
endstop_x_hit=true; endstop_x_hit=true;
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
@ -425,20 +425,17 @@ ISR(TIMER1_COMPA_vect)
#endif #endif
} }
} }
}
else else
{ // +direction { // +direction
CHECK_ENDSTOPS
{
#ifdef DUAL_X_CARRIAGE #ifdef DUAL_X_CARRIAGE
// with 2 x-carriages, endstops are only checked in the homing direction for the active extruder // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
|| (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
#endif #endif
{ {
#if defined(X_MAX_PIN) && X_MAX_PIN > -1 #if defined(X_MAX_PIN) && X_MAX_PIN > -1
bool x_max_endstop=(READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING); bool x_max_endstop=(READ(X_MAX_PIN) != X_MAX_ENDSTOP_INVERTING);
if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0)){ if(x_max_endstop && old_x_max_endstop && (current_block->steps_x > 0))
{
endstops_trigsteps[X_AXIS] = count_position[X_AXIS]; endstops_trigsteps[X_AXIS] = count_position[X_AXIS];
endstop_x_hit=true; endstop_x_hit=true;
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
@ -447,19 +444,18 @@ ISR(TIMER1_COMPA_vect)
#endif #endif
} }
} }
}
#ifndef COREXY #ifndef COREXY
if ((out_bits & (1<<Y_AXIS)) != 0) // -direction if ((out_bits & (1<<Y_AXIS)) != 0) // -direction
#else #else
if (!((current_block->steps_x == current_block->steps_y) && ((out_bits & (1<<X_AXIS))>>X_AXIS == (out_bits & (1<<Y_AXIS))>>Y_AXIS))) // AlexBorro: If DeltaX == DeltaY, the movement is only in X axis
if ((out_bits & (1<<Y_HEAD)) != 0) //AlexBorro: Head direction in -Y axis for CoreXY bots. if ((out_bits & (1<<Y_HEAD)) != 0) //AlexBorro: Head direction in -Y axis for CoreXY bots.
#endif #endif
{ { // -direction
CHECK_ENDSTOPS
{
#if defined(Y_MIN_PIN) && Y_MIN_PIN > -1 #if defined(Y_MIN_PIN) && Y_MIN_PIN > -1
bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING); bool y_min_endstop=(READ(Y_MIN_PIN) != Y_MIN_ENDSTOP_INVERTING);
if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0)) { if(y_min_endstop && old_y_min_endstop && (current_block->steps_y > 0))
{
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS]; endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
endstop_y_hit=true; endstop_y_hit=true;
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
@ -467,20 +463,19 @@ ISR(TIMER1_COMPA_vect)
old_y_min_endstop = y_min_endstop; old_y_min_endstop = y_min_endstop;
#endif #endif
} }
}
else else
{ // +direction { // +direction
CHECK_ENDSTOPS
{
#if defined(Y_MAX_PIN) && Y_MAX_PIN > -1 #if defined(Y_MAX_PIN) && Y_MAX_PIN > -1
bool y_max_endstop=(READ(Y_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING); bool y_max_endstop=(READ(Y_MAX_PIN) != Y_MAX_ENDSTOP_INVERTING);
if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0)){ if(y_max_endstop && old_y_max_endstop && (current_block->steps_y > 0))
{
endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS]; endstops_trigsteps[Y_AXIS] = count_position[Y_AXIS];
endstop_y_hit=true; endstop_y_hit=true;
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count;
} }
old_y_max_endstop = y_max_endstop; old_y_max_endstop = y_max_endstop;
#endif #endif
} }
} }
@ -964,51 +959,41 @@ void st_init()
//Initialize Step Pins //Initialize Step Pins
#if defined(X_STEP_PIN) && (X_STEP_PIN > -1) #if defined(X_STEP_PIN) && (X_STEP_PIN > -1)
SET_OUTPUT(X_STEP_PIN); OUT_WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
WRITE(X_STEP_PIN,INVERT_X_STEP_PIN);
disable_x(); disable_x();
#endif #endif
#if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1) #if defined(X2_STEP_PIN) && (X2_STEP_PIN > -1)
SET_OUTPUT(X2_STEP_PIN); OUT_WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
WRITE(X2_STEP_PIN,INVERT_X_STEP_PIN);
disable_x(); disable_x();
#endif #endif
#if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1) #if defined(Y_STEP_PIN) && (Y_STEP_PIN > -1)
SET_OUTPUT(Y_STEP_PIN); OUT_WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
WRITE(Y_STEP_PIN,INVERT_Y_STEP_PIN);
#if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1) #if defined(Y_DUAL_STEPPER_DRIVERS) && defined(Y2_STEP_PIN) && (Y2_STEP_PIN > -1)
SET_OUTPUT(Y2_STEP_PIN); OUT_WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN);
WRITE(Y2_STEP_PIN,INVERT_Y_STEP_PIN);
#endif #endif
disable_y(); disable_y();
#endif #endif
#if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1) #if defined(Z_STEP_PIN) && (Z_STEP_PIN > -1)
SET_OUTPUT(Z_STEP_PIN); OUT_WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
WRITE(Z_STEP_PIN,INVERT_Z_STEP_PIN);
#if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1) #if defined(Z_DUAL_STEPPER_DRIVERS) && defined(Z2_STEP_PIN) && (Z2_STEP_PIN > -1)
SET_OUTPUT(Z2_STEP_PIN); OUT_WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
WRITE(Z2_STEP_PIN,INVERT_Z_STEP_PIN);
#endif #endif
disable_z(); disable_z();
#endif #endif
#if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1) #if defined(E0_STEP_PIN) && (E0_STEP_PIN > -1)
SET_OUTPUT(E0_STEP_PIN); OUT_WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
WRITE(E0_STEP_PIN,INVERT_E_STEP_PIN);
disable_e0(); disable_e0();
#endif #endif
#if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1) #if defined(E1_STEP_PIN) && (E1_STEP_PIN > -1)
SET_OUTPUT(E1_STEP_PIN); OUT_WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
WRITE(E1_STEP_PIN,INVERT_E_STEP_PIN);
disable_e1(); disable_e1();
#endif #endif
#if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1) #if defined(E2_STEP_PIN) && (E2_STEP_PIN > -1)
SET_OUTPUT(E2_STEP_PIN); OUT_WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
WRITE(E2_STEP_PIN,INVERT_E_STEP_PIN);
disable_e2(); disable_e2();
#endif #endif
#if defined(E3_STEP_PIN) && (E3_STEP_PIN > -1) #if defined(E3_STEP_PIN) && (E3_STEP_PIN > -1)
SET_OUTPUT(E3_STEP_PIN); OUT_WRITE(E3_STEP_PIN,INVERT_E_STEP_PIN);
WRITE(E3_STEP_PIN,INVERT_E_STEP_PIN);
disable_e3(); disable_e3();
#endif #endif

@ -901,21 +901,15 @@ void tp_init()
#ifdef HEATER_0_USES_MAX6675 #ifdef HEATER_0_USES_MAX6675
#ifndef SDSUPPORT #ifndef SDSUPPORT
SET_OUTPUT(SCK_PIN); OUT_WRITE(SCK_PIN, LOW);
WRITE(SCK_PIN,0); OUT_WRITE(MOSI_PIN, HIGH);
OUT_WRITE(MISO_PIN, HIGH);
SET_OUTPUT(MOSI_PIN);
WRITE(MOSI_PIN,1);
SET_INPUT(MISO_PIN);
WRITE(MISO_PIN,1);
#else #else
pinMode(SS_PIN, OUTPUT); pinMode(SS_PIN, OUTPUT);
digitalWrite(SS_PIN, HIGH); digitalWrite(SS_PIN, HIGH);
#endif #endif
SET_OUTPUT(MAX6675_SS); OUT_WRITE(MAX6675_SS,HIGH);
WRITE(MAX6675_SS,1);
#endif //HEATER_0_USES_MAX6675 #endif //HEATER_0_USES_MAX6675

@ -1394,6 +1394,17 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#ifdef ULTIPANEL #ifdef ULTIPANEL
////////////////////////
// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
// These values are independent of which pins are used for EN_A and EN_B indications
// The rotary encoder part is also independent to the chipset used for the LCD
#if defined(EN_A) && defined(EN_B)
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif
/* Warning: This function is called from interrupt context */ /* Warning: This function is called from interrupt context */
void lcd_buttons_update() { void lcd_buttons_update() {
#ifdef NEWPANEL #ifdef NEWPANEL

@ -123,17 +123,6 @@
#define LCD_CLICKED (buttons&(B_MI|B_ST)) #define LCD_CLICKED (buttons&(B_MI|B_ST))
#endif #endif
////////////////////////
// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
// These values are independent of which pins are used for EN_A and EN_B indications
// The rotary encoder part is also independent to the chipset used for the LCD
#if defined(EN_A) && defined(EN_B)
#define encrot0 0
#define encrot1 2
#define encrot2 3
#define encrot3 1
#endif
#endif //ULTIPANEL #endif //ULTIPANEL
//////////////////////////////////// ////////////////////////////////////
@ -833,31 +822,27 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
static void lcd_implementation_quick_feedback() static void lcd_implementation_quick_feedback()
{ {
#ifdef LCD_USE_I2C_BUZZER #ifdef LCD_USE_I2C_BUZZER
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) #if defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) && defined(LCD_FEEDBACK_FREQUENCY_HZ)
lcd_buzz(1000/6,100);
#else
lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ); lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS, LCD_FEEDBACK_FREQUENCY_HZ);
#else
lcd_buzz(1000/6, 100);
#endif #endif
#elif defined(BEEPER) && BEEPER > -1 #elif defined(BEEPER) && BEEPER > -1
SET_OUTPUT(BEEPER); SET_OUTPUT(BEEPER);
#if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS)
for(int8_t i=0;i<10;i++) const unsigned int delay = 100;
{ uint8_t i = 10;
WRITE(BEEPER,HIGH);
delayMicroseconds(100);
WRITE(BEEPER,LOW);
delayMicroseconds(100);
}
#else #else
for(int8_t i=0;i<(LCD_FEEDBACK_FREQUENCY_DURATION_MS / (1000 / LCD_FEEDBACK_FREQUENCY_HZ));i++) const unsigned int delay = 1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2;
{ int8_t i = LCD_FEEDBACK_FREQUENCY_DURATION_MS * LCD_FEEDBACK_FREQUENCY_HZ / 1000;
#endif
while (i--) {
WRITE(BEEPER,HIGH); WRITE(BEEPER,HIGH);
delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2); delayMicroseconds(delay);
WRITE(BEEPER,LOW); WRITE(BEEPER,LOW);
delayMicroseconds(1000000 / LCD_FEEDBACK_FREQUENCY_HZ / 2); delayMicroseconds(delay);
} }
#endif #endif
#endif
} }
#ifdef LCD_HAS_STATUS_INDICATORS #ifdef LCD_HAS_STATUS_INDICATORS

@ -47,12 +47,9 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo
{ {
case U8G_DEV_MSG_INIT: case U8G_DEV_MSG_INIT:
{ {
SET_OUTPUT(ST7920_CS_PIN); OUT_WRITE(ST7920_CS_PIN,LOW);
WRITE(ST7920_CS_PIN,0); OUT_WRITE(ST7920_DAT_PIN,LOW);
SET_OUTPUT(ST7920_DAT_PIN); OUT_WRITE(ST7920_CLK_PIN,HIGH);
WRITE(ST7920_DAT_PIN,0);
SET_OUTPUT(ST7920_CLK_PIN);
WRITE(ST7920_CLK_PIN,1);
ST7920_CS(); ST7920_CS();
u8g_Delay(120); //initial delay for boot up u8g_Delay(120); //initial delay for boot up

Loading…
Cancel
Save