clean orphans

This commit is contained in:
lovebird 2024-07-02 16:10:12 +02:00
parent 1a4dca0f93
commit 75c4b33f6c
760 changed files with 0 additions and 914480 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
extrusion/components/PCFan/PCFan.SLDASM (Stored with Git LFS)

Binary file not shown.

BIN
extrusion/components/PCFan/body.SLDPRT (Stored with Git LFS)

Binary file not shown.

BIN
extrusion/components/PCFan/fan.SLDPRT (Stored with Git LFS)

Binary file not shown.

BIN
extrusion/components/PCFan/perspective.jpg (Stored with Git LFS)

Binary file not shown.

View File

@ -1,648 +0,0 @@
0
SECTION
2
HEADER
9
$INSUNITS
70
4
9
$ACADVER
1
AC1014
9
$HANDSEED
5
FFFF
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
VPORT
5
8
100
AcDbSymbolTable
0
ENDTAB
0
TABLE
2
LTYPE
5
5
100
AcDbSymbolTable
0
LTYPE
5
14
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
BYBLOCK
70
0
0
LTYPE
5
15
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
BYLAYER
70
0
0
ENDTAB
0
TABLE
2
LAYER
5
2
100
AcDbSymbolTable
70
2
0
LAYER
5
50
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
0
70
0
6
CONTINUOUS
0
ENDTAB
0
TABLE
2
STYLE
5
3
100
AcDbSymbolTable
70
1
0
STYLE
5
11
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
2
STANDARD
70
0
0
ENDTAB
0
TABLE
2
VIEW
5
6
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
UCS
5
7
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
APPID
5
9
100
AcDbSymbolTable
70
2
0
APPID
5
12
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD
70
0
0
ENDTAB
0
TABLE
2
DIMSTYLE
5
A
100
AcDbSymbolTable
70
1
0
ENDTAB
0
TABLE
2
BLOCK_RECORD
5
1
100
AcDbSymbolTable
70
1
0
BLOCK_RECORD
5
1F
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*MODEL_SPACE
0
BLOCK_RECORD
5
1B
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*PAPER_SPACE
0
ENDTAB
0
ENDSEC
0
SECTION
2
BLOCKS
0
BLOCK
5
20
100
AcDbEntity
100
AcDbBlockBegin
2
*MODEL_SPACE
0
ENDBLK
5
21
100
AcDbEntity
100
AcDbBlockEnd
0
BLOCK
5
1C
100
AcDbEntity
100
AcDbBlockBegin
2
*PAPER_SPACE
0
ENDBLK
5
1D
100
AcDbEntity
100
AcDbBlockEnd
0
ENDSEC
0
SECTION
2
ENTITIES
0
LINE
5
100
100
AcDbEntity
8
0
100
AcDbLine
10
27.265755208333339
20
-25.198461914062502
30
0
11
62.711653645833337
21
-45.671630859375007
31
0
0
LINE
5
101
100
AcDbEntity
8
0
100
AcDbLine
10
62.711653645833337
20
-45.671630859375007
30
0
11
62.711653645833337
21
-45.732609049479166
31
0
0
LINE
5
102
100
AcDbEntity
8
0
100
AcDbLine
10
62.711653645833337
20
-45.732609049479166
30
0
11
62.711653645833337
21
-86.620035807291657
31
0
0
LINE
5
103
100
AcDbEntity
8
0
100
AcDbLine
10
62.711653645833337
20
-86.620035807291657
30
0
11
27.265755208333342
21
-107.09320475260419
31
0
0
LINE
5
104
100
AcDbEntity
8
0
100
AcDbLine
10
27.265755208333342
20
-107.09320475260419
30
0
11
13.672140026648671
21
-99.2419080463619
31
0
0
LINE
5
105
100
AcDbEntity
8
0
100
AcDbLine
10
13.672140026648671
20
-99.2419080463619
30
0
11
38.204622395833347
21
-85.091446940104177
31
0
0
LINE
5
106
100
AcDbEntity
8
0
100
AcDbLine
10
38.204622395833347
20
-85.091446940104177
30
0
11
38.20462239583334
21
-59.85164388020835
31
0
0
LINE
5
107
100
AcDbEntity
8
0
100
AcDbLine
10
38.20462239583334
20
-59.85164388020835
30
0
11
62.711653645833337
21
-45.732609049479166
31
0
0
LINE
5
108
100
AcDbEntity
8
0
100
AcDbLine
10
62.711653645833337
20
-45.732609049479166
30
0
11
40.833321640545961
21
-33.09592026091088
31
0
0
LINE
5
109
100
AcDbEntity
8
0
100
AcDbLine
10
40.833321640545961
20
-33.09592026091088
30
0
11
16.263842773437503
21
-47.261197916666681
31
0
0
LINE
5
110
100
AcDbEntity
8
0
100
AcDbLine
10
16.263842773437503
20
-47.261197916666681
30
0
11
16.386832682291676
21
-72.440022786458343
31
0
0
LINE
5
111
100
AcDbEntity
8
0
100
AcDbLine
10
16.386832682291676
20
-72.440022786458343
30
0
11
-8.1811767578124961
21
-86.620035807291686
31
0
0
LINE
5
112
100
AcDbEntity
8
0
100
AcDbLine
10
-8.1811767578124961
20
-86.620035807291686
30
0
11
-8.1811767578124961
21
-45.671630859375007
31
0
0
LINE
5
113
100
AcDbEntity
8
0
100
AcDbLine
10
-8.1811767578124961
20
-45.671630859375007
30
0
11
27.265755208333339
21
-25.198461914062502
31
0
0
LWPOLYLINE
5
114
100
AcDbEntity
8
0
100
AcDbPolyline
90
6
70
1
43
0.0
10
27.265755208333342
20
-0.019637058069932323
10
84.530476888020857
20
-33.082218424479173
10
84.530476888020857
20
-99.209448242187506
10
27.265755208333339
20
-132.27202962239585
10
-30.000000000000004
20
-99.20944824218752
10
-30
20
-33.082218424479166
0
ENDSEC
0
SECTION
2
OBJECTS
0
DICTIONARY
5
C
100
AcDbDictionary
3
ACAD_GROUP
350
D
3
ACAD_MLINESTYLE
350
17
0
DICTIONARY
5
D
100
AcDbDictionary
0
DICTIONARY
5
1A
330
C
100
AcDbDictionary
0
DICTIONARY
5
17
100
AcDbDictionary
0
ENDSEC
0
EOF

View File

@ -1,420 +0,0 @@
0
SECTION
2
HEADER
9
$INSUNITS
70
4
9
$ACADVER
1
AC1014
9
$HANDSEED
5
FFFF
0
ENDSEC
0
SECTION
2
TABLES
0
TABLE
2
VPORT
5
8
100
AcDbSymbolTable
0
ENDTAB
0
TABLE
2
LTYPE
5
5
100
AcDbSymbolTable
0
LTYPE
5
14
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
BYBLOCK
70
0
0
LTYPE
5
15
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
BYLAYER
70
0
0
ENDTAB
0
TABLE
2
LAYER
5
2
100
AcDbSymbolTable
70
2
0
LAYER
5
50
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
0
70
0
6
CONTINUOUS
0
ENDTAB
0
TABLE
2
STYLE
5
3
100
AcDbSymbolTable
70
1
0
STYLE
5
11
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
2
STANDARD
70
0
0
ENDTAB
0
TABLE
2
VIEW
5
6
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
UCS
5
7
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
APPID
5
9
100
AcDbSymbolTable
70
2
0
APPID
5
12
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD
70
0
0
ENDTAB
0
TABLE
2
DIMSTYLE
5
A
100
AcDbSymbolTable
70
1
0
ENDTAB
0
TABLE
2
BLOCK_RECORD
5
1
100
AcDbSymbolTable
70
1
0
BLOCK_RECORD
5
1F
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*MODEL_SPACE
0
BLOCK_RECORD
5
1B
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*PAPER_SPACE
0
ENDTAB
0
ENDSEC
0
SECTION
2
BLOCKS
0
BLOCK
5
20
100
AcDbEntity
100
AcDbBlockBegin
2
*MODEL_SPACE
0
ENDBLK
5
21
100
AcDbEntity
100
AcDbBlockEnd
0
BLOCK
5
1C
100
AcDbEntity
100
AcDbBlockBegin
2
*PAPER_SPACE
0
ENDBLK
5
1D
100
AcDbEntity
100
AcDbBlockEnd
0
ENDSEC
0
SECTION
2
ENTITIES
0
LWPOLYLINE
5
100
100
AcDbEntity
8
0
100
AcDbPolyline
90
6
70
1
43
0.0
10
27.265755208333342
20
-107.09320475260419
10
62.711653645833337
20
-86.620035807291657
10
62.711653645833337
20
-45.671630859375007
10
38.20462239583334
20
-59.85164388020835
10
38.204622395833347
20
-85.091446940104177
10
13.672140026648671
20
-99.2419080463619
0
LWPOLYLINE
5
101
100
AcDbEntity
8
0
100
AcDbPolyline
90
6
70
1
43
0.0
10
-8.1811767578124961
20
-86.620035807291686
10
16.386832682291672
20
-72.440022786458343
10
16.263842773437503
20
-47.261197916666681
10
40.833321640545961
20
-33.095920260910887
10
27.265755208333339
20
-25.198461914062502
10
-8.1811767578124961
20
-45.671630859375007
0
LWPOLYLINE
5
102
100
AcDbEntity
8
0
100
AcDbPolyline
90
6
70
1
43
0.0
10
-30
20
-99.20944824218752
10
-30
20
-33.082218424479166
10
27.265755208333342
20
-0.019637058069932323
10
84.530476888020857
20
-33.082218424479173
10
84.530476888020857
20
-99.209448242187506
10
27.265755208333342
20
-132.27202962239585
0
ENDSEC
0
SECTION
2
OBJECTS
0
DICTIONARY
5
C
100
AcDbDictionary
3
ACAD_GROUP
350
D
3
ACAD_MLINESTYLE
350
17
0
DICTIONARY
5
D
100
AcDbDictionary
0
DICTIONARY
5
1A
330
C
100
AcDbDictionary
0
DICTIONARY
5
17
100
AcDbDictionary
0
ENDSEC
0
EOF

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,199 +0,0 @@
CERN Open Hardware Licence Version 2 - Permissive
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: this licence, CERN-OHL-P
(permissive); and two reciprocal licences: CERN-OHL-W (weakly
reciprocal) and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-P.
1.2 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.3 'Covered Source' means Source that is explicitly made available
under this Licence.
1.4 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.5 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.6 'Notice' means copyright, acknowledgement and trademark notices,
references to the location of any Notices, modification notices
(subsection 3.3(b)) and all notices that refer to this Licence
and to the disclaimer of warranties that are included in the
Covered Source.
1.7 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.8 'Licensor' means a person who creates Source or modifies Covered
Source and subsequently Conveys the resulting Covered Source
under the terms and conditions of this Licence. A person may be
a Licensee and a Licensor at the same time.
1.9 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2; and
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it.
3.4 You may Convey Covered Source or modified Covered Source under
licence terms which differ from the terms of this Licence
provided that:
a) You comply at all times with subsection 3.3; and
b) You provide a copy of this Licence to anyone to whom You
Convey Covered Source or modified Covered Source.
4 Making and Conveying Products
You may Make Products, and/or Convey them, provided that You ensure
that the recipient of the Product has access to any Notices applicable
to the Product.
5 DISCLAIMER AND LIABILITY
5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
6 Patents
6.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in this section 6, or where terminated by the Licensor
for cause) patent license to Make, have Made, use, offer to
sell, sell, import, and otherwise transfer the Covered Source
and Products, where such licence applies only to those patent
claims licensable by such Licensor that are necessarily
infringed by exercising rights under the Covered Source as
Conveyed by that Licensor.
6.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
7 General
7.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
7.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
7.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
7.4 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.

Binary file not shown.

View File

@ -1 +0,0 @@
[]

View File

@ -1,199 +0,0 @@
CERN Open Hardware Licence Version 2 - Permissive
Preamble
CERN has developed this licence to promote collaboration among
hardware designers and to provide a legal tool which supports the
freedom to use, study, modify, share and distribute hardware designs
and products based on those designs. Version 2 of the CERN Open
Hardware Licence comes in three variants: this licence, CERN-OHL-P
(permissive); and two reciprocal licences: CERN-OHL-W (weakly
reciprocal) and CERN-OHL-S (strongly reciprocal).
The CERN-OHL-P is copyright CERN 2020. Anyone is welcome to use it, in
unmodified form only.
Use of this Licence does not imply any endorsement by CERN of any
Licensor or their designs nor does it imply any involvement by CERN in
their development.
1 Definitions
1.1 'Licence' means this CERN-OHL-P.
1.2 'Source' means information such as design materials or digital
code which can be applied to Make or test a Product or to
prepare a Product for use, Conveyance or sale, regardless of its
medium or how it is expressed. It may include Notices.
1.3 'Covered Source' means Source that is explicitly made available
under this Licence.
1.4 'Product' means any device, component, work or physical object,
whether in finished or intermediate form, arising from the use,
application or processing of Covered Source.
1.5 'Make' means to create or configure something, whether by
manufacture, assembly, compiling, loading or applying Covered
Source or another Product or otherwise.
1.6 'Notice' means copyright, acknowledgement and trademark notices,
references to the location of any Notices, modification notices
(subsection 3.3(b)) and all notices that refer to this Licence
and to the disclaimer of warranties that are included in the
Covered Source.
1.7 'Licensee' or 'You' means any person exercising rights under
this Licence.
1.8 'Licensor' means a person who creates Source or modifies Covered
Source and subsequently Conveys the resulting Covered Source
under the terms and conditions of this Licence. A person may be
a Licensee and a Licensor at the same time.
1.9 'Convey' means to communicate to the public or distribute.
2 Applicability
2.1 This Licence governs the use, copying, modification, Conveying
of Covered Source and Products, and the Making of Products. By
exercising any right granted under this Licence, You irrevocably
accept these terms and conditions.
2.2 This Licence is granted by the Licensor directly to You, and
shall apply worldwide and without limitation in time.
2.3 You shall not attempt to restrict by contract or otherwise the
rights granted under this Licence to other Licensees.
2.4 This Licence is not intended to restrict fair use, fair dealing,
or any other similar right.
3 Copying, Modifying and Conveying Covered Source
3.1 You may copy and Convey verbatim copies of Covered Source, in
any medium, provided You retain all Notices.
3.2 You may modify Covered Source, other than Notices.
You may only delete Notices if they are no longer applicable to
the corresponding Covered Source as modified by You and You may
add additional Notices applicable to Your modifications.
3.3 You may Convey modified Covered Source (with the effect that You
shall also become a Licensor) provided that You:
a) retain Notices as required in subsection 3.2; and
b) add a Notice to the modified Covered Source stating that You
have modified it, with the date and brief description of how
You have modified it.
3.4 You may Convey Covered Source or modified Covered Source under
licence terms which differ from the terms of this Licence
provided that:
a) You comply at all times with subsection 3.3; and
b) You provide a copy of this Licence to anyone to whom You
Convey Covered Source or modified Covered Source.
4 Making and Conveying Products
You may Make Products, and/or Convey them, provided that You ensure
that the recipient of the Product has access to any Notices applicable
to the Product.
5 DISCLAIMER AND LIABILITY
5.1 DISCLAIMER OF WARRANTY -- The Covered Source and any Products
are provided 'as is' and any express or implied warranties,
including, but not limited to, implied warranties of
merchantability, of satisfactory quality, non-infringement of
third party rights, and fitness for a particular purpose or use
are disclaimed in respect of any Source or Product to the
maximum extent permitted by law. The Licensor makes no
representation that any Source or Product does not or will not
infringe any patent, copyright, trade secret or other
proprietary right. The entire risk as to the use, quality, and
performance of any Source or Product shall be with You and not
the Licensor. This disclaimer of warranty is an essential part
of this Licence and a condition for the grant of any rights
granted under this Licence.
5.2 EXCLUSION AND LIMITATION OF LIABILITY -- The Licensor shall, to
the maximum extent permitted by law, have no liability for
direct, indirect, special, incidental, consequential, exemplary,
punitive or other damages of any character including, without
limitation, procurement of substitute goods or services, loss of
use, data or profits, or business interruption, however caused
and on any theory of contract, warranty, tort (including
negligence), product liability or otherwise, arising in any way
in relation to the Covered Source, modified Covered Source
and/or the Making or Conveyance of a Product, even if advised of
the possibility of such damages, and You shall hold the
Licensor(s) free and harmless from any liability, costs,
damages, fees and expenses, including claims by third parties,
in relation to such use.
6 Patents
6.1 Subject to the terms and conditions of this Licence, each
Licensor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as
stated in this section 6, or where terminated by the Licensor
for cause) patent license to Make, have Made, use, offer to
sell, sell, import, and otherwise transfer the Covered Source
and Products, where such licence applies only to those patent
claims licensable by such Licensor that are necessarily
infringed by exercising rights under the Covered Source as
Conveyed by that Licensor.
6.2 If You institute patent litigation against any entity (including
a cross-claim or counterclaim in a lawsuit) alleging that the
Covered Source or a Product constitutes direct or contributory
patent infringement, or You seek any declaration that a patent
licensed to You under this Licence is invalid or unenforceable
then any rights granted to You under this Licence shall
terminate as of the date such process is initiated.
7 General
7.1 If any provisions of this Licence are or subsequently become
invalid or unenforceable for any reason, the remaining
provisions shall remain effective.
7.2 You shall not use any of the name (including acronyms and
abbreviations), image, or logo by which the Licensor or CERN is
known, except where needed to comply with section 3, or where
the use is otherwise allowed by law. Any such permitted use
shall be factual and shall not be made so as to suggest any kind
of endorsement or implication of involvement by the Licensor or
its personnel.
7.3 CERN may publish updated versions and variants of this Licence
which it considers to be in the spirit of this version, but may
differ in detail to address new problems or concerns. New
versions will be published with a unique version number and a
variant identifier specifying the variant. If the Licensor has
specified that a given variant applies to the Covered Source
without specifying a version, You may treat that Covered Source
as being released under any version of the CERN-OHL with that
variant. If no variant is specified, the Covered Source shall be
treated as being released under CERN-OHL-S. The Licensor may
also specify that the Covered Source is subject to a specific
version of the CERN-OHL or any later version in which case You
may apply this or any later version of CERN-OHL with the same
variant identifier published by CERN.
7.4 This Licence shall not be enforceable except by a Licensor
acting as such, and third party beneficiary rights are
specifically excluded.

View File

@ -1,251 +0,0 @@
<div prefix="" file="product.html" context="machine" class="fragment"><span>Shredder &amp; Extrusion Controller</span>
<hr />
<hr />
Please always contact us through EMAIL : <b>sales@plastic-hub.com</b><br />
<hr />
<div prefix="" file="body.md" context="machine" class="fragment">
<p>Industrial grade shredder and/or extrusion controller, works with v3 and v4. This system adds max. possible safety.</p>
<p>This controller uses an industrial Arduino based controller as well a DIN rail current sensor
to detect jamming. Please check the wiki section for the source code and wiring details.</p>
<p>This system was 8 months in development and is mostly used in our products with educational contexts.</p>
<div>
<a href="https://precious-plastic.org/products/products/components/hal/drawings/overview.jpg" style="color:#4C74B9">
<p style="text-align: center">
<img width="100%" src="https://precious-plastic.org/products/products/components/hal/drawings/overview.jpg" />
</p>
</a>
</div>
<h3 id="features">Features</h3>
<ul>
<li>Very precise auto-reverse</li>
<li>Status lights : Ok &amp; Error</li>
<li>Emergency and reset button</li>
<li>Uses contactor for the power circuit</li>
<li>Extra motor protection (thermal &amp; magnetic).</li>
<li>Stops automatically after one hour of inactivity.</li>
<li>High quality cables and wiring according to industrial standards.</li>
<li>Won&#x2019;t start when power is back after powerloss</li>
<li>Incl. a VFD which enables to 3phase motors on single phase. Please let us know which voltage and power you&apos;d like to use.</li>
<li>Optional on request: Auto-Shredd (hopper filled sensor)</li>
<li>Optional on request: Auto-Suspend &amp; Resume (shut&apos;s down entire power circuit)</li>
<li>All components have warrenty and are CE certified</li>
<li>Modular open source firmware being also used in other products</li>
</ul>
<div>
<div style="padding: 16px; display: inline-block">
<div prefix="" file="product_resources.md" context="machine" class="fragment">
<p><strong>Product Resources</strong></p>
<ul>
<li><a href="https://myhub.autodesk360.com/ue2b6df80/g/shares/SH7f1edQT22b515c761e2cc46804b9803c4c" style="color:#4C74B9">3D Preview</a></li>
<li><a href="https://library.plastic-hub.com/machines/hal.html" style="color:#4C74B9">Wiki</a></li>
<li><a href="https://gitlab.com/plastichub/firmware/tree/master/shredder-extrusion/zoe" style="color:#4C74B9">Firmware - New</a></li>
<li><a href="https://precious-plastic.org/howto/#zoe" style="color:#4C74B9">Howtos - Machine builder</a></li>
</ul>
</div>
</div>
</div>
</div>
<br />
<hr />
<div prefix="" file="others.html" context="machine" class="fragment">
<div style="padding:16px;text-align: center;">
<h3> See our other products </h3>
<div class="ty-vendor-plans">
<div prefix="" file="elena.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/index.php?dispatch=products.view&amp;product_id=99" style="color:#4C74B9">
<img style="height:200px" height="200px" src="https://plastic-hub.com/products/elena/media/preview.jpg">
<br />
<p style="text-align: center;">Arbor Injection</p>
</img>
</a>
</div>
</div>
<div prefix="" file="sheetpress.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block;">
<a href="https://bazar.preciousplastic.com/index.php?dispatch=products.view&amp;product_id=210" style="color:#4C74B9">
<img width="height" src="https://plastic-hub.com/products/sheetpress-cell/media/latest2.jpg">
<br />
<p style="text-align: center;">Sheetpress Cell</p>
</img>
</a>
</div>
</div>
<div prefix="" file="lydia.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/index.php?dispatch=products.view&amp;product_id=179" style="color:#4C74B9">
<img height="200px" src="https://plastic-hub.com/products/lydia/media/preview.jpg">
<br />
<p style="text-align: center;">Extrusion v3</p>
</img>
</a>
</div>
</div>
<div prefix="" file="lydia-v4.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/index.php?dispatch=products.view&amp;product_id=159" style="color:#4C74B9">
<img height="200px" src="https://plastic-hub.com/products/lydia-v4/media/preview.jpg">
<br />
<p style="text-align: center;">Extrusion v4</p>
</img>
</a>
</div>
</div>
<div prefix="" file="shredder_v31.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/machines/shredder/shredder-kits/shredder-v3.1-and-hopper/" style="color:#4C74B9">
<img height="200px" src="https://plastic-hub.com/products/shredder/components/shredder_v31/media/overview.jpg">
<br />
<p style="text-align: center;">v3.1 Shredder with hopper and safety shields</p>
</img>
</a>
</div>
</div>
<div prefix="" file="obelix.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/machines/shredder-pro/shredder-pro-fully-built/upgraded-v4-shredder/" style="color:#4C74B9">
<img height="200px" src="https://plastic-hub.com/products/shredder/obelix/media/gallery/latest.jpg">
<br />
<p style="text-align: center;">Upgraded v4 Shredder &apos;Obelix&apos;</p>
</img>
</a>
</div>
</div>
<div prefix="" file="zoe.html" context="machine" class="fragment">
<div class="ty-grid-list__item" style="float: left;border-color: #c5c5c5;width: 300px;display: inline-block">
<a href="https://bazar.preciousplastic.com/index.php?dispatch=products.view&amp;product_id=152" style="color:#4C74B9">
<img height="200px" src="https://plastic-hub.com/products/zoe/media/preview.jpg">
<br />
<p style="text-align: center;">Shredder &amp; Extrusion Combo &apos;Zoe&apos;</p>
</img>
</a>
</div>
</div>
</div>
</div>
</div>
<div style="clear: both;">
<p style="text-align:center ;">
<a href="https://plastic-hub.com/products/" style="color:#4C74B9">See more products on our website</a>
</p>
</div>
<hr />
<div prefix="" file="vendor_links.html" context="machine" class="fragment">
<p style="color:#f58d8e;clear: both;text-align: center;">
<a href="https://www.instagram.com/plastichubcat/" style="color:#4C74B9"><span style="color:#f58d8e;">Instagram</span></a> |
<a href="https://gitlab.com/plastichub/pp-next" style="color:#4C74B9"><span style="color:#f58d8e;">Github (OpenSourceFiles)</span></a> |
<a href="mailto://sales@plastic-hub.com" style="color:#4C74B9"><span style="color:#f58d8e;">EMail</span></a> |
<a href="https://www.facebook.com/plastichubcat" style="color:#4C74B9"><span style="color:#f58d8e;">Facebook</span></a> |
<a href="https://library.plastic-hub.org/machines/" style="color:#4C74B9"><span style="color:#f58d8e;">Wiki</span></a> |
<a href="https://community.preciousplastic.com/u/plastichub" style="color:#4C74B9"><span style="color:#f58d8e;">Community map</span></a> |
<a href="https://forum.plastic-hub.com/" style="color:#4C74B9"><span style="color:#f58d8e;">Forum</span></a>
</p>
<p style="color:#f58d8e;clear: both;text-align: center;">
<a href="https://join.slack.com/t/pporgworkspace/shared_invite/zt-ki41lt0y-us2lp_bRsgh_uQHESXofLg" style="color:#4C74B9"><span style="color:#f58d8e;">Slack - Support &amp; Development Chat </span></a> |
<a href="tel://0034666894789" style="color:#4C74B9"><span style="color:#f58d8e;">Telefon - Whatsapp (English, French, German, Spanish,
Catalan)</span></a>
</p>
</div>
<hr />
<div prefix="" file="instagram.html" context="machine" class="fragment">
<div>
<h4 style="text-align: center;">Checkout our Instagram</h4>
<div class="ty-vendor-plans">
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://www.instagram.com/p/CGFEVPMHyNB/" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/resources/assets/instagram1.jpg" />
</a>
</p>
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://www.instagram.com/p/B1T3D3bHoke/" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/resources/assets/instagram2.jpg" />
</a>
</p>
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://www.instagram.com/p/CC8-hODqai0/" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/resources/assets/instagram3.jpg" />
</a>
</p>
</div>
</div>
</div>
<hr />
<div prefix="" file="projects.html" context="machine" class="fragment">
<div>
<h4 style="text-align: center;">Our latest Open Source projects</h4>
<div class="ty-vendor-plans">
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://plastic-hub.com/products/cassandra.html" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/cassandra/renderings/perspective.jpg" />
</a>
<span style="text-align: center; font-weight: bold;font-size: larger;">Mini Sheetpress</span>
</p>
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://plastic-hub.com/products/asterix.html" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/shredder/asterix/renderings/perspective.png" />
</a>
<span style="text-align: center; font-weight: bold;font-size: larger;">Vending Shredder</span>
</p>
<p class="ty-grid-list__item" style="float:left;border-color:#c5c5c5;width: 300px;display: inline-block">
<a href="https://plastic-hub.com/products/PrintHead/media/preview.jpg.jpg" style="color:#4C74B9">
<img width="300" src="https://plastic-hub.com/products/PrintHead/media/preview.jpg.jpg" />
</a>
<span style="text-align: center;font-weight: bold;font-size: larger;">3D Printhead for industrial robots</span>
</p>
</div>
</div>
</div>
<hr />
<div prefix="" file="footer.md" context="machine" class="fragment">
<p>
<div prefix="" file="social.html" context="machine" class="fragment">
<table style="display:table;width:auto;margin-left:auto;margin-right:auto">
<tbody>
<tr>
<td>
<a href="https://www.instagram.com/plastichubcat" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/instagram-logo.png" />
</a>
</td>
<td>
<a href="https://www.youtube.com/channel/UCuWDxJtV2pf5BefHEy09Cew/featured?view_as=subscriber" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/002-youtube.png" />
</a>
</td>
<td>
<a alt="Open Source Projects" href="https://gitlab.com/plastichub" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/github.png" />
</a>
</td>
<td>
<a alt="" href="tel:0034666894789" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/007-whatsapp.png" />
</a>
</td>
<td>
<a alt="" href="https://www.facebook.com/plastichubcat/" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/043-facebook-1.png" />
</a>
</td>
<td>
<a alt="" href="mailto:sales@plastic-hub.com" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/012-mail-2.png" />
</a>
</td>
<td>
<a alt="" href="https://plastic-hub.com/blog" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/006-wordpress.png" />
</a>
</td>
<td>
<a alt="" href="https://discord.gg/SN6MT5N" style="color:#4C74B9">
<img width="30px" src="https://precious-plastic.org/products/bazar/assets/discord.png" />
</a>
</td>
</tr>
</tbody>
</table>
</div>
</p>
</div>
</div>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
zoe/cad/100_Controller/cad/700_Hal.SLDASM (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
zoe/cad/100_Controller/cad/Hal_Casing.STEP (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
zoe/cad/100_Controller/cad/door.sldprt (Stored with Git LFS)

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

BIN
zoe/cad/100_Controller/cad/ecab_front.STEP (Stored with Git LFS)

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
ph-cli svg2jpg --debug=true --input="./resources/"

View File

@ -1,18 +0,0 @@
Addon / Component,ATMegaPin,Controllino Pin,Component & Pin,Source File
,,,,
VFD - Forward,9,CONTROLLINO_D5,S41-FWD,[VFD.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/VFD.h)
VFD - Reverse,8,CONTROLLINO_D4,S41-REV,[VFD.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/VFD.h)
,,,,
Direction Switch - Up,15,CONTROLLINO_A1,S1 - 3,[DirectionSwitch.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/DirectionSwitch.h)
Direction Switch - Down,14,CONTROLLINO_A0,S1 - 1,[DirectionSwitch.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/DirectionSwitch.h)
,,,,
Auto-Reverse-Mode - Up,17,CONTROLLINO_A3,S2 - 3,[AutoReverseMode.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/AutoReverseMode.h)
Auto-Reverse-Mode - Down,16,CONTROLLINO_A2,S2 - 1,[AutoReverseMode.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/AutoReverseMode.h)
,,,,
Status - LED - Error,7,CONTROLLINO_D3,S31 - X1,[Status.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/Status.h)
Status - LED - Ok,6,CONTROLLINO_D2,S30 - X1,[Status.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/Status.h)
,,,,
Extrusion - Record,21,CONTROLLINO_A4,S3-13,[ExtrusionReplay.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/ExtrusionReplay.h)
Extrusion - Replay,20,CONTROLLINO_A5,S3-14,[ExtrusionReplay.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/ExtrusionReplay.h)
,,,,
Current Sensor,2,CONTROLLINO_IN0,S40 - 14,[CurrentSensor.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/CurrentSensor.h)
1 Addon / Component ATMegaPin Controllino Pin Component & Pin Source File
2
3 VFD - Forward 9 CONTROLLINO_D5 S41-FWD [VFD.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/VFD.h)
4 VFD - Reverse 8 CONTROLLINO_D4 S41-REV [VFD.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/VFD.h)
5
6 Direction Switch - Up 15 CONTROLLINO_A1 S1 - 3 [DirectionSwitch.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/DirectionSwitch.h)
7 Direction Switch - Down 14 CONTROLLINO_A0 S1 - 1 [DirectionSwitch.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/DirectionSwitch.h)
8
9 Auto-Reverse-Mode - Up 17 CONTROLLINO_A3 S2 - 3 [AutoReverseMode.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/AutoReverseMode.h)
10 Auto-Reverse-Mode - Down 16 CONTROLLINO_A2 S2 - 1 [AutoReverseMode.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/AutoReverseMode.h)
11
12 Status - LED - Error 7 CONTROLLINO_D3 S31 - X1 [Status.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/Status.h)
13 Status - LED - Ok 6 CONTROLLINO_D2 S30 - X1 [Status.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/Status.h)
14
15 Extrusion - Record 21 CONTROLLINO_A4 S3-13 [ExtrusionReplay.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/ExtrusionReplay.h)
16 Extrusion - Replay 20 CONTROLLINO_A5 S3-14 [ExtrusionReplay.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/ExtrusionReplay.h)
17
18 Current Sensor 2 CONTROLLINO_IN0 S40 - 14 [CurrentSensor.h](https://gitlab.com/plastichub/firmware/blob/master/shredder-extrusion/zoe/addons/CurrentSensor.h)

View File

@ -1,29 +0,0 @@
{
"product_name":"Shredder & Extrusion Controller",
"slug": "hal",
"category": "component",
"tags" : "extrusion, shredder, v3, electronics",
"price" : "3154 Euro",
"price_total" : "3400 Euro (VAT & transport)",
"shipping_eu" : "120 Euro",
"product_cad": "https://gitlab.com/plastichub/products/tree/master/products/components/hal/cad",
"product_github" : "https://gitlab.com/plastichub/products/tree/master/products/components/hal",
"product_3d" : "https://myhub.autodesk360.com/ue2b6df80/g/shares/SH7f1edQT22b515c761e2cc46804b9803c4c",
"product_wiki" : "https://library.plastic-hub.com/machines/hal.html",
"product_wiring" : "https://precious-plastic.org/products/products/components/hal/electrics/wiring.png",
"product_overview": "https://precious-plastic.org/products/products/components/hal/drawings/overview.jpg",
"product_firmware": "https://gitlab.com/plastichub/firmware/tree/master/shredder-extrusion/zoe",
"product_firmware_old": "https://gitlab.com/plastichub/firmware/tree/master/shredder-extrusion/firmware",
"product_howtos": "https://precious-plastic.org/howto/#zoe",
"product_assembly" : "https://library.plastic-hub.com/howto/zoe/assembly/base/index.html",
"product_preview": "https://precious-plastic.org/products/products/components/hal/media/front.jpg",
"product_perspective": "${abs_url}/${product_rel}/renderings/perspective.jpg",
"product_dimensions": "${OSR_MACHINES_ASSETS_URL}/${product_rel_min}/drawings/dimensions.jpg",
"product_parts": "${OSR_MACHINES_ASSETS_URL}/${product_rel_min}/drawings/parts.jpg",
"parts":"parts.csv" ,
"component_digital" : "components_digital.csv",
"component_wiring_source" : "https://docs.google.com/spreadsheets/d/1u2YR3Zt2lCD20yn_ffU93bB5otYP1g8DKUFz3GCtG1I/edit?usp=sharing",
"product_download": "https://precious-plastic.org/products/products/lydia-v4/renderings/perspective.jpg",
"download" : "${site}/archives/${slug}.zip",
"Preview3d": true
}

View File

@ -1,11 +0,0 @@
alternative: lydia-v4
similar: lydia-v4
product_id: hal
usedin:
- zoe
- shredder-pro
- extrusion-pro
- lydia-v4
wiring: true
overview_drawing: true
type: component

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
zoe/cad/100_Controller/drawings/parts.PDF (Stored with Git LFS)

Binary file not shown.

BIN
zoe/cad/100_Controller/drawings/parts.jpg (Stored with Git LFS)

Binary file not shown.

BIN
zoe/cad/100_Controller/firmware/vendor/eswitch.pdf (Stored with Git LFS) vendored

Binary file not shown.

View File

@ -1,5 +0,0 @@
Debug
src
__vm
.vs
node_modules

View File

@ -1,51 +0,0 @@
#include "Addon.h"
#include <Streaming.h>
#include <Vector.h>
#include <Arduino.h>
bool Addon::hasFlag(uchar flag)
{
return TEST(flags, flag);
}
void Addon::setFlag(uchar flag)
{
flags = SBI(flags, flag);
}
void Addon::clearFlag(uchar flag)
{
CBI(flags, flag);
}
void Addon::debug(Stream *stream)
{
}
void Addon::info(Stream *stream)
{
}
void Addon::enable()
{
this->clearFlag(DISABLED);
}
void Addon::disable()
{
this->setFlag(DISABLED);
}
bool Addon::enabled()
{
return this->hasFlag(DISABLED);
}
Addon *byId(Addons addons, uchar id)
{
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->id == id)
{
return addon;
}
}
return NULL;
}

View File

@ -1,72 +0,0 @@
#ifndef ADDON_H
#define ADDON_H
#include <WString.h>
#include <Vector.h>
#include "enums.h"
#include "common/macros.h"
#define ADDON_NORMAL 1 << LOOP | 1 << INFO | 1 << SETUP
#ifdef HAS_STATES
#define ADDON_STATED ADDON_NORMAL | 1 << STATE
#else
#define ADDON_STATED ADDON_NORMAL
#endif
class Stream;
class Addon
{
public:
const String name;
const short id;
millis_t now;
millis_t last;
millis_t dt;
Addon(String _name, short _id) : name(_name),
id(_id),
now(0),
last(0),
dt(0)
{
flags = ADDON_NORMAL;
}
Addon(String _name, short _id, short _flags) : name(_name),
id(_id),
flags(_flags)
{
}
virtual void debug(Stream *stream);
virtual void info(Stream *stream);
virtual short setup(){};
virtual short loop(){};
virtual short ok(){};
virtual bool pause(){};
virtual bool resume(){};
virtual bool destroy(){};
virtual String state() { return ""; };
int flags;
void setFlag(uchar flag);
bool hasFlag(uchar flag);
void clearFlag(uchar flag);
void enable();
void disable();
bool enabled();
#ifdef HAS_ADDON_EEP_STORE
void save(void* store);
void restore(void* store);
#endif
};
typedef Vector<Addon *> Addons;
Addon *byId(Addons addons, uchar id);
typedef short (Addon::*AddonFnPtr)(short);
#endif

View File

@ -1,5 +0,0 @@
# TODOS
- new PHStudio widgets: PID control & Display
- info tab: vfd status, PID status, sensor LEDS
- HMIs: shredder, extrusion, shredder && extrusion, asterix

View File

@ -1,54 +0,0 @@
/*
* Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
* Original code by Jesse Tane for http://labs.ideo.com August 2008
* Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support
* Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop
* Modified Oct 2009 by Dan Clemens to work with timer1 of the ATMega1280 or Arduino Mega
* Modified April 2012 by Paul Stoffregen
* Modified again, June 2014 by Paul Stoffregen
* Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality
*
* This is free software. You can redistribute it and/or modify it under
* the terms of Creative Commons Attribution 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#include "TimerOne.h"
TimerOne Timer1; // preinstatiate
unsigned short TimerOne::pwmPeriod = 0;
unsigned char TimerOne::clockSelectBits = 0;
void (*TimerOne::isrCallback)() = TimerOne::isrDefaultUnused;
// interrupt service routine that wraps a user defined function supplied by attachInterrupt
#if defined (__AVR_ATtiny85__)
ISR(TIMER1_COMPA_vect)
{
Timer1.isrCallback();
}
#elif defined(__AVR__)
ISR(TIMER1_OVF_vect)
{
Timer1.isrCallback();
}
#elif defined(__arm__) && defined(CORE_TEENSY)
void ftm1_isr(void)
{
uint32_t sc = FTM1_SC;
#ifdef KINETISL
if (sc & 0x80) FTM1_SC = sc;
#else
if (sc & 0x80) FTM1_SC = sc & 0x7F;
#endif
Timer1.isrCallback();
}
#endif
void TimerOne::isrDefaultUnused()
{
}

View File

@ -1,485 +0,0 @@
/*
* Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328
* Original code by Jesse Tane for http://labs.ideo.com August 2008
* Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support
* Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop
* Modified April 2012 by Paul Stoffregen - portable to other AVR chips, use inline functions
* Modified again, June 2014 by Paul Stoffregen - support Teensy 3.x & even more AVR chips
* Modified July 2017 by Stoyko Dimitrov - added support for ATTiny85 except for the PWM functionality
*
*
* This is free software. You can redistribute it and/or modify it under
* the terms of Creative Commons Attribution 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/
* or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#ifndef TimerOne_h_
#define TimerOne_h_
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "config/known_16bit_timers.h"
#if defined (__AVR_ATtiny85__)
#define TIMER1_RESOLUTION 256UL // Timer1 is 8 bit
#elif defined(__AVR__)
#define TIMER1_RESOLUTION 65536UL // Timer1 is 16 bit
#else
#define TIMER1_RESOLUTION 65536UL // assume 16 bits for non-AVR chips
#endif
// Placing nearly all the code in this .h file allows the functions to be
// inlined by the compiler. In the very common case with constant values
// the compiler will perform all calculations and simply write constants
// to the hardware registers (for example, setPeriod).
class TimerOne
{
#if defined (__AVR_ATtiny85__)
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
TCCR1 = _BV(CTC1); //clear timer1 when it matches the value in OCR1C
TIMSK |= _BV(OCIE1A); //enable interrupt when OCR1A matches the timer value
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = microseconds * ratio;
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = _BV(CS10);
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 2UL) {
clockSelectBits = _BV(CS11);
pwmPeriod = cycles / 2;
} else
if (cycles < TIMER1_RESOLUTION * 4UL) {
clockSelectBits = _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 4;
} else
if (cycles < TIMER1_RESOLUTION * 8UL) {
clockSelectBits = _BV(CS12);
pwmPeriod = cycles / 8;
} else
if (cycles < TIMER1_RESOLUTION * 16UL) {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 16;
} else
if (cycles < TIMER1_RESOLUTION * 32UL) {
clockSelectBits = _BV(CS12) | _BV(CS11);
pwmPeriod = cycles / 32;
} else
if (cycles < TIMER1_RESOLUTION * 64UL) {
clockSelectBits = _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 64UL;
} else
if (cycles < TIMER1_RESOLUTION * 128UL) {
clockSelectBits = _BV(CS13);
pwmPeriod = cycles / 128;
} else
if (cycles < TIMER1_RESOLUTION * 256UL) {
clockSelectBits = _BV(CS13) | _BV(CS10);
pwmPeriod = cycles / 256;
} else
if (cycles < TIMER1_RESOLUTION * 512UL) {
clockSelectBits = _BV(CS13) | _BV(CS11);
pwmPeriod = cycles / 512;
} else
if (cycles < TIMER1_RESOLUTION * 1024UL) {
clockSelectBits = _BV(CS13) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 1024;
} else
if (cycles < TIMER1_RESOLUTION * 2048UL) {
clockSelectBits = _BV(CS13) | _BV(CS12);
pwmPeriod = cycles / 2048;
} else
if (cycles < TIMER1_RESOLUTION * 4096UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 4096;
} else
if (cycles < TIMER1_RESOLUTION * 8192UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11);
pwmPeriod = cycles / 8192;
} else
if (cycles < TIMER1_RESOLUTION * 16384UL) {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 16384;
} else {
clockSelectBits = _BV(CS13) | _BV(CS12) | _BV(CS11) | _BV(CS10);
pwmPeriod = TIMER1_RESOLUTION - 1;
}
OCR1A = pwmPeriod;
OCR1C = pwmPeriod;
TCCR1 = _BV(CTC1) | clockSelectBits;
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
TCCR1 = 0;
TCNT1 = 0;
resume();
}
void stop() __attribute__((always_inline)) {
TCCR1 = _BV(CTC1);
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
TCCR1 = _BV(CTC1) | clockSelectBits;
}
//****************************
// PWM outputs
//****************************
//Not implemented yet for ATTiny85
//TO DO
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
TIMSK |= _BV(OCIE1A);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
//TIMSK = 0; // Timer 0 and Timer 1 both use TIMSK register so setting it to 0 will override settings for Timer1 as well
TIMSK &= ~_BV(OCIE1A);
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
static const byte ratio = (F_CPU)/ ( 1000000 );
#elif defined(__AVR__)
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer
TCCR1A = 0; // clear control register A
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = (F_CPU / 2000000) * microseconds;
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = _BV(CS10);
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = _BV(CS11);
pwmPeriod = cycles / 8;
} else
if (cycles < TIMER1_RESOLUTION * 64) {
clockSelectBits = _BV(CS11) | _BV(CS10);
pwmPeriod = cycles / 64;
} else
if (cycles < TIMER1_RESOLUTION * 256) {
clockSelectBits = _BV(CS12);
pwmPeriod = cycles / 256;
} else
if (cycles < TIMER1_RESOLUTION * 1024) {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = cycles / 1024;
} else {
clockSelectBits = _BV(CS12) | _BV(CS10);
pwmPeriod = TIMER1_RESOLUTION - 1;
}
ICR1 = pwmPeriod;
TCCR1B = _BV(WGM13) | clockSelectBits;
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
TCCR1B = 0;
TCNT1 = 0; // TODO: does this cause an undesired interrupt?
resume();
}
void stop() __attribute__((always_inline)) {
TCCR1B = _BV(WGM13);
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
TCCR1B = _BV(WGM13) | clockSelectBits;
}
//****************************
// PWM outputs
//****************************
void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) {
unsigned long dutyCycle = pwmPeriod;
dutyCycle *= duty;
dutyCycle >>= 10;
if (pin == TIMER1_A_PIN) OCR1A = dutyCycle;
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) OCR1B = dutyCycle;
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) OCR1C = dutyCycle;
#endif
}
void pwm(char pin, unsigned int duty) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); }
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) { pinMode(TIMER1_B_PIN, OUTPUT); TCCR1A |= _BV(COM1B1); }
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) { pinMode(TIMER1_C_PIN, OUTPUT); TCCR1A |= _BV(COM1C1); }
#endif
setPwmDuty(pin, duty);
TCCR1B = _BV(WGM13) | clockSelectBits;
}
void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) {
if (microseconds > 0) setPeriod(microseconds);
pwm(pin, duty);
}
void disablePwm(char pin) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1);
#ifdef TIMER1_B_PIN
else if (pin == TIMER1_B_PIN) TCCR1A &= ~_BV(COM1B1);
#endif
#ifdef TIMER1_C_PIN
else if (pin == TIMER1_C_PIN) TCCR1A &= ~_BV(COM1C1);
#endif
}
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
TIMSK1 = _BV(TOIE1);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
TIMSK1 = 0;
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
// properties
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
#elif defined(__arm__) && defined(CORE_TEENSY)
#if defined(KINETISK)
#define F_TIMER F_BUS
#elif defined(KINETISL)
#define F_TIMER (F_PLL/2)
#endif
public:
//****************************
// Configuration
//****************************
void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) {
setPeriod(microseconds);
}
void setPeriod(unsigned long microseconds) __attribute__((always_inline)) {
const unsigned long cycles = (F_TIMER / 2000000) * microseconds;
// A much faster if-else
// This is like a binary serch tree and no more than 3 conditions are evaluated.
// I haven't checked if this becomes significantly longer ASM than the simple ladder.
// It looks very similar to the ladder tho: same # of if's and else's
/*
// This code does not work properly in all cases :(
// https://github.com/PaulStoffregen/TimerOne/issues/17
if (cycles < TIMER1_RESOLUTION * 16) {
if (cycles < TIMER1_RESOLUTION * 4) {
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = 0;
pwmPeriod = cycles;
}else{
clockSelectBits = 1;
pwmPeriod = cycles >> 1;
}
}else{
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = 3;
pwmPeriod = cycles >> 3;
}else{
clockSelectBits = 4;
pwmPeriod = cycles >> 4;
}
}
}else{
if (cycles > TIMER1_RESOLUTION * 64) {
if (cycles > TIMER1_RESOLUTION * 128) {
clockSelectBits = 7;
pwmPeriod = TIMER1_RESOLUTION - 1;
}else{
clockSelectBits = 7;
pwmPeriod = cycles >> 7;
}
}
else{
if (cycles > TIMER1_RESOLUTION * 32) {
clockSelectBits = 6;
pwmPeriod = cycles >> 6;
}else{
clockSelectBits = 5;
pwmPeriod = cycles >> 5;
}
}
}
*/
if (cycles < TIMER1_RESOLUTION) {
clockSelectBits = 0;
pwmPeriod = cycles;
} else
if (cycles < TIMER1_RESOLUTION * 2) {
clockSelectBits = 1;
pwmPeriod = cycles >> 1;
} else
if (cycles < TIMER1_RESOLUTION * 4) {
clockSelectBits = 2;
pwmPeriod = cycles >> 2;
} else
if (cycles < TIMER1_RESOLUTION * 8) {
clockSelectBits = 3;
pwmPeriod = cycles >> 3;
} else
if (cycles < TIMER1_RESOLUTION * 16) {
clockSelectBits = 4;
pwmPeriod = cycles >> 4;
} else
if (cycles < TIMER1_RESOLUTION * 32) {
clockSelectBits = 5;
pwmPeriod = cycles >> 5;
} else
if (cycles < TIMER1_RESOLUTION * 64) {
clockSelectBits = 6;
pwmPeriod = cycles >> 6;
} else
if (cycles < TIMER1_RESOLUTION * 128) {
clockSelectBits = 7;
pwmPeriod = cycles >> 7;
} else {
clockSelectBits = 7;
pwmPeriod = TIMER1_RESOLUTION - 1;
}
uint32_t sc = FTM1_SC;
FTM1_SC = 0;
FTM1_MOD = pwmPeriod;
FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_CPWMS | clockSelectBits | (sc & FTM_SC_TOIE);
}
//****************************
// Run Control
//****************************
void start() __attribute__((always_inline)) {
stop();
FTM1_CNT = 0;
resume();
}
void stop() __attribute__((always_inline)) {
FTM1_SC = FTM1_SC & (FTM_SC_TOIE | FTM_SC_CPWMS | FTM_SC_PS(7));
}
void restart() __attribute__((always_inline)) {
start();
}
void resume() __attribute__((always_inline)) {
FTM1_SC = (FTM1_SC & (FTM_SC_TOIE | FTM_SC_PS(7))) | FTM_SC_CPWMS | FTM_SC_CLKS(1);
}
//****************************
// PWM outputs
//****************************
void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) {
unsigned long dutyCycle = pwmPeriod;
dutyCycle *= duty;
dutyCycle >>= 10;
if (pin == TIMER1_A_PIN) {
FTM1_C0V = dutyCycle;
} else if (pin == TIMER1_B_PIN) {
FTM1_C1V = dutyCycle;
}
}
void pwm(char pin, unsigned int duty) __attribute__((always_inline)) {
setPwmDuty(pin, duty);
if (pin == TIMER1_A_PIN) {
*portConfigRegister(TIMER1_A_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;
} else if (pin == TIMER1_B_PIN) {
*portConfigRegister(TIMER1_B_PIN) = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE;
}
}
void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) {
if (microseconds > 0) setPeriod(microseconds);
pwm(pin, duty);
}
void disablePwm(char pin) __attribute__((always_inline)) {
if (pin == TIMER1_A_PIN) {
*portConfigRegister(TIMER1_A_PIN) = 0;
} else if (pin == TIMER1_B_PIN) {
*portConfigRegister(TIMER1_B_PIN) = 0;
}
}
//****************************
// Interrupt Function
//****************************
void attachInterrupt(void (*isr)()) __attribute__((always_inline)) {
isrCallback = isr;
FTM1_SC |= FTM_SC_TOIE;
NVIC_ENABLE_IRQ(IRQ_FTM1);
}
void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) {
if(microseconds > 0) setPeriod(microseconds);
attachInterrupt(isr);
}
void detachInterrupt() __attribute__((always_inline)) {
FTM1_SC &= ~FTM_SC_TOIE;
NVIC_DISABLE_IRQ(IRQ_FTM1);
}
static void (*isrCallback)();
static void isrDefaultUnused();
private:
// properties
static unsigned short pwmPeriod;
static unsigned char clockSelectBits;
#undef F_TIMER
#endif
};
extern TimerOne Timer1;
#endif

