Merge pull request #6371 from opentx/bsongis/x-lites
X-LiteS + X3 + PXX2
This commit is contained in:
@@ -23,8 +23,10 @@ env:
|
||||
# - FLAVOR=AR9X
|
||||
# - FLAVOR=SKY9X
|
||||
# - FLAVOR=9XRPRO
|
||||
- FLAVOR=X3
|
||||
- FLAVOR=X7
|
||||
- FLAVOR=XLITE
|
||||
- FLAVOR=XLITES
|
||||
- FLAVOR=X9
|
||||
# - FLAVOR=X9D
|
||||
# - FLAVOR=X9D+
|
||||
|
||||
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://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 <https://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
|
||||
<https://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
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
@@ -96,6 +96,7 @@ const int Boards::getEEpromSize(Board::Type board)
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_AR9X:
|
||||
return EESIZE_9XRPRO;
|
||||
case BOARD_TARANIS_XLITES:
|
||||
case BOARD_TARANIS_XLITE:
|
||||
case BOARD_TARANIS_X7:
|
||||
case BOARD_TARANIS_X9D:
|
||||
@@ -124,6 +125,7 @@ const int Boards::getFlashSize(Type board)
|
||||
case BOARD_9XRPRO:
|
||||
case BOARD_AR9X:
|
||||
return FSIZE_9XRPRO;
|
||||
case BOARD_TARANIS_XLITES:
|
||||
case BOARD_TARANIS_XLITE:
|
||||
case BOARD_TARANIS_X7:
|
||||
case BOARD_TARANIS_X9D:
|
||||
@@ -145,7 +147,19 @@ const SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
|
||||
if (index < 0)
|
||||
return {SWITCH_NOT_AVAILABLE, CPN_STR_UNKNOWN_ITEM};
|
||||
|
||||
if (IS_TARANIS_XLITE(board)) {
|
||||
if (IS_TARANIS_XLITES(board)) {
|
||||
const Board::SwitchInfo switches[] = {
|
||||
{SWITCH_3POS, "SA"},
|
||||
{SWITCH_3POS, "SB"},
|
||||
{SWITCH_2POS, "SC"},
|
||||
{SWITCH_2POS, "SD"},
|
||||
{SWITCH_TOGGLE, "SE"},
|
||||
{SWITCH_TOGGLE, "SF"}
|
||||
};
|
||||
if (index < DIM(switches))
|
||||
return switches[index];
|
||||
}
|
||||
else if (IS_TARANIS_XLITE(board)) {
|
||||
const Board::SwitchInfo switches[] = {
|
||||
{SWITCH_3POS, "SA"},
|
||||
{SWITCH_3POS, "SB"},
|
||||
@@ -155,7 +169,7 @@ const SwitchInfo Boards::getSwitchInfo(Board::Type board, int index)
|
||||
if (index < DIM(switches))
|
||||
return switches[index];
|
||||
}
|
||||
if (IS_TARANIS_X7(board)) {
|
||||
else if (IS_TARANIS_X7(board)) {
|
||||
const Board::SwitchInfo switches[] = {
|
||||
{SWITCH_3POS, "SA"},
|
||||
{SWITCH_3POS, "SB"},
|
||||
@@ -246,7 +260,7 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
return getCapability(board, Board::Sticks) + getCapability(board, Board::Pots) + getCapability(board, Board::Sliders) + getCapability(board, Board::MouseAnalogs);
|
||||
|
||||
case MultiposPots:
|
||||
return IS_HORUS_OR_TARANIS(board) ? 3 : 0;
|
||||
return IS_HORUS_OR_TARANIS(board) ? getCapability(board, Board::Pots) : 0;
|
||||
|
||||
case MultiposPotsPositions:
|
||||
return IS_HORUS_OR_TARANIS(board) ? 6 : 0;
|
||||
@@ -256,6 +270,8 @@ const int Boards::getCapability(Board::Type board, Board::Capability capability)
|
||||
return 18;
|
||||
else if (IS_TARANIS_X7(board))
|
||||
return 6;
|
||||
else if (IS_TARANIS_XLITES(board))
|
||||
return 6;
|
||||
else if (IS_TARANIS_XLITE(board))
|
||||
return 4;
|
||||
else if (IS_HORUS_OR_TARANIS(board))
|
||||
@@ -405,6 +421,8 @@ const QString Boards::getBoardName(Board::Type board)
|
||||
return "Taranis X7/X7S";
|
||||
case BOARD_TARANIS_XLITE:
|
||||
return "Taranis X-Lite";
|
||||
case BOARD_TARANIS_XLITES:
|
||||
return "Taranis X-Lite S";
|
||||
case BOARD_TARANIS_X9D:
|
||||
return "Taranis X9D";
|
||||
case BOARD_TARANIS_X9DP:
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Board {
|
||||
BOARD_X12S,
|
||||
BOARD_X10,
|
||||
BOARD_TARANIS_XLITE,
|
||||
BOARD_TARANIS_XLITES,
|
||||
BOARD_ENUM_COUNT
|
||||
};
|
||||
|
||||
@@ -186,14 +187,15 @@ class Boards
|
||||
#define IS_2560(board) (board==Board::BOARD_GRUVIN9X || board==Board::BOARD_MEGA2560)
|
||||
#define IS_SKY9X(board) (board==Board::BOARD_SKY9X || board==Board::BOARD_9XRPRO || board==Board::BOARD_AR9X)
|
||||
#define IS_9XRPRO(board) (board==Board::BOARD_9XRPRO)
|
||||
#define IS_TARANIS_XLITE(board) (board==Board::BOARD_TARANIS_XLITE)
|
||||
#define IS_TARANIS_XLITE(board) (board==Board::BOARD_TARANIS_XLITE || board==Board::BOARD_TARANIS_XLITES)
|
||||
#define IS_TARANIS_XLITES(board) (board==Board::BOARD_TARANIS_XLITES)
|
||||
#define IS_TARANIS_X7(board) (board==Board::BOARD_TARANIS_X7)
|
||||
#define IS_TARANIS_X9(board) (board==Board::BOARD_TARANIS_X9D || board==Board::BOARD_TARANIS_X9DP || board==Board::BOARD_TARANIS_X9E)
|
||||
#define IS_TARANIS_X9D(board) (board==Board::BOARD_TARANIS_X9D || board==Board::BOARD_TARANIS_X9DP)
|
||||
#define IS_TARANIS_PLUS(board) (board==Board::BOARD_TARANIS_X9DP || board==Board::BOARD_TARANIS_X9E)
|
||||
#define IS_TARANIS_X9E(board) (board==Board::BOARD_TARANIS_X9E)
|
||||
#define IS_TARANIS(board) (IS_TARANIS_X9(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board))
|
||||
#define IS_TARANIS_SMALL(board) (board==Board::BOARD_TARANIS_X7 || board==Board::BOARD_TARANIS_XLITE)
|
||||
#define IS_TARANIS(board) (IS_TARANIS_X9(board) || IS_TARANIS_X7(board) || IS_TARANIS_XLITE(board) || IS_TARANIS_XLITES(board))
|
||||
#define IS_TARANIS_SMALL(board) (board==Board::BOARD_TARANIS_X7 || board==Board::BOARD_TARANIS_XLITE || board==Board::BOARD_TARANIS_XLITES)
|
||||
#define IS_TARANIS_NOT_X9E(board) (IS_TARANIS(board) && !IS_TARANIS_X9E(board))
|
||||
#define IS_HORUS_X12S(board) (board==Board::BOARD_X12S)
|
||||
#define IS_HORUS_X10(board) (board==Board::BOARD_X10)
|
||||
|
||||
@@ -387,7 +387,7 @@ class CharField: public DataField {
|
||||
};
|
||||
|
||||
static const char specialCharsTab[] = "_-.,";
|
||||
static inline int8_t char2idx(char c)
|
||||
static inline int8_t char2zchar(char c)
|
||||
{
|
||||
if (c==' ') return 0;
|
||||
if (c>='A' && c<='Z') return 1+c-'A';
|
||||
@@ -401,7 +401,7 @@ static inline int8_t char2idx(char c)
|
||||
}
|
||||
|
||||
#define ZCHAR_MAX 40
|
||||
static inline char idx2char(int8_t idx)
|
||||
static inline char zchar2char(int8_t idx)
|
||||
{
|
||||
if (idx == 0) return ' ';
|
||||
if (idx < 0) {
|
||||
@@ -429,7 +429,7 @@ class ZCharField: public DataField {
|
||||
int b = 0;
|
||||
int len = strlen(field);
|
||||
for (int i=0; i<N; i++) {
|
||||
int idx = i>=len ? 0 : char2idx(field[i]);
|
||||
int idx = i>=len ? 0 : char2zchar(field[i]);
|
||||
for (int j=0; j<8; j++, b++) {
|
||||
if (idx & (1<<j))
|
||||
output.setBit(b);
|
||||
@@ -446,7 +446,7 @@ class ZCharField: public DataField {
|
||||
if (input[b++])
|
||||
idx |= (1<<j);
|
||||
}
|
||||
field[i] = idx2char(idx);
|
||||
field[i] = zchar2char(idx);
|
||||
}
|
||||
|
||||
field[N] = '\0';
|
||||
|
||||
@@ -146,7 +146,8 @@ enum Capability {
|
||||
HasMixerExpo,
|
||||
HasBatMeterRange,
|
||||
DangerousFunctions,
|
||||
HasModelCategories
|
||||
HasModelCategories,
|
||||
HasSwitchableJack
|
||||
};
|
||||
|
||||
class EEPROMInterface
|
||||
|
||||
@@ -102,6 +102,7 @@ class GeneralSettings {
|
||||
bool disableAlarmWarning;
|
||||
bool disableRssiPoweroffAlarm;
|
||||
unsigned int usbMode;
|
||||
unsigned int jackMode;
|
||||
BeeperMode hapticMode;
|
||||
unsigned int stickMode; // TODO enum
|
||||
int timezone;
|
||||
|
||||
@@ -3702,7 +3702,8 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, Board::Type
|
||||
internalField.Append(new BoolField<1>(this, generalData.jitterFilter));
|
||||
internalField.Append(new BoolField<1>(this, generalData.disableRssiPoweroffAlarm));
|
||||
internalField.Append(new UnsignedField<2>(this, generalData.usbMode));
|
||||
internalField.Append(new SpareBitsField<3>(this));
|
||||
internalField.Append(new UnsignedField<2>(this, generalData.jackMode));
|
||||
internalField.Append(new SpareBitsField<1>(this));
|
||||
}
|
||||
else {
|
||||
internalField.Append(new SpareBitsField<7>(this));
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#define TARANIS_X9E_VARIANT 0x8000
|
||||
#define TARANIS_X7_VARIANT 0x4000
|
||||
#define TARANIS_XLITE_VARIANT 0x2000
|
||||
#define TARANIS_XLITES_VARIANT 0x1000
|
||||
|
||||
#define SIMU_STOCK_VARIANTS (GVARS_VARIANT|FRSKY_VARIANT)
|
||||
#define SIMU_M128_VARIANTS (M128_VARIANT|SIMU_STOCK_VARIANTS)
|
||||
|
||||
@@ -317,6 +317,9 @@ int OpenTxEepromInterface::save(uint8_t * eeprom, const RadioData & radioData, u
|
||||
else if (IS_TARANIS_X7(board)) {
|
||||
variant |= TARANIS_X7_VARIANT;
|
||||
}
|
||||
else if (IS_TARANIS_XLITES(board)) {
|
||||
variant |= TARANIS_XLITES_VARIANT;
|
||||
}
|
||||
else if (IS_TARANIS_XLITE(board)) {
|
||||
variant |= TARANIS_XLITE_VARIANT;
|
||||
}
|
||||
@@ -691,6 +694,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
return TARANIS_X9E_VARIANT;
|
||||
else if (IS_TARANIS_X7(board))
|
||||
return TARANIS_X7_VARIANT;
|
||||
else if (IS_TARANIS_XLITES(board))
|
||||
return TARANIS_XLITES_VARIANT;
|
||||
else if (IS_TARANIS_XLITE(board))
|
||||
return TARANIS_XLITE_VARIANT;
|
||||
else
|
||||
@@ -708,6 +713,8 @@ int OpenTxFirmware::getCapability(::Capability capability)
|
||||
return id.contains("danger") ? 1 : 0;
|
||||
case HasModelCategories:
|
||||
return IS_HORUS(board);
|
||||
case HasSwitchableJack:
|
||||
return IS_TARANIS_XLITES(board);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -921,6 +928,11 @@ bool OpenTxEepromInterface::checkVariant(unsigned int version, unsigned int vari
|
||||
variantError = true;
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS_XLITES(board)) {
|
||||
if (variant != TARANIS_XLITES_VARIANT) {
|
||||
variantError = true;
|
||||
}
|
||||
}
|
||||
else if (IS_TARANIS_XLITE(board)) {
|
||||
if (variant != TARANIS_XLITE_VARIANT) {
|
||||
variantError = true;
|
||||
@@ -1165,6 +1177,12 @@ void registerOpenTxFirmwares()
|
||||
addOpenTxTaranisOptions(firmware, false);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X-Lite S board */
|
||||
firmware = new OpenTxFirmware("opentx-xlites", QCoreApplication::translate("Firmware", "FrSky Taranis X-Lite S"), BOARD_TARANIS_XLITES);
|
||||
// firmware->addOption("stdr9m", QCoreApplication::translate("Firmware", "Use JR-sized R9M module"));
|
||||
addOpenTxTaranisOptions(firmware);
|
||||
registerOpenTxFirmware(firmware);
|
||||
|
||||
/* FrSky X-Lite board */
|
||||
firmware = new OpenTxFirmware("opentx-xlite", Firmware::tr("FrSky Taranis X-Lite"), BOARD_TARANIS_XLITE);
|
||||
// firmware->addOption("stdr9m", Firmware::tr("Use JR-sized R9M module"));
|
||||
|
||||
@@ -151,13 +151,21 @@ ui(new Ui::GeneralSetup)
|
||||
ui->adjustRTC->hide();
|
||||
}
|
||||
|
||||
if (IS_STM32(firmware->getBoard())){
|
||||
if (IS_STM32(firmware->getBoard())) {
|
||||
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
|
||||
}
|
||||
else {
|
||||
ui->usbModeLabel->hide();
|
||||
ui->usbModeCB->hide();
|
||||
}
|
||||
|
||||
if (firmware->getCapability(HasSwitchableJack)) {
|
||||
ui->jackModeCB->setCurrentIndex(generalSettings.jackMode);
|
||||
}
|
||||
else {
|
||||
ui->jackModeLabel->hide();
|
||||
ui->jackModeCB->hide();
|
||||
}
|
||||
|
||||
if (!firmware->getCapability(OptrexDisplay)) {
|
||||
ui->label_displayType->hide();
|
||||
@@ -353,6 +361,15 @@ void GeneralSetupPanel::on_usbModeCB_currentIndexChanged(int index)
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_jackModeCB_currentIndexChanged(int index)
|
||||
{
|
||||
if (!lock) {
|
||||
generalSettings.jackMode = ui->jackModeCB->currentIndex();
|
||||
emit modified();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GeneralSetupPanel::on_backlightColor_SL_valueChanged()
|
||||
{
|
||||
if (!lock) {
|
||||
|
||||
@@ -60,6 +60,7 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_hapticLengthCB_currentIndexChanged(int index);
|
||||
void on_backlightswCB_currentIndexChanged(int index);
|
||||
void on_usbModeCB_currentIndexChanged(int index);
|
||||
void on_jackModeCB_currentIndexChanged(int index);
|
||||
void on_backlightColor_SL_valueChanged();
|
||||
void on_mavbaud_CB_currentIndexChanged(int index);
|
||||
void on_voiceLang_CB_currentIndexChanged(int index);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -77,6 +77,7 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
radioUiWidget = new SimulatedUIWidgetX9(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_TARANIS_XLITE:
|
||||
case Board::BOARD_TARANIS_XLITES:
|
||||
radioUiWidget = new SimulatedUIWidgetXLITE(simulator, this);
|
||||
break;
|
||||
case Board::BOARD_TARANIS_X9E:
|
||||
@@ -108,7 +109,7 @@ SimulatorWidget::SimulatorWidget(QWidget * parent, SimulatorInterface * simulato
|
||||
vJoyLeft = new VirtualJoystickWidget(this, 'L');
|
||||
ui->leftStickLayout->addWidget(vJoyLeft);
|
||||
|
||||
vJoyRight = new VirtualJoystickWidget(this, 'R', (m_board == Board::BOARD_TARANIS_XLITE ? false : true)); // TODO: maybe remove trims for both joysticks and add a cross in the middle?
|
||||
vJoyRight = new VirtualJoystickWidget(this, 'R', (m_board == Board::BOARD_TARANIS_XLITE || m_board == Board::BOARD_TARANIS_XLITES ? false : true)); // TODO: maybe remove trims for both joysticks and add a cross in the middle?
|
||||
ui->rightStickLayout->addWidget(vJoyRight);
|
||||
|
||||
connect(vJoyLeft, &VirtualJoystickWidget::valueChange, this, &SimulatorWidget::onRadioWidgetValueChange);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include(CMakeForceCompiler)
|
||||
include(Bitmaps)
|
||||
|
||||
set(PCB_TYPES X7 XLITE X9D X9D+ X9E X10 X12S SKY9X 9XRPRO AR9X)
|
||||
set(PCB_TYPES X3 X7 XLITE XLITES X9D X9D+ X9E X10 X12S SKY9X 9XRPRO AR9X)
|
||||
set(GUI_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL)
|
||||
set(TTS_LANGUAGES CZ DE EN ES FR IT PT SK SE PL HU NL RU)
|
||||
|
||||
@@ -46,8 +46,6 @@ option(TRACE_LUA_INTERNALS "Turn on traces for Lua internals" OFF)
|
||||
option(FRSKY_STICKS "Reverse sticks for FrSky sticks" OFF)
|
||||
option(NANO "Use nano newlib and binalloc")
|
||||
option(NIGHTLY_BUILD_WARNING "Warn this is a nightly build" OFF)
|
||||
option(MODULE_R9M_FLEX_FW "Add R9M options for non certified firmwwares" OFF)
|
||||
option(PXX2 "Enable PXX v2 support" OFF)
|
||||
|
||||
# since we reset all default CMAKE compiler flags for firmware builds, provide an alternate way for user to specify additional flags.
|
||||
set(FIRMWARE_C_FLAGS "" CACHE STRING "Additional flags for firmware target c compiler (note: all CMAKE_C_FLAGS[_*] are ignored for firmware/bootloader).")
|
||||
@@ -82,7 +80,7 @@ set(FATFS_SRC
|
||||
|
||||
if(PCB STREQUAL X12S OR PCB STREQUAL X10)
|
||||
include(targets/horus/CMakeLists.txt)
|
||||
elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7 OR PCB STREQUAL XLITE)
|
||||
elseif(PCB STREQUAL X9E OR PCB STREQUAL X9D+ OR PCB STREQUAL X9D OR PCB STREQUAL X7 OR PCB STREQUAL X3 OR PCB STREQUAL XLITE OR PCB STREQUAL XLITES)
|
||||
include(targets/taranis/CMakeLists.txt)
|
||||
elseif(PCB STREQUAL SKY9X OR PCB STREQUAL 9XRPRO OR PCB STREQUAL AR9X)
|
||||
include(targets/sky9x/CMakeLists.txt)
|
||||
@@ -133,10 +131,7 @@ else()
|
||||
add_definitions(-DEEPROM -DEEPROM_RAW)
|
||||
endif()
|
||||
|
||||
if(ARCH STREQUAL ARM AND NOT PCB STREQUAL X12S AND NOT PCB STREQUAL X10 AND NOT PCB STREQUAL XLITE)
|
||||
add_definitions(-DEEPROM_CONVERSIONS)
|
||||
set(SRC ${SRC} storage/eeprom_conversions.cpp)
|
||||
endif()
|
||||
include(storage/conversions/CMakeLists.txt)
|
||||
|
||||
add_definitions(-DFLAVOUR="${FLAVOUR}")
|
||||
|
||||
@@ -313,14 +308,6 @@ if(NIGHTLY_BUILD_WARNING)
|
||||
add_definitions(-DNIGHTLY_BUILD_WARNING)
|
||||
endif(NIGHTLY_BUILD_WARNING)
|
||||
|
||||
if(MODULE_R9M_FLEX_FW)
|
||||
add_definitions(-DMODULE_R9M_FLEX_FW)
|
||||
endif()
|
||||
|
||||
if(PXX2)
|
||||
add_definitions(-DPXX2)
|
||||
endif()
|
||||
|
||||
set(SRC
|
||||
${SRC}
|
||||
opentx.cpp
|
||||
@@ -458,7 +445,7 @@ if(NOT MSVC)
|
||||
set(SRC ${SRC} bin_allocator.cpp)
|
||||
endif()
|
||||
|
||||
if(PCB STREQUAL XLITE OR PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X10 OR PCB STREQUAL X12S)
|
||||
if(PCB STREQUAL XLITE OR PCB STREQUAL XLITES OR PCB STREQUAL X9D OR PCB STREQUAL X9D+ OR PCB STREQUAL X9E OR PCB STREQUAL X7 OR PCB STREQUAL X3 OR PCB STREQUAL X10 OR PCB STREQUAL X12S)
|
||||
add_subdirectory(targets/common/arm/stm32/bootloader)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/targets/common/arm/stm32/bootloader)
|
||||
set(FIRMWARE_DEPENDENCIES ${FIRMWARE_DEPENDENCIES} bootloader)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* This file is based on work published at http://www.coranac.com/documents/working-with-bits-and-bitfields
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef BITFIELD_H
|
||||
#define BITFIELD_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
// A set of bitfield handling macros
|
||||
|
||||
template <typename T>
|
||||
inline T BF_BIT(uint8_t n)
|
||||
{
|
||||
return T(1) << n;
|
||||
}
|
||||
|
||||
#define BF_BIT_GET(y, mask) ( y & (mask) )
|
||||
#define BF_BIT_SET(y, mask) ( y |= (mask) )
|
||||
#define BF_BIT_CLEAR(y, mask) ( y &= ~(mask) )
|
||||
#define BF_BIT_FLIP(y, mask) ( y ^= (mask) )
|
||||
#define BF_SINGLE_BIT_GET(y, i) BF_BIT_GET(y, BF_BIT(i))
|
||||
#define BF_SINGLE_BIT_SET(y, i) BF_BIT_SET(y, BF_BIT(i))
|
||||
|
||||
//! Create a bitmask of length 'len'.
|
||||
template <typename T>
|
||||
inline T BF_BITMASK(uint8_t len)
|
||||
{
|
||||
return BF_BIT<T>(len) - 1;
|
||||
}
|
||||
|
||||
//! Create a bitfield mask of length 'len' starting at bit 'start'.
|
||||
template <typename T>
|
||||
inline T BF_MASK(uint8_t start, uint8_t len)
|
||||
{
|
||||
return BF_BITMASK<T>(len) << start;
|
||||
}
|
||||
|
||||
//! Prepare a bitmask for insertion or combining.
|
||||
template <typename T>
|
||||
inline T BF_PREP(T x, uint8_t start, uint8_t len)
|
||||
{
|
||||
return (x & BF_BITMASK<T>(len)) << start;
|
||||
}
|
||||
|
||||
//! Extract a bitfield of length 'len' starting at bit 'start' from 'y'.
|
||||
#define BF_GET(y, start, len) ( ((y)>>(start)) & BF_BITMASK(len) )
|
||||
|
||||
//! Insert 'len' bits of 'x 'into 'y', starting at bit 'start' from 'y'.
|
||||
template <class T>
|
||||
inline T BF_SET(T to, T from, uint8_t start, uint8_t len)
|
||||
{
|
||||
return (to & ~BF_MASK<T>(start, len)) | BF_PREP<T>(from, start, len);
|
||||
}
|
||||
|
||||
#endif //BITFIELD_H
|
||||
+39
-18
@@ -71,32 +71,50 @@ char * bluetoothReadline(bool error_reset)
|
||||
if (!btRxFifo.pop(byte)) {
|
||||
#if defined(PCBX9E) && !defined(USEHORUSBT) // X9E BT module can get unresponsive
|
||||
TRACE("NO RESPONSE FROM BT MODULE");
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TRACE_NOCRLF("%02X ", byte);
|
||||
|
||||
#if 0
|
||||
if (error_reset && byte == 'R' && bluetoothBufferIndex == 4 && memcmp(bluetoothBuffer, "ERRO", 4)) {
|
||||
#if defined(PCBX9E) // X9E enter BT reset loop if following code is implemented
|
||||
TRACE("BT Error...");
|
||||
#else
|
||||
TRACE("BT Reset...");
|
||||
bluetoothBufferIndex = 0;
|
||||
bluetoothDone();
|
||||
bluetoothState = BLUETOOTH_STATE_OFF;
|
||||
bluetoothWakeupTime = get_tmr10ms() + 100; /* 1s */
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
TRACE_NOCRLF("%02X ", byte);
|
||||
else
|
||||
#endif
|
||||
|
||||
if (byte == '\n') {
|
||||
if (bluetoothBufferIndex > 2 && bluetoothBuffer[bluetoothBufferIndex-1] == '\r') {
|
||||
bluetoothBuffer[bluetoothBufferIndex-1] = '\0';
|
||||
bluetoothBufferIndex = 0;
|
||||
TRACE("BT< %s", bluetoothBuffer);
|
||||
if (error_reset && !strcmp((char *)bluetoothBuffer, "ERROR")) {
|
||||
#if defined(PCBX9E) // X9E enter BT reset loop if following code is implemented
|
||||
TRACE("BT error...");
|
||||
#if defined(PCBX9E) // X9E enter BT reset loop if following code is implemented
|
||||
TRACE("BT Error...");
|
||||
#else
|
||||
TRACE("BT Reset...");
|
||||
bluetoothDone();
|
||||
bluetoothState = BLUETOOTH_STATE_OFF;
|
||||
bluetoothWakeupTime = get_tmr10ms() + 100; /* 1s */
|
||||
#endif
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
if (!strncmp((char *)bluetoothBuffer, "Central:", 8))
|
||||
strcpy(bluetoothLocalAddr, (char *)bluetoothBuffer+8);
|
||||
else if (!strncmp((char *)bluetoothBuffer, "Peripheral:", 11))
|
||||
strcpy(bluetoothLocalAddr, (char *)bluetoothBuffer+11);
|
||||
return (char *)bluetoothBuffer;
|
||||
if (!memcmp(bluetoothBuffer, "Central:", 8))
|
||||
strcpy(bluetoothLocalAddr, (char *) bluetoothBuffer + 8);
|
||||
else if (!memcmp(bluetoothBuffer, "Peripheral:", 11))
|
||||
strcpy(bluetoothLocalAddr, (char *) bluetoothBuffer + 11);
|
||||
return (char *) bluetoothBuffer;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -212,7 +230,7 @@ void bluetoothSendTrainer()
|
||||
{
|
||||
int16_t PPM_range = g_model.extendedLimits ? 640*2 : 512*2;
|
||||
|
||||
int firstCh = g_model.moduleData[TRAINER_MODULE].channelsStart;
|
||||
int firstCh = g_model.trainerData.channelsStart;
|
||||
int lastCh = firstCh + 8;
|
||||
|
||||
uint8_t * cur = bluetoothBuffer;
|
||||
@@ -280,7 +298,7 @@ void bluetoothWakeup(void)
|
||||
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
|
||||
if (len > 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
*cur++ = idx2char(g_eeGeneral.bluetoothName[i]);
|
||||
*cur++ = zchar2char(g_eeGeneral.bluetoothName[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -361,11 +379,11 @@ void bluetoothWakeup()
|
||||
bluetoothWakeupTime = now + 10; /* 100ms */
|
||||
}
|
||||
else if (bluetoothState == BLUETOOTH_STATE_CONNECTED) {
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
bluetoothReceiveTrainer();
|
||||
}
|
||||
else {
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH) {
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH) {
|
||||
bluetoothSendTrainer();
|
||||
bluetoothWakeupTime = now + 2; /* 20ms */
|
||||
}
|
||||
@@ -374,20 +392,23 @@ void bluetoothWakeup()
|
||||
}
|
||||
else {
|
||||
char * line = bluetoothReadline();
|
||||
if (line) {
|
||||
TRACE("BT %s", line);
|
||||
}
|
||||
if (bluetoothState == BLUETOOTH_STATE_BAUDRATE_INIT) {
|
||||
char command[32];
|
||||
char * cur = strAppend(command, BLUETOOTH_COMMAND_NAME);
|
||||
uint8_t len = ZLEN(g_eeGeneral.bluetoothName);
|
||||
if (len > 0) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
*cur++ = idx2char(g_eeGeneral.bluetoothName[i]);
|
||||
*cur++ = zchar2char(g_eeGeneral.bluetoothName[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if defined(PCBHORUS)
|
||||
cur = strAppend(cur, "Horus");
|
||||
#else
|
||||
cur = strAppend(cur, "Taranis");
|
||||
cur = strAppend(cur, "taranis"); // TODO capital letter once allowed by BT module
|
||||
#endif
|
||||
}
|
||||
strAppend(cur, "\r\n");
|
||||
@@ -395,11 +416,11 @@ void bluetoothWakeup()
|
||||
bluetoothState = BLUETOOTH_STATE_NAME_SENT;
|
||||
}
|
||||
else if (bluetoothState == BLUETOOTH_STATE_NAME_SENT && (!strncmp(line, "OK+", 3) || !strncmp(line, "Central:", 8) || !strncmp(line, "Peripheral:", 11))) {
|
||||
bluetoothWriteString("AT+TXPW3\r\n");
|
||||
bluetoothWriteString("AT+TXPW\r\n");
|
||||
bluetoothState = BLUETOOTH_STATE_POWER_SENT;
|
||||
}
|
||||
else if (bluetoothState == BLUETOOTH_STATE_POWER_SENT && (!strncmp(line, "Central:", 8) || !strncmp(line, "Peripheral:", 11))) {
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH)
|
||||
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER && g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH)
|
||||
bluetoothWriteString("AT+ROLE1\r\n");
|
||||
else
|
||||
bluetoothWriteString("AT+ROLE0\r\n");
|
||||
@@ -430,7 +451,7 @@ void bluetoothWakeup()
|
||||
else if ((bluetoothState == BLUETOOTH_STATE_IDLE || bluetoothState == BLUETOOTH_STATE_DISCONNECTED || bluetoothState == BLUETOOTH_STATE_CONNECT_SENT) && !strncmp(line, "Connected:", 10)) {
|
||||
strcpy(bluetoothDistantAddr, &line[10]); // TODO quick & dirty
|
||||
bluetoothState = BLUETOOTH_STATE_CONNECTED;
|
||||
if (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH) {
|
||||
if (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH) {
|
||||
bluetoothWakeupTime += 500; // it seems a 5s delay is needed before sending the 1st frame
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,13 +44,6 @@ enum BluetoothStates {
|
||||
|
||||
#define LEN_BLUETOOTH_ADDR 16
|
||||
|
||||
#if (defined(PCBX7) || defined(PCBXLITE)) && !defined(SIMU)
|
||||
extern uint8_t btChipPresent;
|
||||
#define IS_BLUETOOTH_CHIP_PRESENT() (btChipPresent)
|
||||
#else
|
||||
#define IS_BLUETOOTH_CHIP_PRESENT() (true)
|
||||
#endif
|
||||
|
||||
extern volatile uint8_t bluetoothState;
|
||||
extern char bluetoothLocalAddr[LEN_BLUETOOTH_ADDR+1];
|
||||
extern char bluetoothDistantAddr[LEN_BLUETOOTH_ADDR+1];
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ extern uint8_t cliTracesEnabled;
|
||||
#ifdef __cplusplus
|
||||
#include "fifo.h"
|
||||
extern Fifo<uint8_t, 256> cliRxFifo;
|
||||
#include "tasks_arm.h"
|
||||
#include "tasks.h"
|
||||
extern RTOS_TASK_HANDLE cliTaskId;
|
||||
extern RTOS_DEFINE_STACK(cliStack, CLI_STACK_SIZE);
|
||||
#endif
|
||||
|
||||
+50
-53
@@ -21,6 +21,8 @@
|
||||
#ifndef _DATACONSTANTS_H_
|
||||
#define _DATACONSTANTS_H_
|
||||
|
||||
#include "board.h"
|
||||
|
||||
#define NUM_STICKS 4
|
||||
|
||||
#if defined(EXPORT)
|
||||
@@ -44,7 +46,7 @@
|
||||
#define MAX_SCRIPTS 9
|
||||
#define MAX_INPUTS 32
|
||||
#define MAX_TRAINER_CHANNELS 16
|
||||
#define MAX_TELEMETRY_SENSORS 32
|
||||
#define MAX_TELEMETRY_SENSORS 64
|
||||
#define MAX_CUSTOM_SCREENS 5
|
||||
#elif defined(PCBTARANIS)
|
||||
#define MAX_MODELS 60
|
||||
@@ -70,20 +72,10 @@
|
||||
#define MAX_TRAINER_CHANNELS 16
|
||||
#define MAX_TELEMETRY_SENSORS 32
|
||||
#else
|
||||
#define MAX_MODELS 16
|
||||
#define MAX_OUTPUT_CHANNELS 16 // number of real output channels CH1-CH16
|
||||
#define MAX_FLIGHT_MODES 5
|
||||
#define MAX_MIXERS 32
|
||||
#define MAX_EXPOS 14
|
||||
#define MAX_LOGICAL_SWITCHES 12
|
||||
#define MAX_SPECIAL_FUNCTIONS 16 // number of functions assigned to switches
|
||||
#define MAX_TRAINER_CHANNELS 8
|
||||
#define MAX_TELEMETRY_SENSORS 0
|
||||
#warning "Unknown board!"
|
||||
#endif
|
||||
|
||||
#define MAX_TIMERS 3
|
||||
|
||||
#define NUM_CYC 3
|
||||
#define MAX_TIMERS 3
|
||||
#define NUM_CAL_PPM 4
|
||||
|
||||
enum CurveType {
|
||||
@@ -92,8 +84,7 @@ enum CurveType {
|
||||
CURVE_TYPE_LAST = CURVE_TYPE_CUSTOM
|
||||
};
|
||||
|
||||
#define MIN_POINTS_PER_CURVE 3
|
||||
|
||||
#define MIN_POINTS_PER_CURVE 3
|
||||
#define MAX_POINTS_PER_CURVE 17
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
@@ -133,6 +124,14 @@ enum CurveType {
|
||||
#define MAX_CURVE_POINTS 512
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define NUM_RECEIVERS 10
|
||||
#define MAX_RECEIVERS_PER_MODULE 5
|
||||
#else
|
||||
#define NUM_RECEIVERS 4
|
||||
#define MAX_RECEIVERS_PER_MODULE 4
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBSKY9X) || defined(PCBHORUS)
|
||||
#define NUM_MODULES 2
|
||||
#else
|
||||
@@ -191,8 +190,7 @@ enum BeeperMode {
|
||||
enum ModuleIndex {
|
||||
INTERNAL_MODULE,
|
||||
EXTERNAL_MODULE,
|
||||
TRAINER_MODULE,
|
||||
FLASHING_MODULE,
|
||||
SPORT_MODULE,
|
||||
};
|
||||
enum TrainerMode {
|
||||
TRAINER_MODE_MASTER_TRAINER_JACK,
|
||||
@@ -211,7 +209,7 @@ enum BeeperMode {
|
||||
enum ModuleIndex {
|
||||
EXTERNAL_MODULE,
|
||||
EXTRA_MODULE,
|
||||
TRAINER_MODULE
|
||||
SPORT_MODULE
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -224,12 +222,12 @@ enum BeeperMode {
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
#define IS_INTERNAL_MODULE_ENABLED() (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
#elif defined(PCBSKY9X)
|
||||
#define IS_INTERNAL_MODULE_ENABLED() (false)
|
||||
#endif
|
||||
#define IS_EXTERNAL_MODULE_ENABLED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
|
||||
#define IS_EXTERNAL_MODULE_ENABLED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_NONE)
|
||||
|
||||
enum UartModes {
|
||||
#if defined(CLI) || defined(DEBUG)
|
||||
@@ -256,7 +254,7 @@ enum UartModes {
|
||||
#define LEN_BLUETOOTH_NAME 10
|
||||
#endif
|
||||
|
||||
#define TELEM_LABEL_LEN 4
|
||||
#define TELEM_LABEL_LEN 4
|
||||
enum TelemetryUnit {
|
||||
UNIT_RAW,
|
||||
UNIT_VOLTS,
|
||||
@@ -358,7 +356,7 @@ enum SwitchSources {
|
||||
|
||||
SWSRC_FIRST_SWITCH,
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#if defined(PCBHORUS) || defined(PCBTARANIS)
|
||||
SWSRC_SA0 = SWSRC_FIRST_SWITCH,
|
||||
SWSRC_SA1,
|
||||
SWSRC_SA2,
|
||||
@@ -371,22 +369,22 @@ enum SwitchSources {
|
||||
SWSRC_SD0,
|
||||
SWSRC_SD1,
|
||||
SWSRC_SD2,
|
||||
#if !defined(PCBX7) && !defined(PCBXLITE)
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBXLITES)
|
||||
SWSRC_SE0,
|
||||
SWSRC_SE1,
|
||||
SWSRC_SE2,
|
||||
#endif
|
||||
#if !defined(PCBXLITE)
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBX7) || defined(PCBXLITES)
|
||||
SWSRC_SF0,
|
||||
SWSRC_SF1,
|
||||
SWSRC_SF2,
|
||||
#endif
|
||||
#if !defined(PCBX7) && !defined(PCBXLITE)
|
||||
#if defined(PCBHORUS) || defined(PCBX9)
|
||||
SWSRC_SG0,
|
||||
SWSRC_SG1,
|
||||
SWSRC_SG2,
|
||||
#endif
|
||||
#if !defined(PCBXLITE)
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBX7)
|
||||
SWSRC_SH0,
|
||||
SWSRC_SH1,
|
||||
SWSRC_SH2,
|
||||
@@ -423,15 +421,11 @@ enum SwitchSources {
|
||||
SWSRC_SR1,
|
||||
SWSRC_SR2,
|
||||
#endif
|
||||
#if defined(PCBX9E)
|
||||
SWSRC_LAST_SWITCH = SWSRC_FIRST_SWITCH + NUM_SWITCHES_POSITIONS - 1,
|
||||
#if NUM_SWITCHES >= 8
|
||||
SWSRC_TRAINER = SWSRC_SH2,
|
||||
SWSRC_LAST_SWITCH = SWSRC_SR2,
|
||||
#elif defined(PCBXLITE)
|
||||
SWSRC_TRAINER = SWSRC_SD2,
|
||||
SWSRC_LAST_SWITCH = SWSRC_SD2,
|
||||
#else
|
||||
SWSRC_TRAINER = SWSRC_SH2,
|
||||
SWSRC_LAST_SWITCH = SWSRC_SH2,
|
||||
SWSRC_TRAINER = SWSRC_LAST_SWITCH,
|
||||
#endif
|
||||
#else // neither Taranis nor Horus
|
||||
SWSRC_ID0 = SWSRC_FIRST_SWITCH,
|
||||
@@ -560,6 +554,9 @@ enum MixSources {
|
||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
||||
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
||||
MIXSRC_LAST_POT = MIXSRC_POT2,
|
||||
#elif defined(PCBX3)
|
||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
||||
MIXSRC_LAST_POT = MIXSRC_POT1,
|
||||
#elif defined(PCBTARANIS)
|
||||
MIXSRC_POT1 = MIXSRC_FIRST_POT, LUA_EXPORT("s1", "Potentiometer 1")
|
||||
MIXSRC_POT2, LUA_EXPORT("s2", "Potentiometer 2")
|
||||
@@ -588,9 +585,9 @@ enum MixSources {
|
||||
MIXSRC_MAX,
|
||||
|
||||
MIXSRC_FIRST_HELI,
|
||||
MIXSRC_CYC1 = MIXSRC_FIRST_HELI, LUA_EXPORT("cyc1", "Cyclic 1")
|
||||
MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
|
||||
MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
|
||||
MIXSRC_CYC1 = MIXSRC_FIRST_HELI, LUA_EXPORT("cyc1", "Cyclic 1")
|
||||
MIXSRC_CYC2, LUA_EXPORT("cyc2", "Cyclic 2")
|
||||
MIXSRC_CYC3, LUA_EXPORT("cyc3", "Cyclic 3")
|
||||
|
||||
MIXSRC_FIRST_TRIM,
|
||||
MIXSRC_TrimRud = MIXSRC_FIRST_TRIM, LUA_EXPORT("trim-rud", "Rudder trim")
|
||||
@@ -607,25 +604,23 @@ enum MixSources {
|
||||
|
||||
MIXSRC_FIRST_SWITCH,
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
#if defined(PCBHORUS) || defined(PCBTARANIS)
|
||||
MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
|
||||
MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
|
||||
MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
|
||||
MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
|
||||
MIXSRC_LAST_SWITCH = MIXSRC_SD,
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
MIXSRC_SA = MIXSRC_FIRST_SWITCH, LUA_EXPORT("sa", "Switch A")
|
||||
MIXSRC_SB, LUA_EXPORT("sb", "Switch B")
|
||||
MIXSRC_SC, LUA_EXPORT("sc", "Switch C")
|
||||
MIXSRC_SD, LUA_EXPORT("sd", "Switch D")
|
||||
#if !defined(PCBX7)
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBXLITES)
|
||||
MIXSRC_SE, LUA_EXPORT("se", "Switch E")
|
||||
#endif
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBX7) || defined(PCBXLITES)
|
||||
MIXSRC_SF, LUA_EXPORT("sf", "Switch F")
|
||||
#if !defined(PCBX7)
|
||||
#endif
|
||||
#if defined(PCBHORUS) || defined(PCBX9)
|
||||
MIXSRC_SG, LUA_EXPORT("sg", "Switch G")
|
||||
#endif
|
||||
#if defined(PCBHORUS) || defined(PCBX9) || defined(PCBX7)
|
||||
MIXSRC_SH, LUA_EXPORT("sh", "Switch H")
|
||||
#endif
|
||||
#if defined(PCBX9E)
|
||||
MIXSRC_SI, LUA_EXPORT("si", "Switch I")
|
||||
MIXSRC_SJ, LUA_EXPORT("sj", "Switch J")
|
||||
@@ -637,9 +632,6 @@ enum MixSources {
|
||||
MIXSRC_SP, LUA_EXPORT("sp", "Switch P")
|
||||
MIXSRC_SQ, LUA_EXPORT("sq", "Switch Q")
|
||||
MIXSRC_SR, LUA_EXPORT("sr", "Switch R")
|
||||
MIXSRC_LAST_SWITCH = MIXSRC_SR,
|
||||
#else
|
||||
MIXSRC_LAST_SWITCH = MIXSRC_SH,
|
||||
#endif
|
||||
#else
|
||||
MIXSRC_3POS = MIXSRC_FIRST_SWITCH,
|
||||
@@ -649,7 +641,6 @@ enum MixSources {
|
||||
MIXSRC_AIL,
|
||||
MIXSRC_GEA,
|
||||
MIXSRC_TRN,
|
||||
MIXSRC_LAST_SWITCH = MIXSRC_TRN,
|
||||
#endif
|
||||
MIXSRC_FIRST_LOGICAL_SWITCH,
|
||||
MIXSRC_SW1 = MIXSRC_FIRST_LOGICAL_SWITCH, LUA_EXPORT_MULTIPLE("ls", "Logical switch L%d", MAX_LOGICAL_SWITCHES)
|
||||
@@ -703,10 +694,11 @@ enum MixSources {
|
||||
MIXSRC_LAST_TELEM = MIXSRC_FIRST_TELEM+3*MAX_TELEMETRY_SENSORS-1
|
||||
};
|
||||
|
||||
#define MIXSRC_FIRST (MIXSRC_NONE+1)
|
||||
#define MIXSRC_LAST MIXSRC_LAST_CH
|
||||
#define INPUTSRC_FIRST MIXSRC_Rud
|
||||
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
||||
#define MIXSRC_FIRST (MIXSRC_NONE + 1)
|
||||
#define MIXSRC_LAST MIXSRC_LAST_CH
|
||||
#define MIXSRC_LAST_SWITCH (MIXSRC_FIRST_SWITCH + NUM_SWITCHES - 1)
|
||||
#define INPUTSRC_FIRST MIXSRC_Rud
|
||||
#define INPUTSRC_LAST MIXSRC_LAST_TELEM
|
||||
|
||||
enum BacklightMode {
|
||||
e_backlight_mode_off = 0,
|
||||
@@ -803,4 +795,9 @@ enum BluetoothModes {
|
||||
BLUETOOTH_TRAINER,
|
||||
};
|
||||
|
||||
// PXX2 constants
|
||||
#define PXX2_LEN_REGISTRATION_ID 8
|
||||
#define PXX2_LEN_RX_NAME 8
|
||||
#define PXX2_MAX_RECEIVERS_PER_MODULE 3
|
||||
|
||||
#endif // _DATACONSTANTS_H_
|
||||
|
||||
+142
-80
@@ -25,6 +25,7 @@
|
||||
#include "board.h"
|
||||
#include "dataconstants.h"
|
||||
#include "definitions.h"
|
||||
#include "bitfield.h"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define N_TARANIS_FIELD(x)
|
||||
@@ -385,14 +386,40 @@ PACK(struct TelemetrySensor {
|
||||
uint32_t param;
|
||||
};
|
||||
NOBACKUP(
|
||||
void init(const char *label, uint8_t unit=UNIT_RAW, uint8_t prec=0);
|
||||
void init(uint16_t id);
|
||||
bool isAvailable() const;
|
||||
int32_t getValue(int32_t value, uint8_t unit, uint8_t prec) const;
|
||||
bool isConfigurable() const;
|
||||
bool isPrecConfigurable() const;
|
||||
int32_t getPrecMultiplier() const;
|
||||
int32_t getPrecDivisor() const);
|
||||
void init(const char *label, uint8_t unit=UNIT_RAW, uint8_t prec=0);
|
||||
void init(uint16_t id);
|
||||
bool isAvailable() const;
|
||||
int32_t getValue(int32_t value, uint8_t unit, uint8_t prec) const;
|
||||
bool isConfigurable() const;
|
||||
bool isPrecConfigurable() const;
|
||||
int32_t getPrecMultiplier() const;
|
||||
int32_t getPrecDivisor() const;
|
||||
);
|
||||
});
|
||||
|
||||
/*
|
||||
* Trainer module structure
|
||||
*/
|
||||
|
||||
PACK(struct TrainerModuleData {
|
||||
uint8_t mode:3;
|
||||
uint8_t spare:5;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
int8_t frameLength;
|
||||
int8_t delay:6;
|
||||
uint8_t pulsePol:1;
|
||||
});
|
||||
|
||||
/*
|
||||
* Receiver structure
|
||||
*/
|
||||
|
||||
PACK(struct ReceiverData {
|
||||
uint8_t used:1;
|
||||
uint8_t telemetry:1;
|
||||
uint8_t dirty:6;
|
||||
char name[PXX2_LEN_RX_NAME];
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -406,10 +433,19 @@ PACK(struct ModuleData {
|
||||
int8_t rfProtocol:4;
|
||||
uint8_t channelsStart;
|
||||
int8_t channelsCount; // 0=8 channels
|
||||
uint8_t failsafeMode:4; // only 3 bits used
|
||||
uint8_t subType:3;
|
||||
uint8_t invertedSerial:1; // telemetry serial inverted from standard
|
||||
int16_t failsafeChannels[MAX_OUTPUT_CHANNELS];
|
||||
union {
|
||||
struct {
|
||||
uint8_t failsafeMode:4; // only 3 bits used
|
||||
uint8_t subType:3;
|
||||
uint8_t invertedSerial:1; // telemetry serial inverted from standard
|
||||
};
|
||||
struct {
|
||||
uint8_t failsafeMode:4; // only 3 bits used
|
||||
uint8_t freq:2;
|
||||
uint8_t region:2;
|
||||
} r9m;
|
||||
};
|
||||
|
||||
union {
|
||||
struct {
|
||||
int8_t delay:6;
|
||||
@@ -440,6 +476,28 @@ PACK(struct ModuleData {
|
||||
uint8_t spare2:1;
|
||||
int8_t refreshRate; // definition as framelength for ppm (* 5 + 225 = time in 1/10 ms)
|
||||
} sbus);
|
||||
NOBACKUP(PACK(struct {
|
||||
uint8_t power:2; // 0=10 mW, 1=100 mW, 2=500 mW, 3=1W
|
||||
uint8_t external_antenna:1; // false = internal antenna, true = external antenna
|
||||
#if defined(PCBHORUS)
|
||||
uint8_t spare:5;
|
||||
uint32_t receivers; // max 5 receivers per module and 10 receivers in total (4bits per receiver with 0 = unused)
|
||||
#else
|
||||
uint8_t spare:1;
|
||||
uint16_t receivers:12; // max 4 receivers per module and 4 receivers in total (3bits per receiver with 0 = unused)
|
||||
#endif
|
||||
NOBACKUP(inline uint8_t getReceiverSlot(uint8_t receiver) {
|
||||
return (receivers >> (3 * receiver)) & 0b111;
|
||||
})
|
||||
|
||||
NOBACKUP(inline void setReceiverSlot(uint8_t receiver, uint8_t slot) {
|
||||
receivers = BF_SET<uint16_t>(receivers, slot, 3 * receiver, 3);
|
||||
})
|
||||
|
||||
NOBACKUP(inline void clearReceiverSlot(uint8_t receiver) {
|
||||
setReceiverSlot(receiver, 0);
|
||||
})
|
||||
}) pxx2);
|
||||
};
|
||||
|
||||
// Helper functions to set both of the rfProto protocol at the same time
|
||||
@@ -449,12 +507,10 @@ PACK(struct ModuleData {
|
||||
return ((uint8_t) (rfProtocol & 0x0f)) + (multi.rfProtocolExtra << 4);
|
||||
})
|
||||
|
||||
NOBACKUP(inline void setMultiProtocol(uint8_t proto)
|
||||
{
|
||||
NOBACKUP(inline void setMultiProtocol(uint8_t proto) {
|
||||
rfProtocol = (uint8_t) (proto & 0x0f);
|
||||
multi.rfProtocolExtra = (proto & 0x30) >> 4;
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -501,10 +557,6 @@ typedef uint8_t swarnenable_t;
|
||||
swarnenable_t switchWarningEnable;
|
||||
#endif
|
||||
|
||||
#define MODEL_GVARS_DATA GVarData gvars[MAX_GVARS];
|
||||
|
||||
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky); NOBACKUP(RssiAlarmData rssiAlarms);
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#include "gui/480x272/layout.h"
|
||||
#include "gui/480x272/topbar.h"
|
||||
@@ -518,23 +570,11 @@ PACK(struct CustomScreenData {
|
||||
NOBACKUP(Topbar::PersistentData topbarData); \
|
||||
NOBACKUP(uint8_t view);
|
||||
#elif defined(PCBTARANIS)
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
#define CUSTOM_SCREENS_DATA \
|
||||
NOBACKUP(uint8_t view);
|
||||
#else
|
||||
#define CUSTOM_SCREENS_DATA
|
||||
// TODO other boards could have their custom screens here as well
|
||||
#endif
|
||||
|
||||
#if defined(PCBX12S)
|
||||
#define MODELDATA_EXTRA NOBACKUP(uint8_t spare:3); NOBACKUP(uint8_t trainerMode:3); NOBACKUP(uint8_t potsWarnMode:2); ModuleData moduleData[NUM_MODULES+1]; NOBACKUP(ScriptData scriptsData[MAX_SCRIPTS]); NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]); NOBACKUP(uint8_t potsWarnEnabled); NOBACKUP(int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]);
|
||||
#elif defined(PCBX10)
|
||||
#define MODELDATA_EXTRA NOBACKUP(uint8_t spare:3); NOBACKUP(uint8_t trainerMode:3); NOBACKUP(uint8_t potsWarnMode:2); ModuleData moduleData[NUM_MODULES+1]; NOBACKUP(ScriptData scriptsData[MAX_SCRIPTS]); NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]); NOBACKUP(uint8_t potsWarnEnabled); NOBACKUP(int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]); NOBACKUP(uint8_t potsWarnSpares[NUM_DUMMY_ANAS]);
|
||||
#elif defined(PCBTARANIS)
|
||||
#define MODELDATA_EXTRA uint8_t spare:3; uint8_t trainerMode:3; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; ScriptData scriptsData[MAX_SCRIPTS]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS];
|
||||
#elif defined(PCBSKY9X)
|
||||
#define MODELDATA_EXTRA uint8_t spare:6; uint8_t potsWarnMode:2; ModuleData moduleData[NUM_MODULES+1]; char inputNames[MAX_INPUTS][LEN_INPUT_NAME]; uint8_t potsWarnEnabled; int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS]; uint8_t rxBattAlarms[2];
|
||||
#else
|
||||
#define MODELDATA_EXTRA
|
||||
#define CUSTOM_SCREENS_DATA
|
||||
// TODO other boards could have their custom screens here as well
|
||||
#endif
|
||||
|
||||
PACK(struct ModelData {
|
||||
@@ -568,11 +608,25 @@ PACK(struct ModelData {
|
||||
|
||||
SWITCHES_WARNING_DATA
|
||||
|
||||
MODEL_GVARS_DATA
|
||||
GVarData gvars[MAX_GVARS];
|
||||
|
||||
TELEMETRY_DATA
|
||||
NOBACKUP(FrSkyTelemetryData frsky);
|
||||
NOBACKUP(RssiAlarmData rssiAlarms);
|
||||
|
||||
MODELDATA_EXTRA
|
||||
NOBACKUP(uint8_t spare:6);
|
||||
NOBACKUP(uint8_t potsWarnMode:2);
|
||||
ModuleData moduleData[NUM_MODULES];
|
||||
ReceiverData receiverData[NUM_RECEIVERS];
|
||||
int16_t failsafeChannels[MAX_OUTPUT_CHANNELS];
|
||||
TrainerModuleData trainerData;
|
||||
|
||||
#if defined(PCBHORUS) || defined(PCBTARANIS)
|
||||
NOBACKUP(ScriptData scriptsData[MAX_SCRIPTS]);
|
||||
#endif
|
||||
|
||||
NOBACKUP(char inputNames[MAX_INPUTS][LEN_INPUT_NAME]);
|
||||
NOBACKUP(uint8_t potsWarnEnabled);
|
||||
NOBACKUP(int8_t potsWarnPosition[NUM_POTS+NUM_SLIDERS+NUM_DUMMY_ANAS]);
|
||||
|
||||
NOBACKUP(TelemetrySensor telemetrySensors[MAX_TELEMETRY_SENSORS];)
|
||||
|
||||
@@ -580,6 +634,7 @@ PACK(struct ModelData {
|
||||
|
||||
CUSTOM_SCREENS_DATA
|
||||
|
||||
char modelRegistrationID[PXX2_LEN_REGISTRATION_ID];
|
||||
});
|
||||
|
||||
/*
|
||||
@@ -616,30 +671,8 @@ PACK(struct TrainerData {
|
||||
#define SPLASH_MODE int8_t splashMode:3
|
||||
#endif
|
||||
|
||||
#define EXTRA_GENERAL_FIELDS_ARM \
|
||||
NOBACKUP(uint8_t backlightBright); \
|
||||
NOBACKUP(uint32_t globalTimer); \
|
||||
NOBACKUP(uint8_t bluetoothBaudrate:4); \
|
||||
NOBACKUP(uint8_t bluetoothMode:4); \
|
||||
NOBACKUP(uint8_t countryCode); \
|
||||
NOBACKUP(uint8_t imperial:1); \
|
||||
NOBACKUP(uint8_t jitterFilter:1); /* 0 - active */\
|
||||
NOBACKUP(uint8_t disableRssiPoweroffAlarm:1); \
|
||||
NOBACKUP(uint8_t USBMode:2); \
|
||||
NOBACKUP(uint8_t spareExtraArm:3); \
|
||||
NOBACKUP(char ttsLanguage[2]); \
|
||||
NOBACKUP(int8_t beepVolume:4); \
|
||||
NOBACKUP(int8_t wavVolume:4); \
|
||||
NOBACKUP(int8_t varioVolume:4); \
|
||||
NOBACKUP(int8_t backgroundVolume:4); \
|
||||
NOBACKUP(int8_t varioPitch); \
|
||||
NOBACKUP(int8_t varioRange); \
|
||||
NOBACKUP(int8_t varioRepeat); \
|
||||
CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS];
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
EXTRA_GENERAL_FIELDS_ARM \
|
||||
NOBACKUP(uint8_t serial2Mode:4); \
|
||||
uint8_t slidersConfig:4; \
|
||||
uint32_t switchConfig; \
|
||||
@@ -659,7 +692,6 @@ PACK(struct TrainerData {
|
||||
#define BLUETOOTH_FIELDS
|
||||
#endif
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
EXTRA_GENERAL_FIELDS_ARM \
|
||||
uint8_t serial2Mode:4; \
|
||||
uint8_t slidersConfig:4; \
|
||||
uint8_t potsConfig; /* two bits per pot */\
|
||||
@@ -671,7 +703,6 @@ PACK(struct TrainerData {
|
||||
BLUETOOTH_FIELDS
|
||||
#elif defined(PCBSKY9X)
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
EXTRA_GENERAL_FIELDS_ARM \
|
||||
int8_t txCurrentCalibration; \
|
||||
int8_t temperatureWarn; \
|
||||
uint8_t mAhWarn; \
|
||||
@@ -683,7 +714,7 @@ PACK(struct TrainerData {
|
||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||
char anaNames[NUM_STICKS+NUM_POTS+NUM_SLIDERS][LEN_ANA_NAME];
|
||||
#else
|
||||
#define EXTRA_GENERAL_FIELDS EXTRA_GENERAL_FIELDS_ARM
|
||||
#define EXTRA_GENERAL_FIELDS
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
@@ -697,9 +728,9 @@ PACK(struct TrainerData {
|
||||
#endif
|
||||
|
||||
#if defined(BUZZER)
|
||||
#define BUZZER_FIELD NOBACKUP(int8_t buzzerMode:2); // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
|
||||
#define BUZZER_FIELD int8_t buzzerMode:2; // -2=quiet, -1=only alarms, 0=no keys, 1=all (only used on AVR radios without audio hardware)
|
||||
#else
|
||||
#define BUZZER_FIELD NOBACKUP(int8_t spareRadio:2);
|
||||
#define BUZZER_FIELD int8_t spareRadio:2;
|
||||
#endif
|
||||
|
||||
PACK(struct RadioData {
|
||||
@@ -743,16 +774,39 @@ PACK(struct RadioData {
|
||||
NOBACKUP(int8_t vBatMin);
|
||||
NOBACKUP(int8_t vBatMax);
|
||||
|
||||
NOBACKUP(uint8_t backlightBright);
|
||||
NOBACKUP(uint32_t globalTimer);
|
||||
NOBACKUP(uint8_t bluetoothBaudrate:4);
|
||||
NOBACKUP(uint8_t bluetoothMode:4);
|
||||
NOBACKUP(uint8_t countryCode);
|
||||
NOBACKUP(uint8_t imperial:1);
|
||||
NOBACKUP(uint8_t jitterFilter:1); /* 0 - active */
|
||||
NOBACKUP(uint8_t disableRssiPoweroffAlarm:1);
|
||||
NOBACKUP(uint8_t USBMode:2);
|
||||
NOBACKUP(uint8_t jackMode:2);
|
||||
NOBACKUP(uint8_t spareExtraArm:1);
|
||||
NOBACKUP(char ttsLanguage[2]);
|
||||
NOBACKUP(int8_t beepVolume:4);
|
||||
NOBACKUP(int8_t wavVolume:4);
|
||||
NOBACKUP(int8_t varioVolume:4);
|
||||
NOBACKUP(int8_t backgroundVolume:4);
|
||||
NOBACKUP(int8_t varioPitch);
|
||||
NOBACKUP(int8_t varioRange);
|
||||
NOBACKUP(int8_t varioRepeat);
|
||||
|
||||
CustomFunctionData customFn[MAX_SPECIAL_FUNCTIONS];
|
||||
|
||||
EXTRA_GENERAL_FIELDS
|
||||
|
||||
THEME_DATA
|
||||
|
||||
char ownerRegistrationID[PXX2_LEN_REGISTRATION_ID];
|
||||
});
|
||||
|
||||
#undef SWITCHES_WARNING_DATA
|
||||
#undef MODEL_GVARS_DATA
|
||||
#undef TELEMETRY_DATA
|
||||
#undef MODELDATA_EXTRA
|
||||
#undef SCRIPTS_DATA
|
||||
#undef CUSTOM_SCREENS_DATA
|
||||
#undef SPLASH_MODE
|
||||
#undef EXTRA_GENERAL_FIELDS
|
||||
@@ -783,7 +837,7 @@ static inline void check_struct()
|
||||
/* Difference between Taranis/Horus is LEN_EXPOMIX_NAME */
|
||||
/* LEN_FUNCTION_NAME is the difference in CustomFunctionData */
|
||||
|
||||
#if defined(PCBX7) || defined(PCBXLITE)
|
||||
#if defined(PCBX7) || defined(PCBXLITE) || defined(PCBX3)
|
||||
CHKSIZE(MixData, 20);
|
||||
CHKSIZE(ExpoData, 17);
|
||||
CHKSIZE(LimitData, 11);
|
||||
@@ -862,31 +916,39 @@ static inline void check_struct()
|
||||
|
||||
CHKSIZE(LogicalSwitchData, 9);
|
||||
CHKSIZE(TelemetrySensor, 13);
|
||||
CHKSIZE(ModuleData,70);
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
CHKSIZE(ModuleData, 9);
|
||||
#else
|
||||
CHKSIZE(ModuleData, 6);
|
||||
#endif
|
||||
|
||||
CHKSIZE(GVarData, 7);
|
||||
|
||||
CHKSIZE(RssiAlarmData, 2);
|
||||
CHKSIZE(TrainerData, 16);
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
CHKSIZE(RadioData, 844);
|
||||
CHKSIZE(ModelData, 6025);
|
||||
#if defined(PCBXLITES)
|
||||
CHKSIZE(RadioData, 858);
|
||||
CHKSIZE(ModelData, 5940);
|
||||
#elif defined(PCBXLITE)
|
||||
CHKSIZE(RadioData, 852);
|
||||
CHKSIZE(ModelData, 5940);
|
||||
#elif defined(PCBX7)
|
||||
CHKSIZE(RadioData, 850);
|
||||
CHKSIZE(ModelData, 6025);
|
||||
CHKSIZE(RadioData, 858);
|
||||
CHKSIZE(ModelData, 5940);
|
||||
#elif defined(PCBX9E)
|
||||
CHKSIZE(RadioData, 952);
|
||||
CHKSIZE(ModelData, 6520);
|
||||
CHKSIZE(RadioData, 960);
|
||||
CHKSIZE(ModelData, 6435);
|
||||
#elif defined(PCBX9D)
|
||||
CHKSIZE(RadioData, 872);
|
||||
CHKSIZE(ModelData, 6507);
|
||||
CHKSIZE(RadioData, 880);
|
||||
CHKSIZE(ModelData, 6422);
|
||||
#elif defined(PCBSKY9X)
|
||||
CHKSIZE(RadioData, 727);
|
||||
CHKSIZE(ModelData, 5188);
|
||||
CHKSIZE(RadioData, 735);
|
||||
CHKSIZE(ModelData, 5101);
|
||||
#elif defined(PCBHORUS)
|
||||
CHKSIZE(RadioData, 847);
|
||||
CHKSIZE(ModelData, 9380);
|
||||
CHKSIZE(RadioData, 855);
|
||||
CHKSIZE(ModelData, 9771);
|
||||
#endif
|
||||
|
||||
#undef CHKSIZE
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#define _DEFINITIONS_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(UNUSED)
|
||||
#define UNUSED(x) ((void)(x)) /* to avoid warnings */
|
||||
|
||||
+16
-4
@@ -21,6 +21,8 @@
|
||||
#ifndef _FIFO_H_
|
||||
#define _FIFO_H_
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
template <class T, int N>
|
||||
class Fifo
|
||||
{
|
||||
@@ -40,13 +42,18 @@ class Fifo
|
||||
|
||||
void push(T element)
|
||||
{
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
uint32_t next = nextIndex(widx);
|
||||
if (next != ridx) {
|
||||
fifo[widx] = element;
|
||||
widx = next;
|
||||
}
|
||||
}
|
||||
|
||||
void skip()
|
||||
{
|
||||
ridx = nextIndex(ridx);
|
||||
}
|
||||
|
||||
bool pop(T & element)
|
||||
{
|
||||
if (isEmpty()) {
|
||||
@@ -54,7 +61,7 @@ class Fifo
|
||||
}
|
||||
else {
|
||||
element = fifo[ridx];
|
||||
ridx = (ridx+1) & (N-1);
|
||||
ridx = nextIndex(ridx);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +73,7 @@ class Fifo
|
||||
|
||||
bool isFull()
|
||||
{
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
uint32_t next = nextIndex(widx);
|
||||
return (next == ridx);
|
||||
}
|
||||
|
||||
@@ -77,7 +84,7 @@ class Fifo
|
||||
|
||||
uint32_t size() const
|
||||
{
|
||||
return (N + widx - ridx) & (N-1);
|
||||
return (N + widx - ridx) & (N - 1);
|
||||
}
|
||||
|
||||
uint32_t hasSpace(uint32_t n) const
|
||||
@@ -100,6 +107,11 @@ class Fifo
|
||||
T fifo[N];
|
||||
volatile uint32_t widx;
|
||||
volatile uint32_t ridx;
|
||||
|
||||
inline uint32_t nextIndex(uint32_t idx)
|
||||
{
|
||||
return (idx + 1) & (N - 1);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // _FIFO_H_
|
||||
|
||||
@@ -155,8 +155,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
active &= (bool)CFN_ACTIVE(cfn);
|
||||
}
|
||||
|
||||
if (active || IS_PLAY_BOTH_FUNC(CFN_FUNC(cfn))) {
|
||||
|
||||
if (active) {
|
||||
switch (CFN_FUNC(cfn)) {
|
||||
|
||||
#if defined(OVERRIDE_CHANNEL_FUNCTION)
|
||||
@@ -233,7 +232,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
{
|
||||
unsigned int moduleIndex = CFN_PARAM(cfn);
|
||||
if (moduleIndex < NUM_MODULES) {
|
||||
moduleFlag[moduleIndex] = 1 + CFN_FUNC(cfn) - FUNC_RANGECHECK;
|
||||
moduleSettings[moduleIndex].mode = 1 + CFN_FUNC(cfn) - FUNC_RANGECHECK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -404,7 +403,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
{
|
||||
unsigned int moduleIndex = CFN_PARAM(cfn);
|
||||
if (moduleIndex < NUM_MODULES) {
|
||||
moduleFlag[moduleIndex] = 0;
|
||||
moduleSettings[moduleIndex].mode = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+28
-68
@@ -27,7 +27,7 @@
|
||||
|
||||
#define MENUS_SCROLLBAR_WIDTH 0
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
#define HEADER_LINE 0
|
||||
#define HEADER_LINE_COLUMNS
|
||||
#else
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||
#define MENU_HEADER_HEIGHT FH
|
||||
#define MENU_INIT_VPOS 0
|
||||
|
||||
#define CURVE_SIDE_WIDTH (LCD_H/2)
|
||||
#define CURVE_CENTER_X (LCD_W-CURVE_SIDE_WIDTH-2)
|
||||
@@ -53,45 +52,32 @@ extern uint8_t noHighlightCounter;
|
||||
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
||||
#define START_NO_HIGHLIGHT() do { noHighlightCounter = 25; } while(0)
|
||||
|
||||
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
|
||||
#if defined(NAVIGATION_POT1)
|
||||
extern int16_t p1valdiff;
|
||||
#else
|
||||
#define p1valdiff 0
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_POT2)
|
||||
extern int8_t p2valdiff;
|
||||
#else
|
||||
#define p2valdiff 0
|
||||
#endif
|
||||
|
||||
extern int8_t checkIncDec_Ret; // global helper vars
|
||||
|
||||
#define EDIT_SELECT_MENU -1
|
||||
#define EDIT_SELECT_FIELD 0
|
||||
#define EDIT_MODIFY_FIELD 1
|
||||
#define EDIT_MODIFY_STRING 2
|
||||
extern int8_t s_editMode; // global editmode
|
||||
|
||||
// checkIncDec flags
|
||||
#define EE_GENERAL 0x01
|
||||
#define EE_MODEL 0x02
|
||||
|
||||
// we leave room for EE_MODEL and EE_GENERAL
|
||||
#define NO_INCDEC_MARKS 0x04
|
||||
#define INCDEC_SWITCH 0x08
|
||||
#define INCDEC_SOURCE 0x10
|
||||
#define INCDEC_REP10 0x40
|
||||
#define NO_DBLKEYS 0x80
|
||||
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
#define INCDEC_ENABLE_CHECK(fn) isValueAvailable = fn
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define READONLY_ROW ((uint8_t)-1)
|
||||
#define TITLE_ROW READONLY_ROW
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
struct CheckIncDecStops {
|
||||
@@ -167,9 +153,9 @@ void check_submenu_simple(event_t event, uint8_t maxrow);
|
||||
void title(const char * s);
|
||||
#define TITLE(str) title(str)
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
#define MENU_CHECK(tab, menu, lines_count) \
|
||||
check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count)
|
||||
#else
|
||||
@@ -182,13 +168,12 @@ void title(const char * s);
|
||||
MENU_CHECK(tab, menu, lines_count); \
|
||||
TITLE(title)
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||
check_simple(event, menu, tab, DIM(tab), lines_count);
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||
}
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count);
|
||||
#define SUBMENU(title, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, lines_count); \
|
||||
@@ -198,10 +183,9 @@ void title(const char * s);
|
||||
#else
|
||||
#define SIMPLE_MENU_NOTITLE(tab, menu, lines_count) \
|
||||
check_simple(event, menu, tab, DIM(tab), (lines_count)-1);
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) { \
|
||||
#define SUBMENU_NOTITLE(lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1); \
|
||||
}
|
||||
check(event, 0, NULL, 0, mstate_tab, DIM(mstate_tab)-1, (lines_count)-1);
|
||||
|
||||
#define SUBMENU(title, lines_count, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
@@ -211,8 +195,6 @@ void title(const char * s);
|
||||
#define SIMPLE_SUBMENU_NOTITLE(lines_count) \
|
||||
check_submenu_simple(event, (lines_count)-1);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#define SIMPLE_MENU(title, tab, menu, lines_count) \
|
||||
@@ -232,32 +214,21 @@ int8_t editSwitch(coord_t x, coord_t y, int8_t value, LcdFlags attr, event_t eve
|
||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = editCheckBox(value, x, y, label, attr, event)
|
||||
|
||||
#if defined(GVARS)
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, editflags, event)
|
||||
#else
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, event)
|
||||
#endif
|
||||
|
||||
#if defined(GVARS)
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, editflags, event)
|
||||
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, uint8_t editflags, event_t event);
|
||||
void drawGVarName(coord_t x, coord_t y, int8_t index, LcdFlags flags=0);
|
||||
void drawGVarValue(coord_t x, coord_t y, uint8_t gvar, gvar_t value, LcdFlags flags=0);
|
||||
void editGVarValue(coord_t x, coord_t y, event_t event, uint8_t gvar, uint8_t flightMode, LcdFlags flags);
|
||||
#elif defined(GVARS)
|
||||
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
|
||||
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
|
||||
#else
|
||||
int16_t editGVarFieldValue(coord_t x, coord_t y, int16_t value, int16_t min, int16_t max, LcdFlags attr, event_t event);
|
||||
#define GVAR_MENU_ITEM(x, y, v, min, max, attr, editflags, event) editGVarFieldValue(x, y, v, min, max, attr, event)
|
||||
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
void gvarWeightItem(coord_t x, coord_t y, MixData * md, LcdFlags attr, event_t event);
|
||||
|
||||
#if defined(GVARS)
|
||||
#define displayGVar(x, y, v, min, max) GVAR_MENU_ITEM(x, y, v, min, max, 0, 0, 0)
|
||||
#else
|
||||
#define displayGVar(x, y, v, min, max) lcdDraw8bitsNumber(x, y, v)
|
||||
#endif
|
||||
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, uint8_t active, LcdFlags attr=ZCHAR);
|
||||
|
||||
void editSingleName(coord_t x, coord_t y, const char * label, char * name, uint8_t size, event_t event, uint8_t active);
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay);
|
||||
@@ -265,13 +236,7 @@ uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint
|
||||
|
||||
#define WARNING_TYPE_ASTERISK 0
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
#define WARNING_TYPE_INFO 2
|
||||
|
||||
#define COPY_MODE 1
|
||||
#define MOVE_MODE 2
|
||||
@@ -295,11 +260,11 @@ void drawStatusLine();
|
||||
#endif
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
void readModelNotes();
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
void readModelNotes();
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
@@ -335,7 +300,7 @@ void drawStatusLine();
|
||||
#endif
|
||||
|
||||
// TODO enum
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
#define EDIT_MODE_INIT 0
|
||||
#else
|
||||
#define EDIT_MODE_INIT -1
|
||||
@@ -357,8 +322,6 @@ void onSourceLongEnterPress(const char *result);
|
||||
|
||||
uint8_t switchToMix(uint8_t source);
|
||||
|
||||
void deleteExpoMix(uint8_t expo, uint8_t idx);
|
||||
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
|
||||
extern const unsigned char sticks[] ;
|
||||
@@ -370,15 +333,12 @@ void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
||||
void drawPotsBars();
|
||||
void doMainScreenGraphics();
|
||||
|
||||
void drawProgressBar(const char * label, int num, int den);
|
||||
void drawProgressScreen(const char * title, const char * message, int num, int den);
|
||||
void drawSleepBitmap();
|
||||
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
void drawAlertBox(const char * title, const char * text, const char * action);
|
||||
#endif
|
||||
|
||||
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound);
|
||||
|
||||
#define SET_SCROLLBAR_X(x)
|
||||
|
||||
@@ -292,7 +292,7 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
|
||||
{
|
||||
uint8_t width = 0;
|
||||
for (int i=0; len==0 || i<len; ++i) {
|
||||
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
if (!c) {
|
||||
break;
|
||||
}
|
||||
@@ -327,7 +327,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
break;
|
||||
#if !defined(BOOT)
|
||||
case ZCHAR:
|
||||
c = idx2char(*s);
|
||||
c = zchar2char(*s);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@@ -428,6 +428,19 @@ void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags flags)
|
||||
}
|
||||
}
|
||||
|
||||
void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags)
|
||||
{
|
||||
x += FWNUM*2;
|
||||
for (int i=0; i<2; i++) {
|
||||
x -= FWNUM;
|
||||
char c = val & 0xf;
|
||||
c = c>9 ? c+'A'-10 : c+'0';
|
||||
lcdDrawChar(x, y, c, flags|(c>='A' ? CONDENSED : 0));
|
||||
val >>= 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void lcdDraw8bitsNumber(coord_t x, coord_t y, int8_t val)
|
||||
{
|
||||
lcdDrawNumber(x, y, val);
|
||||
|
||||
@@ -124,7 +124,8 @@ void lcdDrawTextAlignedLeft(coord_t y, const char * s);
|
||||
|
||||
#define lcdDrawTextAlignedCenter(y, s) lcdDrawText((LCD_W-sizeof(TR_##s)*FW+FW+1)/2, y, STR_##s)
|
||||
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcdDrawHexNumber(coord_t x, coord_t y, uint32_t val, LcdFlags mode=0);
|
||||
void lcdDrawHexChar(coord_t x, coord_t y, uint8_t val, LcdFlags flags=0);
|
||||
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode, uint8_t len);
|
||||
void lcdDrawNumber(coord_t x, coord_t y, lcdint_t val, LcdFlags mode=0);
|
||||
|
||||
@@ -33,6 +33,13 @@ void popMenu()
|
||||
TRACE("popMenu(%d)", menuLevel);
|
||||
}
|
||||
|
||||
void abortPopMenu()
|
||||
{
|
||||
menuLevel = menuLevel + 1;
|
||||
menuEvent = 0;
|
||||
TRACE("popMenu(%d) aborted", menuLevel);
|
||||
}
|
||||
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
|
||||
@@ -56,6 +56,17 @@ extern uint8_t menuEvent;
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
void popMenu();
|
||||
void abortPopMenu();
|
||||
|
||||
inline bool isRadioMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 1;
|
||||
}
|
||||
|
||||
inline bool isModelMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 0;
|
||||
}
|
||||
|
||||
inline MenuHandlerFunc lastPopMenu()
|
||||
{
|
||||
@@ -63,7 +74,6 @@ inline MenuHandlerFunc lastPopMenu()
|
||||
}
|
||||
|
||||
void onMainViewMenu(const char * result);
|
||||
|
||||
void menuFirstCalib(event_t event);
|
||||
void menuMainView(event_t event);
|
||||
void menuViewTelemetryFrsky(event_t event);
|
||||
@@ -73,10 +83,11 @@ enum MenuRadioIndexes
|
||||
{
|
||||
MENU_RADIO_SETUP,
|
||||
CASE_SDCARD(MENU_RADIO_SD_MANAGER)
|
||||
MENU_RADIO_TOOLS,
|
||||
MENU_RADIO_SPECIAL_FUNCTIONS,
|
||||
MENU_RADIO_TRAINER,
|
||||
MENU_RADIO_VERSION,
|
||||
MENU_RADIO_HARDWARE,
|
||||
MENU_RADIO_VERSION,
|
||||
MENU_RADIO_PAGES_COUNT
|
||||
};
|
||||
|
||||
@@ -88,15 +99,19 @@ void menuRadioVersion(event_t event);
|
||||
void menuRadioDiagKeys(event_t event);
|
||||
void menuRadioDiagAnalogs(event_t event);
|
||||
void menuRadioHardware(event_t event);
|
||||
void menuRadioTools(event_t event);
|
||||
void menuRadioSpectrumAnalyser(event_t event);
|
||||
void menuRadioPowerMeter(event_t event);
|
||||
void menuRadioCalibration(event_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabGeneral[] = {
|
||||
menuRadioSetup,
|
||||
CASE_SDCARD(menuRadioSdManager)
|
||||
menuRadioTools,
|
||||
menuRadioSpecialFunctions,
|
||||
menuRadioTrainer,
|
||||
menuRadioVersion,
|
||||
menuRadioHardware
|
||||
menuRadioHardware,
|
||||
menuRadioVersion
|
||||
};
|
||||
|
||||
enum MenuModelIndexes {
|
||||
@@ -120,6 +135,9 @@ enum MenuModelIndexes {
|
||||
|
||||
void menuModelSelect(event_t event);
|
||||
void menuModelSetup(event_t event);
|
||||
void menuModelFailsafe(event_t event);
|
||||
void menuModelModuleOptions(event_t event);
|
||||
void menuModelReceiverOptions(event_t event);
|
||||
void menuModelHeli(event_t event);
|
||||
void menuModelFlightModesAll(event_t event);
|
||||
void menuModelExpoOne(event_t event);
|
||||
|
||||
@@ -20,17 +20,39 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void displayPresetChoice(event_t event)
|
||||
void runPopupCurvePreset(event_t event)
|
||||
{
|
||||
runPopupWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
|
||||
warningResult = false;
|
||||
|
||||
drawMessageBox(warningText);
|
||||
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, STR_POPUPS_ENTER_EXIT);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
warningResult = true;
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
|
||||
default:
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
reusableBuffer.curveEdit.preset = checkIncDec(event, reusableBuffer.curveEdit.preset, -4, 4);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, '@', INVERS);
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
int k = 25 * warningInputValue;
|
||||
int k = 25 * reusableBuffer.curveEdit.preset;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
int x = -1000 + i * dx;
|
||||
@@ -45,7 +67,8 @@ void displayPresetChoice(event_t event)
|
||||
void onCurveOneMenu(const char * result)
|
||||
{
|
||||
if (result == STR_CURVE_PRESET) {
|
||||
POPUP_INPUT(STR_PRESET, displayPresetChoice, 0, -4, 4);
|
||||
reusableBuffer.curveEdit.preset = 4; // 45°
|
||||
POPUP_INPUT(STR_PRESET, runPopupCurvePreset);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
|
||||
@@ -37,7 +37,7 @@ void onModelCustomScriptMenu(const char *result)
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a lua file in the list
|
||||
copySelection(sd.file, result, sizeof(sd.file));
|
||||
memset(sd.inputs, 0, sizeof(sd.inputs));
|
||||
|
||||
@@ -73,7 +73,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file in the list
|
||||
memcpy(g_model.frsky.screens[screenIndex].script.file, result, sizeof(g_model.frsky.screens[screenIndex].script.file));
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
uint8_t wbar = LCD_W - FW * 4 - FWNUM * 4;
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
wbar -= 6;
|
||||
#endif
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode > 0) {
|
||||
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + 1);
|
||||
|
||||
lcdDrawTextAlignedCenter(0, FAILSAFESET);
|
||||
lcdInvertLine(0);
|
||||
|
||||
const coord_t x = 1;
|
||||
coord_t y = FH + 1;
|
||||
uint8_t line = (menuVerticalPosition >= sentModuleChannels(g_moduleIdx) ? 2 : 0);
|
||||
uint8_t ch = (menuVerticalPosition >= 8 ? 8 : 0) + line;
|
||||
|
||||
// Channels
|
||||
for (; line < 8; line++) {
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.failsafeChannels[ch];
|
||||
|
||||
// Channel
|
||||
putsChn(x+1, y, ch+1, SMLSIZE);
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode > 0) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.failsafeChannels[ch], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const coord_t xValue = x+LCD_W-4-wbar;
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
|
||||
#else
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
|
||||
lcdDrawRect(x+LCD_W-3-wbar, y, wbar+1, 6);
|
||||
#endif
|
||||
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar/2 + lim/2) / lim, wbar/2);
|
||||
const uint8_t lenFailsafe = limit<uint8_t>(1, (abs(failsafeValue) * wbar/2 + lim/2) / lim, wbar/2);
|
||||
const coord_t xChannel = (channelValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenChannel;
|
||||
const coord_t xFailsafe = (failsafeValue>0) ? x+LCD_W-3-wbar/2 : x+LCD_W-2-wbar/2-lenFailsafe;
|
||||
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
|
||||
|
||||
y += FH - 1;
|
||||
|
||||
if (++ch >= sentModuleChannels(g_moduleIdx))
|
||||
break;
|
||||
}
|
||||
|
||||
if (menuVerticalPosition >= sentModuleChannels(g_moduleIdx)) {
|
||||
// Outputs => Failsafe
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ enum MenuModelFlightModeItems {
|
||||
IF_ROTARY_ENCODERS(ITEM_MODEL_FLIGHT_MODE_ROTARY_ENCODERS)
|
||||
ITEM_MODEL_FLIGHT_MODE_FADE_IN,
|
||||
ITEM_MODEL_FLIGHT_MODE_FADE_OUT,
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
#if defined(GVARS)
|
||||
ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV1,
|
||||
ITEM_MODEL_FLIGHT_MODE_GV2,
|
||||
@@ -87,7 +87,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
int8_t sub = menuVerticalPosition;
|
||||
int8_t editMode = s_editMode;
|
||||
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
#if defined(GVARS)
|
||||
if (s_currIdx == 0 && sub>=ITEM_MODEL_FLIGHT_MODE_SWITCH) sub += VERTICAL_SHIFT;
|
||||
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
@@ -126,7 +126,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_ROTARY_ENCODER);
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode(MIXES_2ND_COLUMN+(t*FW), y, s_currIdx, t, menuHorizontalPosition==t ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==t && ((editMode>0) || p1valdiff)) {
|
||||
if (attr && menuHorizontalPosition == t && editMode > 0) {
|
||||
int16_t v = flightModeAddress(s_currIdx)->rotaryEncoders[t];
|
||||
if (v < ROTARY_ENCODER_MAX) v = ROTARY_ENCODER_MAX;
|
||||
v = checkIncDec(event, v, ROTARY_ENCODER_MAX, ROTARY_ENCODER_MAX+MAX_FLIGHT_MODES-1, EE_MODEL);
|
||||
@@ -147,7 +147,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
fm->fadeOut = EDIT_DELAY(0, y, event, attr, STR_FADEOUT, fm->fadeOut);
|
||||
break;
|
||||
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
#if defined(GVARS)
|
||||
case ITEM_MODEL_FLIGHT_MODE_GVARS_LABEL:
|
||||
lcdDrawTextAlignedLeft(y, STR_GLOBAL_VARS);
|
||||
break;
|
||||
@@ -175,7 +175,7 @@ void menuModelFlightModeOne(event_t event)
|
||||
else {
|
||||
lcdDrawText(9*FW, y, STR_OWN, posHorz==1 ? attr : 0);
|
||||
}
|
||||
if (attr && s_currIdx>0 && posHorz==1 && (editMode>0 || p1valdiff)) {
|
||||
if (attr && s_currIdx>0 && posHorz==1 && editMode > 0) {
|
||||
if (v < GVAR_MAX) v = GVAR_MAX;
|
||||
v = checkIncDec(event, v, GVAR_MAX, GVAR_MAX+MAX_FLIGHT_MODES-1, EE_MODEL);
|
||||
if (checkIncDec_Ret) {
|
||||
|
||||
@@ -524,7 +524,6 @@ void menuModelMixOne(event_t event)
|
||||
#define MIX_LINE_SWITCH_POS 16*FW
|
||||
#define MIX_LINE_DELAY_POS 19*FW+7
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onExpoMixMenu(const char *result)
|
||||
{
|
||||
bool expo = (menuHandlers[menuLevel] == menuModelExposAll);
|
||||
@@ -551,7 +550,6 @@ void onExpoMixMenu(const char *result)
|
||||
deleteExpoMix(expo, s_currIdx);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void displayMixInfos(coord_t y, MixData *md)
|
||||
{
|
||||
@@ -672,7 +670,6 @@ void menuModelExpoMix(uint8_t expo, event_t event)
|
||||
}
|
||||
else {
|
||||
if (s_copyMode) s_currCh = 0;
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
if (s_currCh) {
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
@@ -691,15 +688,6 @@ void menuModelExpoMix(uint8_t expo, event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
POPUP_MENU_START(onExpoMixMenu);
|
||||
}
|
||||
#else
|
||||
if (s_currCh) {
|
||||
if (reachExpoMixCountLimit(expo)) break;
|
||||
insertExpoMix(expo, s_currIdx);
|
||||
}
|
||||
pushMenu(expo ? menuModelExpoOne : menuModelMixOne);
|
||||
s_copyMode = 0;
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -234,8 +234,7 @@ void onLogicalSwitchesMenu(const char *result)
|
||||
s_currIdx = sub;
|
||||
pushMenu(menuModelLogicalSwitchOne);
|
||||
}
|
||||
|
||||
if (result == STR_COPY) {
|
||||
else if (result == STR_COPY) {
|
||||
clipboard.type = CLIPBOARD_TYPE_CUSTOM_SWITCH;
|
||||
clipboard.data.csw = *cs;
|
||||
}
|
||||
@@ -269,8 +268,8 @@ void menuModelLogicalSwitches(event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_PASTE);
|
||||
if (cs->func || cs->v1 || cs->v2 || cs->delay || cs->duration || cs->andsw)
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
if(popupMenuNoItems == 1) {
|
||||
popupMenuNoItems = 0;
|
||||
if(popupMenuItemsCount == 1) {
|
||||
popupMenuItemsCount = 0;
|
||||
s_currIdx = sub;
|
||||
pushMenu(menuModelLogicalSwitchOne);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include <math.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN (11*FW)
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
void onTxOptionsUpdateConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = 2;
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.timeout = 0;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_MODULE_SETTINGS;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
ITEM_MODULE_SETTINGS_RF_PROTOCOL,
|
||||
ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA,
|
||||
ITEM_MODULE_SETTINGS_POWER,
|
||||
ITEM_MODULE_SETTINGS_COUNT
|
||||
};
|
||||
|
||||
/* Options order:
|
||||
* - RF Protocol
|
||||
* - External antenna
|
||||
* - Power
|
||||
*/
|
||||
const uint8_t moduleOptions[] = {
|
||||
0b11111111, // None = display all options
|
||||
0b11111011, // XJT
|
||||
0b11111011, // IXJT
|
||||
0b11111011, // IXJT-PRO
|
||||
0b11111011, // IXJT-S
|
||||
0b11111100, // R9M
|
||||
0b11111100, // R9MLite
|
||||
0b11111100, // R9MLite-PRO
|
||||
};
|
||||
|
||||
#define IF_MODULE_OPTIONS(option, count) uint8_t((moduleOptions[modelId] & (1 << option)) ? count : HIDDEN_ROW)
|
||||
|
||||
void drawPower(coord_t x, coord_t y, int8_t dBm)
|
||||
{
|
||||
float power_W_PREC1 = pow(10.0, (dBm - 30.0) / 10.0) * 10;
|
||||
if (dBm >= 30) {
|
||||
lcdDrawNumber(x, y, power_W_PREC1, PREC1);
|
||||
lcdDrawText(lcdNextPos, y, "W");
|
||||
}
|
||||
else if (dBm < 10) {
|
||||
uint16_t power_MW_PREC1 = round(power_W_PREC1 * 1000);
|
||||
lcdDrawNumber(x, y, power_MW_PREC1, PREC1);
|
||||
lcdDrawText(lcdNextPos, y, "mW");
|
||||
}
|
||||
else {
|
||||
uint16_t power_MW = round(power_W_PREC1 * 100);
|
||||
if (power_MW >= 50) {
|
||||
power_MW = (power_MW / 5) * 5;
|
||||
lcdDrawNumber(x, y, power_MW);
|
||||
lcdDrawText(lcdNextPos, y, "mW");
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, power_MW);
|
||||
lcdDrawText(lcdNextPos, y, "mW");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isPowerAvailable(int value)
|
||||
{
|
||||
// uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
|
||||
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
|
||||
|
||||
return (value == 10 /* 10 mW */ ||
|
||||
value == 14 /* 25 mW */ ||
|
||||
value == 20 /* 100 mW */ ||
|
||||
value == 23 /* 200 mW */ ||
|
||||
value == 27 /* 500 mW */ ||
|
||||
value == 30 /* 1000 mW */);
|
||||
}
|
||||
|
||||
void menuModelModuleOptions(event_t event)
|
||||
{
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
|
||||
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
|
||||
|
||||
SUBMENU_NOTITLE(ITEM_MODULE_SETTINGS_COUNT, {
|
||||
IF_MODULE_OPTIONS(0, 0),
|
||||
IF_MODULE_OPTIONS(1, 0),
|
||||
IF_MODULE_OPTIONS(2, 0),
|
||||
});
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.state = PXX2_SETTINGS_OK;
|
||||
#else
|
||||
// no need to initialize reusableBuffer.hardwareAndSettings.moduleSettings.state to PXX2_HARDWARE_INFO
|
||||
reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].current = PXX2_HW_INFO_TX_ID;
|
||||
reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].maximum = PXX2_HW_INFO_TX_ID;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_GET_HARDWARE_INFO;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_HARDWARE_INFO && moduleSettings[g_moduleIdx].mode == MODULE_MODE_NORMAL) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.state = PXX2_SETTINGS_READ;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_MODULE_SETTINGS;
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.dirty) {
|
||||
abortPopMenu();
|
||||
POPUP_CONFIRMATION("Update TX options?", onTxOptionsUpdateConfirm);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.moduleSettings.dirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = 0;
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.timeout = 0;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_MODULE_SETTINGS;
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.dirty == 2 && reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_SETTINGS_OK) {
|
||||
popMenu();
|
||||
}
|
||||
|
||||
if (modelId != 0 && mstate_tab[menuVerticalPosition] == HIDDEN_ROW) {
|
||||
menuVerticalPosition = 0;
|
||||
while (menuVerticalPosition < ITEM_MODULE_SETTINGS_COUNT && mstate_tab[menuVerticalPosition] == HIDDEN_ROW) {
|
||||
++menuVerticalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
lcdDrawTextAlignedLeft(0, "Module options");
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_SETTINGS_OK) {
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
for (int j=0; j<=i; ++j) {
|
||||
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
switch (i) {
|
||||
case ITEM_MODULE_SETTINGS_RF_PROTOCOL:
|
||||
lcdDrawText(0, y, "RF Protocol");
|
||||
lcdDrawTextAtIndex(RECEIVER_OPTIONS_2ND_COLUMN, y, STR_XJT_PROTOCOLS, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol + 1, attr);
|
||||
if (attr) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.rfProtocol, RF_PROTO_X16, RF_PROTO_LAST, 0, nullptr);
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA:
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna = editCheckBox(reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna, RECEIVER_OPTIONS_2ND_COLUMN, y, "Ext. antenna", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODULE_SETTINGS_POWER:
|
||||
lcdDrawText(0, y, "Power");
|
||||
lcdDrawNumber(RECEIVER_OPTIONS_2ND_COLUMN, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, attr);
|
||||
lcdDrawText(lcdNextPos, y, "dBm(");
|
||||
drawPower(lcdNextPos, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower);
|
||||
lcdDrawText(lcdNextPos, y, ")");
|
||||
if (attr) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.txPower = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, 0, 30, 0, &isPowerAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.dirty = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawText(4 * FW, 4 * FH, "Waiting for TX...");
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void menuModelLimitsOne(event_t event)
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
uint8_t attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff)) ;
|
||||
uint8_t active = (attr && s_editMode > 0) ;
|
||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||
|
||||
switch (i) {
|
||||
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN 80
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
extern void drawReceiverName(uint8_t x, uint8_t y, uint8_t receiverSlot);
|
||||
|
||||
void onRxOptionsUpdateConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = 2;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.timeout = 0;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
ITEM_RECEIVER_TELEMETRY,
|
||||
ITEM_RECEIVER_PWM_RATE,
|
||||
ITEM_RECEIVER_PINMAP_FIRST
|
||||
};
|
||||
|
||||
void menuModelReceiverOptions(event_t event)
|
||||
{
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
uint8_t wbar = LCD_W / 2 - 20;
|
||||
auto outputsCount = min<uint8_t>(16, reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount);
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(ITEM_RECEIVER_PINMAP_FIRST + outputsCount);
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_OK;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount = 8;
|
||||
#else
|
||||
// no need to initialize reusableBuffer.hardwareAndSettings.receiverSettings.state to PXX2_HARDWARE_INFO
|
||||
reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].current = reusableBuffer.hardwareAndSettings.receiverSettings.receiverId;
|
||||
reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].maximum = reusableBuffer.hardwareAndSettings.receiverSettings.receiverId;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_GET_HARDWARE_INFO;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_HARDWARE_INFO && moduleSettings[g_moduleIdx].mode == MODULE_MODE_NORMAL) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_READ;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.dirty) {
|
||||
abortPopMenu();
|
||||
POPUP_CONFIRMATION("Update RX options?", onRxOptionsUpdateConfirm);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.receiverSettings.dirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = 0;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.timeout = 0;
|
||||
moduleSettings[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.dirty == 2 && reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_SETTINGS_OK) {
|
||||
popMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
lcdDrawTextAlignedLeft(0, STR_RECEIVER_OPTIONS);
|
||||
drawReceiverName(FW * 13, 0, reusableBuffer.hardwareAndSettings.receiverSettings.receiverId);
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_SETTINGS_OK) {
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
switch (i) {
|
||||
case ITEM_RECEIVER_TELEMETRY:
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.telemetryDisabled = editCheckBox(reusableBuffer.hardwareAndSettings.receiverSettings.telemetryDisabled, RECEIVER_OPTIONS_2ND_COLUMN, y, "Telem. disabled", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_RECEIVER_PWM_RATE:
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.pwmRate = editCheckBox(reusableBuffer.hardwareAndSettings.receiverSettings.pwmRate, RECEIVER_OPTIONS_2ND_COLUMN, y, "9ms PWM", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Pin
|
||||
{
|
||||
uint8_t pin = i - ITEM_RECEIVER_PINMAP_FIRST;
|
||||
uint8_t channel = reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin];
|
||||
int32_t channelValue = channelOutputs[channel];
|
||||
lcdDrawText(0, y, "Pin");
|
||||
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1);
|
||||
putsChn(7 * FW, y, channel + 1, attr);
|
||||
|
||||
// Channel
|
||||
if (attr) {
|
||||
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx) - 1);
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin] = channel;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Bargraph
|
||||
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
|
||||
lcdDrawRect(LCD_W - 3 - wbar, y + 1, wbar + 1, 4);
|
||||
#endif
|
||||
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar / 2 + lim / 2) / lim, wbar / 2);
|
||||
const coord_t xChannel = (channelValue > 0) ? LCD_W - 3 - wbar / 2 : LCD_W - 2 - wbar / 2 - lenChannel;
|
||||
lcdDrawHorizontalLine(xChannel, y + 2, lenChannel, SOLID, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawText(4 * FW, 4 * FH, "Waiting for RX...");
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#define MODELSEL_W LCD_W
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onModelSelectMenu(const char * result)
|
||||
{
|
||||
int8_t sub = menuVerticalPosition;
|
||||
@@ -53,11 +52,11 @@ void onModelSelectMenu(const char * result)
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, nullptr);
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file on SD to restore
|
||||
storageCheck(true);
|
||||
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
|
||||
@@ -67,7 +66,6 @@ void onModelSelectMenu(const char * result)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuModelSelect(event_t event)
|
||||
{
|
||||
@@ -89,12 +87,6 @@ void menuModelSelect(event_t event)
|
||||
|
||||
check_submenu_simple(_event_, MAX_MODELS - HEADER_LINE);
|
||||
|
||||
#if defined(NAVIGATION_POT2)
|
||||
if (event==0 && p2valdiff<0) {
|
||||
event = EVT_KEY_FIRST(KEY_RIGHT);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (s_editMode > 0) s_editMode = 0;
|
||||
|
||||
|
||||
@@ -112,7 +104,7 @@ void menuModelSelect(event_t event)
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, nullptr);
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
}
|
||||
else {
|
||||
@@ -200,7 +192,6 @@ void menuModelSelect(event_t event)
|
||||
else if (event == EVT_KEY_LONG(KEY_ENTER) || IS_ROTARY_BREAK(event)) {
|
||||
s_copyMode = 0;
|
||||
killEvents(event);
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
if (g_eeGeneral.currModel != sub) {
|
||||
if (eeModelExists(sub)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_SELECT_MODEL);
|
||||
@@ -224,11 +215,6 @@ void menuModelSelect(event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_MOVE_MODEL);
|
||||
}
|
||||
POPUP_MENU_START(onModelSelectMenu);
|
||||
#else
|
||||
if (g_eeGeneral.currModel != sub) {
|
||||
selectModel(sub);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (eeModelExists(sub)) {
|
||||
s_copyMode = (s_copyMode == COPY_MODE ? MOVE_MODE : COPY_MODE);
|
||||
@@ -237,7 +223,7 @@ void menuModelSelect(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
case EVT_KEY_LONG(KEY_PAGE):
|
||||
chainMenu(menuTabModel[DIM(menuTabModel)-1]);
|
||||
killEvents(event);
|
||||
@@ -269,7 +255,7 @@ void menuModelSelect(event_t event)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
case EVT_ROTARY_LEFT:
|
||||
case EVT_ROTARY_RIGHT:
|
||||
#endif
|
||||
@@ -310,7 +296,7 @@ void menuModelSelect(event_t event)
|
||||
lcdDrawNumber(17*FW, 0, reusableBuffer.modelsel.eepromfree, RIGHT);
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), 0);
|
||||
#elif defined(ROTARY_ENCODER_NAVIGATION)
|
||||
drawScreenIndex(MENU_MODEL_SELECT, DIM(menuTabModel), (sub == g_eeGeneral.currModel) ? ((IS_ROTARY_ENCODER_NAVIGATION_ENABLE() && s_editMode < 0) ? INVERS|BLINK : INVERS) : 0);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -57,12 +57,12 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
strcpy(directory, SOUNDS_PATH);
|
||||
strncpy(directory+SOUNDS_PATH_LNG_OFS, currentLanguagePack->id, 2);
|
||||
}
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), NULL)) {
|
||||
if (!sdListFiles(directory, func==FUNC_PLAY_SCRIPT ? SCRIPTS_EXT : SOUNDS_EXT, sizeof(cfn->play.name), nullptr)) {
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
POPUP_MENU_UNSET_BSS_FLAG();
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file in the list
|
||||
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
|
||||
storageDirty(eeFlags);
|
||||
@@ -96,7 +96,7 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
CFN_PARAM(cfn) = 0;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
onSourceLongEnterPress(result);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
uint8_t func = CFN_FUNC(cfn);
|
||||
for (uint8_t j=0; j<5; j++) {
|
||||
uint8_t attr = ((sub==k && menuHorizontalPosition==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
|
||||
uint8_t active = (attr && s_editMode > 0);
|
||||
switch (j) {
|
||||
case 0:
|
||||
if (sub==k && menuHorizontalPosition < 1 && CFN_SWITCH(cfn) == SWSRC_NONE) {
|
||||
@@ -390,7 +390,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
|
||||
if (func == FUNC_ADJUST_GVAR && attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
@@ -409,7 +409,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
#else
|
||||
if (active) {
|
||||
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
|
||||
#endif // PCBX7
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -437,7 +437,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
if (sub==k && menuHorizontalPosition<0 && CFN_SWITCH(cfn)) {
|
||||
lcdInvertLine(i+1);
|
||||
}
|
||||
@@ -447,7 +447,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
|
||||
void menuModelSpecialFunctions(event_t event)
|
||||
{
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
const CustomFunctionData * cfn = &g_model.customFn[menuVerticalPosition];
|
||||
if (!CFN_SWITCH(cfn) && menuHorizontalPosition < 0 && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
menuHorizontalPosition = 0;
|
||||
@@ -457,7 +457,7 @@ void menuModelSpecialFunctions(event_t event)
|
||||
|
||||
menuSpecialFunctions(event, g_model.customFn, &modelFunctionsContext);
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
if (!CFN_SWITCH(cfn) && menuHorizontalPosition == 0 && s_editMode <= 0) {
|
||||
menuHorizontalPosition = -1;
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_DOWN):
|
||||
case EVT_KEY_BREAK(KEY_UP):
|
||||
#if !defined(PCBX7)
|
||||
#if !defined(PCBX7) && !defined(PCBX3)
|
||||
case EVT_KEY_BREAK(KEY_LEFT):
|
||||
case EVT_KEY_BREAK(KEY_RIGHT):
|
||||
#endif
|
||||
@@ -531,7 +531,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
s_editMode = 0;
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE, nullptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -543,7 +543,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_MULTIMODULE &&
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MM_RF_PROTO_FS_AFHDS2A)
|
||||
lcdDrawTextAlignedLeft(y, "RSNR");
|
||||
else
|
||||
@@ -588,7 +588,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
}
|
||||
lcdDrawNumber(TELEM_COL2, y, -10+g_model.frsky.varioMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+4*FW, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|LEFT);
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (attr && s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioMin, -7, 7);
|
||||
@@ -605,7 +605,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
lcdDrawNumber(TELEM_COL2, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || menuHorizontalPosition==0) ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawNumber(TELEM_COL2+4*FW, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0)|PREC1|LEFT);
|
||||
lcdDrawTextAtIndex(TELEM_COL2+8*FW, y, STR_VVARIOCENTER, g_model.frsky.varioCenterSilent, (menuHorizontalPosition==2 ? attr : 0));
|
||||
if (attr && (s_editMode>0 || p1valdiff)) {
|
||||
if (attr && s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.frsky.varioCenterMin, -16, 5+min<int8_t>(10, g_model.frsky.varioCenterMax+5));
|
||||
|
||||
@@ -33,7 +33,7 @@ void menuModelTemplates(event_t event)
|
||||
AUDIO_WARNING2();
|
||||
}
|
||||
if (event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
POPUP_CONFIRMATION(STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES));
|
||||
POPUP_CONFIRMATION(STR_VTEMPLATES+1 + (sub * LEN2_VTEMPLATES), nullptr);
|
||||
s_editMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -20,33 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const char * warningText = NULL;
|
||||
const char * warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
|
||||
void drawMessageBox()
|
||||
{
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, warningText, WARNING_LINE_LEN);
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void showMessageBox(const char * str)
|
||||
{
|
||||
warningText = str;
|
||||
drawMessageBox();
|
||||
warningText = NULL;
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const unsigned char ASTERISK_BITMAP[] = {
|
||||
#include "asterisk.lbm"
|
||||
};
|
||||
@@ -65,54 +38,16 @@ void drawAlertBox(const char * title, const char * text, const char * action)
|
||||
lcdDrawText(MESSAGE_LCD_OFFSET, 0, title, DBLSIZE);
|
||||
lcdDrawText(MESSAGE_LCD_OFFSET, 2*FH, STR_WARNING, DBLSIZE);
|
||||
#endif
|
||||
|
||||
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, 32);
|
||||
|
||||
if (text) {
|
||||
lcdDrawTextAlignedLeft(5*FH, text);
|
||||
}
|
||||
|
||||
if (action) {
|
||||
lcdDrawTextAlignedLeft(7*FH, action);
|
||||
}
|
||||
|
||||
|
||||
#undef MESSAGE_LCD_OFFSET
|
||||
}
|
||||
|
||||
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound)
|
||||
{
|
||||
drawAlertBox(title, text, action);
|
||||
|
||||
AUDIO_ERROR_MESSAGE(sound);
|
||||
|
||||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void runPopupWarning(event_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
drawMessageBox();
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
warningResult = true;
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
default:
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,25 +21,20 @@
|
||||
#ifndef _POPUPS_H_
|
||||
#define _POPUPS_H_
|
||||
|
||||
#define MENU_X 10
|
||||
#define MENU_Y 16
|
||||
#define MENU_W LCD_W-(2*MENU_X)
|
||||
#include <keys.h>
|
||||
|
||||
#define MESSAGEBOX_X 10
|
||||
#define MESSAGEBOX_Y 16
|
||||
#define MESSAGEBOX_W (LCD_W - 19)
|
||||
|
||||
#define MENU_X MESSAGEBOX_X
|
||||
#define MENU_Y MESSAGEBOX_Y
|
||||
#define MENU_W MESSAGEBOX_W
|
||||
|
||||
#define WARNING_LINE_LEN 20
|
||||
#define WARNING_LINE_X 16
|
||||
#define WARNING_LINE_Y 3*FH
|
||||
|
||||
void drawMessageBox();
|
||||
void showMessageBox(const char * title);
|
||||
void runPopupWarning(event_t event);
|
||||
|
||||
#define DRAW_MESSAGE_BOX(title) (warningText = title, drawMessageBox(), warningText = NULL)
|
||||
|
||||
extern void (*popupFunc)(event_t event);
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#if !defined(GUI)
|
||||
#define DISPLAY_WARNING(...)
|
||||
#define POPUP_WARNING(...)
|
||||
@@ -49,9 +44,10 @@ extern uint8_t warningInfoFlags;
|
||||
#define SET_WARNING_INFO(...)
|
||||
#else
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = nullptr, popupFunc = runPopupWarning)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define POPUP_CONFIRMATION(s, func) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = nullptr, popupFunc = runPopupWarning, popupMenuHandler = func)
|
||||
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
#endif
|
||||
@@ -62,28 +58,19 @@ extern uint8_t warningInfoFlags;
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s)
|
||||
#endif
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuNoItems ? s : popupMenuNoItems) : 0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
#define POPUP_MENU_SET_BSS_FLAG()
|
||||
#define POPUP_MENU_UNSET_BSS_FLAG()
|
||||
enum {
|
||||
MENU_OFFSET_INTERNAL,
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
extern uint8_t s_menu_item;
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount) : 0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
#define POPUP_MENU_SET_BSS_FLAG()
|
||||
#define POPUP_MENU_UNSET_BSS_FLAG()
|
||||
enum {
|
||||
MENU_OFFSET_INTERNAL,
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
extern uint16_t popupMenuOffset;
|
||||
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
const char * runPopupMenu(event_t event);
|
||||
extern void (*popupMenuHandler)(const char * result);
|
||||
#endif
|
||||
#include "../common/stdlcd/popups.h"
|
||||
|
||||
#endif // _POPUPS_H_
|
||||
|
||||
@@ -67,48 +67,6 @@ void menuRadioDiagAnalogs(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH + 2, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+FW, MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH + 2, getBatteryVoltage(), (menuVerticalPosition==HEADER_LINE ? INVERS | (s_editMode > 0 ? BLINK : 0) : 0) | PREC2 | LEFT);
|
||||
#elif defined(PCBSKY9X)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB);
|
||||
static int32_t adcBatt;
|
||||
// TODO board.cpp
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT+1+4*FH, batCalV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, STR_BATT_CALIB);
|
||||
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, g_vbat100mV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#endif
|
||||
|
||||
if (menuVerticalPosition == HEADER_LINE) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
}
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
lcdDrawTextAlignedLeft(6*FH+1, STR_CURRENT_CALIB);
|
||||
drawValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, 6*FH+1, getCurrent(), UNIT_MILLIAMPS, (menuVerticalPosition==2 ? INVERS : 0)) ;
|
||||
if (menuVerticalPosition==2) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
#define TEMP_CALIB_POS 7*FH+1
|
||||
#define TEMP_CALIB_MENU_POS 3
|
||||
#else
|
||||
#define TEMP_CALIB_POS 6*FH+1
|
||||
#define TEMP_CALIB_MENU_POS 2
|
||||
#endif
|
||||
|
||||
lcdDrawTextAlignedLeft(TEMP_CALIB_POS, STR_TEMP_CALIB);
|
||||
drawValueWithUnit(LEN_CALIB_FIELDS*FW+4*FW, TEMP_CALIB_POS, getTemperature(), UNIT_TEMPERATURE, (menuVerticalPosition==TEMP_CALIB_MENU_POS ? INVERS : 0)) ;
|
||||
if (menuVerticalPosition==TEMP_CALIB_MENU_POS)
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
#endif
|
||||
|
||||
#if (NUM_PWMSTICKS > 0) && !defined(SIMU)
|
||||
lcdDrawTextAlignedLeft(7*FH, STICKS_PWM_ENABLED() ? "Sticks: PWM" : "Sticks: ANA");
|
||||
#endif
|
||||
|
||||
@@ -50,7 +50,7 @@ void menuRadioDiagKeys(event_t event)
|
||||
}
|
||||
|
||||
if (i < TRM_BASE) {
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
y = MENU_HEADER_HEIGHT + FH + FH*i;
|
||||
if (i >= 2) {
|
||||
// hide PLUS and MINUS virtual buttons
|
||||
|
||||
@@ -103,17 +103,33 @@ enum MenuRadioHardwareItems {
|
||||
ITEM_RADIO_HARDWARE_STICK4,
|
||||
ITEM_RADIO_HARDWARE_LABEL_POTS,
|
||||
ITEM_RADIO_HARDWARE_POT1,
|
||||
#if !defined(PCBX3)
|
||||
ITEM_RADIO_HARDWARE_POT2,
|
||||
#endif
|
||||
ITEM_RADIO_HARDWARE_LABEL_SWITCHES,
|
||||
ITEM_RADIO_HARDWARE_SA,
|
||||
ITEM_RADIO_HARDWARE_SB,
|
||||
ITEM_RADIO_HARDWARE_SC,
|
||||
ITEM_RADIO_HARDWARE_SD,
|
||||
#if NUM_SWITCHES > 4
|
||||
#if NUM_SWITCHES >= 5
|
||||
ITEM_RADIO_HARDWARE_SF,
|
||||
#endif
|
||||
#if NUM_SWITCHES >= 6
|
||||
ITEM_RADIO_HARDWARE_SH,
|
||||
#endif
|
||||
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
|
||||
#if defined(STM32)
|
||||
ITEM_RADIO_HARDWARE_RTC_BATTERY,
|
||||
#endif
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
ITEM_RADIO_HARDWARE_CAPACITY_CALIB,
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
ITEM_RADIO_HARDWARE_TEMPERATURE_CALIB,
|
||||
#endif
|
||||
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
|
||||
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
|
||||
#endif
|
||||
#if defined(BLUETOOTH)
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
|
||||
@@ -126,25 +142,38 @@ enum MenuRadioHardwareItems {
|
||||
ITEM_RADIO_HARDWARE_MAX
|
||||
};
|
||||
|
||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
|
||||
#if NUM_SWITCHES > 4
|
||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#if defined(PCBX3)
|
||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1
|
||||
#else
|
||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#endif
|
||||
|
||||
#if NUM_SWITCHES == 6
|
||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#elif NUM_SWITCHES == 5
|
||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#elif NUM_SWITCHES == 4
|
||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define BLUETOOTH_ROWS uint8_t(IS_BLUETOOTH_CHIP_PRESENT() ? 0 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY ? -1 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#if defined(PCBX3)
|
||||
#define BLUETOOTH_ROWS
|
||||
#elif defined(PCBTARANIS)
|
||||
#define BLUETOOTH_ROWS uint8_t(IS_BLUETOOTH_CHIP_PRESENT() ? 0 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY ? -1 : HIDDEN_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#elif defined(BLUETOOTH)
|
||||
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : -1), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#define BLUETOOTH_ROWS 0, uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : READONLY_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : READONLY_ROW), uint8_t(g_eeGeneral.bluetoothMode == BLUETOOTH_OFF ? HIDDEN_ROW : 0),
|
||||
#else
|
||||
#define BLUETOOTH_ROWS
|
||||
#define BLUETOOTH_ROWS
|
||||
#endif
|
||||
#if defined(PCBXLITE)
|
||||
#define SWITCH_TYPE_MAX(sw) (SWITCH_3POS)
|
||||
|
||||
#if defined(PCBX3)
|
||||
#define SWITCH_TYPE_MAX(sw) (sw == MIXSRC_SD-MIXSRC_FIRST_SWITCH ? SWITCH_2POS : SWITCH_3POS)
|
||||
#elif defined(PCBXLITES)
|
||||
#define SWITCH_TYPE_MAX(sw) (sw >= MIXSRC_SE-MIXSRC_FIRST_SWITCH ? SWITCH_2POS : SWITCH_3POS)
|
||||
#elif defined(PCBXLITE)
|
||||
#define SWITCH_TYPE_MAX(sw) (SWITCH_3POS)
|
||||
#else
|
||||
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
||||
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
||||
#endif
|
||||
|
||||
#define HW_SETTINGS_COLUMN1 30
|
||||
@@ -152,16 +181,44 @@ enum MenuRadioHardwareItems {
|
||||
|
||||
void menuRadioHardware(event_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, HEADER_LINE+ITEM_RADIO_HARDWARE_MAX, { HEADER_LINE_COLUMNS 0, 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0/*max bauds*/, BLUETOOTH_ROWS 0/*jitter filter*/, 1 /* debugs */ });
|
||||
MENU(STR_HARDWARE, menuTabGeneral, MENU_RADIO_HARDWARE, HEADER_LINE + ITEM_RADIO_HARDWARE_MAX, {
|
||||
HEADER_LINE_COLUMNS
|
||||
0 /* calibration button */,
|
||||
0 /* stick 1 */,
|
||||
0 /* stick 2 */,
|
||||
0 /* stick 3 */,
|
||||
0 /* stick 4 */,
|
||||
LABEL(Pots),
|
||||
POTS_ROWS,
|
||||
LABEL(Switches),
|
||||
SWITCHES_ROWS,
|
||||
0 /* battery calib */,
|
||||
#if defined(STM32)
|
||||
READONLY_ROW,
|
||||
#endif
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
0,
|
||||
#endif
|
||||
#if defined(PCBSKY9X)
|
||||
0,
|
||||
#endif
|
||||
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
|
||||
0 /* max bauds */,
|
||||
#endif
|
||||
BLUETOOTH_ROWS
|
||||
0 /* jitter filter */,
|
||||
1 /* debugs */,
|
||||
});
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i+menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW)
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
k++;
|
||||
}
|
||||
}
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
uint8_t attr = (sub == k ? blink : 0);
|
||||
@@ -186,7 +243,9 @@ void menuRadioHardware(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_HARDWARE_POT1:
|
||||
#if !defined(PCBX3)
|
||||
case ITEM_RADIO_HARDWARE_POT2:
|
||||
#endif
|
||||
{
|
||||
int idx = k - ITEM_RADIO_HARDWARE_POT1;
|
||||
uint8_t shift = (2*idx);
|
||||
@@ -211,8 +270,10 @@ void menuRadioHardware(event_t event)
|
||||
case ITEM_RADIO_HARDWARE_SB:
|
||||
case ITEM_RADIO_HARDWARE_SC:
|
||||
case ITEM_RADIO_HARDWARE_SD:
|
||||
#if NUM_SWITCHES > 4
|
||||
#if NUM_SWITCHES >= 5
|
||||
case ITEM_RADIO_HARDWARE_SF:
|
||||
#endif
|
||||
#if NUM_SWITCHES >= 6
|
||||
case ITEM_RADIO_HARDWARE_SH:
|
||||
#endif
|
||||
{
|
||||
@@ -231,6 +292,55 @@ void menuRadioHardware(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_RADIO_HARDWARE_BATTERY_CALIB:
|
||||
#if defined(PCBTARANIS)
|
||||
lcdDrawTextAlignedLeft(y, STR_BATT_CALIB);
|
||||
putsVolts(HW_SETTINGS_COLUMN2, y, getBatteryVoltage(), attr|PREC2|LEFT);
|
||||
#elif defined(PCBSKY9X)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+1+4*FH, STR_BATT_CALIB);
|
||||
static int32_t adcBatt;
|
||||
// TODO board.cpp
|
||||
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
|
||||
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.txVoltageCalibration)/128) * 4191;
|
||||
batCalV /= 55296;
|
||||
putsVolts(HW_SETTINGS_COLUMN2, y, batCalV, (menuVerticalPosition==HEADER_LINE ? INVERS : 0));
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT + 1 + (NUM_STICKS+NUM_POTS+NUM_SLIDERS+1)/2 * FH, STR_BATT_CALIB);
|
||||
putsVolts(HW_SETTINGS_COLUMN2, y, g_vbat100mV, attr|LEFT);
|
||||
#endif
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(STM32)
|
||||
case ITEM_RADIO_HARDWARE_RTC_BATTERY:
|
||||
lcdDrawTextAlignedLeft(y, "RTC Batt");
|
||||
putsVolts(HW_SETTINGS_COLUMN2, y, vbattRTC, PREC2|LEFT);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(TX_CAPACITY_MEASUREMENT)
|
||||
case ITEM_RADIO_HARDWARE_CAPACITY_CALIB:
|
||||
lcdDrawTextAlignedLeft(y, STR_CURRENT_CALIB);
|
||||
drawValueWithUnit(HW_SETTINGS_COLUMN2, y, getCurrent(), UNIT_MILLIAMPS, attr);
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.txCurrentCalibration, -49, 49);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_RADIO_HARDWARE_TEMPERATURE_CALIB:
|
||||
lcdDrawTextAlignedLeft(y, STR_TEMP_CALIB);
|
||||
drawValueWithUnit(HW_SETTINGS_COLUMN2, y, getTemperature(), UNIT_TEMPERATURE, attr) ;
|
||||
if (attr) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(CROSSFIRE) && SPORT_MAX_BAUDRATE < 400000
|
||||
case ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE:
|
||||
lcdDrawTextAlignedLeft(y, STR_MAXBAUDRATE);
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN2, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT);
|
||||
@@ -248,6 +358,7 @@ void menuRadioHardware(event_t event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
case ITEM_RADIO_HARDWARE_BLUETOOTH_MODE:
|
||||
@@ -289,7 +400,7 @@ void menuRadioHardware(event_t event)
|
||||
case ITEM_RADIO_HARDWARE_DEBUG:
|
||||
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
||||
lcdDrawText(HW_SETTINGS_COLUMN2, y, STR_ANALOGS_BTN, menuHorizontalPosition == 0 ? attr : 0);
|
||||
lcdDrawText(lcdLastRightPos + 2, y, STR_SWITCHES_BTN, menuHorizontalPosition == 1 ? attr : 0);
|
||||
lcdDrawText(lcdLastRightPos + 2, y, STR_KEYS_BTN, menuHorizontalPosition == 1 ? attr : 0);
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
if (menuHorizontalPosition == 0)
|
||||
pushMenu(menuRadioDiagAnalogs);
|
||||
|
||||
@@ -26,9 +26,9 @@ const unsigned char sticks[] = {
|
||||
#include "sticks.lbm"
|
||||
};
|
||||
|
||||
#define RADIO_SETUP_2ND_COLUMN (LCD_W-6*FW-3)
|
||||
#define RADIO_SETUP_2ND_COLUMN (LCD_W-7*FW-3)
|
||||
#define RADIO_SETUP_DATE_COLUMN (FW*15+7)
|
||||
#define RADIO_SETUP_TIME_COLUMN (FW*15+9)
|
||||
#define RADIO_SETUP_TIME_COLUMN (RADIO_SETUP_2ND_COLUMN + 2 * FWNUM)
|
||||
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
@@ -88,6 +88,9 @@ enum MenuRadioSetupItems {
|
||||
CASE_PWM_BACKLIGHT(ITEM_SETUP_BACKLIGHT_BRIGHTNESS_ON)
|
||||
ITEM_SETUP_FLASH_BEEP,
|
||||
CASE_SPLASH_PARAM(ITEM_SETUP_DISABLE_SPLASH)
|
||||
#if defined(PXX2)
|
||||
ITEM_RADIO_OWNER_ID,
|
||||
#endif
|
||||
CASE_GPS(ITEM_SETUP_TIMEZONE)
|
||||
ITEM_SETUP_ADJUST_RTC,
|
||||
CASE_GPS(ITEM_SETUP_GPSFORMAT)
|
||||
@@ -97,6 +100,7 @@ enum MenuRadioSetupItems {
|
||||
IF_FAI_CHOICE(ITEM_SETUP_FAI)
|
||||
ITEM_SETUP_SWITCHES_DELAY,
|
||||
CASE_STM32(ITEM_SETUP_USB_MODE)
|
||||
CASE_JACK_DETECT(ITEM_SETUP_JACK_MODE)
|
||||
ITEM_SETUP_RX_CHANNEL_ORD,
|
||||
ITEM_SETUP_STICK_MODE_LABELS,
|
||||
ITEM_SETUP_STICK_MODE,
|
||||
@@ -131,7 +135,38 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, HEADER_LINE+ITEM_SETUP_MAX, { HEADER_LINE_COLUMNS CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1) LABEL(SOUND), CASE_AUDIO(0) CASE_BUZZER(0) 0, 0, 0, 0, 0, CASE_AUDIO(0) CASE_VARIO(LABEL(VARIO)) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_VARIO(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) 0, LABEL(ALARMS), 0, CASE_CAPACITY(0) CASE_PCBSKY9X(0) 0, 0, 0, 0, IF_ROTARY_ENCODERS(0) LABEL(BACKLIGHT), 0, 0, 0, CASE_PWM_BACKLIGHT(0) CASE_PWM_BACKLIGHT(0) 0, CASE_SPLASH_PARAM(0) CASE_GPS(0) 0, CASE_GPS(0) CASE_PXX(0) 0, 0, IF_FAI_CHOICE(0) 0, CASE_STM32(0) 0, COL_TX_MODE, 0, 1/*to force edit mode*/});
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, MENU_RADIO_SETUP, HEADER_LINE+ITEM_SETUP_MAX, {
|
||||
HEADER_LINE_COLUMNS CASE_RTCLOCK(2) CASE_RTCLOCK(2) CASE_BATTGRAPH(1)
|
||||
LABEL(SOUND), CASE_AUDIO(0)
|
||||
CASE_BUZZER(0)
|
||||
0, 0, 0, 0, 0, CASE_AUDIO(0)
|
||||
CASE_VARIO(LABEL(VARIO))
|
||||
CASE_VARIO(0)
|
||||
CASE_VARIO(0)
|
||||
CASE_VARIO(0)
|
||||
CASE_VARIO(0)
|
||||
CASE_HAPTIC(LABEL(HAPTIC))
|
||||
CASE_HAPTIC(0)
|
||||
CASE_HAPTIC(0)
|
||||
CASE_HAPTIC(0)
|
||||
0, LABEL(ALARMS), 0, CASE_CAPACITY(0)
|
||||
CASE_PCBSKY9X(0)
|
||||
0, 0, 0, 0, IF_ROTARY_ENCODERS(0)
|
||||
LABEL(BACKLIGHT), 0, 0, 0, CASE_PWM_BACKLIGHT(0)
|
||||
CASE_PWM_BACKLIGHT(0)
|
||||
0,
|
||||
CASE_SPLASH_PARAM(0)
|
||||
#if defined(PXX2)
|
||||
0 /* owner registration ID */,
|
||||
#endif
|
||||
CASE_GPS(0)
|
||||
0, CASE_GPS(0)
|
||||
CASE_PXX(0)
|
||||
0, 0, IF_FAI_CHOICE(0)
|
||||
0,
|
||||
CASE_STM32(0) // USB mode
|
||||
CASE_JACK_DETECT(0) // Jack mode
|
||||
0, COL_TX_MODE, 0, 1/*to force edit mode*/});
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode;
|
||||
@@ -156,11 +191,11 @@ void menuRadioSetup(event_t event)
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN, y, t.tm_year+TM_YEAR_BASE, rowattr|RIGHT);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+3*FW-2, y, t.tm_mon+1, rowattr|LEADING0|RIGHT, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0);
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
@@ -169,7 +204,7 @@ void menuRadioSetup(event_t event)
|
||||
static const uint8_t dmon[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += dmon[t.tm_mon];
|
||||
lcdDrawNumber(RADIO_SETUP_DATE_COLUMN+6*FW-4, y, t.tm_mday, rowattr|LEADING0|RIGHT, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -187,15 +222,15 @@ void menuRadioSetup(event_t event)
|
||||
switch (j) {
|
||||
case 0:
|
||||
lcdDrawNumber(RADIO_SETUP_TIME_COLUMN, y, t.tm_hour, rowattr|LEADING0|RIGHT, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcdDrawNumber(RADIO_SETUP_TIME_COLUMN+3*FWNUM, y, t.tm_min, rowattr|LEADING0|RIGHT, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0);
|
||||
break;
|
||||
case 2:
|
||||
lcdDrawNumber(RADIO_SETUP_TIME_COLUMN+6*FWNUM, y, t.tm_sec, rowattr|LEADING0|RIGHT, 2);
|
||||
if (rowattr && (s_editMode>0 || p1valdiff)) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0);
|
||||
if (rowattr && s_editMode > 0) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -467,6 +502,12 @@ void menuRadioSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
case ITEM_RADIO_OWNER_ID:
|
||||
editSingleName(RADIO_SETUP_2ND_COLUMN, y, STR_OWNER_ID, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID, event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
case ITEM_SETUP_TIMEZONE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
|
||||
@@ -512,7 +553,7 @@ void menuRadioSetup(event_t event)
|
||||
if (g_eeGeneral.fai)
|
||||
POPUP_WARNING("FAI\001mode blocked!");
|
||||
else
|
||||
POPUP_CONFIRMATION("FAI mode?");
|
||||
POPUP_CONFIRMATION("FAI mode?", nullptr);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -524,11 +565,19 @@ void menuRadioSetup(event_t event)
|
||||
lcdDrawText(lcdLastRightPos, y, STR_MS, attr);
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.switchesDelay, -15, 100-15);
|
||||
break;
|
||||
|
||||
#if defined(STM32)
|
||||
case ITEM_SETUP_USB_MODE:
|
||||
g_eeGeneral.USBMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_USBMODE, STR_USBMODES, g_eeGeneral.USBMode, USB_UNSELECTED_MODE, USB_MAX_MODE, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(JACK_DETECT_GPIO)
|
||||
case ITEM_SETUP_JACK_MODE:
|
||||
g_eeGeneral.jackMode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_JACKMODE, STR_JACKMODES, g_eeGeneral.jackMode, JACK_UNSELECTED_MODE, JACK_MAX_MODE, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_RX_CHANNEL_ORD:
|
||||
lcdDrawTextAlignedLeft(y, STR_RXCHANNELORD); // RAET->AETR
|
||||
for (uint8_t i=1; i<=4; i++) {
|
||||
|
||||
@@ -18,8 +18,217 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
// TODO duplicated code
|
||||
#if defined(PCBX7) || defined(PCBX9E) || defined(PCBX3)
|
||||
#define EVT_KEY_NEXT_LINE EVT_ROTARY_RIGHT
|
||||
#define EVT_KEY_PREVIOUS_LINE EVT_ROTARY_LEFT
|
||||
#else
|
||||
#define EVT_KEY_NEXT_LINE EVT_KEY_FIRST(KEY_DOWN)
|
||||
#define EVT_KEY_PREVIOUS_LINE EVT_KEY_FIRST(KEY_UP)
|
||||
#endif
|
||||
|
||||
#define MENU_BODY_TOP (FH + 1)
|
||||
#define MENU_BODY_BOTTOM (LCD_H)
|
||||
|
||||
#if defined(PXX2)
|
||||
void drawPXX2Version(coord_t x, coord_t y, PXX2Version version)
|
||||
{
|
||||
lcdDrawNumber(x, y, version.major, LEFT);
|
||||
lcdDrawChar(lcdNextPos, y, '.');
|
||||
lcdDrawNumber(lcdNextPos, y, version.minor, LEFT);
|
||||
lcdDrawChar(lcdNextPos, y, '.');
|
||||
lcdDrawNumber(lcdNextPos, y, version.revision, LEFT);
|
||||
}
|
||||
|
||||
void drawPXX2FullVersion(coord_t x, coord_t y, PXX2Version hwVersion, PXX2Version swVersion)
|
||||
{
|
||||
drawPXX2Version(x, y, hwVersion);
|
||||
lcdDrawText(lcdNextPos, y, "/");
|
||||
drawPXX2Version(lcdNextPos, y, swVersion);
|
||||
}
|
||||
|
||||
static const char * const modulesModels[] = {
|
||||
"---",
|
||||
"XJT",
|
||||
"IXJT",
|
||||
"IXJT-PRO",
|
||||
"IXJT-S",
|
||||
"R9M",
|
||||
"R9MLite",
|
||||
"R9MLite-PRO",
|
||||
};
|
||||
|
||||
static const char * const receiversModels[] = {
|
||||
"---",
|
||||
"X8R",
|
||||
"RX8R",
|
||||
"RX8R-PRO",
|
||||
"RX6R",
|
||||
"RX4R",
|
||||
"G-RX8",
|
||||
"G-RX6",
|
||||
"X6R",
|
||||
"X4R",
|
||||
"X4R-SB",
|
||||
"XSR",
|
||||
"XSR-M",
|
||||
"RXSR",
|
||||
"S6R",
|
||||
"S8R",
|
||||
"XM",
|
||||
"XM+",
|
||||
"XMR",
|
||||
"R9",
|
||||
"R9-SLIM",
|
||||
"R9-SLIM+",
|
||||
"R9-MINI",
|
||||
"R9-MM",
|
||||
"R9-STAB",
|
||||
};
|
||||
|
||||
void menuRadioModulesVersion(event_t event)
|
||||
{
|
||||
if (menuEvent) {
|
||||
moduleSettings[INTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
moduleSettings[EXTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
return;
|
||||
}
|
||||
|
||||
TITLE("MODULES / RX VERSION");
|
||||
|
||||
if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
|
||||
// menuVerticalOffset = 0;
|
||||
|
||||
memclear(&reusableBuffer.hardwareAndSettings.modules, sizeof(reusableBuffer.hardwareAndSettings.modules));
|
||||
|
||||
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
|
||||
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].current = PXX2_HW_INFO_TX_ID;
|
||||
reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].maximum = MAX_RECEIVERS_PER_MODULE - 1;
|
||||
moduleSettings[INTERNAL_MODULE].mode = MODULE_MODE_GET_HARDWARE_INFO;
|
||||
}
|
||||
|
||||
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
|
||||
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].current = PXX2_HW_INFO_TX_ID;
|
||||
reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].maximum = MAX_RECEIVERS_PER_MODULE - 1;
|
||||
moduleSettings[EXTERNAL_MODULE].mode = MODULE_MODE_GET_HARDWARE_INFO;
|
||||
}
|
||||
|
||||
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms() + 1000 /* 10s*/;
|
||||
}
|
||||
|
||||
coord_t y = (FH + 1) - menuVerticalOffset * FH;
|
||||
|
||||
for (uint8_t module=0; module<NUM_MODULES; module++) {
|
||||
if (module == INTERNAL_MODULE) {
|
||||
if (!isModulePXX2(INTERNAL_MODULE) || !IS_INTERNAL_MODULE_ON()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (module == EXTERNAL_MODULE) {
|
||||
if (!isModulePXX2(EXTERNAL_MODULE) || !IS_EXTERNAL_MODULE_ON()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Label
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
if (module == INTERNAL_MODULE)
|
||||
lcdDrawTextAlignedLeft(y, "Internal module");
|
||||
else if (module == EXTERNAL_MODULE)
|
||||
lcdDrawTextAlignedLeft(y, "External module");
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Module model
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
lcdDrawText(INDENT_WIDTH, y, "Model");
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].information.modelID;
|
||||
if (modelId >= DIM(modulesModels))
|
||||
modelId = 0;
|
||||
lcdDrawText(12 * FW, y, modulesModels[modelId]);
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Module version
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
lcdDrawText(INDENT_WIDTH, y, "Version");
|
||||
if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) {
|
||||
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion);
|
||||
}
|
||||
}
|
||||
y += FH;
|
||||
|
||||
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
||||
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID) {
|
||||
// Receiver model
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
lcdDrawText(INDENT_WIDTH, y, "Receiver");
|
||||
lcdDrawNumber(lcdLastRightPos + 2, y, receiver + 1);
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
|
||||
if (modelId >= DIM(receiversModels))
|
||||
modelId = 0;
|
||||
lcdDrawText(12 * FW, y, receiversModels[modelId]);
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Receiver version
|
||||
if (y >= MENU_BODY_TOP && y < MENU_BODY_BOTTOM) {
|
||||
drawPXX2FullVersion(12 * FW, y, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion);
|
||||
}
|
||||
y += FH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lines = (y - (FH + 1)) / FH + menuVerticalOffset;
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, menuVerticalOffset, lines, NUM_BODY_LINES);
|
||||
}
|
||||
else {
|
||||
menuVerticalOffset = 0;
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
case EVT_KEY_PREVIOUS_LINE:
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
if (menuVerticalOffset-- == 0)
|
||||
menuVerticalOffset = lines - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_NEXT_LINE:
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
if (++menuVerticalOffset + NUM_BODY_LINES > lines)
|
||||
menuVerticalOffset = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (menuVerticalOffset != 0)
|
||||
menuVerticalOffset = 0;
|
||||
else
|
||||
popMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
enum MenuRadioVersionItems
|
||||
{
|
||||
ITEM_RADIO_VERSION_FIRST = HEADER_LINE - 1,
|
||||
#if defined(PXX2)
|
||||
ITEM_RADIO_MODULES_VERSION,
|
||||
#endif
|
||||
#if defined(EEPROM_RLC)
|
||||
ITEM_RADIO_BACKUP_EEPROM,
|
||||
ITEM_RADIO_FACTORY_RESET,
|
||||
#endif
|
||||
ITEM_RADIO_VERSION_COUNT
|
||||
};
|
||||
|
||||
void menuRadioVersion(event_t event)
|
||||
{
|
||||
#if defined(EEPROM_RLC)
|
||||
@@ -31,40 +240,46 @@ void menuRadioVersion(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, MENU_RADIO_VERSION, 1);
|
||||
SIMPLE_MENU(STR_MENUVERSION, menuTabGeneral, MENU_RADIO_VERSION, ITEM_RADIO_VERSION_COUNT);
|
||||
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+FH, vers_stamp);
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1;
|
||||
lcdDrawTextAlignedLeft(y, vers_stamp);
|
||||
y += 4*FH;
|
||||
// TODO this was good on AVR radios, but horrible now ...
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
if (Coproc_valid == 1) {
|
||||
lcdDrawTextAlignedLeft(6*FH, "CoPr:");
|
||||
lcdDraw8bitsNumber(10*FW, 6*FH, Coproc_read);
|
||||
lcdDrawTextAlignedLeft(y, "CoPr:");
|
||||
lcdDraw8bitsNumber(10*FW, y, Coproc_read);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAlignedLeft(6*FH, "CoPr: ---");
|
||||
lcdDrawTextAlignedLeft(y, "CoPr: ---");
|
||||
}
|
||||
#elif defined(EEPROM_RLC)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);
|
||||
lcdDrawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID);
|
||||
y += FH;
|
||||
#endif
|
||||
|
||||
#if defined(PCBXLITE)
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
if (IS_SHIFT_PRESSED()) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET);
|
||||
}
|
||||
else {
|
||||
eepromBackup();
|
||||
}
|
||||
#if defined(PXX2)
|
||||
lcdDrawText(INDENT_WIDTH, y, BUTTON("Modules / RX version"), menuVerticalPosition == ITEM_RADIO_MODULES_VERSION ? INVERS : 0);
|
||||
y += FH;
|
||||
if (menuVerticalPosition == ITEM_RADIO_MODULES_VERSION && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
pushMenu(menuRadioModulesVersion);
|
||||
}
|
||||
#else
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
#endif
|
||||
|
||||
#if defined(EEPROM_RLC)
|
||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(STR_EEBACKUP), menuVerticalPosition == ITEM_RADIO_BACKUP_EEPROM ? INVERS : 0);
|
||||
y += FH;
|
||||
if (menuVerticalPosition == ITEM_RADIO_BACKUP_EEPROM && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
eepromBackup();
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET);
|
||||
|
||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(STR_FACTORYRESET), menuVerticalPosition == ITEM_RADIO_FACTORY_RESET ? INVERS : 0);
|
||||
// y += FH;
|
||||
if (menuVerticalPosition == ITEM_RADIO_FACTORY_RESET && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET, nullptr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void displayTrims(uint8_t phase)
|
||||
}
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber(dir>0 ? 12 : 40, xm-2, -abs(dir/5), TINSIZE|VERTICAL);
|
||||
lcdDrawNumber(dir>0 ? 12 : 40, xm-2, -abs(dir), TINSIZE|VERTICAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ void displayTrims(uint8_t phase)
|
||||
}
|
||||
if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && dir != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? (dir>0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir>0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym-2, -abs(dir/5), TINSIZE);
|
||||
lcdDrawNumber((stickIndex==0 ? (dir>0 ? TRIM_LH_POS : TRIM_LH_NEG) : (dir>0 ? TRIM_RH_POS : TRIM_RH_NEG)), ym-2, -abs(dir), TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ void displayVoltageOrAlarm()
|
||||
#define displayVoltageOrAlarm() displayBattVoltage()
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(PCBX7) || defined(PCBX3)
|
||||
#define EVT_KEY_CONTEXT_MENU EVT_KEY_LONG(KEY_ENTER)
|
||||
#define EVT_KEY_NEXT_VIEW EVT_KEY_BREAK(KEY_PAGE)
|
||||
#define EVT_KEY_NEXT_PAGE EVT_ROTARY_RIGHT
|
||||
@@ -258,7 +258,6 @@ void displayVoltageOrAlarm()
|
||||
#define EVT_KEY_STATISTICS EVT_KEY_LONG(KEY_UP)
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
void onMainViewMenu(const char *result)
|
||||
{
|
||||
if (result == STR_RESET_TIMER1) {
|
||||
@@ -299,7 +298,6 @@ void onMainViewMenu(const char *result)
|
||||
chainMenu(menuAboutView);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuMainView(event_t event)
|
||||
{
|
||||
@@ -334,7 +332,6 @@ void menuMainView(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
case EVT_KEY_CONTEXT_MENU:
|
||||
killEvents(event);
|
||||
|
||||
@@ -348,7 +345,6 @@ void menuMainView(event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_ABOUT_US);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if MENUS_LOCK != 2 /*no menus*/
|
||||
#if defined(EVT_KEY_LAST_MENU)
|
||||
@@ -403,23 +399,12 @@ void menuMainView(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
#if defined(GVARS)
|
||||
if (gvarDisplayTimer > 0) {
|
||||
gvarDisplayTimer = 0;
|
||||
}
|
||||
#endif
|
||||
#if !defined(NAVIGATION_MENUS)
|
||||
if (view == VIEW_TIMER2) {
|
||||
timerReset(1);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
#if !defined(NAVIGATION_MENUS)
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
flightReset();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
@@ -499,7 +484,17 @@ void menuMainView(event_t event)
|
||||
doMainScreenGraphics();
|
||||
|
||||
// Switches
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBX3)
|
||||
static const uint8_t x[NUM_SWITCHES] = {2*FW-2, 2*FW-2, 16*FW+1, 2*FW-2, 16*FW+1};
|
||||
static const uint8_t y[NUM_SWITCHES] = {4*FH+1, 5*FH+1, 5*FH+1, 6*FH+1, 6*FH+1};
|
||||
for (int i=0; i<NUM_SWITCHES; ++i) {
|
||||
if (SWITCH_EXISTS(i)) {
|
||||
getvalue_t val = getValue(MIXSRC_FIRST_SWITCH + i);
|
||||
getvalue_t sw = ((val < 0) ? 3 * i + 1 : ((val == 0) ? 3 * i + 2 : 3 * i + 3));
|
||||
drawSwitch(x[i], y[i], sw, 0);
|
||||
}
|
||||
}
|
||||
#elif defined(PCBTARANIS)
|
||||
for (int i=0; i<NUM_SWITCHES; ++i) {
|
||||
if (SWITCH_EXISTS(i)) {
|
||||
uint8_t x = 2*FW-2, y = 4*FH+i*FH+1;
|
||||
@@ -556,11 +551,11 @@ void menuMainView(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(GVARS) && !defined(PCBSTD)
|
||||
#if defined(GVARS)
|
||||
if (gvarDisplayTimer > 0) {
|
||||
gvarDisplayTimer--;
|
||||
warningText = STR_GLOBAL_VAR;
|
||||
drawMessageBox();
|
||||
drawMessageBox(warningText);
|
||||
lcdDrawSizedText(16, 5*FH, g_model.gvars[gvarLastChanged].name, LEN_GVAR_NAME, ZCHAR);
|
||||
lcdDrawText(16+6*FW, 5*FH, "[", BOLD);
|
||||
drawGVarValue(lcdLastRightPos, 5*FH, gvarLastChanged, GVAR_VALUE(gvarLastChanged, getGVarFlightMode(mixerCurrentFlightMode, gvarLastChanged)), LEFT|BOLD);
|
||||
@@ -573,7 +568,7 @@ void menuMainView(event_t event)
|
||||
#endif
|
||||
|
||||
#if defined(DSM2)
|
||||
if (moduleFlag[0] == MODULE_BIND) {
|
||||
if (moduleSettings[0].mode == MODULE_MODE_BIND) {
|
||||
// Issue 98
|
||||
lcdDrawText(15*FW, 0, "BIND", 0);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values
|
||||
{
|
||||
drawFieldLabel(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -230,22 +230,6 @@ void drawStatusLine()
|
||||
}
|
||||
#endif
|
||||
|
||||
void drawProgressBar(const char * label, int num, int den)
|
||||
{
|
||||
lcdClear();
|
||||
if (label) {
|
||||
lcdDrawTextAlignedLeft(4*FH, label);
|
||||
}
|
||||
lcdDrawRect(4, 6*FH+4, LCD_W-8, 7);
|
||||
if (num > 0 && den > 0) {
|
||||
int width = ((LCD_W-12)*num)/den;
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+6, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+7, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+8, width, FORCE);
|
||||
}
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const unsigned char SLEEP_BITMAP[] = {
|
||||
#include "sleep.lbm"
|
||||
};
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
||||
#define NUM_BODY_LINES (LCD_LINES-1)
|
||||
#define MENU_HEADER_HEIGHT FH
|
||||
#define MENU_INIT_VPOS 0
|
||||
|
||||
#define MODEL_BITMAP_WIDTH 64
|
||||
#define MODEL_BITMAP_HEIGHT 32
|
||||
@@ -55,11 +54,6 @@ inline void drawFieldLabel(coord_t x, coord_t y, const char * str)
|
||||
extern uint8_t modelBitmap[MODEL_BITMAP_SIZE];
|
||||
bool loadModelBitmap(char * name, uint8_t * bitmap);
|
||||
|
||||
struct MenuItem {
|
||||
const char * name;
|
||||
const MenuHandlerFunc action;
|
||||
};
|
||||
|
||||
// Temporary no highlight
|
||||
extern uint8_t noHighlightCounter;
|
||||
#define NO_HIGHLIGHT() (noHighlightCounter > 0)
|
||||
@@ -71,8 +65,6 @@ void drawSplash();
|
||||
void drawSecondSplash();
|
||||
void drawScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void displayMenuBar(const MenuItem * menu, int index);
|
||||
void drawProgressBar(const char * label, int num, int den);
|
||||
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max);
|
||||
void drawColumnHeader(const char * const * headers, uint8_t index);
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
||||
@@ -86,15 +78,13 @@ typedef uint16_t FlightModesType;
|
||||
|
||||
extern int8_t checkIncDec_Ret; // global helper vars
|
||||
|
||||
#define EDIT_SELECT_MENU -1
|
||||
#define EDIT_SELECT_FIELD 0
|
||||
#define EDIT_MODIFY_FIELD 1
|
||||
#define EDIT_MODIFY_STRING 2
|
||||
extern int8_t s_editMode; // global editmode
|
||||
|
||||
// checkIncDec flags
|
||||
#define EE_GENERAL 0x01
|
||||
#define EE_MODEL 0x02
|
||||
// we leave room for EE_MODEL and EE_GENERAL
|
||||
#define NO_INCDEC_MARKS 0x04
|
||||
#define INCDEC_SWITCH 0x08
|
||||
#define INCDEC_SOURCE 0x10
|
||||
@@ -107,7 +97,8 @@ extern int8_t s_editMode; // global editmode
|
||||
#define CHECK_INCDEC_PARAM(event, var, min, max) checkIncDec(event, var, min, max, incdecFlag, isValueAvailable)
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define READONLY_ROW ((uint8_t)-1)
|
||||
#define TITLE_ROW READONLY_ROW
|
||||
#define HIDDEN_ROW ((uint8_t)-2)
|
||||
|
||||
struct CheckIncDecStops
|
||||
@@ -257,15 +248,10 @@ uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint
|
||||
#define WARNING_TYPE_ASTERISK 0
|
||||
#define WARNING_TYPE_CONFIRM 1
|
||||
#define WARNING_TYPE_INPUT 2
|
||||
#define WARNING_TYPE_INFO 4
|
||||
|
||||
void copySelection(char * dst, const char * src, uint8_t size);
|
||||
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
extern uint8_t warningInfoLength;
|
||||
extern uint8_t warningResult;
|
||||
extern uint8_t warningType;
|
||||
|
||||
#define COPY_MODE 1
|
||||
#define MOVE_MODE 2
|
||||
extern uint8_t s_copyMode;
|
||||
|
||||
@@ -244,7 +244,7 @@ uint8_t getTextWidth(const char * s, uint8_t len, LcdFlags flags)
|
||||
{
|
||||
uint8_t width = 0;
|
||||
for (int i=0; len==0 || i<len; ++i) {
|
||||
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
if (!c) {
|
||||
break;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void lcdDrawSizedText(coord_t x, coord_t y, const char * s, uint8_t len, LcdFlag
|
||||
#if defined(BOOT)
|
||||
unsigned char c = *s;
|
||||
#else
|
||||
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
#endif
|
||||
|
||||
if (setx) {
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
const MenuHandlerFunc menuTabGeneral[] = {
|
||||
menuRadioSetup,
|
||||
menuRadioSdManager,
|
||||
menuRadioTools,
|
||||
menuRadioSpecialFunctions,
|
||||
menuRadioTrainer,
|
||||
menuRadioVersion,
|
||||
menuRadioHardware
|
||||
menuRadioHardware,
|
||||
menuRadioVersion
|
||||
};
|
||||
|
||||
void menuRadioSpecialFunctions(event_t event)
|
||||
|
||||
@@ -43,6 +43,16 @@ void chainMenu(MenuHandlerFunc newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
void popMenu();
|
||||
|
||||
inline bool isRadioMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 1;
|
||||
}
|
||||
|
||||
inline bool isModelMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 0;
|
||||
}
|
||||
|
||||
void onMainViewMenu(const char * result);
|
||||
|
||||
void menuFirstCalib(event_t event);
|
||||
@@ -63,10 +73,11 @@ void menuTraceBuffer(event_t event);
|
||||
enum MenuRadioIndexes {
|
||||
MENU_RADIO_SETUP,
|
||||
MENU_RADIO_SD_MANAGER,
|
||||
MENU_RADIO_TOOLS,
|
||||
MENU_RADIO_SPECIAL_FUNCTIONS,
|
||||
MENU_RADIO_TRAINER,
|
||||
MENU_RADIO_VERSION,
|
||||
MENU_RADIO_HARDWARE,
|
||||
MENU_RADIO_VERSION,
|
||||
MENU_RADIO_PAGES_COUNT
|
||||
};
|
||||
|
||||
@@ -78,7 +89,10 @@ void menuRadioVersion(event_t event);
|
||||
void menuRadioDiagKeys(event_t event);
|
||||
void menuRadioDiagAnalogs(event_t event);
|
||||
void menuRadioHardware(event_t event);
|
||||
void menuRadioTools(event_t event);
|
||||
void menuRadioCalibration(event_t event);
|
||||
void menuRadioSpectrumAnalyser(event_t event);
|
||||
void menuRadioPowerMeter(event_t event);
|
||||
|
||||
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
|
||||
|
||||
@@ -105,6 +119,8 @@ enum MenuModelIndexes {
|
||||
void menuModelSelect(event_t event);
|
||||
void menuModelSetup(event_t event);
|
||||
void menuModelFailsafe(event_t event);
|
||||
void menuModelModuleOptions(event_t event);
|
||||
void menuModelReceiverOptions(event_t event);
|
||||
void menuModelHeli(event_t event);
|
||||
void menuModelFlightModesAll(event_t event);
|
||||
void menuModelExpoOne(event_t event);
|
||||
|
||||
@@ -20,17 +20,41 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
void displayPresetChoice(event_t event)
|
||||
void runPopupCurvePreset(event_t event)
|
||||
{
|
||||
runPopupWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
|
||||
warningResult = false;
|
||||
|
||||
drawMessageBox(warningText);
|
||||
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, STR_POPUPS_ENTER_EXIT);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
warningResult = true;
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
|
||||
default:
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
reusableBuffer.curveEdit.preset = checkIncDec(event, reusableBuffer.curveEdit.preset, -4, +4);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastRightPos, WARNING_LINE_Y, '@', INVERS);
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
int k = 25 * warningInputValue;
|
||||
int k = 25 * reusableBuffer.curveEdit.preset;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
int x = -1000 + i * dx;
|
||||
@@ -45,7 +69,8 @@ void displayPresetChoice(event_t event)
|
||||
void onCurveOneMenu(const char * result)
|
||||
{
|
||||
if (result == STR_CURVE_PRESET) {
|
||||
POPUP_INPUT(STR_PRESET, displayPresetChoice, 0, -4, 4);
|
||||
reusableBuffer.curveEdit.preset = 4; // 45°
|
||||
POPUP_INPUT(STR_PRESET, runPopupCurvePreset);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
|
||||
@@ -29,7 +29,7 @@ void onModelCustomScriptMenu(const char *result)
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a lua file in the list
|
||||
copySelection(sd.file, result, sizeof(sd.file));
|
||||
memset(sd.inputs, 0, sizeof(sd.inputs));
|
||||
|
||||
@@ -72,7 +72,7 @@ void onTelemetryScriptFileSelectionMenu(const char *result)
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file in the list
|
||||
memcpy(g_model.frsky.screens[screenIndex].script.file, result, sizeof(g_model.frsky.screens[screenIndex].script.file));
|
||||
storageDirty(EE_MODEL);
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
static uint8_t maxNameLen = 4;
|
||||
static int8_t lastModel = g_eeGeneral.currModel;
|
||||
const coord_t barH = (LCD_H - FH) / 8 - 1;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
uint8_t cols = 1;
|
||||
uint8_t colW = LCD_W;
|
||||
|
||||
if (lastModel != g_eeGeneral.currModel) {
|
||||
lastModel = g_eeGeneral.currModel;
|
||||
maxNameLen = 4;
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + 1);
|
||||
SET_SCROLLBAR_X(0);
|
||||
|
||||
if (sentModuleChannels(g_moduleIdx) > 8) {
|
||||
cols = 2;
|
||||
colW = LCD_W / cols - 1;
|
||||
// Column separator
|
||||
if (menuVerticalPosition >= sentModuleChannels(g_moduleIdx)) {
|
||||
lcdDrawSolidVerticalLine(colW, FH, LCD_H - (FH*2 + FH/2 + 2));
|
||||
}
|
||||
else {
|
||||
lcdDrawSolidVerticalLine(colW, FH, LCD_H - FH);
|
||||
}
|
||||
}
|
||||
|
||||
lcdDrawTextAlignedCenter(0, FAILSAFESET);
|
||||
lcdInvertLine(0);
|
||||
|
||||
coord_t x = colW;
|
||||
for (uint8_t col = 0; col < cols; col++) {
|
||||
|
||||
coord_t y = FH + 1;
|
||||
uint8_t line = (menuVerticalPosition >= sentModuleChannels(g_moduleIdx) ? 2 : 0);
|
||||
uint8_t ch = line + col*8;
|
||||
|
||||
for (; line < 8; line++) {
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.failsafeChannels[8*col+line];
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
|
||||
uint8_t barW = colW - FW * maxNameLen - FWNUM * 3; // default bar width
|
||||
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
barW -= FWNUM + 1;
|
||||
#endif
|
||||
barW += (barW % 2);
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (lenLabel > 0) {
|
||||
if (lenLabel > maxNameLen)
|
||||
maxNameLen = lenLabel;
|
||||
lcdDrawSizedText(x - colW, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
|
||||
}
|
||||
else {
|
||||
putsChn(x - colW, y, ch+1, SMLSIZE);
|
||||
}
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.failsafeChannels[8*col+line], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const coord_t xValue = x - barW;
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
|
||||
#else
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
lcdDrawRect(x - barW, y, barW - 1, barH);
|
||||
barW = barW / 2 - 1;
|
||||
const coord_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * barW + lim / 2) / lim, barW);
|
||||
const coord_t lenFailsafe = limit<uint8_t>(1, (abs(failsafeValue) * barW + lim / 2) / lim, barW);
|
||||
const coord_t barX = x - barW - 2;
|
||||
const coord_t xChannel = (channelValue >= 0) ? barX : barX - lenChannel + 1;
|
||||
const coord_t xFailsafe = (failsafeValue > 0) ? barX : barX - lenFailsafe + 1;
|
||||
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
|
||||
|
||||
if (++ch >= sentModuleChannels(g_moduleIdx))
|
||||
break;
|
||||
|
||||
y += barH + 1;
|
||||
|
||||
} // channels
|
||||
|
||||
x += colW + 2;
|
||||
|
||||
} // columns
|
||||
|
||||
if (menuVerticalPosition >= sentModuleChannels(g_moduleIdx)) {
|
||||
// Outputs => Failsafe
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,4 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _IO_PXX2_H_
|
||||
#define _IO_PXX2_H_
|
||||
|
||||
#define PXX2_BAUDRATE 230400
|
||||
#define PXX2_PERIOD 4 // 4ms
|
||||
|
||||
#endif
|
||||
#include <opentx.h>
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
@@ -52,10 +52,10 @@ void onModelSelectMenu(const char * result)
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
char * nametmp = reusableBuffer.modelsel.mainname;
|
||||
strcat_modelname (nametmp, sub);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, nullptr);
|
||||
SET_WARNING_INFO(nametmp, sizeof(g_model.header.name), 0);
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file on SD to restore
|
||||
storageCheck(true);
|
||||
POPUP_WARNING(eeRestoreModel(sub, (char *)result));
|
||||
@@ -102,7 +102,7 @@ void menuModelSelect(event_t event)
|
||||
if (s_copyMode && s_copyTgtOfs == 0 && g_eeGeneral.currModel != sub && eeModelExists(sub)) {
|
||||
char * nametmp = reusableBuffer.modelsel.mainname;
|
||||
strcat_modelname (nametmp, sub);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, nullptr);
|
||||
SET_WARNING_INFO(nametmp, sizeof(g_model.header.name), 0);
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
@@ -88,6 +88,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND,
|
||||
#endif
|
||||
ITEM_MODEL_EXTERNAL_MODULE_POWER,
|
||||
ITEM_MODEL_EXTERNAL_MODULE_FREQ,
|
||||
ITEM_MODEL_TRAINER_LABEL,
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
ITEM_MODEL_TRAINER_LINE1,
|
||||
@@ -103,7 +104,7 @@ enum MenuModelSetupItems {
|
||||
#define MODEL_SETUP_RANGE_OFS 7*FW
|
||||
#define MODEL_SETUP_SET_FAILSAFE_OFS 10*FW-2
|
||||
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_TRAINER_LABEL ? TRAINER_MODULE : (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE))
|
||||
#define CURRENT_MODULE_EDITED(k) (k >= ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE)
|
||||
|
||||
void onBindMenu(const char * result)
|
||||
{
|
||||
@@ -129,7 +130,7 @@ void onBindMenu(const char * result)
|
||||
return;
|
||||
}
|
||||
|
||||
moduleFlag[moduleIdx] = MODULE_BIND;
|
||||
moduleSettings[moduleIdx].mode = MODULE_MODE_BIND;
|
||||
}
|
||||
|
||||
void copySelection(char * dst, const char * src, uint8_t size)
|
||||
@@ -147,7 +148,7 @@ void onModelSetupBitmapMenu(const char * result)
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a bmp file in the list
|
||||
copySelection(g_model.header.bitmap, result, sizeof(g_model.header.bitmap));
|
||||
memcpy(modelHeaders[g_eeGeneral.currModel].bitmap, g_model.header.bitmap, sizeof(g_model.header.bitmap));
|
||||
@@ -239,21 +240,22 @@ int getSwitchWarningsCount()
|
||||
#define INTERNAL_MODULE_MODE_ROWS 0 // (OFF / RF protocols)
|
||||
#endif
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
|
||||
|
||||
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))
|
||||
|
||||
#if defined(BLUETOOTH) && defined(USEHORUSBT)
|
||||
#define TRAINER_LINE1_BLUETOOTH_M_ROWS ((bluetoothDistantAddr[0] == 0 || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#else
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : HIDDEN_ROW)
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)1 : HIDDEN_ROW)
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#endif
|
||||
|
||||
#define TIMER_ROWS(x) 2|NAVIGATION_LINE_BY_LINE, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t) 1 : (uint8_t)0
|
||||
|
||||
#define EXTERNAL_MODULE_MODE_ROWS (isModulePXX(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : isModuleMultimodule(EXTERNAL_MODULE) ? MULTIMODULE_MODE_ROWS(EXTERNAL_MODULE) : (uint8_t)0
|
||||
#define EXTERNAL_MODULE_MODE_ROWS (isModuleXJT(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE) || isModuleMultimodule(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0
|
||||
#define EXTRA_MODULE_ROWS isR9MMFlex(EXTERNAL_MODULE) ? (uint8_t)1: (uint8_t)HIDDEN_ROW,
|
||||
|
||||
#if TIMERS == 1
|
||||
#define TIMERS_ROWS TIMER_ROWS(0)
|
||||
@@ -296,18 +298,19 @@ void menuModelSetup(event_t event)
|
||||
EXTERNAL_MODULE_OPTION_ROW,
|
||||
MULTIMODULE_MODULE_ROWS
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
LABEL(Trainer), 0, TRAINER_LINE1_ROWS, TRAINER_LINE2_ROWS});
|
||||
|
||||
MENU_CHECK(STR_MENUSETUP, menuTabModel, MENU_MODEL_SETUP, ITEM_MODEL_SETUP_MAX);
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
}
|
||||
|
||||
#if (defined(DSM2) || defined(PXX))
|
||||
if (menuEvent) {
|
||||
moduleFlag[0] = 0;
|
||||
moduleFlag[1] = 0;
|
||||
moduleSettings[0].mode = 0;
|
||||
moduleSettings[1].mode = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -710,9 +713,9 @@ void menuModelSetup(event_t event)
|
||||
#endif
|
||||
case ITEM_MODEL_TRAINER_MODE:
|
||||
lcdDrawTextAlignedLeft(y, STR_MODE);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, attr);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerData.mode, attr);
|
||||
if (attr) {
|
||||
g_model.trainerMode = checkIncDec(event, g_model.trainerMode, 0, TRAINER_MODE_MAX(), EE_MODEL, isTrainerModeAvailable);
|
||||
g_model.trainerData.mode = checkIncDec(event, g_model.trainerData.mode, 0, TRAINER_MODE_MAX(), EE_MODEL, isTrainerModeAvailable);
|
||||
}
|
||||
#if defined(BLUETOOTH) && defined(USEHORUSBT)
|
||||
if (attr && checkIncDec_Ret) {
|
||||
@@ -733,8 +736,8 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
|
||||
else if (isModuleR9M(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].subType, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (isR9ModuleRunning(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].r9m.region, (menuHorizontalPosition==1 ? attr : 0));
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
uint8_t multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
||||
@@ -757,7 +760,7 @@ void menuModelSetup(event_t event)
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, IS_TRAINER_EXTERNAL_MODULE() ? MODULE_TYPE_NONE : MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, IS_TRAINER_EXTERNAL_MODULE() ? MODULE_TYPE_NONE : MODULE_TYPE_COUNT-1, EE_MODEL, isExternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
@@ -771,15 +774,6 @@ void menuModelSetup(event_t event)
|
||||
case 1:
|
||||
if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
|
||||
else if (isModuleR9M(EXTERNAL_MODULE)) {
|
||||
uint8_t newR9MType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].subType, MODULE_SUBTYPE_R9M_FCC, MODULE_SUBTYPE_R9M_LAST, EE_MODEL, isR9MModeAvailable);
|
||||
if (newR9MType != g_model.moduleData[EXTERNAL_MODULE].subType && newR9MType > MODULE_SUBTYPE_R9M_EU) {
|
||||
POPUP_WARNING(STR_R9MFLEXWARN1);
|
||||
const char * w = STR_R9MFLEXWARN2;
|
||||
SET_WARNING_INFO(w, strlen(w), 0);
|
||||
}
|
||||
g_model.moduleData[EXTERNAL_MODULE].subType = newR9MType;
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
int multiRfProto = g_model.moduleData[EXTERNAL_MODULE].multi.customProto == 1 ? MM_RF_PROTO_CUSTOM : g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
||||
@@ -835,7 +829,7 @@ void menuModelSetup(event_t event)
|
||||
|
||||
#if defined(BLUETOOTH) && defined(USEHORUSBT)
|
||||
case ITEM_MODEL_TRAINER_LINE1:
|
||||
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
@@ -876,7 +870,24 @@ void menuModelSetup(event_t event)
|
||||
// no break
|
||||
#else
|
||||
case ITEM_MODEL_TRAINER_LINE1:
|
||||
lcdDrawTextAlignedLeft(y, STR_CHANNELRANGE);
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_CH, menuHorizontalPosition==0 ? attr : 0);
|
||||
lcdDrawNumber(lcdLastRightPos, y, g_model.trainerData.channelsStart+1, LEFT | (menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawChar(lcdLastRightPos, y, '-');
|
||||
lcdDrawNumber(lcdLastRightPos + FW+1, y, g_model.trainerData.channelsStart+8+g_model.trainerData.channelsCount, LEFT | (menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.trainerData.channelsStart, 32-8-g_model.trainerData.channelsCount);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.trainerData.channelsCount, -4, min<int8_t>(MAX_TRAINER_CHANNELS_M8, 32-8-g_model.trainerData.channelsStart));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_INTERNAL_MODULE_CHANNELS:
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS:
|
||||
{
|
||||
@@ -917,9 +928,30 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_MODEL_TRAINER_LINE2:
|
||||
lcdDrawTextAlignedLeft(y, STR_PPMFRAME);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.trainerData.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcdDrawText(lcdLastRightPos, y, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+6*FW, y, (g_model.trainerData.delay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr : 0);
|
||||
lcdDrawChar(lcdLastRightPos, y, 'u');
|
||||
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+12*FW, y, g_model.trainerData.pulsePol ? '+' : '-', (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.trainerData.frameLength, -20, 35);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.trainerData.delay, -4, 10);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.trainerData.pulsePol, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_INTERNAL_MODULE_BIND:
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
case ITEM_MODEL_TRAINER_LINE2:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
@@ -1029,27 +1061,27 @@ void menuModelSetup(event_t event)
|
||||
POPUP_MENU_START(onBindMenu);
|
||||
continue;
|
||||
}
|
||||
if (moduleFlag[moduleIdx] == MODULE_BIND) {
|
||||
newFlag = MODULE_BIND;
|
||||
if (moduleSettings[moduleIdx].mode == MODULE_MODE_BIND) {
|
||||
newFlag = MODULE_MODE_BIND;
|
||||
}
|
||||
else {
|
||||
if (!popupMenuNoItems) {
|
||||
if (!popupMenuItemsCount) {
|
||||
s_editMode = 0; // this is when popup is exited before a choice is made
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
newFlag = MODULE_BIND;
|
||||
newFlag = MODULE_MODE_BIND;
|
||||
}
|
||||
}
|
||||
else if (l_posHorz == 2) {
|
||||
newFlag = MODULE_RANGECHECK;
|
||||
newFlag = MODULE_MODE_RANGECHECK;
|
||||
}
|
||||
}
|
||||
}
|
||||
moduleFlag[moduleIdx] = newFlag;
|
||||
moduleSettings[moduleIdx].mode = newFlag;
|
||||
#if defined(MULTIMODULE)
|
||||
if (newFlag == MODULE_BIND)
|
||||
if (newFlag == MODULE_MODE_BIND)
|
||||
multiBindStatus = MULTI_BIND_INITIATED;
|
||||
#endif
|
||||
}
|
||||
@@ -1129,16 +1161,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (isModuleR9M(moduleIdx)) {
|
||||
lcdDrawTextAlignedLeft(y, STR_MODULE_TELEMETRY);
|
||||
if (IS_TELEMETRY_INTERNAL_MODULE()) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_TELEM_ON);
|
||||
}
|
||||
}
|
||||
else if (isModuleSBUS(moduleIdx)) {
|
||||
if (isModuleSBUS(moduleIdx)) {
|
||||
lcdDrawTextAlignedLeft(y, STR_WARN_BATTVOLTAGE);
|
||||
putsVolts(lcdLastRightPos, y, getBatteryVoltage(), attr | PREC2 | LEFT);
|
||||
}
|
||||
@@ -1159,10 +1182,10 @@ void menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9M_LBT_POWER_VALUES, g_model.moduleData[moduleIdx].pxx.power, LEFT | attr);
|
||||
if (attr)
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].pxx.power, 0, R9M_LBT_POWER_MAX);
|
||||
if (attr && s_editMode == 0 && reusableBuffer.modelsetup.r9mPower != g_model.moduleData[moduleIdx].pxx.power) {
|
||||
if((reusableBuffer.modelsetup.r9mPower + g_model.moduleData[moduleIdx].pxx.power) < 5) //switching between mode 2 and 3 does not require rebind
|
||||
if (attr && s_editMode == 0 && reusableBuffer.moduleSetup.r9mPower != g_model.moduleData[moduleIdx].pxx.power) {
|
||||
if((reusableBuffer.moduleSetup.r9mPower + g_model.moduleData[moduleIdx].pxx.power) < 5) //switching between mode 2 and 3 does not require rebind
|
||||
POPUP_WARNING(STR_REBIND);
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[moduleIdx].pxx.power;
|
||||
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[moduleIdx].pxx.power;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1174,6 +1197,18 @@ void menuModelSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_FREQ:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
lcdDrawTextAlignedLeft(y, STR_FREQUENCY);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9MFLEX_FREQ, g_model.moduleData[moduleIdx].r9m.freq, LEFT | attr);
|
||||
if (attr)
|
||||
{
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[moduleIdx].r9m.freq, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined (MULTIMODULE)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND:
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MM_RF_PROTO_DSM2)
|
||||
@@ -1205,7 +1240,7 @@ void menuModelSetup(event_t event)
|
||||
#if defined(PXX)
|
||||
if (IS_RANGECHECK_ENABLE()) {
|
||||
showMessageBox("RSSI: ");
|
||||
lcdDrawNumber(16+4*FW, 5*FH, TELEMETRY_RSSI(), BOLD);
|
||||
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD | LEFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1223,157 +1258,3 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
static uint8_t maxNameLen = 4;
|
||||
static int8_t lastModel = g_eeGeneral.currModel;
|
||||
const coord_t barH = (LCD_H - FH) / 8 - 1;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
uint8_t cols = 1;
|
||||
uint8_t colW = LCD_W;
|
||||
|
||||
if (lastModel != g_eeGeneral.currModel) {
|
||||
lastModel = g_eeGeneral.currModel;
|
||||
maxNameLen = 4;
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx)+1);
|
||||
SET_SCROLLBAR_X(0);
|
||||
|
||||
if (sentModuleChannels(g_moduleIdx) > 8) {
|
||||
cols = 2;
|
||||
colW = LCD_W / cols - 1;
|
||||
// Column separator
|
||||
if (menuVerticalPosition >= sentModuleChannels(g_moduleIdx)) {
|
||||
lcdDrawSolidVerticalLine(colW, FH, LCD_H - (FH*2 + FH/2 + 2));
|
||||
}
|
||||
else {
|
||||
lcdDrawSolidVerticalLine(colW, FH, LCD_H - FH);
|
||||
}
|
||||
}
|
||||
|
||||
lcdDrawTextAlignedCenter(0, FAILSAFESET);
|
||||
lcdInvertLine(0);
|
||||
|
||||
coord_t x = colW;
|
||||
for (uint8_t col = 0; col < cols; col++) {
|
||||
|
||||
coord_t y = FH + 1;
|
||||
uint8_t line = (menuVerticalPosition >= sentModuleChannels(g_moduleIdx) ? 2 : 0);
|
||||
uint8_t ch = line + col*8;
|
||||
|
||||
for (; line < 8; line++) {
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
|
||||
uint8_t barW = colW - FW * maxNameLen - FWNUM * 3; // default bar width
|
||||
|
||||
#if defined(PPM_UNIT_PERCENT_PREC1)
|
||||
barW -= FWNUM + 1;
|
||||
#endif
|
||||
barW += (barW % 2);
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (lenLabel > 0) {
|
||||
if (lenLabel > maxNameLen)
|
||||
maxNameLen = lenLabel;
|
||||
lcdDrawSizedText(x - colW, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
|
||||
}
|
||||
else {
|
||||
putsChn(x - colW, y, ch+1, SMLSIZE);
|
||||
}
|
||||
|
||||
// Value
|
||||
LcdFlags flags = TINSIZE;
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const coord_t xValue = x - barW;
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(xValue, y, STR_HOLD, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(xValue, y, STR_NONE, RIGHT|flags);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(xValue, y, PPM_CH_CENTER(ch)+failsafeValue/2, RIGHT|flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue), RIGHT|PREC1|flags);
|
||||
#else
|
||||
lcdDrawNumber(xValue, y, calcRESXto1000(failsafeValue)/10, RIGHT|flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
lcdDrawRect(x - barW, y, barW - 1, barH);
|
||||
barW = barW / 2 - 1;
|
||||
const coord_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * barW + lim / 2) / lim, barW);
|
||||
const coord_t lenFailsafe = limit<uint8_t>(1, (abs(failsafeValue) * barW + lim / 2) / lim, barW);
|
||||
const coord_t barX = x - barW - 2;
|
||||
const coord_t xChannel = (channelValue >= 0) ? barX : barX - lenChannel + 1;
|
||||
const coord_t xFailsafe = (failsafeValue > 0) ? barX : barX - lenFailsafe + 1;
|
||||
lcdDrawHorizontalLine(xChannel, y+1, lenChannel, DOTTED, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y+2, lenChannel, DOTTED, 0);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
|
||||
|
||||
if (++ch >= sentModuleChannels(g_moduleIdx))
|
||||
break;
|
||||
|
||||
y += barH + 1;
|
||||
|
||||
} // channels
|
||||
|
||||
x += colW + 2;
|
||||
|
||||
} // columns
|
||||
|
||||
if (menuVerticalPosition >= sentModuleChannels(g_moduleIdx)) {
|
||||
// Outputs => Failsafe
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file in the list
|
||||
memcpy(cfn->play.name, result, sizeof(cfn->play.name));
|
||||
storageDirty(eeFlags);
|
||||
@@ -129,7 +129,7 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
CFN_PARAM(cfn) = 0;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
onSourceLongEnterPress(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,7 +506,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE, nullptr);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -20,30 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const char * warningText = NULL;
|
||||
const char * warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
|
||||
void drawMessageBox(const char * title)
|
||||
{
|
||||
lcdDrawFilledRect(10, 16, LCD_W-20, 40, SOLID, ERASE);
|
||||
lcdDrawRect(10, 16, LCD_W-20, 40);
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN);
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void showMessageBox(const char * title)
|
||||
{
|
||||
drawMessageBox(title);
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const unsigned char ASTERISK_BITMAP[] = {
|
||||
#include "asterisk.lbm"
|
||||
};
|
||||
@@ -75,42 +51,3 @@ void drawAlertBox(const char * title, const char * text, const char * action)
|
||||
|
||||
#undef MESSAGE_LCD_OFFSET
|
||||
}
|
||||
|
||||
void showAlertBox(const char * title, const char * text, const char * action, uint8_t sound)
|
||||
{
|
||||
drawAlertBox(title, text, action);
|
||||
AUDIO_ERROR_MESSAGE(sound);
|
||||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void runPopupWarning(event_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
drawMessageBox(warningText);
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS);
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
warningResult = true;
|
||||
// no break
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
default:
|
||||
if (warningType == WARNING_TYPE_INPUT) {
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,50 +21,40 @@
|
||||
#ifndef _POPUPS_H_
|
||||
#define _POPUPS_H_
|
||||
|
||||
#define MESSAGEBOX_X 10
|
||||
#define MESSAGEBOX_Y 16
|
||||
#define MESSAGEBOX_W LCD_W - (2 * MESSAGEBOX_X)
|
||||
|
||||
#define MENU_X 30
|
||||
#define MENU_Y 16
|
||||
#define MENU_W LCD_W-(2*MENU_X)
|
||||
#define MENU_W LCD_W - (2 * MENU_X)
|
||||
|
||||
#define WARNING_LINE_LEN 32
|
||||
#define WARNING_LINE_X 16
|
||||
#define WARNING_LINE_Y 3*FH
|
||||
|
||||
void drawMessageBox(const char * title);
|
||||
void showMessageBox(const char * title);
|
||||
void runPopupWarning(event_t event);
|
||||
#define DRAW_MESSAGE_BOX(title) drawMessageBox(title)
|
||||
|
||||
extern void (*popupFunc)(event_t event);
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_WARNING(s) (warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define POPUP_CONFIRMATION(s, func) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning, popupMenuHandler = func)
|
||||
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuNoItems ? s : popupMenuNoItems) : 0)
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount) : 0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while (0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 6
|
||||
#define POPUP_MENU_ADD_SD_ITEM(s) POPUP_MENU_ADD_ITEM(s)
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
#define POPUP_MENU_SET_BSS_FLAG()
|
||||
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
extern uint16_t popupMenuOffset;
|
||||
|
||||
enum {
|
||||
MENU_OFFSET_INTERNAL,
|
||||
MENU_OFFSET_EXTERNAL
|
||||
};
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
extern uint8_t s_menu_item;
|
||||
const char * runPopupMenu(event_t event);
|
||||
extern void (*popupMenuHandler)(const char * result);
|
||||
|
||||
#include "../common/stdlcd/popups.h"
|
||||
|
||||
#endif // _POPUPS_H_
|
||||
|
||||
@@ -243,7 +243,7 @@ void menuRadioHardware(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
||||
lcdDrawText(HW_SETTINGS_COLUMN
|
||||
, y, STR_ANALOGS_BTN, menuHorizontalPosition == 0 ? attr : 0);
|
||||
lcdDrawText(lcdLastRightPos + 2, y, STR_SWITCHES_BTN, menuHorizontalPosition == 1 ? attr : 0);
|
||||
lcdDrawText(lcdLastRightPos + 2, y, STR_KEYS_BTN, menuHorizontalPosition == 1 ? attr : 0);
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
if (menuHorizontalPosition == 0)
|
||||
pushMenu(menuRadioDiagAnalogs);
|
||||
|
||||
@@ -460,7 +460,7 @@ void menuRadioSetup(event_t event)
|
||||
if (g_eeGeneral.fai)
|
||||
POPUP_WARNING("FAI\001mode blocked!");
|
||||
else
|
||||
POPUP_CONFIRMATION("FAI mode?");
|
||||
POPUP_CONFIRMATION("FAI mode?", nullptr);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -38,14 +38,14 @@ void menuRadioVersion(event_t event)
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+4*FH+1, "UID\037\033:");
|
||||
lcdDrawText(5*FW+3, MENU_HEADER_HEIGHT+4*FH+1, id);
|
||||
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+5*FH+1, STR_EEBACKUP);
|
||||
lcdDrawTextAlignedLeft(MENU_HEADER_HEIGHT+6*FH+1, STR_FACTORYRESET);
|
||||
lcdDrawText(INDENT_WIDTH, MENU_HEADER_HEIGHT+5*FH+1, "[ENTER Long] " STR_EEBACKUP);
|
||||
lcdDrawText(INDENT_WIDTH, MENU_HEADER_HEIGHT+6*FH+1, "[MENU Long] " STR_FACTORYRESET);
|
||||
lcdDrawFilledRect(0, MENU_HEADER_HEIGHT+5*FH, LCD_W, 2*FH+1, SOLID);
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
eepromBackup();
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_MENU)) {
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void menuStatisticsDebug(event_t event)
|
||||
#if defined(WATCHDOG_TEST)
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
{
|
||||
POPUP_CONFIRMATION("Test the watchdog?");
|
||||
POPUP_CONFIRMATION("Test the watchdog?", nullptr);
|
||||
const char * w = "The radio will reset!";
|
||||
SET_WARNING_INFO(w, strlen(w), 0);
|
||||
}
|
||||
|
||||
@@ -98,22 +98,6 @@ void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uin
|
||||
lcdDrawVerticalLine(x, y + yofs, yhgt, SOLID, FORCE);
|
||||
}
|
||||
|
||||
void drawProgressBar(const char * label, int num, int den)
|
||||
{
|
||||
lcdClear();
|
||||
if (label) {
|
||||
lcdDrawTextAlignedLeft(4*FH, label);
|
||||
}
|
||||
lcdDrawRect(4, 6*FH+4, LCD_W-8, 7);
|
||||
if (num > 0 && den > 0) {
|
||||
int width = ((LCD_W-12)*num)/den;
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+6, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+7, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+8, width, FORCE);
|
||||
}
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
void drawGauge(coord_t x, coord_t y, coord_t w, coord_t h, int32_t val, int32_t max)
|
||||
{
|
||||
lcdDrawRect(x, y, w+1, h);
|
||||
@@ -134,7 +118,7 @@ choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values
|
||||
{
|
||||
drawFieldLabel(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ void BitmapBuffer::drawSizedText(coord_t x, coord_t y, const char * s, uint8_t l
|
||||
#if defined(BOOT)
|
||||
unsigned char c = *s;
|
||||
#else
|
||||
unsigned char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
unsigned char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
#endif
|
||||
if (setpos) {
|
||||
pos = c;
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
#define DATETIME_MIDDLE (LCD_W+DATETIME_SEPARATOR_X+4)/2
|
||||
|
||||
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
||||
#define MENU_INIT_VPOS -1
|
||||
|
||||
#if defined(HELI) && defined(GVARS) && defined(LUA_MODEL_SCRIPTS)
|
||||
#define MENU_ICONS_SPACING 31
|
||||
|
||||
@@ -130,7 +130,7 @@ int getTextWidth(const char * s, int len, LcdFlags flags)
|
||||
for (int i=0; len==0 || i<len; ++i) {
|
||||
|
||||
#if !defined(BOOT)
|
||||
char c = (flags & ZCHAR) ? idx2char(*s) : *s;
|
||||
char c = (flags & ZCHAR) ? zchar2char(*s) : *s;
|
||||
#else
|
||||
char c = *s;
|
||||
#endif
|
||||
|
||||
@@ -82,7 +82,7 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
if (s_editMode > 0) {
|
||||
int8_t c = name[editNameCursorPos];
|
||||
if (!(flags & ZCHAR)) {
|
||||
c = char2idx(c);
|
||||
c = char2zchar(c);
|
||||
}
|
||||
int8_t v = c;
|
||||
|
||||
@@ -132,15 +132,15 @@ void editName(coord_t x, coord_t y, char * name, uint8_t size, event_t event, ui
|
||||
if (c != v) {
|
||||
if (!(flags & ZCHAR)) {
|
||||
if (v != '\0' || name[editNameCursorPos+1] != '\0')
|
||||
v = idx2char(v);
|
||||
v = zchar2char(v);
|
||||
}
|
||||
name[editNameCursorPos] = v;
|
||||
storageDirty(menuVerticalPositions[0] == 0 ? EE_MODEL : EE_GENERAL);
|
||||
storageDirty(isModelMenuDisplayed() ? EE_MODEL : EE_GENERAL);
|
||||
}
|
||||
|
||||
lcdDrawSizedText(x, y, name, size, flags);
|
||||
coord_t left = (editNameCursorPos == 0 ? 0 : getTextWidth(name, editNameCursorPos, flags));
|
||||
char s[] = { (flags & ZCHAR) ? idx2char(name[editNameCursorPos]) : name[editNameCursorPos], '\0' };
|
||||
char s[] = { (flags & ZCHAR) ? zchar2char(name[editNameCursorPos]) : name[editNameCursorPos], '\0' };
|
||||
lcdDrawSolidFilledRect(x+left-1, y, getTextWidth(s, 1)+1, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawText(x+left, y, s, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
|
||||
@@ -48,13 +48,20 @@ extern uint8_t menuVerticalPositions[4];
|
||||
extern uint8_t menuLevel;
|
||||
extern event_t menuEvent;
|
||||
|
||||
/// goto given Menu, but substitute current menu in menuStack
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
/// goto given Menu, store current menu in menuStack
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
/// return to last menu in menuStack
|
||||
void popMenu();
|
||||
|
||||
inline bool isRadioMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 1;
|
||||
}
|
||||
|
||||
inline bool isModelMenuDisplayed()
|
||||
{
|
||||
return menuVerticalPositions[0] == 0;
|
||||
}
|
||||
|
||||
enum MenuIcons {
|
||||
ICON_OPENTX,
|
||||
ICON_RADIO,
|
||||
@@ -258,7 +265,6 @@ typedef uint16_t FlightModesType;
|
||||
|
||||
extern int8_t checkIncDec_Ret; // global helper vars
|
||||
|
||||
#define EDIT_SELECT_MENU -1
|
||||
#define EDIT_SELECT_FIELD 0
|
||||
#define EDIT_MODIFY_FIELD 1
|
||||
#define EDIT_MODIFY_STRING 2
|
||||
@@ -274,7 +280,8 @@ extern int8_t s_editMode; // global editmode
|
||||
#define NO_DBLKEYS 0x80
|
||||
|
||||
// mawrow special values
|
||||
#define TITLE_ROW ((uint8_t)-1)
|
||||
#define READONLY_ROW ((uint8_t)-1)
|
||||
#define TITLE_ROW READONLY_ROW
|
||||
#define ORPHAN_ROW ((uint8_t)-2)
|
||||
#define HIDDEN_ROW ((uint8_t)-3)
|
||||
#define NAVIGATION_LINE_BY_LINE 0x40
|
||||
@@ -469,28 +476,25 @@ void showMessageBox(const char * title);
|
||||
void runPopupWarning(event_t event);
|
||||
|
||||
extern void (* popupFunc)(event_t event);
|
||||
extern int16_t warningInputValue;
|
||||
extern int16_t warningInputValueMin;
|
||||
extern int16_t warningInputValueMax;
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#define DISPLAY_WARNING (*popupFunc)
|
||||
|
||||
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_WARNING(s) (warningType = WARNING_TYPE_ASTERISK, warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_CONFIRMATION(s) (warningText = s, warningType = WARNING_TYPE_CONFIRM, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func, start, min, max) (warningText = s, warningType = WARNING_TYPE_INPUT, popupFunc = func, warningInputValue = start, warningInputValueMin = min, warningInputValueMax = max)
|
||||
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
|
||||
#define WARNING_INFO_FLAGS warningInfoFlags
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
|
||||
#define NAVIGATION_MENUS
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuNoItems < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuNoItems++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuNoItems ? s : popupMenuNoItems) : 0)
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) s_menu_item = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount) : 0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 9
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
#define POPUP_MENU_SET_BSS_FLAG()
|
||||
extern const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
extern uint16_t popupMenuNoItems;
|
||||
extern uint16_t popupMenuItemsCount;
|
||||
extern uint16_t popupMenuOffset;
|
||||
enum {
|
||||
MENU_OFFSET_INTERNAL,
|
||||
@@ -501,6 +505,15 @@ extern uint8_t s_menu_item;
|
||||
const char * runPopupMenu(event_t event);
|
||||
extern void (*popupMenuHandler)(const char * result);
|
||||
|
||||
inline void POPUP_CONFIRMATION(const char *s, void (* confirmHandler)(const char *) = nullptr)
|
||||
{
|
||||
warningText = s;
|
||||
warningType = WARNING_TYPE_CONFIRM;
|
||||
warningInfoText = nullptr;
|
||||
popupFunc = runPopupWarning;
|
||||
popupMenuHandler = confirmHandler;
|
||||
}
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void pushMenuTextView(const char * filename);
|
||||
|
||||
@@ -25,16 +25,36 @@ void drawCurve(int x, int y, int width)
|
||||
drawFunction(applyCurrentCurve, x, y, width);
|
||||
}
|
||||
|
||||
void displayPresetChoice(event_t event)
|
||||
void runPopupCurvePreset(event_t event)
|
||||
{
|
||||
runPopupWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45*warningInputValue/4, LEFT|INVERS, 0, NULL, "@");
|
||||
warningResult = false;
|
||||
|
||||
theme->drawMessageBox(warningText, warningInfoText, STR_POPUPS_ENTER_EXIT, warningType);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
warningResult = true;
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
|
||||
default:
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
reusableBuffer.curveEdit.preset = checkIncDec(event, reusableBuffer.curveEdit.preset, -4, +4);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y-10, 45 * reusableBuffer.curveEdit.preset / 4, LEFT|INVERS, 0, NULL, "@");
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
int k = 25 * warningInputValue;
|
||||
int k = 25 * reusableBuffer.curveEdit.preset;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
int x = -1000 + i * dx;
|
||||
@@ -49,7 +69,8 @@ void displayPresetChoice(event_t event)
|
||||
void onCurveOneMenu(const char * result)
|
||||
{
|
||||
if (result == STR_CURVE_PRESET) {
|
||||
POPUP_INPUT(STR_PRESET, displayPresetChoice, 0, -4, 4);
|
||||
reusableBuffer.curveEdit.preset = 4; // 45°
|
||||
POPUP_INPUT(STR_PRESET, runPopupCurvePreset);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
|
||||
@@ -29,7 +29,7 @@ void onModelCustomScriptMenu(const char *result)
|
||||
POPUP_WARNING(STR_NO_SCRIPTS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a lua file in the list
|
||||
copySelection(sd.file, result, sizeof(sd.file));
|
||||
memset(sd.inputs, 0, sizeof(sd.inputs));
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
bool menuModelFailsafe(event_t event)
|
||||
{
|
||||
uint8_t ch = 0;
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
const uint8_t SLIDER_W = 128;
|
||||
const uint8_t cols = sentModuleChannels(g_moduleIdx) > 8 ? 2 : 1;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", ICON_STATS_ANALOGS, sentModuleChannels(g_moduleIdx)+1, OPTION_MENU_NO_SCROLLBAR);
|
||||
drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR);
|
||||
|
||||
for (uint8_t col=0; col < cols; col++) {
|
||||
for (uint8_t line=0; line < 8; line++) {
|
||||
coord_t x = col*(LCD_W/2);
|
||||
const coord_t y = MENU_CONTENT_TOP - FH + line*(FH+2);
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.failsafeChannels[8*col+line];
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (g_model.limitData[ch+channelStart].name[0] != '\0') {
|
||||
putsChn(x+MENUS_MARGIN_LEFT, y-3, ch+1, TINSIZE);
|
||||
lcdDrawSizedText(x+MENUS_MARGIN_LEFT, y+5, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR|SMLSIZE);
|
||||
}
|
||||
else {
|
||||
putsChn(x+MENUS_MARGIN_LEFT, y, ch+1, 0);
|
||||
}
|
||||
|
||||
// Value
|
||||
LcdFlags flags = RIGHT;
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.failsafeChannels[8*col+line], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x += (LCD_W/2)-4-MENUS_MARGIN_LEFT-SLIDER_W;
|
||||
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(x, y+2, "HOLD", flags|SMLSIZE);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(x, y+2, "NONE", flags|SMLSIZE);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(x, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue), PREC1|flags);
|
||||
#else
|
||||
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue)/10, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
x += 4;
|
||||
lcdDrawRect(x, y+3, SLIDER_W+1, 12);
|
||||
const coord_t lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
|
||||
const coord_t lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
|
||||
x += SLIDER_W/2;
|
||||
const coord_t xChannel = (channelValue>0) ? x : x+1-lenChannel;
|
||||
const coord_t xFailsafe = (failsafeValue>0) ? x : x+1-lenFailsafe;
|
||||
lcdDrawSolidFilledRect(xChannel, y+4, lenChannel, 5, TEXT_COLOR);
|
||||
lcdDrawSolidFilledRect(xFailsafe, y+9, lenFailsafe, 5, ALARM_COLOR);
|
||||
|
||||
if (++ch >= sentModuleChannels(g_moduleIdx)) {
|
||||
|
||||
// draw that menu at the bottom center
|
||||
flags = CENTERED | (menuVerticalPosition == ch ? INVERS : 0);
|
||||
lcdDrawSizedText(LCD_W/2, MENU_CONTENT_TOP - FH + 8*(FH+2), STR_OUTPUTS2FAILSAFE, 20, flags);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
@@ -82,6 +82,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND,
|
||||
#endif
|
||||
ITEM_MODEL_EXTERNAL_MODULE_POWER,
|
||||
ITEM_MODEL_EXTERNAL_MODULE_FREQ,
|
||||
ITEM_MODEL_TRAINER_LABEL,
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
ITEM_MODEL_TRAINER_LINE1,
|
||||
@@ -97,18 +98,21 @@ enum MenuModelSetupItems {
|
||||
#define MODEL_SETUP_SET_FAILSAFE_OFS 100
|
||||
#define MODEL_SETUP_SLIDPOT_SPACING 45
|
||||
|
||||
#define CURRENT_MODULE_EDITED(k) (k>=ITEM_MODEL_TRAINER_LABEL ? TRAINER_MODULE : (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE))
|
||||
#define CURRENT_MODULE_EDITED(k) (k >= ITEM_MODEL_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE)
|
||||
|
||||
void checkModelIdUnique(uint8_t moduleIdx)
|
||||
{
|
||||
char* warn_buf = reusableBuffer.modelsetup.msg;
|
||||
if(isModulePXX(moduleIdx) && IS_D8_RX(moduleIdx))
|
||||
return;
|
||||
|
||||
char* warn_buf = reusableBuffer.moduleSetup.msg;
|
||||
|
||||
// cannot rely exactly on WARNING_LINE_LEN so using WARNING_LINE_LEN-2
|
||||
size_t warn_buf_len = sizeof(reusableBuffer.modelsetup.msg) - WARNING_LINE_LEN - 2;
|
||||
size_t warn_buf_len = sizeof(reusableBuffer.moduleSetup.msg) - WARNING_LINE_LEN - 2;
|
||||
if (!modelslist.isModelIdUnique(moduleIdx,warn_buf,warn_buf_len)) {
|
||||
if (warn_buf[0] != 0) {
|
||||
POPUP_WARNING(STR_MODELIDUSED);
|
||||
SET_WARNING_INFO(warn_buf, sizeof(reusableBuffer.modelsetup.msg), 0);
|
||||
SET_WARNING_INFO(warn_buf, sizeof(reusableBuffer.moduleSetup.msg), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -137,7 +141,7 @@ void onBindMenu(const char * result)
|
||||
return;
|
||||
}
|
||||
|
||||
moduleFlag[moduleIdx] = MODULE_BIND;
|
||||
moduleSettings[moduleIdx].mode = MODULE_MODE_BIND;
|
||||
}
|
||||
|
||||
void onModelSetupBitmapMenu(const char * result)
|
||||
@@ -147,7 +151,7 @@ void onModelSetupBitmapMenu(const char * result)
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a bmp file in the list
|
||||
copySelection(g_model.header.bitmap, result, sizeof(g_model.header.bitmap));
|
||||
storageDirty(EE_MODEL);
|
||||
@@ -231,12 +235,12 @@ int getSwitchWarningsCount()
|
||||
#define IF_EXTERNAL_MODULE_ON(x) (IS_EXTERNAL_MODULE_ENABLED() ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
|
||||
#define INTERNAL_MODULE_MODE_ROWS (uint8_t)0
|
||||
#define INTERNAL_MODULE_CHANNELS_ROWS IF_INTERNAL_MODULE_ON(1)
|
||||
#define PORT_CHANNELS_ROWS(x) (x==INTERNAL_MODULE ? INTERNAL_MODULE_CHANNELS_ROWS : (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 1))
|
||||
|
||||
#define TIMER_ROWS(x) NAVIGATION_LINE_BY_LINE|1, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0
|
||||
|
||||
#define EXTERNAL_MODULE_MODE_ROWS (isModulePXX(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE)) ? (uint8_t)1 : isModuleMultimodule(EXTERNAL_MODULE) ? MULTIMODULE_MODE_ROWS(EXTERNAL_MODULE) : (uint8_t)0
|
||||
#define EXTERNAL_MODULE_MODE_ROWS (isModuleXJT(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE) || isModuleMultimodule(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0
|
||||
#define EXTRA_MODULE_ROWS isR9MMFlex(EXTERNAL_MODULE) ? (uint8_t)1: (uint8_t)HIDDEN_ROW,
|
||||
|
||||
#if TIMERS == 1
|
||||
#define TIMERS_ROWS TIMER_ROWS(0)
|
||||
@@ -252,8 +256,8 @@ int getSwitchWarningsCount()
|
||||
#define SLIDER_WARN_ITEMS() ((g_model.potsWarnMode) ? uint8_t(NAVIGATION_LINE_BY_LINE|(NUM_SLIDERS-1)) : (uint8_t)0)
|
||||
|
||||
#define TRAINER_LINE1_BLUETOOTH_M_ROWS ((bluetoothDistantAddr[0] == 0 || bluetoothState == BLUETOOTH_STATE_CONNECTED) ? (uint8_t)0 : (uint8_t)1)
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerMode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerMode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_LINE1_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)1 : (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_LINE1_BLUETOOTH_M_ROWS : (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH ? (uint8_t)1 : HIDDEN_ROW)))
|
||||
#define TRAINER_LINE2_ROWS (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
|
||||
bool menuModelSetup(event_t event)
|
||||
{
|
||||
@@ -285,18 +289,19 @@ bool menuModelSetup(event_t event)
|
||||
EXTERNAL_MODULE_OPTION_ROW,
|
||||
MULTIMODULE_MODULE_ROWS
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
EXTRA_MODULE_ROWS
|
||||
LABEL(Trainer),
|
||||
0,
|
||||
TRAINER_LINE1_ROWS,
|
||||
TRAINER_LINE2_ROWS });
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
moduleFlag[0] = 0;
|
||||
moduleFlag[1] = 0;
|
||||
moduleSettings[0].mode = 0;
|
||||
moduleSettings[1].mode = 0;
|
||||
}
|
||||
|
||||
int sub = menuVerticalPosition;
|
||||
@@ -675,7 +680,7 @@ bool menuModelSetup(event_t event)
|
||||
|
||||
case ITEM_MODEL_TRAINER_MODE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODE);
|
||||
g_model.trainerMode = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerMode, 0, TRAINER_MODE_MAX(), attr, event);
|
||||
g_model.trainerData.mode = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_VTRAINERMODES, g_model.trainerData.mode, 0, TRAINER_MODE_MAX(), attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
bluetoothState = BLUETOOTH_STATE_OFF;
|
||||
bluetoothDistantAddr[0] = 0;
|
||||
@@ -693,8 +698,8 @@ bool menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_XJT_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (isModuleR9M(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].subType, (menuHorizontalPosition==1 ? attr : 0));
|
||||
else if (isR9ModuleRunning(EXTERNAL_MODULE))
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_3RD_COLUMN, y, STR_R9M_REGION, g_model.moduleData[EXTERNAL_MODULE].r9m.region, (menuHorizontalPosition==1 ? attr : 0));
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
int multi_rfProto = g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
||||
@@ -714,7 +719,9 @@ bool menuModelSetup(event_t event)
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_COUNT-1, EE_MODEL, isModuleAvailable);
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type,
|
||||
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, EE_MODEL,
|
||||
isExternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
@@ -728,15 +735,6 @@ bool menuModelSetup(event_t event)
|
||||
case 1:
|
||||
if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
|
||||
else if (isModuleR9M(EXTERNAL_MODULE)) {
|
||||
uint8_t newR9MType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].subType, MODULE_SUBTYPE_R9M_FCC, MODULE_SUBTYPE_R9M_LAST, EE_MODEL, isR9MModeAvailable);
|
||||
if (newR9MType != g_model.moduleData[EXTERNAL_MODULE].subType && newR9MType > MODULE_SUBTYPE_R9M_EU) {
|
||||
POPUP_WARNING(STR_R9MFLEXWARN1);
|
||||
const char * w = STR_R9MFLEXWARN2;
|
||||
SET_WARNING_INFO(w, strlen(w), 0);
|
||||
}
|
||||
g_model.moduleData[EXTERNAL_MODULE].subType = newR9MType;
|
||||
}
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
int multiRfProto = g_model.moduleData[EXTERNAL_MODULE].multi.customProto == 1 ? MM_RF_PROTO_CUSTOM : g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
|
||||
@@ -790,7 +788,7 @@ bool menuModelSetup(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_TRAINER_LINE1:
|
||||
if (g_model.trainerMode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH) {
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
@@ -864,9 +862,28 @@ bool menuModelSetup(event_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_MODEL_TRAINER_LINE2:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_PPMFRAME);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.trainerData.frameLength*5 + 225, (menuHorizontalPosition<=0 ? attr : 0) | PREC1|LEFT, 0, NULL, STR_MS);
|
||||
lcdDrawNumber(MODEL_SETUP_2ND_COLUMN+80, y, (g_model.trainerData.delay*50)+300, (CURSOR_ON_LINE() || menuHorizontalPosition==1) ? attr|LEFT : LEFT, 0, NULL, "us");
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN+160, y, g_model.trainerData.pulsePol ? "+" : "-", (CURSOR_ON_LINE() || menuHorizontalPosition==2) ? attr : 0);
|
||||
if (attr && s_editMode>0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.trainerData.frameLength, -20, 35);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.trainerData.delay, -4, 10);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.trainerData.pulsePol, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_INTERNAL_MODULE_BIND:
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_BIND:
|
||||
case ITEM_MODEL_TRAINER_LINE2:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
@@ -932,8 +949,8 @@ bool menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
}
|
||||
drawButton(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, (moduleFlag[moduleIdx] == MODULE_BIND ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==1 ? attr : 0));
|
||||
drawButton(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, (moduleFlag[moduleIdx] == MODULE_RANGECHECK ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==2 ? attr : 0));
|
||||
drawButton(MODEL_SETUP_2ND_COLUMN+xOffsetBind, y, STR_MODULE_BIND, (moduleSettings[moduleIdx].mode == MODULE_MODE_BIND ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==1 ? attr : 0));
|
||||
drawButton(MODEL_SETUP_2ND_COLUMN+MODEL_SETUP_RANGE_OFS+xOffsetBind, y, STR_MODULE_RANGE, (moduleSettings[moduleIdx].mode == MODULE_MODE_RANGECHECK ? BUTTON_ON : BUTTON_OFF) | (l_posHorz==2 ? attr : 0));
|
||||
uint8_t newFlag = 0;
|
||||
#if defined(MULTIMODULE)
|
||||
if (multiBindStatus == MULTI_BIND_FINISHED) {
|
||||
@@ -969,27 +986,27 @@ bool menuModelSetup(event_t event)
|
||||
POPUP_MENU_START(onBindMenu);
|
||||
continue;
|
||||
}
|
||||
if (moduleFlag[moduleIdx] == MODULE_BIND) {
|
||||
newFlag = MODULE_BIND;
|
||||
if (moduleSettings[moduleIdx].mode == MODULE_MODE_BIND) {
|
||||
newFlag = MODULE_MODE_BIND;
|
||||
}
|
||||
else {
|
||||
if (!popupMenuNoItems) {
|
||||
if (!popupMenuItemsCount) {
|
||||
s_editMode = 0; // this is when popup is exited before a choice is made
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
newFlag = MODULE_BIND;
|
||||
newFlag = MODULE_MODE_BIND;
|
||||
}
|
||||
}
|
||||
else if (l_posHorz == 2) {
|
||||
newFlag = MODULE_RANGECHECK;
|
||||
newFlag = MODULE_MODE_RANGECHECK;
|
||||
}
|
||||
}
|
||||
}
|
||||
moduleFlag[moduleIdx] = newFlag;
|
||||
moduleSettings[moduleIdx].mode = newFlag;
|
||||
#if defined(MULTIMODULE)
|
||||
if (newFlag == MODULE_BIND)
|
||||
if (newFlag == MODULE_MODE_BIND)
|
||||
multiBindStatus = MULTI_BIND_INITIATED;
|
||||
#endif
|
||||
}
|
||||
@@ -1068,16 +1085,7 @@ bool menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (isModuleR9M(moduleIdx)) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MODULE_TELEMETRY);
|
||||
if (IS_TELEMETRY_INTERNAL_MODULE()) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_DISABLE_INTERNAL);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_TELEM_ON);
|
||||
}
|
||||
}
|
||||
else if (isModuleSBUS(moduleIdx)) {
|
||||
if (isModuleSBUS(moduleIdx)) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WARN_BATTVOLTAGE);
|
||||
drawValueWithUnit(MODEL_SETUP_4TH_COLUMN, y, getBatteryVoltage(), UNIT_VOLTS, attr|PREC2|LEFT);
|
||||
}
|
||||
@@ -1098,12 +1106,12 @@ bool menuModelSetup(event_t event)
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9M_LBT_POWER_VALUES, g_model.moduleData[moduleIdx].pxx.power, LEFT | attr);
|
||||
if (attr)
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].pxx.power, 0, R9M_LBT_POWER_MAX);
|
||||
if (attr && s_editMode == 0 && reusableBuffer.modelsetup.r9mPower != g_model.moduleData[moduleIdx].pxx.power) {
|
||||
if((reusableBuffer.modelsetup.r9mPower + g_model.moduleData[moduleIdx].pxx.power) < 5) { //switching between mode 2 and 3 does not require rebind
|
||||
if (attr && s_editMode == 0 && reusableBuffer.moduleSetup.r9mPower != g_model.moduleData[moduleIdx].pxx.power) {
|
||||
if((reusableBuffer.moduleSetup.r9mPower + g_model.moduleData[moduleIdx].pxx.power) < 5) { //switching between mode 2 and 3 does not require rebind
|
||||
POPUP_WARNING(STR_WARNING);
|
||||
SET_WARNING_INFO(STR_REBIND, sizeof(TR_REBIND), 0);
|
||||
}
|
||||
reusableBuffer.modelsetup.r9mPower = g_model.moduleData[moduleIdx].pxx.power;
|
||||
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[moduleIdx].pxx.power;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1116,6 +1124,18 @@ bool menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_FREQ:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_FREQUENCY);
|
||||
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_R9MFLEX_FREQ, g_model.moduleData[moduleIdx].r9m.freq, LEFT | attr);
|
||||
if (attr)
|
||||
{
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[moduleIdx].r9m.freq, 1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
case ITEM_MODEL_EXTERNAL_MODULE_AUTOBIND:
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MM_RF_PROTO_DSM2)
|
||||
@@ -1180,118 +1200,3 @@ bool menuModelSetup(event_t event)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool menuModelFailsafe(event_t event)
|
||||
{
|
||||
uint8_t ch = 0;
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
const uint8_t SLIDER_W = 128;
|
||||
const uint8_t cols = sentModuleChannels(g_moduleIdx) > 8 ? 2 : 1;
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
|
||||
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_WITH_OPTIONS("FAILSAFE", ICON_STATS_ANALOGS, sentModuleChannels(g_moduleIdx)+1, OPTION_MENU_NO_SCROLLBAR);
|
||||
drawStringWithIndex(50, 3+FH, "Module", g_moduleIdx+1, MENU_TITLE_COLOR);
|
||||
|
||||
for (uint8_t col=0; col < cols; col++) {
|
||||
for (uint8_t line=0; line < 8; line++) {
|
||||
coord_t x = col*(LCD_W/2);
|
||||
const coord_t y = MENU_CONTENT_TOP - FH + line*(FH+2);
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line];
|
||||
|
||||
// Channel name if present, number if not
|
||||
if (g_model.limitData[ch+channelStart].name[0] != '\0') {
|
||||
putsChn(x+MENUS_MARGIN_LEFT, y-3, ch+1, TINSIZE);
|
||||
lcdDrawSizedText(x+MENUS_MARGIN_LEFT, y+5, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR|SMLSIZE);
|
||||
}
|
||||
else {
|
||||
putsChn(x+MENUS_MARGIN_LEFT, y, ch+1, 0);
|
||||
}
|
||||
|
||||
// Value
|
||||
LcdFlags flags = RIGHT;
|
||||
if (menuVerticalPosition == ch) {
|
||||
flags |= INVERS;
|
||||
if (s_editMode) {
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD || failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
flags |= BLINK;
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line], -lim, +lim);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x += (LCD_W/2)-4-MENUS_MARGIN_LEFT-SLIDER_W;
|
||||
|
||||
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
|
||||
lcdDrawText(x, y+2, "HOLD", flags|SMLSIZE);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
|
||||
lcdDrawText(x, y+2, "NONE", flags|SMLSIZE);
|
||||
failsafeValue = 0;
|
||||
}
|
||||
else {
|
||||
#if defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(x, y, PPM_CH_CENTER(ch)+failsafeValue/2, flags);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue), PREC1|flags);
|
||||
#else
|
||||
lcdDrawNumber(x, y, calcRESXto1000(failsafeValue)/10, flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gauge
|
||||
x += 4;
|
||||
lcdDrawRect(x, y+3, SLIDER_W+1, 12);
|
||||
const coord_t lenChannel = limit((uint8_t)1, uint8_t((abs(channelValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
|
||||
const coord_t lenFailsafe = limit((uint8_t)1, uint8_t((abs(failsafeValue) * SLIDER_W/2 + lim/2) / lim), uint8_t(SLIDER_W/2));
|
||||
x += SLIDER_W/2;
|
||||
const coord_t xChannel = (channelValue>0) ? x : x+1-lenChannel;
|
||||
const coord_t xFailsafe = (failsafeValue>0) ? x : x+1-lenFailsafe;
|
||||
lcdDrawSolidFilledRect(xChannel, y+4, lenChannel, 5, TEXT_COLOR);
|
||||
lcdDrawSolidFilledRect(xFailsafe, y+9, lenFailsafe, 5, ALARM_COLOR);
|
||||
|
||||
if (++ch >= sentModuleChannels(g_moduleIdx)) {
|
||||
|
||||
// draw that menu at the bottom center
|
||||
flags = CENTERED | (menuVerticalPosition == ch ? INVERS : 0);
|
||||
lcdDrawSizedText(LCD_W/2, MENU_CONTENT_TOP - FH + 8*(FH+2), STR_OUTPUTS2FAILSAFE, 20, flags);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
POPUP_WARNING(func==FUNC_PLAY_SCRIPT ? STR_NO_SCRIPTS_ON_SD : STR_NO_SOUNDS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
// The user choosed a file in the list
|
||||
memcpy(cf->play.name, result, sizeof(cf->play.name));
|
||||
storageDirty(eeFlags);
|
||||
@@ -128,7 +128,7 @@ void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
CFN_PARAM(cfn) = 0;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
onSourceLongEnterPress(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,38 @@ enum MenuModelTelemetryFrskyItems {
|
||||
ITEM_TELEMETRY_SENSOR30,
|
||||
ITEM_TELEMETRY_SENSOR31,
|
||||
ITEM_TELEMETRY_SENSOR32,
|
||||
ITEM_TELEMETRY_SENSOR33,
|
||||
ITEM_TELEMETRY_SENSOR34,
|
||||
ITEM_TELEMETRY_SENSOR35,
|
||||
ITEM_TELEMETRY_SENSOR36,
|
||||
ITEM_TELEMETRY_SENSOR37,
|
||||
ITEM_TELEMETRY_SENSOR38,
|
||||
ITEM_TELEMETRY_SENSOR39,
|
||||
ITEM_TELEMETRY_SENSOR40,
|
||||
ITEM_TELEMETRY_SENSOR41,
|
||||
ITEM_TELEMETRY_SENSOR42,
|
||||
ITEM_TELEMETRY_SENSOR43,
|
||||
ITEM_TELEMETRY_SENSOR44,
|
||||
ITEM_TELEMETRY_SENSOR45,
|
||||
ITEM_TELEMETRY_SENSOR46,
|
||||
ITEM_TELEMETRY_SENSOR47,
|
||||
ITEM_TELEMETRY_SENSOR48,
|
||||
ITEM_TELEMETRY_SENSOR49,
|
||||
ITEM_TELEMETRY_SENSOR50,
|
||||
ITEM_TELEMETRY_SENSOR51,
|
||||
ITEM_TELEMETRY_SENSOR52,
|
||||
ITEM_TELEMETRY_SENSOR53,
|
||||
ITEM_TELEMETRY_SENSOR54,
|
||||
ITEM_TELEMETRY_SENSOR55,
|
||||
ITEM_TELEMETRY_SENSOR56,
|
||||
ITEM_TELEMETRY_SENSOR57,
|
||||
ITEM_TELEMETRY_SENSOR58,
|
||||
ITEM_TELEMETRY_SENSOR59,
|
||||
ITEM_TELEMETRY_SENSOR60,
|
||||
ITEM_TELEMETRY_SENSOR61,
|
||||
ITEM_TELEMETRY_SENSOR62,
|
||||
ITEM_TELEMETRY_SENSOR63,
|
||||
ITEM_TELEMETRY_SENSOR64,
|
||||
ITEM_TELEMETRY_DISCOVER_SENSORS,
|
||||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
@@ -82,7 +114,8 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#define IS_RANGE_DEFINED(k) (g_model.frsky.channels[k].ratio > 0)
|
||||
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), 0, 0, 0, 0,
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), \
|
||||
SENSOR_ROWS(31), SENSOR_ROWS(32), SENSOR_ROWS(33), SENSOR_ROWS(34), SENSOR_ROWS(35), SENSOR_ROWS(36), SENSOR_ROWS(37), SENSOR_ROWS(38), SENSOR_ROWS(39), SENSOR_ROWS(40),SENSOR_ROWS(41), SENSOR_ROWS(42), SENSOR_ROWS(43), SENSOR_ROWS(44), SENSOR_ROWS(45), SENSOR_ROWS(46), SENSOR_ROWS(47), SENSOR_ROWS(48), SENSOR_ROWS(49), SENSOR_ROWS(50),SENSOR_ROWS(51), SENSOR_ROWS(52), SENSOR_ROWS(53), SENSOR_ROWS(54), SENSOR_ROWS(55), SENSOR_ROWS(56), SENSOR_ROWS(57), SENSOR_ROWS(58), SENSOR_ROWS(59),SENSOR_ROWS(60),SENSOR_ROWS(61), SENSOR_ROWS(62), SENSOR_ROWS(63), 0, 0, 0, 0,
|
||||
#if defined(VARIO)
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#else
|
||||
|
||||
@@ -26,13 +26,10 @@ uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
int16_t warningInputValue;
|
||||
int16_t warningInputValueMin;
|
||||
int16_t warningInputValueMax;
|
||||
void (*popupFunc)(event_t event) = NULL;
|
||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
uint8_t s_menu_item = 0;
|
||||
uint16_t popupMenuNoItems = 0;
|
||||
uint16_t popupMenuItemsCount = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupMenuHandler)(const char * result);
|
||||
@@ -80,24 +77,20 @@ void runPopupWarning(event_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
|
||||
theme->drawMessageBox(warningText, warningInfoText, warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS, warningType);
|
||||
theme->drawMessageBox(warningText, warningInfoText, WARNING_TYPE_INFO ? STR_OK : (warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS_ENTER_EXIT), warningType);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
break;
|
||||
warningResult = true;
|
||||
if (warningType != WARNING_TYPE_INFO)
|
||||
warningResult = true;
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
warningText = NULL;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
default:
|
||||
if (warningType != WARNING_TYPE_INPUT) break;
|
||||
s_editMode = EDIT_MODIFY_FIELD;
|
||||
warningInputValue = checkIncDec(event, warningInputValue, warningInputValueMin, warningInputValueMax);
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +98,7 @@ const char * runPopupMenu(event_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
|
||||
uint8_t display_count = min<unsigned int>(popupMenuNoItems, MENU_MAX_DISPLAY_LINES);
|
||||
uint8_t display_count = min<unsigned int>(popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
||||
|
||||
switch (event) {
|
||||
case EVT_ROTARY_LEFT:
|
||||
@@ -118,18 +111,18 @@ const char * runPopupMenu(event_t event)
|
||||
}
|
||||
else {
|
||||
s_menu_item = min<uint8_t>(display_count, MENU_MAX_DISPLAY_LINES) - 1;
|
||||
if (popupMenuNoItems > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - MENU_MAX_DISPLAY_LINES;
|
||||
if (popupMenuItemsCount > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuItemsCount - MENU_MAX_DISPLAY_LINES;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
|
||||
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuItemsCount) {
|
||||
s_menu_item++;
|
||||
}
|
||||
else if (popupMenuNoItems > popupMenuOffset + display_count) {
|
||||
else if (popupMenuItemsCount > popupMenuOffset + display_count) {
|
||||
popupMenuOffset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
@@ -147,7 +140,7 @@ const char * runPopupMenu(event_t event)
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
popupMenuNoItems = 0;
|
||||
popupMenuItemsCount = 0;
|
||||
s_menu_item = 0;
|
||||
popupMenuOffset = 0;
|
||||
break;
|
||||
@@ -168,8 +161,8 @@ const char * runPopupMenu(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (popupMenuNoItems > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, MENU_MAX_DISPLAY_LINES);
|
||||
if (popupMenuItemsCount > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <io/frsky_device_firmware_update.h>
|
||||
#include "opentx.h"
|
||||
#include "storage/modelslist.h"
|
||||
|
||||
@@ -141,15 +142,18 @@ void onSdManagerMenu(const char * result)
|
||||
}
|
||||
else if (result == STR_FLASH_INTERNAL_MODULE) {
|
||||
getSelectionFullPath(lfn);
|
||||
sportFlashDevice(INTERNAL_MODULE, lfn);
|
||||
DeviceFirmwareUpdate device(INTERNAL_MODULE);
|
||||
device.flashFile(lfn);
|
||||
}
|
||||
else if (result == STR_FLASH_EXTERNAL_MODULE) {
|
||||
getSelectionFullPath(lfn);
|
||||
sportFlashDevice(EXTERNAL_MODULE, lfn);
|
||||
DeviceFirmwareUpdate device(EXTERNAL_MODULE);
|
||||
device.flashFile(lfn);
|
||||
}
|
||||
else if (result == STR_FLASH_EXTERNAL_DEVICE) {
|
||||
getSelectionFullPath(lfn);
|
||||
sportFlashDevice(FLASHING_MODULE, lfn);
|
||||
DeviceFirmwareUpdate device(SPORT_MODULE);
|
||||
device.flashFile(lfn);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (result == STR_EXECUTE_FILE) {
|
||||
|
||||
@@ -403,10 +403,12 @@ bool menuRadioSetup(event_t event)
|
||||
g_eeGeneral.gpsFormat = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_GPSFORMAT, g_eeGeneral.gpsFormat, 0, 1, attr, event);
|
||||
break;
|
||||
|
||||
#if defined(PXX)
|
||||
case ITEM_SETUP_COUNTRYCODE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_COUNTRYCODE);
|
||||
g_eeGeneral.countryCode = editChoice(RADIO_SETUP_2ND_COLUMN, y, STR_COUNTRYCODES, g_eeGeneral.countryCode, 0, 2, attr, event);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_LANGUAGE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_VOICELANG);
|
||||
|
||||
@@ -53,7 +53,7 @@ void onZoneOptionFileSelectionMenu(const char * result)
|
||||
POPUP_WARNING(STR_NO_BITMAPS_ON_SD);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (result != STR_EXIT) {
|
||||
fileSelectionDone = true;
|
||||
memcpy(fileSelection, result, sizeof(fileSelection));
|
||||
}
|
||||
|
||||
@@ -136,12 +136,10 @@ class DarkblueTheme: public Theme
|
||||
|
||||
delete calibHorus;
|
||||
#if defined(PCBX10)
|
||||
if(STICKS_PWM_ENABLED()) {
|
||||
if (STICKS_PWM_ENABLED())
|
||||
calibHorus = BitmapBuffer::load(getThemePath("X10S.bmp"));
|
||||
}
|
||||
else {
|
||||
else
|
||||
calibHorus = BitmapBuffer::load(getThemePath("X10.bmp"));
|
||||
}
|
||||
#else
|
||||
calibHorus = BitmapBuffer::load(getThemePath("horus.bmp"));
|
||||
#endif
|
||||
|
||||
@@ -108,12 +108,12 @@ void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, u
|
||||
}
|
||||
}
|
||||
|
||||
void drawProgressBar(const char * label, int num, int den)
|
||||
void drawProgressScreen(const char * title, const char * message, int num, int den)
|
||||
{
|
||||
lcdClear();
|
||||
lcdSetColor(WHITE);
|
||||
if (label) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, LCD_H-42, label, CUSTOM_COLOR);
|
||||
if (message) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, LCD_H-42, message, CUSTOM_COLOR);
|
||||
}
|
||||
lcdDrawRect(MENUS_MARGIN_LEFT, LCD_H-22, LCD_W-2*MENUS_MARGIN_LEFT, 15, 1, SOLID, CUSTOM_COLOR);
|
||||
lcdSetColor(RED);
|
||||
|
||||
@@ -49,7 +49,7 @@ void drawButton(coord_t x, coord_t y, const char * label, LcdFlags attr);
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr);
|
||||
void drawVerticalScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void drawHorizontalScrollbar(coord_t x, coord_t y, coord_t w, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void drawProgressBar(const char * label, int num, int den);
|
||||
void drawProgressScreen(const char * title, const char * message, int num, int den);
|
||||
void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h);
|
||||
void drawTrimSquare(coord_t x, coord_t y);
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir);
|
||||
|
||||
@@ -9,6 +9,9 @@ set(GUI_SRC
|
||||
menu_model.cpp
|
||||
model_select.cpp
|
||||
model_setup.cpp
|
||||
model_failsafe.cpp
|
||||
model_module_options.cpp
|
||||
model_receiver_options.cpp
|
||||
model_logical_switches.cpp
|
||||
model_special_functions.cpp
|
||||
model_telemetry.cpp
|
||||
|
||||
@@ -46,7 +46,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags
|
||||
|
||||
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags attr, event_t event)
|
||||
{
|
||||
if (attr & INVERS) value = checkIncDec(event, value, min, max, (menuVerticalPositions[0] == 0) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr & INVERS) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -28,5 +28,15 @@ if(SDCARD)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/radio_sdmanager.cpp
|
||||
../common/stdlcd/radio_tools.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PXX2)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/radio_spectrum_analyser.cpp
|
||||
../common/stdlcd/radio_power_meter.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -20,33 +20,77 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupFunc)(event_t event) = NULL;
|
||||
const char * warningText = NULL;
|
||||
const char * warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (* popupFunc)(event_t event) = NULL;
|
||||
|
||||
#if defined(NAVIGATION_MENUS)
|
||||
const char * popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
uint8_t s_menu_item = 0;
|
||||
uint16_t popupMenuNoItems = 0;
|
||||
uint8_t popupMenuFlags = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
void (*popupMenuHandler)(const char * result);
|
||||
uint8_t s_menu_item = 0;
|
||||
uint16_t popupMenuItemsCount = 0;
|
||||
uint16_t popupMenuOffset = 0;
|
||||
void (* popupMenuHandler)(const char * result);
|
||||
const char * popupMenuTitle = nullptr;
|
||||
|
||||
void drawMessageBoxBackground(coord_t top, coord_t height)
|
||||
{
|
||||
// white background
|
||||
lcdDrawFilledRect(MESSAGEBOX_X - 1, top - 1, MESSAGEBOX_W + 2, height + 2, SOLID, ERASE);
|
||||
|
||||
// border
|
||||
lcdDrawRect(MESSAGEBOX_X, top, MESSAGEBOX_W, height, SOLID, FORCE);
|
||||
}
|
||||
|
||||
void drawMessageBox(const char * title)
|
||||
{
|
||||
// background + border
|
||||
drawMessageBoxBackground(MESSAGEBOX_Y, 40);
|
||||
|
||||
// title
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN);
|
||||
|
||||
// could be a place for a warningInfoText
|
||||
}
|
||||
|
||||
void showMessageBox(const char * title)
|
||||
{
|
||||
drawMessageBox(title);
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
const char * runPopupMenu(event_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
const char * result = nullptr;
|
||||
|
||||
uint8_t display_count = min<uint8_t>(popupMenuNoItems, MENU_MAX_DISPLAY_LINES);
|
||||
uint8_t y = (display_count >= 5 ? MENU_Y - FH - 1 : MENU_Y);
|
||||
lcdDrawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2, SOLID, ERASE);
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 2);
|
||||
uint8_t display_count = min<uint8_t>(popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
||||
uint8_t y = LCD_H / 2 - (popupMenuTitle ? 0 : 3) - (display_count * FH / 2);
|
||||
|
||||
// white background
|
||||
lcdDrawFilledRect(MENU_X - 1, popupMenuTitle ? y - FH - 3 : y - 1, MENU_W + 2, display_count * (FH + 1) + (popupMenuTitle ? FH + 6 : 4), SOLID, ERASE);
|
||||
|
||||
// title
|
||||
if (popupMenuTitle) {
|
||||
lcdDrawText(MENU_X + 2, y - FH, popupMenuTitle, BOLD);
|
||||
lcdDrawRect(MENU_X, y - FH - 2, lcdLastRightPos - MENU_X + 2, FH + 3);
|
||||
}
|
||||
|
||||
// border
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH + 1) + 2, SOLID, FORCE);
|
||||
|
||||
// items
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
lcdDrawText(MENU_X+6, i*(FH+1) + y + 2, popupMenuItems[i+(popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)], 0);
|
||||
if (i == s_menu_item) lcdDrawSolidFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 9);
|
||||
}
|
||||
|
||||
if (popupMenuNoItems > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuNoItems, display_count);
|
||||
// scrollbar
|
||||
if (popupMenuItemsCount > display_count) {
|
||||
drawVerticalScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), popupMenuOffset, popupMenuItemsCount, display_count);
|
||||
}
|
||||
|
||||
switch (event) {
|
||||
@@ -67,8 +111,8 @@ const char * runPopupMenu(event_t event)
|
||||
else {
|
||||
s_menu_item = min<uint8_t>(display_count, MENU_MAX_DISPLAY_LINES) - 1;
|
||||
#if defined(SDCARD)
|
||||
if (popupMenuNoItems > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuNoItems - display_count;
|
||||
if (popupMenuItemsCount > MENU_MAX_DISPLAY_LINES) {
|
||||
popupMenuOffset = popupMenuItemsCount - display_count;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
#endif
|
||||
@@ -80,11 +124,11 @@ const char * runPopupMenu(event_t event)
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
case EVT_KEY_REPT(KEY_DOWN):
|
||||
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuNoItems) {
|
||||
if (s_menu_item < display_count - 1 && popupMenuOffset + s_menu_item + 1 < popupMenuItemsCount) {
|
||||
s_menu_item++;
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
else if (popupMenuNoItems > popupMenuOffset + display_count) {
|
||||
else if (popupMenuItemsCount > popupMenuOffset + display_count) {
|
||||
popupMenuOffset++;
|
||||
result = STR_UPDATE_LIST;
|
||||
}
|
||||
@@ -105,7 +149,11 @@ const char * runPopupMenu(event_t event)
|
||||
#endif
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
result = popupMenuItems[s_menu_item + (popupMenuOffsetType == MENU_OFFSET_INTERNAL ? popupMenuOffset : 0)];
|
||||
// no break
|
||||
popupMenuItemsCount = 0;
|
||||
s_menu_item = 0;
|
||||
popupMenuOffset = 0;
|
||||
popupMenuTitle = nullptr;
|
||||
break;
|
||||
|
||||
#if defined(CASE_EVT_ROTARY_LONG)
|
||||
CASE_EVT_ROTARY_LONG
|
||||
@@ -114,13 +162,83 @@ const char * runPopupMenu(event_t event)
|
||||
#endif
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
popupMenuNoItems = 0;
|
||||
result = STR_EXIT;
|
||||
popupMenuItemsCount = 0;
|
||||
s_menu_item = 0;
|
||||
popupMenuFlags = 0;
|
||||
popupMenuOffset = 0;
|
||||
popupMenuTitle = nullptr;
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
void runPopupWarning(event_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
|
||||
drawMessageBox(warningText);
|
||||
|
||||
if (warningInfoText) {
|
||||
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y+FH, warningInfoText, warningInfoLength, WARNING_INFO_FLAGS);
|
||||
}
|
||||
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y+2*FH, warningType == WARNING_TYPE_INFO ? STR_OK : (warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS_ENTER_EXIT));
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (warningType == WARNING_TYPE_ASTERISK)
|
||||
// key ignored, the user has to press [EXIT]
|
||||
break;
|
||||
|
||||
if (warningType == WARNING_TYPE_CONFIRM) {
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
warningText = nullptr;
|
||||
if (popupMenuHandler)
|
||||
popupMenuHandler(STR_OK);
|
||||
else
|
||||
warningResult = true;
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (warningType == WARNING_TYPE_CONFIRM) {
|
||||
if (popupMenuHandler)
|
||||
popupMenuHandler(STR_EXIT);
|
||||
}
|
||||
warningText = nullptr;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void showAlertBox(const char * title, const char * text, const char * action , uint8_t sound)
|
||||
{
|
||||
drawAlertBox(title, text, action);
|
||||
AUDIO_ERROR_MESSAGE(sound);
|
||||
lcdRefresh();
|
||||
lcdSetContrast();
|
||||
clearKeyEvents();
|
||||
backlightOn();
|
||||
checkBacklight();
|
||||
}
|
||||
|
||||
void drawProgressScreen(const char * title, const char * message, int num, int den)
|
||||
{
|
||||
lcdClear();
|
||||
if (title) {
|
||||
lcdDrawText(LCD_W / 2 - getTextWidth(title) / 2, 2*FH, title);
|
||||
}
|
||||
if (message) {
|
||||
lcdDrawText(4, 5*FH, message);
|
||||
}
|
||||
lcdDrawRect(4, 6*FH+4, LCD_W-8, 7);
|
||||
if (num > 0 && den > 0) {
|
||||
int width = ((LCD_W-12)*num)/den;
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+6, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+7, width, FORCE);
|
||||
lcdDrawSolidHorizontalLine(6, 6*FH+8, width, FORCE);
|
||||
}
|
||||
lcdRefresh();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user