Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
89caa423
Commit
89caa423
authored
May 24, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Same fix
parent
29907c62
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
184 additions
and
137 deletions
+184
-137
Configuration.h
MarlinKimbra/Configuration.h
+3
-3
Marlin.h
MarlinKimbra/Marlin.h
+1
-1
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+118
-65
conditionals.h
MarlinKimbra/conditionals.h
+17
-17
stepper.cpp
MarlinKimbra/stepper.cpp
+42
-48
ultralcd_st7920_u8glib_rrd.h
MarlinKimbra/ultralcd_st7920_u8glib_rrd.h
+3
-3
No files found.
MarlinKimbra/Configuration.h
View file @
89caa423
MarlinKimbra/Marlin.h
View file @
89caa423
...
...
@@ -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
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
disable_all_steppers
();
...
...
MarlinKimbra/Marlin_main.cpp
View file @
89caa423
...
...
@@ -240,6 +240,7 @@ bool axis_known_position[3] = { false };
static
long
gcode_N
,
gcode_LastN
,
Stopped_gcode_LastN
=
0
;
static
char
*
current_command
,
*
current_command_args
;
static
int
cmd_queue_index_r
=
0
;
static
int
cmd_queue_index_w
=
0
;
static
int
commands_in_queue
=
0
;
...
...
@@ -269,8 +270,8 @@ static bool relative_mode = false; //Determines Absolute or Relative Coordinate
static
char
serial_char
;
static
int
serial_count
=
0
;
static
boolean
comment_mode
=
false
;
static
char
*
s
trchr_pointer
;
///
< A pointer to find chars in the command string (X, Y, Z, E, etc.)
const
char
*
queued_commands_P
=
NULL
;
/* pointer to the current line in the active sequence of commands, or NULL when none */
static
char
*
s
een_pointer
;
//
< A pointer to find chars in the command string (X, Y, Z, E, etc.)
const
char
*
queued_commands_P
=
NULL
;
/* pointer to the current line in the active sequence of commands, or NULL when none */
const
int
sensitive_pins
[]
=
SENSITIVE_PINS
;
///< Sensitive pin list for M42
// Inactivity shutdown
millis_t
previous_cmd_ms
=
0
;
...
...
@@ -872,8 +873,8 @@ void get_command() {
#endif
if
(
strchr
(
command
,
'N'
)
!=
NULL
)
{
s
trchr
_pointer
=
strchr
(
command
,
'N'
);
gcode_N
=
(
strtol
(
s
trchr
_pointer
+
1
,
NULL
,
10
));
s
een
_pointer
=
strchr
(
command
,
'N'
);
gcode_N
=
(
strtol
(
s
een
_pointer
+
1
,
NULL
,
10
));
if
(
gcode_N
!=
gcode_LastN
+
1
&&
strstr_P
(
command
,
PSTR
(
"M110"
))
==
NULL
)
{
gcode_line_error
(
PSTR
(
MSG_ERR_LINE_NO
));
return
;
...
...
@@ -883,9 +884,9 @@ void get_command() {
byte
checksum
=
0
;
byte
count
=
0
;
while
(
command
[
count
]
!=
'*'
)
checksum
^=
command
[
count
++
];
s
trchr
_pointer
=
strchr
(
command
,
'*'
);
s
een
_pointer
=
strchr
(
command
,
'*'
);
if
(
strtol
(
s
trchr
_pointer
+
1
,
NULL
,
10
)
!=
checksum
)
{
if
(
strtol
(
s
een
_pointer
+
1
,
NULL
,
10
)
!=
checksum
)
{
gcode_line_error
(
PSTR
(
MSG_ERR_CHECKSUM_MISMATCH
));
return
;
}
...
...
@@ -907,8 +908,8 @@ void get_command() {
}
if
(
strchr
(
command
,
'G'
)
!=
NULL
)
{
s
trchr
_pointer
=
strchr
(
command
,
'G'
);
switch
(
strtol
(
s
trchr
_pointer
+
1
,
NULL
,
10
))
{
s
een
_pointer
=
strchr
(
command
,
'G'
);
switch
(
strtol
(
s
een
_pointer
+
1
,
NULL
,
10
))
{
case
0
:
case
1
:
case
2
:
...
...
@@ -1001,32 +1002,32 @@ void get_command() {
bool
code_has_value
()
{
int
i
=
1
;
char
c
=
s
trchr
_pointer
[
i
];
if
(
c
==
'-'
||
c
==
'+'
)
c
=
s
trchr
_pointer
[
++
i
];
if
(
c
==
'.'
)
c
=
s
trchr
_pointer
[
++
i
];
char
c
=
s
een
_pointer
[
i
];
if
(
c
==
'-'
||
c
==
'+'
)
c
=
s
een
_pointer
[
++
i
];
if
(
c
==
'.'
)
c
=
s
een
_pointer
[
++
i
];
return
(
c
>=
'0'
&&
c
<=
'9'
);
}
float
code_value
()
{
float
ret
;
char
*
e
=
strchr
(
s
trchr
_pointer
,
'E'
);
char
*
e
=
strchr
(
s
een
_pointer
,
'E'
);
if
(
e
)
{
*
e
=
0
;
ret
=
strtod
(
s
trchr_pointer
+
1
,
NULL
);
ret
=
strtod
(
s
een_pointer
+
1
,
NULL
);
*
e
=
'E'
;
}
else
ret
=
strtod
(
s
trchr_pointer
+
1
,
NULL
);
ret
=
strtod
(
s
een_pointer
+
1
,
NULL
);
return
ret
;
}
long
code_value_long
()
{
return
strtol
(
s
trchr
_pointer
+
1
,
NULL
,
10
);
}
long
code_value_long
()
{
return
strtol
(
s
een
_pointer
+
1
,
NULL
,
10
);
}
int16_t
code_value_short
()
{
return
(
int16_t
)
strtol
(
s
trchr
_pointer
+
1
,
NULL
,
10
);
}
int16_t
code_value_short
()
{
return
(
int16_t
)
strtol
(
s
een
_pointer
+
1
,
NULL
,
10
);
}
bool
code_seen
(
char
code
)
{
s
trchr
_pointer
=
strchr
(
command_queue
[
cmd_queue_index_r
],
code
);
return
(
s
trchr
_pointer
!=
NULL
);
//Return True if a character was found
s
een
_pointer
=
strchr
(
command_queue
[
cmd_queue_index_r
],
code
);
return
(
s
een
_pointer
!=
NULL
);
//Return True if a character was found
}
#define DEFINE_PGM_READ_ANY(type, reader) \
...
...
@@ -2609,6 +2610,11 @@ void gcode_get_destination() {
}
}
void
unknown_command_error
()
{
ECHO_SMV
(
DB
,
MSG_UNKNOWN_COMMAND
,
current_command
);
ECHO_M
(
"
\"\n
"
);
}
/**
* G0, G1: Coordinated movement of X Y Z E axes
*/
...
...
@@ -3692,7 +3698,7 @@ inline void gcode_G92() {
* M1: // M1 - Conditional stop - Wait for user button press on LCD
*/
inline
void
gcode_M0_M1
()
{
char
*
src
=
s
trchr
_pointer
+
2
;
char
*
src
=
s
een
_pointer
+
2
;
millis_t
codenum
=
0
;
bool
hasP
=
false
,
hasS
=
false
;
...
...
@@ -3826,7 +3832,7 @@ inline void gcode_M17() {
* M23: Select a file
*/
inline
void
gcode_M23
()
{
char
*
codepos
=
s
trchr
_pointer
+
4
;
char
*
codepos
=
s
een
_pointer
+
4
;
char
*
starpos
=
strchr
(
codepos
,
'*'
);
if
(
starpos
)
*
starpos
=
'\0'
;
card
.
openFile
(
codepos
,
true
);
...
...
@@ -3869,11 +3875,11 @@ inline void gcode_M17() {
* M28: Start SD Write
*/
inline
void
gcode_M28
()
{
char
*
codepos
=
s
trchr
_pointer
+
4
;
char
*
codepos
=
s
een
_pointer
+
4
;
char
*
starpos
=
strchr
(
codepos
,
'*'
);
if
(
starpos
)
{
char
*
npos
=
strchr
(
command_queue
[
cmd_queue_index_r
],
'N'
);
s
trchr
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
s
een
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
*
(
starpos
)
=
'\0'
;
}
card
.
openFile
(
codepos
,
false
);
...
...
@@ -3893,13 +3899,13 @@ inline void gcode_M17() {
inline
void
gcode_M30
()
{
if
(
card
.
cardOK
)
{
card
.
closeFile
();
char
*
starpos
=
strchr
(
s
trchr
_pointer
+
4
,
'*'
);
char
*
starpos
=
strchr
(
s
een
_pointer
+
4
,
'*'
);
if
(
starpos
)
{
char
*
npos
=
strchr
(
command_queue
[
cmd_queue_index_r
],
'N'
);
s
trchr
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
s
een
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
*
(
starpos
)
=
'\0'
;
}
card
.
removeFile
(
s
trchr
_pointer
+
4
);
card
.
removeFile
(
s
een
_pointer
+
4
);
}
}
#endif
...
...
@@ -3927,46 +3933,60 @@ inline void gcode_M31() {
if
(
card
.
sdprinting
)
st_synchronize
();
char
*
codepos
=
strchr_pointer
+
4
;
char
*
namestartpos
=
strchr
(
codepos
,
'!'
);
//find ! to indicate filename string start.
if
(
!
namestartpos
)
namestartpos
=
codepos
;
//default name position, 4 letters after the M
char
*
namestartpos
=
strchr
(
current_command_args
,
'!'
);
// Find ! to indicate filename string start.
if
(
!
namestartpos
)
namestartpos
=
current_command_args
;
// Default name position, 4 letters after the M
else
namestartpos
++
;
//to skip the '!'
char
*
starpos
=
strchr
(
codepos
,
'*'
);
if
(
starpos
)
*
(
starpos
)
=
'\0'
;
namestartpos
++
;
// to skip the '!'
bool
call_procedure
=
code_seen
(
'P'
)
&&
(
s
trchr
_pointer
<
namestartpos
);
bool
call_procedure
=
code_seen
(
'P'
)
&&
(
s
een
_pointer
<
namestartpos
);
if
(
card
.
cardOK
)
{
card
.
openFile
(
namestartpos
,
true
,
!
call_procedure
);
if
(
code_seen
(
'S'
)
&&
s
trchr
_pointer
<
namestartpos
)
// "S" (must occur _before_ the filename!)
if
(
code_seen
(
'S'
)
&&
s
een
_pointer
<
namestartpos
)
// "S" (must occur _before_ the filename!)
card
.
setIndex
(
code_value_short
());
card
.
startFileprint
();
if
(
!
call_procedure
)
{
print_job_start_ms
=
millis
();
//procedure calls count as normal print time.
#if HAS_POWER_CONSUMPTION_SENSOR
startpower
=
power_consumption_hour
;
#endif
if
(
!
call_procedure
)
print_job_start_ms
=
millis
();
// procedure calls count as normal print time.
}
}
#ifdef LONG_FILENAME_HOST_SUPPORT
/**
* M33: Get the long full path of a file or folder
*
* Parameters:
* <dospath> Case-insensitive DOS-style path to a file or folder
*
* Example:
* M33 miscel~1/armchair/armcha~1.gco
*
* Output:
* /Miscellaneous/Armchair/Armchair.gcode
*/
inline
void
gcode_M33
()
{
char
*
args
=
seen_pointer
+
4
;
while
(
*
args
==
' '
)
++
args
;
clear_asterisk
(
args
);
card
.
printLongPath
(
args
);
}
#endif
/**
* M928: Start SD Write
*/
inline
void
gcode_M928
()
{
char
*
starpos
=
strchr
(
s
trchr
_pointer
+
5
,
'*'
);
char
*
starpos
=
strchr
(
s
een
_pointer
+
5
,
'*'
);
if
(
starpos
)
{
char
*
npos
=
strchr
(
command_queue
[
cmd_queue_index_r
],
'N'
);
s
trchr
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
s
een
_pointer
=
strchr
(
npos
,
' '
)
+
1
;
*
(
starpos
)
=
'\0'
;
}
card
.
openLogFile
(
s
trchr
_pointer
+
5
);
card
.
openLogFile
(
s
een
_pointer
+
5
);
}
#endif // SDSUPPORT
...
...
@@ -4554,7 +4574,7 @@ inline void gcode_M115() {
* M117: Set LCD Status Message
*/
inline
void
gcode_M117
()
{
lcd_setstatus
(
s
trchr
_pointer
+
5
);
lcd_setstatus
(
s
een
_pointer
+
5
);
}
#endif
...
...
@@ -5889,8 +5909,7 @@ inline void gcode_M999() {
*
* F[mm/min] Set the movement feedrate
*/
inline
void
gcode_T
()
{
uint16_t
tmp_extruder
=
code_value_short
();
inline
void
gcode_T
(
uint8_t
tmp_extruder
)
{
long
csteps
;
if
(
tmp_extruder
>=
EXTRUDERS
)
{
ECHO_SMV
(
DB
,
"T"
,
tmp_extruder
);
...
...
@@ -6128,22 +6147,53 @@ inline void gcode_T() {
* This is called from the main loop()
*/
void
process_next_command
()
{
current_command
=
command_queue
[
cmd_queue_index_r
];
if
((
debugLevel
&
DEBUG_ECHO
))
{
ECHO_LV
(
DB
,
command_queue
[
cmd_queue_index_r
]);
ECHO_LV
(
DB
,
current_command
);
}
// Sanitize the current command:
// - Skip leading spaces
// - Bypass N...
// - Overwrite * with nul to mark the end
while
(
*
current_command
==
' '
)
++
current_command
;
if
(
*
current_command
==
'N'
&&
current_command
[
1
]
>=
'0'
&&
current_command
[
1
]
<=
'9'
)
{
while
(
*
current_command
!=
' '
)
++
current_command
;
while
(
*
current_command
==
' '
)
++
current_command
;
}
char
*
starpos
=
strchr
(
current_command
,
'*'
);
// * should always be the last parameter
if
(
starpos
)
*
starpos
=
'\0'
;
// Get the command code, which must be G, M, or T
char
command_code
=
*
current_command
;
// The code must have a numeric value
bool
code_is_good
=
(
current_command
[
1
]
>=
'0'
&&
current_command
[
1
]
<=
'9'
);
int
codenum
;
// define ahead of goto
if
(
code_seen
(
'G'
))
{
// Bail early if there's no code
if
(
!
code_is_good
)
goto
ExitUnknownCommand
;
int
codenum
=
code_value_short
();
// Args pointer optimizes code_seen, especially those taking XYZEF
// This wastes a little cpu on commands that expect no arguments.
current_command_args
=
current_command
;
while
(
*
current_command_args
!=
' '
)
++
current_command_args
;
while
(
*
current_command_args
==
' '
)
++
current_command_args
;
switch
(
codenum
)
{
// Interpret the code int
seen_pointer
=
current_command
;
codenum
=
code_value_short
();
// Handle a known G, M, or T
switch
(
command_code
)
{
case
'G'
:
switch
(
codenum
)
{
//G0 -> G1
case
0
:
case
1
:
gcode_G0_G1
();
break
;
gcode_G0_G1
();
break
;
// G2, G3
#ifndef SCARA
...
...
@@ -6195,11 +6245,12 @@ void process_next_command() {
relative_mode
=
true
;
break
;
case
92
:
// G92
gcode_G92
();
break
;
default:
code_is_good
=
false
;
}
}
break
;
else
if
(
code_seen
(
'M'
))
{
switch
(
code_value_short
())
{
case
'M'
:
switch
(
codenum
)
{
#ifdef ULTIPANEL
case
0
:
// M0 - Unconditional stop - Wait for user button press on LCD
case
1
:
// M1 - Conditional stop - Wait for user button press on LCD
...
...
@@ -6529,17 +6580,19 @@ void process_next_command() {
gcode_SET_Z_PROBE_OFFSET
();
break
;
#endif // CUSTOM_M_CODE_SET_Z_PROBE_OFFSET
default:
code_is_good
=
false
;
}
}
break
;
else
if
(
code_seen
(
'T'
))
{
gcode_T
();
case
'T'
:
gcode_T
(
codenum
);
break
;
}
else
{
ECHO_SM
(
ER
,
MSG_UNKNOWN_COMMAND
);
ECHO_EVM
(
command_queue
[
cmd_queue_index_r
],
"
\"
"
);
}
ExitUnknownCommand:
// Still unknown command? Throw an error
if
(
!
code_is_good
)
unknown_command_error
();
ok_to_send
();
}
...
...
MarlinKimbra/conditionals.h
View file @
89caa423
...
...
@@ -226,6 +226,23 @@
#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 AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
...
...
@@ -289,23 +306,6 @@
#define BAUDRATE 115200 // Baudrate setting to 115200 because serial monitor arduino function at max 115200 baudrate.
#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
*/
...
...
MarlinKimbra/stepper.cpp
View file @
89caa423
...
...
@@ -76,9 +76,10 @@ volatile long endstops_trigsteps[3] = { 0 };
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
char
old_endstop_bits
=
0
;
// use X_MIN, X_MAX... Z_MAX, Z_PROBE
#ifdef Z_DUAL_ENDSTOPS
static
char
old_dual_endstop_bits
=
0
;
// actually only implemented for Z
#ifndef Z_DUAL_ENDSTOPS
static
byte
old_endstop_bits
=
0
;
// use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#else
static
uint16_t
old_endstop_bits
=
0
;
// use X_MIN, X_MAX... Z_MAX, Z_PROBE, Z2_MIN, Z2_MAX
#endif
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
...
...
@@ -136,10 +137,10 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 };
if (performing_homing) { \
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_
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 {\
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 { \
Z_STEP_WRITE(v); \
...
...
@@ -466,9 +467,10 @@ ISR(TIMER1_COMPA_vect) {
// Check endstops
if
(
check_endstops
)
{
char
current_endstop_bits
;
#ifdef Z_DUAL_ENDSTOPS
char
current_dual_endstop_bits
;
uint16_t
current_endstop_bits
;
#else
byte
current_endstop_bits
;
#endif
#define _ENDSTOP_PIN(AXIS, MINMAX) AXIS ##_## MINMAX ##_PIN
...
...
@@ -477,16 +479,16 @@ ISR(TIMER1_COMPA_vect) {
#define _ENDSTOP_HIT(AXIS) endstop_hit_bits |= BIT(_ENDSTOP(AXIS, MIN))
#define _ENDSTOP(AXIS, MINMAX) AXIS ##_## MINMAX
// GET_ENDSTOP_STATUS: 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)))
// SET_ENDSTOP_BIT: set the current endstop bits for an endstop to its status
#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
#define TEST_ENDSTOPS(AXIS, MINMAX) (TEST(current_endstop_bits, _ENDSTOP(AXIS, MINMAX)) && TEST(old_endstop_bits, _ENDSTOP(AXIS, MINMAX)))
// 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 TEST_ENDSTOP(ENDSTOP) (TEST(current_endstop_bits, ENDSTOP) && TEST(old_endstop_bits, ENDSTOP))
#define UPDATE_ENDSTOP(AXIS,MINMAX) \
GET_ENDSTOP_STATUS(current_endstop_bits,
AXIS, MINMAX); \
if (TEST_ENDSTOP
S(AXIS, MINMAX
) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
SET_ENDSTOP_BIT(
AXIS, MINMAX); \
if (TEST_ENDSTOP
(_ENDSTOP(AXIS, MINMAX)
) && (current_block->steps[_AXIS(AXIS)] > 0)) { \
endstops_trigsteps[_AXIS(AXIS)] = count_position[_AXIS(AXIS)]; \
_ENDSTOP_HIT(AXIS); \
step_events_completed = current_block->step_event_count; \
...
...
@@ -548,22 +550,20 @@ ISR(TIMER1_COMPA_vect) {
#if HAS_Z_MIN
#ifdef Z_DUAL_ENDSTOPS
GET_ENDSTOP_STATUS
(
current_endstop_bits
,
Z
,
MIN
);
SET_ENDSTOP_BIT
(
Z
,
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
bool
z_test
=
TEST_ENDSTOPS
(
Z
,
MIN
)
#if HAS_Z2_MIN
&&
TEST_DUAL_ENDSTOPS
(
Z
,
MIN
)
#endif
;
byte
z_test
=
TEST_ENDSTOP
(
Z_MIN
)
<<
0
+
TEST_ENDSTOP
(
Z2_MIN
)
<<
1
;
// bit 0 for Z, bit 1 for Z2
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
];
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...
step_events_completed
=
current_block
->
step_event_count
;
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
;
//!((~z_test) & 0x3) = Z_MIN && Z2_MIN
}
#else // !Z_DUAL_ENDSTOPS
...
...
@@ -573,10 +573,9 @@ ISR(TIMER1_COMPA_vect) {
#ifdef Z_PROBE_ENDSTOP
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
];
endstop_hit_bits
|=
BIT
(
Z_PROBE
);
}
...
...
@@ -587,22 +586,20 @@ ISR(TIMER1_COMPA_vect) {
#ifdef Z_DUAL_ENDSTOPS
GET_ENDSTOP_STATUS
(
current_endstop_bits
,
Z
,
MAX
);
SET_ENDSTOP_BIT
(
Z
,
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
bool
z_test
=
TEST_ENDSTOPS
(
Z
,
MAX
)
#if HAS_Z2_MAX
&&
TEST_DUAL_ENDSTOPS
(
Z
,
MAX
)
#endif
;
byte
z_test
=
TEST_ENDSTOP
(
Z_MAX
)
<<
0
+
TEST_ENDSTOP
(
Z2_MAX
)
<<
1
;
// bit 0 for Z, bit 1 for Z2
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
];
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...
step_events_completed
=
current_block
->
step_event_count
;
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
;
//!((~z_test) & 0x3) = Z_MAX && Z2_MAX
}
#else // !Z_DUAL_ENDSTOPS
...
...
@@ -614,9 +611,6 @@ ISR(TIMER1_COMPA_vect) {
}
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() {
#if HAS_X_MIN
SET_INPUT
(
X_MIN_PIN
);
#ifdef ENDSTOPPULLUP_XMIN
WRITE
(
X_MIN_PIN
,
HIGH
);
WRITE
(
X_MIN_PIN
,
HIGH
);
#endif
#endif
#if HAS_Y_MIN
SET_INPUT
(
Y_MIN_PIN
);
#ifdef ENDSTOPPULLUP_YMIN
WRITE
(
Y_MIN_PIN
,
HIGH
);
WRITE
(
Y_MIN_PIN
,
HIGH
);
#endif
#endif
#if HAS_Z_MIN
SET_INPUT
(
Z_MIN_PIN
);
#ifdef ENDSTOPPULLUP_ZMIN
WRITE
(
Z_MIN_PIN
,
HIGH
);
WRITE
(
Z_MIN_PIN
,
HIGH
);
#endif
#endif
...
...
@@ -949,35 +943,35 @@ void st_init() {
#if HAS_X_MAX
SET_INPUT
(
X_MAX_PIN
);
#ifdef ENDSTOPPULLUP_XMAX
WRITE
(
X_MAX_PIN
,
HIGH
);
WRITE
(
X_MAX_PIN
,
HIGH
);
#endif
#endif
#if HAS_Y_MAX
SET_INPUT
(
Y_MAX_PIN
);
#ifdef ENDSTOPPULLUP_YMAX
WRITE
(
Y_MAX_PIN
,
HIGH
);
WRITE
(
Y_MAX_PIN
,
HIGH
);
#endif
#endif
#if HAS_Z_MAX
SET_INPUT
(
Z_MAX_PIN
);
#ifdef ENDSTOPPULLUP_ZMAX
WRITE
(
Z_MAX_PIN
,
HIGH
);
WRITE
(
Z_MAX_PIN
,
HIGH
);
#endif
#endif
#if HAS_Z2_MAX
SET_INPUT
(
Z2_MAX_PIN
);
#ifdef ENDSTOPPULLUP_ZMAX
WRITE
(
Z2_MAX_PIN
,
HIGH
);
WRITE
(
Z2_MAX_PIN
,
HIGH
);
#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.
SET_INPUT
(
Z_PROBE_PIN
);
#ifdef ENDSTOPPULLUP_ZPROBE
WRITE
(
Z_PROBE_PIN
,
HIGH
);
WRITE
(
Z_PROBE_PIN
,
HIGH
);
#endif
#endif
...
...
MarlinKimbra/ultralcd_st7920_u8glib_rrd.h
View file @
89caa423
...
...
@@ -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
:
{
OUT_WRITE
(
ST7920_CS_PIN
,
LOW
);
OUT_WRITE
(
ST7920_DAT_PIN
,
LOW
);
OUT_WRITE
(
ST7920_CLK_PIN
,
HIGH
);
OUT_WRITE
(
ST7920_CS_PIN
,
LOW
);
OUT_WRITE
(
ST7920_DAT_PIN
,
LOW
);
OUT_WRITE
(
ST7920_CLK_PIN
,
HIGH
);
ST7920_CS
();
u8g_Delay
(
120
);
//initial delay for boot up
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment