HCoop
/
clinton
/
Smoothieware.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
56d4e14
)
Fixed failure to free memory if TTL pin not used
author
Fred Murphy
<fred27murphy@gmail.com>
Wed, 17 Feb 2016 20:02:59 +0000
(20:02 +0000)
committer
Fred Murphy
<fred27murphy@gmail.com>
Wed, 17 Feb 2016 20:02:59 +0000
(20:02 +0000)
src/modules/tools/laser/Laser.cpp
patch
|
blob
|
blame
|
history
diff --git
a/src/modules/tools/laser/Laser.cpp
b/src/modules/tools/laser/Laser.cpp
index
fdc8dcb
..
f1bb05f
100644
(file)
--- a/
src/modules/tools/laser/Laser.cpp
+++ b/
src/modules/tools/laser/Laser.cpp
@@
-71,8
+71,13
@@
void Laser::on_module_loaded() {
ttl_pin->from_string( THEKERNEL->config->value(laser_module_ttl_pin_checksum)->by_default("nc" )->as_string())->as_output();
this->ttl_used = ttl_pin->connected();
this->ttl_inverting = ttl_pin->inverting;
- if (ttl_used)
+ if (ttl_used)
{
ttl_pin->set(0);
+ } else {
+ delete ttl_pin;
+ ttl_pin = NULL;
+ }
+
this->pwm_pin->period_us(THEKERNEL->config->value(laser_module_pwm_period_checksum)->by_default(20)->as_number());
this->pwm_pin->write(this->pwm_inverting ? 1 : 0);