View File

@ -1,111 +0,0 @@
#ifndef VFD_H
#define VFD_H
#include <Streaming.h>
#include "./Addon.h"
#include "./enums.h"
#include "./config.h"
#ifdef HAS_STATES
#include <ArduinoJson.h>
#endif
class VFD : public Addon
{
public:
enum DIRECTION
{
FORWARD = 1,
STOP = 0,
REVERSE = 2
};
VFD() : Addon(VFD_STR, VFD_CONTROL),
direction(STOP){};
void rev(short nop)
{
update(DIRECTION::REVERSE);
}
void fwd(short nop)
{
update(DIRECTION::FORWARD);
}
short setup()
{
pinMode(FWD_PIN, OUTPUT);
pinMode(REV_PIN, OUTPUT);
stop();
}
short stop(short nop = 0)
{
update(DIRECTION::STOP);
}
void speed(int aValue)
{
}
virtual void debug(Stream *stream)
{
// *stream << this->name << ":" << SPACE(direction);
}
virtual void info(Stream *stream)
{
*stream << this->name << "\n\t" << SPACE(": Forward Pin " << FWD_PIN << " | Reverse Pin " << REV_PIN);
}
uchar direction;
uchar lastDirection;
millis_t dt;
#ifdef HAS_STATES
String state()
{
const int capacity = JSON_OBJECT_SIZE(2);
StaticJsonDocument<capacity> doc;
doc["0"] = id;
doc["1"] = direction;
return doc.as<String>();
}
#endif
private:
void update(uchar newDirection)
{
if (direction != newDirection)
{
dt = now;
lastDirection = direction;
direction = newDirection;
switch (direction)
{
case DIRECTION::FORWARD:
{
digitalWrite(REV_PIN, LOW);
digitalWrite(FWD_PIN, HIGH);
break;
}
case DIRECTION::REVERSE:
{
digitalWrite(FWD_PIN, LOW);
digitalWrite(REV_PIN, HIGH);
break;
}
case DIRECTION::STOP:
{
digitalWrite(FWD_PIN, LOW);
digitalWrite(REV_PIN, LOW);
break;
}
}
}
}
};
#endif

View File

@ -1,9 +0,0 @@
#ifndef VERSION_H
#define VERSION_H
#define VERSION "0.7|2f05843f89b2b8f6d75276ba363f7c2e17383e0b"
#define CID "47"
#endif

View File

@ -1,35 +0,0 @@
#ifndef MOTOR_AUTO_REVERSE_H
#define MOTOR_AUTO_REVERSE_H
#include <Arduino.h>
#include "../Addon.h"
#include "../config.h"
#include <Streaming.h>
#include "../macros.h"
#include "../enums.h"
class App;
class AutoReverse : Addon
{
public:
AutoReverse(App *app);
AutoReverse() : Addon(AUTO_REVERSE_STR, AUTO_REVERSE) {}
virtual short setup()
{
}
virtual short ok()
{
return true;
}
void debug(Stream *stream)
{
// *stream << this->name << ":" << this->ok();
}
void info(Stream *stream)
{
// *stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN);
}
};
#endif

View File

@ -1,73 +0,0 @@
#ifndef AUTO_REVERSE_MODE_H
#define AUTO_REVERSE_MODE_H
#include "../config.h"
#include "../components/3PosAnalog.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../common/macros.h"
class AutoReverseMode : public Addon
{
public:
Pos3Analog dir_switch;
AutoReverseMode(short up, short down) : dir_switch(up, down),
Addon(AUTO_REVERSE_MODE_STR, AUTO_REVERSE_MODE)
{
// setFlag(DEBUG);
}
void debug(Stream *stream)
{
*stream << this->name << ":" << SPACE(dir_switch.switch_pos) << SPACE(dir_switch.last_switch) << SPACE(_value) " | ";
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Up Pin:" << dir_switch.upPin) << SPACE("\t | Down Pin :" << dir_switch.downPin);
}
short setup()
{
dir_switch.setup();
dir_switch.loop();
return loop();
}
short loop()
{
if (now - dt > ANALOG_READ_INTERVAL)
{
_value = dir_switch.loop();
switch (_value)
{
case POS3_DIRECTION::UP:
{
_value = AR_MODE::NORMAL;
break;
}
case POS3_DIRECTION::MIDDLE:
{
_value = AR_MODE::NONE;
break;
}
case POS3_DIRECTION::DOWN:
{
_value = AR_MODE::EXTRUSION;
break;
}
}
dt = now;
}
return _value;
}
short value()
{
return _value;
}
private:
short _value;
};
#endif

View File

@ -1,59 +0,0 @@
#ifndef CURRENT_SENSOR_H
#define CURRENT_SENSOR_H
#include <Arduino.h>
#include <Streaming.h>
#include "../Addon.h"
#include "../config.h"
#include "../common/macros.h"
#include "../common/ppmath.h"
class CurrentSensor : public Addon
{
public:
CurrentSensor(short _pin) : pin(_pin),
load(0),
Addon(CURRENT_SENSOR_STR, CURRENT_SENSOR)
{
// this->setFlag(DEBUG);
}
short setup()
{
pinMode(pin, INPUT);
loop();
}
short loop()
{
if (now - last > MOTOR_LOAD_READ_INTERVAL)
{
load = digitalRead(pin);
last = now;
}
return load;
}
short ok()
{
return !load;
}
void debug(Stream *stream)
{
*stream << this->name << ":" << ok();
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Pin:" << pin);
}
millis_t lastOverload;
protected:
short pin;
short load;
};
#endif

View File

@ -1,56 +0,0 @@
#ifndef DIRECTION_SWITCH_H
#define DIRECTION_SWITCH_H
#include "../config.h"
#include "../components/3PosAnalog.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../common/macros.h"
class DirectionSwitch : public Addon
{
public:
Pos3Analog dir_switch;
DirectionSwitch() : dir_switch(DIR_SWITCH_UP_PIN, DIR_SWITCH_DOWN_PIN),
Addon(DIRECTION_SWITCH_STR, DIRECTION_SWITCH)
{
// setFlag(DEBUG);
}
void debug(Stream *stream)
{
*stream << this->name << ":" << SPACE(dir_switch.switch_pos) << SPACE(dir_switch.last_switch);
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Up Pin:" << DIR_SWITCH_UP_PIN) << SPACE("\t | Down Pin :" << DIR_SWITCH_DOWN_PIN);
}
short setup()
{
dir_switch.setup();
return loop();
}
short loop()
{
if (now - dt > ANALOG_READ_INTERVAL)
{
_value = dir_switch.loop();
dt = now;
}
return _value;
}
short value()
{
return _value;
}
short last()
{
return dir_switch.last_switch;
}
private:
short _value;
};
#endif

View File

@ -1,89 +0,0 @@
#ifndef EXTRUSION_REPLAY_H
#define EXTRUSION_REPLAY_H
#include <Arduino.h>
#include <Streaming.h>
#include "../config.h"
#include "../common/macros.h"
class ExtrusionReplay : public Addon
{
public:
ExtrusionReplay(short _recordPin, short _replayPin) : recordPin(_recordPin),
replayPin(_replayPin),
lastRecordTS(0),
lastReplayTS(0),
recordTime(0),
recordOn(false),
replayOn(false),
Addon(EXTRUSION_REPLAY_STR, EXTRUSION_REPLAY)
{
// setFlag(DEBUG);
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Record pin:" << recordPin) << SPACE("\t | Replay Pin :" << replayPin);
}
void debug(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Record on:" << recordOn) << SPACE("\t | Replay on :" << replayOn) << SPACE("\t Record Time : " << recordTime);
}
short setup()
{
}
short ok()
{
}
short loop()
{
read();
}
short read()
{
bool _recordOn = RANGE(analogRead(recordPin), EXTRUSION_REPLAY_LEVEL - 100, 1024);
if (!recordOn && _recordOn)
{
lastRecordTS = now;
recordOn = true;
recordTime = 0;
}
if (recordOn && !_recordOn)
{
recordTime = now - lastRecordTS;
recordOn = false;
}
bool _replayOn = RANGE(analogRead(replayPin), EXTRUSION_REPLAY_LEVEL - 100, 1024);
if (_replayOn && !replayOn)
{
replayOn = _replayOn;
lastReplayTS = now;
replay = true;
}
if (!_replayOn && replayOn)
{
replayOn = false;
}
}
millis_t recordTime;
bool recordOn;
millis_t lastReplayTS;
bool replayOn;
bool replay;
private:
short recordPin;
short replayPin;
millis_t lastRecordTS;
};
#endif

View File

@ -1,87 +0,0 @@
#ifndef HOPPERLOADED_H
#define HOPPERLOADED_H
#ifdef HAS_STATES
#include <ArduinoJson.h>
#endif
#include <Streaming.h>
#include "../Addon.h"
#include "../config.h"
#include "../common/macros.h"
#include "../components/PhotoElectricSensor.h"
// Addon to detect when there is something in the hopper
class HopperLoaded : public Addon
{
private:
PhotoElectricSensor sensor0;
#ifdef HOPPER_LOADED_1
PhotoElectricSensor sensor1;
#endif
public:
#ifdef HAS_STATES
String HopperLoaded::state()
{
const int capacity = JSON_OBJECT_SIZE(2);
StaticJsonDocument<capacity> doc;
doc["0"] = id;
doc["1"] = ok() ? 1 : 0;
return doc.as<String>();
}
#endif
#ifdef HOPPER_LOADED_1
HopperLoaded(short h1Pin, short h2Pin) : sensor0(h1Pin, HOPPER_LOADED_INTERVAL),
sensor1(h2Pin, HOPPER_LOADED_INTERVAL),
Addon(HOPPER_LOADED_STR, HOPPER_LOADED, ADDON_STATED)
{
// this->setFlag(DEBUG);
}
#else
HopperLoaded(short h1Pin) : sensor0(h1Pin, HOPPER_LOADED_INTERVAL),
Addon(HOPPER_LOADED_STR, HOPPER_LOADED)
{
// this->setFlag(DEBUG);
}
#endif
virtual short loop()
{
#ifdef HOPPER_LOADED_1
this->sensor0.loop();
this->sensor1.loop();
#else
this->sensor0.loop();
#endif
}
#ifdef TESTING
// test override
virtual short ok()
{
return test;
}
#else
virtual short ok()
{
return sensor0.ok(); // || sensor1.ok();
}
#endif
void debug(Stream *stream)
{
// *stream << this->name << ":" << this->ok() << "\n\t" << SPACE("h ts " << this->sensor0.highTS) << "\n\t" << SPACE("l ts " << this->sensor0.lowTS) << "\n\t" << SPACE("dt " << this->sensor0.dt);
}
void info(Stream *stream)
{
#ifdef HOPPER_LOADED_1
*stream << this->name << "\n\t : " << SPACE("HOPPER LOADED 0" << HOPPER_LOADED_0) << SPACE("HOPPER LOADED 1" << HOPPER_LOADED_1);
#endif
}
#ifdef TESTING
bool test;
#endif
};
#endif

View File

@ -1,32 +0,0 @@
#ifndef MOTOR_IDLE_H
#define MOTOR_IDLE_H
#include <Arduino.h>
#include "Addon.h"
#include "config.h"
#include <Streaming.h>
#include "../common/macros.h"
class MotorIdle : public Addon
{
public:
MotorIdle() : Addon(MOTOR_IDLE_STR, MOTOR_IDLE) {}
virtual short setup()
{
pinMode(MOTOR_IDLE_PIN, INPUT_PULLUP);
}
virtual short ok()
{
return !digitalRead(MOTOR_IDLE_PIN);
}
void debug(Stream *stream)
{
//*stream << this->name << ":" << this->ok();
}
void info(Stream *stream)
{
//*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN);
}
};
#endif

View File

@ -1,145 +0,0 @@
#ifndef MOTOR_OVERLOAD_H
#define MOTOR_OVERLOAD_H
#include <Arduino.h>
#include <Streaming.h>
#include "../Addon.h"
#include "../config.h"
#include "../common/macros.h"
#include "../common/ppmath.h"
#ifdef HAS_STATES
#include <ArduinoJson.h>
#endif
class MotorLoad : public Addon
{
public:
enum MSTATE
{
NONE = 0,
IDLE = 1,
LOAD = 2,
OVERLOAD = 2,
ERROR = 3
};
#ifdef HAS_STATES
String state()
{
const int capacity = JSON_OBJECT_SIZE(2);
StaticJsonDocument<capacity> doc;
doc['0'] = id;
doc['s'] = currentState;
return doc.as<String>();
}
#endif
MotorLoad(short _pin) : dt(0),
pin(_pin),
load(0),
lastIdle(0),
lastLoad(0),
lastOverload(0),
currentState(NONE),
lastState(NONE),
Addon(MOTOR_LOAD_STR, MOTOR_LOAD)
{
// this->setFlag(DEBUG);
}
short jammed()
{
return RANGE(load, MOTOR_OVERLOAD_RANGE_MIN, MOTOR_OVERLOAD_RANGE_MAX);
}
short idle()
{
return RANGE(load, MOTOR_IDLE_LOAD_RANGE_MIN, MOTOR_IDLE_LOAD_RANGE_MAX);
}
short shredding()
{
return RANGE(load, MOTOR_SHREDDING_LOAD_RANGE_MIN, MOTOR_SHREDDING_LOAD_RANGE_MAX);
}
short setup()
{
loop();
}
short loop()
{
if (now - last > MOTOR_LOAD_READ_INTERVAL)
{
load = analogRead(pin);
last = now;
uchar newState = NONE;
if (idle())
{
lastIdle = now;
newState = IDLE;
}
else if (jammed())
{
lastOverload = now;
newState = OVERLOAD;
}
else if (shredding())
{
lastLoad = now;
newState = LOAD;
}
if (newState != currentState)
{
dt = now;
lastState = currentState;
currentState = newState;
}
}
return load;
}
short ok()
{
if (currentState == IDLE &&
(now - dt) > MAX_IDLE_TIME)
{
return E_MOTOR_DT_IDLE;
}
if (currentState == LOAD &&
(now - dt) > MAX_SHRED_TIME)
{
return E_MOTOR_DT_OVERLOAD;
}
return E_OK;
}
void debug(Stream *stream)
{
// *stream << this->name << ":" << jammed() << SPACE('@') << load << SPACE(":state") << currentState;
}
void info(Stream *stream)
{
// *stream << this->name << "\n\t : " SPACE("Pin:" << pin);
}
millis_t dt;
uchar lastState;
uchar currentState;
millis_t lastIdle;
millis_t lastLoad;
millis_t lastOverload;
protected:
short pin;
short load;
};
#endif

View File

@ -1,41 +0,0 @@
#ifndef MOTOR_SPEED_H
#define MOTOR_SPEED_H
#include <Arduino.h>
#include "Addon.h"
#include "config.h"
#include <Streaming.h>
#include "../common/macros.h"
#include "IRSensor.h"
class MotorSpeed : public Addon
{
public:
MotorSpeed() :
sensor(new IRSensor()),
Addon(MOTOR_IR_SPEED_STR, MOTOR_SPEED) {}
virtual short setup()
{
sensor->setup();
}
virtual short ok()
{
return this->sensor->ok();
}
virtual short loop()
{
this->sensor->loop();
}
void debug(Stream *stream)
{
//*stream << this->name << ":" << this->ok();
}
void info(Stream *stream)
{
//*stream << this->name << "\n\t : " SPACE("Pin:" << MOTOR_IDLE_PIN);
}
protected:
IRSensor *sensor;
};
#endif

View File

@ -1,40 +0,0 @@
#ifndef MOTOR_TEMPERATURE_H
#define MOTOR_TEMPERATURE_H
#include <Arduino.h>
#include "Addon.h"
#include "config.h"
#include <Streaming.h>
#include "../common/macros.h"
#include "TemperatureSensor.h"
class MotorTemperature : public Addon
{
private:
TemperatureSensor sensor;
public:
MotorTemperature() : sensor(MOTOR_TEMPERTURE_SCK_PIN, MOTOR_TEMPERTURE_CS_PIN, MOTOR_TEMPERTURE_SO_PIN, MOTOR_TEMPERTURE_MAX, MOTOR_TEMPERTURE_INTERVAL),
Addon(MOTOR_TEMPERATURE_STR, MOTOR_TEMPERATURE) {}
virtual short ok()
{
return sensor.ok();
}
void debug(Stream *stream)
{
// *stream << this->name << ":" << this->ok();
}
void info(Stream *stream)
{
/*
*stream << this->name << "\n\t : " <<
SPACE("Pin SCK:" << MOTOR_TEMPERTURE_SCK_PIN ) <<
SPACE("Pin CS :" << MOTOR_TEMPERTURE_CS_PIN ) <<
SPACE("Pin SO:" << MOTOR_TEMPERTURE_SO_PIN ) <<
SPACE("Max" << MOTOR_TEMPERTURE_MAX ) <<
SPACE("Interval" << MOTOR_TEMPERTURE_INTERVAL );
*/
}
};
#endif

View File

@ -1,148 +0,0 @@
#ifndef OPERATION_MODE_SWITCH_H
#define OPERATION_MODE_SWITCH_H
#ifdef HAS_STATES
#include <ArduinoJson.h>
#endif
#ifndef OP_MODE_ANALOG
#include <Bounce2.h>
#endif
#include "../config.h"
#include "../Addon.h"
#include <Streaming.h>
#include "../common/macros.h"
#include "../common/ppmath.h"
class OperationModeSwitch : public Addon
{
public:
short pin1;
#ifdef OP_MODE_ANALOG
ushort level1;
ushort level2;
ushort level3;
OperationModeSwitch(short _pin1, ushort _level1, ushort _level2, ushort _level3) : pin1(_pin1),
level1(_level1),
level2(_level2),
level3(_level3),
Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH)
{
//setFlag(DEBUG);
}
#ifdef HAS_STATES
String state()
{
const int capacity = JSON_OBJECT_SIZE(2);
StaticJsonDocument<capacity> doc;
doc['0'] = id;
doc['1'] = value();
return doc.as<String>();
}
#endif
void debug(Stream *stream)
{
//*stream << this->name << SPACE(value());
}
void info(Stream *stream)
{
//*stream << this->name << "\n\t ";
}
short value()
{
ushort value = analogRead(pin1);
if (RANGE(value, level1 - 10, level1 + 10))
{
return OP_DEBUG;
}
if (RANGE(value, level2 - 10, level2 + 10))
{
return OP_NORMAL;
}
if (RANGE(value, level3 - 10, level3 + 10))
{
return OP_SERVICE;
}
return OP_NONE;
}
short setup()
{
}
short loop()
{
// Serial.println(analogRead(pin1));
}
#else
Bounce debouncer1;
Bounce debouncer2;
Bounce debouncer3;
short pin1;
short pin2;
short pin3;
OperationModeSwitch(short _pin1, short _pin2, short _pin3) : pin1(_pin1), // 1-2
pin2(_pin2), // 5-6
pin3(_pin3), // 9-10
Addon(OPERATION_MODE_SWITCH_STR, OPERATION_MODE_SWITCH)
{
}
void debug(Stream *stream)
{
*stream << this->name << ": PIN1 " << SPACE(!debouncer1.read()) << ": PIN2 " << SPACE(!debouncer2.read()) << ": PIN3 " << SPACE(!debouncer3.read());
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : ";
}
short value()
{
if (!debouncer1.read())
{
return OP_DEBUG;
}
if (!debouncer2.read())
{
return OP_NORMAL;
}
if (!debouncer3.read())
{
return OP_SERVICE;
}
return OP_NONE;
}
short setup()
{
this->debouncer1 = Bounce();
this->debouncer1.attach(this->pin1, INPUT_PULLUP);
this->debouncer1.interval(25);
this->debouncer2 = Bounce();
this->debouncer2.attach(this->pin2, INPUT_PULLUP);
this->debouncer2.interval(25);
this->debouncer3 = Bounce();
this->debouncer3.attach(this->pin3, INPUT_PULLUP);
this->debouncer3.interval(25);
}
short loop()
{
this->debouncer1.update();
this->debouncer2.update();
this->debouncer3.update();
}
#endif
};
#endif

View File

@ -1,30 +0,0 @@
#ifndef RESET_H
#define RESET_H
// This module uses currently a normally closed momentary button.
static millis_t sw_reset_TS = 0;
static void reset_setup()
{
pinMode(RESET_PIN, INPUT_PULLUP);
sw_reset_TS = millis();
}
static void reset_loop()
{
if (millis() - sw_reset_TS > RESET_INTERVAL) {
#if RESET_NC == true
// globals.isReset = digitalRead(RESET_PIN);
#else
// globals.isReset = !digitalRead(RESET_PIN);
#endif
sw_reset_TS = millis();
// if(globals.isReset && DEBUG){
// Serial.println("reset");
// }
}
}
#endif

View File

@ -1,110 +0,0 @@
#ifndef STATUS_H
#define STATUS_H
#include "../addon.h"
#include "../types.h"
#include "../common/macros.h"
#include <Arduino.h>
class Status : public Addon
{
public:
Status(short _errorPin, short _okPin) : errorPin(_errorPin),
okPin(_okPin),
status_blink_TS(0),
doBlink(false),
last_blink(true),
blink_start_ts(0),
max_blink_time(HOUR_MS),
Addon(STATUS_STR, STATUS)
{
}
short setup()
{
pinMode(okPin, OUTPUT);
pinMode(errorPin, OUTPUT);
}
short loop()
{
if (now - status_blink_TS > 1000)
{
status_blink_TS = millis();
last_blink = !last_blink;
if (doBlink)
{
digitalWrite(errorPin, last_blink);
}
if (now - blink_start_ts > max_blink_time)
{
doBlink = false;
}
}
}
void status_blink(bool blink)
{
if (!doBlink && blink)
{
blink_start_ts = millis();
}
doBlink = blink;
}
void setStatusAllOn()
{
if (doBlink)
{
return;
}
digitalWrite(errorPin, HIGH);
digitalWrite(okPin, HIGH);
}
void setStatusAllOff()
{
if (doBlink)
{
return;
}
digitalWrite(errorPin, LOW);
digitalWrite(okPin, LOW);
}
void setStatus(bool error)
{
if (doBlink)
{
return;
}
if (error)
{
digitalWrite(errorPin, HIGH);
digitalWrite(okPin, LOW);
}
else
{
digitalWrite(okPin, HIGH);
digitalWrite(errorPin, LOW);
}
}
void info(Stream *stream)
{
*stream << this->name << "\n\t : " SPACE("Error Pin:" << errorPin) << SPACE("\t | Ok Pin :" << okPin);
}
private:
millis_t status_blink_TS;
bool doBlink;
bool last_blink;
millis_t blink_start_ts;
millis_t max_blink_time;
short okPin;
short errorPin;
};
#endif

View File

@ -1,42 +0,0 @@
#ifndef TEMPERATURE_SENSOR_H
#define TEMPERATURE_SENSOR_H
#include <max6675.h>
#include "../config.h"
#include "../macros.h"
#include "../time.h"
class TemperatureSensor
{
public:
TemperatureSensor(short sck, short cs, short so, short _max, short _interval) : ktc(MAX6675(sck, cs, so)),
temperature(),
temperature_TS(millis()),
maxTemp(_max),
interval(_interval) {}
bool ok()
{
return temperature < maxTemp;
}
void loop()
{
if (millis() - temperature_TS > interval)
{
temperature_TS = millis();
temperature = ktc.readCelsius();
}
}
private:
MAX6675 ktc;
short temperature;
short maxTemp;
short interval;
millis_t temperature_TS;
};
#endif

View File

@ -1,109 +0,0 @@
#include <Vector.h>
#include <Streaming.h>
#include <Arduino.h>
#include "app.h"
#include "features.h"
#include <MemoryFree.h>
#include "Version.h"
// #define DEBUG_MEM
static Addon *addonsArray[10];
short App::ok()
{
return E_OK;
}
App::App() : Addon("APP", APP, 1 << STATE),
#ifdef HAS_DIRECTION_SWITCH
dirSwitch(new DirectionSwitch()),
#endif
#ifdef HAS_AUTO_REVERSE_MODE
aMode(new AutoReverseMode(AUTO_REVERSE_MODE_UP_PIN, AUTO_REVERSE_MODE_DOWN_PIN)),
#endif
#ifdef HAS_VFD
vfd(new VFD()),
#endif
#ifdef HAS_STATUS
status(new Status(STATUS_ERROR_PIN, STATUS_OK_PIN)),
#endif
#ifdef HAS_EXTRUSION_REPLAY
exReplay(new ExtrusionReplay(EXTRUSION_RECORD_PIN, EXTRUSION_REPLAY_PIN)),
#endif
cSensor(new CurrentSensor(CURRENT_SENSOR_PIN)),
shredStateLast(0),
shredCancelState(0)
{
}
short App::getAppState(short val)
{
return _state;
}
void (*resetFunction)(void) = 0; // Self reset (to be used with watchdog)
void printMem()
{
Serial.print("mem: ");
Serial.print(freeMemory());
Serial.println('--');
}
short App::setup()
{
Serial.begin(DEBUG_BAUD_RATE);
Serial.print("Booting Firmware ...................... \n\n");
Serial.print(FIRMWARE_VERSION);
Serial.print(" | ");
Serial.print(VERSION);
Serial.print(" | ");
Serial.print(CID);
Serial.println(" - \n");
addons.setStorage(addonsArray);
setup_addons();
#ifdef MEARSURE_PERFORMANCE
printPerfTS = 0;
addonLoopTime = 0;
bridgeLoopTime = 0;
#endif
debugTS = 0;
loopTS = 0;
shredState = 0;
overloaded = 0;
_state = 0;
jamCounter = 0;
lastJam = 0;
#ifdef DEBUG_MEM
timer.every(
5000, [](App *app) -> void {
printMem();
},
this);
#endif
}
void App::onError(int error)
{
if (_state != ERROR)
{
#ifdef HAS_STATUS
status->status_blink(true);
#endif
_state = ERROR;
}
vfd->stop();
}
short App::loop()
{
timer.tick();
now = millis();
loop_addons();
loopShred();
delay(LOOP_DELAY);
}

