/branches/v0.60_MicroMag3_Nick666/V0.67g/printf_P.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/COPYING |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/eeprom.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/fc.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/fc.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/gps.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/mymath.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/Flight-Ctrl_MEGA644_V0_67g.hex |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/analog.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/FlightCtrl.aps |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/menu.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/mymath.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/_Settings.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/rc.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/analog.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/menu.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/rc.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/uart.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/twimaster.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/License.txt |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/uart.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/version.txt |
---|
File deleted |
\ No newline at end of file |
/branches/v0.60_MicroMag3_Nick666/V0.67g/COPYING.LESSER |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/main.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/twimaster.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/old_macros.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/main.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/GPS.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/makefile |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/timer0.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/flight.pnproj |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/compass.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/timer0.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/compass.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/V0.67g/flight.pnps |
---|
File deleted |
\ No newline at end of file |
/branches/v0.60_MicroMag3_Nick666/V0.67g/printf_P.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/twimaster.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/uart.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/version.txt |
---|
File deleted |
\ No newline at end of file |
/branches/v0.60_MicroMag3_Nick666/v0.60/COPYING.LESSER |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/main.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/twimaster.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/old_macros.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/main.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/GPS.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/makefile |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/timer0.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/flight.pnproj |
---|
File deleted |
\ No newline at end of file |
/branches/v0.60_MicroMag3_Nick666/v0.60/compass.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/timer0.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/compass.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/flight.pnps |
---|
File deleted |
\ No newline at end of file |
/branches/v0.60_MicroMag3_Nick666/v0.60/printf_P.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/README.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/branches/v0.60_MicroMag3_Nick666/v0.60/printf_P.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/COPYING |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/fc.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/math.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/fc.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/math.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/gps.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/Flight-Ctrl_MEGA644_V0_60_MM3.hex |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/analog.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/menu.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/_Settings.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/rc.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/analog.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/menu.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/rc.h |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/license_buss.txt |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/v0.60/uart.c |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/COPYING |
---|
0,0 → 1,674 |
GNU GENERAL PUBLIC LICENSE |
Version 3, 29 June 2007 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
Preamble |
The GNU General Public License is a free, copyleft license for |
software and other kinds of works. |
The licenses for most software and other practical works are designed |
to take away your freedom to share and change the works. By contrast, |
the GNU General Public License is intended to guarantee your freedom to |
share and change all versions of a program--to make sure it remains free |
software for all its users. We, the Free Software Foundation, use the |
GNU General Public License for most of our software; it applies also to |
any other work released this way by its authors. You can apply it to |
your programs, too. |
When we speak of free software, we are referring to freedom, not |
price. Our General Public Licenses are designed to make sure that you |
have the freedom to distribute copies of free software (and charge for |
them if you wish), that you receive source code or can get it if you |
want it, that you can change the software or use pieces of it in new |
free programs, and that you know you can do these things. |
To protect your rights, we need to prevent others from denying you |
these rights or asking you to surrender the rights. Therefore, you have |
certain responsibilities if you distribute copies of the software, or if |
you modify it: responsibilities to respect the freedom of others. |
For example, if you distribute copies of such a program, whether |
gratis or for a fee, you must pass on to the recipients the same |
freedoms that you received. You must make sure that they, too, receive |
or can get the source code. And you must show them these terms so they |
know their rights. |
Developers that use the GNU GPL protect your rights with two steps: |
(1) assert copyright on the software, and (2) offer you this License |
giving you legal permission to copy, distribute and/or modify it. |
For the developers' and authors' protection, the GPL clearly explains |
that there is no warranty for this free software. For both users' and |
authors' sake, the GPL requires that modified versions be marked as |
changed, so that their problems will not be attributed erroneously to |
authors of previous versions. |
Some devices are designed to deny users access to install or run |
modified versions of the software inside them, although the manufacturer |
can do so. This is fundamentally incompatible with the aim of |
protecting users' freedom to change the software. The systematic |
pattern of such abuse occurs in the area of products for individuals to |
use, which is precisely where it is most unacceptable. Therefore, we |
have designed this version of the GPL to prohibit the practice for those |
products. If such problems arise substantially in other domains, we |
stand ready to extend this provision to those domains in future versions |
of the GPL, as needed to protect the freedom of users. |
Finally, every program is threatened constantly by software patents. |
States should not allow patents to restrict development and use of |
software on general-purpose computers, but in those that do, we wish to |
avoid the special danger that patents applied to a free program could |
make it effectively proprietary. To prevent this, the GPL assures that |
patents cannot be used to render the program non-free. |
The precise terms and conditions for copying, distribution and |
modification follow. |
TERMS AND CONDITIONS |
0. Definitions. |
"This License" refers to version 3 of the GNU General Public License. |
"Copyright" also means copyright-like laws that apply to other kinds of |
works, such as semiconductor masks. |
"The Program" refers to any copyrightable work licensed under this |
License. Each licensee is addressed as "you". "Licensees" and |
"recipients" may be individuals or organizations. |
To "modify" a work means to copy from or adapt all or part of the work |
in a fashion requiring copyright permission, other than the making of an |
exact copy. The resulting work is called a "modified version" of the |
earlier work or a work "based on" the earlier work. |
A "covered work" means either the unmodified Program or a work based |
on the Program. |
To "propagate" a work means to do anything with it that, without |
permission, would make you directly or secondarily liable for |
infringement under applicable copyright law, except executing it on a |
computer or modifying a private copy. Propagation includes copying, |
distribution (with or without modification), making available to the |
public, and in some countries other activities as well. |
To "convey" a work means any kind of propagation that enables other |
parties to make or receive copies. Mere interaction with a user through |
a computer network, with no transfer of a copy, is not conveying. |
An interactive user interface displays "Appropriate Legal Notices" |
to the extent that it includes a convenient and prominently visible |
feature that (1) displays an appropriate copyright notice, and (2) |
tells the user that there is no warranty for the work (except to the |
extent that warranties are provided), that licensees may convey the |
work under this License, and how to view a copy of this License. If |
the interface presents a list of user commands or options, such as a |
menu, a prominent item in the list meets this criterion. |
1. Source Code. |
The "source code" for a work means the preferred form of the work |
for making modifications to it. "Object code" means any non-source |
form of a work. |
A "Standard Interface" means an interface that either is an official |
standard defined by a recognized standards body, or, in the case of |
interfaces specified for a particular programming language, one that |
is widely used among developers working in that language. |
The "System Libraries" of an executable work include anything, other |
than the work as a whole, that (a) is included in the normal form of |
packaging a Major Component, but which is not part of that Major |
Component, and (b) serves only to enable use of the work with that |
Major Component, or to implement a Standard Interface for which an |
implementation is available to the public in source code form. A |
"Major Component", in this context, means a major essential component |
(kernel, window system, and so on) of the specific operating system |
(if any) on which the executable work runs, or a compiler used to |
produce the work, or an object code interpreter used to run it. |
The "Corresponding Source" for a work in object code form means all |
the source code needed to generate, install, and (for an executable |
work) run the object code and to modify the work, including scripts to |
control those activities. However, it does not include the work's |
System Libraries, or general-purpose tools or generally available free |
programs which are used unmodified in performing those activities but |
which are not part of the work. For example, Corresponding Source |
includes interface definition files associated with source files for |
the work, and the source code for shared libraries and dynamically |
linked subprograms that the work is specifically designed to require, |
such as by intimate data communication or control flow between those |
subprograms and other parts of the work. |
The Corresponding Source need not include anything that users |
can regenerate automatically from other parts of the Corresponding |
Source. |
The Corresponding Source for a work in source code form is that |
same work. |
2. Basic Permissions. |
All rights granted under this License are granted for the term of |
copyright on the Program, and are irrevocable provided the stated |
conditions are met. This License explicitly affirms your unlimited |
permission to run the unmodified Program. The output from running a |
covered work is covered by this License only if the output, given its |
content, constitutes a covered work. This License acknowledges your |
rights of fair use or other equivalent, as provided by copyright law. |
You may make, run and propagate covered works that you do not |
convey, without conditions so long as your license otherwise remains |
in force. You may convey covered works to others for the sole purpose |
of having them make modifications exclusively for you, or provide you |
with facilities for running those works, provided that you comply with |
the terms of this License in conveying all material for which you do |
not control copyright. Those thus making or running the covered works |
for you must do so exclusively on your behalf, under your direction |
and control, on terms that prohibit them from making any copies of |
your copyrighted material outside their relationship with you. |
Conveying under any other circumstances is permitted solely under |
the conditions stated below. Sublicensing is not allowed; section 10 |
makes it unnecessary. |
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
No covered work shall be deemed part of an effective technological |
measure under any applicable law fulfilling obligations under article |
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
similar laws prohibiting or restricting circumvention of such |
measures. |
When you convey a covered work, you waive any legal power to forbid |
circumvention of technological measures to the extent such circumvention |
is effected by exercising rights under this License with respect to |
the covered work, and you disclaim any intention to limit operation or |
modification of the work as a means of enforcing, against the work's |
users, your or third parties' legal rights to forbid circumvention of |
technological measures. |
4. Conveying Verbatim Copies. |
You may convey verbatim copies of the Program's source code as you |
receive it, in any medium, provided that you conspicuously and |
appropriately publish on each copy an appropriate copyright notice; |
keep intact all notices stating that this License and any |
non-permissive terms added in accord with section 7 apply to the code; |
keep intact all notices of the absence of any warranty; and give all |
recipients a copy of this License along with the Program. |
You may charge any price or no price for each copy that you convey, |
and you may offer support or warranty protection for a fee. |
5. Conveying Modified Source Versions. |
You may convey a work based on the Program, or the modifications to |
produce it from the Program, in the form of source code under the |
terms of section 4, provided that you also meet all of these conditions: |
a) The work must carry prominent notices stating that you modified |
it, and giving a relevant date. |
b) The work must carry prominent notices stating that it is |
released under this License and any conditions added under section |
7. This requirement modifies the requirement in section 4 to |
"keep intact all notices". |
c) You must license the entire work, as a whole, under this |
License to anyone who comes into possession of a copy. This |
License will therefore apply, along with any applicable section 7 |
additional terms, to the whole of the work, and all its parts, |
regardless of how they are packaged. This License gives no |
permission to license the work in any other way, but it does not |
invalidate such permission if you have separately received it. |
d) If the work has interactive user interfaces, each must display |
Appropriate Legal Notices; however, if the Program has interactive |
interfaces that do not display Appropriate Legal Notices, your |
work need not make them do so. |
A compilation of a covered work with other separate and independent |
works, which are not by their nature extensions of the covered work, |
and which are not combined with it such as to form a larger program, |
in or on a volume of a storage or distribution medium, is called an |
"aggregate" if the compilation and its resulting copyright are not |
used to limit the access or legal rights of the compilation's users |
beyond what the individual works permit. Inclusion of a covered work |
in an aggregate does not cause this License to apply to the other |
parts of the aggregate. |
6. Conveying Non-Source Forms. |
You may convey a covered work in object code form under the terms |
of sections 4 and 5, provided that you also convey the |
machine-readable Corresponding Source under the terms of this License, |
in one of these ways: |
a) Convey the object code in, or embodied in, a physical product |
(including a physical distribution medium), accompanied by the |
Corresponding Source fixed on a durable physical medium |
customarily used for software interchange. |
b) Convey the object code in, or embodied in, a physical product |
(including a physical distribution medium), accompanied by a |
written offer, valid for at least three years and valid for as |
long as you offer spare parts or customer support for that product |
model, to give anyone who possesses the object code either (1) a |
copy of the Corresponding Source for all the software in the |
product that is covered by this License, on a durable physical |
medium customarily used for software interchange, for a price no |
more than your reasonable cost of physically performing this |
conveying of source, or (2) access to copy the |
Corresponding Source from a network server at no charge. |
c) Convey individual copies of the object code with a copy of the |
written offer to provide the Corresponding Source. This |
alternative is allowed only occasionally and noncommercially, and |
only if you received the object code with such an offer, in accord |
with subsection 6b. |
d) Convey the object code by offering access from a designated |
place (gratis or for a charge), and offer equivalent access to the |
Corresponding Source in the same way through the same place at no |
further charge. You need not require recipients to copy the |
Corresponding Source along with the object code. If the place to |
copy the object code is a network server, the Corresponding Source |
may be on a different server (operated by you or a third party) |
that supports equivalent copying facilities, provided you maintain |
clear directions next to the object code saying where to find the |
Corresponding Source. Regardless of what server hosts the |
Corresponding Source, you remain obligated to ensure that it is |
available for as long as needed to satisfy these requirements. |
e) Convey the object code using peer-to-peer transmission, provided |
you inform other peers where the object code and Corresponding |
Source of the work are being offered to the general public at no |
charge under subsection 6d. |
A separable portion of the object code, whose source code is excluded |
from the Corresponding Source as a System Library, need not be |
included in conveying the object code work. |
A "User Product" is either (1) a "consumer product", which means any |
tangible personal property which is normally used for personal, family, |
or household purposes, or (2) anything designed or sold for incorporation |
into a dwelling. In determining whether a product is a consumer product, |
doubtful cases shall be resolved in favor of coverage. For a particular |
product received by a particular user, "normally used" refers to a |
typical or common use of that class of product, regardless of the status |
of the particular user or of the way in which the particular user |
actually uses, or expects or is expected to use, the product. A product |
is a consumer product regardless of whether the product has substantial |
commercial, industrial or non-consumer uses, unless such uses represent |
the only significant mode of use of the product. |
"Installation Information" for a User Product means any methods, |
procedures, authorization keys, or other information required to install |
and execute modified versions of a covered work in that User Product from |
a modified version of its Corresponding Source. The information must |
suffice to ensure that the continued functioning of the modified object |
code is in no case prevented or interfered with solely because |
modification has been made. |
If you convey an object code work under this section in, or with, or |
specifically for use in, a User Product, and the conveying occurs as |
part of a transaction in which the right of possession and use of the |
User Product is transferred to the recipient in perpetuity or for a |
fixed term (regardless of how the transaction is characterized), the |
Corresponding Source conveyed under this section must be accompanied |
by the Installation Information. But this requirement does not apply |
if neither you nor any third party retains the ability to install |
modified object code on the User Product (for example, the work has |
been installed in ROM). |
The requirement to provide Installation Information does not include a |
requirement to continue to provide support service, warranty, or updates |
for a work that has been modified or installed by the recipient, or for |
the User Product in which it has been modified or installed. Access to a |
network may be denied when the modification itself materially and |
adversely affects the operation of the network or violates the rules and |
protocols for communication across the network. |
Corresponding Source conveyed, and Installation Information provided, |
in accord with this section must be in a format that is publicly |
documented (and with an implementation available to the public in |
source code form), and must require no special password or key for |
unpacking, reading or copying. |
7. Additional Terms. |
"Additional permissions" are terms that supplement the terms of this |
License by making exceptions from one or more of its conditions. |
Additional permissions that are applicable to the entire Program shall |
be treated as though they were included in this License, to the extent |
that they are valid under applicable law. If additional permissions |
apply only to part of the Program, that part may be used separately |
under those permissions, but the entire Program remains governed by |
this License without regard to the additional permissions. |
When you convey a copy of a covered work, you may at your option |
remove any additional permissions from that copy, or from any part of |
it. (Additional permissions may be written to require their own |
removal in certain cases when you modify the work.) You may place |
additional permissions on material, added by you to a covered work, |
for which you have or can give appropriate copyright permission. |
Notwithstanding any other provision of this License, for material you |
add to a covered work, you may (if authorized by the copyright holders of |
that material) supplement the terms of this License with terms: |
a) Disclaiming warranty or limiting liability differently from the |
terms of sections 15 and 16 of this License; or |
b) Requiring preservation of specified reasonable legal notices or |
author attributions in that material or in the Appropriate Legal |
Notices displayed by works containing it; or |
c) Prohibiting misrepresentation of the origin of that material, or |
requiring that modified versions of such material be marked in |
reasonable ways as different from the original version; or |
d) Limiting the use for publicity purposes of names of licensors or |
authors of the material; or |
e) Declining to grant rights under trademark law for use of some |
trade names, trademarks, or service marks; or |
f) Requiring indemnification of licensors and authors of that |
material by anyone who conveys the material (or modified versions of |
it) with contractual assumptions of liability to the recipient, for |
any liability that these contractual assumptions directly impose on |
those licensors and authors. |
All other non-permissive additional terms are considered "further |
restrictions" within the meaning of section 10. If the Program as you |
received it, or any part of it, contains a notice stating that it is |
governed by this License along with a term that is a further |
restriction, you may remove that term. If a license document contains |
a further restriction but permits relicensing or conveying under this |
License, you may add to a covered work material governed by the terms |
of that license document, provided that the further restriction does |
not survive such relicensing or conveying. |
If you add terms to a covered work in accord with this section, you |
must place, in the relevant source files, a statement of the |
additional terms that apply to those files, or a notice indicating |
where to find the applicable terms. |
Additional terms, permissive or non-permissive, may be stated in the |
form of a separately written license, or stated as exceptions; |
the above requirements apply either way. |
8. Termination. |
You may not propagate or modify a covered work except as expressly |
provided under this License. Any attempt otherwise to propagate or |
modify it is void, and will automatically terminate your rights under |
this License (including any patent licenses granted under the third |
paragraph of section 11). |
However, if you cease all violation of this License, then your |
license from a particular copyright holder is reinstated (a) |
provisionally, unless and until the copyright holder explicitly and |
finally terminates your license, and (b) permanently, if the copyright |
holder fails to notify you of the violation by some reasonable means |
prior to 60 days after the cessation. |
Moreover, your license from a particular copyright holder is |
reinstated permanently if the copyright holder notifies you of the |
violation by some reasonable means, this is the first time you have |
received notice of violation of this License (for any work) from that |
copyright holder, and you cure the violation prior to 30 days after |
your receipt of the notice. |
Termination of your rights under this section does not terminate the |
licenses of parties who have received copies or rights from you under |
this License. If your rights have been terminated and not permanently |
reinstated, you do not qualify to receive new licenses for the same |
material under section 10. |
9. Acceptance Not Required for Having Copies. |
You are not required to accept this License in order to receive or |
run a copy of the Program. Ancillary propagation of a covered work |
occurring solely as a consequence of using peer-to-peer transmission |
to receive a copy likewise does not require acceptance. However, |
nothing other than this License grants you permission to propagate or |
modify any covered work. These actions infringe copyright if you do |
not accept this License. Therefore, by modifying or propagating a |
covered work, you indicate your acceptance of this License to do so. |
10. Automatic Licensing of Downstream Recipients. |
Each time you convey a covered work, the recipient automatically |
receives a license from the original licensors, to run, modify and |
propagate that work, subject to this License. You are not responsible |
for enforcing compliance by third parties with this License. |
An "entity transaction" is a transaction transferring control of an |
organization, or substantially all assets of one, or subdividing an |
organization, or merging organizations. If propagation of a covered |
work results from an entity transaction, each party to that |
transaction who receives a copy of the work also receives whatever |
licenses to the work the party's predecessor in interest had or could |
give under the previous paragraph, plus a right to possession of the |
Corresponding Source of the work from the predecessor in interest, if |
the predecessor has it or can get it with reasonable efforts. |
You may not impose any further restrictions on the exercise of the |
rights granted or affirmed under this License. For example, you may |
not impose a license fee, royalty, or other charge for exercise of |
rights granted under this License, and you may not initiate litigation |
(including a cross-claim or counterclaim in a lawsuit) alleging that |
any patent claim is infringed by making, using, selling, offering for |
sale, or importing the Program or any portion of it. |
11. Patents. |
A "contributor" is a copyright holder who authorizes use under this |
License of the Program or a work on which the Program is based. The |
work thus licensed is called the contributor's "contributor version". |
A contributor's "essential patent claims" are all patent claims |
owned or controlled by the contributor, whether already acquired or |
hereafter acquired, that would be infringed by some manner, permitted |
by this License, of making, using, or selling its contributor version, |
but do not include claims that would be infringed only as a |
consequence of further modification of the contributor version. For |
purposes of this definition, "control" includes the right to grant |
patent sublicenses in a manner consistent with the requirements of |
this License. |
Each contributor grants you a non-exclusive, worldwide, royalty-free |
patent license under the contributor's essential patent claims, to |
make, use, sell, offer for sale, import and otherwise run, modify and |
propagate the contents of its contributor version. |
In the following three paragraphs, a "patent license" is any express |
agreement or commitment, however denominated, not to enforce a patent |
(such as an express permission to practice a patent or covenant not to |
sue for patent infringement). To "grant" such a patent license to a |
party means to make such an agreement or commitment not to enforce a |
patent against the party. |
If you convey a covered work, knowingly relying on a patent license, |
and the Corresponding Source of the work is not available for anyone |
to copy, free of charge and under the terms of this License, through a |
publicly available network server or other readily accessible means, |
then you must either (1) cause the Corresponding Source to be so |
available, or (2) arrange to deprive yourself of the benefit of the |
patent license for this particular work, or (3) arrange, in a manner |
consistent with the requirements of this License, to extend the patent |
license to downstream recipients. "Knowingly relying" means you have |
actual knowledge that, but for the patent license, your conveying the |
covered work in a country, or your recipient's use of the covered work |
in a country, would infringe one or more identifiable patents in that |
country that you have reason to believe are valid. |
If, pursuant to or in connection with a single transaction or |
arrangement, you convey, or propagate by procuring conveyance of, a |
covered work, and grant a patent license to some of the parties |
receiving the covered work authorizing them to use, propagate, modify |
or convey a specific copy of the covered work, then the patent license |
you grant is automatically extended to all recipients of the covered |
work and works based on it. |
A patent license is "discriminatory" if it does not include within |
the scope of its coverage, prohibits the exercise of, or is |
conditioned on the non-exercise of one or more of the rights that are |
specifically granted under this License. You may not convey a covered |
work if you are a party to an arrangement with a third party that is |
in the business of distributing software, under which you make payment |
to the third party based on the extent of your activity of conveying |
the work, and under which the third party grants, to any of the |
parties who would receive the covered work from you, a discriminatory |
patent license (a) in connection with copies of the covered work |
conveyed by you (or copies made from those copies), or (b) primarily |
for and in connection with specific products or compilations that |
contain the covered work, unless you entered into that arrangement, |
or that patent license was granted, prior to 28 March 2007. |
Nothing in this License shall be construed as excluding or limiting |
any implied license or other defenses to infringement that may |
otherwise be available to you under applicable patent law. |
12. No Surrender of Others' Freedom. |
If conditions are imposed on you (whether by court order, agreement or |
otherwise) that contradict the conditions of this License, they do not |
excuse you from the conditions of this License. If you cannot convey a |
covered work so as to satisfy simultaneously your obligations under this |
License and any other pertinent obligations, then as a consequence you may |
not convey it at all. For example, if you agree to terms that obligate you |
to collect a royalty for further conveying from those to whom you convey |
the Program, the only way you could satisfy both those terms and this |
License would be to refrain entirely from conveying the Program. |
13. Use with the GNU Affero General Public License. |
Notwithstanding any other provision of this License, you have |
permission to link or combine any covered work with a work licensed |
under version 3 of the GNU Affero General Public License into a single |
combined work, and to convey the resulting work. The terms of this |
License will continue to apply to the part which is the covered work, |
but the special requirements of the GNU Affero General Public License, |
section 13, concerning interaction through a network will apply to the |
combination as such. |
14. Revised Versions of this License. |
The Free Software Foundation may publish revised and/or new versions of |
the GNU General Public License from time to time. Such new versions will |
be similar in spirit to the present version, but may differ in detail to |
address new problems or concerns. |
Each version is given a distinguishing version number. If the |
Program specifies that a certain numbered version of the GNU General |
Public License "or any later version" applies to it, you have the |
option of following the terms and conditions either of that numbered |
version or of any later version published by the Free Software |
Foundation. If the Program does not specify a version number of the |
GNU General Public License, you may choose any version ever published |
by the Free Software Foundation. |
If the Program specifies that a proxy can decide which future |
versions of the GNU General Public License can be used, that proxy's |
public statement of acceptance of a version permanently authorizes you |
to choose that version for the Program. |
Later license versions may give you additional or different |
permissions. However, no additional obligations are imposed on any |
author or copyright holder as a result of your choosing to follow a |
later version. |
15. Disclaimer of Warranty. |
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
16. Limitation of Liability. |
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
SUCH DAMAGES. |
17. Interpretation of Sections 15 and 16. |
If the disclaimer of warranty and limitation of liability provided |
above cannot be given local legal effect according to their terms, |
reviewing courts shall apply local law that most closely approximates |
an absolute waiver of all civil liability in connection with the |
Program, unless a warranty or assumption of liability accompanies a |
copy of the Program in return for a fee. |
END OF TERMS AND CONDITIONS |
How to Apply These Terms to Your New Programs |
If you develop a new program, and you want it to be of the greatest |
possible use to the public, the best way to achieve this is to make it |
free software which everyone can redistribute and change under these terms. |
To do so, attach the following notices to the program. It is safest |
to attach them to the start of each source file to most effectively |
state the exclusion of warranty; and each file should have at least |
the "copyright" line and a pointer to where the full notice is found. |
<one line to give the program's name and a brief idea of what it does.> |
Copyright (C) <year> <name of author> |
This program is free software: you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation, either version 3 of the License, or |
(at your option) any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Also add information on how to contact you by electronic and paper mail. |
If the program does terminal interaction, make it output a short |
notice like this when it starts in an interactive mode: |
<program> Copyright (C) <year> <name of author> |
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
This is free software, and you are welcome to redistribute it |
under certain conditions; type `show c' for details. |
The hypothetical commands `show w' and `show c' should show the appropriate |
parts of the General Public License. Of course, your program's commands |
might be different; for a GUI interface, you would use an "about box". |
You should also get your employer (if you work as a programmer) or school, |
if any, to sign a "copyright disclaimer" for the program, if necessary. |
For more information on this, and how to apply and follow the GNU GPL, see |
<http://www.gnu.org/licenses/>. |
The GNU General Public License does not permit incorporating your program |
into proprietary programs. If your program is a subroutine library, you |
may consider it more useful to permit linking proprietary applications with |
the library. If this is what you want to do, use the GNU Lesser General |
Public License instead of this License. But first, please read |
<http://www.gnu.org/philosophy/why-not-lgpl.html>. |
/branches/v0.60_MicroMag3_Nick666/COPYING.LESSER |
---|
0,0 → 1,165 |
GNU LESSER GENERAL PUBLIC LICENSE |
Version 3, 29 June 2007 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
This version of the GNU Lesser General Public License incorporates |
the terms and conditions of version 3 of the GNU General Public |
License, supplemented by the additional permissions listed below. |
0. Additional Definitions. |
As used herein, "this License" refers to version 3 of the GNU Lesser |
General Public License, and the "GNU GPL" refers to version 3 of the GNU |
General Public License. |
"The Library" refers to a covered work governed by this License, |
other than an Application or a Combined Work as defined below. |
An "Application" is any work that makes use of an interface provided |
by the Library, but which is not otherwise based on the Library. |
Defining a subclass of a class defined by the Library is deemed a mode |
of using an interface provided by the Library. |
A "Combined Work" is a work produced by combining or linking an |
Application with the Library. The particular version of the Library |
with which the Combined Work was made is also called the "Linked |
Version". |
The "Minimal Corresponding Source" for a Combined Work means the |
Corresponding Source for the Combined Work, excluding any source code |
for portions of the Combined Work that, considered in isolation, are |
based on the Application, and not on the Linked Version. |
The "Corresponding Application Code" for a Combined Work means the |
object code and/or source code for the Application, including any data |
and utility programs needed for reproducing the Combined Work from the |
Application, but excluding the System Libraries of the Combined Work. |
1. Exception to Section 3 of the GNU GPL. |
You may convey a covered work under sections 3 and 4 of this License |
without being bound by section 3 of the GNU GPL. |
2. Conveying Modified Versions. |
If you modify a copy of the Library, and, in your modifications, a |
facility refers to a function or data to be supplied by an Application |
that uses the facility (other than as an argument passed when the |
facility is invoked), then you may convey a copy of the modified |
version: |
a) under this License, provided that you make a good faith effort to |
ensure that, in the event an Application does not supply the |
function or data, the facility still operates, and performs |
whatever part of its purpose remains meaningful, or |
b) under the GNU GPL, with none of the additional permissions of |
this License applicable to that copy. |
3. Object Code Incorporating Material from Library Header Files. |
The object code form of an Application may incorporate material from |
a header file that is part of the Library. You may convey such object |
code under terms of your choice, provided that, if the incorporated |
material is not limited to numerical parameters, data structure |
layouts and accessors, or small macros, inline functions and templates |
(ten or fewer lines in length), you do both of the following: |
a) Give prominent notice with each copy of the object code that the |
Library is used in it and that the Library and its use are |
covered by this License. |
b) Accompany the object code with a copy of the GNU GPL and this license |
document. |
4. Combined Works. |
You may convey a Combined Work under terms of your choice that, |
taken together, effectively do not restrict modification of the |
portions of the Library contained in the Combined Work and reverse |
engineering for debugging such modifications, if you also do each of |
the following: |
a) Give prominent notice with each copy of the Combined Work that |
the Library is used in it and that the Library and its use are |
covered by this License. |
b) Accompany the Combined Work with a copy of the GNU GPL and this license |
document. |
c) For a Combined Work that displays copyright notices during |
execution, include the copyright notice for the Library among |
these notices, as well as a reference directing the user to the |
copies of the GNU GPL and this license document. |
d) Do one of the following: |
0) Convey the Minimal Corresponding Source under the terms of this |
License, and the Corresponding Application Code in a form |
suitable for, and under terms that permit, the user to |
recombine or relink the Application with a modified version of |
the Linked Version to produce a modified Combined Work, in the |
manner specified by section 6 of the GNU GPL for conveying |
Corresponding Source. |
1) Use a suitable shared library mechanism for linking with the |
Library. A suitable mechanism is one that (a) uses at run time |
a copy of the Library already present on the user's computer |
system, and (b) will operate properly with a modified version |
of the Library that is interface-compatible with the Linked |
Version. |
e) Provide Installation Information, but only if you would otherwise |
be required to provide such information under section 6 of the |
GNU GPL, and only to the extent that such information is |
necessary to install and execute a modified version of the |
Combined Work produced by recombining or relinking the |
Application with a modified version of the Linked Version. (If |
you use option 4d0, the Installation Information must accompany |
the Minimal Corresponding Source and Corresponding Application |
Code. If you use option 4d1, you must provide the Installation |
Information in the manner specified by section 6 of the GNU GPL |
for conveying Corresponding Source.) |
5. Combined Libraries. |
You may place library facilities that are a work based on the |
Library side by side in a single library together with other library |
facilities that are not Applications and are not covered by this |
License, and convey such a combined library under terms of your |
choice, if you do both of the following: |
a) Accompany the combined library with a copy of the same work based |
on the Library, uncombined with any other library facilities, |
conveyed under the terms of this License. |
b) Give prominent notice with the combined library that part of it |
is a work based on the Library, and explaining where to find the |
accompanying uncombined form of the same work. |
6. Revised Versions of the GNU Lesser General Public License. |
The Free Software Foundation may publish revised and/or new versions |
of the GNU Lesser General Public License from time to time. Such new |
versions will be similar in spirit to the present version, but may |
differ in detail to address new problems or concerns. |
Each version is given a distinguishing version number. If the |
Library as you received it specifies that a certain numbered version |
of the GNU Lesser General Public License "or any later version" |
applies to it, you have the option of following the terms and |
conditions either of that published version or of any later version |
published by the Free Software Foundation. If the Library as you |
received it does not specify a version number of the GNU Lesser |
General Public License, you may choose any version of the GNU Lesser |
General Public License ever published by the Free Software Foundation. |
If the Library as you received it specifies that a proxy can decide |
whether future versions of the GNU Lesser General Public License shall |
apply, that proxy's public statement of acceptance of any version is |
permanent authorization for you to choose that version for the |
Library. |
/branches/v0.60_MicroMag3_Nick666/Flight-Ctrl_MEGA644_V0_60_MM3.hex |
---|
0,0 → 1,1522 |
:100000000C9492030C94AF030C94AF030C94AF03C5 |
:100010000C94AF030C94AF030C94AF030C94AF0398 |
:100020000C94AF030C94B20B0C94AF030C94AF037D |
:100030000C9407190C94AF030C94AF030C94AF030A |
:100040000C94AF030C94AF030C94590C0C947614DD |
:100050000C94D4050C94AF030C949E050C94AF0340 |
:100060000C94F80C0C94AF030C9460180C94AF0330 |
:100070004B08C508C508C5087D085E08C508C50841 |
:10008000C508A908A908A908A908A9088108C508D8 |
:10009000C5087008C5087908210D730DCC0D270E11 |
:1000A000440E670E8D0E740FB310E71048119E11A9 |
:1000B000EC116512BF12201344137A13B613F41314 |
:1000C0002D1479187E189A18A818AD18B818C018E9 |
:1000D000D4180A0A0D004E65757472616C0048658B |
:1000E0006164696E67486F6C64000A0D53746575CE |
:1000F0006572756E673A20004F4B0A0D000A0D417C |
:1001000062676C65696368204C75667464727563B8 |
:100110006B73656E736F722E2E000A0D4B616C69E6 |
:10012000627269657265204E65757472616C6C618E |
:100130006765000A0D4B616C6962726965726520C2 |
:100140004B6F6D70617373000A0D42656E75747A42 |
:100150006520506172616D657465727361747A2097 |
:100160002564000A0D496E69742E20454550524F92 |
:100170004D3A2047656E6572696572652044656613 |
:1001800061756C742D506172616D657465722E2E8F |
:100190002E000A0D3D3D3D3D3D3D3D3D3D3D3D3D3E |
:1001A0003D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D7F |
:1001B0003D3D000A0D466C69676874436F6E74724A |
:1001C0006F6C205625642E256420002E005A5F5245 |
:1001D000616E67653A202025346900595F52616E6F |
:1001E00067653A202025346900585F52616E676563 |
:1001F0003A2020253469004D4D332052616E6765E9 |
:10020000005A5F4F66667365743A20202533690093 |
:10021000595F4F66667365743A202025336900582C |
:100220005F4F66667365743A2020253369004D4D33 |
:1002300033204F66660052616E67653A2533692D3B |
:10024000253369005374656C6C756E673A202533ED |
:100250006900536574706F696E74202025336900DE |
:10026000536572766F202000506F7469343A2020F5 |
:1002700025336900506F7469333A202025336900B3 |
:10028000506F7469323A202025336900506F7469C9 |
:10029000313A20202533690053746172743A20206A |
:1002A000202020253569004D657373776572743A97 |
:1002B0002020253569005269636874756E673A209D |
:1002C00020253569004B6F6D7061737320202020ED |
:1002D00020202000456D70662E506567656C3A25BC |
:1002E0003569005370616E6E756E673A2020253552 |
:1002F0006900486F636820253469202825336929FF |
:1003000000526F6C6C202534692028253369290040 |
:100310004E69636B20253469202825336929004103 |
:100320004343202D2053656E736F720047696572D9 |
:100330002025346920282533692900526F6C6C20F0 |
:10034000253469202825336929004E69636B2025EF |
:100350003469202825336929004779726F202D20C0 |
:1003600053656E736F720050333A25346920204B09 |
:10037000616EE46C65200050313A253469202050CC |
:10038000323A253469200047733A253469202047E2 |
:10039000693A25346920004E693A25346920205293 |
:1003A0006F3A25346920004B373A25346920204BB9 |
:1003B000616EE46C6520004B353A25346920204B92 |
:1003C000363A25346920004B333A25346920204BD6 |
:1003D000343A25346920004B313A25346920204BCA |
:1003E000323A25346920004B6F6D706173733A2087 |
:1003F000202025356900526F6C6C3A202020202087 |
:1004000020253569004E69636B3A2020202020208A |
:1004100025356900616B742E204C6167650048F6D4 |
:1004200068656E726567656C756E67004B65696EB1 |
:100430006520004F66662020202020203A202535A8 |
:1004400069004C756674647275636B3A2025356972 |
:1004500000536F6C6C486F6568653A2025356900FC |
:10046000486F6568653A20202020202535690028DE |
:10047000632920486F6C676572204275737300535F |
:10048000657474696E673A20256420005625642ED1 |
:100490002564002B2B204D696B726F4B6F70746558 |
:1004A00072202B2B005B25695D000001020305060D |
:1004B0000708090A0B0C0D0F10111213141516174B |
:1004C00018191A1B1B1C1D1E1F2021212223242545 |
:1004D000252627272829292A2B2B2C2C2D2E2E2F79 |
:1004E0002F303031313232333334343435353636DF |
:1004F0003637373838383939393A3A3A3B3B3B3C6A |
:100500003C3C3C3D3D3D3D3E3E3E3E3F3F3F3F400F |
:1005100040404041414141414242424242434343C3 |
:100520004343434444444444444545454545454587 |
:100530004646464646464646474747474747474753 |
:100540004848484848484848484949494949494924 |
:100550004949494A4A4A4A4A4A4A4A4A4A4A4A4BFD |
:100560004B4B4B4B4B4B4B4B4B4B4B4B4C4C4C4CD7 |
:100570004C4C4C4C4C4C4C4C4C4C4C4D4D4D4D4DB6 |
:100580004D4D4D4D4D4D4D4D4D4D4D4D4E4E4E4E97 |
:100590004E4E4E4E4E4E4E4E4E4E4E4E4E4E4E4E7B |
:1005A0004F4F4F4F4F4F4F4F4F4F4F4F4F4F4F4F5B |
:1005B0004F4F4F4F4F4F4F4F0000000056F88E3CAB |
:1005C000C7F20E3D465E563D7FDC8E3DB07EB23DAD |
:1005D0000A13D63D9D96F93D65830E3E5E30203E62 |
:1005E000D5D0313E6F63433ECEE6543E8E59663ED3 |
:1005F00060BA773EED83843E55208D3EBEB1953E78 |
:100600007A379E3EDDB0A63E421DAF3EFF7BB73E31 |
:1006100070CCBF3EE80DC83EC83FD03E6A61D83EB0 |
:100620002D72E03E7171E83E925EF03EF738F83E82 |
:100630000000003F89D9033FCBA8073F766D0B3FF1 |
:1006400044270F3FE7D5123F1779163F8C101A3F0A |
:10065000FE9B1D3F241B213FBA8D243F7CF3273F87 |
:10066000254C2B3F71972E3F22D5313FF404353F67 |
:10067000A726383FFF393B3FBD3E3E3FA634413FB2 |
:100680007C1B443F09F3463F12BB493F60734C3F1C |
:10069000BD1B4F3FF2B3513FCF3B543F1EB3563FBC |
:1006A000AE19593F516F5B3FD7B35D3F14E75F3FD2 |
:1006B000DB08623F0119643F5D17663FCA03683F6C |
:1006C0001DDE693F34A66B3FEB5B6D3F20FF6E3F45 |
:1006D000B28F703F820D723F7078733F63D0743F6A |
:1006E0003F15763FEA46773F4D65783F5270793F38 |
:1006F000E2677A3FEC4B7B3F5C1C7C3F24D97C3F1C |
:1007000036827D3F80177E3FFD987E3F9E067F3F6D |
:100710005B607F3F2FA67F3F13D87F3F05F67F3F6B |
:100720000000803F11241FBECFEFD0E1DEBFCDBF60 |
:1007300011E0A0E0B1E0ECE7FEE502C005900D920B |
:10074000AC38B107D9F715E0ACE8B1E001C01D92B3 |
:10075000A233B107E1F70E94E7030C943D2F0C94FC |
:100760000000A2E0B0E00E941F2F802D992708957D |
:10077000FB01863008F085E0282F2150842F99272F |
:10078000AAE32A9FD0011124A65FBF4F019724F04E |
:1007900001900E942C2FFACFA2E0B0E0022E0E941E |
:1007A0002C2F0895FB01282F863008F025E0842F98 |
:1007B00099272150AAE32A9FD0011124A65FBF4F99 |
:1007C000019724F00E941F2F0192FACF08950F93F2 |
:1007D0001F93CF93DF9381E087B98FEF88B98BE1C7 |
:1007E00084B9289A8EE38AB9579A87EF8BB984B770 |
:1007F000877F84BF80916000886180936000109241 |
:10080000600088EE93E09093A7018093A601109278 |
:100810002202109221021092B3041092B20410929C |
:10082000200210921F0210921E0210921D022898A0 |
:100830000E94BA0C0E94A4070E94F2180E94F20CB7 |
:100840000E9446180E94221778941092AE038CE3FF |
:100850008093AF0384E08093B0038CE390E09F9398 |
:100860008F931F921F9283EB91E09F938F931F9220 |
:100870000E94240982E991E09F938F931F920E9426 |
:100880002409299AA1E0B0E00E941F2F802D2DB7E6 |
:100890003EB7265F3F4F2DBF8A30B9F183E691E026 |
:1008A0009F938F931F920E9424090E945B204AE32A |
:1008B0006AED74E080E00E94B80301E00F900F90B1 |
:1008C0000F90023049F40E94EE1F4AE36AED74E093 |
:1008D00082E00E94B80303E04AE36AED74E0802FEF |
:1008E0000E94B8030F5F063060F381E022E030E041 |
:1008F000D901082E0E942C2F8AE021503040D901C6 |
:10090000082E0E942C2F0E94E52102E010E0D80161 |
:100910000E941F2F802D4AE36AED74E00E94D203EB |
:10092000D8010E941F2F802D99279F938F9388E4D1 |
:1009300091E09F938F931F920E94240984EF91E08E |
:100940000E949D0BEC010F900F900F900F900F9055 |
:10095000CE010E94A60B8823D9F3E091DC04FF2787 |
:10096000EE0FFF1FE255FB4F808191818536910587 |
:10097000C4F0E091DD04FF27EE0FFF1FE255FB4FAF |
:10098000808191818536910564F083E391E09F93A6 |
:100990008F931F920E9424090E945C160F900F9063 |
:1009A0000F90E091DC04FF27EE0FFF1FE255FB4F95 |
:1009B0008081918185369105C4F0E091DD04FF27A7 |
:1009C000EE0FFF1FE255FB4F808191818C599F4FA5 |
:1009D00064F48AE191E09F938F931F920E9424090F |
:1009E0000E94E5210F900F900F908091E20480FF0C |
:1009F00020C08DEF90E09F938F931F920E94240957 |
:100A000084EC99E00E949D0BEC010E940E100F9067 |
:100A10000F900F90CE010E94A60B8823D9F388EF88 |
:100A200090E09F938F931F920E9424090F900F9044 |
:100A30000F900E941321289880ED97E09093A701D2 |
:100A40008093A60188EE93E09093A9038093A80376 |
:100A500085E58093A3038AEE90E09F938F931F9286 |
:100A60000E9424098091E2040F900F900F9082FF62 |
:100A700003C08EED90E002C086ED90E09F938F93CF |
:100A80001F920E9424090F900F900F9082ED90E02A |
:100A90009F938F931F920E9424090E9452100F90DF |
:100AA0000F900F908091A501882379F11092A501F4 |
:100AB0000E945E220E94CC20289880910101882308 |
:100AC00019F081508093010180911C02882329F044 |
:100AD00080911C02815080931C022091040130916E |
:100AE00005018091F20499272817390734F480ED25 |
:100AF00097E09093A7018093A6018091D20188236B |
:100B000019F40E94461801C028980E94BF070E944D |
:100B10002D0880E090E00E94A60B882319F28091B6 |
:100B20002302882329F088B190E1892788B901C080 |
:100B3000449884EF91E00E949D0BB4CF1F920F92D6 |
:100B40000FB60F9211248F939F93EF93FF93809191 |
:100B500000018823E1F48091A1019091A201019606 |
:100B60009093A2018093A101FC01EB58FD4FE0811D |
:100B7000ED3019F08639910539F41092A2011092E6 |
:100B8000A10181E080930001E093C60004C01092AF |
:100B9000A2011092A101FF91EF919F918F910F906F |
:100BA0000FBE0F901F9018951F920F920FB60F92C5 |
:100BB00011242F933F934F938F939F93AF93BF93A2 |
:100BC000CF93DF93EF93FF938091C60080939001C2 |
:100BD00040919C01463910F010929B018091900148 |
:100BE0008D3009F05CC080919B01823009F057C0C4 |
:100BF00010929B01A42FBB27FD01EA54FC4F3081CA |
:100C0000ED01C954DC4F288180919F019091A00192 |
:100C1000831B9109821B91099F709093A00180937F |
:100C20009F019C0196E0369527959A95E1F7235C04 |
:100C300020939E01982F9F73935C90939D018081D8 |
:100C4000281729F48881981711F491E006C0809143 |
:100C500093018F5F8093930190E0809191018823AD |
:100C600009F064C0992309F461C081E08093910187 |
:100C700040939401A854BC4F8DE08C938091BA03AB |
:100C8000823509F053C088E190E02CE00FB6F8946B |
:100C9000A895809360000FBE2093600047C08091AC |
:100CA0009B018130D9F0813018F08230E9F530C0F5 |
:100CB00080919001833239F480919101882319F455 |
:100CC00081E080939B01809190018093B80381E043 |
:100CD00080939C0180919001992715C082E08093B8 |
:100CE0009B01E42FFF2780919001E854FC4F808303 |
:100CF0004F5F40939C012091900180919F019091C2 |
:100D0000A001820F911D9093A00180939F010EC0BE |
:100D1000E42FFF2780919001E854FC4F80834639EF |
:100D200038F310929B01E7CF10929B01FF91EF9156 |
:100D3000DF91CF91BF91AF919F918F914F913F9153 |
:100D40002F910F900FBE0F901F901895DC0120E09F |
:100D500030E040E050E0E5E7F2E005C08191280F87 |
:100D6000311D4F5F5F4F4A175B07C1F73F70C901E5 |
:100D700036E0969587953A95E1F7835CFD01EB584F |
:100D8000FD4F808311962F73235CFD01EB58FD4FBF |
:100D90002083AA58BD4F8DE08C9310920001809162 |
:100DA00075028093C6000895EF92FF920F931F93F0 |
:100DB000CF93DF937A01722F93E290937502609341 |
:100DC00076028093770203E010E060E0A8E7B2E0EB |
:100DD00046C0F701E60FF11D90816F5F715019F465 |
:100DE000E0E040E00FC0F701E60FF11D40816F5FCA |
:100DF000715011F4E0E006C0F701E60FF11DE0814B |
:100E00006F5F7150892F86958695835C8C935527EB |
:100E1000892F99278370907024E0880F991F2A9555 |
:100E2000E1F79A0194E0369527959A95E1F7822BA0 |
:100E3000835CED0189834F705070440F551F440F40 |
:100E4000551F8E2F8295869586958370842B835CA3 |
:100E50008A83EF73E35CEB830C5F1F4F1496772359 |
:100E600009F0B7CFC8010E94A606E6E0CDB7DEB70D |
:100E70000C940A2F1F93CF93DF93EC0170E0A22F05 |
:100E8000BB27129748C0E42FFF27E854FC4F30815E |
:100E90004F5FE42FFF27E854FC4F50814F5FE42F52 |
:100EA000FF27E854FC4F10814F5FE42FFF27E854E1 |
:100EB000FC4F20814F5F842F9927A817B90774F141 |
:100EC0005D53FE01E70FF11D3D53330F330F852FA7 |
:100ED00082958F70382B3083613001F1912F9D53B3 |
:100EE0007F5FFE01E70FF11D71505295507F892FF2 |
:100EF00086958695582B508363506F3F79F07E5FBF |
:100F0000FE01E70FF11D9295990F990F907C2D53DB |
:100F1000922B90837F5F662309F0B5CFDF91CF914D |
:100F20001F9108951F93182F8A3019F48DE00E94A5 |
:100F300092078091C00085FFFCCF1093C60080E02F |
:100F400090E01F9108950895E1ECF0E088E180833E |
:100F5000A0ECB0E08C9182608C938081806880836B |
:100F60008081806480838AE28093C40088EC90E072 |
:100F70000E949D0B9093A2038093A10308958091FA |
:100F80000001882309F468C080918C01882371F0E6 |
:100F900080910001882351F02BE043EA53E06091F7 |
:100FA000740287E40E94D40610928C018091A10300 |
:100FB0009091A2030E94A60B882321F480918E01B8 |
:100FC0008823B1F080910001882391F022E34EE460 |
:100FD00054E06091740284E40E94D40610928E0161 |
:100FE0008AEF90E00E949D0B9093A2038093A1034F |
:100FF00080918D018823F1F0809100018823D1F048 |
:101000000E945B1010928D0180919A018F5F8093F6 |
:101010009A01843011F410929A0180919A0144E16E |
:10102000849FA00111244A5E5E4F24E160E0805D50 |
:101030000E94D40680918F01882371F08091000175 |
:10104000882351F02AE04EEA53E06091740286E56D |
:101050000E94D40610928F010895A2E0B0E0E3E36D |
:10106000F8E00C94F12E80919101882309F48FC04F |
:101070008FEF809301018091BA039927AA27BB279C |
:10108000FC01E356F040E431F10508F07EC0E85C75 |
:10109000FF4F0C94192F2091940143E06BE083EAF9 |
:1010A00093E00E943A078091C8019091A503892B93 |
:1010B0008093C80181E080938E0167C020919401E4 |
:1010C00043E062E0CE0101960E943A078091C80198 |
:1010D0009981892B8093C80181E080938D0155C04F |
:1010E0002091940143E064E086E991E00E943A0790 |
:1010F0004CC081E080938F0148C081E080938C01D7 |
:1011000044C02091940143E062E0CE0101960E9428 |
:101110003A0789818F3F89F0863010F085E0898316 |
:101120004AE36AED74E089810E94D20389812AE34F |
:101130004AED54E06091740208C0109174020E945C |
:10114000B1032AE34AED54E0612F855B0E94D40687 |
:101150001CC02091940143E06AE38AED94E00E9470 |
:101160003A078091BA034AE36AED74E08B560E9415 |
:10117000B8038091BA038B56A2E0B0E0082E0E941B |
:101180002C2F0E94B1030E94492210929101E3E0AA |
:10119000CE5F0C940D2F982F80918004813069F4DC |
:1011A0008091C701E82FFF27EA5EFE4F90838F5F93 |
:1011B0008093C70121E030E005C0892F0E9492078B |
:1011C000282F3327C90108951F93182F04C080E3E7 |
:1011D0000E94CB0811501116D4F31F9108951F934C |
:1011E000182F04C080E20E94CB0811501116D4F3CE |
:1011F0001F9108950F931F93CF93DF938C01EB0101 |
:1012000008C0F8010F5F1F4FE4918E2F0E94CB089A |
:1012100021972097B1F7DF91CF911F910F910895FA |
:101220000F931F93CF93DF938C01EB0106C0F8015E |
:1012300081918F010E94CB0821972097C1F7DF9100 |
:10124000CF911F910F910895A3E3B0E0EAE2F9E096 |
:101250000C94E22E29968FAD299780938004CE01BD |
:10126000855B9F4F9D838C832B968EAD9FAD2B9777 |
:101270009FA78EA722243324210102C01301240139 |
:101280000EA51FA502C00F5F1F4FF801F490FF20AD |
:1012900019F0F5E2FF16B9F7B8018EA59FA5681BF6 |
:1012A000790B11F00E94FA08FF2009F442C20F5F87 |
:1012B0001F4F1FA70EA71982AC81BD811BAA1AAAB6 |
:1012C0009FEF99ABEEA5FFA5CF0101969FA78EA733 |
:1012D000B49095E7B91621F08B2D8062883789F498 |
:1012E000EBA9E0FF07C02D903D904D905C901397C7 |
:1012F000149607C08D919C9111971C01442455248C |
:101300001296F0E2BF1621F489818823D9F685C0B0 |
:1013100083E2B81609F483C09AE2B91621F0EDE22F |
:10132000BE1669F408C0FD011296E081EAABE7FF42 |
:10133000C9CFE195EAABFBA9F061FF7D72C08BE2FA |
:10134000B81609F46AC09EE2B916B1F52EA53FA5FC |
:101350002F5F3F4FEEA5FFA584918A3221F0B82E72 |
:1013600020E030E01BC0FD0112964081518157FF03 |
:1013700002C04FEF5FEF49AB3FA72EA7A3CFC90134 |
:1013800003E0880F991F0A95E1F7220F331F280FFA |
:10139000391F2B0D311D20533040B49031968B2DC9 |
:1013A00080538A3060F3FFA7EEA7A90137FF02C080 |
:1013B0004FEF5FEF49AB8DCFF0E3BF1631F48BA950 |
:1013C00084FD80CF80628BAB7DCF8B2D81538930A4 |
:1013D000E8F420E030E0C901F3E0880F991FFA95A6 |
:1013E000E1F7220F331F280F391F2B0D311D20531A |
:1013F0003040EEA5FFA5CF0101969FA78EA7B49020 |
:101400008B2D80538A3038F32AAB63CF98E6B91618 |
:1014100051F4EBA9E460EBAB55CFB98253CFFBA9F4 |
:10142000F860FBAB4FCF8CE6B81621F49BA9916016 |
:101430009BAB48CFBD83AC83E3E6BE1639F412966E |
:10144000BD83AC8312978C918E8318C1F4E4BF16D0 |
:1014500039F084E6B81639F099E6B91659F503C0A3 |
:10146000EBA9E160EBABFBA9F0FF08C01496BD83CC |
:10147000AC835E904E903E902E900AC01296BD8333 |
:10148000AC839E918E911C01442437FC4094542CD3 |
:1014900057FC03C08AE088AB92C0509440943094CB |
:1014A0002094211C311C411C511C8DE289839AE03F |
:1014B00098AB85C0EFE4BE1629F0FFE6BF1639F4FD |
:1014C00088E061C09BA991609BABE8E056C0F0E763 |
:1014D000BF1671F41296BD83AC839E918E911C0150 |
:1014E000442455248BA980648BAB78E7B72E5EC06B |
:1014F000E3E7BE16D9F51296BD83AC83DE90CE909D |
:10150000C114D10489F488E28E838EE68F8385E747 |
:1015100088878CE689878A8789E28B871C8666E0C4 |
:10152000C62ED12CCC0EDD1EF9A9F7FD13C04F2F0E |
:10153000552747FD509560E070E0C6010E94EA2CF7 |
:10154000009711F419A90DC08C1919A981174CF431 |
:10155000182F07C0F60101900020E9F731971E2FE0 |
:101560001C1919824201310140E094C085E5B8168A |
:1015700031F095E7B91649F4EAE0E8AB1FC0FBA9E2 |
:10158000F160FBAB8AE088AB19C098E5B91621F091 |
:10159000E8E7BE1609F06EC0FBA9F3FD02C080E1CA |
:1015A000F2CF211431044104510419F490E198ABB5 |
:1015B00005C0EBA9E064EBABF0E1F8AB198289A9B7 |
:1015C00087FD03C09BA99F7D9BAB2114310441047F |
:1015D000510461F4E9A9EE2349F466247724430118 |
:1015E0005EE2C52ED12CCC0EDD1E3EC04EE2C42ED6 |
:1015F000D12CCC0EDD1EF8A9EF2EFF2400271127D9 |
:10160000C201B101A80197010E94A52E6A3020F401 |
:1016100030E3A32EA60E08C027E5A22EA60E88E56D |
:10162000B81611F49FEDA922F601A2926F01C20132 |
:10163000B101A80197010E94A52E39014A012E147B |
:101640003F044006510618F019012A01D9CFF8A924 |
:10165000F83051F48BA983FF07C090E3A91621F05D |
:1016600080E3F60182936F01CE018C19182F125D71 |
:1016700049A910C0BB2009F45CC0BE821982420196 |
:10168000310100E096E0C92ED12CCC0EDD1E11E018 |
:1016900021E005C0212F042F011B07FD00E08981F7 |
:1016A000882319F0812F8F5F07C09BA996FD02C088 |
:1016B000812F02C0822F8E5FA82EA00EEBA9EE2EE6 |
:1016C000FF2480E3482E512C4E205F20411451040A |
:1016D00021F48AA98A190E94EF088981882329F0B8 |
:1016E00061E070E0CE01019609C0E6FE09C080E32A |
:1016F0008A83BB8262E070E0CE0102960E941009EC |
:10170000F0E24F16510421F48AA98A190E94E408D4 |
:10171000802F0E94E408612F772767FD7095C6012E |
:101720000E941009E4FEAACD8AA98A190E94EF0836 |
:10173000A5CDE2E1CD5C0C94FE2E2091A301309169 |
:10174000A4012F5F3F4F820F931F08952091A301A3 |
:101750003091A401821B930B892F99278695807461 |
:10176000992708951F920F920FB60F921124EF92AE |
:10177000FF920F931F932F933F934F935F936F931A |
:101780007F938F939F93AF93BF93CF93DF93EF9309 |
:10179000FF93809102018150809302018F3F09F0F5 |
:1017A0006DC083E88093B00080918901C82FDD2748 |
:1017B000D093A901C093A80180910005E090FC049A |
:1017C00080FF1EC06091DB017091DC018091DD0122 |
:1017D0009091DE01FF240027112720E830E040E04F |
:1017E00050E00E94C72EC801B7010E945F2E20E082 |
:1017F00032E040E050E00E94C72EC20FD31F1DC050 |
:101800006091DB017091DC018091DD019091DE013E |
:10181000FF240027112720E830E040E050E00E943C |
:10182000C72EC801B7010E945F2E20E032E040E0E1 |
:1018300050E00E94C72EC21BD30BD093A901C093C6 |
:10184000A8012091A8013091A9018091FD04992758 |
:101850002817390734F08091FE04992782179307DF |
:1018600024F49093A9018093A8018091A80180930A |
:10187000B3008091FF048093020104C083E0809351 |
:10188000B0005F98FF91EF91DF91CF91BF91AF9141 |
:101890009F918F917F916F915F914F913F912F9188 |
:1018A0001F910F91FF90EF900F900FBE0F901F9020 |
:1018B00018951F920F920FB60F9211242F933F93FA |
:1018C0004F935F936F937F938F939F93AF93BF9348 |
:1018D000EF93FF938091AA0181508093AA018F3FDB |
:1018E00001F58AE08093AA01809103018F5F8170E6 |
:1018F00080930301882319F481E08093A5018091EE |
:10190000A3019091A40101969093A4018093A30157 |
:101910008091D201882329F08091D2018150809357 |
:10192000D2018091A6019091A701029758F0809171 |
:10193000A6019091A70101979093A7018093A6011A |
:101940005A9A01C05A988091E20483FF02C00E9413 |
:101950002A16FF91EF91BF91AF919F918F917F9147 |
:101960006F915F914F913F912F910F900FBE0F900C |
:101970001F9018958091A3019091A4010B969093CC |
:10198000AC018093AB0182E085BD83EA84BD17BCC6 |
:1019900088E788BD83EC8093B00086E08093B10037 |
:1019A000E0E7F0E0808182608083EEE6F0E0808115 |
:1019B000816080838AE08093B3001092B200089522 |
:1019C0002091A3013091A4012F5F3F4F280F391FB1 |
:1019D0008091A3019091A401A901481B590B57FFC5 |
:1019E000F7CF089510927C008FEC80937A000895D1 |
:1019F0001F920F920FB60F921124EF92FF920F9346 |
:101A00001F932F933F934F935F936F937F938F9386 |
:101A10009F93AF93BF93CF93DF93EF93FF93109276 |
:101A20007A008091C3018F5F8093C3018150E82FBA |
:101A3000FF27E830F10508F0CFC2E45BFF4F0C94BC |
:101A4000192F2091D7013091D80180917800909181 |
:101A50007900281B390B8091B1019091B201820F5E |
:101A6000931F9093B2018093B1018091BB018F5F6E |
:101A70008093BB018091FF0190910002A09101022F |
:101A8000B0910202442737FD4095542F820F931FD7 |
:101A9000A41FB51F8093FF0190930002A093010241 |
:101AA000B09302028091030290910402A09105027A |
:101AB000B0910602820F931FA41FB51F80930302EB |
:101AC00090930402A0930502B093060281E08093F4 |
:101AD000C4018091C1019091C20101969093C2010D |
:101AE0008093C1017DC260917800709179008091EE |
:101AF000D5019091D601681B790B8091F7019091E7 |
:101B0000F801A091F901B091FA019B01442737FD3A |
:101B10004095542F820F931FA41FB51F8093F70188 |
:101B20009093F801A093F901B093FA018091FB0121 |
:101B30009091FC01A091FD01B091FE01820F931FD5 |
:101B4000A41FB51F8093FB019093FC01A093FD019E |
:101B5000B093FE0180917800909179000A9710F47B |
:101B600064E47DEF8091780090917900895E9340E4 |
:101B700010F06CEB72E08091AF019091B001860F94 |
:101B8000971F9093B0018093AF018091BA018F5F4E |
:101B90008093BA0182E058C060917800709179001A |
:101BA0008091D3019091D401681B790B8091EF0152 |
:101BB0009091F001A091F101B091F2019B014427B5 |
:101BC00037FD4095542F820F931FA41FB51F80939C |
:101BD000EF019093F001A093F101B093F201809195 |
:101BE000F3019091F401A091F501B091F601820FFB |
:101BF000931FA41FB51F8093F3019093F401A0934A |
:101C0000F501B093F60180917800909179000A97E0 |
:101C100010F464E47DEF8091780090917900895E02 |
:101C2000934010F06CEB72E08091AD019091AE01A9 |
:101C3000860F971F9093AE018093AD018091B901FB |
:101C40008F5F8093B90184E08093C401C9C1409142 |
:101C500004015091050180917800909179009A01DA |
:101C6000220F331F240F351F63E070E00E947E2E89 |
:101C7000260F371F36952795369527953093050102 |
:101C80002093040186E0E0CF809121059091220508 |
:101C90002091780030917900821B930B90938204FD |
:101CA000809381048091B3019091B40120918104CB |
:101CB00030918204820F931F9093B4018093B301FB |
:101CC0008091BD018F5F8093BD0187E0BDCF809182 |
:101CD00078009091790020911F0530912005821B9A |
:101CE000930B90938D0480938C048091B501909117 |
:101CF000B60120918C0430918D04820F931F909334 |
:101D0000B6018093B5018091BC018F5F8093BC01C7 |
:101D100085E08093C40186E0E4C060917800709112 |
:101D20007900E0902305F09024050091250510919D |
:101D30002605882777FD8095982F0E949D2DA80164 |
:101D400097010E94F72C0E94802D7093B801609338 |
:101D5000B7012091B7013091B801E0918104F09171 |
:101D6000820480918C0490918D0497FF03C090951C |
:101D700081959F4F64E070E00E94922EEB01CF01AD |
:101D8000F7FF03C0909581959F4F64E070E00E943B |
:101D9000922E260F371F2C0F3D1F3093B801209332 |
:101DA000B7018091B7019091B801029704F1609159 |
:101DB000230570912405809125059091260520E04A |
:101DC00030E048E454E40E94A72D88230CF03CC086 |
:101DD0006091230570912405809125059091260539 |
:101DE0002AE037ED43EA5CE30E94F82C25C080919D |
:101DF000B7019091B8018F5F9F4F34F56091230533 |
:101E000070912405809125059091260520E030E011 |
:101E100046E154E40E94AA2D1816B4F460912305FB |
:101E20007091240580912505909126052AE037EDD3 |
:101E300043EA5CE30E94F72C60932305709324052A |
:101E4000809325059093260581E08093BE018091C3 |
:101E5000780090917900909384048093830420917A |
:101E60000702309108024091090250910A028091C4 |
:101E7000B7019091B801AA2797FDA095BA2F280F16 |
:101E8000391F4A1F5B1F20930702309308024093BB |
:101E9000090250930A02E0900702F09008020091B4 |
:101EA000090210910A026091070270910802809164 |
:101EB000090290910A0220E034E040E050E00E94E4 |
:101EC000C72EE21AF30A040B150BE0920702F092F8 |
:101ED00008020093090210930A0283E08093C40170 |
:101EE00087E08093C3017CC080919104909192041B |
:101EF0002091780030917900820F931F9093920483 |
:101F000080939104809189048F5F809389048091EC |
:101F10008904853008F460C0809178009091790040 |
:101F200090930B0180930A0110928904809185049B |
:101F3000909186042091910430919204821B930B1E |
:101F40002091240230912502821B930B9093C001B3 |
:101F50008093BF016091910470919204E09006011A |
:101F6000F09007010091080110910901882777FD81 |
:101F70008095982FA8019701220F331F441F551FEA |
:101F80002E0D3F1D401F511F620F731F841F951F91 |
:101F900024E030E040E050E00E94C72E209306018C |
:101FA0003093070140930801509309012091850463 |
:101FB000309186048091060190910701A09108015B |
:101FC000B0910901281B390B30932502209324027C |
:101FD00010929204109291041092C4011092C301C5 |
:101FE0008091C40180937C008FEC80937A00FF91F4 |
:101FF000EF91DF91CF91BF91AF919F918F917F91A1 |
:102000006F915F914F913F912F911F910F91FF9091 |
:10201000EF900F900FBE0F901F901895CF93DF9306 |
:10202000A3E0B0E00E941F2F802DC82FDD27C5310F |
:10203000D10508F02A97C7BD84E690E00E94E00C25 |
:1020400080910A0190910B0182559340D0F4C0E039 |
:10205000D0E017C0C7BD82E390E00E94E00C8BEC9B |
:1020600091E09F938F931F920E94240980910A010F |
:1020700090910B010F900F900F908458934020F097 |
:102080002196CA3FD10530F3A3E0B0E00C2E0E94A8 |
:102090002C2FC0938E0488EC90E00E94E00CDF911E |
:1020A000CF910895E6E1F1E080E2819391E0E63698 |
:1020B000F907D9F70895FF920F931F938091C801F4 |
:1020C000282F3327C90181709070682F882391F0E1 |
:1020D0008091C901882311F0815002C0809166016E |
:1020E0008093C901E6E1F1E080E2819391E0E63678 |
:1020F000F907D9F7A9014270507021FF0DC08091F6 |
:10210000C9018F5F8093C901E6E1F1E080E281932C |
:1021100091E0E636F907D9F7662321F0452B11F057 |
:102120001092C90181E18093C7018091C90199276B |
:102130009F938F9385EA94E09F938F9381E08F9391 |
:102140000E9424098091C9010F900F900F900F9069 |
:102150000F90E82FFF27ED30F10508F0BCC3EC5AD3 |
:10216000FF4F0C94192F1092C70183E994E09F93BD |
:102170008F9311E01F930E94240984E18093C7018B |
:102180008CE390E09F938F931F921F928CE894E0D2 |
:102190009F938F931F930E94240988E28093C70125 |
:1021A0000E94B10399279F938F938FE794E09F93A9 |
:1021B0008F931F930E9424098CE38093C7018FE6BD |
:1021C00094E09F938F931F930E94240980C3809172 |
:1021D000E20480FF44C01092C701809124029091D4 |
:1021E00025029F938F9380E694E09F938F9311E055 |
:1021F0001F930E94240984E18093C70180912602E5 |
:10220000909127029F938F9381E594E09F938F9302 |
:102210001F930E94240988E28093C70180910A01DC |
:1022200090910B019F938F9382E494E09F938F93FF |
:102230001F930E9424098CE38093C70180918E0430 |
:1022400099279F938F9383E394E09F938F931F939A |
:102250000E9424098DB79EB744968DBF41C384E187 |
:102260008093C7018CE294E09F938F9311E01F93BA |
:102270000E94240988E28093C7018EE194E09F9335 |
:102280008F931F930E9424098DB79EB70696E5CFC2 |
:102290001092C70184E194E09F938F9311E01F9304 |
:1022A0000E94240984E18093C7016091DB01709151 |
:1022B000DC018091DD019091DE0120E034E040E01E |
:1022C00050E00E94C72E5F934F933F932F9385E07A |
:1022D00094E09F938F931F930E94240988E2809338 |
:1022E000C7016091E3017091E4018091E501909153 |
:1022F000E60120E034E040E050E00E94C72E5F930A |
:102300004F933F932F9386EF93E09F938F931F9369 |
:102310000E9424098CE38093C70180910B02909165 |
:102320000C029F938F9387EE93E09F938F931F935D |
:102330000E9424098DB79EB746968FCF1092C70191 |
:102340008091B2049091B3042091B0043091B10413 |
:102350009F938F933F932F9387ED93E09F938F935A |
:1023600011E01F930E94240984E18093C7018091AA |
:10237000B6049091B7042091B4043091B5049F93B2 |
:102380008F933F932F9387EC93E09F938F931F93AB |
:102390000E94240988E28093C7018091BA04909139 |
:1023A000BB042091B8043091B9049F938F933F935D |
:1023B0002F9387EB93E09F938F931F930E942409A1 |
:1023C0008CE38093C7018091BC049091BD049F93DE |
:1023D0008F9387EA93E070C01092C701E091DB040D |
:1023E000FF27EE0FFF1FE255FB4F20813181E09167 |
:1023F000DA04FF27EE0FFF1FE255FB4F808191812A |
:102400003F932F939F938F9387E993E09F938F93AD |
:1024100011E01F930E94240984E18093C701E09199 |
:10242000DD04FF27EE0FFF1FE255FB4F20813181B6 |
:10243000E091DC04FF27EE0FFF1FE255FB4F808188 |
:1024400091813F932F939F938F9387E893E09F937E |
:102450008F931F930E94240988E28093C701E09123 |
:10246000DF04FF27EE0FFF1FE255FB4F2081318174 |
:10247000E091DE04FF27EE0FFF1FE255FB4F808146 |
:1024800091813F932F939F938F9387E793E09F933F |
:102490008F931F930E9424098CE38093C701E091DE |
:1024A000E004FF27EE0FFF1FE255FB4F8081918173 |
:1024B0009F938F9387E693E09F938F931F930E9440 |
:1024C00024098DB79EB74A96C8CE1092C70189E5F8 |
:1024D00093E09F938F9311E01F930E94240984E15E |
:1024E0008093C7012091D3013091D4018091AD0137 |
:1024F0009091AE016091B9013F932F9377270E948D |
:10250000922E7F936F938AE493E09F938F931F9310 |
:102510000E94240988E28093C7012091D50130915F |
:10252000D6018091AF019091B0016091BA013F93C3 |
:102530002F9377270E94922E7F936F938BE393E0E4 |
:102540009F938F931F930E9424098CE38093C7016C |
:102550002091D7013091D8018091B1019091B201C1 |
:102560006091BB013F932F9377270E94922E7F9318 |
:102570006F938CE293E09F938F931F935BC01092B5 |
:10258000C7018FE193E09F938F9381E0F82EFF9234 |
:102590000E94240984E18093C70120911F05309196 |
:1025A00020058091B5019091B6016091BC013F93E7 |
:1025B0002F9377270E94922E7F936F9380E193E071 |
:1025C0009F938F93FF920E94240988E28093C70112 |
:1025D00020912105309122058091B3019091B401A1 |
:1025E0006091BD013F932F9377270E94922E7F9396 |
:1025F0006F9381E093E09F938F93FF920E94240951 |
:102600008CE38093C701609123057091240580912C |
:1026100025059091260500918304109184040E9461 |
:10262000802D7F936F931F930F9382EF92E09F9380 |
:102630008F93FF920E9424098DB79EB748960DCEC6 |
:1026400084E18093C70180910401909105019F93DB |
:102650008F9383EE92E09F938F9311E01F930E94DC |
:10266000240988E28093C70180911C0299279F93D7 |
:102670008F9384ED92E09F938F931F930E94240980 |
:102680008DB79EB70A96E9CD1092C70185EC92E00E |
:102690009F938F9311E01F930E94240984E18093FC |
:1026A000C70180910F02909110029F938F9386EB48 |
:1026B00092E09F938F931F930E94240988E2809356 |
:1026C000C70180910B0290910C029F938F9387EA30 |
:1026D00092E09F938F931F930E9424098CE3809331 |
:1026E000C70180910D0290910E029F938F9388E90C |
:1026F00092E0E8C01092C7018091140290911502F7 |
:102700009F938F938CE892E09F938F9311E01F9398 |
:102710000E94240984E18093C70180911602909160 |
:1027200017029F938F9380E892E09F938F931F935C |
:102730000E94240988E28093C70180911802909139 |
:1027400019029F938F9384E792E09F938F931F9337 |
:102750000E9424098CE38093C70180911A02909112 |
:102760001B029F938F9388E692E06FCD1092C70172 |
:1027700080E692E09F938F9311E01F930E942409BB |
:1027800084E18093C7018091890199279F938F935A |
:1027900082E592E09F938F931F930E94240988E221 |
:1027A0008093C7018091A8019091A9019F938F9375 |
:1027B00084E492E09F938F931F930E9424098CE3FB |
:1027C0008093C7018091FE0499279F938F938091F6 |
:1027D000FD0499279F938F9386E392E09F938F93B5 |
:1027E0001F930E94240936CD1092C7018EE292E019 |
:1027F0009F938F9311E01F930E94240984E180939B |
:10280000C70180919304992787FD90959F938F939B |
:102810008FE192E09F938F931F930E94240988E297 |
:102820008093C70180919404992787FD90959F9389 |
:102830008F9380E192E09F938F931F930E942409CE |
:102840008CE38093C70180919504992787FD90952B |
:102850009F938F9381E092E035C01092C70187EF7C |
:1028600091E09F938F9311E01F930E94240984E1CC |
:102870008093C70180919604909197049F938F93C2 |
:1028800089EE91E09F938F931F930E94240988E221 |
:102890008093C70180919804909199049F938F939E |
:1028A0008BED91E09F938F931F930E9424098CE3FB |
:1028B0008093C70180919A0490919B049F938F937A |
:1028C0008DEC91E09F938F931F930E9424098DB705 |
:1028D0009EB74296C2CC8150809366011092C90186 |
:1028E0001092C8011F910F91FF9008951F920F92AF |
:1028F0000FB60F9211242F933F934F938F939F9373 |
:1029000080919C04833019F08430A1F508C08EB505 |
:102910008093CA011EBC84E080939C042BC08091EC |
:10292000CA019927382F22278EB59927282B392BB2 |
:10293000C9018D509E4F875E9340D0F480919F04D3 |
:10294000853019F0863069F406C03093A1042093D5 |
:10295000A00486E00BC03093A3042093A20487E078 |
:1029600005C03093A5042093A40485E080939F04C0 |
:1029700010929C049F918F914F913F912F910F90B6 |
:102980000FBE0F901F901895A0E1B0E0EAECF4E1C3 |
:102990000C94E22E6091DB017091DC018091DD01ED |
:1029A0009091DE01E090F704FF2433E0EE0CFF1C71 |
:1029B0003A95E1F700271127A80197010E94C72E39 |
:1029C00059016A01C9010E94DE176D877E878F87D2 |
:1029D000988BC5010E943E1869877A878B879C87F0 |
:1029E0006091E3017091E4018091E5019091E6012D |
:1029F000A80197010E94C72E79018A01C9010E948E |
:102A0000DE176D837E838F839887C7010E943E18EF |
:102A100069837A838B839C83A090A004B090A104E7 |
:102A200080919304992787FD9095A81AB90A809000 |
:102A3000A2049090A30480919404992787FD909517 |
:102A4000881A990A4090A4045090A5048091950496 |
:102A5000992787FD9095481A590A2090960430903E |
:102A60009704C0909804D0909904C214D304D0F471 |
:102A700060909A0470909B046214730498F471013E |
:102A800000271127B401882777FD8095982FA8018A |
:102A900097010E945F2E9601442755270E94C72E5A |
:102AA00049011CC02C143D0448F560909A047090B4 |
:102AB0009B046C147D0410F5760100271127B501E5 |
:102AC000882777FD8095982FA80197010E945F2E97 |
:102AD0009101442755270E94C72E5901B20188272A |
:102AE00077FD8095982FA80197010E945F2E930192 |
:102AF000442755270E94C72E290124C0E0909A043C |
:102B0000F0909B0400271127B501882777FD809559 |
:102B1000982FA80197010E945F2E91014427552705 |
:102B20000E94C72E5901B401882777FD8095982F00 |
:102B3000A80197010E945F2E9601442755270E9405 |
:102B4000C72E4901B0927304A0927204909275044A |
:102B5000809274045092770440927604B5018827DD |
:102B600077FD8095982F0E949D2D29853A854B856C |
:102B70005C850E94172E5B016C01B401882777FDEC |
:102B80008095982F0E949D2D7B018C012D813E8187 |
:102B90004F8158850E94172E2D853E854F85588977 |
:102BA0000E94172E9B01AC01C601B5010E94F82CB2 |
:102BB0003B014C01B201882777FD8095982F0E9438 |
:102BC0009D2D5B016C0129813A814B815C81C8019B |
:102BD000B7010E94172E7B018C012D813E814F8110 |
:102BE0005885C601B5010E94172E9B01AC01C80192 |
:102BF000B7010E94F82C0E94802D7B018C01298155 |
:102C00003A814B815C81C601B5010E94172E2D854A |
:102C10003E854F8558890E94172E9B01AC01C40147 |
:102C2000B3010E94F72C0E94802DDC01CB01B7017B |
:102C30000E9436179C0197FF05C088279927821BA1 |
:102C4000930B04C088E691E0821B930BE2E1C05F26 |
:102C50000C94FE2E80919C04813041F0813018F05C |
:102C6000823049F51CC02A9A81E016C02A988091CA |
:102C70009F04853011F481E305C0863011F482E3AE |
:102C800001C083E38EBD88E090E00E949D0B90938D |
:102C90009E0480939D0482E080939C04089580911B |
:102CA0009D0490919E040E94A60B882321F01EBCD7 |
:102CB00083E080939C040895A0E0B0E0E2E6F6E1B2 |
:102CC0000C94E42E299A2898EE24FF2400E010E0CA |
:102CD000AA24BB24CC24DD246624772488249924C8 |
:102CE00062E3462E55248091A0049091A104081718 |
:102CF00019072CF40091A0041091A1040BC080913D |
:102D0000A0049091A1048E159F0524F4E090A004E6 |
:102D1000F090A1048091A2049091A304C816D90652 |
:102D20002CF4C090A204D090A3040BC08091A20404 |
:102D30009091A3048A159B0524F4A090A204B0905E |
:102D4000A3048091A4049091A504881699062CF4FC |
:102D50008090A4049090A5040BC08091A40490914D |
:102D6000A5048615970524F46090A4047090A5042A |
:102D7000552081F485B191E0892785B985B192E02C |
:102D8000892785B982E390E09093A7018093A601FB |
:102D900052E3552E8AE090E00E949D0BEC01CE019B |
:102DA0000E94A60B8823D9F3E091DC04FF27EE0FE5 |
:102DB000FF1FE255FB4F80819181843691050CF411 |
:102DC0004A94442011F05A948ECFC8018E199F095D |
:102DD0009093970480939604C6018A199B09909357 |
:102DE000990480939804C4018619970990939B04D1 |
:102DF00080939A04E3E9F4E0C8018E0D9F1D62E020 |
:102E000070E00E94922E60939304C6018A0D9B1D70 |
:102E100062E070E00E94922E60939404C401860DDB |
:102E2000971D62E070E00E94922E6093950489E005 |
:102E3000ACE2B1E0182E0E94382FE0E1CDB7DEB74A |
:102E40000C94002F83ED8CBD84B1846A84B95B98A7 |
:102E500085E080939F0410929C0489E0E3E9F4E00C |
:102E6000ACE2B1E0182E0E94272F08951F93CF9354 |
:102E7000DF93EC01892B31F46115710519F480E0C1 |
:102E800090E08EC077FD02C011E001C01FEF2097D7 |
:102E900029F48AE51802C001112482C0882777FD31 |
:102EA0008095982F22E330E040E050E00E945F2EB2 |
:102EB0009E01442737FD4095542F0E94C72EF901EB |
:102EC00037FF03C0F095E195FF4F41E0EE30F40786 |
:102ED00034F4E655FB4F8491282F332747C056E141 |
:102EE000E737F5071CF02AE530E040C087E0E63719 |
:102EF000F8071CF029E530E039C044E0EE37F4076C |
:102F00001CF028E530E032C053E0E433F5071CF054 |
:102F100027E530E02BC082E0E038F8071CF026E51A |
:102F200030E024C042E0E830F4071CF025E530E052 |
:102F30001DC051E0E83BF5071CF024E530E016C069 |
:102F400081E0EC37F8071CF023E530E00FC041E0EA |
:102F5000EF34F4071CF022E530E008C0EB52F140FA |
:102F60001CF021E530E002C020E530E01C161D0613 |
:102F70006CF4812F992787FD9095AC01249FC001A7 |
:102F8000259F900D349F900D11240AC011162CF42A |
:102F900084EB90E0821B930B03C0C901845B9040DB |
:102FA000DF91CF911F910895FC0125913491FC018F |
:102FB000329645915491CA01B9010895A0E0B0E05C |
:102FC000E4EEF7E10C94EC2E9C0197FD04C041E087 |
:102FD000C42ED12C06C0309521953F4F9FEFC92EAE |
:102FE000D92E2B3531055CF0C9018B5590408A35BF |
:102FF000910540F484EB90E0821B930B9C01C1E0AF |
:10300000D0E010C0C901855B90408A35910518F465 |
:10301000245B304005C088E691E0821B930B9C0145 |
:10302000CFEFDFEF220F331F220F331FC901885468 |
:103030009A4F0E94D4177B018C01B601882777FD37 |
:103040008095982F0E949D2D9B01AC01C801B7016E |
:103050000E94172E7B018C01BE01882777FD809589 |
:10306000982F0E949D2D9B01AC01C801B7010E94C1 |
:10307000172EE8E0CDB7DEB70C94082F2AE530E034 |
:10308000281B390BC9010E94DE1708951092B90060 |
:103090008AE28093B800089585EA8093BC0080E0BE |
:1030A00090E0089584E98093BC0008951092B900DF |
:1030B0008093BB0085E88093BC0080E090E0089599 |
:1030C0001F920F920FB60F9211248F939F93EF933D |
:1030D000FF938091CB018F5F8093CB018150E82FCC |
:1030E000FF27E830F10508F074C0EF59FF4F0C944A |
:1030F000192F8091CC01880F8E5A14C08091CC0179 |
:103100008F5F8093CC018150813009F444C08130BD |
:1031100038F0823009F442C0833009F05AC041C00F |
:10312000809165021092B9008093BB0085E880937E |
:10313000BC004FC084E98093BC008091CC018430F6 |
:1031400018F41092CB0102C01092CC0185EAEFCFA7 |
:103150008091CD01880F8D5AE5CF8091CD018130CE |
:10316000D1F08130E8F28230C9F0833091F519C096 |
:103170008091BB00E091CD01FF27EA55FB4F808392 |
:103180008091CD01813039F0813050F2823031F0C0 |
:103190008330F9F406C080916602C4CF8091690241 |
:1031A000C1CF80916B02BECF8091CD019091BB00C9 |
:1031B000E82FFF27EA55FB4F94838F5F8093CD0163 |
:1031C000843010F01092CD0184E98093BC001092FD |
:1031D000CB01FF91EF919F918F910F900FBE0F90B8 |
:1031E0001F90189583EC80938100EFE6F0E08081DA |
:1031F000806280831092D8011092D7011092D6017C |
:103200001092D5011092D4011092D30108951F920B |
:103210000F920FB60F9211240F931F932F933F938A |
:103220004F935F936F937F938F939F93AF93BF93CE |
:10323000CF93DF93EF93FF93209186003091870027 |
:103240008091D0019091D101281B390B809186008B |
:10325000909187009093D1018093D001C9018D5D39 |
:1032600095408356994148F481E090E09093CF01D6 |
:103270008093CE011092670154C0C091CE01D091CD |
:10328000CF01CA30D1050CF04CC0C9018B5F904012 |
:10329000845B914008F040C0A901425D5140FE01AD |
:1032A000EE0FFF1FE255FB4F80819181FA01E81B71 |
:1032B000F90BCF01F7FF03C0909581959F4F0697BB |
:1032C0004CF480911C02883C28F480911C02865F9B |
:1032D00080931C02FE01EE0FFF1F8F0102551B4F52 |
:1032E000D8012D913C91C901880F991F820F931F1E |
:1032F000840F951F64E070E00E94922ED8018D919A |
:103300009C9111979B01281B390BEC53FB4F318388 |
:10331000208311967C936E932196D093CF01C09316 |
:10332000CE01FF91EF91DF91CF91BF91AF919F912E |
:103330008F917F916F915F914F913F912F911F914D |
:103340000F910F900FBE0F901F901895AF92BF92E4 |
:10335000CF92DF92EF92FF920F931F9310927A0019 |
:103360008091B901882369F08091AD019091AE01FF |
:103370006091B90177270E94922E70931705609390 |
:1033800016058091BA01882369F08091AF01909170 |
:10339000B0016091BA0177270E94922E70931505B3 |
:1033A000609314058091BB01882369F08091B1017D |
:1033B0009091B2016091BB0177270E94922E709389 |
:1033C0002B0560932A058091BC018823D9F1E090F8 |
:1033D0002705F09028056091B5017091B601209104 |
:1033E000BC010027F7FC0095102F5701680183E00E |
:1033F000AA0CBB1CCC1CDD1C8A95D1F7AE18BF08EB |
:10340000C00AD10A882777FD8095982FB4E0660F0F |
:10341000771F881F991FBA95D1F73327442755275F |
:103420000E94C72EA20EB31EC41ED51EC601B50132 |
:1034300028E030E040E050E00E94C72E309328059D |
:10344000209327058091BD018823D9F1E0903005B4 |
:10345000F09031056091B3017091B4012091BD01EC |
:103460000027F7FC0095102F57016801A3E0AA0C74 |
:10347000BB1CCC1CDD1CAA95D1F7AE18BF08C00A36 |
:10348000D10A882777FD8095982FF4E0660F771F83 |
:10349000881F991FFA95D1F73327442755270E9493 |
:1034A000C72EA20EB31EC41ED51EC601B50128E04C |
:1034B00030E040E050E00E94C72E30933105209369 |
:1034C00030058091BE018823A1F1E0901905F090AC |
:1034D0001A056091B7017091B8012091BE010027D3 |
:1034E000F7FC0095102F57016801E3E0AA0CBB1C04 |
:1034F000CC1CDD1CEA95D1F7AE18BF08C00AD10A72 |
:10350000882777FD8095982F3327442755270E94D9 |
:10351000C72EA20EB31EC41ED51EC601B50128E0DB |
:1035200030E040E050E00E94C72E30931A0520930F |
:1035300019051092AE011092AD011092B9011092CE |
:10354000B0011092AF011092BA011092B201109224 |
:10355000B1011092BB011092B4011092B30110920C |
:10356000BD011092B6011092B5011092BC011092EB |
:10357000B8011092B7011092BE018091FF019091A5 |
:103580000002A0910102B09102028093EB0190939E |
:10359000EC01A093ED01B093EE018091EF019091C9 |
:1035A000F001A091F101B091F2018093DB019093C1 |
:1035B000DC01A093DD01B093DE018091F7019091D1 |
:1035C000F801A091F901B091FA018093E301909381 |
:1035D000E401A093E501B093E6018091F30190919D |
:1035E000F401A091F501B091F6018093DF01909371 |
:1035F000E001A093E101B093E2018091FB01909181 |
:10360000FC01A091FD01B091FE018093E701909330 |
:10361000E801A093E901B093EA018FEC80937A006E |
:1036200020911402309115028091DE04E82FFF27CB |
:10363000EE0FFF1FE255FB4F8081918182599F4F12 |
:10364000281739071CF42F5F3F4F0CC080819181F0 |
:1036500082599F4F821793074CF42115310531F0A1 |
:10366000215030403093150220931402209116020D |
:10367000309117028091DF04E82FFF27EE0FFF1F24 |
:10368000E255FB4F8081918182599F4F281739075E |
:103690001CF42F5F3F4F0CC08081918182599F4F56 |
:1036A000821793074CF42115310531F02150304039 |
:1036B00030931702209316022091180230911902BC |
:1036C0008091E004E82FFF27EE0FFF1FE255FB4F2C |
:1036D0008081918182599F4F281739071CF42F5FF1 |
:1036E0003F4F0CC08081918182599F4F8217930771 |
:1036F0004CF42115310531F021503040309319023E |
:103700002093180220911A0230911B028091E1044B |
:10371000E82FFF27EE0FFF1FE255FB4F80819181BD |
:1037200082599F4F281739071CF42F5F3F4F0CC059 |
:103730008081918182599F4F821793074CF4211504 |
:10374000310531F02150304030931B0220931A0292 |
:10375000809114029091150297FF05C010921502F6 |
:10376000109214020AC08F3F910539F034F08FEFA8 |
:1037700090E090931502809314028091160290912C |
:10378000170297FF05C010921702109216020AC086 |
:103790008F3F910539F034F08FEF90E0909317024E |
:1037A00080931602809118029091190297FF05C02C |
:1037B00010921902109218020AC08F3F910539F039 |
:1037C00034F08FEF90E0909319028093180280916B |
:1037D0001A0290911B0297FF05C010921B021092D3 |
:1037E0001A020AC08F3F910539F034F08FEF90E054 |
:1037F00090931B0280931A021F910F91FF90EF90FC |
:10380000DF90CF90BF90AF90089510927A00809192 |
:10381000B901882369F08091AD019091AE0160916A |
:10382000B90177270E94922E7093170560931605B1 |
:103830008091BA01882369F08091AF019091B00125 |
:103840006091BA0177270E94922E709315056093BC |
:1038500014058091BB01882369F08091B10190919A |
:10386000B2016091BB0177270E94922E70932B05C5 |
:1038700060932A058091BC018823D1F06091B50145 |
:103880007091B6012091BC01882777FD8095982F13 |
:10389000F4E0660F771F881F991FFA95D1F7332739 |
:1038A000442755270E94C72E3093280520932705CB |
:1038B0008091BD018823D1F06091B3017091B40172 |
:1038C0002091BD01882777FD8095982FE4E0660F51 |
:1038D000771F881F991FEA95D1F73327442755276B |
:1038E0000E94C72E30933105209330058091BE0190 |
:1038F000882399F06091B7017091B8012091BE01C1 |
:10390000882777FD8095982F3327442755270E94D5 |
:10391000C72E30931A05209319051092AE0110920C |
:10392000AD011092B9011092B0011092AF01109246 |
:10393000BA011092B2011092B1011092BB01109223 |
:10394000B4011092B3011092BD011092B601109211 |
:10395000B5011092BC011092B8011092B7011092FB |
:10396000BE018FEC80937A002091140230911502F1 |
:103970008091DE04E82FFF27EE0FFF1FE255FB4F7B |
:103980008081918182599F4F281739071CF42F5F3E |
:103990003F4F0CC08081918182599F4F82179307BE |
:1039A0004CF42115310531F021503040309315028F |
:1039B0002093140220911602309117028091DF04A7 |
:1039C000E82FFF27EE0FFF1FE255FB4F808191810B |
:1039D00082599F4F281739071CF42F5F3F4F0CC0A7 |
:1039E0008081918182599F4F821793074CF4211552 |
:1039F000310531F0215030403093170220931602E8 |
:103A000020911802309119028091E004E82FFF27DD |
:103A1000EE0FFF1FE255FB4F8081918182599F4F2E |
:103A2000281739071CF42F5F3F4F0CC0808191810C |
:103A300082599F4F821793074CF42115310531F0BD |
:103A400021503040309319022093180220911A021D |
:103A500030911B028091E104E82FFF27EE0FFF1F3A |
:103A6000E255FB4F8081918182599F4F281739077A |
:103A70001CF42F5F3F4F0CC08081918182599F4F72 |
:103A8000821793074CF42115310531F02150304055 |
:103A900030931B0220931A02809114029091150218 |
:103AA00097FF05C010921502109214020AC08F3FB2 |
:103AB000910539F034F08FEF90E0909315028093E8 |
:103AC0001402809116029091170297FF05C0109280 |
:103AD0001702109216020AC08F3F910539F034F098 |
:103AE0008FEF90E090931702809316028091180256 |
:103AF0009091190297FF05C01092190210921802B6 |
:103B00000AC08F3F910539F034F08FEF90E0909329 |
:103B100019028093180280911A0290911B0297FF5C |
:103B200005C010921B0210921A0208958F3F910552 |
:103B300039F034F08FEF90E090931B0280931A02DB |
:103B400008951F938091E5048B3F98F08B3F19F403 |
:103B5000809114020EC08C3F19F48091160209C0A6 |
:103B60008D3F19F48091180204C08E3F21F480919A |
:103B70001A028093810180918101882319F41092A7 |
:103B8000810104C08F3F11F4809381018091E4048E |
:103B90008B3F98F08B3F19F4809114020EC08C3F3C |
:103BA00019F48091160209C08D3F19F48091180212 |
:103BB00004C08E3F21F480911A028093800180918D |
:103BC0008001882319F41092800105C0843618F012 |
:103BD00084E6809380018091E6048B3F98F08B3FD0 |
:103BE00019F4809114020EC08C3F19F480911602D2 |
:103BF00009C08D3F19F48091180204C08E3F21F452 |
:103C000080911A028093820180918201882319F4A5 |
:103C10001092820105C0843618F084E680938201F8 |
:103C20008091E8048B3F98F08B3F19F48091140247 |
:103C30000EC08C3F19F48091160209C08D3F19F413 |
:103C40008091180204C08E3F21F480911A02809363 |
:103C5000830180918301882319F41092830104C0A9 |
:103C60008F3F11F4809383018091EF048B3F98F094 |
:103C70008B3F19F4809114020EC08C3F19F480918F |
:103C8000160209C08D3F19F48091180204C08E3FBE |
:103C900021F480911A028093840180918401882309 |
:103CA00019F41092840104C08F3F11F480938401B1 |
:103CB0008091F0048B3F98F08B3F19F480911402AF |
:103CC0000EC08C3F19F48091160209C08D3F19F483 |
:103CD0008091180204C08E3F21F480911A028093D3 |
:103CE0008501809185018B3010F48AE002C08F3FFE |
:103CF00011F4809385018091F1048B3F98F08B3F04 |
:103D000019F4809114020EC08C3F19F480911602B0 |
:103D100009C08D3F19F48091180204C08E3F21F430 |
:103D200080911A028093860180918601882319F47C |
:103D30001092860104C08F3F11F480938601809118 |
:103D4000F6048B3F98F08B3F19F4809114020EC05B |
:103D50008C3F19F48091160209C08D3F19F48091AF |
:103D6000180204C08E3F21F480911A0280938801CA |
:103D700080918801882319F41092880104C08F3F34 |
:103D800011F4809388018091F7048B3F98F08B3F6A |
:103D900019F4809114020EC08C3F19F48091160220 |
:103DA00009C08D3F19F48091180204C08E3F21F4A0 |
:103DB00080911A028093280280912802882319F4A6 |
:103DC0001092280204C08F3F11F480932802809142 |
:103DD000F8048B3F98F08B3F19F4809114020EC0C9 |
:103DE0008C3F19F48091160209C08D3F19F480911F |
:103DF000180204C08E3F21F480911A028093290298 |
:103E000080912902882319F41092290204C08F3F5F |
:103E100011F4809329028091F9048B3F98F08B3F35 |
:103E200019F4809114020EC08C3F19F4809116028F |
:103E300009C08D3F19F48091180204C08E3F21F40F |
:103E400080911A0280932A0280912A02882319F411 |
:103E500010922A0204C08F3F11F480932A028091AD |
:103E6000FA048B3F98F08B3F19F4809114020EC036 |
:103E70008C3F19F48091160209C08D3F19F480918E |
:103E8000180204C08E3F21F480911A0280932B0205 |
:103E900080912B02882319F410922B0204C08F3FCB |
:103EA00011F480932B029091FB049B3FB0F09B3F59 |
:103EB00019F48091140204C09C3F29F480911602E9 |
:103EC000809389010CC09D3F19F480911802F8CFAE |
:103ED0009E3F29F480911A02F3CF9093890180913B |
:103EE0008901882319F41092890104C08F3F11F4CD |
:103EF000809389019B3FB0F09B3F19F4809114029D |
:103F000004C09C3F29F480911602809389010CC063 |
:103F10009D3F19F480911802F8CF9E3F29F48091BB |
:103F20001A02F3CF9093890180918901882319F4B3 |
:103F30001092890104C08F3F11F4809389019B3F47 |
:103F4000B0F09B3F19F48091140204C09C3F29F407 |
:103F500080911602809389010CC09D3F19F48091D5 |
:103F60001802F8CF9E3F29F480911A02F3CF909364 |
:103F7000890180918901882319F41092890104C074 |
:103F80008F3F11F48093890110918801612F772769 |
:103F900067FD7095872F972F0E949D2D17FF06C0F4 |
:103FA00020E030E040E853E40E94F82C27E137EBB2 |
:103FB00041ED58E30E94172E60937C0170937D01C0 |
:103FC00080937E0190937F018091ED048093290579 |
:103FD0008091EC04809318051F91089581E08093EF |
:103FE000DA0442E04093DB0483E08093DC0494E055 |
:103FF0009093DD0435E03093DE0486E08093DF04A7 |
:1040000087E08093E0041092E2048EE18093E30461 |
:104010008BEF8093E5048AE08093E60422E320930B |
:10402000E4042093E8044093E7049093E904109299 |
:10403000EA0490E19093EB048FE08093EC048AEF24 |
:104040008093ED048AE18093EE049093EF048FEA6D |
:104050008093F0048093F1048AE58093F20483E274 |
:104060008093F30484E18093F4041092F504309378 |
:10407000F60482EB8093F7041092F8041092F9048E |
:104080001092FA0484E68093FB0488E28093FC0497 |
:10409000109200052093FD0486E98093FE0430937E |
:1040A000FF04A8E0B5E0E8E6F1E08CE001900D92B5 |
:1040B0008150E1F7089581E08093DA0452E0509353 |
:1040C000DB0483E08093DC0444E04093DD0435E0CE |
:1040D0003093DE0486E08093DF0487E08093E00481 |
:1040E00028E02093E1041092E2049EE19093E3041F |
:1040F0008BEF8093E5048AE08093E60486E4809366 |
:10410000E4049093E8045093E7044093E904209377 |
:10411000EA0490E19093EB048FE08093EC048AEF43 |
:104120008093ED048AE18093EE049093EF0488E796 |
:104130008093F00496E99093F1048AE58093F20469 |
:1041400083E28093F30484E18093F4041092F504F5 |
:104150003093F60482EB8093F7041092F8041092E7 |
:10416000F9041092FA0484E68093FB0488E28093B9 |
:10417000FC041092000582E38093FD049093FE04FA |
:104180003093FF04A8E0B5E0E0E7F1E08CE00190B7 |
:104190000D928150E1F7089580912302882301F563 |
:1041A00010926602109265021092690210926B02E0 |
:1041B00080919601882311F0809365028091970188 |
:1041C000882311F08093660280919801882311F072 |
:1041D00080936B0280919901882311F0809369028A |
:1041E0008091650299279093790480937804809157 |
:1041F0006602992790937B0480937A0480916B02E6 |
:10420000992790937D0480937C048091690299277B |
:1042100090937F0480937E041092CB011092CC0186 |
:104220000E944C180895CF93DF93109220051092AE |
:104230001F05109222051092210580E090E0A0E079 |
:10424000B0E08093230590932405A0932505B093B7 |
:1042500026051092D4011092D3011092D60110922B |
:10426000D5011092D8011092D7010E94051C85E05B |
:1042700090E00E949D0BEC01CE010E94A60B8823CA |
:10428000D9F30E94051C8091E20480FF10C0809148 |
:104290000A0190910B01875B934038F480910A01E9 |
:1042A00090910B018E5E924010F40E940E1080914E |
:1042B00016059091170597FF03C0909581959F4F24 |
:1042C0009093D4018093D3018091140590911505AA |
:1042D00097FF03C0909581959F4F9093D60180934F |
:1042E000D50180912A0590912B0597FF03C09095E9 |
:1042F00081959F4F9093D8018093D70188E0EFE19B |
:10430000F5E0A5E3B1E0182E0E94272F1092EF01EF |
:104310001092F0011092F1011092F2011092F3014B |
:104320001092F4011092F5011092F6011092F7012B |
:104330001092F8011092F9011092FA011092FB010B |
:104340001092FC011092FD011092FE011092FF01EB |
:1043500010920002109201021092020210921705B0 |
:1043600010921605109215051092140510922B0547 |
:1043700010922A058091060190910701A0910801F1 |
:10438000B091090190938604809385041092C00136 |
:104390001092BF01109207021092080210920902B7 |
:1043A00010920A0280910B0290910C0290930E02DF |
:1043B00080930D020E94C02C82E390E09093A701AD |
:1043C0008093A601DF91CF910895CF93DF93109250 |
:1043D000200510921F05109222051092210580E001 |
:1043E00090E0A0E0B0E08093230590932405A09393 |
:1043F0002505B09326050E94051C85E090E00E94EB |
:104400009D0BEC01CE010E94A60B8823D9F30E94DC |
:10441000051C809127059091280597FF03C0909572 |
:1044200081959F4F60E170E00E94922ECFE1D5E030 |
:104430007093200560931F058091300590913105A0 |
:1044400097FF03C0909581959F4F60E170E00E94B7 |
:10445000922E7093220560932105609183047091E0 |
:104460008404882777FD8095982F0E949D2D609366 |
:10447000230570932405809325059093260588E0F5 |
:10448000A5E3B1E0FE01182E0E94382FDF91CF91F5 |
:1044900008951F93182F0EC080912302882361F482 |
:1044A00084E690E09093A7018093A6018AEF90E0C4 |
:1044B0000E94E00C115080F71F910895A4E0B0E035 |
:1044C000E4E6F2E20C94E22E0E94A619299AE09109 |
:1044D000DC04AE2FBB27AA0FBB1FA255BB4F0D900C |
:1044E000BC91A02D9D0128583F4F3A83298337FF67 |
:1044F00002C01A82198280911C02843608F04AC0D8 |
:1045000080910101882331F484EF91E09093A70119 |
:104510008093A6018091350290913602009731F088 |
:104520000197909336028093350204C010922302C3 |
:1045300010921202289A8091300290913102815D8E |
:10454000974028F18091F304482F55275A834983D7 |
:1045500081E080931202E091DA04FF27EE0FFF1F43 |
:10456000E255FB4F11821082E091DB04FF27EE0F32 |
:10457000FF1FE255FB4F11821082E091DD04FF27FF |
:10458000EE0FFF1FE255FB4F11821082CEC1109239 |
:104590002302CBC180911C028D3808F4C6C1109251 |
:1045A00012028091F40422E3829FC00111249093AF |
:1045B00036028093350269817A81693271056CF027 |
:1045C00080913002909131027FEF8F3F970781F108 |
:1045D0000196909331028093300280913002909145 |
:1045E0003102883C910520F089819A81889704F5F1 |
:1045F00010924B0210924C0210924D0210924E02F9 |
:1046000010924702109248021092490210924A02F8 |
:104610001092FF0110920002109201021092020209 |
:1046200010920302109204021092050210920602E8 |
:10463000E981FA81E93CF1050CF4D6C080912302AE |
:10464000882309F072C1E091DD04FF27EE0FFF1F00 |
:10465000E255FB4F808191818C3491050CF4C1C0EF |
:10466000809134028F5F80933402893C08F45DC1ED |
:1046700029980E9413211092230210923402109262 |
:104680003102109230028091DA04282F3327F90189 |
:10469000EE0FFF1FE255FB4F80819181873491051A |
:1046A0009CF4E091DB04FF27EE0FFF1FE255FB4F68 |
:1046B0000190F081E02DF7FF03C0F095E195FF4FE9 |
:1046C000E734F1050CF46CC08091DB04682F772788 |
:1046D000DB01AA0FBB1FA255BB4F8D919C91119777 |
:1046E000873491053CF0F901EE0FFF1FE255FB4FB7 |
:1046F000808191818D919C918734910564F0F901BD |
:10470000EE0FFF1FE255FB4F8081918187349105A9 |
:1047100014F042E001C041E0FB01EE0FFF1FE25543 |
:10472000FB4F80819181863491055CF4F901EE0F95 |
:10473000FF1FE255FB4F80819181873491050CF07A |
:1047400043E0FB01EE0FFF1FE255FB4F808191819B |
:104750008A5B9F4F5CF4F901EE0FFF1FE255FB4FA0 |
:1047600080819181873491050CF044E0660F771FBA |
:1047700062557B4FFB01808191818A5B9F4F5CF486 |
:10478000220F331F22553B4FF901808191818634DE |
:1047900091050CF445E0A2E0B0E0042E0E942C2F1D |
:1047A0000E94B1034AE36AED74E00E94D2030E94C2 |
:1047B000B1030E9449228091E20480FFB6C080913B |
:1047C0000A0190910B01875B934040F480910A01AC |
:1047D00090910B018E5E924008F0A7C00E940E10CF |
:1047E000A4C010923402A1C049815A8143325105BC |
:1047F0000CF09BC08091DD04482F5527FA01EE0F85 |
:10480000FF1FE255FB4F80819181855B9F4F0CF02C |
:104810006DC0809133028F5F80933302893C08F42E |
:1048200067C088EC8093330281E090E0909331027E |
:104830008093300281E08093230210924302109211 |
:10484000440210924502109246021092FF0110920B |
:1048500000021092010210920202109203021092C2 |
:10486000040210920502109206021092EF011092BB |
:10487000F0011092F1011092F2011092F7011092E2 |
:10488000F8011092F9011092FA018091DB019091E8 |
:10489000DC01A091DD01B091DE018093F3019093E2 |
:1048A000F401A093F501B093F6018091E30190919A |
:1048B000E401A091E501B091E6018093FB019093A2 |
:1048C000FC01A093FD01B093FE0110924B021092E7 |
:1048D0004C0210924D0210924E021092470210921A |
:1048E00048021092490210924A0202C0109233020A |
:1048F000440F551F42555B4FFA01808191818C34E2 |
:1049000091058CF0809132028F5F80933202893C56 |
:1049100060F01092230288EC8093320210923102F0 |
:104920001092300202C010923202809167018150D1 |
:1049300080936701809167018F3F29F08091120277 |
:10494000882309F412C10E94A11DE091DA04FF2717 |
:10495000EE0FFF1FDF01A255BB4F8D919C9160911F |
:10496000E9047727EC53FB4F208131814091EA0421 |
:104970005527FC01E69FC001E79F900DF69F900D23 |
:104980001124F901E49F9001E59F300DF49F300D53 |
:104990001124820F931F90931E0280931D02E091B9 |
:1049A000DB04FF27EE0FFF1FDF01A255BB4F8D91E8 |
:1049B0009C91EC53FB4F20813181FC01E69FC001AB |
:1049C000E79F900DF69F900D1124B901649F90010F |
:1049D000659F300D749F300D1124820F931F9093AB |
:1049E000200280931F02E091DD04FF27EE0FFF1FDE |
:1049F000E255FB4F80819181909581959F4F9093D7 |
:104A000022028093210210918501612F772767FD93 |
:104A10007095872F972F0E949D2D17FF06C020E0CD |
:104A200030E040E853E40E94F82C20E030E040E21F |
:104A300051E40E94F82C20E030E040E85BE30E9463 |
:104A4000172E5B016C0160932C0570932D058093EC |
:104A50002E0590932F0510918601612F772767FD12 |
:104A60007095872F972F0E949D2D17FF06C020E07D |
:104A700030E040E853E40E94F82C20E030EE4BE2B6 |
:104A800057E40E943A2D60931B0570931C05809398 |
:104A90001D0590931E058091E20482FF0CC080E00A |
:104AA00090E0A0E0B0E080931B0590931C05A093DC |
:104AB0001D05B0931E0520E030E040E050E0C60147 |
:104AC000B5010E94A72D882364F480E090E0A0E067 |
:104AD000B0E080932C0590932D05A0932E05B09304 |
:104AE0002F0520E030E040E050E060911B05709120 |
:104AF0001C0580911D0590911E050E94A72D8823FD |
:104B000064F480E090E0A0E0B0E080931B05909317 |
:104B10001C05A0931D05B0931E05809112028823E9 |
:104B200021F1109222021092210210921E02109284 |
:104B30001D021092200210921F028DEC9CECACEC36 |
:104B4000BDE380932C0590932D05A0932E05B09383 |
:104B50002F058AE097EDA3EABBE380931B059093B2 |
:104B60001C05A0931D05B0931E058091C101909175 |
:104B7000C2018D54914008F490C02091DF01309122 |
:104B8000E0014091E1015091E2018091DB019091BF |
:104B9000DC01A091DD01B091DE01B901681B790B48 |
:104BA00070933A02609339022091E7013091E80155 |
:104BB0004091E9015091EA018091E3019091E40173 |
:104BC000A091E501B091E601281B390B3093380222 |
:104BD000209337021092C2011092C101673A710509 |
:104BE00034F08091D3019091D401019608C06A55A8 |
:104BF0007F4F4CF48091D3019091D4010197909311 |
:104C0000D4018093D301273A310534F08091D50146 |
:104C10009091D601019608C02A553F4F4CF48091DF |
:104C2000D5019091D60101979093D6018093D5013B |
:104C300010927A008091DB019091DC01A091DD015E |
:104C4000B091DE018093F3019093F401A093F501FC |
:104C5000B093F6018091E3019091E401A091E50108 |
:104C6000B091E6018093FB019093FC01A093FD01BC |
:104C7000B093FE018091EB019091EC01A091ED01C8 |
:104C8000B091EE018093030290930402A093050279 |
:104C9000B09306028FEC80937A006091DB017091F3 |
:104CA000DC018091DD019091DE01A090EE04BB2437 |
:104CB000CC24DD24E0902705F0902805A60195017D |
:104CC0000E94C72E0027F7FC0095102F2E193F09D0 |
:104CD000400B510BCA01B90120E130E040E050E047 |
:104CE0000E94C72E39014A0120933F0230934002AF |
:104CF00040934102509342026091E3017091E401BC |
:104D00008091E5019091E601E0903005F090310549 |
:104D1000A60195010E94C72E0027F7FC0095102FD1 |
:104D20002E193F09400B510BCA01B90120E130E0B7 |
:104D300040E050E00E94C72E20933B0230933C029B |
:104D400040933D0250933E02E5EF6E16E1E07E0691 |
:104D5000E0E08E06E0E09E062CF084EF91E0A0E01B |
:104D6000B0E00DC0FCE06F16FEEF7F06FFEF8F0690 |
:104D7000FFEF9F0664F48CE09EEFAFEFBFEF8093F0 |
:104D80003F0290934002A0934102B0934202253F1C |
:104D900061E0360760E0460760E056072CF084EFDC |
:104DA00091E0A0E0B0E009C02C503E4F4F4F5F4F64 |
:104DB00064F48CE09EEFAFEFBFEF80933B029093E3 |
:104DC0003C02A0933D02B0933E0210927A00809183 |
:104DD000EF019091F001A091F101B091F2012091C9 |
:104DE0003F02309140024091410250914202821BA9 |
:104DF000930BA40BB50B8093EF019093F001A0935C |
:104E0000F101B093F2018091F7019091F801A09126 |
:104E1000F901B091FA0120913B0230913C0240919E |
:104E20003D0250913E02821B930BA40BB50B809365 |
:104E3000F7019093F801A093F901B093FA018091E2 |
:104E40002102909122025C01CC24B7FCC094DC2C9E |
:104E5000A0924302B0924402C0924502D092460210 |
:104E600097FF03C0909581959F4F84973CF0809168 |
:104E7000E20484FD03C081E080938A016090FF0119 |
:104E8000709000028090010290900202C501B7FE6E |
:104E900003C0909581959F4F7C010027F7FC0095FA |
:104EA000102F2091EB04332744275527C601B50165 |
:104EB0000E945F2E9B01AC01C801B7010E945F2ECA |
:104EC00020E031E040E050E00E94C72E442737FD4B |
:104ED0004095542F621A730A840A950A6092FF0162 |
:104EE0007092000280920102909202028091FF0172 |
:104EF00090910002A0910102B09102028153954766 |
:104F0000A040B04064F080E395E7A0E0B0E080937B |
:104F1000FF0190930002A0930102B09302028091DE |
:104F2000FF0190910002A0910102B0910202805D08 |
:104F30009A48AF4FBF4F64F480ED9AE8AFEFBFEFF0 |
:104F40008093FF0190930002A0930102B0930202AC |
:104F50008FEC80937A008091E20483FFAEC0809151 |
:104F600011028150809311028F3FD9F40E94C41422 |
:104F700090930C0280930B0220910D0230910E024F |
:104F8000821B930B845E9D4F68E671E00E94922E17 |
:104F9000845B90409093100280930F0282E3809391 |
:104FA00011026091DB017091DC018091DD01909133 |
:104FB000DE0120E034E040E050E00E94C72E89018D |
:104FC00037FF03C0109501951F4F6091E301709169 |
:104FD000E4018091E5019091E60120E034E040E0B9 |
:104FE00050E00E94C72EB90137FF03C0709561954C |
:104FF0007F4F601771070CF4B8016332710594F4A8 |
:1050000080918A01882371F080912C02882351F4C9 |
:1050100080910B0290910C0290930E0280930D02EE |
:1050200010928A01209184013327629FC001639FFF |
:10503000900D729F900D112460E470E00E94922EFA |
:10504000A901461B570B14161506A4F580912C02D6 |
:10505000882371F510927A000091FF0110910002EF |
:10506000209101023091020280910F029091100272 |
:10507000BC01469FC001479F900D569F900D112483 |
:1050800060E270E00E94922E882777FD8095982F2D |
:10509000060F171F281F391F0093FF0110930002EE |
:1050A00020930102309302028FEC80937A0005C0B6 |
:1050B000815001C08AEF80932C0280915F048F5F42 |
:1050C00080935F0480912D02815080932D028F3F49 |
:1050D00009F068C081E380932D026091DB0170913B |
:1050E000DC018091DD019091DE01E090EE04FF246F |
:1050F00000271127A80197010E94C72E3093610451 |
:10510000209360046091E3017091E4018091E501D6 |
:105110009091E601A80197010E94C72E3093630485 |
:10512000209362048091270590912805909365044F |
:1051300080936404809130059091310590936704C9 |
:105140008093660480912A0590912B0590936904C1 |
:1051500080936804809124029091250290936B04BF |
:1051600080936A046091070270910802809109029D |
:1051700090910A0220E032E040E050E00E94C72E09 |
:1051800030936D0420936C0489819A8190936F040D |
:1051900080936E0480910B0290910C0290937104A5 |
:1051A000809370046091DB017091DC018091DD01DE |
:1051B0009091DE0120901B0530901C0540901D054C |
:1051C00050901E05E0901605F090170560902C0594 |
:1051D00070902D0580902E0590902F050E949D2D9A |
:1051E000A20191010E94172E5B016C010027F7FCC0 |
:1051F0000095102FC801B7010E949D2DA4019301B5 |
:105200000E94172E9B01AC01C601B5010E94F82C2B |
:105210000E94802D70931705609316056091E3013D |
:105220007091E4018091E5019091E601E090140510 |
:10523000F09015050E949D2DA20191010E94172E4C |
:105240005B016C010027F7FC0095102FC801B70126 |
:105250000E949D2DA40193010E94172E9B01AC0179 |
:10526000C601B5010E94F82C0E94802D709315058F |
:105270006093140560912A0570912B05A090EB01B5 |
:10528000B090EC01C090ED01D090EE01882777FD41 |
:105290008095982F0E949D2D7B018C0120E030E0AD |
:1052A00040E05FE3C401B3010E94172E9B01AC01F3 |
:1052B000C801B7010E94172E7B018C01C601B50100 |
:1052C0000E949D2DA20191010E94172E9B01AC010D |
:1052D000C801B7010E94F82C0E94802D70932B0505 |
:1052E00060932A058091160590911705815098408A |
:1052F00034F080E098E09093170580931605809134 |
:105300001605909117058050984F34F480E098EF7F |
:1053100090931705809316058091140590911505BB |
:105320008150984034F080E098E090931505809388 |
:10533000140580911405909115058050984F34F410 |
:1053400080E098EF909315058093140580912A05CD |
:1053500090912B058150984034F080E098E0909334 |
:105360002B0580932A0580912A0590912B0580506A |
:10537000984F34F480E098EF90932B0580932A05A2 |
:105380008091E204992780FFCDC02091810181FFA7 |
:105390000EC02233B0F480912402909125024497EC |
:1053A0009093270280932602109213020DC08091E1 |
:1053B000E704289FC001112444979093270280930B |
:1053C000260281E08093130280911202882321F04B |
:1053D0001092270210922602209124023091250279 |
:1053E0004091260250912702421753070CF09AC0B1 |
:1053F00080911302882309F495C0241B350B8091FA |
:1054000082019927BC01269FC001279F900D369FDE |
:10541000900D112460E170E00E94922E09811A81A2 |
:10542000061B170B2091BF013091C00180918001B4 |
:105430009927FC012E9FC0012F9F900D3E9F900D3C |
:10544000112468E070E00E94922E061B170B6091F9 |
:105450000702709108028091090290910A0220E0EF |
:1054600032E040E050E00E94C72ECA01B90120910D |
:1054700083013327442755270E945F2E20E230E026 |
:1054800040E050E00E94C72EFFEF2E3C3F0714F48F |
:105490002EEC3FEF80912E0290912F02AC0164E040 |
:1054A000440F551F6A95E1F7481B590B233331050B |
:1054B00014F022E330E0021B130BCA01800F911F8E |
:1054C00060E170E00E94922E70932F0260932E0292 |
:1054D0008091E3049927681779078CF429813A8130 |
:1054E000281739072CF090932F0280932E0207C0C3 |
:1054F00049815A8150932F0240932E020DC0809112 |
:105500002E0290912F0269817A816817790724F41D |
:1055100070932F0260932E0280912E0290912F02A1 |
:105520009A838983C0902A05D0902B0580914302ED |
:1055300090914402C81AD90A95E6C916D10424F0FC |
:1055400014E6C12ED12C09C0ECE9CE16EFEFDE0631 |
:1055500024F4BCE9CB2EBFEFDB2E409078015090B5 |
:10556000790160907A0170907B01609116057091CD |
:10557000170520911D0230911E0240914F0250915B |
:105580005002241B350B621B730B882777FD809517 |
:10559000982F0E949D2D9B01AC01C301B2010E9476 |
:1055A000172E0E94802D709368026093670280918D |
:1055B0006702909168028C01222717FD2095322FF7 |
:1055C00080914B0290914C02A0914D02B0914E02FD |
:1055D000080F191F2A1F3B1F00934B0210934C0208 |
:1055E00020934D0230934E02101611061206130638 |
:1055F000ACF4C80117FF03C0909581959F4F60E000 |
:1056000071E00E94922E6F5F7F4F882777FD809513 |
:10561000982F061B170B280B390B14C0C80117FF56 |
:1056200003C0909581959F4F60E071E00E94922E9B |
:105630006F5F7F4F882777FD8095982F060F171F84 |
:10564000281F391F00934B0210934C0220934D02E8 |
:1056500030934E0280914B0290914C02A0914D02EA |
:10566000B0914E028138FEE39F07F0E0AF07F0E013 |
:10567000BF072CF080E89EE3A0E0B0E009C08058AE |
:10568000914CAF4FBF4F64F480E891ECAFEFBFEFA8 |
:1056900080934B0290934C02A0934D02B0934E0224 |
:1056A000609167027091680280907C0190907D010A |
:1056B000A0907E01B0907F01882777FD8095982F7C |
:1056C0000E949D2D7B018C0160914B0270914C02D8 |
:1056D00080914D0290914E020E949D2D9B01AC0144 |
:1056E000C501B4010E94172E9B01AC01C801B7018E |
:1056F0000E94F82C0E94802D9601260F371F4981A9 |
:105700005A81240F351F22244A30510514F4A1E098 |
:105710002A2E37FD02C0222019F040E050E008C0D8 |
:1057200080912905482F5527241735070CF4A90126 |
:1057300080911805E82FFF27FC83EB839F01E41776 |
:10574000F5070CF49A012093650229813A81261B02 |
:10575000370BB9016C0D7D1D77FD02C0222019F0B9 |
:1057600080E090E007C080912905992768177907A4 |
:105770000CF4CB012B813C81281739070CF49C01D8 |
:1057800020936602609114057091150520911F0207 |
:10579000309120024091510250915202241B350B4E |
:1057A000621B730B882777FD8095982F0E949D2D93 |
:1057B0009B01AC01C301B2010E94172E0E94802DF3 |
:1057C000709364026093630280916302909164021B |
:1057D0008C01222717FD2095322F8091470290914E |
:1057E0004802A0914902B0914A02080F191F2A1FCE |
:1057F0003B1F0093470210934802209349023093C5 |
:105800004A021016110612061306ACF4C80117FF5F |
:1058100003C0909581959F4F60E071E00E94922EA9 |
:105820006F5F7F4F882777FD8095982F061B170B9A |
:10583000280B390B14C0C80117FF03C09095819540 |
:105840009F4F60E071E00E94922E6F5F7F4F88272C |
:1058500077FD8095982F060F171F281F391F00937B |
:105860004702109348022093490230934A028091E4 |
:10587000470290914802A0914902B0914A028138B2 |
:105880003EE3930730E0A30730E0B3072CF080E855 |
:105890009EE3A0E0B0E009C08058914CAF4FBF4FED |
:1058A00064F480E891ECAFEFBFEF809347029093F0 |
:1058B0004802A0934902B0934A026091630270913A |
:1058C0006402882777FD8095982F0E949D2D7B018B |
:1058D0008C01609147027091480280914902909139 |
:1058E0004A020E949D2D9B01AC01C501B4010E949A |
:1058F000172E9B01AC01C801B7010E94F82C0E9431 |
:10590000802D29813A81260F371F2C193D0937FD3B |
:1059100002C0222019F040E050E008C08091290523 |
:10592000482F5527241735070CF4A9012B813C81FA |
:10593000241735070CF49A0120936B0289819A8110 |
:10594000861B970BBC016C197D0977FD02C02220D4 |
:1059500019F020E030E008C080912905282F332776 |
:10596000621773070CF49B018B819C81821793074C |
:105970000CF4C90180936902E2E1CC5F0C94FE2E25 |
:105980008091530290915402A0915502B091560219 |
:1059900080935B0290935C02A0935D02B0935E02E1 |
:1059A0008091570290915802A0915902B0915A02E9 |
:1059B00080935F0290936002A0936102B0936202B1 |
:1059C00008951092500210924F02109252021092BB |
:1059D00051020895FC014150504030F001900616EC |
:1059E000D1F73197CF010895882799270895505806 |
:1059F000192EEFD001D0D2C0BA17620773078407FF |
:105A00009507B1F188F40EF410940B2EBA2FA02D47 |
:105A1000062E622F202D072E732F302D082E842F57 |
:105A2000402D092E952F502DFF275523B9F0591BD6 |
:105A300049F0573E98F0469537952795A795F04041 |
:105A40005395C9F776F0BA0F621F731F841F30F4A5 |
:105A5000879577956795B795F040939517FA0F2E30 |
:105A60000895BF1BBB27BA0B620B730B840BF6CFD9 |
:105A7000DEF6DBC0AED001D091C0552359F099239A |
:105A800069F09F575F57951B33F442F4903811F437 |
:105A9000915805C09BC091589F3F09F4C6C0BB27D1 |
:105AA000112462177307840730F4660F771F881F6D |
:105AB000BB1F915098F311D00F920FD00F920DD0C1 |
:105AC000A0E82617370748071B0609F0A048BA2F99 |
:105AD000602D7F918F9100240895A0E80024621723 |
:105AE00073078407B10528F0621B730B840BB1099F |
:105AF0000A2A660F771F881FBB1FA69581F7089596 |
:105B000097FB73D09F3738F0FEE9F91B982F872F4A |
:105B1000762F6B2F05C086C09695879577956795EC |
:105B2000F150D0F73EF490958095709561957F4F38 |
:105B30008F4F9F4F0895E89403C097FB0EF4F3DF57 |
:105B4000B62F672F782F892F9EE9002427C00ED00B |
:105B50005EF004C00BD026F001C008D019F020F48C |
:105B60008FEF089580E0089581E0089597FB092E56 |
:105B7000052600F8689430D0E89407FC07C0621747 |
:105B800073078407950721F008F40094079498940C |
:105B900008959A95BB0F661F771F881F11249923BC |
:105BA000A1F08823B2F79F3F59F0BB0F48F421F4CE |
:105BB000002011F460FF04C06F5F7F4F8F4F9F4F35 |
:105BC000881F9795879597F908952CC09FEF80ECD3 |
:105BD0000895052E092607FA440F551F5F3F79F0F7 |
:105BE000AA27A51708F051E04795880F991F9F3FF6 |
:105BF00031F0BB27B91708F091E0879508959F9180 |
:105C00009F911124E3CF97FB880F991F9F3F31F09D |
:105C1000BB27B91708F091E0879508959F919F9150 |
:105C20001124D4CF66277727882799270895D1DFB5 |
:105C300001D0B4CF992339F0552329F09F575F57EE |
:105C4000950F13F49AF1F1CF91589F3FE1F3629FC2 |
:105C5000A12D0F92BB27639FA00DB11DEE27729F50 |
:105C6000A00DB11DEE1FAF93AA27649FB00DE11DDB |
:105C7000739FB00DE11DAA1F6627829FB00DE11D25 |
:105C8000A61F5527749FE00DA11D551F839FE00D92 |
:105C9000A11D561F849FA00D511D852F7A2F6E2F99 |
:105CA0001F900F9088231AF4939539F48FCF000C2E |
:105CB000111CBB1F661F771F881F01280895629F54 |
:105CC000D001739FF001829FE00DF11D649FE00DF4 |
:105CD000F11D929FF00D839FF00D749FF00D659F55 |
:105CE000F00D9927729FB00DE11DF91F639FB00D54 |
:105CF000E11DF91FBD01CF0111240895AA1BBB1B93 |
:105D000051E107C0AA1FBB1FA617B70710F0A61BBB |
:105D1000B70B881F991F5A95A9F780959095BC01DC |
:105D2000CD01089597FB092E07260AD077FD04D0F0 |
:105D3000E5DF06D000201AF4709561957F4F089535 |
:105D4000F6F7909581959F4F0895A1E21A2EAA1B10 |
:105D5000BB1BFD010DC0AA1FBB1FEE1FFF1FA2171B |
:105D6000B307E407F50720F0A21BB30BE40BF50B18 |
:105D7000661F771F881F991F1A9469F760957095A1 |
:105D8000809590959B01AC01BD01CF01089597FBD3 |
:105D9000092E05260ED057FD04D0D7DF0AD0001CEF |
:105DA00038F450954095309521953F4F4F4F5F4FB8 |
:105DB0000895F6F790958095709561957F4F8F4F78 |
:105DC0009F4F08952F923F924F925F926F927F92D2 |
:105DD0008F929F92AF92BF92CF92DF92EF92FF92FB |
:105DE0000F931F93CF93DF93CDB7DEB7CA1BDB0BA7 |
:105DF0000FB6F894DEBF0FBECDBF09942A8839884C |
:105E000048885F846E847D848C849B84AA84B98452 |
:105E1000C884DF80EE80FD800C811B81AA81B9815E |
:105E2000CE0FD11D0FB6F894DEBF0FBECDBFED0172 |
:105E30000895EE0FFF1F0590F491E02D0994F99954 |
:105E4000FECFB2BDA1BDF89A119600B40895F7DF58 |
:105E500001921A94E1F70895F999FECFB2BDA1BD60 |
:105E600000BC11960FB6F894FA9AF99A0FBE0895ED |
:0C5E70000190F2DF1A94E1F70895FFCFD3 |
:105E7C0001640A016400007D0000FF0301020304B9 |
:105E8C0005060708090A48616C6C6F2057656C742D |
:105E9C0000000000000000000000000000000000F6 |
:105EAC0000000000000000000000000000000000E6 |
:105EBC0000000000000000000000000000000000D6 |
:105ECC0000000000000000000000000000000000C6 |
:105EDC000000000000000C014B616D657261000058 |
:105EEC004E6F726D616C00000000803F17B7D138A7 |
:0C5EFC0030FB103A403296020A640100AC |
:00000001FF |
/branches/v0.60_MicroMag3_Nick666/GPS.c |
---|
0,0 → 1,26 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
signed int GPS_Nick = 0; |
signed int GPS_Roll = 0; |
long GpsAktuell_X = 0; |
long GpsAktuell_Y = 0; |
long GpsZiel_X = 0; |
long GpsZiel_Y = 0; |
void GPS_Neutral(void) |
{ |
GpsZiel_X = GpsAktuell_X; |
GpsZiel_Y = GpsAktuell_Y; |
} |
void GPS_BerechneZielrichtung(void) |
{ |
GPS_Nick = 0; |
GPS_Roll = 0; |
} |
/branches/v0.60_MicroMag3_Nick666/README.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/branches/v0.60_MicroMag3_Nick666/Settings.h |
---|
--- _Settings.h (nonexistent) |
+++ _Settings.h (revision 512) |
@@ -0,0 +1,50 @@ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Testmodi |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define MOTOR_OFF 0 |
+#define MOTOR_TEST 0 |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Abstimmung |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define ACC_AMPLIFY 16 |
+#define FAKTOR_P 1 |
+#define FAKTOR_I 0.0001 |
+ |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Debug-Interface |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define SIO_DEBUG 1 // Soll der Debugger aktiviert sein? |
+#define MIN_DEBUG_INTERVALL 250 // in diesem Intervall werden Degugdaten ohne Aufforderung gesendet |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Sender |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ #define K_NICK 0 |
+ #define K_ROLL 1 |
+ #define K_GAS 2 |
+ #define K_GIER 3 |
+ #define K_POTI1 4 |
+ #define K_POTI2 5 |
+ #define K_POTI3 6 |
+ #define K_POTI4 7 |
+// +++++++++++++++++++++++++++++++ |
+// + Getestete Settings: |
+// +++++++++++++++++++++++++++++++ |
+// Setting: Kamera |
+// Stick_P:3 |
+// Stick_D:0 |
+// Gyro_P: 175 |
+// Gyro_I: 175 |
+// Ki_Anteil: 10 |
+// +++++++++++++++++++++++++++++++ |
+// + Getestete Settings: |
+// +++++++++++++++++++++++++++++++ |
+// Setting: Normal |
+// Stick_P:2 |
+// Stick_D:8 |
+// Gyro_P: 80 |
+// Gyro_I: 150 |
+// Ki_Anteil: 5 |
+ |
/branches/v0.60_MicroMag3_Nick666/analog.c |
---|
0,0 → 1,155 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az, UBat = 100; |
volatile int AccumulateNick = 0, AccumulateRoll = 0, AccumulateGier = 0; |
volatile int accumulate_AccRoll = 0,accumulate_AccNick = 0,accumulate_AccHoch = 0; |
volatile char MessanzahlNick = 0, MessanzahlRoll = 0, MessanzahlGier = 0; |
volatile char messanzahl_AccNick = 0, messanzahl_AccRoll = 0, messanzahl_AccHoch = 0; |
volatile long Luftdruck = 32000; |
volatile int StartLuftdruck; |
volatile unsigned int MessLuftdruck = 1023; |
unsigned char DruckOffsetSetting; |
volatile int HoeheD = 0; |
volatile char messanzahl_Druck; |
volatile int tmpLuftdruck; |
volatile unsigned int ZaehlMessungen = 0; |
//####################################################################################### |
// |
void ADC_Init(void) |
//####################################################################################### |
{ |
ADMUX = 0;//Referenz ist extern |
ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE); |
//Free Running Mode, Division Factor 128, Interrupt on |
} |
//####################################################################################### |
// |
void SucheLuftruckOffset(void) |
//####################################################################################### |
{ |
unsigned int off; |
off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]); |
if(off > 20) off -= 10; |
OCR0A = off; |
Delay_ms(100); |
if(MessLuftdruck < 850) off = 0; |
for(; off < 250;off++) |
{ |
OCR0A = off; |
Delay_ms(50); |
printf("."); |
if(MessLuftdruck < 900) break; |
} |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off); |
DruckOffsetSetting = off; |
Delay_ms(200); |
} |
//####################################################################################### |
// |
SIGNAL(SIG_ADC) |
//####################################################################################### |
{ |
static unsigned char kanal=0,state = 0; |
signed int wert; |
ANALOG_OFF; |
switch(state++) |
{ |
case 0: |
wert = (signed int) AdNeutralGier - ADC; |
AccumulateGier += wert; // |
MessanzahlGier++; |
Mess_Integral_Gier += wert;// / 16; |
Mess_Integral_Gier2 += wert; |
kanal = 1; |
ZaehlMessungen++; |
break; |
case 1: |
wert = (signed int) ADC - AdNeutralRoll; |
Mess_IntegralRoll += wert; |
Mess_IntegralRoll2 += wert; |
if(ADC < 10) wert = -700; |
if(ADC > 1000) wert = +700; |
AccumulateRoll += wert; |
MessanzahlRoll++; |
kanal = 2; |
break; |
case 2: |
wert = (signed int) ADC - AdNeutralNick; |
Mess_IntegralNick += wert; |
Mess_IntegralNick2 += wert; |
if(ADC < 10) wert = -700; |
if(ADC > 1000) wert = +700; |
AccumulateNick += wert; |
MessanzahlNick++; |
kanal = 4; |
break; |
case 3: |
UBat = (3 * UBat + ADC / 3) / 4;//(UBat + ((ADC * 39) / 256) + 19) / 2; |
kanal = 6; |
break; |
case 4: |
Aktuell_ay = acc_neutral.Y - ADC; |
accumulate_AccRoll += Aktuell_ay; |
messanzahl_AccRoll++; |
kanal = 7; |
break; |
case 5: |
Aktuell_ax = ADC - acc_neutral.X; |
accumulate_AccNick += Aktuell_ax; |
messanzahl_AccNick++; |
kanal = 5; |
state = 6; |
break; |
case 6: |
accumulate_AccHoch = (signed int) ADC - acc_neutral.Z; |
accumulate_AccHoch += abs(Aktuell_ay) / 4 + abs(Aktuell_ax) / 4; |
if(accumulate_AccHoch > 1) |
{ |
if(acc_neutral.Z < 800) acc_neutral.Z+= 0.02; |
} |
else if(accumulate_AccHoch < -1) |
{ |
if(acc_neutral.Z > 600) acc_neutral.Z-= 0.02; |
} |
messanzahl_AccHoch = 1; |
Aktuell_az = ADC; |
Mess_Integral_Hoch += accumulate_AccHoch; // Integrieren |
Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämpfen |
kanal = 3; |
state = 7; |
break; |
case 7: |
tmpLuftdruck += ADC; |
if(++messanzahl_Druck >= 5) |
{ |
MessLuftdruck = ADC; |
messanzahl_Druck = 0; |
HoeheD = (int)(StartLuftdruck - tmpLuftdruck - HoehenWert); // D-Anteil = neuerWert - AlterWert |
Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4; |
HoehenWert = StartLuftdruck - Luftdruck; |
tmpLuftdruck = 0; |
} |
kanal = 0; |
state = 0; |
break; |
default: |
kanal = 0; |
state = 0; |
break; |
} |
ADMUX = kanal; |
ANALOG_ON; |
} |
/branches/v0.60_MicroMag3_Nick666/analog.h |
---|
0,0 → 1,23 |
/*####################################################################################### |
#######################################################################################*/ |
extern volatile int UBat; |
extern volatile int AccumulateNick, AccumulateRoll, AccumulateGier,accumulate_AccRoll,accumulate_AccNick,accumulate_AccHoch; |
extern volatile char MessanzahlNick, MessanzahlRoll, MessanzahlGier,messanzahl_AccNick, messanzahl_AccRoll,messanzahl_AccHoch; |
extern volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az; |
extern volatile long Luftdruck; |
extern volatile char messanzahl_Druck; |
extern volatile unsigned int ZaehlMessungen; |
extern unsigned char DruckOffsetSetting; |
extern volatile int HoeheD; |
extern volatile unsigned int MessLuftdruck; |
extern volatile int StartLuftdruck; |
extern unsigned int ReadADC(unsigned char adc_input); |
extern void ADC_Init(void); |
extern void SucheLuftruckOffset(void); |
#define ANALOG_OFF ADCSRA=0 |
#define ANALOG_ON ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE) |
/branches/v0.60_MicroMag3_Nick666/compass.c |
---|
0,0 → 1,242 |
/* |
Copyright 2007, Niklas Nold |
This program (files compass.c and compass.h) is free software; you can redistribute it and/or modify |
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; |
either version 3 of the License, or (at your option) any later version. |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de |
*/ |
#include "main.h" |
struct MM3_calib_struct ee_calib EEMEM; // Reservierung im EEPROM |
struct MM3_working_struct MM3; |
struct MM3_calib_struct MM3_calib; |
//############################################################################ |
// Initialisierung |
void init_MM3(void) |
//############################################################################ |
{ |
SPCR = (1<<SPIE)|(1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Interrupt an, Master, 156 kHz Oszillator |
//SPSR = (1<<SPI2X); |
DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang |
PORTD &= ~(1<<PD3); // J5 auf Low |
MM3.AXIS = MM3_X; |
MM3.STATE = MM3_RESET; |
// Kalibrierung aus dem EEprom lesen |
eeprom_read_block(&MM3_calib,&ee_calib,sizeof(struct MM3_calib_struct)); |
} |
//############################################################################ |
// Wird in der SIGNAL (SIG_OVERFLOW0) aufgerufen |
void timer0_MM3(void) |
//############################################################################ |
{ |
switch (MM3.STATE) |
{ |
case MM3_RESET: |
PORTB |= (1<<PB2); // J8 auf High, MM3 Reset |
MM3.STATE = MM3_START_TRANSFER; |
return; |
case MM3_START_TRANSFER: |
PORTB &= ~(1<<PB2); // J8 auf Low (war ~125 µs auf High) |
if (MM3.AXIS == MM3_X) SPDR = 0x31; // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus |
else if (MM3.AXIS == MM3_Y) SPDR = 0x32; // Micromag Period Select ist auf 256 (0x30) |
else SPDR = 0x33; //if (MM3.AXIS == MM3_Z) // 1: x-Achse, 2: Y-Achse, 3: Z-Achse |
MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.STATE = MM3_WAIT_DRDY; |
return; |
case MM3_WAIT_DRDY: |
if (CheckDelay(MM3.DRDY)) {SPDR = 0x00;MM3.STATE = MM3_DRDY;} // Irgendwas ins SPDR, damit Übertragung ausgelöst wird, wenn Wartezeit vorbei |
return; // Jetzt gehts weiter in SIGNAL (SIG_SPI) |
} |
} |
//############################################################################ |
// SPI byte ready |
SIGNAL (SIG_SPI) |
//############################################################################ |
{ |
static char tmp; |
int wert; |
switch (MM3.STATE) |
{ |
case MM3_DRDY: // 1. Byte ist da, zwischenspeichern |
tmp = SPDR; |
SPDR = 0x00; // Übertragung von 2. Byte auslösen |
MM3.STATE = MM3_BYTE2; |
return; |
case MM3_BYTE2: // 2. Byte der entsprechenden Achse ist da |
wert = tmp; |
wert <<= 8; // 1. Byte an MSB-Stelle rücken |
wert |= SPDR; // 2. Byte dranpappen |
if(abs(wert) < Max_Axis_Value) // Spikes filtern. Zuweisung nur, wenn Max-Wert nicht überschritten |
switch (MM3.AXIS) |
{ |
case MM3_X: |
MM3.x_axis = wert; |
MM3.AXIS = MM3_Y; |
break; |
case MM3_Y: |
MM3.y_axis = wert; |
MM3.AXIS = MM3_Z; |
break; |
default: //case MM3_Z: |
MM3.z_axis = wert; |
MM3.AXIS = MM3_X; |
} |
MM3.STATE = MM3_RESET; |
} |
} |
//############################################################################ |
// Kompass kalibrieren |
void calib_MM3(void) |
//############################################################################ |
{ |
signed int x_min=0,x_max=0,y_min=0,y_max=0,z_min=0,z_max=0; |
uint8_t measurement=50,beeper=0; |
unsigned int timer; |
GRN_ON; |
ROT_OFF; |
while (measurement) |
{ |
//H_earth = MM3.x_axis*MM3.x_axis + MM3.y_axis*MM3.y_axis + MM3.z_axis*MM3.z_axis; |
if (MM3.x_axis > x_max) x_max = MM3.x_axis; |
else if (MM3.x_axis < x_min) x_min = MM3.x_axis; |
if (MM3.y_axis > y_max) y_max = MM3.y_axis; |
else if (MM3.y_axis < y_min) y_min = MM3.y_axis; |
if (MM3.z_axis > z_max) z_max = MM3.z_axis; |
else if (MM3.z_axis < z_min) z_min = MM3.z_axis; |
if (!beeper) |
{ |
ROT_FLASH; |
GRN_FLASH; |
beeptime = 50; |
beeper = 50; |
} |
beeper--; |
// Schleife mit 100 Hz |
timer = SetDelay(10); |
while(!CheckDelay(timer)); |
// Wenn Gas zurück genommen wird, Kalibrierung mit 1/2 Sekunde Verzögerung beenden |
if (PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < 100) measurement--; |
} |
// Wertebereich der Achsen |
MM3_calib.X_range = (x_max - x_min); |
MM3_calib.Y_range = (y_max - y_min); |
MM3_calib.Z_range = (z_max - z_min); |
// Offset der Achsen |
MM3_calib.X_off = (x_max + x_min) / 2; |
MM3_calib.Y_off = (y_max + y_min) / 2; |
MM3_calib.Z_off = (z_max + z_min) / 2; |
// und im EEProm abspeichern |
eeprom_write_block(&MM3_calib,&ee_calib,sizeof(struct MM3_calib_struct)); |
} |
//############################################################################ |
// Neigungskompensierung und Berechnung der Ausrichtung |
signed int heading_MM3(void) |
//############################################################################ |
{ |
float sin_nick, cos_nick, sin_roll, cos_roll; |
float x_corr, y_corr; |
signed int x_axis,y_axis,z_axis,nicktilt,rolltilt,heading; |
unsigned int div_faktor; |
div_faktor = (uint16_t)EE_Parameter.UserParam1 * 8; |
// Berechung von sinus und cosinus |
nicktilt = (IntegralNick/div_faktor); |
sin_nick = sin_f(nicktilt); |
cos_nick = cos_f(nicktilt); |
rolltilt = (IntegralRoll/div_faktor); |
sin_roll = sin_f(rolltilt); |
cos_roll = cos_f(rolltilt); |
// Offset |
x_axis = (MM3.x_axis - MM3_calib.X_off); |
y_axis = (MM3.y_axis - MM3_calib.Y_off); |
z_axis = (MM3.z_axis - MM3_calib.Z_off); |
// Normierung Wertebereich |
if ((MM3_calib.X_range > MM3_calib.Y_range) && (MM3_calib.X_range > MM3_calib.Z_range)) |
{ |
y_axis = ((long)y_axis * MM3_calib.X_range) / MM3_calib.Y_range; |
z_axis = ((long)z_axis * MM3_calib.X_range) / MM3_calib.Z_range; |
} |
else if ((MM3_calib.Y_range > MM3_calib.X_range) && (MM3_calib.Y_range > MM3_calib.Z_range)) |
{ |
x_axis = ((long)x_axis * MM3_calib.Y_range) / MM3_calib.X_range; |
z_axis = ((long)z_axis * MM3_calib.Y_range) / MM3_calib.Z_range; |
} |
else //if ((MM3_calib.Z_range > MM3_calib.X_range) && (MM3_calib.Z_range > MM3_calib.Y_range)) |
{ |
x_axis = ((long)x_axis * MM3_calib.Z_range) / MM3_calib.X_range; |
y_axis = ((long)y_axis * MM3_calib.Z_range) / MM3_calib.Y_range; |
} |
DebugOut.Analog[9] = x_axis; |
DebugOut.Analog[10] = y_axis; |
DebugOut.Analog[11] = z_axis; |
// Neigungskompensation |
x_corr = x_axis * cos_nick; |
x_corr += y_axis * sin_roll * sin_nick; |
x_corr -= z_axis * cos_roll * sin_nick; |
y_corr = y_axis * cos_roll; |
y_corr += z_axis * sin_roll; |
// Winkelberechnung |
heading = atan2_i(x_corr, y_corr); |
if (heading < 0) heading = -heading; |
else heading = 360 - heading; |
/* |
if (!x_corr && y_corr <0) return (90); |
if (!x_corr && y_corr >0) return (270); |
heading = atan(y_corr/x_corr)*57.29578; |
if (x_corr < 0) heading = 180-heading; |
if (x_corr > 0 && y_corr < 0) heading = -heading; |
if (x_corr > 0 && y_corr > 0) heading = 360 - heading; |
*/ |
return (heading); |
} |
/branches/v0.60_MicroMag3_Nick666/compass.h |
---|
0,0 → 1,44 |
struct MM3_working_struct |
{ |
uint8_t STATE; |
unsigned int DRDY; |
uint8_t AXIS; |
volatile signed int x_axis; |
volatile signed int y_axis; |
volatile signed int z_axis; |
}; |
struct MM3_calib_struct |
{ |
int8_t X_off; |
int8_t Y_off; |
int8_t Z_off; |
uint16_t X_range; |
uint16_t Y_range; |
uint16_t Z_range; |
}; |
extern struct MM3_working_struct MM3; |
extern struct MM3_calib_struct MM3_calib; |
void init_MM3(void); |
void timer0_MM3(void); |
void calib_MM3(void); |
signed int heading_MM3(void); |
#define Max_Axis_Value 500 |
// Die Werte der Statemachine |
#define MM3_RESET 0 |
#define MM3_START_TRANSFER 1 |
#define MM3_WAIT_DRDY 2 |
#define MM3_DRDY 3 |
#define MM3_BYTE2 4 |
#define MM3_X 5 |
#define MM3_Y 6 |
#define MM3_Z 7 |
#define MM3_TILT 8 |
#define MM3_IDLE 9 |
/branches/v0.60_MicroMag3_Nick666/fc.c |
---|
0,0 → 1,846 |
/*####################################################################################### |
Flight Control |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
unsigned char h,m,s; |
volatile unsigned char Timeout = 0; |
volatile int MesswertNick,MesswertRoll,MesswertGier; |
volatile int AdNeutralNick = 0,AdNeutralRoll = 0,AdNeutralGier = 0; |
volatile int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch; |
unsigned char CosinusNickWinkel = 0, CosinusRollWinkel = 0; |
volatile long IntegralNick = 0,IntegralNick2 = 0; |
volatile long IntegralRoll = 0,IntegralRoll2 = 0; |
volatile long Integral_Gier = 0; |
volatile long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0; |
volatile long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0; |
volatile long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0; |
volatile long Mess_Integral_Hoch = 0; |
int KompassValue = 0; |
int KompassStartwert = 0; |
int KompassRichtung = 0; |
uint8_t updKompass = 0; |
unsigned char MAX_GAS,MIN_GAS; |
unsigned char Notlandung = 0; |
unsigned char HoehenReglerAktiv = 0; |
float GyroFaktor; |
float IntegralFaktor; |
volatile int DiffNick,DiffRoll; |
int Poti1 = 0, Poti2 = 0, Poti3 = 0, Poti4 = 0; |
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
unsigned char MotorWert[5]; |
volatile unsigned char SenderOkay = 0; |
int StickNick = 0,StickRoll = 0,StickGier = 0; |
char MotorenEin = 0; |
int HoehenWert = 0; |
int SollHoehe = 0; |
float Kp = FAKTOR_P; |
float Ki = FAKTOR_I; |
unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250 |
unsigned char Parameter_MaxHoehe = 251; // Wert : 0-250 |
unsigned char Parameter_Hoehe_P = 16; // Wert : 0-32 |
unsigned char Parameter_Hoehe_ACC_Wirkung = 58; // Wert : 0-250 |
unsigned char Parameter_KompassWirkung = 64; // Wert : 0-250 |
unsigned char Parameter_Gyro_P = 50; // Wert : 10-250 |
unsigned char Parameter_Gyro_I = 150; // Wert : 0-250 |
unsigned char Parameter_Gier_P = 2; // Wert : 1-20 |
unsigned char Parameter_I_Faktor = 10; // Wert : 1-20 |
unsigned char Parameter_UserParam1 = 0; |
unsigned char Parameter_UserParam2 = 0; |
unsigned char Parameter_UserParam3 = 0; |
unsigned char Parameter_UserParam4 = 0; |
unsigned char Parameter_ServoNickControl = 100; |
struct mk_param_struct EE_Parameter; |
struct acc_neutral_struct ee_acc_neutral EEMEM; // Reservierung im EEPROM |
struct acc_neutral_struct acc_neutral; |
void Piep(unsigned char Anzahl) |
{ |
while(Anzahl--) |
{ |
if(MotorenEin) return; //auf keinen Fall im Flug! |
beeptime = 100; |
Delay_ms(250); |
} |
} |
//############################################################################ |
// Neutrallage kalibrieren und fest im EEPROM abspeichern |
void calib_acc(void) |
//############################################################################ |
{ |
unsigned int timer; |
acc_neutral.X = 0; |
acc_neutral.Y = 0; |
acc_neutral.Z = 0; |
CalibrierMittelwert(); |
timer = SetDelay(5); |
while (!CheckDelay(timer)); |
CalibrierMittelwert(); |
acc_neutral.X = abs(Mittelwert_AccNick) / ACC_AMPLIFY; |
acc_neutral.Y = abs(Mittelwert_AccRoll) / ACC_AMPLIFY; |
acc_neutral.Z = Aktuell_az; |
eeprom_write_block(&acc_neutral,&ee_acc_neutral,sizeof(struct acc_neutral_struct)); |
} |
//############################################################################ |
// Nullwerte ermitteln |
void SetNeutral(void) |
//############################################################################ |
{ |
unsigned int timer; |
acc_neutral.X = 0; |
acc_neutral.Y = 0; |
acc_neutral.Z = 0; |
AdNeutralNick = 0; |
AdNeutralRoll = 0; |
AdNeutralGier = 0; |
CalibrierMittelwert(); |
timer = SetDelay(5); |
while (!CheckDelay(timer)); |
CalibrierMittelwert(); |
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
{ |
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
} |
AdNeutralNick= abs(MesswertNick); |
AdNeutralRoll= abs(MesswertRoll); |
AdNeutralGier= abs(MesswertGier); |
eeprom_read_block(&acc_neutral,&ee_acc_neutral,sizeof(struct acc_neutral_struct)); |
Mess_IntegralNick = 0; |
Mess_IntegralNick2 = 0; |
Mess_IntegralRoll = 0; |
Mess_IntegralRoll2 = 0; |
Mess_Integral_Gier = 0; |
MesswertNick = 0; |
MesswertRoll = 0; |
MesswertGier = 0; |
StartLuftdruck = Luftdruck; |
HoeheD = 0; |
Mess_Integral_Hoch = 0; |
KompassStartwert = KompassValue; |
GPS_Neutral(); |
beeptime = 50; |
} |
//############################################################################ |
// Bildet den Mittelwert aus den Messwerten |
void Mittelwert(void) |
//############################################################################ |
{ |
// ADC auschalten, damit die Werte sich nicht während der Berechnung ändern |
ANALOG_OFF; |
if(MessanzahlNick) (MesswertNick = AccumulateNick / MessanzahlNick); |
if(MessanzahlRoll) (MesswertRoll = AccumulateRoll / MessanzahlRoll); |
if(MessanzahlGier) (MesswertGier = AccumulateGier / MessanzahlGier); |
if(messanzahl_AccNick) Mittelwert_AccNick = ((long)Mittelwert_AccNick * 7 + ((ACC_AMPLIFY * (long)accumulate_AccNick) / messanzahl_AccNick)) / 8L; |
if(messanzahl_AccRoll) Mittelwert_AccRoll = ((long)Mittelwert_AccRoll * 7 + ((ACC_AMPLIFY * (long)accumulate_AccRoll) / messanzahl_AccRoll)) / 8L; |
if(messanzahl_AccHoch) Mittelwert_AccHoch = ((long)Mittelwert_AccHoch * 7 + ((long)accumulate_AccHoch) / messanzahl_AccHoch) / 8L; |
AccumulateNick = 0; MessanzahlNick = 0; |
AccumulateRoll = 0; MessanzahlRoll = 0; |
AccumulateGier = 0; MessanzahlGier = 0; |
accumulate_AccRoll = 0;messanzahl_AccRoll = 0; |
accumulate_AccNick = 0;messanzahl_AccNick = 0; |
accumulate_AccHoch = 0;messanzahl_AccHoch = 0; |
Integral_Gier = Mess_Integral_Gier; |
// Integral_Gier2 = Mess_Integral_Gier2; |
IntegralNick = Mess_IntegralNick; |
IntegralRoll = Mess_IntegralRoll; |
IntegralNick2 = Mess_IntegralNick2; |
IntegralRoll2 = Mess_IntegralRoll2; |
// ADC einschalten |
ANALOG_ON; |
/* |
//------------------------------------------------------------------------------ |
if(MesswertNick > 200) MesswertNick += 4 * (MesswertNick - 200); |
else |
if(MesswertNick < -200) MesswertNick += 4 * (MesswertNick + 200); |
if(MesswertRoll > 200) MesswertRoll += 4 * (MesswertRoll - 200); |
else |
if(MesswertRoll < -200) MesswertRoll += 4 * (MesswertRoll + 200); |
//------------------------------------------------------------------------------ |
*/ |
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--; |
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--; |
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--; |
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--; |
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255; |
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255; |
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255; |
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255; |
} |
//############################################################################ |
// Messwerte beim Ermitteln der Nullage |
void CalibrierMittelwert(void) |
//############################################################################ |
{ |
// ADC auschalten, damit die Werte sich nicht während der Berechnung ändern |
ANALOG_OFF; |
if(MessanzahlNick) (MesswertNick = AccumulateNick / MessanzahlNick); |
if(MessanzahlRoll) (MesswertRoll = AccumulateRoll / MessanzahlRoll); |
if(MessanzahlGier) (MesswertGier = AccumulateGier / MessanzahlGier); |
if(messanzahl_AccNick) Mittelwert_AccNick = ((ACC_AMPLIFY * (long)accumulate_AccNick) / messanzahl_AccNick); |
if(messanzahl_AccRoll) Mittelwert_AccRoll = (ACC_AMPLIFY * (long)accumulate_AccRoll) / messanzahl_AccRoll; |
if(messanzahl_AccHoch) Mittelwert_AccHoch = ((long)accumulate_AccHoch) / messanzahl_AccHoch; |
AccumulateNick = 0; MessanzahlNick = 0; |
AccumulateRoll = 0; MessanzahlRoll = 0; |
AccumulateGier = 0; MessanzahlGier = 0; |
accumulate_AccRoll = 0;messanzahl_AccRoll = 0; |
accumulate_AccNick = 0;messanzahl_AccNick = 0; |
accumulate_AccHoch = 0;messanzahl_AccHoch = 0; |
// ADC einschalten |
ANALOG_ON; |
if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--; |
if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--; |
if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--; |
if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--; |
if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255; |
if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255; |
if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255; |
if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255; |
} |
//############################################################################ |
// Senden der Motorwerte per I2C-Bus |
void SendMotorData(void) |
//############################################################################ |
{ |
if(MOTOR_OFF || !MotorenEin) |
{ |
Motor_Hinten = 0; |
Motor_Vorne = 0; |
Motor_Rechts = 0; |
Motor_Links = 0; |
if(MotorTest[0]) Motor_Vorne = MotorTest[0]; |
if(MotorTest[1]) Motor_Hinten = MotorTest[1]; |
if(MotorTest[2]) Motor_Links = MotorTest[2]; |
if(MotorTest[3]) Motor_Rechts = MotorTest[3]; |
} |
DebugOut.Analog[12] = Motor_Vorne; |
DebugOut.Analog[13] = Motor_Hinten; |
DebugOut.Analog[14] = Motor_Links; |
DebugOut.Analog[15] = Motor_Rechts; |
//Start I2C Interrupt Mode |
twi_state = 0; |
motor = 0; |
i2c_start(); |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Konstanten |
// + 0-250 -> normale Werte |
// + 251 -> Poti1 |
// + 252 -> Poti2 |
// + 253 -> Poti3 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
void DefaultKonstanten1(void) |
{ |
EE_Parameter.Kanalbelegung[K_NICK] = 1; |
EE_Parameter.Kanalbelegung[K_ROLL] = 2; |
EE_Parameter.Kanalbelegung[K_GAS] = 3; |
EE_Parameter.Kanalbelegung[K_GIER] = 4; |
EE_Parameter.Kanalbelegung[K_POTI1] = 5; |
EE_Parameter.Kanalbelegung[K_POTI2] = 6; |
EE_Parameter.Kanalbelegung[K_POTI3] = 7; |
EE_Parameter.Kanalbelegung[K_POTI4] = 8; |
EE_Parameter.GlobalConfig = 0;//CFG_HOEHENREGELUNG | /*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV | CFG_KOMPASS_FIX;//0x01; |
EE_Parameter.Hoehe_MinGas = 30; |
EE_Parameter.MaxHoehe = 251; // Wert : 0-32 251 -> Poti1 |
EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
EE_Parameter.Luftdruck_D = 70; // Wert : 0-250 |
EE_Parameter.Hoehe_ACC_Wirkung = 30; // Wert : 0-250 |
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50 |
EE_Parameter.Stick_P = 4; //2 // Wert : 1-6 |
EE_Parameter.Stick_D = 8; //8 // Wert : 0-64 |
EE_Parameter.Gier_P = 16; // Wert : 1-20 |
EE_Parameter.Gas_Min = 15; // Wert : 0-32 |
EE_Parameter.Gas_Max = 250; // Wert : 33-250 |
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64 |
EE_Parameter.KompassWirkung = 16; // Wert : 0-250 |
EE_Parameter.Gyro_P = 120; //80 // Wert : 0-250 |
EE_Parameter.Gyro_I = 150; // Wert : 0-250 |
EE_Parameter.UnterspannungsWarnung = 90; // Wert : 0-250 |
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
EE_Parameter.I_Faktor = 5; |
EE_Parameter.UserParam1 = 178; //zur freien Verwendung |
EE_Parameter.UserParam2 = 0; //zur freien Verwendung |
EE_Parameter.UserParam3 = 0; //zur freien Verwendung |
EE_Parameter.UserParam4 = 0; //zur freien Verwendung |
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickRefresh = 5; |
memcpy(EE_Parameter.Name, "Normal\0", 12); |
} |
void DefaultKonstanten2(void) |
{ |
EE_Parameter.Kanalbelegung[K_NICK] = 1; |
EE_Parameter.Kanalbelegung[K_ROLL] = 2; |
EE_Parameter.Kanalbelegung[K_GAS] = 3; |
EE_Parameter.Kanalbelegung[K_GIER] = 4; |
EE_Parameter.Kanalbelegung[K_POTI1] = 5; |
EE_Parameter.Kanalbelegung[K_POTI2] = 6; |
EE_Parameter.Kanalbelegung[K_POTI3] = 7; |
EE_Parameter.GlobalConfig = 0;//CFG_HOEHENREGELUNG | /*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV;//0x01; |
EE_Parameter.Hoehe_MinGas = 30; |
EE_Parameter.MaxHoehe = 251; // Wert : 0-32 251 -> Poti1 |
EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
EE_Parameter.Luftdruck_D = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50 |
EE_Parameter.Stick_P = 4; //2 // Wert : 1-6 |
EE_Parameter.Stick_D = 0; //8 // Wert : 0-64 |
EE_Parameter.Gier_P = 16; // Wert : 1-20 |
EE_Parameter.Gas_Min = 15; // Wert : 0-32 |
EE_Parameter.Gas_Max = 250; // Wert : 33-250 |
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64 |
EE_Parameter.KompassWirkung = 16; // Wert : 0-250 |
EE_Parameter.Gyro_P = 175; //80 // Wert : 0-250 |
EE_Parameter.Gyro_I = 175; // Wert : 0-250 |
EE_Parameter.UnterspannungsWarnung = 90; // Wert : 0-250 |
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
EE_Parameter.I_Faktor = 5; |
EE_Parameter.UserParam1 = 178; //zur freien Verwendung |
EE_Parameter.UserParam2 = 0; //zur freien Verwendung |
EE_Parameter.UserParam3 = 0; //zur freien Verwendung |
EE_Parameter.UserParam4 = 0; //zur freien Verwendung |
EE_Parameter.UserParam3 = 0; //zur freien Verwendung |
EE_Parameter.UserParam4 = 0; //zur freien Verwendung |
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickRefresh = 5; |
memcpy(EE_Parameter.Name, "Kamera\0", 12); |
} |
//############################################################################ |
// Trägt ggf. das Poti als Parameter ein |
void ParameterZuordnung(void) |
//############################################################################ |
{ |
#define CHK_POTI(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; if(b <= min) b = min; else if(b >= max) b = max;} |
CHK_POTI(Parameter_MaxHoehe,EE_Parameter.MaxHoehe,0,255); |
CHK_POTI(Parameter_Luftdruck_D,EE_Parameter.Luftdruck_D,0,100); |
CHK_POTI(Parameter_Hoehe_P,EE_Parameter.Hoehe_P,0,100); |
CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung,0,255); |
CHK_POTI(Parameter_KompassWirkung,EE_Parameter.KompassWirkung,0,255); |
CHK_POTI(Parameter_Gyro_P,EE_Parameter.Gyro_P,10,255); |
CHK_POTI(Parameter_Gyro_I,EE_Parameter.Gyro_I,0,255); |
CHK_POTI(Parameter_I_Faktor,EE_Parameter.I_Faktor,0,255); |
CHK_POTI(Parameter_UserParam1,EE_Parameter.UserParam1,0,255); |
CHK_POTI(Parameter_UserParam2,EE_Parameter.UserParam2,0,255); |
CHK_POTI(Parameter_UserParam3,EE_Parameter.UserParam3,0,255); |
CHK_POTI(Parameter_UserParam4,EE_Parameter.UserParam4,0,255); |
CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255); |
CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255); |
CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255); |
Ki = (float) Parameter_I_Faktor * 0.0001; |
MAX_GAS = EE_Parameter.Gas_Max; |
MIN_GAS = EE_Parameter.Gas_Min; |
} |
//############################################################################ |
// |
void MotorRegler(void) |
//############################################################################ |
{ |
int motorwert,pd_ergebnis,h,tmp_int; |
int GierMischanteil,GasMischanteil; |
static long SummeNick=0,SummeRoll=0; |
static long sollGier = 0,tmp_long,tmp_long2; |
static int IntegralFehlerNick = 0; |
static int IntegralFehlerRoll = 0; |
static unsigned int RcLostTimer; |
static unsigned char delay_neutral = 0; |
static unsigned char delay_einschalten = 0,delay_ausschalten = 0; |
static unsigned int modell_fliegt = 0; |
static int hoehenregler = 0; |
static char TimerWerteausgabe = 0; |
static char NeueKompassRichtungMerken = 1; |
Mittelwert(); |
GRN_ON; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Gaswert ermitteln |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
GasMischanteil = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + 120; |
if(GasMischanteil < 0) GasMischanteil = 0; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Emfang schlecht |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(SenderOkay < 100) |
{ |
if(!PcZugriff) beeptime = 500; |
if(RcLostTimer) RcLostTimer--; |
else |
{ |
MotorenEin = 0; |
Notlandung = 0; |
} |
ROT_ON; |
if(modell_fliegt > 2000) // wahrscheinlich in der Luft --> langsam absenken |
{ |
GasMischanteil = EE_Parameter.NotGas; |
Notlandung = 1; |
PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0; |
PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0; |
PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] = 0; |
/* Poti1 = 65; |
Poti2 = 48; |
Poti3 = 0; |
*/ } |
else MotorenEin = 0; |
} |
else |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Emfang gut |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(SenderOkay > 140) |
{ |
Notlandung = 0; |
RcLostTimer = EE_Parameter.NotGasZeit * 50; |
if(GasMischanteil > 40) |
{ |
if(modell_fliegt < 0xffff) modell_fliegt++; |
} |
if((modell_fliegt < 200) || (GasMischanteil < 40)) |
{ |
SummeNick = 0; |
SummeRoll = 0; |
Mess_Integral_Gier = 0; |
Mess_Integral_Gier2 = 0; |
} |
if((GasMischanteil > 200) && MotorenEin == 0) |
{ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// auf Nullwerte kalibrieren |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) // Neutralwerte |
{ |
unsigned char setting; |
if(++delay_neutral > 200) // nicht sofort |
{ |
GRN_OFF; |
SetNeutral(); |
MotorenEin = 0; |
delay_neutral = 0; |
modell_fliegt = 0; |
if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70) |
{ |
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 1; |
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 2; |
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 3; |
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 4; |
if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 5; |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], setting); // aktiven Datensatz merken |
} |
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], sizeof(struct mk_param_struct)); |
Piep(GetActiveParamSetNumber()); |
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
{ |
if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
} |
} |
} |
else delay_neutral = 0; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Gas ist unten |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(GasMischanteil < 35) |
{ |
// Starten |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75) |
{ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Einschalten |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(++delay_einschalten > 200) |
{ |
delay_einschalten = 200; |
modell_fliegt = 1; |
MotorenEin = 1; |
sollGier = 0; |
Mess_Integral_Gier = 0; |
Mess_Integral_Gier2 = 0; |
Mess_IntegralNick = 0; |
Mess_IntegralRoll = 0; |
Mess_IntegralNick2 = IntegralNick; |
Mess_IntegralRoll2 = IntegralRoll; |
SummeNick = 0; |
SummeRoll = 0; |
} |
} |
else delay_einschalten = 0; |
//Auf Neutralwerte setzen |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Auschalten |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) |
{ |
if(++delay_ausschalten > 200) // nicht sofort |
{ |
MotorenEin = 0; |
delay_ausschalten = 200; |
modell_fliegt = 0; |
} |
} |
else delay_ausschalten = 0; |
} |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// neue Werte von der Funke |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(!NewPpmData-- || Notlandung) |
{ |
ParameterZuordnung(); |
StickNick = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_P; |
StickNick += PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_D; |
StickRoll = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_P; |
StickRoll += PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_D; |
StickGier = -PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; |
GyroFaktor = ((float)Parameter_Gyro_P + 10.0) / 256.0; |
IntegralFaktor = ((float) Parameter_Gyro_I) / 44000; |
if(EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) IntegralFaktor = 0; |
if(GyroFaktor < 0) GyroFaktor = 0; |
if(IntegralFaktor < 0) IntegralFaktor = 0; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Bei Empfangsausfall im Flug |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(Notlandung) |
{ |
StickGier = 0; |
StickNick = 0; |
StickRoll = 0; |
GyroFaktor = 0.1; |
IntegralFaktor = 0.005; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Gyro-Drift kompensieren |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#define DRIFT_FAKTOR 3 |
if(ZaehlMessungen >= 1000 / DRIFT_FAKTOR) |
{ |
IntegralFehlerNick = IntegralNick2 - IntegralNick; |
IntegralFehlerRoll = IntegralRoll2 - IntegralRoll; |
ZaehlMessungen = 0; |
if(IntegralFehlerNick > 500/DRIFT_FAKTOR) AdNeutralNick++; |
if(IntegralFehlerNick < -500/DRIFT_FAKTOR) AdNeutralNick--; |
if(IntegralFehlerRoll > 500/DRIFT_FAKTOR) AdNeutralRoll++; |
if(IntegralFehlerRoll < -500/DRIFT_FAKTOR) AdNeutralRoll--; |
//if(Mess_Integral_Gier2 > 500/DRIFT_FAKTOR) AdNeutralGier--; |
//if(Mess_Integral_Gier2 <-500/DRIFT_FAKTOR) AdNeutralGier++; |
ANALOG_OFF; // ADC ausschalten, damit die Werte sich nicht während der Berechnung ändern |
Mess_IntegralNick2 = IntegralNick; |
Mess_IntegralRoll2 = IntegralRoll; |
Mess_Integral_Gier2 = Integral_Gier; |
ANALOG_ON; // ADC einschalten |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Integrale auf ACC-Signal abgleichen |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
tmp_long = (long)(IntegralNick / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccNick) / 16; |
tmp_long2 = (long)(IntegralRoll / EE_Parameter.GyroAccFaktor - (long)Mittelwert_AccRoll) / 16; |
#define AUSGLEICH 500 |
if(tmp_long > AUSGLEICH) tmp_long = AUSGLEICH; |
if(tmp_long < -AUSGLEICH) tmp_long =-AUSGLEICH; |
if(tmp_long2 > AUSGLEICH) tmp_long2 = AUSGLEICH; |
if(tmp_long2 <-AUSGLEICH) tmp_long2 =-AUSGLEICH; |
ANALOG_OFF; // ADC ausschalten, damit die Werte sich nicht während der Berechnung ändern |
Mess_IntegralNick -= tmp_long; |
Mess_IntegralRoll -= tmp_long2; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Gieren |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
sollGier = StickGier; |
if(abs(StickGier) > 35) |
{ |
if(!(EE_Parameter.GlobalConfig & CFG_KOMPASS_FIX)) NeueKompassRichtungMerken = 1; |
} |
tmp_int = EE_Parameter.Gier_P * (sollGier * abs(sollGier)) / 256; // expo |
Mess_Integral_Gier -= tmp_int; |
if(Mess_Integral_Gier > 30000) Mess_Integral_Gier = 30000; // begrenzen |
if(Mess_Integral_Gier <-30000) Mess_Integral_Gier =-30000; |
ANALOG_ON; // ADC einschalten |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Kompass |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) |
{ |
int w,v; |
static uint8_t SignalSchlecht = 0; |
if (!updKompass--) // Aufruf mit ~10 Hz |
{ |
KompassValue = heading_MM3(); |
KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
updKompass = 50; |
} |
w = abs(IntegralNick /1024); // mit zunehmender Neigung den Einfluss drosseln |
v = abs(IntegralRoll /1024); |
if(v > w) w = v; // grösste Neigung ermitteln |
if(w < 35 && NeueKompassRichtungMerken && !SignalSchlecht) |
{ |
KompassStartwert = KompassValue; |
NeueKompassRichtungMerken = 0; |
} |
w = (w * Parameter_KompassWirkung) / 64; // auf die Wirkung normieren |
w = Parameter_KompassWirkung - w; // Wirkung ggf drosseln |
if(w > 0) |
{ |
if(!SignalSchlecht) |
{ |
ANALOG_OFF; // ADC ausschalten, damit die Werte sich nicht während der Berechnung ändern |
Mess_Integral_Gier += (KompassRichtung * w) / 32; // nach Kompass ausrichten |
ANALOG_ON; // ADC einschalten |
} |
else SignalSchlecht--; |
} |
else SignalSchlecht = 250; // so lange das Signal taub stellen --> ca. 1/2 sek |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Debugwerte zuordnen |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
DebugOut.Sekunden++; |
if(!TimerWerteausgabe--) |
{ |
TimerWerteausgabe = 49; |
// DebugOut.Analog[0] = MesswertNick; |
// DebugOut.Analog[1] = MesswertRoll; |
// DebugOut.Analog[2] = MesswertGier; |
DebugOut.Analog[0] = IntegralNick / EE_Parameter.GyroAccFaktor; |
DebugOut.Analog[1] = IntegralRoll / EE_Parameter.GyroAccFaktor; |
DebugOut.Analog[2] = Mittelwert_AccNick; |
DebugOut.Analog[3] = Mittelwert_AccRoll; |
DebugOut.Analog[4] = MesswertGier; |
DebugOut.Analog[5] = HoehenWert; |
DebugOut.Analog[6] = (Mess_Integral_Hoch / 512); |
DebugOut.Analog[7] = GasMischanteil; |
DebugOut.Analog[8] = KompassValue; |
// Kanäle 9 bis 11 in compass.c |
// DebugOut.Analog[9] = SollHoehe; |
// DebugOut.Analog[10] = Mess_Integral_Gier / 128; |
// DebugOut.Analog[11] = KompassStartwert; |
// DebugOut.Analog[10] = Parameter_Gyro_I; |
// DebugOut.Analog[10] = EE_Parameter.Gyro_I; |
// DebugOut.Analog[9] = KompassRichtung; |
// DebugOut.Analog[10] = GasMischanteil; |
// DebugOut.Analog[3] = HoeheD * 32; |
// DebugOut.Analog[4] = hoehenregler; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Drehgeschwindigkeit und -winkel zu einem Istwert zusammenfassen |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
MesswertNick = IntegralNick * IntegralFaktor + MesswertNick * GyroFaktor; |
MesswertRoll = IntegralRoll * IntegralFaktor + MesswertRoll * GyroFaktor; |
MesswertGier = MesswertGier * (GyroFaktor/2) + Integral_Gier * IntegralFaktor; |
// Maximalwerte abfangen |
#define MAX_SENSOR 2048 |
if(MesswertNick > MAX_SENSOR) MesswertNick = MAX_SENSOR; |
if(MesswertNick < -MAX_SENSOR) MesswertNick = -MAX_SENSOR; |
if(MesswertRoll > MAX_SENSOR) MesswertRoll = MAX_SENSOR; |
if(MesswertRoll < -MAX_SENSOR) MesswertRoll = -MAX_SENSOR; |
if(MesswertGier > MAX_SENSOR) MesswertGier = MAX_SENSOR; |
if(MesswertGier < -MAX_SENSOR) MesswertGier = -MAX_SENSOR; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Höhenregelung |
// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//OCR0B = 180 - (Poti1 + 120) / 4; |
//DruckOffsetSetting = OCR0B; |
if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung |
{ |
int tmp_int; |
if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert |
{ |
if(Parameter_MaxHoehe < 50) |
{ |
SollHoehe = HoehenWert - 20; // Parameter_MaxHoehe ist der PPM-Wert des Schalters |
HoehenReglerAktiv = 0; |
} |
else |
HoehenReglerAktiv = 1; |
} |
else |
{ |
SollHoehe = Parameter_MaxHoehe * EE_Parameter.Hoehe_Verstaerkung - 20; |
HoehenReglerAktiv = 1; |
} |
if(Notlandung) SollHoehe = 0; |
h = HoehenWert; |
if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln |
{ h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / 16; // Differenz bestimmen --> P-Anteil |
h = GasMischanteil - h; // vom Gas abziehen |
h -= (HoeheD * Parameter_Luftdruck_D)/8; // D-Anteil |
tmp_int = ((Mess_Integral_Hoch / 512) * (signed long) Parameter_Hoehe_ACC_Wirkung) / 32; |
if(tmp_int > 50) tmp_int = 50; |
else if(tmp_int < -50) tmp_int = -50; |
h -= tmp_int; |
hoehenregler = (hoehenregler*15 + h) / 16; |
if(hoehenregler < EE_Parameter.Hoehe_MinGas) // nicht unter MIN |
{ |
if(GasMischanteil >= EE_Parameter.Hoehe_MinGas) hoehenregler = EE_Parameter.Hoehe_MinGas; |
if(GasMischanteil < EE_Parameter.Hoehe_MinGas) hoehenregler = GasMischanteil; |
} |
if(hoehenregler > GasMischanteil) hoehenregler = GasMischanteil; // nicht mehr als Gas |
GasMischanteil = hoehenregler; |
} |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Mischer und PI-Regler |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Gier-Anteil |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
GierMischanteil = MesswertGier - sollGier; // Regler für Gier |
if(GierMischanteil > 100) GierMischanteil = 100; |
if(GierMischanteil < -100) GierMischanteil = -100; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Nick-Achse |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
DiffNick = Kp * (MesswertNick - (StickNick - GPS_Nick)); // Differenz bestimmen |
SummeNick += DiffNick; // I-Anteil |
if(SummeNick > 0) SummeNick-= (abs(SummeNick)/256 + 1); else SummeNick += abs(SummeNick)/256 + 1; |
if(SummeNick > 16000) SummeNick = 16000; |
if(SummeNick < -16000) SummeNick = -16000; |
pd_ergebnis = DiffNick + Ki * SummeNick; // PI-Regler für Nick |
// Motor Vorn |
motorwert = GasMischanteil + pd_ergebnis + GierMischanteil; // Mischer |
if ((motorwert < 0) | (GasMischanteil < 10)) motorwert = 0; |
else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
Motor_Vorne = motorwert; |
// Motor Heck |
motorwert = GasMischanteil - pd_ergebnis + GierMischanteil; |
if ((motorwert < 0) | (GasMischanteil < 10)) motorwert = 0; |
else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
Motor_Hinten = motorwert; |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Roll-Achse |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
DiffRoll = Kp * (MesswertRoll - (StickRoll - GPS_Roll)); // Differenz bestimmen |
SummeRoll += DiffRoll; // I-Anteil |
if(SummeRoll > 0) SummeRoll-= (abs(SummeRoll)/256 + 1); else SummeRoll += abs(SummeRoll)/256 + 1; |
if(SummeRoll > 16000) SummeRoll = 16000; |
if(SummeRoll < -16000) SummeRoll = -16000; |
pd_ergebnis = DiffRoll + Ki * SummeRoll; // PI-Regler für Roll |
// Motor Links |
motorwert = GasMischanteil + pd_ergebnis - GierMischanteil; |
if ((motorwert < 0) | (GasMischanteil < 10)) motorwert = 0; |
else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
Motor_Links = motorwert; |
// Motor Rechts |
motorwert = GasMischanteil - pd_ergebnis - GierMischanteil; |
if ((motorwert < 0) | (GasMischanteil < 10)) motorwert = 0; |
else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
Motor_Rechts = motorwert; |
// +++++++++++++++++++++++++++++++++++++++++++++++ |
} |
/branches/v0.60_MicroMag3_Nick666/fc.h |
---|
0,0 → 1,117 |
/*####################################################################################### |
Flight Control |
#######################################################################################*/ |
#ifndef _FC_H |
#define _FC_H |
extern volatile unsigned char Timeout; |
extern unsigned char Sekunde,Minute; |
extern volatile long IntegralNick,IntegralNick2; |
extern volatile long IntegralRoll,IntegralRoll2; |
extern volatile long Mess_IntegralNick,Mess_IntegralNick2; |
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
extern volatile long Mess_Integral_Hoch; |
extern volatile long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2; |
extern int KompassValue; |
extern int KompassStartwert; |
extern int KompassRichtung; |
extern int HoehenWert; |
extern int SollHoehe; |
extern volatile int MesswertNick,MesswertRoll,MesswertGier; |
extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll; |
extern volatile int NeutralAccX, NeutralAccY,Mittelwert_AccHoch; |
extern volatile float NeutralAccZ; |
void MotorRegler(void); |
void SendMotorData(void); |
void CalibrierMittelwert(void); |
void Mittelwert(void); |
void SetNeutral(void); |
void Piep(unsigned char Anzahl); |
void DefaultKonstanten1(void); |
void DefaultKonstanten2(void); |
unsigned char h,m,s; |
volatile unsigned char Timeout ; |
unsigned char CosinusNickWinkel, CosinusRollWinkel; |
volatile long IntegralNick,IntegralNick2; |
volatile long IntegralRoll,IntegralRoll2; |
volatile long Integral_Gier; |
volatile long Mess_IntegralNick,Mess_IntegralNick2; |
volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
volatile long Mess_Integral_Gier; |
volatile int DiffNick,DiffRoll; |
extern int Poti1, Poti2, Poti3, Poti4; |
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
unsigned char MotorWert[5]; |
volatile unsigned char SenderOkay; |
int StickNick,StickRoll,StickGier; |
char MotorenEin; |
extern void DefaultKonstanten(void); |
struct mk_param_struct |
{ |
unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
unsigned char Luftdruck_D; // Wert : 0-250 |
unsigned char MaxHoehe; // Wert : 0-32 |
unsigned char Hoehe_P; // Wert : 0-32 |
unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
unsigned char Stick_P; // Wert : 1-6 |
unsigned char Stick_D; // Wert : 0-64 |
unsigned char Gier_P; // Wert : 1-20 |
unsigned char Gas_Min; // Wert : 0-32 |
unsigned char Gas_Max; // Wert : 33-250 |
unsigned char GyroAccFaktor; // Wert : 1-64 |
unsigned char KompassWirkung; // Wert : 0-32 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char UfoAusrichtung; // X oder + Formation |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
unsigned char UserParam3; // Wert : 0-250 |
unsigned char UserParam4; // Wert : 0-250 |
unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
unsigned char ServoNickRefresh; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
unsigned char ServoNickCompInvert; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
unsigned char Reserved[7]; |
char Name[12]; |
}; |
struct acc_neutral_struct |
{ |
volatile int X; |
volatile int Y; |
volatile float Z; |
}; |
extern struct acc_neutral_struct acc_neutral; |
extern void calib_acc(void); |
extern struct mk_param_struct EE_Parameter; |
extern unsigned char Parameter_Luftdruck_D; |
extern unsigned char Parameter_MaxHoehe; |
extern unsigned char Parameter_Hoehe_P; |
extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
extern unsigned char Parameter_KompassWirkung; |
extern unsigned char Parameter_Gyro_P; |
extern unsigned char Parameter_Gyro_I; |
extern unsigned char Parameter_Gier_P; |
extern unsigned char Parameter_ServoNickControl; |
#endif //_FC_H |
/branches/v0.60_MicroMag3_Nick666/flight.pnproj |
---|
0,0 → 1,0 |
<Project name="Flight-Ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="printf_P.h"></File><File path="printf_P.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="old_macros.h"></File><File path="twimaster.c"></File><File path="version.txt"></File><File path="twimaster.h"></File><File path="rc.c"></File><File path="rc.h"></File><File path="fc.h"></File><File path="fc.c"></File><File path="menu.h"></File><File path="menu.c"></File><File path="_Settings.h"></File><File path="analog.c"></File><File path="analog.h"></File><File path="GPS.c"></File><File path="gps.h"></File><File path="license_buss.txt"></File><File path="math.c"></File><File path="math.h"></File><File path="compass.c"></File><File path="compass.h"></File><File path="COPYING"></File><File path="COPYING.LESSER"></File></Project> |
/branches/v0.60_MicroMag3_Nick666/flight.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="Flight-Ctrl" x="true"></e></ViewState></pd> |
/branches/v0.60_MicroMag3_Nick666/gps.h |
---|
0,0 → 1,4 |
extern signed int GPS_Nick; |
extern signed int GPS_Roll; |
extern void GPS_Neutral(void); |
extern void GPS_BerechneZielrichtung(void); |
/branches/v0.60_MicroMag3_Nick666/license_buss.txt |
---|
0,0 → 1,52 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten und nichtkommerziellen Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt und genannt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-profit use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked and named as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/branches/v0.60_MicroMag3_Nick666/main.c |
---|
0,0 → 1,236 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt und genannt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
// Reservierung im EEPROM |
unsigned char EEPromArray[10] EEMEM; |
struct mk_param_struct EEParameterArray[5] EEMEM; |
// -- Parametersatz aus EEPROM lesen --- |
// number [0..5] |
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
{ |
if (number > 5) number = 5; |
number--; // Auf Index 0 bis 4 anpassen |
eeprom_read_block(buffer, &EEParameterArray[number], length); |
} |
// -- Parametersatz ins EEPROM schreiben --- |
// number [0..5] |
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
{ |
if (number > 5) number = 5; |
number--; // Auf Index 0 bis 4 anpassen |
eeprom_write_block(buffer, &EEParameterArray[number], length); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
} |
unsigned char GetActiveParamSetNumber(void) |
{ |
return(eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET])); |
} |
//############################################################################ |
//Hauptprogramm |
int main (void) |
//############################################################################ |
{ |
unsigned int timer; |
unsigned int timer2 = 0; |
DDRC = 0x01; // SCL |
PORTC = 0xff; // Pullup SDA |
DDRB = 0x1B; // LEDs und Druckoffset |
PORTB |= (1<<PB0); // LED_Rot |
DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
DDRD |= (1<<PD7); // J7 |
PORTD = 0xF7; |
MCUSR &=~(1<<WDRF); |
WDTCSR |= (1<<WDCE)|(1<<WDE); |
WDTCSR = 0; |
beeptime = 1000; |
StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0; |
ROT_OFF; |
Timer_Init(); |
UART_Init(); |
rc_sum_init(); |
ADC_Init(); |
i2c_init(); |
init_MM3(); |
sei(); |
VersionInfo.Hauptversion = VERSION_HAUPTVERSION; |
VersionInfo.Nebenversion = VERSION_NEBENVERSION; |
VersionInfo.PCKompatibel = VERSION_KOMPATIBEL; |
printf("\n\rFlightControl V%d.%d ", VERSION_HAUPTVERSION, VERSION_NEBENVERSION); |
printf("\n\r=============================="); |
GRN_ON; |
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != 10) // seit V 0.60 |
{ |
printf("\n\rInit. EEPROM: Generiere Default-Parameter..."); |
DefaultKonstanten1(); |
for (unsigned char i=0;i<6;i++) |
{ |
if(i==2) DefaultKonstanten2(); |
WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], sizeof(struct mk_param_struct)); |
} |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 1); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], 10); |
calib_acc(); |
} |
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], sizeof(struct mk_param_struct)); |
printf("\n\rBenutze Parametersatz %d", GetActiveParamSetNumber()); |
//kurze Wartezeit (sonst reagiert die "Kompass kalibrieren?"-Abfrage nicht |
timer = SetDelay(500); |
while(!CheckDelay(timer)); |
//Kompass kalibrieren? |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 100 && PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 100) |
{ |
printf("\n\rKalibriere Kompass"); |
calib_MM3(); |
} |
//Neutrallage kalibrieren? |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 100 && PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -100) |
{ |
printf("\n\rKalibriere Neutrallage"); |
calib_acc(); |
} |
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
{ |
printf("\n\rAbgleich Luftdrucksensor.."); |
timer = SetDelay(2500); |
SucheLuftruckOffset(); |
while (!CheckDelay(timer)); |
printf("OK\n\r"); |
} |
SetNeutral(); |
ROT_OFF; |
beeptime = 2000; |
DebugIn.Analog[1] = 1000; |
DebugIn.Digital[0] = 0x55; |
printf("\n\rSteuerung: "); |
if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
else printf("Neutral"); |
printf("\n\n\r"); |
LcdClear(); |
while (1) |
{ |
if (UpdateMotor) // ReglerIntervall |
{ |
UpdateMotor=0; |
MotorRegler(); |
SendMotorData(); |
ROT_OFF; |
if(PcZugriff) PcZugriff--; |
if(SenderOkay) SenderOkay--; |
if (UBat < EE_Parameter.UnterspannungsWarnung) |
{ |
beeptime = 2000; |
} |
if(!Timeout) |
{ |
i2c_init(); |
} |
else |
{ |
ROT_OFF; |
} |
} |
if(SIO_DEBUG) |
{ |
DatenUebertragung(); |
BearbeiteRxDaten(); |
} |
else BearbeiteRxDaten(); |
if(CheckDelay(timer2)) |
{ |
if(MotorenEin) PORTC ^= 0x10; else PORTC &= ~0x10; |
timer = SetDelay(500); |
} |
} |
return (1); |
} |
/branches/v0.60_MicroMag3_Nick666/main.h |
---|
0,0 → 1,93 |
#ifndef _MAIN_H |
#define _MAIN_H |
//Hier die Quarz Frequenz einstellen |
#if defined (__AVR_ATmega32__) |
#define SYSCLK 20000000L //Quarz Frequenz in Hz |
#endif |
#if defined (__AVR_ATmega644__) |
#define SYSCLK 20000000L //Quarz Frequenz in Hz |
//#define SYSCLK 16000000L //Quarz Frequenz in Hz |
#endif |
// neue Hardware |
#define ROT_OFF PORTB &=~(1<<PB0) |
#define ROT_ON PORTB |= (1<<PB0) |
#define ROT_FLASH PORTB ^= (1<<PB0) |
#define GRN_OFF PORTB &=~(1<<PB1) |
#define GRN_ON PORTB |= (1<<PB1) |
#define GRN_FLASH PORTB ^= (1<<PB1) |
//#ifndef F_CPU |
//#error ################## F_CPU nicht definiert oder ungültig ############# |
//#endif |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//#define ANZ_MITTELWERT 4 |
#define EEPROM_ADR_VALID 1 |
#define EEPROM_ADR_ACTIVE_SET 2 |
#define EEPROM_ADR_LAST_OFFSET 3 |
#define CFG_HOEHENREGELUNG 0x01 |
#define CFG_HOEHEN_SCHALTER 0x02 |
#define CFG_HEADING_HOLD 0x04 |
#define CFG_KOMPASS_AKTIV 0x08 |
#define CFG_KOMPASS_FIX 0x10 |
#define CFG_GPS_AKTIV 0x20 |
//#define SYSCLK |
//extern unsigned long SYSCLK; |
extern volatile int i_Nick[20],i_Roll[20],DiffNick,DiffRoll; |
extern volatile unsigned char SenderOkay; |
extern unsigned char CosinusNickWinkel, CosinusRollWinkel; |
extern void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
extern void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
extern unsigned char GetActiveParamSetNumber(void); |
extern unsigned char EEPromArray[]; |
#include <stdlib.h> |
#include <string.h> |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
#include <avr/eeprom.h> |
#include <avr/boot.h> |
#include <avr/wdt.h> |
#include "old_macros.h" |
#include "_settings.h" |
#include "printf_P.h" |
#include "compass.h" |
#include "timer0.h" |
#include "uart.h" |
#include "analog.h" |
#include "twimaster.h" |
#include "menu.h" |
#include "rc.h" |
#include "fc.h" |
#include "gps.h" |
#include "math.h" |
#ifndef EEMEM |
#define EEMEM __attribute__ ((section (".eeprom"))) |
#endif |
#define DEBUG_DISPLAY_INTERVALL 123 // in ms |
#define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
#endif //_MAIN_H |
/branches/v0.60_MicroMag3_Nick666/makefile |
---|
0,0 → 1,393 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega644 |
F_CPU = 20000000 |
#------------------------------------------------------------------- |
HAUPT_VERSION = 0 |
NEBEN_VERSION = 60 |
VERSION_KOMPATIBEL = 4 # PC-Kompatibilität |
#------------------------------------------------------------------- |
ifeq ($(MCU), atmega32) |
# FUSE_SETTINGS= -u -U lfuse:w:0xff:m -U hfuse:w:0xcf:m |
HEX_NAME = MEGA32 |
endif |
ifeq ($(MCU), atmega644) |
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
#FUSE_SETTINGS = -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
# -u bei neuen Controllern wieder einspielen |
HEX_NAME = MEGA644 |
endif |
ifeq ($(F_CPU), 16000000) |
QUARZ = 16MHZ |
endif |
ifeq ($(F_CPU), 20000000) |
QUARZ = 20MHZ |
endif |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)_MM3 |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c printf_P.c timer0.c analog.c menu.c compass.c math.c |
SRC += twimaster.c rc.c fc.c GPS.c |
########################################################################################################## |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-mtiny-stack -mcall-prologues \ |
#-Wno-pointer-sign \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += -DVERSION_HAUPTVERSION=$(HAUPT_VERSION) -DVERSION_NEBENVERSION=$(NEBEN_VERSION) -DVERSION_KOMPATIBEL=$(VERSION_KOMPATIBEL) |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
##LDFLAGS += -T./linkerfile/avr5.x |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
#AVRDUDE_PROGRAMMER = stk200 |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = ponyser |
#falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
#AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
AVRDUDE_FLAGS += -V |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
#ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
$(REMOVE) $(TARGET).eep |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/branches/v0.60_MicroMag3_Nick666/math.c |
---|
0,0 → 1,126 |
/* |
Copyright 2007, Niklas Nold |
This program (files math.c and math.h) is free software; you can redistribute it and/or modify |
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; |
either version 3 of the License, or (at your option) any later version. |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de |
*/ |
#include "main.h" |
const uint8_t pgm_atan[270] PROGMEM = {0,1,2,3,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,27,28,29,30,31,32,33,33,34,35,36,37,37,38,39,39,40,41,41,42,43,43,44,44,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,52,53,53,54,54,54,55,55,56,56,56,57,57,57,58,58,58,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,64,64,64,64,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,67,68,68,68,68,68,68,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79}; |
//############################################################################ |
// Arkustangens2 im Gradmaß |
signed int atan2_i(signed int x, signed int y) |
//############################################################################ |
{ |
int i,angle; |
int8_t m; |
if (!x && !y) return 0; //atan2 = 0 für x und y = 0 |
if (y < 0) m=-1; |
else m=1; |
if (x==0) return (90*m); // atan2 = 90° für x = 0 |
i = abs(((long)y*50) / x); // Berechne i für die Lookup table (Schrittweite atan(x) ist 0.02 -> *50) |
if (i<270) angle = pgm_read_byte(&pgm_atan[i]); // Lookup für 1° bis 79° |
else if (i>5750) angle = 90; // Grenzwert ist 90° |
else if (i>=1910) angle = 89; // 89° bis 80° über Wertebereiche |
else if (i>=1150) angle = 88; |
else if (i>=820) angle = 87; |
else if (i>=640) angle = 86; |
else if (i>=520) angle = 85; |
else if (i>=440) angle = 84; |
else if (i>=380) angle = 83; |
else if (i>=335) angle = 82; |
else if (i>=299) angle = 81; |
else angle = 80; // (i>=270) |
if (x > 0) return (angle*m); // Quadrant I und IV |
else if ((x < 0) && (m > 0)) return (-angle + 180); // Quadrant II |
else return (angle - 180); // x < 0 && y < 0 Quadrant III |
} |
const float pgm_sinus_f[91] PROGMEM = {0.0,0.0174524,0.0348995,0.0523360,0.0697565,0.0871557,0.1045285,0.1218693,0.1391731,0.1564345,0.1736482,0.1908090,0.2079117,0.2249510,0.2419219,0.2588190,0.2756373,0.2923717,0.3090170,0.3255681,0.3420201,0.3583679,0.3746066,0.3907311,0.4067366,0.4226182,0.4383711,0.4539905,0.4694715,0.4848096,0.5000000,0.5150381,0.5299193,0.5446390,0.5591929,0.5735764,0.5877852,0.6018150,0.6156615,0.6293204,0.6427876,0.6560590,0.6691306,0.6819983,0.6946584,0.7071068,0.7193398,0.7313537,0.7431448,0.7547096,0.7660444,0.7771459,0.7880107,0.7986355,0.8090170,0.8191520,0.8290376,0.8386706,0.8480481,0.8571673,0.8660254,0.8746197,0.8829476,0.8910065,0.8987940,0.9063078,0.9135454,0.9205048,0.9271838,0.9335804,0.9396926,0.9455186,0.9510565,0.9563047,0.9612617,0.9659258,0.9702957,0.9743701,0.9781476,0.9816272,0.9848077,0.9876883,0.9902681,0.9925461,0.9945219,0.9961947,0.9975640,0.9986295,0.9993908,0.9998477,1.0}; |
inline float pgm_read_float(const float *addr) |
{ |
union |
{ |
uint16_t i[2]; // 2 16-bit-Worte |
float f; |
} u; |
u.i[0]=pgm_read_word((PGM_P)addr); |
u.i[1]=pgm_read_word((PGM_P)addr+2); |
return u.f; |
} |
//############################################################################ |
// Kosinusfunktion im Gradmaß |
float cos_f(signed int winkel) |
//############################################################################ |
{ |
return (sin_f(90-winkel)); |
} |
//############################################################################ |
// Sinusfunktion im Gradmaß |
float sin_f(signed int winkel) |
//############################################################################ |
{ |
short int m,n; |
float sinus; |
//winkel = winkel % 360; |
if (winkel < 0) |
{ |
m = -1; |
winkel = abs(winkel); |
} |
else m = +1; |
// Quadranten auswerten |
if (winkel <= 90) n=1; |
else if ((winkel > 90 ) && (winkel <= 180)) {winkel = 180 - winkel; n = 1;} |
else if ((winkel > 180 ) && (winkel <= 270)) {winkel = winkel - 180; n = -1;} |
else {winkel = 360 - winkel; n = -1;} //if ((winkel > 270) && (winkel <= 360)) |
sinus = pgm_read_float(&pgm_sinus_f[winkel]); |
return (sinus*m*n); |
} |
/* |
const uint8_t pgm_asin[201] PROGMEM = {0,0,1,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9,10,10,10,11,11,11,12,12,12,12,13,13,13,14,14,14,14,15,15,15,16,16,16,17,17,17,17,18,18,18,19,19,19,20,20,20,20,21,21,21,22,22,22,23,23,23,24,24,24,25,25,25,25,26,26,26,27,27,27,28,28,28,29,29,29,30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,41,41,41,42,42,42,43,43,44,44,44,45,45,46,46,46,47,47,48,48,49,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,62,62,63,64,64,65,66,66,67,68,68,69,70,71,72,73,74,75,76,77,79,80,82,84,90}; |
//############################################################################ |
// Akurssinusfunktion im Gradmaß |
int8_t asin_i(signed int i) |
//############################################################################ |
{ |
signed char m; |
if (i < 0) {m=-1;i=abs(i);} |
else m=1; |
i = i % 200; |
return (pgm_read_byte(&pgm_asin[i]) * m); |
} |
*/ |
/branches/v0.60_MicroMag3_Nick666/math.h |
---|
0,0 → 1,11 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Peter Muehlenbrock |
// Definitionen fuer Modul math |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
extern signed int atan2_i(signed int x, signed int y); |
extern float cos_f(signed int winkel); |
extern float sin_f(signed int winkel); |
//extern int8_t asin_i(signed int i); |
/branches/v0.60_MicroMag3_Nick666/menu.c |
---|
0,0 → 1,129 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
unsigned int TestInt = 0; |
#define ARRAYGROESSE 10 |
unsigned char Array[ARRAYGROESSE] = {1,2,3,4,5,6,7,8,9,10}; |
char DisplayBuff[80] = "Hallo Welt"; |
unsigned char DispPtr = 0; |
unsigned char RemoteTasten = 0; |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
void LcdClear(void) |
{ |
unsigned char i; |
for(i=0;i<80;i++) DisplayBuff[i] = ' '; |
} |
void Menu(void) |
{ |
static unsigned char MaxMenue = 12,MenuePunkt=0; |
if(RemoteTasten & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue; LcdClear(); } |
if(RemoteTasten & KEY2) { MenuePunkt++; LcdClear(); } |
if((RemoteTasten & KEY1) && (RemoteTasten & KEY2)) MenuePunkt = 0; |
LCD_printfxy(17,0,"[%i]",MenuePunkt); |
switch(MenuePunkt) |
{ |
case 0: |
LCD_printfxy(0,0,"++ MikroKopter ++"); |
LCD_printfxy(0,1,"V%d.%d",VERSION_HAUPTVERSION, VERSION_NEBENVERSION); |
LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber()); |
LCD_printfxy(0,3,"(c) Holger Buss"); |
// if(RemoteTasten & KEY3) TestInt--; |
// if(RemoteTasten & KEY4) TestInt++; |
break; |
case 1: |
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
{ |
LCD_printfxy(0,0,"Hoehe: %5i",HoehenWert); |
LCD_printfxy(0,1,"SollHoehe: %5i",SollHoehe); |
LCD_printfxy(0,2,"Luftdruck: %5i",MessLuftdruck); |
LCD_printfxy(0,3,"Off : %5i",DruckOffsetSetting); |
} |
else |
{ |
LCD_printfxy(0,1,"Keine "); |
LCD_printfxy(0,2,"Höhenregelung"); |
} |
break; |
case 2: |
LCD_printfxy(0,0,"akt. Lage"); |
LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024); |
LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024); |
LCD_printfxy(0,3,"Kompass: %5i",KompassValue); |
break; |
case 3: |
LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]); |
LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]); |
LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]); |
LCD_printfxy(0,3,"K7:%4i Kanäle ",PPM_in[7]); |
break; |
case 4: |
LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]); |
LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]); |
LCD_printfxy(0,3,"P3:%4i Kanäle ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]]); |
break; |
case 5: |
LCD_printfxy(0,0,"Gyro - Sensor"); |
LCD_printfxy(0,1,"Nick %4i (%3i)",AccumulateNick / MessanzahlNick, AdNeutralNick); |
LCD_printfxy(0,2,"Roll %4i (%3i)",AccumulateRoll / MessanzahlRoll, AdNeutralRoll); |
LCD_printfxy(0,3,"Gier %4i (%3i)",AccumulateGier / MessanzahlGier, AdNeutralGier); |
break; |
case 6: |
LCD_printfxy(0,0,"ACC - Sensor"); |
LCD_printfxy(0,1,"Nick %4i (%3i)",accumulate_AccNick / messanzahl_AccNick,acc_neutral.X); |
LCD_printfxy(0,2,"Roll %4i (%3i)",accumulate_AccRoll / messanzahl_AccRoll,acc_neutral.Y); |
LCD_printfxy(0,3,"Hoch %4i (%3i)",Aktuell_az/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)acc_neutral.Z); |
break; |
case 7: |
LCD_printfxy(0,1,"Spannung: %5i",UBat); |
LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay); |
break; |
case 8: |
LCD_printfxy(0,0,"Kompass "); |
LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung); |
LCD_printfxy(0,2,"Messwert: %5i",KompassValue); |
LCD_printfxy(0,3,"Start: %5i",KompassStartwert); |
break; |
case 9: |
LCD_printfxy(0,0,"Poti1: %3i",Poti1); |
LCD_printfxy(0,1,"Poti2: %3i",Poti2); |
LCD_printfxy(0,2,"Poti3: %3i",Poti3); |
LCD_printfxy(0,3,"Poti4: %3i",Poti4); |
break; |
case 10: |
LCD_printfxy(0,0,"Servo " ); |
LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl); |
LCD_printfxy(0,2,"Stellung: %3i",ServoValue); |
LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax); |
break; |
case 11: |
LCD_printfxy(0,0,"MM3 Off"); |
LCD_printfxy(0,1,"X_Offset: %3i",MM3_calib.X_off); |
LCD_printfxy(0,2,"Y_Offset: %3i",MM3_calib.Y_off); |
LCD_printfxy(0,3,"Z_Offset: %3i",MM3_calib.Z_off); |
break; |
case 12: |
LCD_printfxy(0,0,"MM3 Range"); |
LCD_printfxy(0,1,"X_Range: %4i",MM3_calib.X_range); |
LCD_printfxy(0,2,"Y_Range: %4i",MM3_calib.Y_range); |
LCD_printfxy(0,3,"Z_Range: %4i",MM3_calib.Z_range); |
break; |
default: MaxMenue = MenuePunkt - 1; |
MenuePunkt = 0; |
break; |
} |
RemoteTasten = 0; |
} |
/branches/v0.60_MicroMag3_Nick666/menu.h |
---|
0,0 → 1,7 |
void LcdClear(void); |
extern void Menu(void); |
extern char DisplayBuff[80]; |
extern unsigned char DispPtr; |
unsigned char RemoteTasten; |
/branches/v0.60_MicroMag3_Nick666/old_macros.h |
---|
0,0 → 1,47 |
/* |
For backwards compatibility only. |
Ingo Busker ingo@mikrocontroller.com |
*/ |
#ifndef cbi |
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) |
#endif |
#ifndef sbi |
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) |
#endif |
#ifndef inb |
#define inb(sfr) _SFR_BYTE(sfr) |
#endif |
#ifndef outb |
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) |
#endif |
#ifndef inw |
#define inw(sfr) _SFR_WORD(sfr) |
#endif |
#ifndef outw |
#define outw(sfr, val) (_SFR_WORD(sfr) = (val)) |
#endif |
#ifndef outp |
#define outp(val, sfr) outb(sfr, val) |
#endif |
#ifndef inp |
#define inp(sfr) inb(sfr) |
#endif |
#ifndef BV |
#define BV(bit) _BV(bit) |
#endif |
#ifndef PRG_RDB |
#define PRG_RDB pgm_read_byte |
#endif |
/branches/v0.60_MicroMag3_Nick666/printf_P.c |
---|
0,0 → 1,480 |
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt |
/* |
Copyright (C) 1993 Free Software Foundation |
This file is part of the GNU IO Library. This library is free |
software; you can redistribute it and/or modify it under the |
terms of the GNU General Public License as published by the |
Free Software Foundation; either version 2, or (at your option) |
any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this library; see the file COPYING. If not, write to the Free |
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
As a special exception, if you link this library with files |
compiled with a GNU compiler to produce an executable, this does not cause |
the resulting executable to be covered by the GNU General Public License. |
This exception does not however invalidate any other reasons why |
the executable file might be covered by the GNU General Public License. */ |
/* |
* Copyright (c) 1990 Regents of the University of California. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. [rescinded 22 July 1999] |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
/****************************************************************************** |
This file is a patched version of printf called _printf_P |
It is made to work with avr-gcc for Atmel AVR MCUs. |
There are some differences from standard printf: |
1. There is no floating point support (with fp the code is about 8K!) |
2. Return type is void |
3. Format string must be in program memory (by using macro printf this is |
done automaticaly) |
4. %n is not implemented (just remove the comment around it if you need it) |
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the |
folowing specifiers are disabled : |
space # * . - + p s o O |
6. A function void uart_sendchar(char c) is used for output. The UART must |
be initialized before using printf. |
Alexander Popov |
sasho@vip.orbitel.bg |
******************************************************************************/ |
/* |
* Actual printf innards. |
* |
* This code is large and complicated... |
*/ |
#include <string.h> |
#ifdef __STDC__ |
#include <stdarg.h> |
#else |
#include <varargs.h> |
#endif |
#include "main.h" |
//#define LIGHTPRINTF |
char PrintZiel; |
char Putchar(char zeichen) |
{ |
if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);} |
else return(uart_putchar(zeichen)); |
} |
void PRINT(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(*ptr++); |
} |
void PRINTP(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(pgm_read_byte(ptr++)); |
} |
void PAD_SP(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar(' '); |
} |
void PAD_0(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar('0'); |
} |
#define BUF 40 |
/* |
* Macros for converting digits to letters and vice versa |
*/ |
#define to_digit(c) ((c) - '0') |
#define is_digit(c) ((c)<='9' && (c)>='0') |
#define to_char(n) ((n) + '0') |
/* |
* Flags used during conversion. |
*/ |
#define LONGINT 0x01 /* long integer */ |
#define LONGDBL 0x02 /* long double; unimplemented */ |
#define SHORTINT 0x04 /* short integer */ |
#define ALT 0x08 /* alternate form */ |
#define LADJUST 0x10 /* left adjustment */ |
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ |
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ |
void _printf_P (char ziel,char const *fmt0, ...) /* Works with string from FLASH */ |
{ |
va_list ap; |
register const char *fmt; /* format string */ |
register char ch; /* character from fmt */ |
register int n; /* handy integer (short term usage) */ |
register char *cp; /* handy char pointer (short term usage) */ |
const char *fmark; /* for remembering a place in fmt */ |
register unsigned char flags; /* flags as above */ |
signed char width; /* width from format (%8d), or 0 */ |
signed char prec; /* precision from format (%.3d), or -1 */ |
char sign; /* sign prefix (' ', '+', '-', or \0) */ |
unsigned long _ulong=0; /* integer arguments %[diouxX] */ |
#define OCT 8 |
#define DEC 10 |
#define HEX 16 |
unsigned char base; /* base for [diouxX] conversion */ |
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */ |
signed char dpad; /* extra 0 padding needed for integers */ |
signed char fieldsz; /* field size expanded by sign, dpad etc */ |
/* The initialization of 'size' is to suppress a warning that |
'size' might be used unitialized. It seems gcc can't |
quite grok this spaghetti code ... */ |
signed char size = 0; /* size of converted field or string */ |
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ |
char ox[2]; /* space for 0x hex-prefix */ |
PrintZiel = ziel; // bestimmt, LCD oder UART |
va_start(ap, fmt0); |
fmt = fmt0; |
/* |
* Scan the format for conversions (`%' character). |
*/ |
for (;;) { |
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++) |
/* void */; |
if ((n = fmt - fmark) != 0) { |
PRINTP(fmark, n); |
} |
if (ch == '\0') |
goto done; |
fmt++; /* skip over '%' */ |
flags = 0; |
dprec = 0; |
width = 0; |
prec = -1; |
sign = '\0'; |
rflag: ch = PRG_RDB(fmt++); |
reswitch: |
#ifdef LIGHTPRINTF |
if (ch=='o' || ch=='u' || (ch|0x20)=='x') { |
#else |
if (ch=='u' || (ch|0x20)=='x') { |
#endif |
if (flags&LONGINT) { |
_ulong=va_arg(ap, unsigned long); |
} else { |
register unsigned int _d; |
_d=va_arg(ap, unsigned int); |
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d; |
} |
} |
#ifndef LIGHTPRINTF |
if(ch==' ') { |
/* |
* ``If the space and + flags both appear, the space |
* flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
if (!sign) |
sign = ' '; |
goto rflag; |
} else if (ch=='#') { |
flags |= ALT; |
goto rflag; |
} else if (ch=='*'||ch=='-') { |
if (ch=='*') { |
/* |
* ``A negative field width argument is taken as a |
* - flag followed by a positive field width.'' |
* -- ANSI X3J11 |
* They don't exclude field widths read from args. |
*/ |
if ((width = va_arg(ap, int)) >= 0) |
goto rflag; |
width = -width; |
} |
flags |= LADJUST; |
flags &= ~ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch=='+') { |
sign = '+'; |
goto rflag; |
} else if (ch=='.') { |
if ((ch = PRG_RDB(fmt++)) == '*') { |
n = va_arg(ap, int); |
prec = n < 0 ? -1 : n; |
goto rflag; |
} |
n = 0; |
while (is_digit(ch)) { |
n = n*10 + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} |
prec = n < 0 ? -1 : n; |
goto reswitch; |
} else |
#endif /* LIGHTPRINTF */ |
if (ch=='0') { |
/* |
* ``Note that 0 is taken as a flag, not as the |
* beginning of a field width.'' |
* -- ANSI X3J11 |
*/ |
if (!(flags & LADJUST)) |
flags |= ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch>='1' && ch<='9') { |
n = 0; |
do { |
n = 10 * n + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} while (is_digit(ch)); |
width = n; |
goto reswitch; |
} else if (ch=='h') { |
flags |= SHORTINT; |
goto rflag; |
} else if (ch=='l') { |
flags |= LONGINT; |
goto rflag; |
} else if (ch=='c') { |
*(cp = buf) = va_arg(ap, int); |
size = 1; |
sign = '\0'; |
} else if (ch=='D'||ch=='d'||ch=='i') { |
if(ch=='D') |
flags |= LONGINT; |
if (flags&LONGINT) { |
_ulong=va_arg(ap, long); |
} else { |
register int _d; |
_d=va_arg(ap, int); |
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d; |
} |
if ((long)_ulong < 0) { |
_ulong = -_ulong; |
sign = '-'; |
} |
base = DEC; |
goto number; |
} else |
/* |
if (ch=='n') { |
if (flags & LONGINT) |
*va_arg(ap, long *) = ret; |
else if (flags & SHORTINT) |
*va_arg(ap, short *) = ret; |
else |
*va_arg(ap, int *) = ret; |
continue; // no output |
} else |
*/ |
#ifndef LIGHTPRINTF |
if (ch=='O'||ch=='o') { |
if (ch=='O') |
flags |= LONGINT; |
base = OCT; |
goto nosign; |
} else if (ch=='p') { |
/* |
* ``The argument shall be a pointer to void. The |
* value of the pointer is converted to a sequence |
* of printable characters, in an implementation- |
* defined manner.'' |
* -- ANSI X3J11 |
*/ |
/* NOSTRICT */ |
_ulong = (unsigned int)va_arg(ap, void *); |
base = HEX; |
flags |= HEXPREFIX; |
ch = 'x'; |
goto nosign; |
} else if (ch=='s') { // print a string from RAM |
if ((cp = va_arg(ap, char *)) == NULL) { |
cp=buf; |
cp[0] = '('; |
cp[1] = 'n'; |
cp[2] = 'u'; |
cp[4] = cp[3] = 'l'; |
cp[5] = ')'; |
cp[6] = '\0'; |
} |
if (prec >= 0) { |
/* |
* can't use strlen; can only look for the |
* NUL in the first `prec' characters, and |
* strlen() will go further. |
*/ |
char *p = (char*)memchr(cp, 0, prec); |
if (p != NULL) { |
size = p - cp; |
if (size > prec) |
size = prec; |
} else |
size = prec; |
} else |
size = strlen(cp); |
sign = '\0'; |
} else |
#endif /* LIGHTPRINTF */ |
if(ch=='U'||ch=='u') { |
if (ch=='U') |
flags |= LONGINT; |
base = DEC; |
goto nosign; |
} else if (ch=='X'||ch=='x') { |
base = HEX; |
/* leading 0x/X only if non-zero */ |
if (flags & ALT && _ulong != 0) |
flags |= HEXPREFIX; |
/* unsigned conversions */ |
nosign: sign = '\0'; |
/* |
* ``... diouXx conversions ... if a precision is |
* specified, the 0 flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
number: if ((dprec = prec) >= 0) |
flags &= ~ZEROPAD; |
/* |
* ``The result of converting a zero value with an |
* explicit precision of zero is no characters.'' |
* -- ANSI X3J11 |
*/ |
cp = buf + BUF; |
if (_ulong != 0 || prec != 0) { |
register unsigned char _d,notlastdigit; |
do { |
notlastdigit=(_ulong>=base); |
_d = _ulong % base; |
if (_d<10) { |
_d+='0'; |
} else { |
_d+='a'-10; |
if (ch=='X') _d&=~0x20; |
} |
*--cp=_d; |
_ulong /= base; |
} while (notlastdigit); |
#ifndef LIGHTPRINTF |
// handle octal leading 0 |
if (base==OCT && flags & ALT && *cp != '0') |
*--cp = '0'; |
#endif |
} |
size = buf + BUF - cp; |
} else { //default |
/* "%?" prints ?, unless ? is NUL */ |
if (ch == '\0') |
goto done; |
/* pretend it was %c with argument ch */ |
cp = buf; |
*cp = ch; |
size = 1; |
sign = '\0'; |
} |
/* |
* All reasonable formats wind up here. At this point, |
* `cp' points to a string which (if not flags&LADJUST) |
* should be padded out to `width' places. If |
* flags&ZEROPAD, it should first be prefixed by any |
* sign or other prefix; otherwise, it should be blank |
* padded before the prefix is emitted. After any |
* left-hand padding and prefixing, emit zeroes |
* required by a decimal [diouxX] precision, then print |
* the string proper, then emit zeroes required by any |
* leftover floating precision; finally, if LADJUST, |
* pad with blanks. |
*/ |
/* |
* compute actual size, so we know how much to pad. |
*/ |
fieldsz = size; |
dpad = dprec - size; |
if (dpad < 0) |
dpad = 0; |
if (sign) |
fieldsz++; |
else if (flags & HEXPREFIX) |
fieldsz += 2; |
fieldsz += dpad; |
/* right-adjusting blank padding */ |
if ((flags & (LADJUST|ZEROPAD)) == 0) |
PAD_SP(width - fieldsz); |
/* prefix */ |
if (sign) { |
PRINT(&sign, 1); |
} else if (flags & HEXPREFIX) { |
ox[0] = '0'; |
ox[1] = ch; |
PRINT(ox, 2); |
} |
/* right-adjusting zero padding */ |
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) |
PAD_0(width - fieldsz); |
/* leading zeroes from decimal precision */ |
PAD_0(dpad); |
/* the string or number proper */ |
PRINT(cp, size); |
/* left-adjusting padding (always blank) */ |
if (flags & LADJUST) |
PAD_SP(width - fieldsz); |
} |
done: |
va_end(ap); |
} |
/branches/v0.60_MicroMag3_Nick666/printf_P.h |
---|
0,0 → 1,19 |
#ifndef _PRINTF_P_H_ |
#define _PRINTF_P_H_ |
#include <avr/pgmspace.h> |
#define OUT_V24 0 |
#define OUT_LCD 1 |
extern void _printf_P (char, char const *fmt0, ...); |
extern char PrintZiel; |
#define printf_P(format, args...) _printf_P(OUT_V24,format , ## args) |
#define printf(format, args...) _printf_P(OUT_V24,PSTR(format) , ## args) |
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#define LCD_printf(format, args...) { _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#endif |
/branches/v0.60_MicroMag3_Nick666/rc.c |
---|
0,0 → 1,85 |
/*####################################################################################### |
Decodieren eines RC Summen Signals |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "rc.h" |
#include "main.h" |
volatile int PPM_in[11]; |
volatile int PPM_diff[11]; // das diffenzierte Stick-Signal |
volatile unsigned char NewPpmData = 1; |
//############################################################################ |
//zum decodieren des PPM-Signals wird Timer1 mit seiner Input |
//Capture Funktion benutzt: |
void rc_sum_init (void) |
//############################################################################ |
{ |
TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64 |
// PWM |
//TCCR1A = (1 << COM1B1) | (1 << WGM11) | (1 << WGM10); |
//TCCR1B |= (1 << WGM12); |
//OCR1B = 55; |
TIMSK1 |= _BV(ICIE1); |
AdNeutralGier = 0; |
AdNeutralRoll = 0; |
AdNeutralNick = 0; |
return; |
} |
//############################################################################ |
//Diese Routine startet und inizialisiert den Timer für RC |
SIGNAL(SIG_INPUT_CAPTURE1) |
//############################################################################ |
{ |
static unsigned int AltICR=0; |
signed int signal = 0; |
static int index; |
signal = (unsigned int) ICR1 - AltICR; |
AltICR = ICR1; |
//Syncronisationspause? |
if ((signal > 1500) && (signal < 8000)) |
{ |
index = 1; |
NewPpmData = 0; // Null bedeutet: Neue Daten |
// OCR2A = Poti2/2 + 80; |
} |
else |
{ |
if(index < 10) |
{ |
if((signal > 250) && (signal < 687)) |
{ |
signal -= 466; |
// Stabiles Signal |
if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;} |
signal = (3 * (PPM_in[index]) + signal) / 4; |
//373 entspricht ca. 1.5ms also Mittelstellung |
PPM_diff[index] = signal - PPM_in[index]; |
PPM_in[index] = signal; |
} |
index++; |
/* if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |
if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen */ |
} |
} |
} |
/branches/v0.60_MicroMag3_Nick666/rc.h |
---|
0,0 → 1,29 |
/*####################################################################################### |
Derkodieren eines RC Summen Signals |
#######################################################################################*/ |
#ifndef _RC_H |
#define _RC_H |
#if defined (__AVR_ATmega32__) |
#define TIMER_TEILER CK64 |
#define TIMER_RELOAD_VALUE 250 |
#endif |
#if defined (__AVR_ATmega644__) |
//#define TIMER_TEILER CK64 |
#define TIMER_RELOAD_VALUE 250 |
//#define TIMER_TEILER CK256 // bei 20MHz |
//#define TIMER_RELOAD_VALUE -78 // bei 20MHz |
#endif |
#define GAS PPM_in[2] |
extern void rc_sum_init (void); |
extern volatile int PPM_in[11]; |
extern volatile int PPM_diff[11]; // das diffenzierte Stick-Signal |
extern volatile unsigned char NewPpmData; |
#endif //_RC_H |
/branches/v0.60_MicroMag3_Nick666/timer0.c |
---|
0,0 → 1,121 |
#include "main.h" |
volatile unsigned int CountMilliseconds = 0; |
volatile static unsigned int tim_main; |
volatile unsigned char UpdateMotor = 0; |
volatile unsigned int beeptime = 0; |
int ServoValue = 0; |
enum { |
STOP = 0, |
CK = 1, |
CK8 = 2, |
CK64 = 3, |
CK256 = 4, |
CK1024 = 5, |
T0_FALLING_EDGE = 6, |
T0_RISING_EDGE = 7 |
}; |
SIGNAL (SIG_OVERFLOW0) // 9,8kHz |
{ |
static unsigned char cnt_1ms = 1,cnt = 0; |
// TCNT0 -= 250;//TIMER_RELOAD_VALUE; |
if(!cnt--) |
{ |
cnt = 10; |
cnt_1ms++; |
cnt_1ms %= 2; |
if(!cnt_1ms) UpdateMotor = 1; |
CountMilliseconds++; |
if(Timeout) Timeout--; |
} |
if(beeptime > 1) |
{ |
beeptime--; |
PORTD |= (1<<PD2); |
} |
else |
PORTD &= ~(1<<PD2); |
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) timer0_MM3(); // Kompass auslesen |
} |
void Timer_Init(void) |
{ |
tim_main = SetDelay(10); |
TCCR0B = CK8; |
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|3;//fast PWM |
OCR0A = 0; |
OCR0B = 120; |
//TCNT0 = -TIMER_RELOAD_VALUE; // reload |
//OCR1 = 0x00; |
TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3; |
TCCR2B=(0<<CS20)|(1<<CS21)|(1<<CS22); |
// TIMSK2 |= _BV(TOIE2); |
TIMSK2 |= _BV(OCIE2A); |
TIMSK0 |= _BV(TOIE0); |
OCR2A = 10; |
TCNT2 = 0; |
} |
// ----------------------------------------------------------------------- |
unsigned int SetDelay (unsigned int t) |
{ |
// TIMSK0 &= ~_BV(TOIE0); |
return(CountMilliseconds + t + 1); |
// TIMSK0 |= _BV(TOIE0); |
} |
// ----------------------------------------------------------------------- |
char CheckDelay(unsigned int t) |
{ |
// TIMSK0 &= ~_BV(TOIE0); |
return(((t - CountMilliseconds) & 0x8000) >> 9); |
// TIMSK0 |= _BV(TOIE0); |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(unsigned int w) |
{ |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)); |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Servo ansteuern |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(SIG_OUTPUT_COMPARE2A) |
{ |
static unsigned char timer = 10; |
if(!timer--) |
{ |
TCCR2A=(1<<COM2A1)|(0<<COM2A0)|3; |
ServoValue = Parameter_ServoNickControl; |
if(EE_Parameter.ServoNickCompInvert & 0x01) ServoValue += ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512; |
else ServoValue -= ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512; |
if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin; |
else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax; |
//DebugOut.Analog[10] = ServoValue; |
OCR2A = ServoValue;// + 75; |
timer = EE_Parameter.ServoNickRefresh; |
} |
else |
{ |
TCCR2A =3; |
PORTD&=~0x80; |
} |
} |
/branches/v0.60_MicroMag3_Nick666/timer0.h |
---|
0,0 → 1,13 |
#define TIMER_TEILER CK8 |
#define TIMER_RELOAD_VALUE 250 |
void Timer_Init(void); |
void Delay_ms(unsigned int); |
unsigned int SetDelay (unsigned int t); |
char CheckDelay (unsigned int t); |
extern volatile unsigned int CountMilliseconds; |
extern volatile unsigned char UpdateMotor; |
extern volatile unsigned int beeptime; |
extern int ServoValue; |
/branches/v0.60_MicroMag3_Nick666/trunc/uart.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.elf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
-application/octet-stream |
\ No newline at end of property |
/branches/v0.60_MicroMag3_Nick666/trunc/rc.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.eep |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/GPS.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.map |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/analog.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.lss |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/printf_P.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.hex |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/twimaster.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/main.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/timer0.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/Flight-Ctrl_MEGA644_V0_60_MM3.sym |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/menu.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/compass.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/math.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/trunc/fc.d |
---|
File deleted |
/branches/v0.60_MicroMag3_Nick666/twimaster.c |
---|
0,0 → 1,131 |
/*############################################################################ |
############################################################################*/ |
#include "main.h" |
unsigned char twi_state = 0; |
unsigned char motor = 0; |
unsigned char motorread = 0; |
unsigned char motor_rx[8]; |
//############################################################################ |
//Initzialisieren der I2C (TWI) Schnittstelle |
void i2c_init(void) |
//############################################################################ |
{ |
TWSR = 0; |
TWBR = ((SYSCLK/SCL_CLOCK)-16)/2; |
} |
//############################################################################ |
//Start I2C |
char i2c_start(void) |
//############################################################################ |
{ |
TWCR = (1<<TWSTA) | (1<<TWEN) | (1<<TWINT) | (1<<TWIE); |
return(0); |
} |
//############################################################################ |
//Start I2C |
void i2c_stop(void) |
//############################################################################ |
{ |
TWCR = (1<<TWEN) | (1<<TWSTO) | (1<<TWINT); |
} |
//############################################################################ |
//Start I2C |
char i2c_write_byte(char byte) |
//############################################################################ |
{ |
TWSR = 0x00; |
TWDR = byte; |
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE); |
return(0); |
} |
//############################################################################ |
//Start I2C |
SIGNAL (TWI_vect) |
//############################################################################ |
{ |
switch (twi_state++) |
{ |
case 0: |
i2c_write_byte(0x52+(motor*2)); |
break; |
case 1: |
switch(motor++) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 2: |
i2c_stop(); |
if (motor<4) twi_state = 0; |
else motor = 0; |
i2c_start(); |
break; |
//Liest Daten von Motor |
case 3: |
i2c_write_byte(0x53+(motorread*2)); |
break; |
case 4: |
switch(motorread) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 5: //1 Byte vom Motor lesen |
motor_rx[motorread] = TWDR; |
case 6: |
switch(motorread) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 7: //2 Byte vom Motor lesen |
motor_rx[motorread+4] = TWDR; |
motorread++; |
if (motorread>3) motorread=0; |
i2c_stop(); |
twi_state = 0; |
} |
} |
/branches/v0.60_MicroMag3_Nick666/twimaster.h |
---|
0,0 → 1,32 |
/*############################################################################ |
############################################################################*/ |
#ifndef _I2C_MASTER_H |
#define _I2C_MASTER_H |
//############################################################################ |
// I2C Konstanten |
#define SCL_CLOCK 200000L |
#define I2C_TIMEOUT 30000 |
#define I2C_START 0x08 |
#define I2C_REPEATED_START 0x10 |
#define I2C_TX_SLA_ACK 0x18 |
#define I2C_TX_DATA_ACK 0x28 |
#define I2C_RX_SLA_ACK 0x40 |
#define I2C_RX_DATA_ACK 0x50 |
//############################################################################ |
extern unsigned char twi_state; |
extern unsigned char motor; |
extern unsigned char motorread; |
extern unsigned char motor_rx[8]; |
void i2c_init (void); // I2C initialisieren |
char i2c_start (void); // Start I2C |
void i2c_stop (void); // Stop I2C |
char i2c_write_byte (char byte); // 1 Byte schreiben |
#endif |
/branches/v0.60_MicroMag3_Nick666/uart.c |
---|
0,0 → 1,328 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
#include "uart.h" |
unsigned char DebugGetAnforderung = 0,DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0; |
unsigned volatile char SioTmp = 0; |
unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
unsigned volatile char NMEABuffer[MAX_EMPFANGS_BUFF]; |
unsigned volatile char NeuerDatensatzEmpfangen = 0; |
unsigned volatile char NeueKoordinateEmpfangen = 0; |
unsigned volatile char UebertragungAbgeschlossen = 1; |
unsigned volatile char CntCrcError = 0; |
unsigned volatile char AnzahlEmpfangsBytes = 0; |
unsigned volatile char PC_DebugTimeout = 0; |
unsigned char PcZugriff = 100; |
unsigned char MotorTest[4] = {0,0,0,0}; |
unsigned char MeineSlaveAdresse; |
struct str_DebugOut DebugOut; |
struct str_Debug DebugIn; |
struct str_VersionInfo VersionInfo; |
int Debug_Timer; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Sende-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_TX) |
{ |
static unsigned int ptr = 0; |
unsigned char tmp_tx; |
if(!UebertragungAbgeschlossen) |
{ |
ptr++; // die [0] wurde schon gesendet |
tmp_tx = SendeBuffer[ptr]; |
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
{ |
ptr = 0; |
UebertragungAbgeschlossen = 1; |
} |
UDR = tmp_tx; |
} |
else ptr = 0; |
} |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_RX) |
{ |
static unsigned int crc; |
static unsigned char crc1,crc2,buf_ptr; |
static unsigned char UartState = 0; |
unsigned char CrcOkay = 0; |
SioTmp = UDR; |
if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
if(SioTmp == '\r' && UartState == 2) |
{ |
UartState = 0; |
crc -= RxdBuffer[buf_ptr-2]; |
crc -= RxdBuffer[buf_ptr-1]; |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
CrcOkay = 0; |
if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
{ |
NeuerDatensatzEmpfangen = 1; |
AnzahlEmpfangsBytes = buf_ptr; |
RxdBuffer[buf_ptr] = '\r'; |
if(/*(RxdBuffer[1] == MeineSlaveAdresse || (RxdBuffer[1] == 'a')) && */(RxdBuffer[2] == 'R')) wdt_enable(WDTO_250MS); // Reset-Commando |
} |
} |
else |
switch(UartState) |
{ |
case 0: |
if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
buf_ptr = 0; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc = SioTmp; |
break; |
case 1: // Adresse auswerten |
UartState++; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc += SioTmp; |
break; |
case 2: // Eingangsdaten sammeln |
RxdBuffer[buf_ptr] = SioTmp; |
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
else UartState = 0; |
crc += SioTmp; |
break; |
default: |
UartState = 0; |
break; |
} |
} |
// -------------------------------------------------------------------------- |
void AddCRC(unsigned int wieviele) |
{ |
unsigned int tmpCRC = 0,i; |
for(i = 0; i < wieviele;i++) |
{ |
tmpCRC += SendeBuffer[i]; |
} |
tmpCRC %= 4096; |
SendeBuffer[i++] = '=' + tmpCRC / 64; |
SendeBuffer[i++] = '=' + tmpCRC % 64; |
SendeBuffer[i++] = '\r'; |
UebertragungAbgeschlossen = 0; |
UDR = SendeBuffer[0]; |
} |
// -------------------------------------------------------------------------- |
void SendOutData(unsigned char cmd,unsigned char modul, unsigned char *snd, unsigned char len) |
{ |
unsigned int pt = 0; |
unsigned char a,b,c; |
unsigned char ptr = 0; |
SendeBuffer[pt++] = '#'; // Startzeichen |
SendeBuffer[pt++] = modul; // Adresse (a=0; b=1,...) |
SendeBuffer[pt++] = cmd; // Commando |
while(len) |
{ |
if(len) { a = snd[ptr++]; len--;} else a = 0; |
if(len) { b = snd[ptr++]; len--;} else b = 0; |
if(len) { c = snd[ptr++]; len--;} else c = 0; |
SendeBuffer[pt++] = '=' + (a >> 2); |
SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
SendeBuffer[pt++] = '=' + ( c & 0x3f); |
} |
AddCRC(pt); |
} |
// -------------------------------------------------------------------------- |
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer |
{ |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
unsigned char x,y,z; |
while(len) |
{ |
a = RxdBuffer[ptrIn++] - '='; |
b = RxdBuffer[ptrIn++] - '='; |
c = RxdBuffer[ptrIn++] - '='; |
d = RxdBuffer[ptrIn++] - '='; |
if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
} |
} |
// -------------------------------------------------------------------------- |
void BearbeiteRxDaten(void) |
{ |
if(!NeuerDatensatzEmpfangen) return; |
//unsigned int tmp_int_arr1[1]; |
//unsigned int tmp_int_arr2[2]; |
//unsigned int tmp_int_arr3[3]; |
unsigned char tmp_char_arr2[2]; |
//unsigned char tmp_char_arr3[3]; |
//unsigned char tmp_char_arr4[4]; |
//if(!MotorenEin) |
PcZugriff = 255; |
switch(RxdBuffer[2]) |
{ |
case 'c':// Debugdaten incl. Externe IOs usw |
Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes); |
/* for(unsigned char i=0; i<4;i++) |
{ |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2], DebugIn.Analog[i]); |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8); |
}*/ |
RemoteTasten |= DebugIn.RemoteTasten; |
DebugDataAnforderung = 1; |
break; |
case 'h':// x-1 Displayzeilen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
RemoteTasten |= tmp_char_arr2[0]; |
DebugDisplayAnforderung = 1; |
break; |
case 't':// Motortest |
Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes); |
break; |
case 'v': // Version-Anforderung und Ausbaustufe |
GetVersionAnforderung = 1; |
break; |
case 'g':// "Get"-Anforderung für Debug-Daten |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
DebugGetAnforderung = 1; |
break; |
case 'q':// "Get"-Anforderung für Settings |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
if(tmp_char_arr2[0] != 0xff) |
{ |
if(tmp_char_arr2[0] > 5) tmp_char_arr2[0] = 5; |
ReadParameterSet(tmp_char_arr2[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], sizeof(struct mk_param_struct)); |
SendOutData('L' + tmp_char_arr2[0] -1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],sizeof(struct mk_param_struct)); |
} |
else |
SendOutData('L' + GetActiveParamSetNumber()-1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],sizeof(struct mk_param_struct)); |
break; |
case 'l': |
case 'm': |
case 'n': |
case 'o': |
case 'p': // Parametersatz speichern |
Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],sizeof(struct mk_param_struct),3,AnzahlEmpfangsBytes); |
WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], sizeof(struct mk_param_struct)); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken |
Piep(GetActiveParamSetNumber()); |
break; |
} |
// DebugOut.AnzahlZyklen = Debug_Timer_Intervall; |
NeuerDatensatzEmpfangen = 0; |
} |
//############################################################################ |
//Routine für die Serielle Ausgabe |
int uart_putchar (char c) |
//############################################################################ |
{ |
if (c == '\n') |
uart_putchar('\r'); |
//Warten solange bis Zeichen gesendet wurde |
loop_until_bit_is_set(USR, UDRE); |
//Ausgabe des Zeichens |
UDR = c; |
return (0); |
} |
// -------------------------------------------------------------------------- |
void WriteProgramData(unsigned int pos, unsigned char wert) |
{ |
//if (ProgramLocation == IN_RAM) Buffer[pos] = wert; |
// else eeprom_write_byte(&EE_Buffer[pos], wert); |
// Buffer[pos] = wert; |
} |
//############################################################################ |
//INstallation der Seriellen Schnittstelle |
void UART_Init (void) |
//############################################################################ |
{ |
//Enable TXEN im Register UCR TX-Data Enable & RX Enable |
UCR=(1 << TXEN) | (1 << RXEN); |
// UART Double Speed (U2X) |
USR |= (1<<U2X); |
// RX-Interrupt Freigabe |
UCSRB |= (1<<RXCIE); |
// TX-Interrupt Freigabe |
UCSRB |= (1<<TXCIE); |
//Teiler wird gesetzt |
UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1); |
//UBRR = 33; |
//öffnet einen Kanal für printf (STDOUT) |
//fdevopen (uart_putchar, 0); |
//sbi(PORTD,4); |
Debug_Timer = SetDelay(200); |
} |
//--------------------------------------------------------------------------------------------- |
void DatenUebertragung(void) |
{ |
static char dis_zeile = 0; |
if(!UebertragungAbgeschlossen) return; |
if(DebugGetAnforderung && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
{ |
SendOutData('G',MeineSlaveAdresse,(unsigned char *) &DebugIn,sizeof(DebugIn)); |
DebugGetAnforderung = 0; |
} |
if((CheckDelay(Debug_Timer) || DebugDataAnforderung) && UebertragungAbgeschlossen) |
{ |
SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut)); |
DebugDataAnforderung = 0; |
Debug_Timer = SetDelay(MIN_DEBUG_INTERVALL); |
} |
if(DebugDisplayAnforderung && UebertragungAbgeschlossen) |
{ |
Menu(); |
DebugDisplayAnforderung = 0; |
if(++dis_zeile == 4) dis_zeile = 0; |
SendOutData('0' + dis_zeile,0,&DisplayBuff[20 * dis_zeile],20); // DisplayZeile übertragen |
} |
if(GetVersionAnforderung && UebertragungAbgeschlossen) |
{ |
SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo)); |
GetVersionAnforderung = 0; |
} |
} |
/branches/v0.60_MicroMag3_Nick666/uart.h |
---|
0,0 → 1,95 |
#ifndef _UART_H |
#define _UART_H |
#define MAX_SENDE_BUFF 150 |
#define MAX_EMPFANGS_BUFF 150 |
void BearbeiteRxDaten(void); |
extern unsigned char DebugGetAnforderung; |
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
extern unsigned volatile char UebertragungAbgeschlossen; |
extern unsigned volatile char PC_DebugTimeout; |
extern unsigned volatile char NeueKoordinateEmpfangen; |
extern unsigned char MeineSlaveAdresse; |
extern unsigned char PcZugriff; |
extern int Debug_Timer; |
extern void UART_Init (void); |
extern int uart_putchar (char c); |
extern void boot_program_page (uint32_t page, uint8_t *buf); |
extern void DatenUebertragung(void); |
extern void DecodeNMEA(void); |
extern unsigned char MotorTest[4]; |
struct str_DebugOut |
{ |
unsigned char Digital[13]; |
unsigned int AnzahlZyklen; |
unsigned int Zeit; |
unsigned char Sekunden; |
unsigned int Analog[16]; // Debugwerte |
}; |
extern struct str_DebugOut DebugOut; |
struct str_Debug |
{ |
unsigned char Digital[2]; |
unsigned char RemoteTasten; |
unsigned int Analog[4]; |
}; |
extern struct str_Debug DebugIn; |
struct str_VersionInfo |
{ |
unsigned char Hauptversion; |
unsigned char Nebenversion; |
unsigned char PCKompatibel; |
unsigned char Rserved[7]; |
}; |
extern struct str_VersionInfo VersionInfo; |
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
//#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
#define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
#if defined (__AVR_ATmega128__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICRB |
#endif |
#if defined (__AVR_ATmega32__) |
# define USR UCSRA |
# define UCR UCSRB |
# define UBRR UBRRL |
# define EICR EICRB |
# define INT_VEC_RX SIG_UART_RECV |
# define INT_VEC_TX SIG_UART_TRANS |
#endif |
#if defined (__AVR_ATmega644__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICR0B |
# define TXEN TXEN0 |
# define RXEN RXEN0 |
# define RXCIE RXCIE0 |
# define TXCIE TXCIE0 |
# define U2X U2X0 |
# define UCSRB UCSR0B |
# define UDRE UDRE0 |
# define INT_VEC_RX SIG_USART_RECV |
# define INT_VEC_TX SIG_USART_TRANS |
#endif |
#endif //_UART_H |
/branches/v0.60_MicroMag3_Nick666/v0.66c/COPYING |
---|
0,0 → 1,674 |
GNU GENERAL PUBLIC LICENSE |
Version 3, 29 June 2007 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
Preamble |
The GNU General Public License is a free, copyleft license for |
software and other kinds of works. |
The licenses for most software and other practical works are designed |
to take away your freedom to share and change the works. By contrast, |
the GNU General Public License is intended to guarantee your freedom to |
share and change all versions of a program--to make sure it remains free |
software for all its users. We, the Free Software Foundation, use the |
GNU General Public License for most of our software; it applies also to |
any other work released this way by its authors. You can apply it to |
your programs, too. |
When we speak of free software, we are referring to freedom, not |
price. Our General Public Licenses are designed to make sure that you |
have the freedom to distribute copies of free software (and charge for |
them if you wish), that you receive source code or can get it if you |
want it, that you can change the software or use pieces of it in new |
free programs, and that you know you can do these things. |
To protect your rights, we need to prevent others from denying you |
these rights or asking you to surrender the rights. Therefore, you have |
certain responsibilities if you distribute copies of the software, or if |
you modify it: responsibilities to respect the freedom of others. |
For example, if you distribute copies of such a program, whether |
gratis or for a fee, you must pass on to the recipients the same |
freedoms that you received. You must make sure that they, too, receive |
or can get the source code. And you must show them these terms so they |
know their rights. |
Developers that use the GNU GPL protect your rights with two steps: |
(1) assert copyright on the software, and (2) offer you this License |
giving you legal permission to copy, distribute and/or modify it. |
For the developers' and authors' protection, the GPL clearly explains |
that there is no warranty for this free software. For both users' and |
authors' sake, the GPL requires that modified versions be marked as |
changed, so that their problems will not be attributed erroneously to |
authors of previous versions. |
Some devices are designed to deny users access to install or run |
modified versions of the software inside them, although the manufacturer |
can do so. This is fundamentally incompatible with the aim of |
protecting users' freedom to change the software. The systematic |
pattern of such abuse occurs in the area of products for individuals to |
use, which is precisely where it is most unacceptable. Therefore, we |
have designed this version of the GPL to prohibit the practice for those |
products. If such problems arise substantially in other domains, we |
stand ready to extend this provision to those domains in future versions |
of the GPL, as needed to protect the freedom of users. |
Finally, every program is threatened constantly by software patents. |
States should not allow patents to restrict development and use of |
software on general-purpose computers, but in those that do, we wish to |
avoid the special danger that patents applied to a free program could |
make it effectively proprietary. To prevent this, the GPL assures that |
patents cannot be used to render the program non-free. |
The precise terms and conditions for copying, distribution and |
modification follow. |
TERMS AND CONDITIONS |
0. Definitions. |
"This License" refers to version 3 of the GNU General Public License. |
"Copyright" also means copyright-like laws that apply to other kinds of |
works, such as semiconductor masks. |
"The Program" refers to any copyrightable work licensed under this |
License. Each licensee is addressed as "you". "Licensees" and |
"recipients" may be individuals or organizations. |
To "modify" a work means to copy from or adapt all or part of the work |
in a fashion requiring copyright permission, other than the making of an |
exact copy. The resulting work is called a "modified version" of the |
earlier work or a work "based on" the earlier work. |
A "covered work" means either the unmodified Program or a work based |
on the Program. |
To "propagate" a work means to do anything with it that, without |
permission, would make you directly or secondarily liable for |
infringement under applicable copyright law, except executing it on a |
computer or modifying a private copy. Propagation includes copying, |
distribution (with or without modification), making available to the |
public, and in some countries other activities as well. |
To "convey" a work means any kind of propagation that enables other |
parties to make or receive copies. Mere interaction with a user through |
a computer network, with no transfer of a copy, is not conveying. |
An interactive user interface displays "Appropriate Legal Notices" |
to the extent that it includes a convenient and prominently visible |
feature that (1) displays an appropriate copyright notice, and (2) |
tells the user that there is no warranty for the work (except to the |
extent that warranties are provided), that licensees may convey the |
work under this License, and how to view a copy of this License. If |
the interface presents a list of user commands or options, such as a |
menu, a prominent item in the list meets this criterion. |
1. Source Code. |
The "source code" for a work means the preferred form of the work |
for making modifications to it. "Object code" means any non-source |
form of a work. |
A "Standard Interface" means an interface that either is an official |
standard defined by a recognized standards body, or, in the case of |
interfaces specified for a particular programming language, one that |
is widely used among developers working in that language. |
The "System Libraries" of an executable work include anything, other |
than the work as a whole, that (a) is included in the normal form of |
packaging a Major Component, but which is not part of that Major |
Component, and (b) serves only to enable use of the work with that |
Major Component, or to implement a Standard Interface for which an |
implementation is available to the public in source code form. A |
"Major Component", in this context, means a major essential component |
(kernel, window system, and so on) of the specific operating system |
(if any) on which the executable work runs, or a compiler used to |
produce the work, or an object code interpreter used to run it. |
The "Corresponding Source" for a work in object code form means all |
the source code needed to generate, install, and (for an executable |
work) run the object code and to modify the work, including scripts to |
control those activities. However, it does not include the work's |
System Libraries, or general-purpose tools or generally available free |
programs which are used unmodified in performing those activities but |
which are not part of the work. For example, Corresponding Source |
includes interface definition files associated with source files for |
the work, and the source code for shared libraries and dynamically |
linked subprograms that the work is specifically designed to require, |
such as by intimate data communication or control flow between those |
subprograms and other parts of the work. |
The Corresponding Source need not include anything that users |
can regenerate automatically from other parts of the Corresponding |
Source. |
The Corresponding Source for a work in source code form is that |
same work. |
2. Basic Permissions. |
All rights granted under this License are granted for the term of |
copyright on the Program, and are irrevocable provided the stated |
conditions are met. This License explicitly affirms your unlimited |
permission to run the unmodified Program. The output from running a |
covered work is covered by this License only if the output, given its |
content, constitutes a covered work. This License acknowledges your |
rights of fair use or other equivalent, as provided by copyright law. |
You may make, run and propagate covered works that you do not |
convey, without conditions so long as your license otherwise remains |
in force. You may convey covered works to others for the sole purpose |
of having them make modifications exclusively for you, or provide you |
with facilities for running those works, provided that you comply with |
the terms of this License in conveying all material for which you do |
not control copyright. Those thus making or running the covered works |
for you must do so exclusively on your behalf, under your direction |
and control, on terms that prohibit them from making any copies of |
your copyrighted material outside their relationship with you. |
Conveying under any other circumstances is permitted solely under |
the conditions stated below. Sublicensing is not allowed; section 10 |
makes it unnecessary. |
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
No covered work shall be deemed part of an effective technological |
measure under any applicable law fulfilling obligations under article |
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
similar laws prohibiting or restricting circumvention of such |
measures. |
When you convey a covered work, you waive any legal power to forbid |
circumvention of technological measures to the extent such circumvention |
is effected by exercising rights under this License with respect to |
the covered work, and you disclaim any intention to limit operation or |
modification of the work as a means of enforcing, against the work's |
users, your or third parties' legal rights to forbid circumvention of |
technological measures. |
4. Conveying Verbatim Copies. |
You may convey verbatim copies of the Program's source code as you |
receive it, in any medium, provided that you conspicuously and |
appropriately publish on each copy an appropriate copyright notice; |
keep intact all notices stating that this License and any |
non-permissive terms added in accord with section 7 apply to the code; |
keep intact all notices of the absence of any warranty; and give all |
recipients a copy of this License along with the Program. |
You may charge any price or no price for each copy that you convey, |
and you may offer support or warranty protection for a fee. |
5. Conveying Modified Source Versions. |
You may convey a work based on the Program, or the modifications to |
produce it from the Program, in the form of source code under the |
terms of section 4, provided that you also meet all of these conditions: |
a) The work must carry prominent notices stating that you modified |
it, and giving a relevant date. |
b) The work must carry prominent notices stating that it is |
released under this License and any conditions added under section |
7. This requirement modifies the requirement in section 4 to |
"keep intact all notices". |
c) You must license the entire work, as a whole, under this |
License to anyone who comes into possession of a copy. This |
License will therefore apply, along with any applicable section 7 |
additional terms, to the whole of the work, and all its parts, |
regardless of how they are packaged. This License gives no |
permission to license the work in any other way, but it does not |
invalidate such permission if you have separately received it. |
d) If the work has interactive user interfaces, each must display |
Appropriate Legal Notices; however, if the Program has interactive |
interfaces that do not display Appropriate Legal Notices, your |
work need not make them do so. |
A compilation of a covered work with other separate and independent |
works, which are not by their nature extensions of the covered work, |
and which are not combined with it such as to form a larger program, |
in or on a volume of a storage or distribution medium, is called an |
"aggregate" if the compilation and its resulting copyright are not |
used to limit the access or legal rights of the compilation's users |
beyond what the individual works permit. Inclusion of a covered work |
in an aggregate does not cause this License to apply to the other |
parts of the aggregate. |
6. Conveying Non-Source Forms. |
You may convey a covered work in object code form under the terms |
of sections 4 and 5, provided that you also convey the |
machine-readable Corresponding Source under the terms of this License, |
in one of these ways: |
a) Convey the object code in, or embodied in, a physical product |
(including a physical distribution medium), accompanied by the |
Corresponding Source fixed on a durable physical medium |
customarily used for software interchange. |
b) Convey the object code in, or embodied in, a physical product |
(including a physical distribution medium), accompanied by a |
written offer, valid for at least three years and valid for as |
long as you offer spare parts or customer support for that product |
model, to give anyone who possesses the object code either (1) a |
copy of the Corresponding Source for all the software in the |
product that is covered by this License, on a durable physical |
medium customarily used for software interchange, for a price no |
more than your reasonable cost of physically performing this |
conveying of source, or (2) access to copy the |
Corresponding Source from a network server at no charge. |
c) Convey individual copies of the object code with a copy of the |
written offer to provide the Corresponding Source. This |
alternative is allowed only occasionally and noncommercially, and |
only if you received the object code with such an offer, in accord |
with subsection 6b. |
d) Convey the object code by offering access from a designated |
place (gratis or for a charge), and offer equivalent access to the |
Corresponding Source in the same way through the same place at no |
further charge. You need not require recipients to copy the |
Corresponding Source along with the object code. If the place to |
copy the object code is a network server, the Corresponding Source |
may be on a different server (operated by you or a third party) |
that supports equivalent copying facilities, provided you maintain |
clear directions next to the object code saying where to find the |
Corresponding Source. Regardless of what server hosts the |
Corresponding Source, you remain obligated to ensure that it is |
available for as long as needed to satisfy these requirements. |
e) Convey the object code using peer-to-peer transmission, provided |
you inform other peers where the object code and Corresponding |
Source of the work are being offered to the general public at no |
charge under subsection 6d. |
A separable portion of the object code, whose source code is excluded |
from the Corresponding Source as a System Library, need not be |
included in conveying the object code work. |
A "User Product" is either (1) a "consumer product", which means any |
tangible personal property which is normally used for personal, family, |
or household purposes, or (2) anything designed or sold for incorporation |
into a dwelling. In determining whether a product is a consumer product, |
doubtful cases shall be resolved in favor of coverage. For a particular |
product received by a particular user, "normally used" refers to a |
typical or common use of that class of product, regardless of the status |
of the particular user or of the way in which the particular user |
actually uses, or expects or is expected to use, the product. A product |
is a consumer product regardless of whether the product has substantial |
commercial, industrial or non-consumer uses, unless such uses represent |
the only significant mode of use of the product. |
"Installation Information" for a User Product means any methods, |
procedures, authorization keys, or other information required to install |
and execute modified versions of a covered work in that User Product from |
a modified version of its Corresponding Source. The information must |
suffice to ensure that the continued functioning of the modified object |
code is in no case prevented or interfered with solely because |
modification has been made. |
If you convey an object code work under this section in, or with, or |
specifically for use in, a User Product, and the conveying occurs as |
part of a transaction in which the right of possession and use of the |
User Product is transferred to the recipient in perpetuity or for a |
fixed term (regardless of how the transaction is characterized), the |
Corresponding Source conveyed under this section must be accompanied |
by the Installation Information. But this requirement does not apply |
if neither you nor any third party retains the ability to install |
modified object code on the User Product (for example, the work has |
been installed in ROM). |
The requirement to provide Installation Information does not include a |
requirement to continue to provide support service, warranty, or updates |
for a work that has been modified or installed by the recipient, or for |
the User Product in which it has been modified or installed. Access to a |
network may be denied when the modification itself materially and |
adversely affects the operation of the network or violates the rules and |
protocols for communication across the network. |
Corresponding Source conveyed, and Installation Information provided, |
in accord with this section must be in a format that is publicly |
documented (and with an implementation available to the public in |
source code form), and must require no special password or key for |
unpacking, reading or copying. |
7. Additional Terms. |
"Additional permissions" are terms that supplement the terms of this |
License by making exceptions from one or more of its conditions. |
Additional permissions that are applicable to the entire Program shall |
be treated as though they were included in this License, to the extent |
that they are valid under applicable law. If additional permissions |
apply only to part of the Program, that part may be used separately |
under those permissions, but the entire Program remains governed by |
this License without regard to the additional permissions. |
When you convey a copy of a covered work, you may at your option |
remove any additional permissions from that copy, or from any part of |
it. (Additional permissions may be written to require their own |
removal in certain cases when you modify the work.) You may place |
additional permissions on material, added by you to a covered work, |
for which you have or can give appropriate copyright permission. |
Notwithstanding any other provision of this License, for material you |
add to a covered work, you may (if authorized by the copyright holders of |
that material) supplement the terms of this License with terms: |
a) Disclaiming warranty or limiting liability differently from the |
terms of sections 15 and 16 of this License; or |
b) Requiring preservation of specified reasonable legal notices or |
author attributions in that material or in the Appropriate Legal |
Notices displayed by works containing it; or |
c) Prohibiting misrepresentation of the origin of that material, or |
requiring that modified versions of such material be marked in |
reasonable ways as different from the original version; or |
d) Limiting the use for publicity purposes of names of licensors or |
authors of the material; or |
e) Declining to grant rights under trademark law for use of some |
trade names, trademarks, or service marks; or |
f) Requiring indemnification of licensors and authors of that |
material by anyone who conveys the material (or modified versions of |
it) with contractual assumptions of liability to the recipient, for |
any liability that these contractual assumptions directly impose on |
those licensors and authors. |
All other non-permissive additional terms are considered "further |
restrictions" within the meaning of section 10. If the Program as you |
received it, or any part of it, contains a notice stating that it is |
governed by this License along with a term that is a further |
restriction, you may remove that term. If a license document contains |
a further restriction but permits relicensing or conveying under this |
License, you may add to a covered work material governed by the terms |
of that license document, provided that the further restriction does |
not survive such relicensing or conveying. |
If you add terms to a covered work in accord with this section, you |
must place, in the relevant source files, a statement of the |
additional terms that apply to those files, or a notice indicating |
where to find the applicable terms. |
Additional terms, permissive or non-permissive, may be stated in the |
form of a separately written license, or stated as exceptions; |
the above requirements apply either way. |
8. Termination. |
You may not propagate or modify a covered work except as expressly |
provided under this License. Any attempt otherwise to propagate or |
modify it is void, and will automatically terminate your rights under |
this License (including any patent licenses granted under the third |
paragraph of section 11). |
However, if you cease all violation of this License, then your |
license from a particular copyright holder is reinstated (a) |
provisionally, unless and until the copyright holder explicitly and |
finally terminates your license, and (b) permanently, if the copyright |
holder fails to notify you of the violation by some reasonable means |
prior to 60 days after the cessation. |
Moreover, your license from a particular copyright holder is |
reinstated permanently if the copyright holder notifies you of the |
violation by some reasonable means, this is the first time you have |
received notice of violation of this License (for any work) from that |
copyright holder, and you cure the violation prior to 30 days after |
your receipt of the notice. |
Termination of your rights under this section does not terminate the |
licenses of parties who have received copies or rights from you under |
this License. If your rights have been terminated and not permanently |
reinstated, you do not qualify to receive new licenses for the same |
material under section 10. |
9. Acceptance Not Required for Having Copies. |
You are not required to accept this License in order to receive or |
run a copy of the Program. Ancillary propagation of a covered work |
occurring solely as a consequence of using peer-to-peer transmission |
to receive a copy likewise does not require acceptance. However, |
nothing other than this License grants you permission to propagate or |
modify any covered work. These actions infringe copyright if you do |
not accept this License. Therefore, by modifying or propagating a |
covered work, you indicate your acceptance of this License to do so. |
10. Automatic Licensing of Downstream Recipients. |
Each time you convey a covered work, the recipient automatically |
receives a license from the original licensors, to run, modify and |
propagate that work, subject to this License. You are not responsible |
for enforcing compliance by third parties with this License. |
An "entity transaction" is a transaction transferring control of an |
organization, or substantially all assets of one, or subdividing an |
organization, or merging organizations. If propagation of a covered |
work results from an entity transaction, each party to that |
transaction who receives a copy of the work also receives whatever |
licenses to the work the party's predecessor in interest had or could |
give under the previous paragraph, plus a right to possession of the |
Corresponding Source of the work from the predecessor in interest, if |
the predecessor has it or can get it with reasonable efforts. |
You may not impose any further restrictions on the exercise of the |
rights granted or affirmed under this License. For example, you may |
not impose a license fee, royalty, or other charge for exercise of |
rights granted under this License, and you may not initiate litigation |
(including a cross-claim or counterclaim in a lawsuit) alleging that |
any patent claim is infringed by making, using, selling, offering for |
sale, or importing the Program or any portion of it. |
11. Patents. |
A "contributor" is a copyright holder who authorizes use under this |
License of the Program or a work on which the Program is based. The |
work thus licensed is called the contributor's "contributor version". |
A contributor's "essential patent claims" are all patent claims |
owned or controlled by the contributor, whether already acquired or |
hereafter acquired, that would be infringed by some manner, permitted |
by this License, of making, using, or selling its contributor version, |
but do not include claims that would be infringed only as a |
consequence of further modification of the contributor version. For |
purposes of this definition, "control" includes the right to grant |
patent sublicenses in a manner consistent with the requirements of |
this License. |
Each contributor grants you a non-exclusive, worldwide, royalty-free |
patent license under the contributor's essential patent claims, to |
make, use, sell, offer for sale, import and otherwise run, modify and |
propagate the contents of its contributor version. |
In the following three paragraphs, a "patent license" is any express |
agreement or commitment, however denominated, not to enforce a patent |
(such as an express permission to practice a patent or covenant not to |
sue for patent infringement). To "grant" such a patent license to a |
party means to make such an agreement or commitment not to enforce a |
patent against the party. |
If you convey a covered work, knowingly relying on a patent license, |
and the Corresponding Source of the work is not available for anyone |
to copy, free of charge and under the terms of this License, through a |
publicly available network server or other readily accessible means, |
then you must either (1) cause the Corresponding Source to be so |
available, or (2) arrange to deprive yourself of the benefit of the |
patent license for this particular work, or (3) arrange, in a manner |
consistent with the requirements of this License, to extend the patent |
license to downstream recipients. "Knowingly relying" means you have |
actual knowledge that, but for the patent license, your conveying the |
covered work in a country, or your recipient's use of the covered work |
in a country, would infringe one or more identifiable patents in that |
country that you have reason to believe are valid. |
If, pursuant to or in connection with a single transaction or |
arrangement, you convey, or propagate by procuring conveyance of, a |
covered work, and grant a patent license to some of the parties |
receiving the covered work authorizing them to use, propagate, modify |
or convey a specific copy of the covered work, then the patent license |
you grant is automatically extended to all recipients of the covered |
work and works based on it. |
A patent license is "discriminatory" if it does not include within |
the scope of its coverage, prohibits the exercise of, or is |
conditioned on the non-exercise of one or more of the rights that are |
specifically granted under this License. You may not convey a covered |
work if you are a party to an arrangement with a third party that is |
in the business of distributing software, under which you make payment |
to the third party based on the extent of your activity of conveying |
the work, and under which the third party grants, to any of the |
parties who would receive the covered work from you, a discriminatory |
patent license (a) in connection with copies of the covered work |
conveyed by you (or copies made from those copies), or (b) primarily |
for and in connection with specific products or compilations that |
contain the covered work, unless you entered into that arrangement, |
or that patent license was granted, prior to 28 March 2007. |
Nothing in this License shall be construed as excluding or limiting |
any implied license or other defenses to infringement that may |
otherwise be available to you under applicable patent law. |
12. No Surrender of Others' Freedom. |
If conditions are imposed on you (whether by court order, agreement or |
otherwise) that contradict the conditions of this License, they do not |
excuse you from the conditions of this License. If you cannot convey a |
covered work so as to satisfy simultaneously your obligations under this |
License and any other pertinent obligations, then as a consequence you may |
not convey it at all. For example, if you agree to terms that obligate you |
to collect a royalty for further conveying from those to whom you convey |
the Program, the only way you could satisfy both those terms and this |
License would be to refrain entirely from conveying the Program. |
13. Use with the GNU Affero General Public License. |
Notwithstanding any other provision of this License, you have |
permission to link or combine any covered work with a work licensed |
under version 3 of the GNU Affero General Public License into a single |
combined work, and to convey the resulting work. The terms of this |
License will continue to apply to the part which is the covered work, |
but the special requirements of the GNU Affero General Public License, |
section 13, concerning interaction through a network will apply to the |
combination as such. |
14. Revised Versions of this License. |
The Free Software Foundation may publish revised and/or new versions of |
the GNU General Public License from time to time. Such new versions will |
be similar in spirit to the present version, but may differ in detail to |
address new problems or concerns. |
Each version is given a distinguishing version number. If the |
Program specifies that a certain numbered version of the GNU General |
Public License "or any later version" applies to it, you have the |
option of following the terms and conditions either of that numbered |
version or of any later version published by the Free Software |
Foundation. If the Program does not specify a version number of the |
GNU General Public License, you may choose any version ever published |
by the Free Software Foundation. |
If the Program specifies that a proxy can decide which future |
versions of the GNU General Public License can be used, that proxy's |
public statement of acceptance of a version permanently authorizes you |
to choose that version for the Program. |
Later license versions may give you additional or different |
permissions. However, no additional obligations are imposed on any |
author or copyright holder as a result of your choosing to follow a |
later version. |
15. Disclaimer of Warranty. |
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
16. Limitation of Liability. |
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
SUCH DAMAGES. |
17. Interpretation of Sections 15 and 16. |
If the disclaimer of warranty and limitation of liability provided |
above cannot be given local legal effect according to their terms, |
reviewing courts shall apply local law that most closely approximates |
an absolute waiver of all civil liability in connection with the |
Program, unless a warranty or assumption of liability accompanies a |
copy of the Program in return for a fee. |
END OF TERMS AND CONDITIONS |
How to Apply These Terms to Your New Programs |
If you develop a new program, and you want it to be of the greatest |
possible use to the public, the best way to achieve this is to make it |
free software which everyone can redistribute and change under these terms. |
To do so, attach the following notices to the program. It is safest |
to attach them to the start of each source file to most effectively |
state the exclusion of warranty; and each file should have at least |
the "copyright" line and a pointer to where the full notice is found. |
<one line to give the program's name and a brief idea of what it does.> |
Copyright (C) <year> <name of author> |
This program is free software: you can redistribute it and/or modify |
it under the terms of the GNU General Public License as published by |
the Free Software Foundation, either version 3 of the License, or |
(at your option) any later version. |
This program is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Also add information on how to contact you by electronic and paper mail. |
If the program does terminal interaction, make it output a short |
notice like this when it starts in an interactive mode: |
<program> Copyright (C) <year> <name of author> |
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
This is free software, and you are welcome to redistribute it |
under certain conditions; type `show c' for details. |
The hypothetical commands `show w' and `show c' should show the appropriate |
parts of the General Public License. Of course, your program's commands |
might be different; for a GUI interface, you would use an "about box". |
You should also get your employer (if you work as a programmer) or school, |
if any, to sign a "copyright disclaimer" for the program, if necessary. |
For more information on this, and how to apply and follow the GNU GPL, see |
<http://www.gnu.org/licenses/>. |
The GNU General Public License does not permit incorporating your program |
into proprietary programs. If your program is a subroutine library, you |
may consider it more useful to permit linking proprietary applications with |
the library. If this is what you want to do, use the GNU Lesser General |
Public License instead of this License. But first, please read |
<http://www.gnu.org/philosophy/why-not-lgpl.html>. |
/branches/v0.60_MicroMag3_Nick666/v0.66c/COPYING.LESSER |
---|
0,0 → 1,165 |
GNU LESSER GENERAL PUBLIC LICENSE |
Version 3, 29 June 2007 |
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
Everyone is permitted to copy and distribute verbatim copies |
of this license document, but changing it is not allowed. |
This version of the GNU Lesser General Public License incorporates |
the terms and conditions of version 3 of the GNU General Public |
License, supplemented by the additional permissions listed below. |
0. Additional Definitions. |
As used herein, "this License" refers to version 3 of the GNU Lesser |
General Public License, and the "GNU GPL" refers to version 3 of the GNU |
General Public License. |
"The Library" refers to a covered work governed by this License, |
other than an Application or a Combined Work as defined below. |
An "Application" is any work that makes use of an interface provided |
by the Library, but which is not otherwise based on the Library. |
Defining a subclass of a class defined by the Library is deemed a mode |
of using an interface provided by the Library. |
A "Combined Work" is a work produced by combining or linking an |
Application with the Library. The particular version of the Library |
with which the Combined Work was made is also called the "Linked |
Version". |
The "Minimal Corresponding Source" for a Combined Work means the |
Corresponding Source for the Combined Work, excluding any source code |
for portions of the Combined Work that, considered in isolation, are |
based on the Application, and not on the Linked Version. |
The "Corresponding Application Code" for a Combined Work means the |
object code and/or source code for the Application, including any data |
and utility programs needed for reproducing the Combined Work from the |
Application, but excluding the System Libraries of the Combined Work. |
1. Exception to Section 3 of the GNU GPL. |
You may convey a covered work under sections 3 and 4 of this License |
without being bound by section 3 of the GNU GPL. |
2. Conveying Modified Versions. |
If you modify a copy of the Library, and, in your modifications, a |
facility refers to a function or data to be supplied by an Application |
that uses the facility (other than as an argument passed when the |
facility is invoked), then you may convey a copy of the modified |
version: |
a) under this License, provided that you make a good faith effort to |
ensure that, in the event an Application does not supply the |
function or data, the facility still operates, and performs |
whatever part of its purpose remains meaningful, or |
b) under the GNU GPL, with none of the additional permissions of |
this License applicable to that copy. |
3. Object Code Incorporating Material from Library Header Files. |
The object code form of an Application may incorporate material from |
a header file that is part of the Library. You may convey such object |
code under terms of your choice, provided that, if the incorporated |
material is not limited to numerical parameters, data structure |
layouts and accessors, or small macros, inline functions and templates |
(ten or fewer lines in length), you do both of the following: |
a) Give prominent notice with each copy of the object code that the |
Library is used in it and that the Library and its use are |
covered by this License. |
b) Accompany the object code with a copy of the GNU GPL and this license |
document. |
4. Combined Works. |
You may convey a Combined Work under terms of your choice that, |
taken together, effectively do not restrict modification of the |
portions of the Library contained in the Combined Work and reverse |
engineering for debugging such modifications, if you also do each of |
the following: |
a) Give prominent notice with each copy of the Combined Work that |
the Library is used in it and that the Library and its use are |
covered by this License. |
b) Accompany the Combined Work with a copy of the GNU GPL and this license |
document. |
c) For a Combined Work that displays copyright notices during |
execution, include the copyright notice for the Library among |
these notices, as well as a reference directing the user to the |
copies of the GNU GPL and this license document. |
d) Do one of the following: |
0) Convey the Minimal Corresponding Source under the terms of this |
License, and the Corresponding Application Code in a form |
suitable for, and under terms that permit, the user to |
recombine or relink the Application with a modified version of |
the Linked Version to produce a modified Combined Work, in the |
manner specified by section 6 of the GNU GPL for conveying |
Corresponding Source. |
1) Use a suitable shared library mechanism for linking with the |
Library. A suitable mechanism is one that (a) uses at run time |
a copy of the Library already present on the user's computer |
system, and (b) will operate properly with a modified version |
of the Library that is interface-compatible with the Linked |
Version. |
e) Provide Installation Information, but only if you would otherwise |
be required to provide such information under section 6 of the |
GNU GPL, and only to the extent that such information is |
necessary to install and execute a modified version of the |
Combined Work produced by recombining or relinking the |
Application with a modified version of the Linked Version. (If |
you use option 4d0, the Installation Information must accompany |
the Minimal Corresponding Source and Corresponding Application |
Code. If you use option 4d1, you must provide the Installation |
Information in the manner specified by section 6 of the GNU GPL |
for conveying Corresponding Source.) |
5. Combined Libraries. |
You may place library facilities that are a work based on the |
Library side by side in a single library together with other library |
facilities that are not Applications and are not covered by this |
License, and convey such a combined library under terms of your |
choice, if you do both of the following: |
a) Accompany the combined library with a copy of the same work based |
on the Library, uncombined with any other library facilities, |
conveyed under the terms of this License. |
b) Give prominent notice with the combined library that part of it |
is a work based on the Library, and explaining where to find the |
accompanying uncombined form of the same work. |
6. Revised Versions of the GNU Lesser General Public License. |
The Free Software Foundation may publish revised and/or new versions |
of the GNU Lesser General Public License from time to time. Such new |
versions will be similar in spirit to the present version, but may |
differ in detail to address new problems or concerns. |
Each version is given a distinguishing version number. If the |
Library as you received it specifies that a certain numbered version |
of the GNU Lesser General Public License "or any later version" |
applies to it, you have the option of following the terms and |
conditions either of that published version or of any later version |
published by the Free Software Foundation. If the Library as you |
received it does not specify a version number of the GNU Lesser |
General Public License, you may choose any version of the GNU Lesser |
General Public License ever published by the Free Software Foundation. |
If the Library as you received it specifies that a proxy can decide |
whether future versions of the GNU Lesser General Public License shall |
apply, that proxy's public statement of acceptance of any version is |
permanent authorization for you to choose that version for the |
Library. |
/branches/v0.60_MicroMag3_Nick666/v0.66c/FlightCtrl.aps |
---|
0,0 → 1,0 |
<AVRStudio><MANAGEMENT><ProjectName>FlightCtrl</ProjectName><Created>15-May-2007 11:20:41</Created><LastEdit>11-Oct-2007 22:58:54</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>15-May-2007 11:20:41</Created><Version>4</Version><Build>4, 13, 0, 528</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile>default\Flight-Ctrl.elf</ObjectFile><EntryFile></EntryFile><SaveFolder>F:\SVN\MikroKopter\FlightCtrl\branches\V0.64_ZeroWarnings\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR Simulator</CURRENT_TARGET><CURRENT_PART>ATmega644.xml</CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>uart.c</SOURCEFILE><SOURCEFILE>analog.c</SOURCEFILE><SOURCEFILE>eeprom.c</SOURCEFILE><SOURCEFILE>fc.c</SOURCEFILE><SOURCEFILE>GPS.c</SOURCEFILE><SOURCEFILE>main.c</SOURCEFILE><SOURCEFILE>menu.c</SOURCEFILE><SOURCEFILE>printf_P.c</SOURCEFILE><SOURCEFILE>rc.c</SOURCEFILE><SOURCEFILE>timer0.c</SOURCEFILE><SOURCEFILE>twimaster.c</SOURCEFILE><HEADERFILE>uart.h</HEADERFILE><HEADERFILE>_Settings.h</HEADERFILE><HEADERFILE>analog.h</HEADERFILE><HEADERFILE>fc.h</HEADERFILE><HEADERFILE>gps.h</HEADERFILE><HEADERFILE>main.h</HEADERFILE><HEADERFILE>menu.h</HEADERFILE><HEADERFILE>old_macros.h</HEADERFILE><HEADERFILE>printf_P.h</HEADERFILE><HEADERFILE>rc.h</HEADERFILE><HEADERFILE>Settings.h</HEADERFILE><HEADERFILE>timer0.h</HEADERFILE><HEADERFILE>twimaster.h</HEADERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>NO</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE></EXTERNALMAKEFILE><PART>atmega644</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>Flight-Ctrl.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS><OPTION><FILE>GPS.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>analog.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>eeprom.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>fc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>main.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>menu.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>printf_P.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>rc.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>timer0.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>twimaster.c</FILE><OPTIONLIST></OPTIONLIST></OPTION><OPTION><FILE>uart.c</FILE><OPTIONLIST></OPTIONLIST></OPTION></OPTIONS><INCDIRS/><LIBDIRS/><LIBS><LIB>libc.a</LIB><LIB>libm.a</LIB></LIBS><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -Wstrict-prototypes -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -DVERSION_HAUPTVERSION=0 -DVERSION_NEBENVERSION=64 -DVERSION_KOMPATIBEL=5</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\Program Files\WinAVR\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\Program Files\WinAVR\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/></IOView><Files><File00000><FileId>00000</FileId><FileName>main.c</FileName><Status>1</Status></File00000><File00001><FileId>00001</FileId><FileName>uart.c</FileName><Status>1</Status></File00001><File00002><FileId>00002</FileId><FileName>menu.c</FileName><Status>1</Status></File00002><File00003><FileId>00003</FileId><FileName>timer0.c</FileName><Status>1</Status></File00003><File00004><FileId>00004</FileId><FileName>fc.c</FileName><Status>1</Status></File00004><File00005><FileId>00005</FileId><FileName>fc.h</FileName><Status>1</Status></File00005><File00006><FileId>00006</FileId><FileName>menu.h</FileName><Status>1</Status></File00006><File00007><FileId>00007</FileId><FileName>TWIMASTER.C</FileName><Status>1</Status></File00007><File00008><FileId>00008</FileId><FileName>twimaster.h</FileName><Status>1</Status></File00008><File00009><FileId>00009</FileId><FileName>uart.h</FileName><Status>1</Status></File00009><File00010><FileId>00010</FileId><FileName>_Settings.h</FileName><Status>1</Status></File00010><File00011><FileId>00011</FileId><FileName>analog.h</FileName><Status>1</Status></File00011><File00012><FileId>00012</FileId><FileName>gps.h</FileName><Status>1</Status></File00012><File00013><FileId>00013</FileId><FileName>main.h</FileName><Status>1</Status></File00013><File00014><FileId>00014</FileId><FileName>old_macros.h</FileName><Status>1</Status></File00014><File00015><FileId>00015</FileId><FileName>printf_P.h</FileName><Status>1</Status></File00015><File00016><FileId>00016</FileId><FileName>rc.h</FileName><Status>1</Status></File00016><File00017><FileId>00017</FileId><FileName>Settings.h</FileName><Status>1</Status></File00017><File00018><FileId>00018</FileId><FileName>timer0.h</FileName><Status>1</Status></File00018></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio> |
/branches/v0.60_MicroMag3_Nick666/v0.66c/GPS.c |
---|
0,0 → 1,30 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
signed int GPS_Nick = 0; |
signed int GPS_Roll = 0; |
long GpsAktuell_X = 0; |
long GpsAktuell_Y = 0; |
long GpsZiel_X = 0; |
long GpsZiel_Y = 0; |
void GPS_Neutral(void) |
{ |
GpsZiel_X = GpsAktuell_X; |
GpsZiel_Y = GpsAktuell_Y; |
} |
void GPS_BerechneZielrichtung(void) |
{ |
GPS_Nick = 0; |
GPS_Roll = 0; |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/README.pdf |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/branches/v0.60_MicroMag3_Nick666/v0.66c/Settings.h |
---|
--- v0.66c/_Settings.h (nonexistent) |
+++ v0.66c/_Settings.h (revision 512) |
@@ -0,0 +1,50 @@ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Testmodi |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define MOTOR_OFF 0 |
+#define MOTOR_TEST 0 |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Abstimmung |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define ACC_AMPLIFY 12 |
+#define FAKTOR_P 1 |
+#define FAKTOR_I 0.0001 |
+ |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Debug-Interface |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define SIO_DEBUG 1 // Soll der Debugger aktiviert sein? |
+#define MIN_DEBUG_INTERVALL 500 // in diesem Intervall werden Degugdaten ohne Aufforderung gesendet |
+ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Sender |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ #define K_NICK 0 |
+ #define K_ROLL 1 |
+ #define K_GAS 2 |
+ #define K_GIER 3 |
+ #define K_POTI1 4 |
+ #define K_POTI2 5 |
+ #define K_POTI3 6 |
+ #define K_POTI4 7 |
+// +++++++++++++++++++++++++++++++ |
+// + Getestete Settings: |
+// +++++++++++++++++++++++++++++++ |
+// Setting: Kamera |
+// Stick_P:3 |
+// Stick_D:0 |
+// Gyro_P: 175 |
+// Gyro_I: 175 |
+// Ki_Anteil: 10 |
+// +++++++++++++++++++++++++++++++ |
+// + Getestete Settings: |
+// +++++++++++++++++++++++++++++++ |
+// Setting: Normal |
+// Stick_P:2 |
+// Stick_D:8 |
+// Gyro_P: 80 |
+// Gyro_I: 150 |
+// Ki_Anteil: 5 |
+ |
/branches/v0.60_MicroMag3_Nick666/v0.66c/analog.c |
---|
0,0 → 1,145 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az, UBat = 100; |
volatile int AdWertNick = 0, AdWertRoll = 0, AdWertGier = 0; |
volatile int AdWertAccRoll = 0,AdWertAccNick = 0,AdWertAccHoch = 0; |
volatile char MessanzahlNick = 0, MessanzahlRoll = 0, MessanzahlGier = 0; |
volatile char messanzahl_AccNick = 0, messanzahl_AccRoll = 0, messanzahl_AccHoch = 0; |
volatile long Luftdruck = 32000; |
volatile int StartLuftdruck; |
volatile unsigned int MessLuftdruck = 1023; |
unsigned char DruckOffsetSetting; |
volatile int HoeheD = 0; |
volatile char messanzahl_Druck; |
volatile int tmpLuftdruck; |
volatile unsigned int ZaehlMessungen = 0; |
//####################################################################################### |
// |
void ADC_Init(void) |
//####################################################################################### |
{ |
ADMUX = 0;//Referenz ist extern |
ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE); |
//Free Running Mode, Division Factor 128, Interrupt on |
} |
void SucheLuftruckOffset(void) |
{ |
unsigned int off; |
off = eeprom_read_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET]); |
if(off > 20) off -= 10; |
OCR0A = off; |
Delay_ms_Mess(100); |
if(MessLuftdruck < 850) off = 0; |
for(; off < 250;off++) |
{ |
OCR0A = off; |
Delay_ms_Mess(50); |
printf("."); |
if(MessLuftdruck < 900) break; |
} |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_LAST_OFFSET], off); |
DruckOffsetSetting = off; |
Delay_ms_Mess(300); |
} |
//####################################################################################### |
// |
SIGNAL(SIG_ADC) |
//####################################################################################### |
{ |
static unsigned char kanal=0,state = 0; |
static unsigned int gier1, roll1, nick1; |
ANALOG_OFF; |
switch(state++) |
{ |
case 0: |
gier1 = ADC; |
kanal = 1; |
ZaehlMessungen++; |
break; |
case 1: |
roll1 = ADC; |
kanal = 2; |
break; |
case 2: |
nick1 = ADC; |
kanal = 4; |
break; |
case 3: |
UBat = (3 * UBat + ADC / 3) / 4;//(UBat + ((ADC * 39) / 256) + 19) / 2; |
kanal = 6; |
break; |
case 4: |
Aktuell_ay = acc_neutral.Y - ADC; |
AdWertAccRoll = Aktuell_ay; |
kanal = 7; |
break; |
case 5: |
Aktuell_ax = ADC - acc_neutral.X; |
AdWertAccNick = Aktuell_ax; |
kanal = 0; |
break; |
case 6: |
if(PlatinenVersion == 10) AdWertGier = (ADC + gier1) / 2; |
else AdWertGier = ADC + gier1; |
kanal = 1; |
break; |
case 7: |
if(PlatinenVersion == 10) AdWertRoll = (ADC + roll1) / 2; |
else AdWertRoll = ADC + roll1; |
kanal = 2; |
break; |
case 8: |
if(PlatinenVersion == 10) AdWertNick = (ADC + nick1) / 2; |
else AdWertNick = ADC + nick1; |
kanal = 5; |
break; |
case 9: |
AdWertAccHoch = (signed int) ADC - acc_neutral.Z; |
AdWertAccHoch += abs(Aktuell_ay) / 4 + abs(Aktuell_ax) / 4; |
if(AdWertAccHoch > 1) |
{ |
if(acc_neutral.Z < 800) acc_neutral.Z+= 0.02; |
} |
else if(AdWertAccHoch < -1) |
{ |
if(acc_neutral.Z > 600) acc_neutral.Z-= 0.02; |
} |
messanzahl_AccHoch = 1; |
Aktuell_az = ADC; |
Mess_Integral_Hoch += AdWertAccHoch; // Integrieren |
Mess_Integral_Hoch -= Mess_Integral_Hoch / 1024; // dämfen |
kanal = 3; |
break; |
case 10: |
tmpLuftdruck += ADC; |
if(++messanzahl_Druck >= 5) |
{ |
MessLuftdruck = ADC; |
messanzahl_Druck = 0; |
HoeheD = (int)(StartLuftdruck - tmpLuftdruck - HoehenWert); // D-Anteil = neuerWert - AlterWert |
Luftdruck = (tmpLuftdruck + 3 * Luftdruck) / 4; |
HoehenWert = StartLuftdruck - Luftdruck; |
tmpLuftdruck = 0; |
} |
kanal = 0; |
state = 0; |
break; |
default: |
kanal = 0; |
state = 0; |
break; |
} |
ADMUX = kanal; |
if(state != 0) ANALOG_ON; |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/analog.h |
---|
0,0 → 1,24 |
/*####################################################################################### |
#######################################################################################*/ |
extern volatile int UBat; |
extern volatile int AdWertNick, AdWertRoll, AdWertGier; |
extern volatile int AdWertAccRoll,AdWertAccNick,AdWertAccHoch; |
extern volatile int Aktuell_Nick,Aktuell_Roll,Aktuell_Gier,Aktuell_ax, Aktuell_ay,Aktuell_az; |
extern volatile long Luftdruck; |
extern volatile char messanzahl_Druck; |
extern volatile unsigned int ZaehlMessungen; |
extern unsigned char DruckOffsetSetting; |
extern volatile int HoeheD; |
extern volatile unsigned int MessLuftdruck; |
extern volatile int StartLuftdruck; |
extern volatile char MessanzahlNick; |
unsigned int ReadADC(unsigned char adc_input); |
void ADC_Init(void); |
void SucheLuftruckOffset(void); |
#define ANALOG_OFF ADCSRA=0 |
#define ANALOG_ON ADCSRA=(1<<ADEN)|(1<<ADSC)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0)|(1<<ADIE) |
/branches/v0.60_MicroMag3_Nick666/v0.66c/compass.c |
---|
0,0 → 1,243 |
/* |
Copyright 2007, Niklas Nold |
This program (files compass.c and compass.h) is free software; you can redistribute it and/or modify |
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; |
either version 3 of the License, or (at your option) any later version. |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de |
*/ |
#include "main.h" |
struct MM3_calib_struct ee_calib EEMEM; // Reservierung im EEPROM |
struct MM3_working_struct MM3; |
struct MM3_calib_struct MM3_calib; |
//############################################################################ |
// Initialisierung |
void init_MM3(void) |
//############################################################################ |
{ |
SPCR = (1<<SPIE)|(1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0); //Interrupt an, Master, 156 kHz Oszillator |
//SPSR = (1<<SPI2X); |
DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang |
PORTD &= ~(1<<PD3); // J5 auf Low |
MM3.AXIS = MM3_X; |
MM3.STATE = MM3_RESET; |
// Kalibrierung aus dem EEprom lesen |
eeprom_read_block(&MM3_calib,&ee_calib,sizeof(struct MM3_calib_struct)); |
} |
//############################################################################ |
// Wird in der SIGNAL (SIG_OVERFLOW0) aufgerufen |
void timer0_MM3(void) |
//############################################################################ |
{ |
switch (MM3.STATE) |
{ |
case MM3_RESET: |
PORTB |= (1<<PB2); // J8 auf High, MM3 Reset |
MM3.STATE = MM3_START_TRANSFER; |
return; |
case MM3_START_TRANSFER: |
PORTB &= ~(1<<PB2); // J8 auf Low (war ~125 µs auf High) |
if (MM3.AXIS == MM3_X) SPDR = 0x31; // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus |
else if (MM3.AXIS == MM3_Y) SPDR = 0x32; // Micromag Period Select ist auf 256 (0x30) |
else if (MM3.AXIS == MM3_Z) SPDR = 0x33; // 1: x-Achse, 2: Y-Achse, 3: Z-Achse |
MM3.DRDY = SetDelay(8); // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms) |
MM3.STATE = MM3_WAIT_DRDY; |
return; |
case MM3_WAIT_DRDY: |
if (CheckDelay(MM3.DRDY)) {SPDR = 0x00;MM3.STATE = MM3_DRDY;} // Irgendwas ins SPDR, damit Übertragung ausgelöst wird, wenn Wartezeit vorbei |
return; // Jetzt gehts weiter in SIGNAL (SIG_SPI) |
} |
} |
//############################################################################ |
// SPI byte ready |
SIGNAL (SIG_SPI) |
//############################################################################ |
{ |
static char tmp; |
int wert; |
switch (MM3.STATE) |
{ |
case MM3_DRDY: // 1. Byte ist da, zwischenspeichern |
tmp = SPDR; |
SPDR = 0x00; // Übertragung von 2. Byte auslösen |
MM3.STATE = MM3_BYTE2; |
return; |
case MM3_BYTE2: // 2. Byte der entsprechenden Achse ist da |
wert = tmp; |
wert <<= 8; // 1. Byte an MSB-Stelle rücken |
wert |= SPDR; // 2. Byte dranpappen |
if(abs(wert) < Max_Axis_Value) // Spikes filtern. Zuweisung nur, wenn Max-Wert nicht überschritten |
switch (MM3.AXIS) |
{ |
case MM3_X: |
MM3.x_axis = wert; |
MM3.AXIS = MM3_Y; |
break; |
case MM3_Y: |
MM3.y_axis = wert; |
MM3.AXIS = MM3_Z; |
break; |
case MM3_Z: |
MM3.z_axis = wert; |
MM3.AXIS = MM3_X; |
} |
MM3.STATE = MM3_RESET; |
} |
} |
//############################################################################ |
// Kompass kalibrieren |
void calib_MM3(void) |
//############################################################################ |
{ |
signed int x_min=0,x_max=0,y_min=0,y_max=0,z_min=0,z_max=0; |
uint8_t measurement=50,beeper=0; |
unsigned int timer; |
GRN_ON; |
ROT_OFF; |
while (measurement) |
{ |
//H_earth = MM3.x_axis*MM3.x_axis + MM3.y_axis*MM3.y_axis + MM3.z_axis*MM3.z_axis; |
if (MM3.x_axis > x_max) x_max = MM3.x_axis; |
else if (MM3.x_axis < x_min) x_min = MM3.x_axis; |
if (MM3.y_axis > y_max) y_max = MM3.y_axis; |
else if (MM3.y_axis < y_min) y_min = MM3.y_axis; |
if (MM3.z_axis > z_max) z_max = MM3.z_axis; |
else if (MM3.z_axis < z_min) z_min = MM3.z_axis; |
if (!beeper) |
{ |
ROT_FLASH; |
GRN_FLASH; |
beeptime = 50; |
beeper = 50; |
} |
beeper--; |
// Schleife mit 100 Hz |
timer = SetDelay(10); |
while(!CheckDelay(timer)); |
// Wenn Gas zurück genommen wird, Kalibrierung mit 1/2 Sekunde Verzögerung beenden |
if (PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] < 100) measurement--; |
} |
// Wertebereich der Achsen |
MM3_calib.X_range = (x_max - x_min); |
MM3_calib.Y_range = (y_max - y_min); |
MM3_calib.Z_range = (z_max - z_min); |
// Offset der Achsen |
MM3_calib.X_off = (x_max + x_min) / 2; |
MM3_calib.Y_off = (y_max + y_min) / 2; |
MM3_calib.Z_off = (z_max + z_min) / 2; |
// und im EEProm abspeichern |
eeprom_write_block(&MM3_calib,&ee_calib,sizeof(struct MM3_calib_struct)); |
} |
//############################################################################ |
// Neigungskompensierung und Berechnung der Ausrichtung |
signed int heading_MM3(void) |
//############################################################################ |
{ |
float sin_nick, cos_nick, sin_roll, cos_roll; |
float x_corr, y_corr; |
signed int x_axis,y_axis,z_axis,heading; |
signed int nicktilt,rolltilt; |
unsigned int div_faktor; |
div_faktor = (uint16_t)EE_Parameter.UserParam1 * 8; |
// Berechung von sinus und cosinus |
nicktilt = (IntegralNick/div_faktor); |
sin_nick = sin_f(nicktilt); |
cos_nick = cos_f(nicktilt); |
rolltilt = (IntegralRoll/div_faktor); |
sin_roll = sin_f(rolltilt); |
cos_roll = cos_f(rolltilt); |
// Offset |
x_axis = (MM3.x_axis - MM3_calib.X_off); |
y_axis = (MM3.y_axis - MM3_calib.Y_off); |
z_axis = (MM3.z_axis - MM3_calib.Z_off); |
// Normierung Wertebereich |
if ((MM3_calib.X_range > MM3_calib.Y_range) && (MM3_calib.X_range > MM3_calib.Z_range)) |
{ |
y_axis = ((long)y_axis * MM3_calib.X_range) / MM3_calib.Y_range; |
z_axis = ((long)z_axis * MM3_calib.X_range) / MM3_calib.Z_range; |
} |
else if ((MM3_calib.Y_range > MM3_calib.X_range) && (MM3_calib.Y_range > MM3_calib.Z_range)) |
{ |
x_axis = ((long)x_axis * MM3_calib.Y_range) / MM3_calib.X_range; |
z_axis = ((long)z_axis * MM3_calib.Y_range) / MM3_calib.Z_range; |
} |
else //if ((MM3_calib.Z_range > MM3_calib.X_range) && (MM3_calib.Z_range > MM3_calib.Y_range)) |
{ |
x_axis = ((long)x_axis * MM3_calib.Z_range) / MM3_calib.X_range; |
y_axis = ((long)y_axis * MM3_calib.Z_range) / MM3_calib.Y_range; |
} |
//DebugOut.Analog[9] = x_axis; |
//DebugOut.Analog[10] = y_axis; |
//DebugOut.Analog[11] = z_axis; |
// Neigungskompensation |
x_corr = x_axis * cos_nick; |
x_corr += y_axis * sin_roll * sin_nick; |
x_corr -= z_axis * cos_roll * sin_nick; |
y_corr = y_axis * cos_roll; |
y_corr += z_axis * sin_roll; |
// Winkelberechnung |
heading = atan2_i(x_corr, y_corr); |
if (heading < 0) heading = -heading; |
else heading = 360 - heading; |
/* |
if (!x_corr && y_corr <0) return (90); |
if (!x_corr && y_corr >0) return (270); |
heading = atan(y_corr/x_corr)*57.29578; |
if (x_corr < 0) heading = 180-heading; |
if (x_corr > 0 && y_corr < 0) heading = -heading; |
if (x_corr > 0 && y_corr > 0) heading = 360 - heading; |
*/ |
return (heading); |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/compass.h |
---|
0,0 → 1,44 |
struct MM3_working_struct |
{ |
uint8_t STATE; |
unsigned int DRDY; |
uint8_t AXIS; |
volatile signed int x_axis; |
volatile signed int y_axis; |
volatile signed int z_axis; |
}; |
struct MM3_calib_struct |
{ |
int8_t X_off; |
int8_t Y_off; |
int8_t Z_off; |
uint16_t X_range; |
uint16_t Y_range; |
uint16_t Z_range; |
}; |
extern struct MM3_working_struct MM3; |
extern struct MM3_calib_struct MM3_calib; |
void init_MM3(void); |
void timer0_MM3(void); |
void calib_MM3(void); |
signed int heading_MM3(void); |
#define Max_Axis_Value 500 |
// Die Werte der Statemachine |
#define MM3_RESET 0 |
#define MM3_START_TRANSFER 1 |
#define MM3_WAIT_DRDY 2 |
#define MM3_DRDY 3 |
#define MM3_BYTE2 4 |
#define MM3_X 5 |
#define MM3_Y 6 |
#define MM3_Z 7 |
#define MM3_TILT 8 |
#define MM3_IDLE 9 |
/branches/v0.60_MicroMag3_Nick666/v0.66c/eeprom.c |
---|
0,0 → 1,165 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Konstanten |
// + 0-250 -> normale Werte |
// + 251 -> Poti1 |
// + 252 -> Poti2 |
// + 253 -> Poti3 |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
void DefaultKonstanten1(void) |
{ |
EE_Parameter.Kanalbelegung[K_NICK] = 1; |
EE_Parameter.Kanalbelegung[K_ROLL] = 2; |
EE_Parameter.Kanalbelegung[K_GAS] = 3; |
EE_Parameter.Kanalbelegung[K_GIER] = 4; |
EE_Parameter.Kanalbelegung[K_POTI1] = 5; |
EE_Parameter.Kanalbelegung[K_POTI2] = 6; |
EE_Parameter.Kanalbelegung[K_POTI3] = 7; |
EE_Parameter.Kanalbelegung[K_POTI4] = 8; |
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV;//CFG_HOEHENREGELUNG | /*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV | CFG_KOMPASS_FIX;//0x01; |
EE_Parameter.Hoehe_MinGas = 30; |
EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1 |
EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
EE_Parameter.Luftdruck_D = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_Verstaerkung = 4; // Wert : 0-50 |
EE_Parameter.Stick_P = 4; //2 // Wert : 1-6 |
EE_Parameter.Stick_D = 8; //8 // Wert : 0-64 |
EE_Parameter.Gier_P = 14; // Wert : 1-20 |
EE_Parameter.Gas_Min = 15; // Wert : 0-32 |
EE_Parameter.Gas_Max = 250; // Wert : 33-250 |
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64 |
EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
EE_Parameter.Gyro_P = 120; //80 // Wert : 0-250 |
EE_Parameter.Gyro_I = 150; // Wert : 0-250 |
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250 |
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
EE_Parameter.I_Faktor = 0; |
EE_Parameter.UserParam1 = 178; //zur freien Verwendung |
EE_Parameter.UserParam2 = 0; //zur freien Verwendung |
EE_Parameter.UserParam3 = 0; //zur freien Verwendung |
EE_Parameter.UserParam4 = 0; //zur freien Verwendung |
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickRefresh = 5; |
EE_Parameter.LoopGasLimit = 50; |
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
EE_Parameter.LoopHysterese = 50; |
EE_Parameter.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
EE_Parameter.AchsKopplung1 = 100; |
EE_Parameter.AchsGegenKopplung1 = 70; |
EE_Parameter.WinkelUmschlagNick = 100; |
EE_Parameter.WinkelUmschlagRoll = 100; |
EE_Parameter.GyroAccAbgleich = 10; // 1/k |
memcpy(EE_Parameter.Name, "Sport\0", 12); |
} |
void DefaultKonstanten2(void) |
{ |
EE_Parameter.Kanalbelegung[K_NICK] = 1; |
EE_Parameter.Kanalbelegung[K_ROLL] = 2; |
EE_Parameter.Kanalbelegung[K_GAS] = 3; |
EE_Parameter.Kanalbelegung[K_GIER] = 4; |
EE_Parameter.Kanalbelegung[K_POTI1] = 5; |
EE_Parameter.Kanalbelegung[K_POTI2] = 6; |
EE_Parameter.Kanalbelegung[K_POTI3] = 7; |
EE_Parameter.Kanalbelegung[K_POTI4] = 8; |
EE_Parameter.GlobalConfig = CFG_ACHSENKOPPLUNG_AKTIV;//CFG_HOEHENREGELUNG | /*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV;//0x01; |
EE_Parameter.Hoehe_MinGas = 30; |
EE_Parameter.MaxHoehe = 251; // Wert : 0-250 251 -> Poti1 |
EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
EE_Parameter.Luftdruck_D = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50 |
EE_Parameter.Stick_P = 4; //2 // Wert : 1-6 |
EE_Parameter.Stick_D = 0; //8 // Wert : 0-64 |
EE_Parameter.Gier_P = 10; // Wert : 1-20 |
EE_Parameter.Gas_Min = 15; // Wert : 0-32 |
EE_Parameter.Gas_Max = 250; // Wert : 33-250 |
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64 |
EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
EE_Parameter.Gyro_P = 175; //80 // Wert : 0-250 |
EE_Parameter.Gyro_I = 175; // Wert : 0-250 |
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250 |
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
EE_Parameter.I_Faktor = 0; |
EE_Parameter.UserParam1 = 178; // zur freien Verwendung |
EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
EE_Parameter.UserParam3 = 0; // zur freien Verwendung |
EE_Parameter.UserParam4 = 0; // zur freien Verwendung |
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickRefresh = 5; |
EE_Parameter.LoopGasLimit = 50; |
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
EE_Parameter.LoopHysterese = 50; |
EE_Parameter.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
EE_Parameter.AchsKopplung1 = 100; // Faktor, mit dem Gier die Achsen Roll und Nick verkoppelt |
EE_Parameter.AchsGegenKopplung1 = 80; |
EE_Parameter.WinkelUmschlagNick = 100; |
EE_Parameter.WinkelUmschlagRoll = 100; |
EE_Parameter.GyroAccAbgleich = 16; // 1/k |
memcpy(EE_Parameter.Name, "Kamera\0", 12); |
} |
void DefaultKonstanten3(void) |
{ |
EE_Parameter.Kanalbelegung[K_NICK] = 1; |
EE_Parameter.Kanalbelegung[K_ROLL] = 2; |
EE_Parameter.Kanalbelegung[K_GAS] = 3; |
EE_Parameter.Kanalbelegung[K_GIER] = 4; |
EE_Parameter.Kanalbelegung[K_POTI1] = 5; |
EE_Parameter.Kanalbelegung[K_POTI2] = 6; |
EE_Parameter.Kanalbelegung[K_POTI3] = 7; |
EE_Parameter.Kanalbelegung[K_POTI4] = 8; |
EE_Parameter.GlobalConfig = CFG_HOEHENREGELUNG | CFG_DREHRATEN_BEGRENZER | CFG_ACHSENKOPPLUNG_AKTIV;///*CFG_HOEHEN_SCHALTER |*/ CFG_KOMPASS_AKTIV;//0x01; |
EE_Parameter.Hoehe_MinGas = 30; |
EE_Parameter.MaxHoehe = 100; // Wert : 0-250 251 -> Poti1 |
EE_Parameter.Hoehe_P = 10; // Wert : 0-32 |
EE_Parameter.Luftdruck_D = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_ACC_Wirkung = 50; // Wert : 0-250 |
EE_Parameter.Hoehe_Verstaerkung = 2; // Wert : 0-50 |
EE_Parameter.Stick_P = 3; //2 // Wert : 1-6 |
EE_Parameter.Stick_D = 0; //8 // Wert : 0-64 |
EE_Parameter.Gier_P = 8; // Wert : 1-20 |
EE_Parameter.Gas_Min = 15; // Wert : 0-32 |
EE_Parameter.Gas_Max = 250; // Wert : 33-250 |
EE_Parameter.GyroAccFaktor = 26; // Wert : 1-64 |
EE_Parameter.KompassWirkung = 128; // Wert : 0-250 |
EE_Parameter.Gyro_P = 200; //80 // Wert : 0-250 |
EE_Parameter.Gyro_I = 175; // Wert : 0-250 |
EE_Parameter.UnterspannungsWarnung = 94; // Wert : 0-250 |
EE_Parameter.NotGas = 35; // Wert : 0-250 // Gaswert bei Empangsverlust |
EE_Parameter.NotGasZeit = 20; // Wert : 0-250 // Zeit bis auf NotGas geschaltet wird, wg. Rx-Problemen |
EE_Parameter.UfoAusrichtung = 0; // X oder + Formation |
EE_Parameter.I_Faktor = 0; |
EE_Parameter.UserParam1 = 178; // zur freien Verwendung |
EE_Parameter.UserParam2 = 0; // zur freien Verwendung |
EE_Parameter.UserParam3 = 0; // zur freien Verwendung |
EE_Parameter.UserParam4 = 0; // zur freien Verwendung |
EE_Parameter.ServoNickControl = 100; // Wert : 0-250 // Stellung des Servos |
EE_Parameter.ServoNickComp = 40; // Wert : 0-250 // Einfluss Gyro/Servo |
EE_Parameter.ServoNickCompInvert = 0; // Wert : 0-250 // Richtung Einfluss Gyro/Servo |
EE_Parameter.ServoNickMin = 50; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickMax = 150; // Wert : 0-250 // Anschlag |
EE_Parameter.ServoNickRefresh = 5; |
EE_Parameter.LoopGasLimit = 50; |
EE_Parameter.LoopThreshold = 90; // Wert: 0-250 Schwelle für Stickausschlag |
EE_Parameter.LoopHysterese = 50; |
EE_Parameter.LoopConfig = 0; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts |
EE_Parameter.AchsKopplung1 = 100; // Faktor, mit dem Gier die Achsen Roll und Nick verkoppelt |
EE_Parameter.AchsGegenKopplung1 = 80; |
EE_Parameter.WinkelUmschlagNick = 100; |
EE_Parameter.WinkelUmschlagRoll = 100; |
EE_Parameter.GyroAccAbgleich = 16; // 1/k |
memcpy(EE_Parameter.Name, "Beginner\0", 12); |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/eeprom.d |
---|
0,0 → 1,0 |
eeprom.o eeprom.d : eeprom.c |
/branches/v0.60_MicroMag3_Nick666/v0.66c/eeprom.h |
---|
--- v0.66c/fc.c (nonexistent) |
+++ v0.66c/fc.c (revision 512) |
@@ -0,0 +1,1060 @@ |
+/*####################################################################################### |
+Flight Control |
+#######################################################################################*/ |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Copyright (c) 04.2007 Holger Buss |
+// + Nur für den privaten Gebrauch |
+// + www.MikroKopter.com |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
+// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
+// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
+// + bzgl. der Nutzungsbedingungen aufzunehmen. |
+// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
+// + Verkauf von Luftbildaufnahmen, usw. |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
+// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
+// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
+// + eindeutig als Ursprung verlinkt werden |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
+// + Benutzung auf eigene Gefahr |
+// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
+// + mit unserer Zustimmung zulässig |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
+// + this list of conditions and the following disclaimer. |
+// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
+// + from this software without specific prior written permission. |
+// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
+// + for non-commercial use (directly or indirectly) |
+// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
+// + with our written permission |
+// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
+// + clearly linked as origin |
+// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
+// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
+// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
+// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
+// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
+// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
+// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
+// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
+// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
+// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
+// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
+// + POSSIBILITY OF SUCH DAMAGE. |
+// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ |
+#include "main.h" |
+#include "eeprom.c" |
+ |
+unsigned char h,m,s; |
+volatile unsigned int I2CTimeout = 100; |
+int MesswertNick,MesswertRoll,MesswertGier; |
+int AdNeutralNick = 0,AdNeutralRoll = 0,AdNeutralGier = 0, StartNeutralRoll = 0, StartNeutralNick = 0; |
+int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch; |
+ |
+long IntegralNick = 0,IntegralNick2 = 0; |
+long IntegralRoll = 0,IntegralRoll2 = 0; |
+long IntegralAccNick = 0,IntegralAccRoll = 0,IntegralAccZ = 0; |
+long Integral_Gier = 0; |
+volatile long Mess_IntegralNick = 0,Mess_IntegralNick2 = 0; |
+volatile long Mess_IntegralRoll = 0,Mess_IntegralRoll2 = 0; |
+volatile long Mess_Integral_Gier = 0,Mess_Integral_Gier2 = 0; |
+volatile long MittelIntegralNick,MittelIntegralRoll,MittelIntegralNick2,MittelIntegralRoll2; |
+volatile long Mess_Integral_Hoch = 0; |
+int KompassValue = 0; |
+int KompassStartwert = 0; |
+int KompassRichtung = 0; |
+uint8_t updKompass = 0; |
+unsigned char MAX_GAS,MIN_GAS; |
+unsigned char Notlandung = 0; |
+unsigned char HoehenReglerAktiv = 0; |
+long Umschlag180Nick = 250000L, Umschlag180Roll = 250000L; |
+ |
+float GyroFaktor; |
+float IntegralFaktor; |
+ |
+int DiffNick,DiffRoll; |
+int Poti1 = 0, Poti2 = 0, Poti3 = 0, Poti4 = 0; |
+volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
+unsigned char MotorWert[5]; |
+volatile unsigned char SenderOkay = 0; |
+int StickNick = 0,StickRoll = 0,StickGier = 0; |
+char MotorenEin = 0; |
+int HoehenWert = 0; |
+int SollHoehe = 0; |
+int I_LageRoll = 0,I_LageNick = 0; |
+float Kp = FAKTOR_P; |
+float Ki = FAKTOR_I; |
+unsigned char Looping_Nick = 0,Looping_Roll = 0; |
+unsigned char Looping_Links = 0, Looping_Rechts = 0, Looping_Unten = 0, Looping_Oben = 0; |
+ |
+unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250 |
+unsigned char Parameter_MaxHoehe = 251; // Wert : 0-250 |
+unsigned char Parameter_Hoehe_P = 16; // Wert : 0-32 |
+unsigned char Parameter_Hoehe_ACC_Wirkung = 58; // Wert : 0-250 |
+unsigned char Parameter_KompassWirkung = 64; // Wert : 0-250 |
+unsigned char Parameter_Gyro_P = 150; // Wert : 10-250 |
+unsigned char Parameter_Gyro_I = 150; // Wert : 0-250 |
+unsigned char Parameter_Gier_P = 2; // Wert : 1-20 |
+unsigned char Parameter_I_Faktor = 10; // Wert : 1-20 |
+unsigned char Parameter_UserParam1 = 0; |
+unsigned char Parameter_UserParam2 = 0; |
+unsigned char Parameter_UserParam3 = 0; |
+unsigned char Parameter_UserParam4 = 0; |
+unsigned char Parameter_ServoNickControl = 100; |
+unsigned char Parameter_LoopGasLimit = 70; |
+unsigned char Parameter_AchsKopplung1 = 0; |
+unsigned char Parameter_AchsGegenKopplung1 = 0; |
+ |
+struct mk_param_struct EE_Parameter; |
+struct acc_neutral_struct ee_acc_neutral EEMEM; // Reservierung im EEPROM |
+struct acc_neutral_struct acc_neutral; |
+ |
+ |
+ |
+void Piep(unsigned char Anzahl) |
+{ |
+ while(Anzahl--) |
+ { |
+ if(MotorenEin) return; //auf keinen Fall im Flug! |
+ beeptime = 100; |
+ Delay_ms(250); |
+ } |
+} |
+ |
+//############################################################################ |
+// Neutrallage kalibrieren und fest im EEPROM abspeichern |
+void calib_acc(void) |
+//############################################################################ |
+{ |
+ acc_neutral.X = 0; |
+ acc_neutral.Y = 0; |
+ acc_neutral.Z = 0; |
+ CalibrierMittelwert(); |
+ Delay_ms_Mess(100); |
+ CalibrierMittelwert(); |
+ |
+ acc_neutral.X = abs(Mittelwert_AccNick) / ACC_AMPLIFY; |
+ acc_neutral.Y = abs(Mittelwert_AccRoll) / ACC_AMPLIFY; |
+ acc_neutral.Z = Aktuell_az; |
+ |
+ eeprom_write_block(&acc_neutral,&ee_acc_neutral,sizeof(struct acc_neutral_struct)); |
+} |
+ |
+//############################################################################ |
+// Nullwerte ermitteln |
+void SetNeutral(void) |
+//############################################################################ |
+{ |
+ acc_neutral.X = 0; |
+ acc_neutral.Y = 0; |
+ acc_neutral.Z = 0; |
+ AdNeutralNick = 0; |
+ AdNeutralRoll = 0; |
+ AdNeutralGier = 0; |
+ Parameter_AchsKopplung1 = 0; |
+ Parameter_AchsGegenKopplung1 = 0; |
+ CalibrierMittelwert(); |
+ Delay_ms_Mess(100); |
+ CalibrierMittelwert(); |
+ if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
+ { |
+ if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
+ } |
+ |
+ AdNeutralNick= AdWertNick; |
+ AdNeutralRoll= AdWertRoll; |
+ AdNeutralGier= AdWertGier; |
+ StartNeutralRoll = AdNeutralRoll; |
+ StartNeutralNick = AdNeutralNick; |
+ |
+ eeprom_read_block(&acc_neutral,&ee_acc_neutral,sizeof(struct acc_neutral_struct)); |
+ |
+ Mess_IntegralNick = 0; |
+ Mess_IntegralNick2 = 0; |
+ Mess_IntegralRoll = 0; |
+ Mess_IntegralRoll2 = 0; |
+ Mess_Integral_Gier = 0; |
+ MesswertNick = 0; |
+ MesswertRoll = 0; |
+ MesswertGier = 0; |
+ StartLuftdruck = Luftdruck; |
+ HoeheD = 0; |
+ Mess_Integral_Hoch = 0; |
+ KompassStartwert = KompassValue; |
+ GPS_Neutral(); |
+ beeptime = 50; |
+ Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
+ Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
+} |
+ |
+//############################################################################ |
+// Bearbeitet die Messwerte |
+void Mittelwert(void) |
+//############################################################################ |
+{ |
+ static signed long tmpl,tmpl2; |
+ MesswertGier = (signed int) AdNeutralGier - AdWertGier; |
+ MesswertRoll = (signed int) AdWertRoll - AdNeutralRoll; |
+ MesswertNick = (signed int) AdWertNick - AdNeutralNick; |
+ |
+// Beschleunigungssensor ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ Mittelwert_AccNick = ((long)Mittelwert_AccNick * 1 + ((ACC_AMPLIFY * (long)AdWertAccNick))) / 2L; |
+ Mittelwert_AccRoll = ((long)Mittelwert_AccRoll * 1 + ((ACC_AMPLIFY * (long)AdWertAccRoll))) / 2L; |
+ Mittelwert_AccHoch = ((long)Mittelwert_AccHoch * 1 + ((long)AdWertAccHoch)) / 2L; |
+ IntegralAccNick += ACC_AMPLIFY * AdWertAccNick; |
+ IntegralAccRoll += ACC_AMPLIFY * AdWertAccRoll; |
+ IntegralAccZ += Aktuell_az - 704;//acc_neutral.Z; |
+// Gier ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ Mess_Integral_Gier += MesswertGier; |
+ Mess_Integral_Gier2 += MesswertGier; |
+// Kopplungsanteil +++++++++++++++++++++++++++++++++++++ |
+ if(!Looping_Nick && !Looping_Roll && (EE_Parameter.GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) |
+ { |
+ tmpl = Mess_IntegralNick / 4096L; |
+ tmpl *= MesswertGier; |
+ tmpl *= Parameter_AchsKopplung1; //125 |
+ tmpl /= 2048L; |
+ tmpl2 = Mess_IntegralRoll / 4096L; |
+ tmpl2 *= MesswertGier; |
+ tmpl2 *= Parameter_AchsKopplung1; |
+ tmpl2 /= 2048L; |
+ } |
+ else tmpl = tmpl2 = 0; |
+// Roll ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ MesswertRoll += tmpl; |
+ MesswertRoll += (tmpl2*Parameter_AchsGegenKopplung1)/512L; //109 |
+ Mess_IntegralRoll2 += MesswertRoll; |
+ Mess_IntegralRoll += MesswertRoll - I_LageRoll; |
+ if(Mess_IntegralRoll > Umschlag180Roll) |
+ { |
+ Mess_IntegralRoll = -(Umschlag180Roll - 10000L); |
+ Mess_IntegralRoll2 = Mess_IntegralRoll; |
+ } |
+ if(Mess_IntegralRoll <-Umschlag180Roll) |
+ { |
+ Mess_IntegralRoll = (Umschlag180Roll - 10000L); |
+ Mess_IntegralRoll2 = Mess_IntegralRoll; |
+ } |
+ if(AdWertRoll < 15) MesswertRoll = -1000; |
+ if(AdWertRoll < 7) MesswertRoll = -2000; |
+ if(PlatinenVersion == 10) |
+ { |
+ if(AdWertRoll > 1010) MesswertRoll = +1000; |
+ if(AdWertRoll > 1017) MesswertRoll = +2000; |
+ } |
+ else |
+ { |
+ if(AdWertRoll > 2020) MesswertRoll = +1000; |
+ if(AdWertRoll > 2034) MesswertRoll = +2000; |
+ } |
+// Nick ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ MesswertNick -= tmpl2; |
+ MesswertNick -= (tmpl*Parameter_AchsGegenKopplung1)/512L; |
+ Mess_IntegralNick2 += MesswertNick; |
+ Mess_IntegralNick += MesswertNick - I_LageNick; |
+ if(Mess_IntegralNick > Umschlag180Nick) |
+ { |
+ Mess_IntegralNick = -(Umschlag180Nick - 10000L); |
+ Mess_IntegralNick2 = Mess_IntegralNick; |
+ } |
+ if(Mess_IntegralNick <-Umschlag180Nick) |
+ { |
+ Mess_IntegralNick = (Umschlag180Nick - 10000L); |
+ Mess_IntegralNick2 = Mess_IntegralNick; |
+ } |
+ if(AdWertNick < 15) MesswertNick = -1000; |
+ if(AdWertNick < 7) MesswertNick = -2000; |
+ if(PlatinenVersion == 10) |
+ { |
+ if(AdWertNick > 1010) MesswertNick = +1000; |
+ if(AdWertNick > 1017) MesswertNick = +2000; |
+ } |
+ else |
+ { |
+ if(AdWertNick > 2020) MesswertNick = +1000; |
+ if(AdWertNick > 2034) MesswertNick = +2000; |
+ } |
+//++++++++++++++++++++++++++++++++++++++++++++++++ |
+// ADC einschalten |
+ ANALOG_ON; |
+//++++++++++++++++++++++++++++++++++++++++++++++++ |
+DebugOut.Analog[11] = MesswertRoll; |
+ |
+ Integral_Gier = Mess_Integral_Gier; |
+ IntegralNick = Mess_IntegralNick; |
+ IntegralRoll = Mess_IntegralRoll; |
+ IntegralNick2 = Mess_IntegralNick2; |
+ IntegralRoll2 = Mess_IntegralRoll2; |
+ |
+ if(EE_Parameter.GlobalConfig & CFG_DREHRATEN_BEGRENZER && !Looping_Nick && !Looping_Roll) |
+ { |
+ if(MesswertNick > 200) MesswertNick += 4 * (MesswertNick - 200); |
+ else if(MesswertNick < -200) MesswertNick += 4 * (MesswertNick + 200); |
+ if(MesswertRoll > 200) MesswertRoll += 4 * (MesswertRoll - 200); |
+ else if(MesswertRoll < -200) MesswertRoll += 4 * (MesswertRoll + 200); |
+ } |
+ if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--; |
+ if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--; |
+ if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--; |
+ if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--; |
+ if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255; |
+ if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255; |
+ if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255; |
+ if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255; |
+} |
+ |
+//############################################################################ |
+// Messwerte beim Ermitteln der Nullage |
+void CalibrierMittelwert(void) |
+//############################################################################ |
+{ |
+ // ADC auschalten, damit die Werte sich nicht während der Berechnung ändern |
+ ANALOG_OFF; |
+ MesswertNick = AdWertNick; |
+ MesswertRoll = AdWertRoll; |
+ MesswertGier = AdWertGier; |
+ Mittelwert_AccNick = ACC_AMPLIFY * (long)AdWertAccNick; |
+ Mittelwert_AccRoll = ACC_AMPLIFY * (long)AdWertAccRoll; |
+ Mittelwert_AccHoch = (long)AdWertAccHoch; |
+ // ADC einschalten |
+ ANALOG_ON; |
+ if(Poti1 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110) Poti1++; else if(Poti1 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]] + 110 && Poti1) Poti1--; |
+ if(Poti2 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110) Poti2++; else if(Poti2 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]] + 110 && Poti2) Poti2--; |
+ if(Poti3 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110) Poti3++; else if(Poti3 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]] + 110 && Poti3) Poti3--; |
+ if(Poti4 < PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110) Poti4++; else if(Poti4 > PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]] + 110 && Poti4) Poti4--; |
+ if(Poti1 < 0) Poti1 = 0; else if(Poti1 > 255) Poti1 = 255; |
+ if(Poti2 < 0) Poti2 = 0; else if(Poti2 > 255) Poti2 = 255; |
+ if(Poti3 < 0) Poti3 = 0; else if(Poti3 > 255) Poti3 = 255; |
+ if(Poti4 < 0) Poti4 = 0; else if(Poti4 > 255) Poti4 = 255; |
+ |
+ Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
+ Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
+} |
+ |
+//############################################################################ |
+// Senden der Motorwerte per I2C-Bus |
+void SendMotorData(void) |
+//############################################################################ |
+{ |
+ if(MOTOR_OFF || !MotorenEin) |
+ { |
+ Motor_Hinten = 0; |
+ Motor_Vorne = 0; |
+ Motor_Rechts = 0; |
+ Motor_Links = 0; |
+ if(MotorTest[0]) Motor_Vorne = MotorTest[0]; |
+ if(MotorTest[1]) Motor_Hinten = MotorTest[1]; |
+ if(MotorTest[2]) Motor_Links = MotorTest[2]; |
+ if(MotorTest[3]) Motor_Rechts = MotorTest[3]; |
+ } |
+ |
+ DebugOut.Analog[12] = Motor_Vorne; |
+ DebugOut.Analog[13] = Motor_Hinten; |
+ DebugOut.Analog[14] = Motor_Links; |
+ DebugOut.Analog[15] = Motor_Rechts; |
+ |
+ //Start I2C Interrupt Mode |
+ twi_state = 0; |
+ motor = 0; |
+ i2c_start(); |
+} |
+ |
+ |
+ |
+//############################################################################ |
+// Trägt ggf. das Poti als Parameter ein |
+void ParameterZuordnung(void) |
+//############################################################################ |
+{ |
+ |
+ #define CHK_POTI(b,a,min,max) { if(a > 250) { if(a == 251) b = Poti1; else if(a == 252) b = Poti2; else if(a == 253) b = Poti3; else if(a == 254) b = Poti4;} else b = a; if(b <= min) b = min; else if(b >= max) b = max;} |
+ CHK_POTI(Parameter_MaxHoehe,EE_Parameter.MaxHoehe,0,255); |
+ CHK_POTI(Parameter_Luftdruck_D,EE_Parameter.Luftdruck_D,0,100); |
+ CHK_POTI(Parameter_Hoehe_P,EE_Parameter.Hoehe_P,0,100); |
+ CHK_POTI(Parameter_Hoehe_ACC_Wirkung,EE_Parameter.Hoehe_ACC_Wirkung,0,255); |
+ CHK_POTI(Parameter_KompassWirkung,EE_Parameter.KompassWirkung,0,255); |
+ CHK_POTI(Parameter_Gyro_P,EE_Parameter.Gyro_P,10,255); |
+ CHK_POTI(Parameter_Gyro_I,EE_Parameter.Gyro_I,0,255); |
+ CHK_POTI(Parameter_I_Faktor,EE_Parameter.I_Faktor,0,255); |
+ CHK_POTI(Parameter_UserParam1,EE_Parameter.UserParam1,0,255); |
+ CHK_POTI(Parameter_UserParam2,EE_Parameter.UserParam2,0,255); |
+ CHK_POTI(Parameter_UserParam3,EE_Parameter.UserParam3,0,255); |
+ CHK_POTI(Parameter_UserParam4,EE_Parameter.UserParam4,0,255); |
+ CHK_POTI(Parameter_ServoNickControl,EE_Parameter.ServoNickControl,0,255); |
+ CHK_POTI(Parameter_LoopGasLimit,EE_Parameter.LoopGasLimit,0,255); |
+ CHK_POTI(Parameter_AchsKopplung1, EE_Parameter.AchsKopplung1,0,255); |
+ CHK_POTI(Parameter_AchsGegenKopplung1,EE_Parameter.AchsGegenKopplung1,0,255); |
+ |
+ Ki = (float) Parameter_I_Faktor * 0.0001; |
+ MAX_GAS = EE_Parameter.Gas_Max; |
+ MIN_GAS = EE_Parameter.Gas_Min; |
+} |
+ |
+ |
+//############################################################################ |
+// |
+void MotorRegler(void) |
+//############################################################################ |
+{ |
+ int motorwert,pd_ergebnis,h,tmp_int; |
+ int GierMischanteil,GasMischanteil; |
+ static long SummeNick=0,SummeRoll=0; |
+ static long sollGier = 0,tmp_long,tmp_long2; |
+ static long IntegralFehlerNick = 0; |
+ static long IntegralFehlerRoll = 0; |
+ static unsigned int RcLostTimer; |
+ static unsigned char delay_neutral = 0; |
+ static unsigned char delay_einschalten = 0,delay_ausschalten = 0; |
+ static unsigned int modell_fliegt = 0; |
+ static int hoehenregler = 0; |
+ static char TimerWerteausgabe = 0; |
+ static char NeueKompassRichtungMerken = 1; |
+ static long ausgleichNick, ausgleichRoll; |
+ |
+ Mittelwert(); |
+ |
+ GRN_ON; |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Gaswert ermitteln |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ GasMischanteil = PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] + 120; |
+ if(GasMischanteil < 0) GasMischanteil = 0; |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Emfang schlecht |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(SenderOkay < 100) |
+ { |
+ if(!PcZugriff) |
+ { |
+ if(BeepMuster == 0xffff) |
+ { |
+ beeptime = 15000; |
+ BeepMuster = 0x0c00; |
+ } |
+ } |
+ if(RcLostTimer) RcLostTimer--; |
+ else |
+ { |
+ MotorenEin = 0; |
+ Notlandung = 0; |
+ } |
+ ROT_ON; |
+ if(modell_fliegt > 2000) // wahrscheinlich in der Luft --> langsam absenken |
+ { |
+ GasMischanteil = EE_Parameter.NotGas; |
+ Notlandung = 1; |
+ PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] = 0; |
+ PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] = 0; |
+ PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] = 0; |
+ } |
+ else MotorenEin = 0; |
+ } |
+ else |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Emfang gut |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(SenderOkay > 140) |
+ { |
+ Notlandung = 0; |
+ RcLostTimer = EE_Parameter.NotGasZeit * 50; |
+ if(GasMischanteil > 40) |
+ { |
+ if(modell_fliegt < 0xffff) modell_fliegt++; |
+ } |
+ if((modell_fliegt < 200) || (GasMischanteil < 40)) |
+ { |
+ SummeNick = 0; |
+ SummeRoll = 0; |
+ Mess_Integral_Gier = 0; |
+ Mess_Integral_Gier2 = 0; |
+ } |
+ if((GasMischanteil > 200) && MotorenEin == 0) |
+ { |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// auf Nullwerte kalibrieren |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) // Neutralwerte |
+ { |
+ if(++delay_neutral > 200) // nicht sofort |
+ { |
+ GRN_OFF; |
+ MotorenEin = 0; |
+ delay_neutral = 0; |
+ modell_fliegt = 0; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70 || abs(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]) > 70) |
+ { |
+ unsigned char setting=1; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 1; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 2; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < 70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 3; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > 70) setting = 4; |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] <-70 && PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < 70) setting = 5; |
+ eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], setting); // aktiven Datensatz merken |
+ } |
+ if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung aktiviert? |
+ { |
+ if((MessLuftdruck > 950) || (MessLuftdruck < 750)) SucheLuftruckOffset(); |
+ } |
+ ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
+ SetNeutral(); |
+ Piep(GetActiveParamSetNumber()); |
+ } |
+ } |
+ else delay_neutral = 0; |
+ } |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Gas ist unten |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(GasMischanteil < 35) |
+ { |
+ // Starten |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -75) |
+ { |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Einschalten |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(++delay_einschalten > 200) |
+ { |
+ delay_einschalten = 200; |
+ modell_fliegt = 1; |
+ MotorenEin = 1; |
+ sollGier = 0; |
+ Mess_Integral_Gier = 0; |
+ Mess_Integral_Gier2 = 0; |
+ Mess_IntegralNick = 0; |
+ Mess_IntegralRoll = 0; |
+ Mess_IntegralNick2 = IntegralNick; |
+ Mess_IntegralRoll2 = IntegralRoll; |
+ SummeNick = 0; |
+ SummeRoll = 0; |
+ } |
+ } |
+ else delay_einschalten = 0; |
+ //Auf Neutralwerte setzen |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Auschalten |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 75) |
+ { |
+ if(++delay_ausschalten > 200) // nicht sofort |
+ { |
+ MotorenEin = 0; |
+ delay_ausschalten = 200; |
+ modell_fliegt = 0; |
+ } |
+ } |
+ else delay_ausschalten = 0; |
+ } |
+ } |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// neue Werte von der Funke |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(!NewPpmData-- || Notlandung) |
+ { |
+ ParameterZuordnung(); |
+ StickNick = PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_P; |
+ StickNick += PPM_diff[EE_Parameter.Kanalbelegung[K_NICK]] * EE_Parameter.Stick_D; |
+ StickRoll = PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_P; |
+ StickRoll += PPM_diff[EE_Parameter.Kanalbelegung[K_ROLL]] * EE_Parameter.Stick_D; |
+ StickGier = -PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]; |
+ GyroFaktor = ((float)Parameter_Gyro_P + 10.0) / 256.0; |
+ IntegralFaktor = ((float) Parameter_Gyro_I) / 44000; |
+ |
+ if(EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) IntegralFaktor = 0; |
+ if(GyroFaktor < 0) GyroFaktor = 0; |
+ if(IntegralFaktor < 0) IntegralFaktor = 0; |
+ // greift in den Stick ein, um ungewolltes überschlagen zu verhindern |
+ if(!(EE_Parameter.LoopConfig & CFG_LOOP_LINKS) && !(EE_Parameter.LoopConfig & CFG_LOOP_RECHTS)) |
+ { |
+ if(IntegralNick > 60000) |
+ { |
+ StickNick -= 8 * EE_Parameter.Stick_P; |
+ if(IntegralNick > 80000) StickNick -= 16 * EE_Parameter.Stick_P; |
+ } |
+ else |
+ if(IntegralNick < -60000) |
+ { |
+ StickNick += 8 * EE_Parameter.Stick_P; |
+ if(IntegralNick > 80000) StickNick -= 16 * EE_Parameter.Stick_P; |
+ } |
+ if(IntegralRoll > 60000) |
+ { |
+ StickRoll -= 8 * EE_Parameter.Stick_P; |
+ if(IntegralRoll > 80000) StickRoll -= 16 * EE_Parameter.Stick_P; |
+ } |
+ else |
+ if(IntegralRoll < -60000) |
+ { |
+ StickRoll += 8 * EE_Parameter.Stick_P; |
+ if(IntegralRoll > 80000) StickRoll -= 16 * EE_Parameter.Stick_P; |
+ } |
+ } |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Looping? |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > EE_Parameter.LoopThreshold) && EE_Parameter.LoopConfig & CFG_LOOP_LINKS) Looping_Links = 1; |
+ else |
+ { |
+ { |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Links = 0; |
+ } |
+ } |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] < -EE_Parameter.LoopThreshold) && EE_Parameter.LoopConfig & CFG_LOOP_RECHTS) Looping_Rechts = 1; |
+ else |
+ { |
+ if(Looping_Rechts) // Hysterese |
+ { |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Rechts = 0; |
+ } |
+ } |
+ |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > EE_Parameter.LoopThreshold) && EE_Parameter.LoopConfig & CFG_LOOP_OBEN) Looping_Oben = 1; |
+ else |
+ { |
+ if(Looping_Oben) // Hysterese |
+ { |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < (EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese))) Looping_Oben = 0; |
+ } |
+ } |
+ if((PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] < -EE_Parameter.LoopThreshold) && EE_Parameter.LoopConfig & CFG_LOOP_UNTEN) Looping_Unten = 1; |
+ else |
+ { |
+ if(Looping_Unten) // Hysterese |
+ { |
+ if(PPM_in[EE_Parameter.Kanalbelegung[K_NICK]] > -(EE_Parameter.LoopThreshold - EE_Parameter.LoopHysterese)) Looping_Unten = 0; |
+ } |
+ } |
+ |
+ if(Looping_Links || Looping_Rechts) Looping_Roll = 1; else Looping_Roll = 0; |
+ if(Looping_Oben || Looping_Unten) {Looping_Nick = 1; Looping_Roll = 0; Looping_Links = 0; Looping_Rechts = 0;} else Looping_Nick = 0; |
+ } // Ende neue Funken-Werte |
+ |
+ if(Looping_Roll) beeptime = 100; |
+ if(Looping_Roll || Looping_Nick) |
+ { |
+ if(GasMischanteil > EE_Parameter.LoopGasLimit) GasMischanteil = EE_Parameter.LoopGasLimit; |
+ } |
+ |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Bei Empfangsausfall im Flug |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(Notlandung) |
+ { |
+ StickGier = 0; |
+ StickNick = 0; |
+ StickRoll = 0; |
+ GyroFaktor = 0.1; |
+ IntegralFaktor = 0.005; |
+ Looping_Roll = 0; |
+ Looping_Nick = 0; |
+ } |
+ |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Integrale auf ACC-Signal abgleichen |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define ABGLEICH_ANZAHL 256L |
+ |
+ MittelIntegralNick += IntegralNick; // Für die Mittelwertbildung aufsummieren |
+ MittelIntegralRoll += IntegralRoll; |
+ MittelIntegralNick2 += IntegralNick2; |
+ MittelIntegralRoll2 += IntegralRoll2; |
+ |
+ if(Looping_Nick || Looping_Roll) |
+ { |
+ IntegralAccNick = 0; |
+ IntegralAccRoll = 0; |
+ MittelIntegralNick = 0; |
+ MittelIntegralRoll = 0; |
+ MittelIntegralNick2 = 0; |
+ MittelIntegralRoll2 = 0; |
+ Mess_IntegralNick2 = Mess_IntegralNick; |
+ Mess_IntegralRoll2 = Mess_IntegralRoll; |
+ ZaehlMessungen = 0; |
+ I_LageNick = 0; |
+ I_LageRoll = 0; |
+ } |
+ |
+ if(ZaehlMessungen >= ABGLEICH_ANZAHL) |
+ { |
+ static int cnt = 0; |
+ static char last_n_p,last_n_n,last_r_p,last_r_n; |
+ static long MittelIntegralNick_Alt,MittelIntegralRoll_Alt; |
+ if(!Looping_Nick && !Looping_Roll) |
+ { |
+ MittelIntegralNick /= ABGLEICH_ANZAHL; |
+ MittelIntegralRoll /= ABGLEICH_ANZAHL; |
+ IntegralAccNick = (EE_Parameter.GyroAccFaktor * IntegralAccNick) / ABGLEICH_ANZAHL; |
+ IntegralAccRoll = (EE_Parameter.GyroAccFaktor * IntegralAccRoll) / ABGLEICH_ANZAHL; |
+ IntegralAccZ = IntegralAccZ / ABGLEICH_ANZAHL; |
+#define MAX_I 32 |
+// Nick ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ IntegralFehlerNick = (long)(MittelIntegralNick - (long)IntegralAccNick); |
+ ausgleichNick = IntegralFehlerNick / EE_Parameter.GyroAccAbgleich; |
+ if(labs(MittelIntegralNick_Alt - MittelIntegralNick) < 5000) |
+ { |
+ tmp_long = IntegralFehlerNick / 700L; |
+ if(tmp_long > MAX_I) tmp_long = MAX_I; |
+ if(tmp_long <-MAX_I) tmp_long =-MAX_I; |
+ I_LageNick = tmp_long; |
+ } |
+ else |
+ { |
+ I_LageNick /= 2; |
+ } |
+// Roll ++++++++++++++++++++++++++++++++++++++++++++++++ |
+ IntegralFehlerRoll = (long)(MittelIntegralRoll - (long)IntegralAccRoll); |
+ ausgleichRoll = IntegralFehlerRoll / EE_Parameter.GyroAccAbgleich; |
+ if(labs(MittelIntegralRoll_Alt - MittelIntegralRoll) < 5000) |
+ { |
+ tmp_long2 = IntegralFehlerRoll / 700L; |
+ if(tmp_long2 > MAX_I) tmp_long2 = MAX_I; |
+ if(tmp_long2 <-MAX_I) tmp_long2 =-MAX_I; |
+ I_LageRoll = tmp_long2; |
+ } |
+ else |
+ { |
+ I_LageRoll /=2; |
+ } |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ MittelIntegralNick_Alt = MittelIntegralNick; |
+ MittelIntegralRoll_Alt = MittelIntegralRoll; |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ Mess_IntegralNick -= ausgleichNick; |
+ Mess_IntegralRoll -= ausgleichRoll; |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Gyro-Drift ermitteln |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ MittelIntegralNick2 /= ABGLEICH_ANZAHL; |
+ MittelIntegralRoll2 /= ABGLEICH_ANZAHL; |
+ tmp_long = (long)(MittelIntegralNick2 - (long)IntegralAccNick); |
+ tmp_long2 = (long)(MittelIntegralRoll2 - (long)IntegralAccRoll); |
+ //DebugOut.Analog[25] = MittelIntegralRoll2 / 26; |
+ |
+ IntegralFehlerNick = tmp_long; |
+ IntegralFehlerRoll = tmp_long2; |
+ Mess_IntegralNick2 -= IntegralFehlerNick; |
+ Mess_IntegralRoll2 -= IntegralFehlerRoll; |
+ |
+// IntegralFehlerNick = (IntegralFehlerNick * 1 + tmp_long) / 2; |
+// IntegralFehlerRoll = (IntegralFehlerRoll * 1 + tmp_long2) / 2; |
+ |
+ |
+DebugOut.Analog[30] = I_LageRoll * 10; |
+DebugOut.Analog[17] = IntegralAccNick / 26; |
+DebugOut.Analog[18] = IntegralAccRoll / 26; |
+DebugOut.Analog[19] = IntegralFehlerNick;// / 26; |
+DebugOut.Analog[20] = IntegralFehlerRoll;// / 26; |
+DebugOut.Analog[21] = MittelIntegralNick / 26; |
+DebugOut.Analog[22] = MittelIntegralRoll / 26; |
+DebugOut.Analog[28] = ausgleichNick; |
+DebugOut.Analog[29] = ausgleichRoll; |
+ |
+#define FEHLER_LIMIT (ABGLEICH_ANZAHL/2) |
+#define FEHLER_LIMIT2 (ABGLEICH_ANZAHL*4) |
+ |
+// Nick +++++++++++++++++++++++++++++++++++++++++++++++++ |
+ cnt = 1;// + labs(IntegralFehlerNick) / 4096; |
+ if(IntegralFehlerNick > FEHLER_LIMIT2) |
+ { |
+ if(last_n_p) |
+ { |
+ cnt += labs(IntegralFehlerNick) / FEHLER_LIMIT2; |
+ ausgleichNick = IntegralFehlerNick / 8; |
+ if(ausgleichNick > 5000) ausgleichNick = 5000; |
+ Mess_IntegralNick -= ausgleichNick; |
+ } |
+ else last_n_p = 1; |
+ } else last_n_p = 0; |
+ if(IntegralFehlerNick < -FEHLER_LIMIT2) |
+ { |
+ if(last_n_n) |
+ { |
+ cnt += labs(IntegralFehlerNick) / FEHLER_LIMIT2; |
+ ausgleichNick = IntegralFehlerNick / 8; |
+ if(ausgleichNick < -5000) ausgleichNick = -5000; |
+ Mess_IntegralNick -= ausgleichNick; |
+ } |
+ else last_n_n = 1; |
+ } else last_n_n = 0; |
+ |
+ if(cnt > 3) cnt = 3; |
+ if(IntegralFehlerNick > FEHLER_LIMIT) AdNeutralNick += cnt; |
+ if(IntegralFehlerNick < -FEHLER_LIMIT) AdNeutralNick -= cnt; |
+ |
+// Roll +++++++++++++++++++++++++++++++++++++++++++++++++ |
+ cnt = 1;// + labs(IntegralFehlerRoll) / 4096; |
+ausgleichRoll = 0; |
+ if(IntegralFehlerRoll > FEHLER_LIMIT2) |
+ { |
+ if(last_r_p) |
+ { |
+ cnt += labs(IntegralFehlerRoll) / FEHLER_LIMIT2; |
+ ausgleichRoll = IntegralFehlerRoll / 4; |
+ if(ausgleichRoll > 5000) ausgleichRoll = 5000; |
+ Mess_IntegralRoll -= ausgleichRoll; |
+ } |
+ else last_r_p = 1; |
+ } else last_r_p = 0; |
+ if(IntegralFehlerRoll < -FEHLER_LIMIT2) |
+ { |
+ if(last_r_n) |
+ { |
+ cnt += labs(IntegralFehlerRoll) / FEHLER_LIMIT2; |
+ ausgleichRoll = IntegralFehlerRoll / 4; |
+ if(ausgleichRoll < -5000) ausgleichRoll = -5000; |
+ Mess_IntegralRoll -= ausgleichRoll; |
+ } |
+ else last_r_n = 1; |
+ } else last_r_n = 0; |
+ |
+DebugOut.Analog[27] = ausgleichRoll; |
+ if(cnt > 3) cnt = 3; |
+ if(IntegralFehlerRoll > FEHLER_LIMIT) AdNeutralRoll += cnt; |
+ if(IntegralFehlerRoll < -FEHLER_LIMIT) AdNeutralRoll -= cnt; |
+DebugOut.Analog[24] = 10*(AdNeutralRoll - StartNeutralRoll); |
+ } |
+ IntegralAccNick = 0; |
+ IntegralAccRoll = 0; |
+ IntegralAccZ = 0; |
+ MittelIntegralNick = 0; |
+ MittelIntegralRoll = 0; |
+ MittelIntegralNick2 = 0; |
+ MittelIntegralRoll2 = 0; |
+ ZaehlMessungen = 0; |
+ } |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Gieren |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(abs(StickGier) > 20) // war 35 |
+ { |
+ if(!(EE_Parameter.GlobalConfig & CFG_KOMPASS_FIX)) NeueKompassRichtungMerken = 1; |
+ } |
+ tmp_int = (long) EE_Parameter.Gier_P * ((long)StickGier * abs(StickGier)) / 512L; // expo y = ax + bx² |
+ tmp_int += (EE_Parameter.Gier_P * StickGier) / 4; |
+ sollGier = tmp_int; |
+ Mess_Integral_Gier -= tmp_int; |
+ if(Mess_Integral_Gier > 50000) Mess_Integral_Gier = 50000; // begrenzen |
+ if(Mess_Integral_Gier <-50000) Mess_Integral_Gier =-50000; |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Kompass |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) |
+ { |
+ int w,v; |
+ |
+ if (!updKompass--) // Aufruf mit ~10 Hz |
+ { |
+ updKompass = 50; |
+ KompassValue = heading_MM3(); |
+ KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
+ } |
+ |
+ w = abs(IntegralNick /512); // mit zunehmender Neigung den Einfluss drosseln |
+ v = abs(IntegralRoll /512); |
+ if (v > w) w = v; // grösste Neigung ermitteln |
+ if (w < 35 && NeueKompassRichtungMerken) |
+ { |
+ KompassStartwert = KompassValue; |
+ NeueKompassRichtungMerken = 0; |
+ } |
+ w = (w * Parameter_KompassWirkung) / 64; // auf die Wirkung normieren |
+ w = Parameter_KompassWirkung - w; // Wirkung ggf drosseln |
+ if (w > 0) |
+ { |
+ Mess_Integral_Gier += (KompassRichtung * w) / 32; // nach Kompass ausrichten |
+ } |
+ else beeptime = 500; |
+ } |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Debugwerte zuordnen |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(!TimerWerteausgabe--) |
+ { |
+ TimerWerteausgabe = 24; |
+ DebugOut.Analog[0] = IntegralNick / EE_Parameter.GyroAccFaktor; |
+ DebugOut.Analog[1] = IntegralRoll / EE_Parameter.GyroAccFaktor; |
+ DebugOut.Analog[2] = Mittelwert_AccNick; |
+ DebugOut.Analog[3] = Mittelwert_AccRoll; |
+ DebugOut.Analog[4] = MesswertGier; |
+ DebugOut.Analog[5] = HoehenWert; |
+ DebugOut.Analog[6] =(Mess_Integral_Hoch / 512); |
+ DebugOut.Analog[8] = KompassValue; |
+ DebugOut.Analog[9] = UBat; |
+ DebugOut.Analog[10] = SenderOkay; |
+ DebugOut.Analog[16] = Mittelwert_AccHoch; |
+ |
+/* DebugOut.Analog[16] = motor_rx[0]; |
+ DebugOut.Analog[17] = motor_rx[1]; |
+ DebugOut.Analog[18] = motor_rx[2]; |
+ DebugOut.Analog[19] = motor_rx[3]; |
+ DebugOut.Analog[20] = motor_rx[0] + motor_rx[1] + motor_rx[2] + motor_rx[3]; |
+ DebugOut.Analog[20] /= 14; |
+ DebugOut.Analog[21] = motor_rx[4]; |
+ DebugOut.Analog[22] = motor_rx[5]; |
+ DebugOut.Analog[23] = motor_rx[6]; |
+ DebugOut.Analog[24] = motor_rx[7]; |
+ DebugOut.Analog[25] = motor_rx[4] + motor_rx[5] + motor_rx[6] + motor_rx[7]; |
+*/ |
+// DebugOut.Analog[9] = MesswertNick; |
+// DebugOut.Analog[9] = SollHoehe; |
+// DebugOut.Analog[10] = Mess_Integral_Gier / 128; |
+// DebugOut.Analog[11] = KompassStartwert; |
+// DebugOut.Analog[10] = Parameter_Gyro_I; |
+// DebugOut.Analog[10] = EE_Parameter.Gyro_I; |
+// DebugOut.Analog[9] = KompassRichtung; |
+// DebugOut.Analog[10] = GasMischanteil; |
+// DebugOut.Analog[3] = HoeheD * 32; |
+// DebugOut.Analog[4] = hoehenregler; |
+ } |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Drehgeschwindigkeit und -winkel zu einem Istwert zusammenfassen |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ if(Looping_Nick) MesswertNick = MesswertNick * GyroFaktor; |
+ else MesswertNick = IntegralNick * IntegralFaktor + MesswertNick * GyroFaktor; |
+ if(Looping_Roll) MesswertRoll = MesswertRoll * GyroFaktor; |
+ else MesswertRoll = IntegralRoll * IntegralFaktor + MesswertRoll * GyroFaktor; |
+// MesswertGier = MesswertGier * (GyroFaktor/2) + Integral_Gier * IntegralFaktor; |
+ MesswertGier = MesswertGier * (GyroFaktor) + Integral_Gier * IntegralFaktor/2; |
+ |
+ // Maximalwerte abfangen |
+ #define MAX_SENSOR 2048 |
+ if(MesswertNick > MAX_SENSOR) MesswertNick = MAX_SENSOR; |
+ if(MesswertNick < -MAX_SENSOR) MesswertNick = -MAX_SENSOR; |
+ if(MesswertRoll > MAX_SENSOR) MesswertRoll = MAX_SENSOR; |
+ if(MesswertRoll < -MAX_SENSOR) MesswertRoll = -MAX_SENSOR; |
+ if(MesswertGier > MAX_SENSOR) MesswertGier = MAX_SENSOR; |
+ if(MesswertGier < -MAX_SENSOR) MesswertGier = -MAX_SENSOR; |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Höhenregelung |
+// Die Höhenregelung schwächt lediglich das Gas ab, erhöht es allerdings nicht |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+//OCR0B = 180 - (Poti1 + 120) / 4; |
+//DruckOffsetSetting = OCR0B; |
+ if((EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)) // Höhenregelung |
+ { |
+ int tmp_int; |
+ if(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER) // Regler wird über Schalter gesteuert |
+ { |
+ if(Parameter_MaxHoehe < 50) |
+ { |
+ SollHoehe = HoehenWert - 20; // Parameter_MaxHoehe ist der PPM-Wert des Schalters |
+ HoehenReglerAktiv = 0; |
+ } |
+ else |
+ HoehenReglerAktiv = 1; |
+ } |
+ else |
+ { |
+ SollHoehe = Parameter_MaxHoehe * EE_Parameter.Hoehe_Verstaerkung - 20; |
+ HoehenReglerAktiv = 1; |
+ } |
+ |
+ if(Notlandung) SollHoehe = 0; |
+ h = HoehenWert; |
+ if((h > SollHoehe) && HoehenReglerAktiv) // zu hoch --> drosseln |
+ { h = ((h - SollHoehe) * (int) Parameter_Hoehe_P) / 16; // Differenz bestimmen --> P-Anteil |
+ h = GasMischanteil - h; // vom Gas abziehen |
+ h -= (HoeheD * Parameter_Luftdruck_D)/8; // D-Anteil |
+ tmp_int = ((Mess_Integral_Hoch / 512) * (signed long) Parameter_Hoehe_ACC_Wirkung) / 32; |
+ if(tmp_int > 50) tmp_int = 50; |
+ else if(tmp_int < -50) tmp_int = -50; |
+ h -= tmp_int; |
+ hoehenregler = (hoehenregler*15 + h) / 16; |
+ if(hoehenregler < EE_Parameter.Hoehe_MinGas) // nicht unter MIN |
+ { |
+ if(GasMischanteil >= EE_Parameter.Hoehe_MinGas) hoehenregler = EE_Parameter.Hoehe_MinGas; |
+ if(GasMischanteil < EE_Parameter.Hoehe_MinGas) hoehenregler = GasMischanteil; |
+ } |
+ if(hoehenregler > GasMischanteil) hoehenregler = GasMischanteil; // nicht mehr als Gas |
+ GasMischanteil = hoehenregler; |
+ } |
+ } |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// + Mischer und PI-Regler |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ DebugOut.Analog[7] = GasMischanteil; |
+ |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Gier-Anteil |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+#define MUL_G 1.0 |
+ GierMischanteil = MesswertGier - sollGier; // Regler für Gier |
+//GierMischanteil = 0; |
+ if(GierMischanteil > (MUL_G * GasMischanteil)) GierMischanteil = MUL_G * GasMischanteil; |
+ if(GierMischanteil < -(MUL_G * GasMischanteil)) GierMischanteil = -(MUL_G * GasMischanteil); |
+ if(GierMischanteil > 100) GierMischanteil = 100; |
+ if(GierMischanteil < -100) GierMischanteil = -100; |
+ |
+ if(GasMischanteil < 20) GierMischanteil = 0; |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Nick-Achse |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ DiffNick = Kp * (MesswertNick - (StickNick - GPS_Nick)); // Differenz bestimmen |
+ SummeNick += DiffNick; // I-Anteil |
+ if(SummeNick > 0) SummeNick-= (abs(SummeNick)/256 + 1); else SummeNick += abs(SummeNick)/256 + 1; |
+ if(SummeNick > 16000) SummeNick = 16000; |
+ if(SummeNick < -16000) SummeNick = -16000; |
+ pd_ergebnis = DiffNick + Ki * SummeNick; // PI-Regler für Nick |
+ // Motor Vorn |
+#define MUL 2 |
+ if(pd_ergebnis > MUL * (GasMischanteil + abs(GierMischanteil))) pd_ergebnis = MUL * (GasMischanteil + abs(GierMischanteil)); |
+ if(pd_ergebnis < -MUL * (GasMischanteil + abs(GierMischanteil))) pd_ergebnis = -MUL * (GasMischanteil + abs(GierMischanteil)); |
+ |
+ motorwert = GasMischanteil + pd_ergebnis + GierMischanteil; // Mischer |
+ if ((motorwert < 0)) motorwert = 0; |
+ else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
+ if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
+ Motor_Vorne = motorwert; |
+ // Motor Heck |
+ motorwert = GasMischanteil - pd_ergebnis + GierMischanteil; |
+ if ((motorwert < 0)) motorwert = 0; |
+ else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
+ if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
+ Motor_Hinten = motorwert; |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+// Roll-Achse |
+// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
+ DiffRoll = Kp * (MesswertRoll - (StickRoll - GPS_Roll)); // Differenz bestimmen |
+ SummeRoll += DiffRoll; // I-Anteil |
+ if(SummeRoll > 0) SummeRoll-= (abs(SummeRoll)/256 + 1); else SummeRoll += abs(SummeRoll)/256 + 1; |
+ if(SummeRoll > 16000) SummeRoll = 16000; |
+ if(SummeRoll < -16000) SummeRoll = -16000; |
+ pd_ergebnis = DiffRoll + Ki * SummeRoll; // PI-Regler für Roll |
+ if(pd_ergebnis > MUL * (GasMischanteil + abs(GierMischanteil))) pd_ergebnis = MUL * (GasMischanteil + abs(GierMischanteil)); |
+ if(pd_ergebnis < -MUL * (GasMischanteil + abs(GierMischanteil))) pd_ergebnis = -MUL * (GasMischanteil + abs(GierMischanteil)); |
+ // Motor Links |
+ motorwert = GasMischanteil + pd_ergebnis - GierMischanteil; |
+ if ((motorwert < 0)) motorwert = 0; |
+ else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
+ if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
+ Motor_Links = motorwert; |
+ // Motor Rechts |
+ motorwert = GasMischanteil - pd_ergebnis - GierMischanteil; |
+ if ((motorwert < 0)) motorwert = 0; |
+ else if(motorwert > MAX_GAS) motorwert = MAX_GAS; |
+ if (motorwert < MIN_GAS) motorwert = MIN_GAS; |
+ Motor_Rechts = motorwert; |
+ // +++++++++++++++++++++++++++++++++++++++++++++++ |
+} |
+ |
/branches/v0.60_MicroMag3_Nick666/v0.66c/fc.h |
---|
0,0 → 1,138 |
/*####################################################################################### |
Flight Control |
#######################################################################################*/ |
#ifndef _FC_H |
#define _FC_H |
extern volatile unsigned int I2CTimeout; |
extern unsigned char Sekunde,Minute; |
extern long IntegralNick,IntegralNick2; |
extern long IntegralRoll,IntegralRoll2; |
extern long Integral_Gier; |
extern volatile long Mess_IntegralNick,Mess_IntegralNick2; |
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2; |
extern long IntegralAccNick,IntegralAccRoll; |
volatile long Mess_Integral_Hoch; |
extern volatile long Mess_Integral_Gier,Mess_Integral_Gier2; |
extern int KompassValue; |
extern int KompassStartwert; |
extern int KompassRichtung; |
extern int HoehenWert; |
extern int SollHoehe; |
extern int MesswertNick,MesswertRoll,MesswertGier; |
int AdNeutralNick,AdNeutralRoll,AdNeutralGier; |
int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch; |
extern long Umschlag180Nick, Umschlag180Roll; |
void MotorRegler(void); |
void SendMotorData(void); |
void CalibrierMittelwert(void); |
void Mittelwert(void); |
void SetNeutral(void); |
void Piep(unsigned char Anzahl); |
extern void DefaultKonstanten(void); |
void DefaultKonstanten1(void); |
void DefaultKonstanten2(void); |
extern unsigned char h,m,s; |
extern volatile unsigned char Timeout; |
extern int DiffNick,DiffRoll; |
extern int Poti1, Poti2, Poti3, Poti4; |
extern volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count; |
extern unsigned char MotorWert[5]; |
extern volatile unsigned char SenderOkay; |
extern int StickNick,StickRoll,StickGier; |
extern char MotorenEin; |
#define STRUCT_PARAM_LAENGE 65 |
struct mk_param_struct |
{ |
unsigned char Kanalbelegung[8]; // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3 |
unsigned char GlobalConfig; // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv |
unsigned char Hoehe_MinGas; // Wert : 0-100 |
unsigned char Luftdruck_D; // Wert : 0-250 |
unsigned char MaxHoehe; // Wert : 0-32 |
unsigned char Hoehe_P; // Wert : 0-32 |
unsigned char Hoehe_Verstaerkung; // Wert : 0-50 |
unsigned char Hoehe_ACC_Wirkung; // Wert : 0-250 |
unsigned char Stick_P; // Wert : 1-6 |
unsigned char Stick_D; // Wert : 0-64 |
unsigned char Gier_P; // Wert : 1-20 |
unsigned char Gas_Min; // Wert : 0-32 |
unsigned char Gas_Max; // Wert : 33-250 |
unsigned char GyroAccFaktor; // Wert : 1-64 |
unsigned char KompassWirkung; // Wert : 0-32 |
unsigned char Gyro_P; // Wert : 10-250 |
unsigned char Gyro_I; // Wert : 0-250 |
unsigned char UnterspannungsWarnung; // Wert : 0-250 |
unsigned char NotGas; // Wert : 0-250 //Gaswert bei Empängsverlust |
unsigned char NotGasZeit; // Wert : 0-250 // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen |
unsigned char UfoAusrichtung; // X oder + Formation |
unsigned char I_Faktor; // Wert : 0-250 |
unsigned char UserParam1; // Wert : 0-250 |
unsigned char UserParam2; // Wert : 0-250 |
unsigned char UserParam3; // Wert : 0-250 |
unsigned char UserParam4; // Wert : 0-250 |
unsigned char ServoNickControl; // Wert : 0-250 // Stellung des Servos |
unsigned char ServoNickComp; // Wert : 0-250 // Einfluss Gyro/Servo |
unsigned char ServoNickMin; // Wert : 0-250 // Anschlag |
unsigned char ServoNickMax; // Wert : 0-250 // Anschlag |
unsigned char ServoNickRefresh; // |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
unsigned char LoopHysterese; // Wert: 0-250 Hysterese für Stickausschlag |
unsigned char AchsKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung) |
unsigned char AchsGegenKopplung1; // Wert: 0-250 Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung) |
unsigned char WinkelUmschlagNick; // Wert: 0-250 180°-Punkt |
unsigned char WinkelUmschlagRoll; // Wert: 0-250 180°-Punkt |
unsigned char GyroAccAbgleich; // 1/k (Koppel_ACC_Wirkung) |
unsigned char Driftkomp; |
//------------------------------------------------ |
unsigned char LoopConfig; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
unsigned char ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
unsigned char Reserved[4]; |
char Name[12]; |
}; |
struct acc_neutral_struct |
{ |
volatile int X; |
volatile int Y; |
volatile float Z; |
}; |
extern struct acc_neutral_struct acc_neutral; |
extern void calib_acc(void); |
/* |
unsigned char ServoNickMax; // Wert : 0-250 |
unsigned char ServoNickRefresh; // |
unsigned char LoopGasLimit; // Wert: 0-250 max. Gas während Looping |
unsigned char LoopThreshold; // Wert: 0-250 Schwelle für Stickausschlag |
//------------------------------------------------ |
unsigned char LoopConfig; // Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt |
unsigned char ServoNickCompInvert; // Wert : 0-250 0 oder 1 // WICHTIG!!! am Ende lassen |
unsigned char Reserved[4]; |
char Name[12]; |
*/ |
extern struct mk_param_struct EE_Parameter; |
extern unsigned char Parameter_Luftdruck_D; |
extern unsigned char Parameter_MaxHoehe; |
extern unsigned char Parameter_Hoehe_P; |
extern unsigned char Parameter_Hoehe_ACC_Wirkung; |
extern unsigned char Parameter_KompassWirkung; |
extern unsigned char Parameter_Gyro_P; |
extern unsigned char Parameter_Gyro_I; |
extern unsigned char Parameter_Gier_P; |
extern unsigned char Parameter_ServoNickControl; |
extern unsigned char Parameter_AchsKopplung1; |
extern unsigned char Parameter_AchsGegenKopplung1; |
#endif //_FC_H |
/branches/v0.60_MicroMag3_Nick666/v0.66c/flight.pnproj |
---|
0,0 → 1,0 |
<Project name="Flight-Ctrl"><File path="uart.h"></File><File path="main.c"></File><File path="main.h"></File><File path="makefile"></File><File path="uart.c"></File><File path="printf_P.h"></File><File path="printf_P.c"></File><File path="timer0.c"></File><File path="timer0.h"></File><File path="old_macros.h"></File><File path="twimaster.c"></File><File path="version.txt"></File><File path="twimaster.h"></File><File path="rc.c"></File><File path="rc.h"></File><File path="fc.h"></File><File path="fc.c"></File><File path="menu.h"></File><File path="menu.c"></File><File path="_Settings.h"></File><File path="analog.c"></File><File path="analog.h"></File><File path="GPS.c"></File><File path="gps.h"></File><File path="license_buss.txt"></File><File path="mymath.c"></File><File path="mymath.h"></File><File path="compass.c"></File><File path="compass.h"></File><File path="COPYING"></File><File path="COPYING.LESSER"></File><File path="eeprom.c"></File><File path="eeprom.h"></File></Project> |
/branches/v0.60_MicroMag3_Nick666/v0.66c/flight.pnps |
---|
0,0 → 1,0 |
<pd><ViewState><e p="Flight-Ctrl" x="true"></e></ViewState></pd> |
/branches/v0.60_MicroMag3_Nick666/v0.66c/gps.h |
---|
0,0 → 1,14 |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Nick; |
extern signed int GPS_Roll; |
void GPS_Neutral(void); |
void GPS_BerechneZielrichtung(void); |
/branches/v0.60_MicroMag3_Nick666/v0.66c/license_buss.txt |
---|
0,0 → 1,52 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten und nichtkommerziellen Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt und genannt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-profit use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet, our webpage (http://www.MikroKopter.de) must be |
// + clearly linked and named as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
/branches/v0.60_MicroMag3_Nick666/v0.66c/main.c |
---|
0,0 → 1,259 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + Nur für den privaten Gebrauch |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten und nicht-kommerziellen Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt und genannt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Portierung der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permittet |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * porting to systems other than hardware from www.mikrokopter.de is not allowed |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
// Reservierung im EEPROM |
unsigned char EEPromArray[5] EEMEM; |
struct mk_param_struct EEParameterArray[5] EEMEM; |
unsigned char PlatinenVersion = 10; |
// -- Parametersatz aus EEPROM lesen --- |
// number [0..5] |
void ReadParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
{ |
if (number > 5) number = 5; |
number--; |
eeprom_read_block(buffer, &EEParameterArray[number], length); |
} |
// -- Parametersatz ins EEPROM schreiben --- |
// number [0..5] |
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length) |
{ |
if(number > 5) number = 5; |
number--; |
eeprom_write_block(buffer, &EEParameterArray[number], length); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], number); // diesen Parametersatz als aktuell merken |
} |
unsigned char GetActiveParamSetNumber(void) |
{ |
unsigned char set; |
set = eeprom_read_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET]); |
if(set > 5) |
{ |
set = 2; |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], set); // diesen Parametersatz als aktuell merken |
} |
return(set); |
} |
//############################################################################ |
//Hauptprogramm |
int main (void) |
//############################################################################ |
{ |
unsigned int timer; |
//unsigned int timer2 = 0; |
DDRB = 0x00; |
PORTB = 0x00; |
for(timer = 0; timer < 1000; timer++); // verzögern |
if(PINB & 0x01) PlatinenVersion = 11; else PlatinenVersion = 10; |
DDRC = 0x81; // SCL |
PORTC = 0xff; // Pullup SDA |
DDRB = 0x1B; // LEDs und Druckoffset |
PORTB = 0x01; // LED_Rot |
DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
DDRD |=0x80; // J7 |
PORTD = 0xF7; // LED |
MCUSR &=~(1<<WDRF); |
WDTCSR |= (1<<WDCE)|(1<<WDE); |
WDTCSR = 0; |
beeptime = 2000; |
StickGier = 0; PPM_in[K_GAS] = 0;StickRoll = 0; StickNick = 0; |
ROT_OFF; |
Timer_Init(); |
UART_Init(); |
rc_sum_init(); |
ADC_Init(); |
i2c_init(); |
init_MM3(); |
sei(); |
VersionInfo.Hauptversion = VERSION_HAUPTVERSION; |
VersionInfo.Nebenversion = VERSION_NEBENVERSION; |
VersionInfo.PCKompatibel = VERSION_KOMPATIBEL; |
printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",PlatinenVersion/10,PlatinenVersion%10, VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX + 'a'); |
printf("\n\r=============================="); |
GRN_ON; |
#define EE_DATENREVISION 66 // wird angepasst, wenn sich die EEPROM-Daten geändert haben |
if(eeprom_read_byte(&EEPromArray[EEPROM_ADR_VALID]) != EE_DATENREVISION) |
{ |
printf("\n\rInit. EEPROM: Generiere Default-Parameter..."); |
DefaultKonstanten1(); |
for (unsigned char i=0;i<6;i++) |
{ |
if(i==2) DefaultKonstanten2(); // Kamera |
if(i==3) DefaultKonstanten3(); // Beginner |
if(i>3) DefaultKonstanten2(); // Kamera |
WriteParameterSet(i, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
} |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], 3); // default-Setting |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_VALID], EE_DATENREVISION); |
calib_acc(); |
} |
ReadParameterSet(GetActiveParamSetNumber(), (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
printf("\n\rBenutze Parametersatz %d", GetActiveParamSetNumber()); |
//kurze Wartezeit (sonst reagiert die "Kompass kalibrieren?"-Abfrage nicht |
timer = SetDelay(500); |
while(!CheckDelay(timer)); |
//Kompass kalibrieren? |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 100 && PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] > 100) |
{ |
printf("\n\rKalibriere Kompass"); |
calib_MM3(); |
} |
//Neutrallage kalibrieren? |
if(PPM_in[EE_Parameter.Kanalbelegung[K_GAS]] > 100 && PPM_in[EE_Parameter.Kanalbelegung[K_GIER]] < -100) |
{ |
printf("\n\rKalibriere Neutrallage"); |
calib_acc(); |
} |
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
{ |
printf("\n\rAbgleich Luftdrucksensor.."); |
timer = SetDelay(1000); |
SucheLuftruckOffset(); |
while (!CheckDelay(timer)); |
printf("OK\n\r"); |
} |
SetNeutral(); |
ROT_OFF; |
beeptime = 2000; |
DebugIn.Analog[1] = 1000; |
DebugIn.Digital[0] = 0x55; |
printf("\n\rSteuerung: "); |
if (EE_Parameter.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
else printf("Neutral"); |
printf("\n\n\r"); |
LcdClear(); |
I2CTimeout = 5000; |
while (1) |
{ |
if (UpdateMotor) // ReglerIntervall |
{ |
// SPI_TransmitByte(); |
UpdateMotor=0; |
//PORTD |= 0x08; |
MotorRegler(); |
//PORTD &= ~0x08; |
SendMotorData(); |
ROT_OFF; |
if(PcZugriff) PcZugriff--; |
if(SenderOkay) SenderOkay--; |
if(!I2CTimeout) |
{ |
I2CTimeout = 5; |
i2c_reset(); |
if((BeepMuster == 0xffff) && MotorenEin) |
{ |
beeptime = 10000; |
BeepMuster = 0x0080; |
} |
} |
else |
{ |
I2CTimeout--; |
ROT_OFF; |
} |
} |
if(SIO_DEBUG) |
{ |
DatenUebertragung(); |
BearbeiteRxDaten(); |
} |
else BearbeiteRxDaten(); |
if(CheckDelay(timer)) |
{ |
if(UBat < EE_Parameter.UnterspannungsWarnung) |
{ |
if(BeepMuster == 0xffff) |
{ |
beeptime = 6000; |
BeepMuster = 0x0300; |
} |
} |
// SPI_StartTransmitPacket(); |
timer = SetDelay(100); |
} |
} |
return (1); |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/main.h |
---|
0,0 → 1,92 |
#ifndef _MAIN_H |
#define _MAIN_H |
//Hier die Quarz Frequenz einstellen |
#if defined (__AVR_ATmega32__) |
#define SYSCLK 20000000L //Quarz Frequenz in Hz |
#endif |
#if defined (__AVR_ATmega644__) |
#define SYSCLK 20000000L //Quarz Frequenz in Hz |
//#define SYSCLK 16000000L //Quarz Frequenz in Hz |
#endif |
// neue Hardware |
#define ROT_OFF {if(PlatinenVersion == 10) PORTB &=~0x01; else PORTB |= 0x01;} |
#define ROT_ON {if(PlatinenVersion == 10) PORTB |= 0x01; else PORTB &=~0x01;} |
#define ROT_FLASH PORTB ^= (1<<PB0) |
#define GRN_OFF PORTB &=~(1<<PB1) |
#define GRN_ON PORTB |= (1<<PB1) |
#define GRN_FLASH PORTB ^= (1<<PB1) |
#define F_CPU SYSCLK |
//#ifndef F_CPU |
//#error ################## F_CPU nicht definiert oder ungültig ############# |
//#endif |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#define EEPROM_ADR_VALID 1 |
#define EEPROM_ADR_ACTIVE_SET 2 |
#define EEPROM_ADR_LAST_OFFSET 3 |
#define CFG_HOEHENREGELUNG 0x01 |
#define CFG_HOEHEN_SCHALTER 0x02 |
#define CFG_HEADING_HOLD 0x04 |
#define CFG_KOMPASS_AKTIV 0x08 |
#define CFG_KOMPASS_FIX 0x10 |
#define CFG_GPS_AKTIV 0x20 |
#define CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
#define CFG_DREHRATEN_BEGRENZER 0x80 |
#define CFG_LOOP_OBEN 0x01 |
#define CFG_LOOP_UNTEN 0x02 |
#define CFG_LOOP_LINKS 0x04 |
#define CFG_LOOP_RECHTS 0x08 |
extern unsigned char PlatinenVersion; |
void ReadParameterSet (unsigned char number, unsigned char *buffer, unsigned char length); |
void WriteParameterSet(unsigned char number, unsigned char *buffer, unsigned char length); |
extern unsigned char GetActiveParamSetNumber(void); |
extern unsigned char EEPromArray[]; |
#include <stdlib.h> |
#include <string.h> |
#include <avr/io.h> |
#include <avr/pgmspace.h> |
#include <avr/interrupt.h> |
#include <avr/eeprom.h> |
#include <avr/boot.h> |
#include <avr/wdt.h> |
#include "old_macros.h" |
#include "_Settings.h" |
#include "printf_P.h" |
#include "timer0.h" |
#include "uart.h" |
#include "analog.h" |
#include "twimaster.h" |
#include "menu.h" |
#include "rc.h" |
#include "fc.h" |
#include "gps.h" |
#include "compass.h" |
#include "mymath.h" |
#ifndef EEMEM |
#define EEMEM __attribute__ ((section (".eeprom"))) |
#endif |
#define DEBUG_DISPLAY_INTERVALL 123 // in ms |
#define DELAY_US(x) ((unsigned int)( (x) * 1e-6 * F_CPU )) |
#endif //_MAIN_H |
/branches/v0.60_MicroMag3_Nick666/v0.66c/makefile |
---|
0,0 → 1,411 |
#-------------------------------------------------------------------- |
# MCU name |
MCU = atmega644 |
F_CPU = 20000000 |
#------------------------------------------------------------------- |
HAUPT_VERSION = 0 |
NEBEN_VERSION = 66 |
VERSION_INDEX = 2 |
VERSION_KOMPATIBEL = 6 # PC-Kompatibilität |
#------------------------------------------------------------------- |
ifeq ($(MCU), atmega32) |
# FUSE_SETTINGS= -u -U lfuse:w:0xff:m -U hfuse:w:0xcf:m |
HEX_NAME = MEGA32 |
endif |
ifeq ($(MCU), atmega644) |
FUSE_SETTINGS = -u -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
#FUSE_SETTINGS = -U lfuse:w:0xff:m -U hfuse:w:0xdf:m |
# -u bei neuen Controllern wieder einspielen |
HEX_NAME = MEGA644 |
endif |
ifeq ($(F_CPU), 16000000) |
QUARZ = 16MHZ |
endif |
ifeq ($(F_CPU), 20000000) |
QUARZ = 20MHZ |
endif |
# Output format. (can be srec, ihex, binary) |
FORMAT = ihex |
# Target file name (without extension). |
ifeq ($(VERSION_INDEX), 0) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)a |
endif |
ifeq ($(VERSION_INDEX), 1) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)b |
endif |
ifeq ($(VERSION_INDEX), 2) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)c |
endif |
ifeq ($(VERSION_INDEX), 3) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)d |
endif |
ifeq ($(VERSION_INDEX), 4) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)e |
endif |
ifeq ($(VERSION_INDEX), 5) |
TARGET = Flight-Ctrl_$(HEX_NAME)_V$(HAUPT_VERSION)_$(NEBEN_VERSION)f |
endif |
# Optimization level, can be [0, 1, 2, 3, s]. 0 turns off optimization. |
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
OPT = s |
########################################################################################################## |
# List C source files here. (C dependencies are automatically generated.) |
SRC = main.c uart.c printf_P.c timer0.c analog.c menu.c |
SRC += twimaster.c rc.c fc.c GPS.c |
SRC += compass.c mymath.c |
########################################################################################################## |
# List Assembler source files here. |
# Make them always end in a capital .S. Files ending in a lowercase .s |
# will not be considered source files but generated files (assembler |
# output from the compiler), and will be deleted upon "make clean"! |
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
# it will preserve the spelling of the filenames, and gcc itself does |
# care about how the name is spelled on its command-line. |
ASRC = |
# List any extra directories to look for include files here. |
# Each directory must be seperated by a space. |
EXTRAINCDIRS = |
# Optional compiler flags. |
# -g: generate debugging information (for GDB, or for COFF conversion) |
# -O*: optimization level |
# -f...: tuning, see gcc manual and avr-libc documentation |
# -Wall...: warning level |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create assembler listing |
CFLAGS = -O$(OPT) \ |
-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums \ |
-Wall -Wstrict-prototypes \ |
-mtiny-stack -mcall-prologues \ |
-Wa,-adhlns=$(<:.c=.lst) \ |
$(patsubst %,-I%,$(EXTRAINCDIRS)) |
# Set a "language standard" compiler flag. |
# Unremark just one line below to set the language standard to use. |
# gnu99 = C99 + GNU extensions. See GCC manual for more information. |
#CFLAGS += -std=c89 |
#CFLAGS += -std=gnu89 |
#CFLAGS += -std=c99 |
CFLAGS += -std=gnu99 |
CFLAGS += -DVERSION_HAUPTVERSION=$(HAUPT_VERSION) -DVERSION_NEBENVERSION=$(NEBEN_VERSION) -DVERSION_KOMPATIBEL=$(VERSION_KOMPATIBEL) -DVERSION_INDEX=$(VERSION_INDEX) |
# Optional assembler flags. |
# -Wa,...: tell GCC to pass this to the assembler. |
# -ahlms: create listing |
# -gstabs: have the assembler create line number information; note that |
# for use in COFF files, additional information about filenames |
# and function names needs to be present in the assembler source |
# files -- see avr-libc docs [FIXME: not yet described there] |
ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs |
# Optional linker flags. |
# -Wl,...: tell GCC to pass this to linker. |
# -Map: create map file |
# --cref: add cross reference to map file |
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
# Additional libraries |
# Minimalistic printf version |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min |
# Floating point printf version (requires -lm below) |
#LDFLAGS += -Wl,-u,vfprintf -lprintf_flt |
# -lm = math library |
LDFLAGS += -lm |
##LDFLAGS += -T./linkerfile/avr5.x |
# Programming support using avrdude. Settings and variables. |
# Programming hardware: alf avr910 avrisp bascom bsd |
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 |
# |
# Type: avrdude -c ? |
# to get a full listing. |
# |
#AVRDUDE_PROGRAMMER = stk200 |
AVRDUDE_PROGRAMMER = dt006 |
#AVRDUDE_PROGRAMMER = ponyser |
#falls Ponyser ausgewählt wird, muss sich unsere avrdude-Configdatei im Bin-Verzeichnis des Compilers befinden |
#AVRDUDE_PORT = com1 # programmer connected to serial device |
AVRDUDE_PORT = lpt1 # programmer connected to parallel port |
#AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex $(FUSE_SETTINGS) |
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
# Uncomment the following if you want avrdude's erase cycle counter. |
# Note that this counter needs to be initialized first using -Yn, |
# see avrdude manual. |
#AVRDUDE_ERASE += -y |
# Uncomment the following if you do /not/ wish a verification to be |
# performed after programming the device. |
AVRDUDE_FLAGS += -V |
# Increase verbosity level. Please use this when submitting bug |
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
# to submit bug reports. |
#AVRDUDE_FLAGS += -v -v |
# --------------------------------------------------------------------------- |
# Define directories, if needed. |
DIRAVR = c:/winavr |
DIRAVRBIN = $(DIRAVR)/bin |
DIRAVRUTILS = $(DIRAVR)/utils/bin |
DIRINC = . |
DIRLIB = $(DIRAVR)/avr/lib |
# Define programs and commands. |
SHELL = sh |
CC = avr-gcc |
OBJCOPY = avr-objcopy |
OBJDUMP = avr-objdump |
SIZE = avr-size |
# Programming support using avrdude. |
AVRDUDE = avrdude |
REMOVE = rm -f |
COPY = cp |
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
ELFSIZE = $(SIZE) -A $(TARGET).elf |
# Define Messages |
# English |
MSG_ERRORS_NONE = Errors: none |
MSG_BEGIN = -------- begin -------- |
MSG_END = -------- end -------- |
MSG_SIZE_BEFORE = Size before: |
MSG_SIZE_AFTER = Size after: |
MSG_COFF = Converting to AVR COFF: |
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
MSG_FLASH = Creating load file for Flash: |
MSG_EEPROM = Creating load file for EEPROM: |
MSG_EXTENDED_LISTING = Creating Extended Listing: |
MSG_SYMBOL_TABLE = Creating Symbol Table: |
MSG_LINKING = Linking: |
MSG_COMPILING = Compiling: |
MSG_ASSEMBLING = Assembling: |
MSG_CLEANING = Cleaning project: |
# Define all object files. |
OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) |
# Define all listing files. |
LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) |
# Combine all necessary flags and optional flags. |
# Add target processor to flags. |
#ALL_CFLAGS = -mmcu=$(MCU) -DF_CPU=$(F_CPU) -I. $(CFLAGS) |
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) |
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
# Default target. |
all: begin gccversion sizebefore $(TARGET).elf $(TARGET).hex $(TARGET).eep \ |
$(TARGET).lss $(TARGET).sym sizeafter finished end |
# Eye candy. |
# AVR Studio 3.x does not check make's exit code but relies on |
# the following magic strings to be generated by the compile job. |
begin: |
@echo |
@echo $(MSG_BEGIN) |
finished: |
@echo $(MSG_ERRORS_NONE) |
end: |
@echo $(MSG_END) |
@echo |
# Display size of file. |
sizebefore: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi |
sizeafter: |
@if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi |
# Display compiler version information. |
gccversion : |
@$(CC) --version |
# Convert ELF to COFF for use in debugging / simulating in |
# AVR Studio or VMLAB. |
COFFCONVERT=$(OBJCOPY) --debugging \ |
--change-section-address .data-0x800000 \ |
--change-section-address .bss-0x800000 \ |
--change-section-address .noinit-0x800000 \ |
--change-section-address .eeprom-0x810000 |
coff: $(TARGET).elf |
@echo |
@echo $(MSG_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
extcoff: $(TARGET).elf |
@echo |
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
# Program the device. |
program: $(TARGET).hex $(TARGET).eep |
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
# Create final output files (.hex, .eep) from ELF output file. |
%.hex: %.elf |
@echo |
@echo $(MSG_FLASH) $@ |
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ |
%.eep: %.elf |
@echo |
@echo $(MSG_EEPROM) $@ |
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
--change-section-lma .eeprom=0 -O $(FORMAT) $< $@ |
# Create extended listing file from ELF output file. |
%.lss: %.elf |
@echo |
@echo $(MSG_EXTENDED_LISTING) $@ |
$(OBJDUMP) -h -S $< > $@ |
# Create a symbol table from ELF output file. |
%.sym: %.elf |
@echo |
@echo $(MSG_SYMBOL_TABLE) $@ |
avr-nm -n $< > $@ |
# Link: create ELF output file from object files. |
.SECONDARY : $(TARGET).elf |
.PRECIOUS : $(OBJ) |
%.elf: $(OBJ) |
@echo |
@echo $(MSG_LINKING) $@ |
$(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) |
# Compile: create object files from C source files. |
%.o : %.c |
@echo |
@echo $(MSG_COMPILING) $< |
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
# Compile: create assembler files from C source files. |
%.s : %.c |
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
# Assemble: create object files from assembler source files. |
%.o : %.S |
@echo |
@echo $(MSG_ASSEMBLING) $< |
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
# Target: clean project. |
clean: begin clean_list finished end |
clean_list : |
@echo |
@echo $(MSG_CLEANING) |
# $(REMOVE) $(TARGET).hex |
$(REMOVE) $(TARGET).eep |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).cof |
$(REMOVE) $(TARGET).elf |
$(REMOVE) $(TARGET).map |
$(REMOVE) $(TARGET).obj |
$(REMOVE) $(TARGET).a90 |
$(REMOVE) $(TARGET).sym |
$(REMOVE) $(TARGET).lnk |
$(REMOVE) $(TARGET).lss |
$(REMOVE) $(OBJ) |
$(REMOVE) $(LST) |
$(REMOVE) $(SRC:.c=.s) |
$(REMOVE) $(SRC:.c=.d) |
# Automatically generate C source code dependencies. |
# (Code originally taken from the GNU make user manual and modified |
# (See README.txt Credits).) |
# |
# Note that this will work with sh (bash) and sed that is shipped with WinAVR |
# (see the SHELL variable defined above). |
# This may not work with other shells or other seds. |
# |
%.d: %.c |
set -e; $(CC) -MM $(ALL_CFLAGS) $< \ |
| sed 's,\(.*\)\.o[ :]*,\1.o \1.d : ,g' > $@; \ |
[ -s $@ ] || rm -f $@ |
# Remove the '-' if you want to see the dependency files generated. |
-include $(SRC:.c=.d) |
# Listing of phony targets. |
.PHONY : all begin finish end sizebefore sizeafter gccversion coff extcoff \ |
clean clean_list program |
/branches/v0.60_MicroMag3_Nick666/v0.66c/menu.c |
---|
0,0 → 1,140 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
unsigned int TestInt = 0; |
#define ARRAYGROESSE 10 |
unsigned char Array[ARRAYGROESSE] = {1,2,3,4,5,6,7,8,9,10}; |
char DisplayBuff[80] = "Hallo Welt"; |
unsigned char DispPtr = 0; |
unsigned char RemoteTasten = 0; |
#define KEY1 0x01 |
#define KEY2 0x02 |
#define KEY3 0x04 |
#define KEY4 0x08 |
#define KEY5 0x10 |
void LcdClear(void) |
{ |
unsigned char i; |
for(i=0;i<80;i++) DisplayBuff[i] = ' '; |
} |
void Menu(void) |
{ |
static unsigned char MaxMenue = 12,MenuePunkt=0; |
if(RemoteTasten & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue; LcdClear(); } |
if(RemoteTasten & KEY2) { MenuePunkt++; LcdClear(); } |
if((RemoteTasten & KEY1) && (RemoteTasten & KEY2)) MenuePunkt = 0; |
LCD_printfxy(17,0,"[%i]",MenuePunkt); |
switch(MenuePunkt) |
{ |
case 0: |
LCD_printfxy(0,0,"++ MikroKopter ++"); |
LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10,VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX+'a'); |
LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber()); |
LCD_printfxy(0,3,"(c) Holger Buss"); |
// if(RemoteTasten & KEY3) TestInt--; |
// if(RemoteTasten & KEY4) TestInt++; |
break; |
case 1: |
if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
{ |
LCD_printfxy(0,0,"Hoehe: %5i",HoehenWert); |
LCD_printfxy(0,1,"SollHoehe: %5i",SollHoehe); |
LCD_printfxy(0,2,"Luftdruck: %5i",MessLuftdruck); |
LCD_printfxy(0,3,"Off : %5i",DruckOffsetSetting); |
} |
else |
{ |
LCD_printfxy(0,1,"Keine "); |
LCD_printfxy(0,2,"Höhenregelung"); |
} |
break; |
case 2: |
LCD_printfxy(0,0,"akt. Lage"); |
LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024); |
LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024); |
LCD_printfxy(0,3,"Kompass: %5i",KompassValue); |
break; |
case 3: |
LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]); |
LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]); |
LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]); |
LCD_printfxy(0,3,"K7:%4i K8:%4i ",PPM_in[7],PPM_in[8]); |
break; |
case 4: |
LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]); |
LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]); |
LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]); |
break; |
case 5: |
LCD_printfxy(0,0,"Gyro - Sensor"); |
if(PlatinenVersion == 10) |
{ |
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertNick - AdNeutralNick, AdNeutralNick); |
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll); |
LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier); |
} |
else |
{ |
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertNick - AdNeutralNick, AdNeutralNick/2); |
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll/2); |
LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier/2); |
} |
break; |
case 6: |
LCD_printfxy(0,0,"ACC - Sensor"); |
LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertAccNick,acc_neutral.X); |
LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertAccRoll,acc_neutral.Y); |
LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)acc_neutral.Z); |
break; |
case 7: |
LCD_printfxy(0,1,"Spannung: %5i",UBat); |
LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay); |
break; |
case 8: |
LCD_printfxy(0,0,"Kompass "); |
LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung); |
LCD_printfxy(0,2,"Messwert: %5i",KompassValue); |
LCD_printfxy(0,3,"Start: %5i",KompassStartwert); |
break; |
case 9: |
LCD_printfxy(0,0,"Poti1: %3i",Poti1); |
LCD_printfxy(0,1,"Poti2: %3i",Poti2); |
LCD_printfxy(0,2,"Poti3: %3i",Poti3); |
LCD_printfxy(0,3,"Poti4: %3i",Poti4); |
break; |
case 10: |
LCD_printfxy(0,0,"Servo " ); |
LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl); |
LCD_printfxy(0,2,"Stellung: %3i",ServoValue); |
LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax); |
break; |
case 11: |
LCD_printfxy(0,0,"MM3 Off"); |
LCD_printfxy(0,1,"X_Offset: %3i",MM3_calib.X_off); |
LCD_printfxy(0,2,"Y_Offset: %3i",MM3_calib.Y_off); |
LCD_printfxy(0,3,"Z_Offset: %3i",MM3_calib.Z_off); |
break; |
case 12: |
LCD_printfxy(0,0,"MM3 Range"); |
LCD_printfxy(0,1,"X_Range: %4i",MM3_calib.X_range); |
LCD_printfxy(0,2,"Y_Range: %4i",MM3_calib.Y_range); |
LCD_printfxy(0,3,"Z_Range: %4i",MM3_calib.Z_range); |
break; |
default: MaxMenue = MenuePunkt - 1; |
MenuePunkt = 0; |
break; |
} |
RemoteTasten = 0; |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/menu.h |
---|
0,0 → 1,6 |
extern void Menu(void); |
extern void LcdClear(void); |
extern char DisplayBuff[80]; |
extern unsigned char DispPtr; |
extern unsigned char RemoteTasten; |
/branches/v0.60_MicroMag3_Nick666/v0.66c/mymath.c |
---|
0,0 → 1,126 |
/* |
Copyright 2007, Niklas Nold |
This program (files math.c and math.h) is free software; you can redistribute it and/or modify |
it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; |
either version 3 of the License, or (at your option) any later version. |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Please note: All the other files for the project "Mikrokopter" by H. Buss are under the license (license_buss.txt) published by www.mikrokopter.de |
*/ |
#include "main.h" |
const uint8_t pgm_atan[270] PROGMEM = {0,1,2,3,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,27,28,29,30,31,32,33,33,34,35,36,37,37,38,39,39,40,41,41,42,43,43,44,44,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,52,53,53,54,54,54,55,55,56,56,56,57,57,57,58,58,58,59,59,59,60,60,60,60,61,61,61,61,62,62,62,62,63,63,63,63,64,64,64,64,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,67,68,68,68,68,68,68,69,69,69,69,69,69,69,70,70,70,70,70,70,70,70,71,71,71,71,71,71,71,71,72,72,72,72,72,72,72,72,72,73,73,73,73,73,73,73,73,73,73,74,74,74,74,74,74,74,74,74,74,74,74,75,75,75,75,75,75,75,75,75,75,75,75,75,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79}; |
//############################################################################ |
// Arkustangens2 im Gradmaß |
signed int atan2_i(signed int x, signed int y) |
//############################################################################ |
{ |
int i,angle; |
int8_t m; |
if (!x && !y) return 0; //atan2 = 0 für x und y = 0 |
if (y < 0) m=-1; |
else m=1; |
if (x==0) return (90*m); // atan2 = 90° für x = 0 |
i = abs(((long)y*50) / x); // Berechne i für die Lookup table (Schrittweite atan(x) ist 0.02 -> *50) |
if (i<270) angle = pgm_read_byte(&pgm_atan[i]); // Lookup für 1° bis 79° |
else if (i>5750) angle = 90; // Grenzwert ist 90° |
else if (i>=1910) angle = 89; // 89° bis 80° über Wertebereiche |
else if (i>=1150) angle = 88; |
else if (i>=820) angle = 87; |
else if (i>=640) angle = 86; |
else if (i>=520) angle = 85; |
else if (i>=440) angle = 84; |
else if (i>=380) angle = 83; |
else if (i>=335) angle = 82; |
else if (i>=299) angle = 81; |
else angle = 80; // (i>=270) |
if (x > 0) return (angle*m); // Quadrant I und IV |
else if ((x < 0) && (m > 0)) return (-angle + 180); // Quadrant II |
else return (angle - 180); // x < 0 && y < 0 Quadrant III |
} |
const float pgm_sinus_f[91] PROGMEM = {0.0,0.0174524,0.0348995,0.0523360,0.0697565,0.0871557,0.1045285,0.1218693,0.1391731,0.1564345,0.1736482,0.1908090,0.2079117,0.2249510,0.2419219,0.2588190,0.2756373,0.2923717,0.3090170,0.3255681,0.3420201,0.3583679,0.3746066,0.3907311,0.4067366,0.4226182,0.4383711,0.4539905,0.4694715,0.4848096,0.5000000,0.5150381,0.5299193,0.5446390,0.5591929,0.5735764,0.5877852,0.6018150,0.6156615,0.6293204,0.6427876,0.6560590,0.6691306,0.6819983,0.6946584,0.7071068,0.7193398,0.7313537,0.7431448,0.7547096,0.7660444,0.7771459,0.7880107,0.7986355,0.8090170,0.8191520,0.8290376,0.8386706,0.8480481,0.8571673,0.8660254,0.8746197,0.8829476,0.8910065,0.8987940,0.9063078,0.9135454,0.9205048,0.9271838,0.9335804,0.9396926,0.9455186,0.9510565,0.9563047,0.9612617,0.9659258,0.9702957,0.9743701,0.9781476,0.9816272,0.9848077,0.9876883,0.9902681,0.9925461,0.9945219,0.9961947,0.9975640,0.9986295,0.9993908,0.9998477,1.0}; |
inline float pgm_read_float(const float *addr) |
{ |
union |
{ |
uint16_t i[2]; // 2 16-bit-Worte |
float f; |
} u; |
u.i[0]=pgm_read_word((PGM_P)addr); |
u.i[1]=pgm_read_word((PGM_P)addr+2); |
return u.f; |
} |
//############################################################################ |
// Kosinusfunktion im Gradmaß |
float cos_f(signed int winkel) |
//############################################################################ |
{ |
return (sin_f(90-winkel)); |
} |
//############################################################################ |
// Sinusfunktion im Gradmaß |
float sin_f(signed int winkel) |
//############################################################################ |
{ |
short int m,n; |
float sinus; |
//winkel = winkel % 360; |
if (winkel < 0) |
{ |
m = -1; |
winkel = abs(winkel); |
} |
else m = +1; |
// Quadranten auswerten |
if (winkel <= 90) n=1; |
else if ((winkel > 90 ) && (winkel <= 180)) {winkel = 180 - winkel; n = 1;} |
else if ((winkel > 180 ) && (winkel <= 270)) {winkel = winkel - 180; n = -1;} |
else {winkel = 360 - winkel; n = -1;} //if ((winkel > 270) && (winkel <= 360)) |
sinus = pgm_read_float(&pgm_sinus_f[winkel]); |
return (sinus*m*n); |
} |
/* |
const uint8_t pgm_asin[201] PROGMEM = {0,0,1,1,1,1,2,2,2,3,3,3,3,4,4,4,5,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9,10,10,10,11,11,11,12,12,12,12,13,13,13,14,14,14,14,15,15,15,16,16,16,17,17,17,17,18,18,18,19,19,19,20,20,20,20,21,21,21,22,22,22,23,23,23,24,24,24,25,25,25,25,26,26,26,27,27,27,28,28,28,29,29,29,30,30,30,31,31,31,32,32,32,33,33,33,34,34,34,35,35,35,36,36,37,37,37,38,38,38,39,39,39,40,40,41,41,41,42,42,42,43,43,44,44,44,45,45,46,46,46,47,47,48,48,49,49,49,50,50,51,51,52,52,53,53,54,54,55,55,56,56,57,57,58,58,59,59,60,60,61,62,62,63,64,64,65,66,66,67,68,68,69,70,71,72,73,74,75,76,77,79,80,82,84,90}; |
//############################################################################ |
// Akurssinusfunktion im Gradmaß |
int8_t asin_i(signed int i) |
//############################################################################ |
{ |
signed char m; |
if (i < 0) {m=-1;i=abs(i);} |
else m=1; |
i = i % 200; |
return (pgm_read_byte(&pgm_asin[i]) * m); |
} |
*/ |
/branches/v0.60_MicroMag3_Nick666/v0.66c/mymath.h |
---|
0,0 → 1,11 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Peter Muehlenbrock |
// Definitionen fuer Modul math |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
extern signed int atan2_i(signed int x, signed int y); |
extern float cos_f(signed int winkel); |
extern float sin_f(signed int winkel); |
//extern int8_t asin_i(signed int i); |
/branches/v0.60_MicroMag3_Nick666/v0.66c/old_macros.h |
---|
0,0 → 1,47 |
/* |
For backwards compatibility only. |
Ingo Busker ingo@mikrocontroller.com |
*/ |
#ifndef cbi |
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) |
#endif |
#ifndef sbi |
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) |
#endif |
#ifndef inb |
#define inb(sfr) _SFR_BYTE(sfr) |
#endif |
#ifndef outb |
#define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) |
#endif |
#ifndef inw |
#define inw(sfr) _SFR_WORD(sfr) |
#endif |
#ifndef outw |
#define outw(sfr, val) (_SFR_WORD(sfr) = (val)) |
#endif |
#ifndef outp |
#define outp(val, sfr) outb(sfr, val) |
#endif |
#ifndef inp |
#define inp(sfr) inb(sfr) |
#endif |
#ifndef BV |
#define BV(bit) _BV(bit) |
#endif |
#ifndef PRG_RDB |
#define PRG_RDB pgm_read_byte |
#endif |
/branches/v0.60_MicroMag3_Nick666/v0.66c/printf_P.c |
---|
0,0 → 1,480 |
// Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist nicht von der Lizenz für den MikroKopter-Teil unterstellt |
/* |
Copyright (C) 1993 Free Software Foundation |
This file is part of the GNU IO Library. This library is free |
software; you can redistribute it and/or modify it under the |
terms of the GNU General Public License as published by the |
Free Software Foundation; either version 2, or (at your option) |
any later version. |
This library is distributed in the hope that it will be useful, |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
GNU General Public License for more details. |
You should have received a copy of the GNU General Public License |
along with this library; see the file COPYING. If not, write to the Free |
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
As a special exception, if you link this library with files |
compiled with a GNU compiler to produce an executable, this does not cause |
the resulting executable to be covered by the GNU General Public License. |
This exception does not however invalidate any other reasons why |
the executable file might be covered by the GNU General Public License. */ |
/* |
* Copyright (c) 1990 Regents of the University of California. |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* 1. Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* 3. [rescinded 22 July 1999] |
* 4. Neither the name of the University nor the names of its contributors |
* may be used to endorse or promote products derived from this software |
* without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
* SUCH DAMAGE. |
*/ |
/****************************************************************************** |
This file is a patched version of printf called _printf_P |
It is made to work with avr-gcc for Atmel AVR MCUs. |
There are some differences from standard printf: |
1. There is no floating point support (with fp the code is about 8K!) |
2. Return type is void |
3. Format string must be in program memory (by using macro printf this is |
done automaticaly) |
4. %n is not implemented (just remove the comment around it if you need it) |
5. If LIGHTPRINTF is defined, the code is about 550 bytes smaller and the |
folowing specifiers are disabled : |
space # * . - + p s o O |
6. A function void uart_sendchar(char c) is used for output. The UART must |
be initialized before using printf. |
Alexander Popov |
sasho@vip.orbitel.bg |
******************************************************************************/ |
/* |
* Actual printf innards. |
* |
* This code is large and complicated... |
*/ |
#include <string.h> |
#ifdef __STDC__ |
#include <stdarg.h> |
#else |
#include <varargs.h> |
#endif |
#include "main.h" |
//#define LIGHTPRINTF |
char PrintZiel; |
char Putchar(char zeichen) |
{ |
if(PrintZiel == OUT_LCD) { DisplayBuff[DispPtr++] = zeichen; return(1);} |
else return(uart_putchar(zeichen)); |
} |
void PRINT(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(*ptr++); |
} |
void PRINTP(const char * ptr, unsigned int len) |
{ |
for(;len;len--) Putchar(pgm_read_byte(ptr++)); |
} |
void PAD_SP(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar(' '); |
} |
void PAD_0(signed char howmany) |
{ |
for(;howmany>0;howmany--) Putchar('0'); |
} |
#define BUF 40 |
/* |
* Macros for converting digits to letters and vice versa |
*/ |
#define to_digit(c) ((c) - '0') |
#define is_digit(c) ((c)<='9' && (c)>='0') |
#define to_char(n) ((n) + '0') |
/* |
* Flags used during conversion. |
*/ |
#define LONGINT 0x01 /* long integer */ |
#define LONGDBL 0x02 /* long double; unimplemented */ |
#define SHORTINT 0x04 /* short integer */ |
#define ALT 0x08 /* alternate form */ |
#define LADJUST 0x10 /* left adjustment */ |
#define ZEROPAD 0x20 /* zero (as opposed to blank) pad */ |
#define HEXPREFIX 0x40 /* add 0x or 0X prefix */ |
void _printf_P (char ziel,char const *fmt0, ...) /* Works with string from FLASH */ |
{ |
va_list ap; |
register const char *fmt; /* format string */ |
register char ch; /* character from fmt */ |
register int n; /* handy integer (short term usage) */ |
register char *cp; /* handy char pointer (short term usage) */ |
const char *fmark; /* for remembering a place in fmt */ |
register unsigned char flags; /* flags as above */ |
signed char width; /* width from format (%8d), or 0 */ |
signed char prec; /* precision from format (%.3d), or -1 */ |
char sign; /* sign prefix (' ', '+', '-', or \0) */ |
unsigned long _ulong=0; /* integer arguments %[diouxX] */ |
#define OCT 8 |
#define DEC 10 |
#define HEX 16 |
unsigned char base; /* base for [diouxX] conversion */ |
signed char dprec; /* a copy of prec if [diouxX], 0 otherwise */ |
signed char dpad; /* extra 0 padding needed for integers */ |
signed char fieldsz; /* field size expanded by sign, dpad etc */ |
/* The initialization of 'size' is to suppress a warning that |
'size' might be used unitialized. It seems gcc can't |
quite grok this spaghetti code ... */ |
signed char size = 0; /* size of converted field or string */ |
char buf[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ |
char ox[2]; /* space for 0x hex-prefix */ |
PrintZiel = ziel; // bestimmt, LCD oder UART |
va_start(ap, fmt0); |
fmt = fmt0; |
/* |
* Scan the format for conversions (`%' character). |
*/ |
for (;;) { |
for (fmark = fmt; (ch = pgm_read_byte(fmt)) != '\0' && ch != '%'; fmt++) |
/* void */; |
if ((n = fmt - fmark) != 0) { |
PRINTP(fmark, n); |
} |
if (ch == '\0') |
goto done; |
fmt++; /* skip over '%' */ |
flags = 0; |
dprec = 0; |
width = 0; |
prec = -1; |
sign = '\0'; |
rflag: ch = PRG_RDB(fmt++); |
reswitch: |
#ifdef LIGHTPRINTF |
if (ch=='o' || ch=='u' || (ch|0x20)=='x') { |
#else |
if (ch=='u' || (ch|0x20)=='x') { |
#endif |
if (flags&LONGINT) { |
_ulong=va_arg(ap, unsigned long); |
} else { |
register unsigned int _d; |
_d=va_arg(ap, unsigned int); |
_ulong = flags&SHORTINT ? (unsigned long)(unsigned short)_d : (unsigned long)_d; |
} |
} |
#ifndef LIGHTPRINTF |
if(ch==' ') { |
/* |
* ``If the space and + flags both appear, the space |
* flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
if (!sign) |
sign = ' '; |
goto rflag; |
} else if (ch=='#') { |
flags |= ALT; |
goto rflag; |
} else if (ch=='*'||ch=='-') { |
if (ch=='*') { |
/* |
* ``A negative field width argument is taken as a |
* - flag followed by a positive field width.'' |
* -- ANSI X3J11 |
* They don't exclude field widths read from args. |
*/ |
if ((width = va_arg(ap, int)) >= 0) |
goto rflag; |
width = -width; |
} |
flags |= LADJUST; |
flags &= ~ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch=='+') { |
sign = '+'; |
goto rflag; |
} else if (ch=='.') { |
if ((ch = PRG_RDB(fmt++)) == '*') { |
n = va_arg(ap, int); |
prec = n < 0 ? -1 : n; |
goto rflag; |
} |
n = 0; |
while (is_digit(ch)) { |
n = n*10 + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} |
prec = n < 0 ? -1 : n; |
goto reswitch; |
} else |
#endif /* LIGHTPRINTF */ |
if (ch=='0') { |
/* |
* ``Note that 0 is taken as a flag, not as the |
* beginning of a field width.'' |
* -- ANSI X3J11 |
*/ |
if (!(flags & LADJUST)) |
flags |= ZEROPAD; /* '-' disables '0' */ |
goto rflag; |
} else if (ch>='1' && ch<='9') { |
n = 0; |
do { |
n = 10 * n + to_digit(ch); |
ch = PRG_RDB(fmt++); |
} while (is_digit(ch)); |
width = n; |
goto reswitch; |
} else if (ch=='h') { |
flags |= SHORTINT; |
goto rflag; |
} else if (ch=='l') { |
flags |= LONGINT; |
goto rflag; |
} else if (ch=='c') { |
*(cp = buf) = va_arg(ap, int); |
size = 1; |
sign = '\0'; |
} else if (ch=='D'||ch=='d'||ch=='i') { |
if(ch=='D') |
flags |= LONGINT; |
if (flags&LONGINT) { |
_ulong=va_arg(ap, long); |
} else { |
register int _d; |
_d=va_arg(ap, int); |
_ulong = flags&SHORTINT ? (long)(short)_d : (long)_d; |
} |
if ((long)_ulong < 0) { |
_ulong = -_ulong; |
sign = '-'; |
} |
base = DEC; |
goto number; |
} else |
/* |
if (ch=='n') { |
if (flags & LONGINT) |
*va_arg(ap, long *) = ret; |
else if (flags & SHORTINT) |
*va_arg(ap, short *) = ret; |
else |
*va_arg(ap, int *) = ret; |
continue; // no output |
} else |
*/ |
#ifndef LIGHTPRINTF |
if (ch=='O'||ch=='o') { |
if (ch=='O') |
flags |= LONGINT; |
base = OCT; |
goto nosign; |
} else if (ch=='p') { |
/* |
* ``The argument shall be a pointer to void. The |
* value of the pointer is converted to a sequence |
* of printable characters, in an implementation- |
* defined manner.'' |
* -- ANSI X3J11 |
*/ |
/* NOSTRICT */ |
_ulong = (unsigned int)va_arg(ap, void *); |
base = HEX; |
flags |= HEXPREFIX; |
ch = 'x'; |
goto nosign; |
} else if (ch=='s') { // print a string from RAM |
if ((cp = va_arg(ap, char *)) == NULL) { |
cp=buf; |
cp[0] = '('; |
cp[1] = 'n'; |
cp[2] = 'u'; |
cp[4] = cp[3] = 'l'; |
cp[5] = ')'; |
cp[6] = '\0'; |
} |
if (prec >= 0) { |
/* |
* can't use strlen; can only look for the |
* NUL in the first `prec' characters, and |
* strlen() will go further. |
*/ |
char *p = (char*)memchr(cp, 0, prec); |
if (p != NULL) { |
size = p - cp; |
if (size > prec) |
size = prec; |
} else |
size = prec; |
} else |
size = strlen(cp); |
sign = '\0'; |
} else |
#endif /* LIGHTPRINTF */ |
if(ch=='U'||ch=='u') { |
if (ch=='U') |
flags |= LONGINT; |
base = DEC; |
goto nosign; |
} else if (ch=='X'||ch=='x') { |
base = HEX; |
/* leading 0x/X only if non-zero */ |
if (flags & ALT && _ulong != 0) |
flags |= HEXPREFIX; |
/* unsigned conversions */ |
nosign: sign = '\0'; |
/* |
* ``... diouXx conversions ... if a precision is |
* specified, the 0 flag will be ignored.'' |
* -- ANSI X3J11 |
*/ |
number: if ((dprec = prec) >= 0) |
flags &= ~ZEROPAD; |
/* |
* ``The result of converting a zero value with an |
* explicit precision of zero is no characters.'' |
* -- ANSI X3J11 |
*/ |
cp = buf + BUF; |
if (_ulong != 0 || prec != 0) { |
register unsigned char _d,notlastdigit; |
do { |
notlastdigit=(_ulong>=base); |
_d = _ulong % base; |
if (_d<10) { |
_d+='0'; |
} else { |
_d+='a'-10; |
if (ch=='X') _d&=~0x20; |
} |
*--cp=_d; |
_ulong /= base; |
} while (notlastdigit); |
#ifndef LIGHTPRINTF |
// handle octal leading 0 |
if (base==OCT && flags & ALT && *cp != '0') |
*--cp = '0'; |
#endif |
} |
size = buf + BUF - cp; |
} else { //default |
/* "%?" prints ?, unless ? is NUL */ |
if (ch == '\0') |
goto done; |
/* pretend it was %c with argument ch */ |
cp = buf; |
*cp = ch; |
size = 1; |
sign = '\0'; |
} |
/* |
* All reasonable formats wind up here. At this point, |
* `cp' points to a string which (if not flags&LADJUST) |
* should be padded out to `width' places. If |
* flags&ZEROPAD, it should first be prefixed by any |
* sign or other prefix; otherwise, it should be blank |
* padded before the prefix is emitted. After any |
* left-hand padding and prefixing, emit zeroes |
* required by a decimal [diouxX] precision, then print |
* the string proper, then emit zeroes required by any |
* leftover floating precision; finally, if LADJUST, |
* pad with blanks. |
*/ |
/* |
* compute actual size, so we know how much to pad. |
*/ |
fieldsz = size; |
dpad = dprec - size; |
if (dpad < 0) |
dpad = 0; |
if (sign) |
fieldsz++; |
else if (flags & HEXPREFIX) |
fieldsz += 2; |
fieldsz += dpad; |
/* right-adjusting blank padding */ |
if ((flags & (LADJUST|ZEROPAD)) == 0) |
PAD_SP(width - fieldsz); |
/* prefix */ |
if (sign) { |
PRINT(&sign, 1); |
} else if (flags & HEXPREFIX) { |
ox[0] = '0'; |
ox[1] = ch; |
PRINT(ox, 2); |
} |
/* right-adjusting zero padding */ |
if ((flags & (LADJUST|ZEROPAD)) == ZEROPAD) |
PAD_0(width - fieldsz); |
/* leading zeroes from decimal precision */ |
PAD_0(dpad); |
/* the string or number proper */ |
PRINT(cp, size); |
/* left-adjusting padding (always blank) */ |
if (flags & LADJUST) |
PAD_SP(width - fieldsz); |
} |
done: |
va_end(ap); |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/printf_P.h |
---|
0,0 → 1,19 |
#ifndef _PRINTF_P_H_ |
#define _PRINTF_P_H_ |
#include <avr/pgmspace.h> |
#define OUT_V24 0 |
#define OUT_LCD 1 |
void _printf_P (char, char const *fmt0, ...); |
extern char PrintZiel; |
#define printf_P(format, args...) _printf_P(OUT_V24,format , ## args) |
#define printf(format, args...) _printf_P(OUT_V24,PSTR(format) , ## args) |
#define LCD_printfxy(x,y,format, args...) { DispPtr = y * 20 + x; _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#define LCD_printf(format, args...) { _printf_P(OUT_LCD,PSTR(format) , ## args);} |
#endif |
/branches/v0.60_MicroMag3_Nick666/v0.66c/rc.c |
---|
0,0 → 1,85 |
/*####################################################################################### |
Decodieren eines RC Summen Signals |
#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "rc.h" |
#include "main.h" |
volatile int PPM_in[11]; |
volatile int PPM_diff[11]; // das diffenzierte Stick-Signal |
volatile unsigned char NewPpmData = 1; |
//############################################################################ |
//zum decodieren des PPM-Signals wird Timer1 mit seiner Input |
//Capture Funktion benutzt: |
void rc_sum_init(void) |
//############################################################################ |
{ |
TCCR1B=(1<<CS11)|(1<<CS10)|(1<<ICES1)|(1<<ICNC1);//|(1 << WGM12); //timer1 prescale 64 |
// PWM |
//TCCR1A = (1 << COM1B1) | (1 << WGM11) | (1 << WGM10); |
//TCCR1B |= (1 << WGM12); |
//OCR1B = 55; |
TIMSK1 |= _BV(ICIE1); |
AdNeutralGier = 0; |
AdNeutralRoll = 0; |
AdNeutralNick = 0; |
return; |
} |
//############################################################################ |
//Diese Routine startet und inizialisiert den Timer für RC |
SIGNAL(SIG_INPUT_CAPTURE1) |
//############################################################################ |
{ |
static unsigned int AltICR=0; |
signed int signal = 0,tmp; |
static int index; |
signal = (unsigned int) ICR1 - AltICR; |
AltICR = ICR1; |
//Syncronisationspause? |
if ((signal > 1500) && (signal < 8000)) |
{ |
index = 1; |
NewPpmData = 0; // Null bedeutet: Neue Daten |
// OCR2A = Poti2/2 + 80; |
} |
else |
{ |
if(index < 10) |
{ |
if((signal > 250) && (signal < 687)) |
{ |
signal -= 466; |
// Stabiles Signal |
if(abs(signal - PPM_in[index]) < 6) { if(SenderOkay < 200) SenderOkay += 10;} |
tmp = (3 * (PPM_in[index]) + signal) / 4; |
// if(tmp > signal+1) tmp--; else |
// if(tmp < signal-1) tmp++; |
PPM_diff[index] = tmp - PPM_in[index]; |
PPM_in[index] = tmp; |
} |
index++; |
if(index == 5) PORTD |= 0x20; else PORTD &= ~0x20; // Servosignal an J3 anlegen |
if(index == 6) PORTD |= 0x10; else PORTD &= ~0x10; // Servosignal an J4 anlegen |
if(index == 7) PORTD |= 0x08; else PORTD &= ~0x08; // Servosignal an J5 anlegen |
} |
} |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/rc.h |
---|
0,0 → 1,29 |
/*####################################################################################### |
Derkodieren eines RC Summen Signals |
#######################################################################################*/ |
#ifndef _RC_H |
#define _RC_H |
#if defined (__AVR_ATmega32__) |
#define TIMER_TEILER CK64 |
#define TIMER_RELOAD_VALUE 250 |
#endif |
#if defined (__AVR_ATmega644__) |
//#define TIMER_TEILER CK64 |
#define TIMER_RELOAD_VALUE 250 |
//#define TIMER_TEILER CK256 // bei 20MHz |
//#define TIMER_RELOAD_VALUE -78 // bei 20MHz |
#endif |
#define GAS PPM_in[2] |
extern void rc_sum_init (void); |
extern volatile int PPM_in[11]; |
extern volatile int PPM_diff[11]; // das diffenzierte Stick-Signal |
extern volatile unsigned char NewPpmData; |
#endif //_RC_H |
/branches/v0.60_MicroMag3_Nick666/v0.66c/timer0.c |
---|
0,0 → 1,145 |
#include "main.h" |
volatile unsigned int CountMilliseconds = 0; |
volatile unsigned char UpdateMotor = 0; |
volatile unsigned int beeptime = 0; |
unsigned int BeepMuster = 0xffff; |
int ServoValue = 0; |
enum { |
STOP = 0, |
CK = 1, |
CK8 = 2, |
CK64 = 3, |
CK256 = 4, |
CK1024 = 5, |
T0_FALLING_EDGE = 6, |
T0_RISING_EDGE = 7 |
}; |
SIGNAL (SIG_OVERFLOW0) // 9,8kHz |
{ |
static unsigned char cnt_1ms = 1,cnt = 0; |
unsigned char pieper_ein = 0; |
// TCNT0 -= 250;//TIMER_RELOAD_VALUE; |
if(!cnt--) |
{ |
cnt = 10; |
cnt_1ms++; |
cnt_1ms %= 2; |
if(!cnt_1ms) UpdateMotor = 1; |
CountMilliseconds++; |
} |
if(beeptime > 1) |
{ |
beeptime--; |
if(beeptime & BeepMuster) |
{ |
pieper_ein = 1; |
} |
else pieper_ein = 0; |
} |
else |
{ |
pieper_ein = 0; |
BeepMuster = 0xffff; |
} |
if(pieper_ein) |
{ |
if(PlatinenVersion == 10) PORTD |= (1<<2); // Speaker an PORTD.2 |
else PORTC |= (1<<7); // Speaker an PORTC.7 |
} |
else |
{ |
if(PlatinenVersion == 10) PORTD &= ~(1<<2); |
else PORTC &= ~(1<<7); |
} |
if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) timer0_MM3(); // Kompass auslesen |
} |
void Timer_Init(void) |
{ |
TCCR0B = CK8; |
TCCR0A = (1<<COM0A1)|(1<<COM0B1)|3;//fast PWM |
OCR0A = 0; |
OCR0B = 120; |
TCNT0 = (unsigned char)-TIMER_RELOAD_VALUE; // reload |
//OCR1 = 0x00; |
TCCR2A=(1<<COM2A1)|(1<<COM2A0)|3; |
TCCR2B=(0<<CS20)|(1<<CS21)|(1<<CS22); |
// TIMSK2 |= _BV(TOIE2); |
TIMSK2 |= _BV(OCIE2A); |
TIMSK0 |= _BV(TOIE0); |
OCR2A = 10; |
TCNT2 = 0; |
} |
// ----------------------------------------------------------------------- |
unsigned int SetDelay (unsigned int t) |
{ |
// TIMSK0 &= ~_BV(TOIE0); |
return(CountMilliseconds + t + 1); |
// TIMSK0 |= _BV(TOIE0); |
} |
// ----------------------------------------------------------------------- |
char CheckDelay(unsigned int t) |
{ |
// TIMSK0 &= ~_BV(TOIE0); |
return(((t - CountMilliseconds) & 0x8000) >> 9); |
// TIMSK0 |= _BV(TOIE0); |
} |
// ----------------------------------------------------------------------- |
void Delay_ms(unsigned int w) |
{ |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)); |
} |
void Delay_ms_Mess(unsigned int w) |
{ |
unsigned int akt; |
akt = SetDelay(w); |
while (!CheckDelay(akt)) ANALOG_ON; |
} |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// Servo ansteuern |
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(SIG_OUTPUT_COMPARE2A) |
{ |
static unsigned char timer = 10; |
if(!timer--) |
{ |
TCCR2A=(1<<COM2A1)|(0<<COM2A0)|3; |
ServoValue = Parameter_ServoNickControl; |
if(EE_Parameter.ServoNickCompInvert & 0x01) ServoValue += ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512; |
else ServoValue -= ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512; |
if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin; |
else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax; |
OCR2A = ServoValue;// + 75; |
timer = EE_Parameter.ServoNickRefresh; |
} |
else |
{ |
TCCR2A =3; |
PORTD&=~0x80; |
} |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/timer0.h |
---|
0,0 → 1,15 |
#define TIMER_TEILER CK8 |
#define TIMER_RELOAD_VALUE 250 |
void Timer_Init(void); |
void Delay_ms(unsigned int); |
void Delay_ms_Mess(unsigned int); |
unsigned int SetDelay (unsigned int t); |
char CheckDelay (unsigned int t); |
extern volatile unsigned int CountMilliseconds; |
extern volatile unsigned char UpdateMotor; |
extern volatile unsigned int beeptime; |
extern int ServoValue; |
extern unsigned int BeepMuster; |
/branches/v0.60_MicroMag3_Nick666/v0.66c/twimaster.c |
---|
0,0 → 1,152 |
/*############################################################################ |
############################################################################*/ |
#include "main.h" |
unsigned char twi_state = 0; |
unsigned char motor = 0; |
unsigned char motorread = 0; |
unsigned char motor_rx[8]; |
//############################################################################ |
//Initzialisieren der I2C (TWI) Schnittstelle |
void i2c_init(void) |
//############################################################################ |
{ |
TWSR = 0; |
TWBR = ((SYSCLK/SCL_CLOCK)-16)/2; |
} |
//############################################################################ |
//Start I2C |
char i2c_start(void) |
//############################################################################ |
{ |
TWCR = (1<<TWSTA) | (1<<TWEN) | (1<<TWINT) | (1<<TWIE); |
return(0); |
} |
//############################################################################ |
//Start I2C |
void i2c_stop(void) |
//############################################################################ |
{ |
TWCR = (1<<TWEN) | (1<<TWSTO) | (1<<TWINT); |
} |
void i2c_reset(void) |
//############################################################################ |
{ |
i2c_stop(); |
twi_state = 0; |
motor = TWDR; |
motor = 0; |
TWCR = 0x80; |
TWAMR = 0; |
TWAR = 0; |
TWDR = 0; |
TWSR = 0; |
TWBR = 0; |
i2c_init(); |
i2c_start(); |
i2c_write_byte(0); |
} |
//############################################################################ |
//Start I2C |
char i2c_write_byte(char byte) |
//############################################################################ |
{ |
TWSR = 0x00; |
TWDR = byte; |
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWIE); |
return(0); |
} |
//############################################################################ |
//Start I2C |
SIGNAL (TWI_vect) |
//############################################################################ |
{ |
switch (twi_state++) |
{ |
case 0: |
i2c_write_byte(0x52+(motor*2)); |
break; |
case 1: |
switch(motor++) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 2: |
i2c_stop(); |
if (motor<4) twi_state = 0; |
else motor = 0; |
i2c_start(); |
break; |
//Liest Daten von Motor |
case 3: |
i2c_write_byte(0x53+(motorread*2)); |
break; |
case 4: |
switch(motorread) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 5: //1 Byte vom Motor lesen |
motor_rx[motorread] = TWDR; |
case 6: |
switch(motorread) |
{ |
case 0: |
i2c_write_byte(Motor_Vorne); |
break; |
case 1: |
i2c_write_byte(Motor_Hinten); |
break; |
case 2: |
i2c_write_byte(Motor_Rechts); |
break; |
case 3: |
i2c_write_byte(Motor_Links); |
break; |
} |
break; |
case 7: //2 Byte vom Motor lesen |
motor_rx[motorread+4] = TWDR; |
motorread++; |
if (motorread>3) motorread=0; |
i2c_stop(); |
I2CTimeout = 10; |
twi_state = 0; |
} |
TWCR |= 0x80; |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/twimaster.h |
---|
0,0 → 1,33 |
/*############################################################################ |
############################################################################*/ |
#ifndef _I2C_MASTER_H |
#define _I2C_MASTER_H |
//############################################################################ |
// I2C Konstanten |
#define SCL_CLOCK 200000L |
#define I2C_TIMEOUT 30000 |
#define I2C_START 0x08 |
#define I2C_REPEATED_START 0x10 |
#define I2C_TX_SLA_ACK 0x18 |
#define I2C_TX_DATA_ACK 0x28 |
#define I2C_RX_SLA_ACK 0x40 |
#define I2C_RX_DATA_ACK 0x50 |
//############################################################################ |
extern unsigned char twi_state; |
extern unsigned char motor; |
extern unsigned char motorread; |
extern unsigned char motor_rx[8]; |
void i2c_reset(void); |
extern void i2c_init (void); // I2C initialisieren |
extern char i2c_start (void); // Start I2C |
extern void i2c_stop (void); // Stop I2C |
extern char i2c_write_byte (char byte); // 1 Byte schreiben |
extern void i2c_reset(void); |
#endif |
/branches/v0.60_MicroMag3_Nick666/v0.66c/uart.c |
---|
0,0 → 1,335 |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 04.2007 Holger Buss |
// + only for non-profit use |
// + www.MikroKopter.com |
// + see the File "License.txt" for further Informations |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "main.h" |
#include "uart.h" |
unsigned char DebugGetAnforderung = 0,DebugDisplayAnforderung = 0,DebugDataAnforderung = 0,GetVersionAnforderung = 0; |
unsigned volatile char SioTmp = 0; |
unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
unsigned volatile char NMEABuffer[MAX_EMPFANGS_BUFF]; |
unsigned volatile char NeuerDatensatzEmpfangen = 0; |
unsigned volatile char NeueKoordinateEmpfangen = 0; |
unsigned volatile char UebertragungAbgeschlossen = 1; |
unsigned volatile char CntCrcError = 0; |
unsigned volatile char AnzahlEmpfangsBytes = 0; |
unsigned volatile char PC_DebugTimeout = 0; |
unsigned char NurKanalAnforderung = 0; |
unsigned char PcZugriff = 100; |
unsigned char MotorTest[4] = {0,0,0,0}; |
unsigned char MeineSlaveAdresse; |
struct str_DebugOut DebugOut; |
struct str_Debug DebugIn; |
struct str_VersionInfo VersionInfo; |
int Debug_Timer; |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Sende-Part der Datenübertragung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_TX) |
{ |
static unsigned int ptr = 0; |
unsigned char tmp_tx; |
if(!UebertragungAbgeschlossen) |
{ |
ptr++; // die [0] wurde schon gesendet |
tmp_tx = SendeBuffer[ptr]; |
if((tmp_tx == '\r') || (ptr == MAX_SENDE_BUFF)) |
{ |
ptr = 0; |
UebertragungAbgeschlossen = 1; |
} |
UDR = tmp_tx; |
} |
else ptr = 0; |
} |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
//++ Empfangs-Part der Datenübertragung, incl. CRC-Auswertung |
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
SIGNAL(INT_VEC_RX) |
{ |
static unsigned int crc; |
static unsigned char crc1,crc2,buf_ptr; |
static unsigned char UartState = 0; |
unsigned char CrcOkay = 0; |
SioTmp = UDR; |
if(buf_ptr >= MAX_EMPFANGS_BUFF) UartState = 0; |
if(SioTmp == '\r' && UartState == 2) |
{ |
UartState = 0; |
crc -= RxdBuffer[buf_ptr-2]; |
crc -= RxdBuffer[buf_ptr-1]; |
crc %= 4096; |
crc1 = '=' + crc / 64; |
crc2 = '=' + crc % 64; |
CrcOkay = 0; |
if((crc1 == RxdBuffer[buf_ptr-2]) && (crc2 == RxdBuffer[buf_ptr-1])) CrcOkay = 1; else { CrcOkay = 0; CntCrcError++;}; |
if(!NeuerDatensatzEmpfangen && CrcOkay) // Datensatz schon verarbeitet |
{ |
NeuerDatensatzEmpfangen = 1; |
AnzahlEmpfangsBytes = buf_ptr; |
RxdBuffer[buf_ptr] = '\r'; |
if(RxdBuffer[2] == 'R') wdt_enable(WDTO_250MS); // Reset-Commando |
} |
} |
else |
switch(UartState) |
{ |
case 0: |
if(SioTmp == '#' && !NeuerDatensatzEmpfangen) UartState = 1; // Startzeichen und Daten schon verarbeitet |
buf_ptr = 0; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc = SioTmp; |
break; |
case 1: // Adresse auswerten |
UartState++; |
RxdBuffer[buf_ptr++] = SioTmp; |
crc += SioTmp; |
break; |
case 2: // Eingangsdaten sammeln |
RxdBuffer[buf_ptr] = SioTmp; |
if(buf_ptr < MAX_EMPFANGS_BUFF) buf_ptr++; |
else UartState = 0; |
crc += SioTmp; |
break; |
default: |
UartState = 0; |
break; |
} |
} |
// -------------------------------------------------------------------------- |
void AddCRC(unsigned int wieviele) |
{ |
unsigned int tmpCRC = 0,i; |
for(i = 0; i < wieviele;i++) |
{ |
tmpCRC += SendeBuffer[i]; |
} |
tmpCRC %= 4096; |
SendeBuffer[i++] = '=' + tmpCRC / 64; |
SendeBuffer[i++] = '=' + tmpCRC % 64; |
SendeBuffer[i++] = '\r'; |
UebertragungAbgeschlossen = 0; |
UDR = SendeBuffer[0]; |
} |
// -------------------------------------------------------------------------- |
void SendOutData(unsigned char cmd,unsigned char modul, unsigned char *snd, unsigned char len) |
{ |
unsigned int pt = 0; |
unsigned char a,b,c; |
unsigned char ptr = 0; |
SendeBuffer[pt++] = '#'; // Startzeichen |
SendeBuffer[pt++] = modul; // Adresse (a=0; b=1,...) |
SendeBuffer[pt++] = cmd; // Commando |
while(len) |
{ |
if(len) { a = snd[ptr++]; len--;} else a = 0; |
if(len) { b = snd[ptr++]; len--;} else b = 0; |
if(len) { c = snd[ptr++]; len--;} else c = 0; |
SendeBuffer[pt++] = '=' + (a >> 2); |
SendeBuffer[pt++] = '=' + (((a & 0x03) << 4) | ((b & 0xf0) >> 4)); |
SendeBuffer[pt++] = '=' + (((b & 0x0f) << 2) | ((c & 0xc0) >> 6)); |
SendeBuffer[pt++] = '=' + ( c & 0x3f); |
} |
AddCRC(pt); |
} |
// -------------------------------------------------------------------------- |
void Decode64(unsigned char *ptrOut, unsigned char len, unsigned char ptrIn,unsigned char max) // Wohin mit den Daten; Wie lang; Wo im RxdBuffer |
{ |
unsigned char a,b,c,d; |
unsigned char ptr = 0; |
unsigned char x,y,z; |
while(len) |
{ |
a = RxdBuffer[ptrIn++] - '='; |
b = RxdBuffer[ptrIn++] - '='; |
c = RxdBuffer[ptrIn++] - '='; |
d = RxdBuffer[ptrIn++] - '='; |
if(ptrIn > max - 2) break; // nicht mehr Daten verarbeiten, als empfangen wurden |
x = (a << 2) | (b >> 4); |
y = ((b & 0x0f) << 4) | (c >> 2); |
z = ((c & 0x03) << 6) | d; |
if(len--) ptrOut[ptr++] = x; else break; |
if(len--) ptrOut[ptr++] = y; else break; |
if(len--) ptrOut[ptr++] = z; else break; |
} |
} |
// -------------------------------------------------------------------------- |
void BearbeiteRxDaten(void) |
{ |
if(!NeuerDatensatzEmpfangen) return; |
// unsigned int tmp_int_arr1[1]; |
// unsigned int tmp_int_arr2[2]; |
// unsigned int tmp_int_arr3[3]; |
unsigned char tmp_char_arr2[2]; |
// unsigned char tmp_char_arr3[3]; |
// unsigned char tmp_char_arr4[4]; |
//if(!MotorenEin) |
PcZugriff = 255; |
switch(RxdBuffer[2]) |
{ |
case 'c':// Debugdaten incl. Externe IOs usw |
Decode64((unsigned char *) &DebugIn,sizeof(DebugIn),3,AnzahlEmpfangsBytes); |
/* for(unsigned char i=0; i<4;i++) |
{ |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2], DebugIn.Analog[i]); |
EE_CheckAndWrite(&EE_Buffer[EE_DEBUGWERTE + i*2 + 1], DebugIn.Analog[i] >> 8); |
}*/ |
RemoteTasten |= DebugIn.RemoteTasten; |
DebugDataAnforderung = 1; |
break; |
case 'h':// x-1 Displayzeilen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
RemoteTasten |= tmp_char_arr2[0]; |
if(tmp_char_arr2[1] == 255) NurKanalAnforderung = 1; else NurKanalAnforderung = 0; // keine Displaydaten |
DebugDisplayAnforderung = 1; |
break; |
case 't':// Motortest |
Decode64((unsigned char *) &MotorTest[0],sizeof(MotorTest),3,AnzahlEmpfangsBytes); |
break; |
case 'v': // Version-Anforderung und Ausbaustufe |
GetVersionAnforderung = 1; |
break; |
case 'g':// "Get"-Anforderung für Debug-Daten |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
DebugGetAnforderung = 1; |
break; |
case 'q':// "Get"-Anforderung für Settings |
// Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
Decode64((unsigned char *) &tmp_char_arr2[0],sizeof(tmp_char_arr2),3,AnzahlEmpfangsBytes); |
if(tmp_char_arr2[0] != 0xff) |
{ |
if(tmp_char_arr2[0] > 5) tmp_char_arr2[0] = 5; |
ReadParameterSet(tmp_char_arr2[0], (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
SendOutData('L' + tmp_char_arr2[0] -1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE); |
} |
else |
SendOutData('L' + GetActiveParamSetNumber()-1,MeineSlaveAdresse,(unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE); |
break; |
case 'l': |
case 'm': |
case 'n': |
case 'o': |
case 'p': // Parametersatz speichern |
Decode64((unsigned char *) &EE_Parameter.Kanalbelegung[0],STRUCT_PARAM_LAENGE,3,AnzahlEmpfangsBytes); |
WriteParameterSet(RxdBuffer[2] - 'l' + 1, (unsigned char *) &EE_Parameter.Kanalbelegung[0], STRUCT_PARAM_LAENGE); |
eeprom_write_byte(&EEPromArray[EEPROM_ADR_ACTIVE_SET], RxdBuffer[2] - 'l' + 1); // aktiven Datensatz merken |
Umschlag180Nick = (long) EE_Parameter.WinkelUmschlagNick * 2500L; |
Umschlag180Roll = (long) EE_Parameter.WinkelUmschlagRoll * 2500L; |
Piep(GetActiveParamSetNumber()); |
break; |
} |
// DebugOut.AnzahlZyklen = Debug_Timer_Intervall; |
NeuerDatensatzEmpfangen = 0; |
} |
//############################################################################ |
//Routine für die Serielle Ausgabe |
int uart_putchar (char c) |
//############################################################################ |
{ |
if (c == '\n') |
uart_putchar('\r'); |
//Warten solange bis Zeichen gesendet wurde |
loop_until_bit_is_set(USR, UDRE); |
//Ausgabe des Zeichens |
UDR = c; |
return (0); |
} |
// -------------------------------------------------------------------------- |
void WriteProgramData(unsigned int pos, unsigned char wert) |
{ |
//if (ProgramLocation == IN_RAM) Buffer[pos] = wert; |
// else eeprom_write_byte(&EE_Buffer[pos], wert); |
// Buffer[pos] = wert; |
} |
//############################################################################ |
//INstallation der Seriellen Schnittstelle |
void UART_Init (void) |
//############################################################################ |
{ |
//Enable TXEN im Register UCR TX-Data Enable & RX Enable |
UCR=(1 << TXEN) | (1 << RXEN); |
// UART Double Speed (U2X) |
USR |= (1<<U2X); |
// RX-Interrupt Freigabe |
UCSRB |= (1<<RXCIE); |
// TX-Interrupt Freigabe |
UCSRB |= (1<<TXCIE); |
//Teiler wird gesetzt |
UBRR=(SYSCLK / (BAUD_RATE * 8L) - 1); |
//UBRR = 33; |
//öffnet einen Kanal für printf (STDOUT) |
//fdevopen (uart_putchar, 0); |
//sbi(PORTD,4); |
Debug_Timer = SetDelay(200); |
} |
//--------------------------------------------------------------------------------------------- |
void DatenUebertragung(void) |
{ |
static char dis_zeile = 0; |
if(!UebertragungAbgeschlossen) return; |
if(DebugGetAnforderung && UebertragungAbgeschlossen) // Bei Get werden die vom PC einstellbaren Werte vom PC zurückgelesen |
{ |
SendOutData('G',MeineSlaveAdresse,(unsigned char *) &DebugIn,sizeof(DebugIn)); |
DebugGetAnforderung = 0; |
} |
if((CheckDelay(Debug_Timer) || DebugDataAnforderung) && UebertragungAbgeschlossen) |
{ |
SendOutData('D',MeineSlaveAdresse,(unsigned char *) &DebugOut,sizeof(DebugOut)); |
DebugDataAnforderung = 0; |
Debug_Timer = SetDelay(MIN_DEBUG_INTERVALL); |
} |
if(DebugDisplayAnforderung && UebertragungAbgeschlossen) |
{ |
Menu(); |
DebugDisplayAnforderung = 0; |
if(++dis_zeile == 4 || NurKanalAnforderung) |
{ |
SendOutData('4',0,(unsigned char *)&PPM_in,sizeof(PPM_in)); // DisplayZeile übertragen |
dis_zeile = -1; |
} |
else SendOutData('0' + dis_zeile,0,(unsigned char *)&DisplayBuff[20 * dis_zeile],20); // DisplayZeile übertragen |
} |
if(GetVersionAnforderung && UebertragungAbgeschlossen) |
{ |
SendOutData('V',MeineSlaveAdresse,(unsigned char *) &VersionInfo,sizeof(VersionInfo)); |
GetVersionAnforderung = 0; |
} |
} |
/branches/v0.60_MicroMag3_Nick666/v0.66c/uart.h |
---|
0,0 → 1,94 |
#ifndef _UART_H |
#define _UART_H |
#define MAX_SENDE_BUFF 150 |
#define MAX_EMPFANGS_BUFF 150 |
void BearbeiteRxDaten(void); |
extern unsigned char DebugGetAnforderung; |
extern unsigned volatile char SendeBuffer[MAX_SENDE_BUFF]; |
extern unsigned volatile char RxdBuffer[MAX_EMPFANGS_BUFF]; |
extern unsigned volatile char UebertragungAbgeschlossen; |
extern unsigned volatile char PC_DebugTimeout; |
extern unsigned volatile char NeueKoordinateEmpfangen; |
extern unsigned char MeineSlaveAdresse; |
extern unsigned char PcZugriff; |
extern int Debug_Timer; |
extern void UART_Init (void); |
extern int uart_putchar (char c); |
extern void boot_program_page (uint32_t page, uint8_t *buf); |
extern void DatenUebertragung(void); |
extern void DecodeNMEA(void); |
extern void BearbeiteRxDaten(void); |
extern unsigned char MotorTest[4]; |
struct str_DebugOut |
{ |
unsigned char Digital[2]; |
unsigned int Analog[32]; // Debugwerte |
}; |
extern struct str_DebugOut DebugOut; |
struct str_Debug |
{ |
unsigned char Digital[2]; |
unsigned char RemoteTasten; |
unsigned int Analog[4]; |
}; |
extern struct str_Debug DebugIn; |
struct str_VersionInfo |
{ |
unsigned char Hauptversion; |
unsigned char Nebenversion; |
unsigned char PCKompatibel; |
unsigned char Rserved[7]; |
}; |
extern struct str_VersionInfo VersionInfo; |
//Die Baud_Rate der Seriellen Schnittstelle ist 9600 Baud |
//#define BAUD_RATE 9600 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 14400 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 28800 //Baud Rate für die Serielle Schnittstelle |
//#define BAUD_RATE 38400 //Baud Rate für die Serielle Schnittstelle |
#define BAUD_RATE 57600 //Baud Rate für die Serielle Schnittstelle |
//Anpassen der seriellen Schnittstellen Register wenn ein ATMega128 benutzt wird |
#if defined (__AVR_ATmega128__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICRB |
#endif |
#if defined (__AVR_ATmega32__) |
# define USR UCSRA |
# define UCR UCSRB |
# define UBRR UBRRL |
# define EICR EICRB |
# define INT_VEC_RX SIG_UART_RECV |
# define INT_VEC_TX SIG_UART_TRANS |
#endif |
#if defined (__AVR_ATmega644__) |
# define USR UCSR0A |
# define UCR UCSR0B |
# define UDR UDR0 |
# define UBRR UBRR0L |
# define EICR EICR0B |
# define TXEN TXEN0 |
# define RXEN RXEN0 |
# define RXCIE RXCIE0 |
# define TXCIE TXCIE0 |
# define U2X U2X0 |
# define UCSRB UCSR0B |
# define UDRE UDRE0 |
# define INT_VEC_RX SIG_USART_RECV |
# define INT_VEC_TX SIG_USART_TRANS |
#endif |
#endif //_UART_H |
/branches/v0.60_MicroMag3_Nick666/v0.66c/version.txt |
---|
0,0 → 1,91 |
------- |
V0.53 27.04.2007 H.Buss |
- erste öffentliche Version |
V0.53b 29.04.2007 H.Buss |
- der FAKTOR_I war versehentlich auf Null, dann liegt der MikroKopter nicht so hart in der Luft |
V0.53c 29.04.2007 H.Buss |
- es gib ein Menü, in dem die Werte der Kanäle nach Nick, Roll, Gas,... sortiert sind. |
Die angezeigten Werte waren nicht die Werte der Funke |
V0.54 01.05.2007 H.Buss |
- die Paramtersätze können jetzt vor dem Start ausgewählt werden |
Dazu wird beim Kalibrieren der Messwerte (Gashebel oben links) der Nick-Rollhebel abgefragt: |
2 3 4 |
1 x 5 |
- - - |
Bedeutet: Nick-Rollhebel Links Mitte = Setting:1 Links Oben = Setting:2 usw. |
- der Faktor_I für den Hauptregler ist hinzugekommen. Im Heading-Hold-Modus sollte er vergössert werden, was Stabilität bringt |
V0.55 14.05.2007 H.Buss |
- es können nun Servos an J3,J4,J5 mit den Kanälen 5-7 gesteuert werden |
V0.56 14.05.2007 H.Buss |
- es gab Probleme mit Funken, die mehr als 8 Kanäle haben, wenn mehrere Kanäle dann auf Null waren |
- Funken, die nicht bis +-120 aussteuern können, sollten jetzt auch gehen |
V0.57 24.05.2007 H.Buss |
- Der Höhenregler kann nun auch mittels Schalter bedient werden |
- Bug im Gier-Algorithmus behoben; Schnelles Gieren fürhrte dazu, dass der MK zu weit gedreht hat |
- Kompass-Einfluss dämpfen bei Neigung |
- Man kann zwischen Kompass FIX (Richtung beim Kalibrieren) und Variabel (einstellbar per Gier) wählen |
- Der Motortest vom Kopter-Tool geht jetzt |
- Man kann den Parametersätzen einen Namen geben |
- Das Kamerasetting ist unter Setting 2 defaultmässig integriert |
V0.58 30.05.2007 H.Buss |
- Der Höhenregler-Algorithmus wird nun umgangen, wenn der Höhenreglerschalter aus ist |
V0.60 17.08.2007 H.Buss |
- "Schwindel-Bug" behoben |
- Die Poti-Werte werden jetzt auf Unterlauf (<0) überprüft |
- Poti4 zugefügt |
- Es werden jetzt 8 Kanäle ausgewertet |
- Kamera-Servo (an J7) |
- Die Settings müssen überschrieben werden |
V0.61 - V0.63 H.Buss 27.09.2007 |
- Poti 4 und Kanal 8 werden im Menü angezeigt |
- ein paar Kleinigkeiten bei den DefaultKonstanten2 bereinigt |
- Analog.c: Aktuell_ax korrigiert |
- auf 32 Debug-Kanäle erweitert |
- Loopings sind jetzt möglich und einzeln im KopterTool freischaltbar |
- leichte Anpassungen im Gier - Geschwindigkeit und Drift |
- die Hardwareversion V1.1 wird erkannt und das Programm stellt sich auf die geänderte Gyroverstärkung und die geänderten Portpins ein |
- die Software startet nach dem Einschalten schneller, weil der Luftdruckoffset schneller gefunden wird |
- die PPM-Ausgänge liegen wieder an den Pins an |
- Details an der Sensordatenverarbeitung -> es fliegt sich geringfügig anders |
- der MK ist bei wenig Gas nicht mehr so giftig -> soll das Landen vereinfachen |
- I2C-Bus läuft jetzt sicher nach einer Störung wieder an |
- Sticksignale werden präziser ausgewertet |
- Stick-Kanäle werden ans Kopter-Tool übertragen |
- Es muss die Version V1.47 des Kopter-Tool verwendet werden |
- Die Settings werden auf Default zurückgesetzt |
- am Piepen kann man die Fehlerart unterscheiden |
1. einzelnes Piepen beim Einschalten und Kalibrieren |
2. langsames Intervall mindestens 1 Sek -> Empfangsausfall |
3. schnelleres Intervall mindestens 1 Sek -> Akku |
4. sehr schnelles Intervall mindestens 1 Sek -> Kommunikation zu den Reglern gestört |
V0.64 H.Buss 30.09.2007 |
- beim Gieren wurden die Achsen nicht hart genug geregelt |
V0.65a H.Buss 15.10.2007 |
- Integral im Mischer wieder integriert |
- Feinabstimmung im ACC/Gyro Abgleich -> 1/32 & 100 |
- ACC/Gyro Abgleich auch bei HH |
V0.66a H.Buss 3.11.2007 |
- Messwertverarbeitung aus dem Analog-Interrupt entfernt |
- Analogmessung hängt jetzt am FC-Timing |
- Looping-Stick-Hysterese eingebaut |
- Looping-180°-Umschlag einstellbar |
- Achsenkopplung: Gierbewegung verkoppelt Nick und Roll |
- Lageregelung nach ACC-Sensor verbessert |
- zusätzlicher I-Anteil in der Lageregelung verbessert die Neutrallage |
- Gyrodriftkompensation überarbeitet |
- Bug in der Gier-Stick-Berechnung behoben |
- Gyro-Messung auf 1kHz beschleunigt |
/branches/v0.60_MicroMag3_Nick666/version.txt |
---|
0,0 → 1,49 |
------- |
V0.53 27.04.2007 H.Buss |
- erste öffentliche Version |
V0.53b 29.04.2007 H.Buss |
- der FAKTOR_I war versehentlich auf Null, dann liegt der MikroKopter nicht so hart in der Luft |
V0.53c 29.04.2007 H.Buss |
- es gib ein Menü, in dem die Werte der Kanäle nach Nick, Roll, Gas,... sortiert sind. |
Die angezeigten Werte waren nicht die Werte der Funke |
V0.54 01.05.2007 H.Buss |
- die Paramtersätze können jetzt vor dem Start ausgewählt werden |
Dazu wird beim Kalibrieren der Messwerte (Gashebel oben links) der Nick-Rollhebel abgefragt: |
2 3 4 |
1 x 5 |
- - - |
Bedeutet: Nick-Rollhebel Links Mitte = Setting:1 Links Oben = Setting:2 usw. |
- der Faktor_I für den Hauptregler ist hinzugekommen. Im Heading-Hold-Modus sollte er vergössert werden, was Stabilität bringt |
V0.55 14.05.2007 H.Buss |
- es können nun Servos an J3,J4,J5 mit den Kanälen 5-7 gesteuert werden |
V0.56 14.05.2007 H.Buss |
- es gab Probleme mit Funken, die mehr als 8 Kanäle haben, wenn mehrere Kanäle dann auf Null waren |
- Funken, die nicht bis +-120 aussteuern können, sollten jetzt auch gehen |
V0.57 24.05.2007 H.Buss |
- Der Höhenregler kann nun auch mittels Schalter bedient werden |
- Bug im Gier-Algorithmus behoben; Schnelles Gieren fürhrte dazu, dass der MK zu weit gedreht hat |
- Kompass-Einfluss dämpfen bei Neigung |
- Man kann zwischen Kompass FIX (Richtung beim Kalibrieren) und Variabel (einstellbar per Gier) wählen |
- Der Motortest vom Kopter-Tool geht jetzt |
- Man kann den Parametersätzen einen Namen geben |
- Das Kamerasetting ist unter Setting 2 defaultmässig integriert |
V0.58 30.05.2007 H.Buss |
- Der Höhenregler-Algorithmus wird nun umgangen, wenn der Höhenreglerschalter aus ist |
V0.60 17.08.2007 H.Buss |
- "Schwindel-Bug" behoben |
- Die Poti-Werte werden jetzt auf Unterlauf (<0) überprüft |
- Poti4 zugefügt |
- Es werden jetzt 8 Kanäle ausgewertet |
- Kamera-Servo (an J7) |
- Die Settings müssen überschrieben werden |