Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
marlin-anet-a8
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
marlin-anet-a8
Commits
538231ed
Commit
538231ed
authored
Jan 6, 2015
by
Steffen Vogel
Browse files
Options
Downloads
Patches
Plain Diff
cosmetic whitespace cleanup and comments added/updated
parent
00e4bc9f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Marlin/scripts/createTemperatureLookupMarlin.py
+22
-25
22 additions, 25 deletions
Marlin/scripts/createTemperatureLookupMarlin.py
with
22 additions
and
25 deletions
Marlin/scripts/createTemperatureLookupMarlin.py
+
22
−
25
View file @
538231ed
#!/usr/bin/python
#!/usr/bin/python
#
# Creates a C code lookup table for doing ADC to temperature conversion
# on a microcontroller
# based on: http://hydraraptor.blogspot.com/2007/10/measuring-temperature-easy-way.html
"""
Thermistor Value Lookup Table Generator
"""
Thermistor Value Lookup Table Generator
Generates lookup to temperature values for use in a microcontroller in C format based on:
Generates lookup to temperature values for use in a microcontroller in C format based on:
http://
hydraraptor.blogspot.com/2007/10/measuring-temperature-easy-way.html
http://
en.wikipedia.org/wiki/Steinhart-Hart_equation
The main use is for Arduino programs that read data from the circuit board described here:
The main use is for Arduino programs that read data from the circuit board described here:
http://make.rrrf.org/ts-1.0
http://make.rrrf.org/ts-1.0
...
@@ -19,7 +15,7 @@ Options:
...
@@ -19,7 +15,7 @@ Options:
--t1=ttt:rrr low temperature temperature:resistance point (around 25C)
--t1=ttt:rrr low temperature temperature:resistance point (around 25C)
--t2=ttt:rrr middle temperature temperature:resistance point (around 150C)
--t2=ttt:rrr middle temperature temperature:resistance point (around 150C)
--t3=ttt:rrr high temperature temperature:resistance point (around 250C)
--t3=ttt:rrr high temperature temperature:resistance point (around 250C)
--num-temps=... the number of temperature points to calculate (default:
20
)
--num-temps=... the number of temperature points to calculate (default:
36
)
"""
"""
from
math
import
*
from
math
import
*
...
@@ -86,15 +82,15 @@ class Thermistor:
...
@@ -86,15 +82,15 @@ class Thermistor:
return
(
r
/
(
self
.
rp
+
r
))
*
(
1024
)
return
(
r
/
(
self
.
rp
+
r
))
*
(
1024
)
def
main
(
argv
):
def
main
(
argv
):
"
Default values
"
rp
=
4700
;
t1
=
25
# low temperature in Kelvin (25 degC)
t
1
=
25
;
r
1
=
100000
# resistance at low temperature (10 kOhm)
r1
=
1
00000
;
t2
=
1
50
# middle temperature in Kelvin (150 degC)
t
2
=
1
50
;
r
2
=
1
641.9
# resistance at middle temperature (1.6 KOhm)
r2
=
1641.9
;
t3
=
250
# high temperature in Kelvin (250 degC)
t
3
=
2
50
;
r
3
=
2
26.15
# resistance at high temperature (226.15 Ohm)
r
3
=
226.15
;
r
p
=
4700
;
# pull-up resistor (4.7 kOhm)
num_temps
=
int
(
36
);
num_temps
=
int
(
36
);
# number of entries for look-up table
try
:
try
:
opts
,
args
=
getopt
.
getopt
(
argv
,
"
h
"
,
[
"
help
"
,
"
rp=
"
,
"
t1=
"
,
"
t2=
"
,
"
t3=
"
,
"
num-temps=
"
])
opts
,
args
=
getopt
.
getopt
(
argv
,
"
h
"
,
[
"
help
"
,
"
rp=
"
,
"
t1=
"
,
"
t2=
"
,
"
t3=
"
,
"
num-temps=
"
])
...
@@ -136,8 +132,9 @@ def main(argv):
...
@@ -136,8 +132,9 @@ def main(argv):
print
"
// Thermistor lookup table for Marlin
"
print
"
// Thermistor lookup table for Marlin
"
print
"
// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s
"
%
(
rp
,
t1
,
r1
,
t2
,
r2
,
t3
,
r3
,
num_temps
)
print
"
// ./createTemperatureLookupMarlin.py --rp=%s --t1=%s:%s --t2=%s:%s --t3=%s:%s --num-temps=%s
"
%
(
rp
,
t1
,
r1
,
t2
,
r2
,
t3
,
r3
,
num_temps
)
print
"
// Steinhart-Hart Coefficients: %.15g, %.15g, %.15g
"
%
(
t
.
c1
,
t
.
c2
,
t
.
c3
)
print
"
// Steinhart-Hart Coefficients: a=%.15g, b=%.15g, c=%.15g
"
%
(
t
.
c1
,
t
.
c2
,
t
.
c3
)
print
"
//#define NUMTEMPS %s
"
%
(
len
(
temps
))
print
print
"
#define NUMTEMPS %s
"
%
(
len
(
temps
))
print
"
const short temptable[NUMTEMPS][2] PROGMEM = {
"
print
"
const short temptable[NUMTEMPS][2] PROGMEM = {
"
counter
=
0
counter
=
0
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment