Commit 89caa423 authored by MagoKimbra's avatar MagoKimbra

Same fix

parent 29907c62
...@@ -218,9 +218,9 @@ ...@@ -218,9 +218,9 @@
//#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay //#define SLOW_PWM_HEATERS // PWM with very low frequency (roughly 0.125Hz=8s) and minimum state time of approximately 1s useful for heaters driven by a relay
// If the temperature difference between the target temperature and the actual temperature // If the temperature difference between the target temperature and the actual temperature
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max. // is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_FUNCTIONAL_RANGE 10 // degC #define PID_FUNCTIONAL_RANGE 10 // degC
#define PID_INTEGRAL_DRIVE_MAX PID_MAX // Limit for the integral term #define PID_INTEGRAL_DRIVE_MAX PID_MAX // Limit for the integral term
#define K1 0.95 // Smoothing factor within the PID #define K1 0.95 // Smoothing factor within the PID
#define MAX_OVERSHOOT_PID_AUTOTUNE 20 // Max valor for overshoot autotune #define MAX_OVERSHOOT_PID_AUTOTUNE 20 // Max valor for overshoot autotune
// HotEnd{HE0,HE1,HE2,HE3} // HotEnd{HE0,HE1,HE2,HE3}
......
...@@ -139,7 +139,7 @@ void manage_inactivity(bool ignore_stepper_queue=false); ...@@ -139,7 +139,7 @@ void manage_inactivity(bool ignore_stepper_queue=false);
*/ */
enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5}; enum AxisEnum {X_AXIS=0, Y_AXIS=1, A_AXIS=0, B_AXIS=1, Z_AXIS=2, E_AXIS=3, X_HEAD=4, Y_HEAD=5};
enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6}; enum EndstopEnum {X_MIN=0, Y_MIN=1, Z_MIN=2, Z_PROBE=3, X_MAX=4, Y_MAX=5, Z_MAX=6, Z2_MIN=7, Z2_MAX=8};
void enable_all_steppers(); void enable_all_steppers();
void disable_all_steppers(); void disable_all_steppers();
......
This diff is collapsed.
...@@ -226,6 +226,23 @@ ...@@ -226,6 +226,23 @@
#define CONDITIONALS_H #define CONDITIONALS_H
/**
* SINGLENOZZLE
*/
#ifdef SINGLENOZZLE
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else
#define HOTENDS EXTRUDERS
#endif
/**
* DRIVER_EXTRUDERS
*/
#if !defined(MKR4) && !defined(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif
#ifndef __SAM3X8E__ #ifndef __SAM3X8E__
#ifndef AT90USB #ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
...@@ -289,23 +306,6 @@ ...@@ -289,23 +306,6 @@
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate. #define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#endif #endif
/**
* SINGLENOZZLE
*/
#ifdef SINGLENOZZLE
#define HOTENDS 1
#undef TEMP_SENSOR_1_AS_REDUNDANT
#else
#define HOTENDS EXTRUDERS
#endif
/**
* DRIVER_EXTRUDERS
*/
#if !defined(MKR4) && !defined(NPR2)
#define DRIVER_EXTRUDERS EXTRUDERS // This defines the number of Driver extruder
#endif
/** /**
* Axis lengths * Axis lengths
*/ */
......
...@@ -76,9 +76,10 @@ volatile long endstops_trigsteps[3] = { 0 }; ...@@ -76,9 +76,10 @@ volatile long endstops_trigsteps[3] = { 0 };
volatile long endstops_stepsTotal, endstops_stepsDone; volatile long endstops_stepsTotal, endstops_stepsDone;
static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value static volatile char endstop_hit_bits = 0; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value
static char old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE #ifndef Z_DUAL_ENDSTOPS
#ifdef Z_DUAL_ENDSTOPS static byte old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
static char old_dual_endstop_bits = 0; // actually only implemented for Z #else
static uint16_t old_endstop_bits = 0; // use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#endif #endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
...@@ -136,10 +137,10 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; ...@@ -136,10 +137,10 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
if (performing_homing) { \ if (performing_homing) { \
if (Z_HOME_DIR > 0) {\ if (Z_HOME_DIR > 0) {\
if (!(TEST(old_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \ if (!(TEST(old_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
if (!(TEST(old_dual_endstop_bits, Z_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \ if (!(TEST(old_endstop_bits, Z2_MAX) && (count_direction[Z_AXIS] > 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
} else {\ } else {\
if (!(TEST(old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \ if (!(TEST(old_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z_motor) Z_STEP_WRITE(v); \
if (!(TEST(old_dual_endstop_bits, Z_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \ if (!(TEST(old_endstop_bits, Z2_MIN) && (count_direction[Z_AXIS] < 0)) && !locked_z2_motor) Z2_STEP_WRITE(v); \
} \ } \
} else { \ } else { \
Z_STEP_WRITE(v); \ Z_STEP_WRITE(v); \
...@@ -466,9 +467,10 @@ ISR(TIMER1_COMPA_vect) { ...@@ -466,9 +467,10 @@ ISR(TIMER1_COMPA_vect) {
// Check endstops // Check endstops
if (check_endstops) { if (check_endstops) {
char current_endstop_bits;
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
char current_dual_endstop_bits; uint16_t current_endstop_bits;
#else
byte current_endstop_bits;
#endif #endif
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN #define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
...@@ -477,16 +479,16 @@ ISR(TIMER1_COMPA_vect) { ...@@ -477,16 +479,16 @@ ISR(TIMER1_COMPA_vect) {
#define _ENDSTOP_HIT(AXIS) endstop_hit_bits |= BIT(_ENDSTOP(AXIS, MIN)) #define _ENDSTOP_HIT(AXIS) endstop_hit_bits |= BIT(_ENDSTOP(AXIS, MIN))
#define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX #define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
// GET_ENDSTOP_STATUS: set the current endstop bits for an endstop to its status // SET_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
#define GET_ENDSTOP_STATUS(endstop, AXIS, MINMAX) SET_BIT(endstop, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) #define SET_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT(current_endstop_bits, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX)))
// COPY_BIT: copy the value of COPY_BIT to BIT in bits
#define COPY_BIT(bits, COPY_BIT, BIT) SET_BIT(bits, BIT, TEST(bits, COPY_BIT))
// TEST_ENDSTOP: test the old and the current status of an endstop // TEST_ENDSTOP: test the old and the current status of an endstop
#define TEST_ENDSTOPS(AXIS, MINMAX) (TEST(current_endstop_bits, _ENDSTOP(AXIS, MINMAX)) && TEST(old_endstop_bits, _ENDSTOP(AXIS, MINMAX))) #define TEST_ENDSTOP(ENDSTOP) (TEST(current_endstop_bits, ENDSTOP) && TEST(old_endstop_bits, ENDSTOP))
// TEST_DUAL_ENDSTOP: same like TEST_ENDSTOP for dual endstops
#define TEST_DUAL_ENDSTOPS(AXIS, MINMAX) (TEST(current_dual_endstop_bits, _ENDSTOP(AXIS, MINMAX)) && TEST(old_dual_endstop_bits, _ENDSTOP(AXIS, MINMAX)))
#define UPDATE_ENDSTOP(AXIS,MINMAX) \ #define UPDATE_ENDSTOP(AXIS,MINMAX) \
GET_ENDSTOP_STATUS(current_endstop_bits, AXIS, MINMAX); \ SET_ENDSTOP_BIT(AXIS, MINMAX); \
if (TEST_ENDSTOPS(AXIS, MINMAX) && (current_block->steps[_AXIS(AXIS)] > 0)) { \ if (TEST_ENDSTOP(_ENDSTOP(AXIS, MINMAX)) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \ endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \
_ENDSTOP_HIT(AXIS); \ _ENDSTOP_HIT(AXIS); \
step_events_completed = current_block->step_event_count; \ step_events_completed = current_block->step_event_count; \
...@@ -548,22 +550,20 @@ ISR(TIMER1_COMPA_vect) { ...@@ -548,22 +550,20 @@ ISR(TIMER1_COMPA_vect) {
#if HAS_Z_MIN #if HAS_Z_MIN
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
GET_ENDSTOP_STATUS(current_endstop_bits, Z, MIN); SET_ENDSTOP_BIT(Z, MIN);
#if HAS_Z2_MIN #if HAS_Z2_MIN
GET_ENDSTOP_STATUS(current_dual_endstop_bits, Z, MIN); SET_ENDSTOP_BIT(Z2, MIN);
#else
COPY_BIT(current_endstop_bits, Z_MIN, Z2_MIN)
#endif #endif
bool z_test = TEST_ENDSTOPS(Z, MIN) byte z_test = TEST_ENDSTOP(Z_MIN) << 0 + TEST_ENDSTOP(Z2_MIN) << 1; // bit 0 for Z, bit 1 for Z2
#if HAS_Z2_MIN
&& TEST_DUAL_ENDSTOPS(Z, MIN)
#endif
;
if (z_test && current_block->steps[Z_AXIS] > 0) { if (z_test && current_block->steps[Z_AXIS] > 0) { // z_test = Z_MIN || Z2_MIN
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_MIN); endstop_hit_bits |= BIT(Z_MIN);
if (!performing_homing || (performing_homing && !z_test)) //if not performing home or if both endstops were trigged during homing... if (!performing_homing || (performing_homing && !((~z_test) & 0x3))) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count; //!((~z_test) & 0x3) = Z_MIN && Z2_MIN
} }
#else // !Z_DUAL_ENDSTOPS #else // !Z_DUAL_ENDSTOPS
...@@ -573,10 +573,9 @@ ISR(TIMER1_COMPA_vect) { ...@@ -573,10 +573,9 @@ ISR(TIMER1_COMPA_vect) {
#ifdef Z_PROBE_ENDSTOP #ifdef Z_PROBE_ENDSTOP
UPDATE_ENDSTOP(Z, PROBE); UPDATE_ENDSTOP(Z, PROBE);
GET_ENDSTOP_STATUS(current_endstop_bits, Z, PROBE); SET_ENDSTOP_BIT(Z, PROBE);
if(TEST_ENDSTOPS(Z, PROBE)) if (TEST_ENDSTOP(Z_PROBE)) {
{
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_PROBE); endstop_hit_bits |= BIT(Z_PROBE);
} }
...@@ -587,22 +586,20 @@ ISR(TIMER1_COMPA_vect) { ...@@ -587,22 +586,20 @@ ISR(TIMER1_COMPA_vect) {
#ifdef Z_DUAL_ENDSTOPS #ifdef Z_DUAL_ENDSTOPS
GET_ENDSTOP_STATUS(current_endstop_bits, Z, MAX); SET_ENDSTOP_BIT(Z, MAX);
#if HAS_Z2_MAX #if HAS_Z2_MAX
GET_ENDSTOP_STATUS(current_dual_endstop_bits, Z, MAX); SET_ENDSTOP_BIT(Z2, MAX);
#else
COPY_BIT(current_endstop_bits, Z_MAX, Z2_MAX)
#endif #endif
bool z_test = TEST_ENDSTOPS(Z, MAX) byte z_test = TEST_ENDSTOP(Z_MAX) << 0 + TEST_ENDSTOP(Z2_MAX) << 1; // bit 0 for Z, bit 1 for Z2
#if HAS_Z2_MAX
&& TEST_DUAL_ENDSTOPS(Z, MAX)
#endif
;
if (z_test && current_block->steps[Z_AXIS] > 0) { if (z_test && current_block->steps[Z_AXIS] > 0) { // t_test = Z_MAX || Z2_MAX
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS]; endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
endstop_hit_bits |= BIT(Z_MIN); endstop_hit_bits |= BIT(Z_MIN);
if (!performing_homing || (performing_homing && !z_test)) //if not performing home or if both endstops were trigged during homing... if (!performing_homing || (performing_homing && !((~z_test) & 0x3))) //if not performing home or if both endstops were trigged during homing...
step_events_completed = current_block->step_event_count; step_events_completed = current_block->step_event_count; //!((~z_test) & 0x3) = Z_MAX && Z2_MAX
} }
#else // !Z_DUAL_ENDSTOPS #else // !Z_DUAL_ENDSTOPS
...@@ -614,9 +611,6 @@ ISR(TIMER1_COMPA_vect) { ...@@ -614,9 +611,6 @@ ISR(TIMER1_COMPA_vect) {
} }
old_endstop_bits = current_endstop_bits; old_endstop_bits = current_endstop_bits;
#ifdef Z_DUAL_ENDSTOPS
old_dual_endstop_bits = current_dual_endstop_bits;
#endif
} }
...@@ -921,21 +915,21 @@ void st_init() { ...@@ -921,21 +915,21 @@ void st_init() {
#if HAS_X_MIN #if HAS_X_MIN
SET_INPUT(X_MIN_PIN); SET_INPUT(X_MIN_PIN);
#ifdef ENDSTOPPULLUP_XMIN #ifdef ENDSTOPPULLUP_XMIN
WRITE(X_MIN_PIN, HIGH); WRITE(X_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MIN #if HAS_Y_MIN
SET_INPUT(Y_MIN_PIN); SET_INPUT(Y_MIN_PIN);
#ifdef ENDSTOPPULLUP_YMIN #ifdef ENDSTOPPULLUP_YMIN
WRITE(Y_MIN_PIN, HIGH); WRITE(Y_MIN_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MIN #if HAS_Z_MIN
SET_INPUT(Z_MIN_PIN); SET_INPUT(Z_MIN_PIN);
#ifdef ENDSTOPPULLUP_ZMIN #ifdef ENDSTOPPULLUP_ZMIN
WRITE(Z_MIN_PIN, HIGH); WRITE(Z_MIN_PIN,HIGH);
#endif #endif
#endif #endif
...@@ -949,35 +943,35 @@ void st_init() { ...@@ -949,35 +943,35 @@ void st_init() {
#if HAS_X_MAX #if HAS_X_MAX
SET_INPUT(X_MAX_PIN); SET_INPUT(X_MAX_PIN);
#ifdef ENDSTOPPULLUP_XMAX #ifdef ENDSTOPPULLUP_XMAX
WRITE(X_MAX_PIN, HIGH); WRITE(X_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Y_MAX #if HAS_Y_MAX
SET_INPUT(Y_MAX_PIN); SET_INPUT(Y_MAX_PIN);
#ifdef ENDSTOPPULLUP_YMAX #ifdef ENDSTOPPULLUP_YMAX
WRITE(Y_MAX_PIN, HIGH); WRITE(Y_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z_MAX #if HAS_Z_MAX
SET_INPUT(Z_MAX_PIN); SET_INPUT(Z_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX #ifdef ENDSTOPPULLUP_ZMAX
WRITE(Z_MAX_PIN, HIGH); WRITE(Z_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if HAS_Z2_MAX #if HAS_Z2_MAX
SET_INPUT(Z2_MAX_PIN); SET_INPUT(Z2_MAX_PIN);
#ifdef ENDSTOPPULLUP_ZMAX #ifdef ENDSTOPPULLUP_ZMAX
WRITE(Z2_MAX_PIN, HIGH); WRITE(Z2_MAX_PIN,HIGH);
#endif #endif
#endif #endif
#if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used. #if (defined(Z_PROBE_PIN) && Z_PROBE_PIN >= 0) && defined(Z_PROBE_ENDSTOP) // Check for Z_PROBE_ENDSTOP so we don't pull a pin high unless it's to be used.
SET_INPUT(Z_PROBE_PIN); SET_INPUT(Z_PROBE_PIN);
#ifdef ENDSTOPPULLUP_ZPROBE #ifdef ENDSTOPPULLUP_ZPROBE
WRITE(Z_PROBE_PIN, HIGH); WRITE(Z_PROBE_PIN,HIGH);
#endif #endif
#endif #endif
......
...@@ -53,9 +53,9 @@ uint8_t u8g_dev_rrd_st7920_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, vo ...@@ -53,9 +53,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:
{ {
OUT_WRITE(ST7920_CS_PIN, LOW); OUT_WRITE(ST7920_CS_PIN,LOW);
OUT_WRITE(ST7920_DAT_PIN, LOW); OUT_WRITE(ST7920_DAT_PIN,LOW);
OUT_WRITE(ST7920_CLK_PIN, HIGH); OUT_WRITE(ST7920_CLK_PIN,HIGH);
ST7920_CS(); ST7920_CS();
u8g_Delay(120); //initial delay for boot up u8g_Delay(120); //initial delay for boot up
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment