HHS81 / c182s

Cessna C182S (1996 model) for FlightGear
GNU General Public License v2.0
27 stars 9 forks source link

FGCom compatibility of audio panel/radios #324

Closed hbeni closed 3 years ago

hbeni commented 4 years ago

Currently FGCom is linked to the first radio (i think). We could integrate the audio panel more into the FGCom:

see fgfs forum: https://forum.flightgear.org/viewtopic.php?f=32&t=33232&p=368615#p368615 see fgcom source: https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/src/Network/fgcom.cxx

Properties seem to be:

(Follow up from PR #180 )

hbeni commented 4 years ago

GMA-340 handbook says (page 3):

Speaker Output Pressing the SPKR button (12) selects aircraft radios over the cabin speaker. The speaker output is muted when a COM microphone is keyed. The GMA 340 speaker output level can be adjusted by your installing agency

So we just might ignore that or implement it so that disabling the speaker turns fgcoms speaker to "0" and turning it on sets the volume to the currently set value from fgcom.

hbeni commented 4 years ago

Implementation in branch issue324_FGCom-GMAPanel. I tested it locally with 2019.1.1 but for FGCom in 2020 versions the FGCom properties did change. I honored that so both versions should work.

Properties seem to be set just fine - the only question remaining is, if FGCom will pick it up correctly. We need some testers in recent FGFS versions so this can be stabilized.

Test cases (estimated time to run trough: 2 minutes):

(announced it on the forums)

hbeni commented 4 years ago

I tested with 2019.1.1 today and basic function works. With COM1 i could connect to FGCom and disabling the radio did shut down FGCom. reenabling worked.

Further tests still pending; i currently try to build fgfs 2020.2.0

hbeni commented 4 years ago

Further testing revealed: the /controls/radios/comm-radio-selected property is hardwired to the code. From the aircraft perspective, it is read-only (could be set but confuses FGComs internal state).

The currently only solution i think is FGComs controls: SPACE=COM-1, CTRL+SPACE=COM-2. The thing we could do is to let the corresponding COM-MIC LED that is used, blink, so the pilot sees which Radio he transmits on and otherwise set the MIC-Buttons readonly.

Further investigation could reveal if we instead can overwrite the key bindings for FGCom. Maybe also it could be that FGCom just has the keybinding set to write the PTT and radio property, in this case we might just overwrite that code.... but where is this?

hbeni commented 4 years ago

but where is this?

controls.nas in fgdata: https://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Nasal/controls.nas and this overwrites our preset values. It also seems that in the /controls/radios/comm-ptt propety the value of the used com has to be entered. keyboard.xml defines the trigger for when space is pressed or released (space() gets called). Can we override that so the old code doesn't trigger?


Edit: just tested: when setting either the /instrumentation/comm[n]/ptt to 1, then FGCom will start to transmit on that radio (controls.nas defines listeners for that). So we either

@HHS81 please advise, what would you do? I would say, that the current implementation where we hilight the LED of the radio currently used for transmission is a good compromise. We cannot disable receiving messages, even when the radios are dead (thats hardwired in fgcom) anyway. Currently users might try to swith radios using the buttons however, and will fail. Maybe we disable the LED switching when pressing MIC2 or MIC3, so MIC1 always stays current (it's the default fgcom radio anyway)?

hbeni commented 4 years ago

(overwriting is trivial, just did it. Should we go that route, Heiko? @HHS81 )

hbeni commented 4 years ago

Tonight it struck me like lightning! We easily can have both. I will introduce a new realistically aircraft option and if it’s checked, i overwrite the space key. If not, default behavior is looped trough.

hbeni commented 4 years ago

Got it working now in the current commit.

commit 0cd66c0b85a4b693ab6c04922e1f2cf34228fb75 (HEAD -> issue324_FGCom-GMAPanel) Author: hbeni beni@hallinger.org Date: Tue Jun 2 00:02:54 2020 +0200

GMA-340 / FGCOM integration

  • corrected the implementation of commit d2c1b4ea9b, that one was not eintirely correct. Current implementation is much cleaner.
    • GMA 340 / FGCom Integration can now be turned on in the c182s aircraft menu. Default is off (fgcom standard behaviour).
    • When integration is disabled, just the LEDs blink for the radio used from FGCom, when transmitting.
    • When integration is enabled, the current MIC radio is switched with the audio panel button "COM+MIC". Then pressing space and shift-space is the same, it will transmit on the selected radio. When the selected radio is dead, transmission will not occur. When the GMA Panel dies, the hardwired COM1 failsafe will activate automatically. This all was tested using 2020.2.0 / Revision: e76787fa62 using two PCs and two fgcom standalone instances for monitoring the frequencies PHNL TWR+UNICOM.

So this is ready for merge in my eyes. We probably should make an entry in the next fgfs newsletter for this...

hbeni commented 4 years ago

Hi @stuartbuchanan I think we missed to close this one - the code seems to be already in master. What do you think (would be good if you could confirm and close, as I'm only 99% sure)

beni@segin:~/Dokumente/FGFS/work/c182s$ git branch --contains 8dfb580
  Issue331-UpgradeRadio
  damage
  fgcom-fixNoListener
* master
  master-merged
  tyresmoke
hbeni commented 3 years ago

Verified, is already merged, so i close this now.