View File

@ -1,130 +0,0 @@
#ifndef APP_H
#define APP_H
#include "config.h"
#include <Vector.h>
#include "types.h"
#include "Addon.h"
#include "common/timer.h"
class DirectionSwitch;
class VFD;
class AutoReverse;
class RMotorControl;
class AutoReverseMode;
class CurrentSensor;
class Status;
class ExtrusionReplay;
class App : public Addon
{
public:
App();
DirectionSwitch *dirSwitch;
VFD *vfd;
AutoReverse *autoReverse;
AutoReverseMode *aMode;
CurrentSensor *cSensor;
Status *status;
ExtrusionReplay *exReplay;
Addon *byId(short id);
short setup();
short loop();
short debug();
short info();
short ok();
void loop_service();
void loop_shredding();
void auto_reverse();
void loop_extruding();
void _loop_motor_manual(bool jamDetection);
void loop_addons();
void setup_addons();
void onDidSetupAddons();
ushort numByFlag(ushort flag);
short shred(short value = 0);
ushort loopShred();
void loopShredCancel();
void onError(int error);
Vector<Addon *> addons;
// bridge
short setFlag(ushort addonId, ushort flag);
#ifdef HAS_STATES
short appState(short nop = 0);
String state();
#endif
millis_t loopTS;
millis_t wait;
millis_t waitTS;
Timer<10, millis> timer; // 10 concurrent tasks, using micros as resolution
millis_t lastJam;
short setOverload(short val);
short overloaded;
enum SHRED_STATE
{
WAITING = 0,
INIT = 1,
POWERED = 2,
STARTED = 3,
SHREDDING = 6,
UNPOWERED = 7,
DONE = 8,
CANCELLING = 10,
JAMMED = 11,
REVERSING = 12,
REVERSED = 13,
STOPPING = 14,
FORWARDING = 15,
CANCELLED = 16,
STUCK = 17
};
short shredState;
short shredStateLast;
short shredCancelState;
short jamCounter;
short setShredState(short newState);
bool isAutoReversing();
enum APP_STATE
{
RESET = 0,
// SHREDDING = 1,
ERROR = 5,
REPLAY = 6,
RECORD = 7
};
short _state;
short _error;
short getLastError(short val = 0){
return _error;
}
short setLastError(short val = 0);
short setAppState(short newState);
short getAppState(short val);
private:
#ifdef MEARSURE_PERFORMANCE
millis_t addonLoopTime;
millis_t bridgeLoopTime;
millis_t printPerfTS;
#endif
millis_t debugTS;
};
#endif

View File

@ -1,167 +0,0 @@
#include <Vector.h>
#include <Streaming.h>
#include <Arduino.h>
#include "app.h"
#include "config.h"
#include "types.h"
#include "common/macros.h"
#include "Addon.h"
#include "features.h"
void App::onDidSetupAddons(){
#ifdef HAS_STATUS
status->setStatusAllOn();
delay(SECS * 2);
status->setStatusAllOff();
status->setStatus(false);
#endif
}
short App::setFlag(ushort addonId, ushort flag)
{
Addon *addon = byId(addonId);
if (addon)
{
addon->setFlag(flag);
return E_OK;
}
return ERROR_WARNING;
}
ushort App::numByFlag(ushort flag)
{
uchar s = addons.size();
uchar l = 0;
String out = "";
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (!!(addon->hasFlag(flag)))
{
l++;
}
}
return l;
}
short App::debug()
{
#ifndef MEARSURE_PERFORMANCE
if (millis() - debugTS > DEBUG_INTERVAL)
{
uchar s = addons.size();
uchar nb = 0;
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(DEBUG))
{
(addon->debug)(&Serial);
Serial.println("\n");
nb++;
}
}
if (nb)
{
Serial.println("\n");
}
debugTS = millis();
}
#endif
}
short App::info()
{
Serial.print("Addon configuration : \n\n");
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(INFO))
{
addon->info(&Serial);
Serial << "\n";
}
}
}
Addon *App::byId(short id)
{
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->id == id)
{
return addon;
}
}
return NULL;
}
void App::setup_addons()
{
#ifdef HAS_DIRECTION_SWITCH
addons.push_back((Addon *)dirSwitch);
#endif
#ifdef HAS_VFD
addons.push_back((Addon *)vfd);
#endif
#ifdef HAS_AUTO_REVERSE_MODE
addons.push_back((Addon *)aMode);
#endif
#ifdef HAS_STATUS
addons.push_back((Addon *)status);
#endif
#ifdef HAS_EXTRUSION_REPLAY
addons.push_back((Addon *)exReplay);
#endif
addons.push_back((Addon *)cSensor);
addons.push_back((Addon *)this);
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(SETUP))
{
addon->setup();
}
}
onDidSetupAddons();
}
void App::loop_addons()
{
#ifdef MEARSURE_PERFORMANCE
millis_t now = millis();
#endif
uchar s = addons.size();
for (uchar i = 0; i < s; i++)
{
Addon *addon = addons[i];
if (addon->hasFlag(LOOP))
{
addon->now = now;
addon->loop();
}
}
#ifdef MEARSURE_PERFORMANCE
addonLoopTime = millis() - now;
if (millis() - printPerfTS > 3000)
{
printPerfTS = now;
Serial << SPACE("Addon loop time") << addonLoopTime << "\n";
}
#endif
debug();
}

View File

@ -1,312 +0,0 @@
#include <Vector.h>
#include <Streaming.h>
#include <Arduino.h>
#include "app.h"
#include "features.h"
// #define HAS_SHRED_DEBUG
#ifdef HAS_SHRED_DEBUG
#define SHRED_DEBUG(A) Serial.println(A);
#else
#define SHRED_DEBUG(A)
#endif
void App::auto_reverse()
{
switch (shredState)
{
case JAMMED:
{
SHRED_DEBUG("jammed: reversing");
shredState = FORWARDING;
vfd->rev(true);
jamCounter++;
lastJam = now;
timer.in(
AR_REVERSE_TIME, [](App *app) -> void {
app->vfd->stop();
app->shredState = STOPPING;
SHRED_DEBUG("jammed: stopped");
},
this);
break;
}
case STOPPING:
{
SHRED_DEBUG("jammed: stopping");
shredState = FORWARDING;
timer.in(
AR_FORWARD_WAIT_TIME, [](App *app) -> void {
app->shredState = REVERSED;
SHRED_DEBUG("jammed: stopped");
},
this);
break;
}
case FORWARDING:
{
delay(1);
break;
}
case REVERSED:
{
shredState = FORWARDING;
if (!cSensor->ok())
{
SHRED_DEBUG("jammed: stuck");
shredState = STUCK;
break;
}
vfd->fwd(true);
SHRED_DEBUG("jammed: forward");
timer.in(
AR_FORWARDING_TIME, [](App *app) -> void {
if (!app->cSensor->ok())
{
SHRED_DEBUG("jammed: overloaded");
if (app->jamCounter > MAX_REVERSE_TRIALS)
{
SHRED_DEBUG("jammed: stuck");
app->shredState = STUCK;
}
else
{
SHRED_DEBUG("jammed: still jammed");
SHRED_DEBUG(app->jamCounter);
app->shredState = JAMMED;
}
}
else
{
SHRED_DEBUG("jammed: continue with last state");
app->shredState = app->shredStateLast;
app->lastJam = 0;
}
},
this);
break;
}
}
}
bool App::isAutoReversing()
{
return shredState == App::SHRED_STATE::JAMMED ||
shredState == App::SHRED_STATE::REVERSING ||
shredState == App::SHRED_STATE::REVERSED ||
shredState == App::SHRED_STATE::STOPPING ||
shredState == App::SHRED_STATE::FORWARDING;
}
short App::setShredState(short newState)
{
if (isAutoReversing())
{
return App::SHRED_STATE::JAMMED;
}
shredState = newState;
return shredState;
}
void App::loop_shredding()
{
uchar sw = this->dirSwitch->value();
if (shredState == STUCK)
{
onError(E_MAX_JAM);
return;
}
if (!cSensor->ok())
{
if (!isAutoReversing())
{
setShredState(JAMMED);
}
}
switch (sw)
{
case POS3_DIRECTION::UP:
{
if (isAutoReversing())
{
auto_reverse();
#ifdef HAS_STATUS
status->setStatus(true);
#endif
}
else
{
setShredState(SHREDDING);
vfd->fwd(true);
}
break;
}
case POS3_DIRECTION::MIDDLE:
{
vfd->stop();
shredState = DONE;
break;
}
case POS3_DIRECTION::DOWN:
{
if (!cSensor->ok())
{
onError(ERROR);
break;
}
vfd->rev(true);
setShredState(SHREDDING);
break;
}
}
#ifdef HAS_STATUS
status->setStatus(sw);
#endif
}
void App::_loop_motor_manual(bool jamDetection)
{
if (_state == ERROR)
{
return;
}
#if defined(HAS_DIRECTION_SWITCH) && defined(HAS_VFD)
uchar sw = this->dirSwitch->value();
if (jamDetection && sw && !cSensor->ok())
{
onError(ERROR);
return;
}
switch (sw)
{
case POS3_DIRECTION::UP:
{
this->vfd->fwd(true);
break;
}
case POS3_DIRECTION::DOWN:
{
this->vfd->rev(true);
break;
}
case POS3_DIRECTION::MIDDLE:
{
this->vfd->stop(true);
break;
}
}
#ifdef HAS_STATUS
status->setStatus(sw);
#endif
#endif
}
ushort App::loopShred()
{
uchar sw = dirSwitch->value();
uchar am = aMode->value();
if (sw && sw == dirSwitch->last())
{
onError(ERROR);
return;
}
#ifdef HAS_EXTRUSION_REPLAY
if (!sw && am == AR_MODE::EXTRUSION && _state != ERROR)
{
if (exReplay->replay && exReplay->recordTime > 2000)
{
_state = REPLAY;
}
if (_state == REPLAY)
{
if(!cSensor->ok()){
onError(ERROR);
return;
}
#ifdef HAS_STATUS
status->setStatus(true);
#endif
if (now - exReplay->lastReplayTS < exReplay->recordTime)
{
vfd->fwd(true);
}else{
vfd->stop();
exReplay->replay = false;
_state = RESET;
#ifdef HAS_STATUS
status->setStatus(false);
#endif
}
return;
}
if (exReplay->recordOn)
{
if (cSensor->ok())
{
#ifdef HAS_STATUS
status->setStatus(true);
#endif
vfd->fwd(true);
}
else
{
onError(ERROR);
}
}
else
{
#ifdef HAS_STATUS
status->setStatus(false);
#endif
vfd->stop(true);
}
return;
}
#endif
// clear error state on pos middle / stop
if ((_state == ERROR || isAutoReversing()) && sw == POS3_DIRECTION::MIDDLE)
{
#ifdef HAS_STATUS
status->status_blink(false);
status->setStatus(false);
#endif
_state = RESET;
shredState = DONE;
jamCounter = 0;
}
switch (am)
{
case AR_MODE::EXTRUSION:
case AR_MODE::NONE:
{
_loop_motor_manual(am == AR_MODE::EXTRUSION);
break;
}
case AR_MODE::NORMAL:
{
loop_shredding();
break;
}
}
}

View File

@ -1,33 +0,0 @@
#ifndef BOARDS_H
#define BOARDS_H
// back - compat
#if ARDUINO > 22
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
#define BOARD_MEGA
#endif
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
#define BOARD_MEGA
#endif
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__)
#define BOARD_LEONARDO
#endif
#if defined(CONTROLLINO_MINI)
#define BOARD_CONTROLLINO_UNO
#elif defined(CONTROLLINO_MAXI)
#elif defined(CONTROLLINO_MEGA)
#elif defined(CONTROLLINO_MAXI_AUTOMATION)
#define BOARD_CONTROLLINO_MEGA
#else
#error Please, select one of the CONTROLLINO variants in Tools->Board
#endif
#endif

View File

@ -1,121 +0,0 @@
#include "bridge.h"
#include <Vector.h>
#include <Streaming.h>
#include "constants.h"
typedef struct
{
short key;
char *value;
} TAddons;
const TAddons addonsDict[]{};
static VSL *_instance;
class SKeyVal;
SKeyVal *clazzMaps[20];
Vector<SKeyVal *> clazzes;
class SKeyValS
{
public:
void *instance;
ushort id;
SKeyValS() {}
SKeyValS(void *_instance, ushort _id) : instance(_instance),
id(_id) {}
};
char *getAddonName(short key)
{
for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i)
{
if (addonsDict[i].key == key)
{
return addonsDict[i].value;
}
}
return NULL;
}
short getAddonKey(String name)
{
for (uchar i = 0; i < sizeof(addonsDict) / sizeof(TAddons); ++i)
{
if (name.equals(String(addonsDict[i].value)))
{
return addonsDict[i].value;
}
}
return -1;
}
void VSL::init()
{
_instance = new VSL();
clazzes.setStorage(clazzMaps);
}
VSL *VSL::instance()
{
if (!_instance)
{
VSL::init();
}
return _instance;
}
SKeyVal *VSL::hasMethod(ushort id, String methodName)
{
uchar s = clazzes.size();
for (uchar i = 0; i < s; i++)
{
SKeyVal *val = clazzes.at(i);
if (val->key == id && val->methodName.equals(methodName))
{
return val;
}
}
return NULL;
}
void VSL::debug()
{
#ifdef BRIDGE_DEBUG
uchar s = clazzes.size();
for (uchar i = 0; i < s; i++)
{
SKeyVal *val = clazzes.at(i);
Serial.print(val->className);
Serial.print(":");
Serial.print(val->methodName);
Serial.print("\n");
}
#endif
}
SKeyVal *VSL::registerMemberFunction(ushort id, Addon *clazz, char *method, AddonFnPtr ptr, char *ret)
{
SKeyVal *meth = hasMethod(id, method);
if (meth)
{
#ifdef BRIDGE_DEBUG
Serial << "Register class member: "
<< SPACE(name << "::" << method)
<< "already registered! \n";
#endif
}
else
{
#ifdef BRIDGE_DEBUG
if (!getAddonKey(name))
{
Serial.println("invalid addon key");
}
#endif
meth = new SKeyVal(id, clazz, method, ptr);
//Serial << "Register member method:"
// << SPACE(meth->className << "::" << meth->methodName)
// << "\n";
clazzes.push_back(meth);
}
}

View File

@ -1,81 +0,0 @@
#ifndef BRDIGE_H
#define BRIDGE_H
#include "Addon.h"
#include <WString.h>
class App;
class SKeyVal;
class SKeyValS;
class SKeyVal
{
public:
short key;
void *instance;
String methodName;
AddonFnPtr mPtr;
SKeyVal() {}
SKeyVal(ushort _key, void *_instance, String _methodName, AddonFnPtr _mPtr) : key(_key),
instance(_instance),
methodName(_methodName),
mPtr(_mPtr) {}
};
class VSL
{
public:
SKeyVal *registerMemberFunction(
ushort id,
Addon *clazz,
char *method,
AddonFnPtr ptr,
char *ret);
static void init();
static VSL *instance();
SKeyVal *VSL::hasMethod(ushort id, String method);
void debug();
};
#define REGISTER_CLASS_MEMBER_FN(id, inst, methodName, method, ret) \
{ \
VSL::instance()->registerMemberFunction(id, inst, methodName, method, "2"); \
}
#endif
namespace Bridge
{
static const char *START_STR = "<<";
static const char *END_STR = ">>";
static const char RESPONSE_DEL = ';';
static const char *CreateResponse(short id, short error, short ret)
{
static char response[1024] = {'\0'};
snprintf(response, sizeof(response), "%s%d%c%d%c%d%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR);
return response;
}
static const char *CreateResponse(short id, short error, const char *ret)
{
static char response[1024] = {'\0'};
snprintf(response, sizeof(response), "%s%d%c%d%c%s%s\r", START_STR, id, RESPONSE_DEL, error, RESPONSE_DEL, ret, END_STR);
return response;
}
enum ECALLS
{
EC_COMMAND = 1,
EC_METHOD = 2,
EC_FUNC = 3,
EC_USER = 10
};
enum MessageFlags
{
NEW = 1,
PROCESSING = 2,
PROCESSED = 3,
DEBUG = 4,
RECEIPT = 5,
STATE = 6
};
} // namespace Bridge

View File

@ -1,512 +0,0 @@
#ifndef PIN_H
#define PIN_H
// this class doesn't outperform fastgpio but is works with AtmelMega
#include <Arduino.h>
#define DDR_HIGH (*_DDR |= _offset) ///< Set the DDR register to HIGH for the pin
#define DDR_TOGGLE (*_DDR ^= _offset) ///< Set the DDR register to the inverse for the pin
#define DDR_LOW (*_DDR &= _ioffset) ///< Set the DDR register to LOW for the pin
#define PORT_HIGH (*_PORT |= _offset) ///< Set the PORT register to HIGH for the pin
#define PORT_TOGGLE (*_PORT ^= _offset) ///< Set the PORT register to the inverse for the pin
#define PORT_LOW (*_PORT &= _ioffset) ///< Set the PORT register to LOW for the pin
#define DDR_ON (*_DDR & _offset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 0
#define DDR_OFF (*_DDR | _ioffset) ///< Get the DDR register for the pin (HIGH, LOW) with other pins forced to 1
#define PORT_ON (*_PORT & _offset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 0
#define PORT_OFF (*_PORT | _ioffset) ///< Get the PORT register for the pin (HIGH, LOW) with other pins forced to 1
#define PIN_ON (*_PIN & _offset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 0
#define PIN_OFF (*_PIN | _ioffset) ///< Get the PIN register for the pin (HIGH, LOW) with other pins forced to 1
class Pin
{
public:
Pin(uint8_t number)
{
_number = number;
_offset = digitalPinToBitMask(_number);
_ioffset = ~_offset;
_timer = digitalPinToTimer(_number);
_PIN = portInputRegister(digitalPinToPort(_number));
_PORT = portOutputRegister(digitalPinToPort(_number));
_DDR = portModeRegister(digitalPinToPort(_number));
}
/**
Custom board constructor
getAnalogValue() and setDutyCycle(int value) not supported
@param number pin number written on board
@param offset bit mask used to access pin in registers
@param timer timer for pin
@param PIN input register for pin
@param PORT data register for pin
@param DDR data direction register for pin
*/
Pin(uint8_t number, uint8_t offset, uint8_t timer, volatile uint8_t *PIN, volatile uint8_t *PORT, volatile uint8_t *DDR)
{
_number = number;
_offset = offset;
_ioffset = ~_offset;
_timer = timer;
_PIN = PIN;
_PORT = PORT;
_DDR = DDR;
}
// ################################# Operators #################################
/**
Get the value of the pin from the PIN register
@return true if the value of the pin is HIGH, false otherwise
*/
operator bool() const
{
return bool(PIN_ON);
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
Pin &operator=(uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
return *this;
}
// ################################# Getters #################################
/**
Get the pin number
@return pin number
*/
uint8_t getNumber()
{
return _number;
}
/**
Get the pin offset
@return pin offset
*/
uint8_t getOffset()
{
return _offset;
}
/**
Get the inverse pin offset
@return inverse pin offset
*/
uint8_t getInverseOffset()
{
return _ioffset;
}
/**
Get the pin timer
@return pin timer
*/
uint8_t getTimer()
{
return _timer;
}
/**
Get a pointer to the PIN register
@return pointer to the PIN register
*/
volatile uint8_t *getPIN()
{
return _PIN;
}
/**
Get a pointer to the PORT register
@return pointer to the PORT register
*/
volatile uint8_t *getPORT()
{
return _PORT;
}
/**
Get a pointer to the DDR register
@return pointer to the DDR register
*/
volatile uint8_t *getDDR()
{
return _DDR;
}
/**
Get the mode of the pin from the DDR register
@return mode of the pin (OUTPUT, INPUT)
*/
uint8_t getMode()
{
if (DDR_ON)
{
return OUTPUT;
}
else
{
return INPUT;
}
}
/**
Get the state of the pin from the PORT register
@return state of the pin (HIGH, LOW)
*/
uint8_t getState()
{
if (PORT_ON)
{
return HIGH;
}
else
{
return LOW;
}
}
/**
Get the value of the pin from the PIN register
@return value of the pin (HIGH, LOW)
*/
uint8_t getValue()
{
if (PIN_ON)
{
return HIGH;
}
else
{
return LOW;
}
}
/**
Get the analog value of the pin
@return analog value of the pin (0-1023)
*/
uint16_t getAnalogValue()
{
return analogRead(_number);
}
/**
Set the pin mode and pin state
@param mode the mode of the pin (OUTPUT, INPUT)
@param state the state of the pin (HIGH, LOW)
*/
void set(uint8_t mode, uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin mode
@param mode the mode of the pin (OUTPUT, INPUT)
*/
void setMode(uint8_t mode)
{
uint8_t oldSREG = SREG;
cli();
if (mode == INPUT)
{
DDR_LOW;
}
else
{
DDR_HIGH;
}
SREG = oldSREG;
}
/**
Set the pin state
@param state the state of the pin (HIGH, LOW)
*/
void setState(uint8_t state)
{
uint8_t oldSREG = SREG;
cli();
if (state == LOW)
{
PORT_LOW;
}
else
{
PORT_HIGH;
}
SREG = oldSREG;
}
// #################### Input ####################
void setInput()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to on
*/
void setPullupOn()
{
uint8_t oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin pullup resistor to off
*/
void setPullupOff()
{
uint8_t oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to on
*/
void setInputPullupOn()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to input and the pin pullup resistor to off
*/
void setInputPullupOff()
{
uint8_t oldSREG = SREG;
cli();
DDR_LOW;
PORT_LOW;
SREG = oldSREG;
}
// #################### Output ####################
/**
Set the pin mode to output
*/
void setOutput()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to HIGH
*/
void setHigh()
{
uint8_t oldSREG = SREG;
cli();
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin output to LOW
*/
void setLow()
{
uint8_t oldSREG = SREG;
cli();
PORT_LOW;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to HIGH
*/
void setOutputHigh()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
PORT_HIGH;
SREG = oldSREG;
}
/**
Set the pin mode to output and the pin output to LOW
*/
void setOutputLow()
{
uint8_t oldSREG = SREG;
cli();
DDR_HIGH;
PORT_LOW;
SREG = oldSREG;
}
/**
Set the PWM duty cycle
@param value the duty cycle (0-255)
*/
void setDutyCycle(int value)
{
analogWrite(_number, value);
}
// ################################# Utilities #################################
/**
Toggle the pin mode (OUTPUT -> INPUT, INPUT -> OUTPUT)
*/
void toggleMode()
{
uint8_t oldSREG = SREG;
cli();
DDR_TOGGLE;
SREG = oldSREG;
}
/**
Toggle the pin state (HIGH -> LOW, LOW -> HIGH)
*/
void toggleState()
{
uint8_t oldSREG = SREG;
cli();
PORT_TOGGLE;
SREG = oldSREG;
}
// #################### RC Timer ####################
/**
Set the pin mode to input and decrement a counter until the pin goes HIGH or the counter reaches 0 then set the pin mode to output and return the counter value
@param count the initial value for the counter to start at (0-65535)
@return the value remaining on the counter when the pin state went to HIGH or 0 if the counter reached 0
*/
volatile unsigned int rcTimer(volatile unsigned int count)
{
uint8_t status;
asm volatile(
// Save interupt status and disable interupts
"in %[status], __SREG__ \n\t" // Store current interupt status in variable 's'
"cli \n\t" // Disable interupts
// Set Pin to input mode to start charging capacitor
"ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__)
"and __tmp_reg__, %[_ioffset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the DDR register
// Count time before Pin becomes high
"loop%=: \n\t" // Label for looping
//"ld __tmp_reg__,%a[_PIN] \n\t" // Load the PIN register into r0 (__tmp_reg__)
"and __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"brne end%= \n\t" // End the loop if r0 (__tmp_reg__) is not equal to zero by branching to label 'end'
"dec %[count] \n\t" // Decrement the value of 'count' by one
"brne loop%= \n\t" // If the value of 'count' is not equal to zero continue the loop by branching to label 'loop'
// Done counting
"end%=: \n\t" // Label for ending loop
// Set Pin to output mode to start discharging capacitor
"ld __tmp_reg__, %a[_DDR] \n\t" // Load the DDR register into r0 (__tmp_reg__)
"or __tmp_reg__, %[_offset] \n\t" // Apply the bit mask (offset) to r0 (__tmp_reg__)
"st %a[_DDR], __tmp_reg__ \n\t" // Store r0 (__tmp_reg__) in the PORT register
// Restore interupt status
"out __SREG__, %[status] \n\t" // Load interupt status from variable 's'
// Outputs
:
[ count ] "+r"(count), // The value the counter was at when the pin went high
[ status ] "=&r"(status) // The interupt status
// Inputs
:
[ _DDR ] "e"(_DDR), // The address of the DDR register for the pin
[ _PIN ] "e"(_PIN), // The address of the PIN register for the pin
[ _offset ] "r"(_offset), // The bit mask used to access pin in registers
[ _ioffset ] "r"(_ioffset) // The inverse bit mask used to access pin in registers
);
return count;
}
private:
uint8_t _number;
uint8_t _offset;
uint8_t _ioffset;
uint8_t _timer;
volatile uint8_t *_PIN;
volatile uint8_t *_PORT;
volatile uint8_t *_DDR;
};
#endif

Some files were not shown because too many files have changed in this diff Show More