Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
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
Printrun
Commits
f2a695ba
Commit
f2a695ba
authored
Jul 17, 2013
by
D1plo1d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a fan speed option and better fan errors to prontserve.
parent
91622f84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
prontserve.py
prontserve.py
+25
-6
No files found.
prontserve.py
View file @
f2a695ba
...
...
@@ -452,6 +452,8 @@ class Prontserve(pronsole.pronsole, EventEmitter):
self
.
settings
.
sensor_poll_rate
=
1
# seconds
self
.
sensors
=
{
'extruder'
:
-
1
,
'bed'
:
-
1
}
self
.
target_values
=
{
'e0'
:
0
,
'b'
:
0
}
self
.
fan_speed
=
255
self
.
fan_enabled
=
False
self
.
load_default_rc
()
self
.
jobs
=
PrintJobQueue
()
self
.
job_id_incr
=
0
...
...
@@ -562,13 +564,30 @@ class Prontserve(pronsole.pronsole, EventEmitter):
setter
(
self
,
kwargs
[
k
])
pprint
({
prefix
:
kwargs
[
k
]})
def
do_set_fan
(
self
,
*
args
):
value
=
{
"on"
:
True
,
"off"
:
False
}[
args
[
0
]
.
lower
()]
if
value
:
self
.
p
.
send_now
(
"M106 S255"
)
def
do_set_fan
(
self
,
*
args
,
**
kwargs
):
states
=
{
"on"
:
True
,
"off"
:
False
}
if
len
(
args
)
==
1
and
len
(
kwargs
)
==
0
and
(
args
[
0
]
in
states
):
self
.
fan_enabled
=
states
[
args
[
0
]
.
lower
()]
self
.
fire
(
"fan_enabled_changed"
,
self
.
fan_enabled
)
elif
"speed"
in
kwargs
:
try
:
self
.
fan_speed
=
float
(
kwargs
[
"speed"
])
except
:
raise
Exception
(
"Fan speed must be a number"
)
self
.
fire
(
"fan_speed_changed"
,
self
.
fan_speed
)
else
:
self
.
p
.
send_now
(
"M106 S0"
)
self
.
fire
(
"fan_speed_changed"
,
255
)
raise
Exception
(
"""
Bad set fan parameters. Please either use `set fan speed: [NUMBER]`
or `set fan [ON|OFF]`.
"""
)
if
self
.
fan_enabled
==
False
:
speed
=
0
else
:
speed
=
int
(
self
.
fan_speed
)
print
"M106 S
%
i"
%
speed
self
.
p
.
send_now
(
"M106 S
%
i"
%
speed
)
def
do_set_motors
(
self
,
*
args
):
value
=
{
"on"
:
True
,
"off"
:
False
}[
args
[
0
]
.
lower
()]
...
...
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