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
b1fb1c6a
Commit
b1fb1c6a
authored
Apr 02, 2016
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update laser patches for marlinkimbra changes
parent
9348f6ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
35 deletions
+25
-35
MK_Main.cpp
MK/module/MK_Main.cpp
+19
-25
laser.cpp
MK/module/laser/laser.cpp
+6
-10
No files found.
MK/module/MK_Main.cpp
View file @
b1fb1c6a
...
@@ -2940,16 +2940,14 @@ inline void gcode_G2_G3(bool clockwise) {
...
@@ -2940,16 +2940,14 @@ inline void gcode_G2_G3(bool clockwise) {
gcode_get_destination
();
gcode_get_destination
();
#if ENABLED(LASER) && ENABLED(LASER_FIRE_G1)
#if ENABLED(LASER) && ENABLED(LASER_FIRE_G1)
if
(
lfire
)
{
if
(
code_seen
(
'S'
)
&&
IsRunning
())
laser
.
intensity
=
(
float
)
code_value
();
if
(
code_seen
(
'S'
)
&&
IsRunning
())
laser
.
intensity
=
(
float
)
code_value
();
if
(
code_seen
(
'L'
)
&&
IsRunning
())
laser
.
duration
=
(
unsigned
long
)
labs
(
code_value
());
if
(
code_seen
(
'L'
)
&&
IsRunning
())
laser
.
duration
=
(
unsigned
long
)
labs
(
code_value
());
if
(
code_seen
(
'P'
)
&&
IsRunning
())
laser
.
ppm
=
(
float
)
code_value
();
if
(
code_seen
(
'P'
)
&&
IsRunning
())
laser
.
ppm
=
(
float
)
code_value
();
if
(
code_seen
(
'D'
)
&&
IsRunning
())
laser
.
diagnostics
=
(
bool
)
code_value
();
if
(
code_seen
(
'D'
)
&&
IsRunning
())
laser
.
diagnostics
=
(
bool
)
code_value
();
if
(
code_seen
(
'B'
)
&&
IsRunning
())
laser_set_mode
((
int
)
code_value
());
if
(
code_seen
(
'B'
)
&&
IsRunning
())
laser_set_mode
((
int
)
code_value
());
laser
.
status
=
LASER_ON
;
laser
.
status
=
LASER_ON
;
laser
.
fired
=
LASER_FIRE_G1
;
laser
.
fired
=
LASER_FIRE_G1
;
}
#endif
#endif
...
@@ -2968,9 +2966,7 @@ inline void gcode_G2_G3(bool clockwise) {
...
@@ -2968,9 +2966,7 @@ inline void gcode_G2_G3(bool clockwise) {
refresh_cmd_timeout
();
refresh_cmd_timeout
();
#if ENABLED(LASER) && ENABLED(LASER_FIRE_G1)
#if ENABLED(LASER) && ENABLED(LASER_FIRE_G1)
if
(
lfire
)
{
laser
.
status
=
LASER_OFF
;
laser
.
status
=
LASER_OFF
;
}
#endif
#endif
}
}
...
@@ -3125,18 +3121,16 @@ inline void gcode_G7() {
...
@@ -3125,18 +3121,16 @@ inline void gcode_G7() {
laser
.
raster_direction
=
(
bool
)
code_value
();
laser
.
raster_direction
=
(
bool
)
code_value
();
destination
[
Y_AXIS
]
=
current_position
[
Y_AXIS
]
+
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_aspect_ratio
);
// increment Y axis
destination
[
Y_AXIS
]
=
current_position
[
Y_AXIS
]
+
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_aspect_ratio
);
// increment Y axis
}
}
if
(
code_seen
(
'D'
))
laser
.
raster_num_pixels
=
base64_decode
(
laser
.
raster_data
,
&
cmdbuffer
[
bufindr
][
strchr_pointer
-
cmdbuffer
[
bufindr
]
+
1
]
,
laser
.
raster_raw_length
);
if
(
code_seen
(
'D'
))
laser
.
raster_num_pixels
=
base64_decode
(
laser
.
raster_data
,
seen_pointer
+
1
,
laser
.
raster_raw_length
);
if
(
!
laser
.
raster_direction
)
{
if
(
!
laser
.
raster_direction
)
{
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
]
-
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_num_pixels
);
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
]
-
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_num_pixels
);
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHO_START
;
ECHO_LM
(
INFO
,
"Negative Raster Line"
);
SERIAL_ECHOLN
(
"Negative Raster Line"
);
}
}
}
else
{
}
else
{
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
]
+
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_num_pixels
);
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
]
+
(
laser
.
raster_mm_per_pulse
*
laser
.
raster_num_pixels
);
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHO_START
;
ECHO_LM
(
INFO
,
"Positive Raster Line"
);
SERIAL_ECHOLN
(
"Positive Raster Line"
);
}
}
}
}
...
@@ -4435,7 +4429,7 @@ inline void gcode_G92() {
...
@@ -4435,7 +4429,7 @@ inline void gcode_G92() {
}
}
#endif //ULTIPANEL
#endif //ULTIPANEL
#if
ENABLED(LASERBEAM) || (ENABLED(LASER) && ENABLED(LASER
_SPINDLE))
#if
(ENABLED(LASERBEAM) || ENABLED(LASER) && ENABLED(LASER_FIRE
_SPINDLE))
/**
/**
* M3: S - Setting laser beam or fire laser
* M3: S - Setting laser beam or fire laser
*/
*/
...
@@ -4448,7 +4442,7 @@ inline void gcode_G92() {
...
@@ -4448,7 +4442,7 @@ inline void gcode_G92() {
laser_ttl_modulation
=
0
;
laser_ttl_modulation
=
0
;
}
}
#endif
#endif
#if ENABLED(LASER) && ENABLED(LASER_SPINDLE)
#if ENABLED(LASER) && ENABLED(LASER_
FIRE_
SPINDLE)
if
(
code_seen
(
'S'
)
&&
IsRunning
())
laser
.
intensity
=
(
float
)
code_value
();
if
(
code_seen
(
'S'
)
&&
IsRunning
())
laser
.
intensity
=
(
float
)
code_value
();
if
(
code_seen
(
'L'
)
&&
IsRunning
())
laser
.
duration
=
(
unsigned
long
)
labs
(
code_value
());
if
(
code_seen
(
'L'
)
&&
IsRunning
())
laser
.
duration
=
(
unsigned
long
)
labs
(
code_value
());
if
(
code_seen
(
'P'
)
&&
IsRunning
())
laser
.
ppm
=
(
float
)
code_value
();
if
(
code_seen
(
'P'
)
&&
IsRunning
())
laser
.
ppm
=
(
float
)
code_value
();
...
@@ -4473,7 +4467,7 @@ inline void gcode_G92() {
...
@@ -4473,7 +4467,7 @@ inline void gcode_G92() {
WRITE
(
LASER_PWR_PIN
,
HIGH
);
WRITE
(
LASER_PWR_PIN
,
HIGH
);
laser_ttl_modulation
=
0
;
laser_ttl_modulation
=
0
;
#endif
#endif
#if ENABLED(LASER) && ENABLED(LASER_SPINDLE)
#if ENABLED(LASER) && ENABLED(LASER_
FIRE_
SPINDLE)
gcode_M3
();
gcode_M3
();
#endif
#endif
...
@@ -4487,7 +4481,7 @@ inline void gcode_G92() {
...
@@ -4487,7 +4481,7 @@ inline void gcode_G92() {
WRITE
(
LASER_PWR_PIN
,
LOW
);
WRITE
(
LASER_PWR_PIN
,
LOW
);
laser_ttl_modulation
=
0
;
laser_ttl_modulation
=
0
;
#endif
#endif
#if ENABLED(LASER) && ENABLED(LASER_SPINDLE)
#if ENABLED(LASER) && ENABLED(LASER_
FIRE_
SPINDLE)
laser
.
status
=
LASER_OFF
;
laser
.
status
=
LASER_OFF
;
lcd_update
();
lcd_update
();
prepare_move
();
prepare_move
();
...
@@ -7038,7 +7032,7 @@ inline void gcode_M503() {
...
@@ -7038,7 +7032,7 @@ inline void gcode_M503() {
if
(
code_seen
(
'B'
)
&&
IsRunning
())
laser_set_mode
((
int
)
code_value
());
if
(
code_seen
(
'B'
)
&&
IsRunning
())
laser_set_mode
((
int
)
code_value
());
if
(
code_seen
(
'R'
)
&&
IsRunning
())
laser
.
raster_mm_per_pulse
=
((
float
)
code_value
());
if
(
code_seen
(
'R'
)
&&
IsRunning
())
laser
.
raster_mm_per_pulse
=
((
float
)
code_value
());
if
(
code_seen
(
'F'
))
{
if
(
code_seen
(
'F'
))
{
next_feedrate
=
code_value
();
float
next_feedrate
=
code_value
();
if
(
next_feedrate
>
0.0
)
feedrate
=
next_feedrate
;
if
(
next_feedrate
>
0.0
)
feedrate
=
next_feedrate
;
}
}
}
}
...
@@ -7632,7 +7626,7 @@ void process_next_command() {
...
@@ -7632,7 +7626,7 @@ void process_next_command() {
// G0 -> G1
// G0 -> G1
case
0
:
case
0
:
case
1
:
case
1
:
gcode_G0_G1
(
codenum
==
1
);
break
;
gcode_G0_G1
(
codenum
==
1
);
break
;
// G2, G3
// G2, G3
#if !MECH(SCARA)
#if !MECH(SCARA)
...
@@ -8997,7 +8991,7 @@ void kill(const char* lcd_msg) {
...
@@ -8997,7 +8991,7 @@ void kill(const char* lcd_msg) {
void
Stop
()
{
void
Stop
()
{
disable_all_heaters
();
disable_all_heaters
();
#ifdef LASER
#ifdef LASER
if
(
laser
.
diagnostics
)
SERIAL_ECHOLN
(
"Laser set to off, stop() called"
);
if
(
laser
.
diagnostics
)
ECHO_LM
(
INFO
,
"Laser set to off, stop() called"
);
laser_extinguish
();
laser_extinguish
();
#endif
#endif
#ifdef LASER_PERIPHERALS
#ifdef LASER_PERIPHERALS
...
...
MK/module/laser/laser.cpp
View file @
b1fb1c6a
...
@@ -123,7 +123,7 @@ void laser_fire(int intensity = 100.0){
...
@@ -123,7 +123,7 @@ void laser_fire(int intensity = 100.0){
#endif
#endif
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHOLN
(
"Laser fired"
);
ECHO_LM
(
INFO
,
"Laser fired"
);
}
}
}
}
void
laser_extinguish
(){
void
laser_extinguish
(){
...
@@ -135,7 +135,7 @@ void laser_extinguish(){
...
@@ -135,7 +135,7 @@ void laser_extinguish(){
laser
.
time
+=
millis
()
-
(
laser
.
last_firing
/
1000
);
laser
.
time
+=
millis
()
-
(
laser
.
last_firing
/
1000
);
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHOLN
(
"Laser extinguished"
);
ECHO_LM
(
INFO
,
"Laser extinguished"
);
}
}
}
}
}
}
...
@@ -159,30 +159,26 @@ bool laser_peripherals_ok(){
...
@@ -159,30 +159,26 @@ bool laser_peripherals_ok(){
void
laser_peripherals_on
(){
void
laser_peripherals_on
(){
digitalWrite
(
LASER_PERIPHERALS_PIN
,
LOW
);
digitalWrite
(
LASER_PERIPHERALS_PIN
,
LOW
);
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHO_START
;
ECHO_LM
(
INFO
,
"Laser Peripherals Enabled"
);
SERIAL_ECHOLNPGM
(
"Laser Peripherals Enabled"
);
}
}
}
}
void
laser_peripherals_off
(){
void
laser_peripherals_off
(){
if
(
!
digitalRead
(
LASER_PERIPHERALS_STATUS_PIN
))
{
if
(
!
digitalRead
(
LASER_PERIPHERALS_STATUS_PIN
))
{
digitalWrite
(
LASER_PERIPHERALS_PIN
,
HIGH
);
digitalWrite
(
LASER_PERIPHERALS_PIN
,
HIGH
);
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHO_START
;
ECHO_LM
(
INFO
,
"Laser Peripherals Disabled"
);
SERIAL_ECHOLNPGM
(
"Laser Peripherals Disabled"
);
}
}
}
}
}
}
void
laser_wait_for_peripherals
()
{
void
laser_wait_for_peripherals
()
{
unsigned
long
timeout
=
millis
()
+
LASER_PERIPHERALS_TIMEOUT
;
unsigned
long
timeout
=
millis
()
+
LASER_PERIPHERALS_TIMEOUT
;
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ECHO_START
;
ECHO_LM
(
INFO
,
"Waiting for peripheral control board signal..."
);
SERIAL_ECHOLNPGM
(
"Waiting for peripheral control board signal..."
);
}
}
while
(
!
laser_peripherals_ok
())
{
while
(
!
laser_peripherals_ok
())
{
if
(
millis
()
>
timeout
)
{
if
(
millis
()
>
timeout
)
{
if
(
laser
.
diagnostics
)
{
if
(
laser
.
diagnostics
)
{
SERIAL_ERROR_START
;
ECHO_LM
(
ERR
,
"Peripheral control board failed to respond"
);
SERIAL_ERRORLNPGM
(
"Peripheral control board failed to respond"
);
}
}
Stop
();
Stop
();
break
;
break
;
...
...
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