Merge branch '2-restore-work-from-pervious-repository' into 'dev'
Resolve "restore work from pervious repository" See merge request Steins7/fan_monitor!1
This commit is contained in:
commit
6286a14cc1
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
27
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -1,27 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: bug
|
||||
assignees: Steins7
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Code
|
||||
2. Specific Hardware used
|
||||
3. OS and toolchain
|
||||
4. Conditions for the bug to appear
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: Steins7
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ bin
|
||||
.gdb_history
|
||||
*tags
|
||||
*.taghl
|
||||
.~lock*
|
||||
|
||||
BIN
cad/BOM.ods
Normal file
BIN
cad/BOM.ods
Normal file
Binary file not shown.
41
cad/adapter/adapter.scad
Normal file
41
cad/adapter/adapter.scad
Normal file
@ -0,0 +1,41 @@
|
||||
$fn = 100;
|
||||
|
||||
// element dimensions
|
||||
w = 60;
|
||||
d = 30;
|
||||
h = 4;
|
||||
|
||||
// aditionnal parameters
|
||||
e = 5;
|
||||
|
||||
// internal values
|
||||
we = w + e;
|
||||
de = d + e;
|
||||
|
||||
translate([0,0,e/2]);
|
||||
cube([we,de,e/3], true);
|
||||
module tab() {
|
||||
translate([-e/4,0,(e/3+h)/2]) {
|
||||
cube([e/2,2*e,h], true);
|
||||
translate([-1.75*e,-e,h/2])
|
||||
rotate([0,-90,-90])
|
||||
linear_extrude(height = 2*e)
|
||||
polygon([[0,1.2*e],[e/4,1.2*e],[0,2*e],[e/2,2*e]],
|
||||
[[0,1,3,2]]);
|
||||
}
|
||||
}
|
||||
|
||||
translate([we/2,-de/2+e,0])
|
||||
tab();
|
||||
|
||||
translate([-we/2,0,0])
|
||||
rotate([0,0,180])
|
||||
tab();
|
||||
|
||||
translate([8,de/2,0])
|
||||
rotate([0,0,90])
|
||||
tab();
|
||||
|
||||
translate([0,-de/2,0])
|
||||
rotate([0,0,-90])
|
||||
tab();
|
||||
646
cad/adapter/adapter.stl
Normal file
646
cad/adapter/adapter.stl
Normal file
@ -0,0 +1,646 @@
|
||||
solid OpenSCAD_Model
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex 32.5 -17.5 7.33333
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 32.5 -7.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 32.5 -17.5 7.33333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 28.5 -17.5 4.83333
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 30 -17.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 28.5 -17.5 4.83333
|
||||
vertex 28.5 -7.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 30 -17.5 0.833333
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 30 -17.5 0.833333
|
||||
vertex 30 -7.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 30 -17.5 0.833333
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 30 -7.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 -0 0
|
||||
outer loop
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 30 -17.5 0.833333
|
||||
vertex 30 -17.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 32.5 -7.5 7.33333
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 28.5 -7.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 32.5 -7.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 32.5 -7.5 0.833333
|
||||
vertex 30 -7.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 28.5 -7.5 6.08333
|
||||
vertex 30 -7.5 4.83333
|
||||
vertex 28.5 -7.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 30 -17.5 4.83333
|
||||
vertex 28.5 -17.5 6.08333
|
||||
vertex 28.5 -17.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 28.5 -17.5 6.08333
|
||||
vertex 30 -17.5 4.83333
|
||||
vertex 32.5 -17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex 30 -17.5 4.83333
|
||||
vertex 30 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 30 -17.5 4.83333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex 32.5 -17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.298275 0 0.95448
|
||||
outer loop
|
||||
vertex 28.5 -7.5 6.08333
|
||||
vertex 32.5 -17.5 7.33333
|
||||
vertex 32.5 -7.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0.298275 0 0.95448
|
||||
outer loop
|
||||
vertex 32.5 -17.5 7.33333
|
||||
vertex 28.5 -7.5 6.08333
|
||||
vertex 28.5 -17.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 28.5 -17.5 4.83333
|
||||
vertex 28.5 -7.5 6.08333
|
||||
vertex 28.5 -7.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 -0 0
|
||||
outer loop
|
||||
vertex 28.5 -7.5 6.08333
|
||||
vertex 28.5 -17.5 4.83333
|
||||
vertex 28.5 -17.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -32.5 5 7.33333
|
||||
vertex -32.5 5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 -0 0
|
||||
outer loop
|
||||
vertex -32.5 5 7.33333
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -32.5 -5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -30 -5 4.83333
|
||||
vertex -28.5 5 4.83333
|
||||
vertex -28.5 -5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex -28.5 5 4.83333
|
||||
vertex -30 -5 4.83333
|
||||
vertex -30 5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -30 5 0.833333
|
||||
vertex -30 -5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex -30 5 0.833333
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -32.5 5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex -30 -5 4.83333
|
||||
vertex -30 5 0.833333
|
||||
vertex -30 5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex -30 5 0.833333
|
||||
vertex -30 -5 4.83333
|
||||
vertex -30 -5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex -32.5 -5 7.33333
|
||||
vertex -30 -5 4.83333
|
||||
vertex -28.5 -5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -30 -5 4.83333
|
||||
vertex -32.5 -5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex -30 -5 4.83333
|
||||
vertex -32.5 -5 0.833333
|
||||
vertex -30 -5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex -28.5 -5 6.08333
|
||||
vertex -30 -5 4.83333
|
||||
vertex -28.5 -5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -30 5 4.83333
|
||||
vertex -28.5 5 6.08333
|
||||
vertex -28.5 5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -28.5 5 6.08333
|
||||
vertex -30 5 4.83333
|
||||
vertex -32.5 5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -32.5 5 0.833333
|
||||
vertex -30 5 4.83333
|
||||
vertex -30 5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -30 5 4.83333
|
||||
vertex -32.5 5 0.833333
|
||||
vertex -32.5 5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.298275 0 0.95448
|
||||
outer loop
|
||||
vertex -32.5 5 7.33333
|
||||
vertex -28.5 -5 6.08333
|
||||
vertex -28.5 5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0.298275 0 0.95448
|
||||
outer loop
|
||||
vertex -28.5 -5 6.08333
|
||||
vertex -32.5 5 7.33333
|
||||
vertex -32.5 -5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex -28.5 -5 6.08333
|
||||
vertex -28.5 5 4.83333
|
||||
vertex -28.5 5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex -28.5 5 4.83333
|
||||
vertex -28.5 -5 6.08333
|
||||
vertex -28.5 -5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 13 17.5 0.833333
|
||||
vertex 3 17.5 7.33333
|
||||
vertex 13 17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex 3 17.5 7.33333
|
||||
vertex 13 17.5 0.833333
|
||||
vertex 3 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 3 13.5 4.83333
|
||||
vertex 13 15 4.83333
|
||||
vertex 13 13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 13 15 4.83333
|
||||
vertex 3 13.5 4.83333
|
||||
vertex 3 15 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex 3 15 0.833333
|
||||
vertex 13 17.5 0.833333
|
||||
vertex 13 15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 13 17.5 0.833333
|
||||
vertex 3 15 0.833333
|
||||
vertex 3 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 3 15 0.833333
|
||||
vertex 13 15 4.83333
|
||||
vertex 3 15 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 13 15 4.83333
|
||||
vertex 3 15 0.833333
|
||||
vertex 13 15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 3 15 4.83333
|
||||
vertex 3 17.5 0.833333
|
||||
vertex 3 15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 3 17.5 0.833333
|
||||
vertex 3 15 4.83333
|
||||
vertex 3 17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 3 13.5 6.08333
|
||||
vertex 3 15 4.83333
|
||||
vertex 3 13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex 3 15 4.83333
|
||||
vertex 3 13.5 6.08333
|
||||
vertex 3 17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 13 17.5 7.33333
|
||||
vertex 13 15 4.83333
|
||||
vertex 13 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 13 15 4.83333
|
||||
vertex 13 17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 13 15 4.83333
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 13 13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 13 17.5 0.833333
|
||||
vertex 13 15 4.83333
|
||||
vertex 13 15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0.298275 0.95448
|
||||
outer loop
|
||||
vertex 3 17.5 7.33333
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 13 17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -0.298275 0.95448
|
||||
outer loop
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 3 17.5 7.33333
|
||||
vertex 3 13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex 3 13.5 4.83333
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 3 13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 13 13.5 6.08333
|
||||
vertex 3 13.5 4.83333
|
||||
vertex 13 13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex -5 -17.5 0.833333
|
||||
vertex 5 -17.5 7.33333
|
||||
vertex -5 -17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 5 -17.5 7.33333
|
||||
vertex -5 -17.5 0.833333
|
||||
vertex 5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -5 -15 4.83333
|
||||
vertex 5 -13.5 4.83333
|
||||
vertex 5 -15 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 5 -13.5 4.83333
|
||||
vertex -5 -15 4.83333
|
||||
vertex -5 -13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -5 -17.5 0.833333
|
||||
vertex 5 -15 0.833333
|
||||
vertex 5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 5 -15 0.833333
|
||||
vertex -5 -17.5 0.833333
|
||||
vertex -5 -15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 5 -15 0.833333
|
||||
vertex -5 -15 4.83333
|
||||
vertex 5 -15 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -5 -15 4.83333
|
||||
vertex 5 -15 0.833333
|
||||
vertex -5 -15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 5 -13.5 6.08333
|
||||
vertex 5 -15 4.83333
|
||||
vertex 5 -13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 5 -17.5 7.33333
|
||||
vertex 5 -15 4.83333
|
||||
vertex 5 -13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 5 -17.5 0.833333
|
||||
vertex 5 -15 4.83333
|
||||
vertex 5 -17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 5 -15 4.83333
|
||||
vertex 5 -17.5 0.833333
|
||||
vertex 5 -15 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -5 -15 0.833333
|
||||
vertex -5 -17.5 0.833333
|
||||
vertex -5 -15 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -5 -15 4.83333
|
||||
vertex -5 -13.5 6.08333
|
||||
vertex -5 -13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -5 -15 4.83333
|
||||
vertex -5 -17.5 7.33333
|
||||
vertex -5 -13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -5 -17.5 7.33333
|
||||
vertex -5 -15 4.83333
|
||||
vertex -5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0.298275 0.95448
|
||||
outer loop
|
||||
vertex -5 -13.5 6.08333
|
||||
vertex 5 -17.5 7.33333
|
||||
vertex 5 -13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0.298275 0.95448
|
||||
outer loop
|
||||
vertex 5 -17.5 7.33333
|
||||
vertex -5 -13.5 6.08333
|
||||
vertex -5 -17.5 7.33333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 5 -13.5 4.83333
|
||||
vertex -5 -13.5 6.08333
|
||||
vertex 5 -13.5 6.08333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -5 -13.5 6.08333
|
||||
vertex 5 -13.5 4.83333
|
||||
vertex -5 -13.5 4.83333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 -0 0
|
||||
outer loop
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex 32.5 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 1 0 0
|
||||
outer loop
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex 32.5 -17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 1
|
||||
outer loop
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex 32.5 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 1
|
||||
outer loop
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex -32.5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 0 -1
|
||||
outer loop
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex 32.5 -17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -0 0 -1
|
||||
outer loop
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex -32.5 17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 0 0
|
||||
outer loop
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex -32.5 17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal -1 -0 0
|
||||
outer loop
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex -32.5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 -0
|
||||
outer loop
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex 32.5 17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 1 0
|
||||
outer loop
|
||||
vertex -32.5 17.5 0.833333
|
||||
vertex 32.5 17.5 -0.833333
|
||||
vertex -32.5 17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 0
|
||||
outer loop
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex -32.5 -17.5 0.833333
|
||||
endloop
|
||||
endfacet
|
||||
facet normal 0 -1 -0
|
||||
outer loop
|
||||
vertex 32.5 -17.5 0.833333
|
||||
vertex -32.5 -17.5 -0.833333
|
||||
vertex 32.5 -17.5 -0.833333
|
||||
endloop
|
||||
endfacet
|
||||
endsolid OpenSCAD_Model
|
||||
34
cad/encoder/encoder.scad
Normal file
34
cad/encoder/encoder.scad
Normal file
@ -0,0 +1,34 @@
|
||||
$fn = 100;
|
||||
|
||||
r = 12;
|
||||
h = 12;
|
||||
|
||||
center_r = 3.2;
|
||||
|
||||
mol_r = 7;
|
||||
mol_off = 6;
|
||||
|
||||
difference() {
|
||||
union() {
|
||||
difference() {
|
||||
cylinder(h=h, r=r, center=true);
|
||||
translate([0,0,h/2])
|
||||
cylinder(h=15, r=center_r, center=true);
|
||||
for(i=[0:45:359]) {
|
||||
echo((r+mol_off*sin(i)));
|
||||
translate([(r+mol_off)*cos(i),(r+mol_off)
|
||||
*sin(i),0])
|
||||
cylinder(h=h, r=mol_r, center=true);
|
||||
}
|
||||
}
|
||||
translate([3,0,0])
|
||||
cube([3,2*center_r,h], center=true);
|
||||
}
|
||||
difference() {
|
||||
translate([0,0,3])
|
||||
cylinder(h=h, r=0.8*r, center=true);
|
||||
translate([0,0,3])
|
||||
cylinder(h=h, r=1.4*center_r, center=true);
|
||||
|
||||
}
|
||||
}
|
||||
12042
cad/encoder/encoder.stl
Normal file
12042
cad/encoder/encoder.stl
Normal file
File diff suppressed because it is too large
Load Diff
231
cad/main_board/main_board_routing.json
Normal file
231
cad/main_board/main_board_routing.json
Normal file
File diff suppressed because one or more lines are too long
15
cad/main_board/main_board_schematic.json
Normal file
15
cad/main_board/main_board_schematic.json
Normal file
File diff suppressed because one or more lines are too long
BIN
docs/Graphs.ods
Normal file
BIN
docs/Graphs.ods
Normal file
Binary file not shown.
141
src/main.c
141
src/main.c
@ -1,31 +1,94 @@
|
||||
// standard headers
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// driver includes
|
||||
#include "drivers/rcc.h"
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/lcd.h"
|
||||
#include "drivers/adc.h"
|
||||
|
||||
Clock_t sysclks;
|
||||
#include "drivers/timer.h"
|
||||
|
||||
extern uint32_t end;
|
||||
// project headers
|
||||
#include "ui.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* static variables */;
|
||||
int val = 0; //debug led
|
||||
int read_flag = 0;
|
||||
int sensor_id = 0;
|
||||
|
||||
// low_pass filter
|
||||
#define FILTER_LENGTH 10
|
||||
int16_t temp_filter[3][FILTER_LENGTH] = {};
|
||||
|
||||
// adc channels
|
||||
uint8_t channels[3][2] = {
|
||||
{4, 5},
|
||||
{0, 1},
|
||||
{2, 3}
|
||||
};
|
||||
|
||||
vars_t vars = {
|
||||
{},
|
||||
5,
|
||||
2,
|
||||
{},
|
||||
1,
|
||||
1
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* Timer IRQ */
|
||||
static void timeout_cb(void) {
|
||||
io_write(GPIOC, val, PIN_13);
|
||||
val = !val;
|
||||
|
||||
// set temp read flag
|
||||
read_flag = 1;
|
||||
}
|
||||
|
||||
int16_t read_temp(uint8_t id) {
|
||||
// get ADC values
|
||||
uint32_t data = 0;
|
||||
data = adc_read(ADC1, channels[id][0]);
|
||||
data -= adc_read(ADC1, channels[id][1]);
|
||||
|
||||
int16_t voltage = ((data*4) << 8)/4095 ;
|
||||
|
||||
return ((voltage - 0x73) << 8)/0x9 + vars.facs[id][0];
|
||||
}
|
||||
|
||||
void process_temps(void) {
|
||||
// shift filter queue
|
||||
int32_t sum = 0;
|
||||
for(int i=0; i<(FILTER_LENGTH-1); ++i) {
|
||||
temp_filter[sensor_id][i] = temp_filter[sensor_id][i+1];
|
||||
sum += temp_filter[sensor_id][i];
|
||||
}
|
||||
|
||||
// calculate temp value
|
||||
temp_filter[sensor_id][FILTER_LENGTH-1] = read_temp(sensor_id);
|
||||
|
||||
// apply filter
|
||||
sum += temp_filter[sensor_id][FILTER_LENGTH-1];
|
||||
vars.temps[sensor_id] = (sum/FILTER_LENGTH) >> 8;
|
||||
|
||||
// switch to next sensor
|
||||
sensor_id++;
|
||||
sensor_id = sensor_id%3;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* main function */
|
||||
int main(void) {
|
||||
|
||||
//initialize variables
|
||||
val = 0; //debug led
|
||||
read_flag = 0;
|
||||
sensor_id = 0;
|
||||
|
||||
// configure clocks (necessary before using timers)
|
||||
rcc_config_clock(CLOCK_CONFIG_PERFORMANCE, &sysclks);
|
||||
|
||||
@ -34,19 +97,75 @@ int main(void) {
|
||||
return -1;
|
||||
io_write(GPIOC, 1, PIN_13);
|
||||
|
||||
// start timed interruption
|
||||
timer_tick_init(TIM2, 1000, timeout_cb);
|
||||
timer_start(TIM2);
|
||||
// configure GPIO for relay
|
||||
if(io_configure(GPIOB, PIN_11, IO_MODE_OUTPUT | IO_OUT_PUSH_PULL, 0))
|
||||
return -1;
|
||||
io_write(GPIOB, 1, PIN_11);
|
||||
|
||||
uint32_t test = (uint32_t)(&end);
|
||||
test++;
|
||||
int* tab = (int*)malloc(10*sizeof(int));
|
||||
for(int i=0; i<10; ++i) {
|
||||
tab[i] = i;
|
||||
// configure GPIOS for temperature sensors
|
||||
if(io_configure(GPIOA, PIN_0 | PIN_1 | PIN_2 | PIN_3 | PIN_4 | PIN_5,
|
||||
IO_MODE_INPUT | IO_IN_ANALOG, 0)) return -1;
|
||||
if(adc_init(ADC1)) return -1;
|
||||
|
||||
// initilize filter
|
||||
for(int i=0; i<3; ++i) {
|
||||
int16_t tmp = read_temp(i);
|
||||
for(int j=0; j<FILTER_LENGTH; ++j) {
|
||||
temp_filter[i][j] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
// setup ui
|
||||
if(ui_init(TIM4, TIM2, &vars)) return -1;
|
||||
|
||||
// start timed interruption
|
||||
timer_tick_init(TIM3, 1000, timeout_cb); //1262 last to work
|
||||
timer_start(TIM3);
|
||||
|
||||
// initialize temps
|
||||
for(int i=0; i<3*FILTER_LENGTH; ++i) process_temps();
|
||||
|
||||
int count = 0;
|
||||
|
||||
// main loop
|
||||
for(;;);
|
||||
while(1){
|
||||
|
||||
// process sensor values
|
||||
if(read_flag) {
|
||||
|
||||
// clear flag
|
||||
read_flag = 0;
|
||||
|
||||
// print new value
|
||||
ui_update_temp(sensor_id);
|
||||
|
||||
if(++count >= 6) {
|
||||
count = 0;
|
||||
|
||||
// compute temps
|
||||
process_temps();
|
||||
|
||||
// set fan state
|
||||
if((vars.temps[vars.silo] - vars.temps[T_EXT]) >=
|
||||
vars.start_treshold) {
|
||||
if(!vars.fan) {
|
||||
io_set(GPIOB, PIN_11);
|
||||
vars.fan = 1;
|
||||
}
|
||||
} else if((vars.temps[vars.silo] - vars.temps[T_EXT]) <=
|
||||
vars.stop_treshold) {
|
||||
if(vars.fan) {
|
||||
io_clear(GPIOB, PIN_11);
|
||||
vars.fan = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update every 0.2 seconds
|
||||
ui_update();
|
||||
// timer_wait_ms(TIM1, 200, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
309
src/ui.c
Normal file
309
src/ui.c
Normal file
@ -0,0 +1,309 @@
|
||||
#include "ui.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* control variables */
|
||||
static int state;
|
||||
static volatile int button_update;
|
||||
static int sel, prev_sel;
|
||||
static TIM_TypeDef* enc;
|
||||
static TIM_TypeDef* tim;
|
||||
static vars_t* vars;
|
||||
|
||||
/* data variables */
|
||||
static const char* ui_default[] = {
|
||||
"SILO: Te: ""\xDF""C",
|
||||
"1: ""\xDF""C 2: ""\xDF""C"
|
||||
};
|
||||
|
||||
static const char* ui_menu[] = {
|
||||
" 1-Retour",
|
||||
" 2-Silo:",
|
||||
" 3-Start:",
|
||||
" 4-Stop:",
|
||||
// " 5-Calibrer Te",
|
||||
// " 6-Calibrer T1",
|
||||
// " 7-Calibrer T2",
|
||||
// " 8-Test ventil",
|
||||
" 1-Retour"
|
||||
};
|
||||
|
||||
static const char* ui_interact[] = {
|
||||
" lue: ""\xDF""C",
|
||||
" reelle: ""\xDF""C"
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* internal functions */
|
||||
void show_bg(const char** bg) {
|
||||
lcd_send_cmd(LCD_CLEAR);
|
||||
lcd_send_cmd(LCD_CUR_HOME);
|
||||
lcd_print(bg[0]);
|
||||
lcd_set_cursor(0,1);
|
||||
lcd_print(bg[1]);
|
||||
}
|
||||
|
||||
void update_entry(uint8_t prev_entry, uint8_t value) {
|
||||
// get vlaue in str form
|
||||
char str[8]; //too long to be sure
|
||||
num2str(str, value, 10);
|
||||
|
||||
// print value in the correct position
|
||||
if(sel == prev_entry) lcd_set_cursor(14, 1);
|
||||
else lcd_set_cursor(14, 0);
|
||||
lcd_print(str);
|
||||
}
|
||||
|
||||
void change_value(uint8_t entry, uint8_t* entry_val, int max) {
|
||||
int local_val = *entry_val;
|
||||
lcd_set_cursor(14,0);
|
||||
while(!button_update) {
|
||||
local_val = ((enc->CNT/2)%max) + 1;
|
||||
char str[8];
|
||||
num2str(str, local_val, 10);
|
||||
lcd_print(str);
|
||||
lcd_set_cursor(14,0);
|
||||
timer_wait_ms(TIM1, 200, 0);
|
||||
}
|
||||
*entry_val = local_val;
|
||||
}
|
||||
|
||||
void interact(uint8_t entry, uint8_t* entry_val) {
|
||||
while(!button_update) {
|
||||
lcd_set_cursor(10,0);
|
||||
lcd_print(" ");
|
||||
lcd_set_cursor(10,0);
|
||||
|
||||
lcd_set_cursor(10,0);
|
||||
lcd_print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_sleep() {
|
||||
// disable screen functions to economize energy
|
||||
lcd_send_cmd(LCD_DISP_CTRL | LCD_CTRL_DISP_OFF | LCD_CTRL_CUR_OFF
|
||||
| LCD_CTRL_BLINK_OFF);
|
||||
|
||||
// disable backlight
|
||||
io_clear(GPIOB, PIN_9);
|
||||
}
|
||||
|
||||
void lcd_resume() {
|
||||
// re-enable screen functions
|
||||
lcd_send_cmd(LCD_DISP_CTRL | LCD_CTRL_DISP_ON | LCD_CTRL_CUR_OFF
|
||||
| LCD_CTRL_BLINK_OFF); //TODO
|
||||
|
||||
// re-enable backlight
|
||||
io_set(GPIOB, PIN_9);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* timeout timer cb */
|
||||
static void ui_sleep(void) {
|
||||
state = UI_SLEEP;
|
||||
}
|
||||
|
||||
/* encoder button gpio cb */
|
||||
static void ui_button_cb(void) {
|
||||
for(int i=0; i<1000000; ++i); //avoid double trigger
|
||||
timer_start(tim);
|
||||
button_update = 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/* main functions */
|
||||
int ui_init(TIM_TypeDef* encoder, TIM_TypeDef* timeout, vars_t* vars_p) {
|
||||
// save parameters
|
||||
enc = encoder;
|
||||
tim = timeout;
|
||||
vars = vars_p;
|
||||
|
||||
// configure backlight control pin
|
||||
if(io_configure(GPIOB, PIN_9, IO_MODE_OUTPUT | IO_OUT_PUSH_PULL, 0))
|
||||
return -1;
|
||||
io_set(GPIOB, PIN_9);
|
||||
|
||||
// configure lcd
|
||||
lcd_init(TIM1, 16, 2);
|
||||
lcd_send_cmd(LCD_CUR_HOME);
|
||||
lcd_print(ui_default[0]);
|
||||
lcd_set_cursor(0, 1);
|
||||
lcd_print(ui_default[1]);
|
||||
lcd_send_cmd(LCD_DISP_CTRL | LCD_CTRL_DISP_ON | LCD_CTRL_CUR_OFF |
|
||||
LCD_CTRL_BLINK_OFF);
|
||||
|
||||
// configure encoder
|
||||
io_configure(GPIOB, PIN_6 | PIN_7, IO_MODE_INPUT | IO_IN_FLOATING, 0);
|
||||
timer_enc_init(enc); //TODO fix weird behaviour around 0
|
||||
|
||||
io_configure(GPIOB, PIN_8, IO_MODE_INPUT | IO_IN_PULL_UP |
|
||||
IO_IRQ_EDGE_FALL, ui_button_cb);
|
||||
|
||||
// setup state variables
|
||||
state = UI_SLEEP;
|
||||
sel = 0;
|
||||
prev_sel = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ui_update(void) {
|
||||
// manage button press
|
||||
if(button_update) {
|
||||
button_update = 0;
|
||||
|
||||
switch(state) {
|
||||
//-------------------------
|
||||
case UI_DEFAULT:
|
||||
// reset encoder and previous values
|
||||
timer_start(enc);
|
||||
sel = 0;
|
||||
prev_sel = -1;
|
||||
|
||||
// go to menu screen
|
||||
state = UI_MENU;
|
||||
break;
|
||||
//-------------------------
|
||||
case UI_MENU:
|
||||
// go back to default screen whith return
|
||||
if(sel == UI_RETURN) {
|
||||
show_bg(ui_default);
|
||||
lcd_set_cursor(5,0);
|
||||
char str[4];
|
||||
num2str(str, vars->silo, 10);
|
||||
lcd_print(str);
|
||||
|
||||
state = UI_DEFAULT;
|
||||
for(int i=0; i<3; ++i) ui_update_temp(i);
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise interact with option
|
||||
if(sel == UI_CAL_T_EXT || sel == UI_CAL_T1
|
||||
|| sel == UI_CAL_T2) {
|
||||
show_bg(ui_interact);
|
||||
}
|
||||
lcd_send_cmd(LCD_DISP_CTRL | LCD_CTRL_DISP_ON |
|
||||
LCD_CTRL_CUR_ON | LCD_CTRL_BLINK_OFF);
|
||||
timer_start(enc);
|
||||
state = UI_INTERACT;
|
||||
break;
|
||||
//-------------------------
|
||||
case UI_INTERACT:
|
||||
state = UI_MENU;
|
||||
lcd_send_cmd(LCD_DISP_CTRL | LCD_CTRL_DISP_ON |
|
||||
LCD_CTRL_CUR_OFF | LCD_CTRL_BLINK_OFF);
|
||||
break;
|
||||
//-------------------------
|
||||
case UI_SLEEP:
|
||||
// re-enable screen
|
||||
lcd_resume();
|
||||
|
||||
// re-enable timeout system
|
||||
timer_wait_ms(tim, TIMEOUT_LENGHT, ui_sleep);
|
||||
|
||||
// go back to default screen
|
||||
show_bg(ui_default);
|
||||
lcd_set_cursor(5,0);
|
||||
char str[4];
|
||||
num2str(str, vars->silo, 10);
|
||||
lcd_print(str);
|
||||
|
||||
state = UI_DEFAULT;
|
||||
for(int i=0; i<3; ++i) ui_update_temp(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// manage dynamic draw
|
||||
switch(state) {
|
||||
//---------------------
|
||||
case UI_MENU:
|
||||
// get current encoder value
|
||||
sel = (enc->CNT/2)%(MENU_LENGHT+1);
|
||||
|
||||
// refresh menu if selected item changed
|
||||
if(sel != prev_sel) {
|
||||
prev_sel = sel;
|
||||
timer_start(tim); //refresh timeout timer
|
||||
show_bg(ui_menu + sel);
|
||||
lcd_send_cmd(LCD_CUR_HOME);
|
||||
lcd_print_c(0x7E);
|
||||
|
||||
// show silo value if needed
|
||||
if(sel == UI_RETURN || sel == UI_SILO) {
|
||||
update_entry(UI_RETURN, vars->silo);
|
||||
}
|
||||
// show start value if needed
|
||||
if(sel == UI_SILO || sel == UI_START) {
|
||||
update_entry(UI_SILO, vars->start_treshold);
|
||||
}
|
||||
// show start value if needed
|
||||
if(sel == UI_START || sel == UI_STOP) {
|
||||
update_entry(UI_START, vars->stop_treshold);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//---------------------
|
||||
case UI_INTERACT:
|
||||
switch(sel) {
|
||||
case UI_SILO:
|
||||
change_value(UI_SILO, &vars->silo, 2);
|
||||
break;
|
||||
case UI_START:
|
||||
change_value(UI_START, &vars->start_treshold, 9);
|
||||
break;
|
||||
case UI_STOP:
|
||||
change_value(UI_STOP, &vars->stop_treshold, 9);
|
||||
break;
|
||||
}
|
||||
//---------------------
|
||||
case UI_DEFAULT:
|
||||
break;
|
||||
//---------------------
|
||||
case UI_SLEEP:
|
||||
lcd_sleep();
|
||||
}
|
||||
}
|
||||
|
||||
static uint8_t temp_pos[][2] = {
|
||||
{11, 0},
|
||||
{ 2, 1},
|
||||
{11, 1}};
|
||||
|
||||
void ui_update_temp(uint8_t id) {
|
||||
if(state != UI_DEFAULT) return;
|
||||
|
||||
if(id > 2) return; //protect from overflow
|
||||
uint8_t* pos = temp_pos[id];
|
||||
|
||||
// prepare data
|
||||
char str[16]; //longer, in case of error
|
||||
|
||||
// convert int into str
|
||||
uint32_t nb = num2str(str, (vars->temps[id]), 10);
|
||||
|
||||
// clear previous text
|
||||
lcd_set_cursor(pos[0],pos[1]);
|
||||
lcd_print(" ");
|
||||
|
||||
// prepare lcd for write
|
||||
switch(nb) {
|
||||
case 1:
|
||||
lcd_set_cursor(pos[0]+2,pos[1]);
|
||||
break;
|
||||
case 2:
|
||||
lcd_set_cursor(pos[0]+1,pos[1]);
|
||||
break;
|
||||
case 3:
|
||||
lcd_set_cursor(pos[0],pos[1]);
|
||||
break;
|
||||
default: // something went wrong
|
||||
lcd_set_cursor(pos[0],pos[1]);
|
||||
lcd_print("Err");
|
||||
return;
|
||||
}
|
||||
|
||||
// write value
|
||||
lcd_print(str);
|
||||
}
|
||||
|
||||
76
src/ui.h
Normal file
76
src/ui.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef UI_H
|
||||
#define UI_H
|
||||
|
||||
// drivers headers
|
||||
#include "drivers/lcd.h"
|
||||
#include "drivers/timer.h"
|
||||
|
||||
// standard headers
|
||||
#include <stdint.h>
|
||||
|
||||
// project headers
|
||||
#include "utils.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#define TIMEOUT_LENGHT 20000
|
||||
|
||||
/** vars_t
|
||||
* structure that contains all the variables needed by the ui and used or
|
||||
* created elsewhere
|
||||
*/
|
||||
typedef struct {
|
||||
int16_t temps[3];
|
||||
uint8_t start_treshold;
|
||||
uint8_t stop_treshold;
|
||||
uint8_t facs[3][2];
|
||||
uint8_t silo;
|
||||
uint8_t fan;
|
||||
} vars_t;
|
||||
|
||||
// ui enums, created to improve readability
|
||||
enum temp {
|
||||
T_EXT = 0,
|
||||
T1 = 1,
|
||||
T2 = 2
|
||||
};
|
||||
|
||||
enum ui_state {
|
||||
UI_DEFAULT,
|
||||
UI_MENU,
|
||||
UI_INTERACT,
|
||||
UI_SLEEP
|
||||
};
|
||||
|
||||
enum ui_menu {
|
||||
UI_RETURN = 0,
|
||||
UI_SILO = 1,
|
||||
UI_START = 2,
|
||||
UI_STOP = 3,
|
||||
UI_CAL_T_EXT = 4,
|
||||
UI_CAL_T1 = 5,
|
||||
UI_CAL_T2 = 6,
|
||||
UI_TEST = 7
|
||||
};
|
||||
|
||||
#define MENU_LENGHT 3
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** ui_init
|
||||
* init ui, using a timer for the encoder and another for the timeout delay
|
||||
*/
|
||||
int ui_init(TIM_TypeDef* encoder, TIM_TypeDef* timeout, vars_t* vars_p);
|
||||
|
||||
/** ui_update
|
||||
* update the graphical elements and manages the button press
|
||||
* should be called quite often for a smooth usage
|
||||
*/
|
||||
void ui_update(void);
|
||||
|
||||
/** update_temp
|
||||
* update on the lcd the given value for the corresponding id
|
||||
*/
|
||||
void ui_update_temp(uint8_t id);
|
||||
|
||||
#endif
|
||||
|
||||
30
src/utils.c
Normal file
30
src/utils.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include "utils.h"
|
||||
|
||||
uint32_t num2str(char *s, int number, uint8_t base) {
|
||||
|
||||
static char hexChars[] = "0123456789ABCDEF";
|
||||
char *p = s;
|
||||
|
||||
// manage sign
|
||||
uint32_t nb = (number < 0 ? -number : number);
|
||||
|
||||
// get digits
|
||||
do {
|
||||
*s++ = hexChars[nb % base];
|
||||
} while (nb /= base);
|
||||
|
||||
// finalize string
|
||||
if(number < 0) *s++ = '-';
|
||||
*s='\0';
|
||||
|
||||
// reverse string
|
||||
int cnt = s - p;
|
||||
char tmp;
|
||||
for(int i=0; i<cnt/2; ++i) {
|
||||
tmp = p[i];
|
||||
p[i] = p[cnt-i-1];
|
||||
p[cnt-i-1] = tmp;
|
||||
}
|
||||
|
||||
return cnt; //number of caracters (excluding '\0')
|
||||
}
|
||||
12
src/utils.h
Normal file
12
src/utils.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
// standard headers
|
||||
#include <stdint.h>
|
||||
|
||||
uint32_t num2str(char *s, int number, uint8_t base);
|
||||
|
||||
//void print_num(int number,
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user