Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed support for Radiomaster TX12 additional switches (SI and SJ) #1303

Merged
merged 4 commits into from
Dec 30, 2021

Conversation

piotrva
Copy link
Contributor

@piotrva piotrva commented Dec 27, 2021

Two connectors are present on TX12 main board (near top of internal TX module) and are mapped as SI (2) and SJ (1), but were not read out by the firmware.

image

With this update they might be used for some further hacking of the radio (ex. adding additional 2-pos switches, adding detector of external module insertion etc.).

Resubmitted PR #1302

Summary of changes:

  • Add readout of SI and SJ switches in switchState

Two connectors are present on TX12 main board (near top of internal TX module) and are mapped as SI and SJ, but were not read out by the firmware.
With this update they might be used for some further hacking of the radio (ex. adding additional 2-pos switches, adding detector of external module insertion etc.).
@pfeerick
Copy link
Member

pfeerick commented Dec 28, 2021

Are the SI/SJ connectors two or three pin (thus two or three position?). I'm assuming two pin, since you defined them as a 2POS, and thus this is needed also to limit them as 2POS max (otherwise 3POS will appear as an option also).

diff --git a/radio/src/gui/common/stdlcd/radio_hardware.cpp b/radio/src/gui/common/stdlcd/radio_hardware.cpp
index 67de15c46..339052c65 100644
--- a/radio/src/gui/common/stdlcd/radio_hardware.cpp
+++ b/radio/src/gui/common/stdlcd/radio_hardware.cpp
@@ -210,7 +210,8 @@ enum {
 #elif defined(RADIO_ZORRO)
   #define SWITCH_TYPE_MAX(sw)            ((MIXSRC_SB - MIXSRC_FIRST_SWITCH == sw || MIXSRC_SC - MIXSRC_FIRST_SWITCH == sw) ? SWITCH_3POS : SWITCH_2POS)
 #elif defined(RADIO_TX12) || defined(RADIO_T8)
-  #define SWITCH_TYPE_MAX(sw)            ((MIXSRC_SA - MIXSRC_FIRST_SWITCH == sw || MIXSRC_SD - MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
+  #define SWITCH_TYPE_MAX(sw)            ((MIXSRC_SA - MIXSRC_FIRST_SWITCH == sw || MIXSRC_SD - MIXSRC_FIRST_SWITCH == sw || \
+                                           MIXSRC_SI - MIXSRC_FIRST_SWITCH == sw || MIXSRC_SJ - MIXSRC_FIRST_SWITCH) ? SWITCH_2POS : SWITCH_3POS)
 #elif defined(RADIO_T12)
   #define SWITCH_TYPE_MAX(sw)            ((MIXSRC_SG - MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH - MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
 #else

@pfeerick pfeerick added this to the 2.6 milestone Dec 28, 2021
@rotorman
Copy link
Member

rotorman commented Dec 28, 2021

@piotrva would it be possible for you to edit the first post above and add an image showing the SI & SJ connectors on the TX12 mainboard (ideally circle or arrow them with a short button wiring info) in case further users wish to follow your path, test this PR and also for documentation purposes. Thanks!

@pfeerick
Copy link
Member

Ok, so it looks like they are these two connectors, making them 2POS, but I don't know which is which, and I don't feel like pulling mine apart tonight. 😆

image

@piotrva
Copy link
Contributor Author

piotrva commented Dec 28, 2021

Also noticed - in keys debug screen they display as SG and SH...
Despite being identified in other places as SI and SJ

Switches were displayed in test screen as SG and SH, due to fact that firmware did not take into account no presence of SG and SH in TX12.
The update provides correct and consistent naming of the additional switches across whole radio.
@piotrva
Copy link
Contributor Author

piotrva commented Dec 28, 2021

So debug screen naming is corrected now - I think I check operation of additional switches across whole firmware and everything LGTM for this small update.

Copy link
Member

@pfeerick pfeerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added a commit fixing some other issues in the diags screen on the TX12 (which are not due to your changes) since I noticed the alignment for the switches was slightly out and the rotary encoder info was overlapping the TELE button.

I've since tried this out on my TX12, and it is working perfectly - can see SI and SJ and can see them being toggled when I short out the indicated connectors. Tried them on some mixer lines and they seemed to be working fine there also.

@pfeerick pfeerick merged commit d41855a into EdgeTX:main Dec 30, 2021
pfeerick added a commit that referenced this pull request Dec 30, 2021
* Fixed support for Radiomaster TX12 additional switches (SI and SJ)

Two connectors are present on TX12 main board (near top of internal TX module) and are mapped as SI and SJ, but were not read out by the firmware.
With this update they might be used for some further hacking of the radio (ex. adding additional 2-pos switches, adding detector of external module insertion etc.).

* Radiomaster TX12 - preventing selection of Si and SJ as 3POS

* Radiomaster TX12 - corrected SI and SJ switch names in Keys Debug screen

Switches were displayed in test screen as SG and SH, due to fact that firmware did not take into account no presence of SG and SH in TX12.
The update provides correct and consistent naming of the additional switches across whole radio.

* Alignment tweak + fix rot_enc info overlap

Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
pfeerick added a commit that referenced this pull request Feb 3, 2022
*Somebody* (me) forgot ternary operator only compares two value in #1303
pfeerick added a commit that referenced this pull request Feb 8, 2022
*Somebody* (me) forgot ternary operator only compares two value in #1303
pfeerick added a commit that referenced this pull request Feb 12, 2022
…OS (#1548)

* fix: SE and SF could not be set 3POS
*Somebody* (me) forgot ternary operator only compares two value in #1303

* fix: TX12 default contrast is too high
There is no 'perfect' value due to manufacturing variance, but 25 is simply too high,
and 15 a bit too low.
rotorman pushed a commit to rotorman/edgetx that referenced this pull request Feb 13, 2022
…OS (EdgeTX#1548)

* fix: SE and SF could not be set 3POS
*Somebody* (me) forgot ternary operator only compares two value in EdgeTX#1303

* fix: TX12 default contrast is too high
There is no 'perfect' value due to manufacturing variance, but 25 is simply too high,
and 15 a bit too low.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants