]> git.mxchange.org Git - flightgear.git/commitdiff
Make adf volume and adf on/off seperate properties.
authorcurt <curt>
Thu, 29 Aug 2002 04:18:55 +0000 (04:18 +0000)
committercurt <curt>
Thu, 29 Aug 2002 04:18:55 +0000 (04:18 +0000)
src/Cockpit/kr_87.cxx
src/Cockpit/kr_87.hxx
src/Network/atc610x.cxx
src/Network/atc610x.hxx

index a675f1adc57cc4605c004929ae66089eb99c332c..2c65a3823e84f1fe8863e1150feea021dc4b533d 100644 (file)
@@ -85,7 +85,8 @@ FGKR_87::FGKR_87() :
     timer_mode(0),
     count_mode(0),
     rotation(0),
-    on_off_vol_btn(0.5),
+    power_btn(true),
+    vol_btn(0.5),
     adf_btn(true),
     bfo_btn(false),
     frq_btn(false),
@@ -152,10 +153,14 @@ void FGKR_87::bind () {
     fgTie("/radios/kr-87/inputs/rotation-deg", this,
          &FGKR_87::get_rotation, &FGKR_87::set_rotation);
     fgSetArchivable("/radios/kr-87/inputs/rotation-deg");
-    fgTie("/radios/kr-87/inputs/on-off-volume", this,
-         &FGKR_87::get_on_off_vol_btn,
-         &FGKR_87::set_on_off_vol_btn);
-    fgSetArchivable("/radios/kr-87/inputs/on-off-volume");
+    fgTie("/radios/kr-87/inputs/power-btn", this,
+         &FGKR_87::get_power_btn,
+         &FGKR_87::set_power_btn);
+    fgSetArchivable("/radios/kr-87/inputs/power-btn");
+    fgTie("/radios/kr-87/inputs/volume", this,
+         &FGKR_87::get_vol_btn,
+         &FGKR_87::set_vol_btn);
+    fgSetArchivable("/radios/kr-87/inputs/volume");
     fgTie("/radios/kr-87/inputs/adf-btn", this,
          &FGKR_87::get_adf_btn,
          &FGKR_87::set_adf_btn);
@@ -213,7 +218,8 @@ void FGKR_87::unbind () {
 
     // input and buttons
     fgUntie("/radios/kr-87/inputs/rotation-deg");
-    fgUntie("/radios/kr-87/inputs/on-off-volume");
+    fgUntie("/radios/kr-87/inputs/power-btn");
+    fgUntie("/radios/kr-87/inputs/volume");
     fgUntie("/radios/kr-87/inputs/adf-btn");
     fgUntie("/radios/kr-87/inputs/bfo-btn");
     fgUntie("/radios/kr-87/inputs/frq-btn");
@@ -254,7 +260,7 @@ void FGKR_87::update( double dt ) {
     // Radio
     ////////////////////////////////////////////////////////////////////////
 
-    if ( on_off_vol_btn >= 0.05 ) {
+    if ( power_btn ) {
         // buttons
         if ( adf_btn == 0 ) {
             ant_mode = 1;
@@ -450,11 +456,11 @@ void FGKR_87::update( double dt ) {
     if ( valid && inrange ) {
        // play station ident via audio system if on + ident_btn,
        // otherwise turn it off
-       if ( on_off_vol_btn >= 0.01 && ident_btn ) {
+       if ( vol_btn >= 0.01 && ident_btn ) {
            FGSimpleSound *sound;
            sound = globals->get_soundmgr()->find( "adf-ident" );
             if ( sound != NULL ) {
-                sound->set_volume( on_off_vol_btn );
+                sound->set_volume( vol_btn );
             } else {
                 SG_LOG( SG_COCKPIT, SG_ALERT, "Can't find adf-ident sound" );
             }
index 21230d5113e2eac60f48e80dae9c9bc8549f7702..5b6069e991a5a12d72c6168fd2570bb806b82946 100644 (file)
@@ -79,7 +79,8 @@ class FGKR_87 : public FGSubsystem
 
     // input and buttons
     double rotation;            // compass faceplace rotation
-    double on_off_vol_btn;
+    bool power_btn;             // 0 = off, 1 = powered
+    double vol_btn;
     bool adf_btn;               // 0 = normal, 1 = depressed
     bool bfo_btn;               // 0 = normal, 1 = depressed
     bool frq_btn;               // 0 = normal, 1 = depressed
@@ -137,11 +138,15 @@ public:
     // input and buttons
     inline double get_rotation () const { return rotation; }
     inline void set_rotation( double rot ) { rotation = rot; }
-    inline double get_on_off_vol_btn() const { return on_off_vol_btn; }
-    inline void set_on_off_vol_btn( double val ) {
+    inline bool get_power_btn() const { return power_btn; }
+    inline void set_power_btn( bool val ) {
+       power_btn = val;
+    }
+    inline double get_vol_btn() const { return vol_btn; }
+    inline void set_vol_btn( double val ) {
        if ( val < 0.0 ) val = 0.0;
        if ( val > 1.0 ) val = 1.0;
-       on_off_vol_btn = val;
+       vol_btn = val;
     }
     inline bool get_adf_btn() const { return adf_btn; }
     inline void set_adf_btn( bool val ) { adf_btn = val; }
index 3c3be228d8712925c21d93c1bab546a6dab99fcc..f2a9a34d4c0878d059320fe78a628744b9b16dfd 100644 (file)
@@ -396,7 +396,8 @@ bool FGATC610x::open() {
     nav2_stby_freq
        = fgGetNode( "/radios/nav[1]/frequencies/standby-mhz", true );
 
-    adf_on_off_vol = fgGetNode( "/radios/kr-87/inputs/on-off-volume", true );
+    adf_power = fgGetNode( "/radios/kr-87/inputs/power-btn", true );
+    adf_vol = fgGetNode( "/radios/kr-87/inputs/volume", true );
     adf_adf_btn = fgGetNode( "/radios/kr-87/inputs/adf-btn", true );
     adf_bfo_btn = fgGetNode( "/radios/kr-87/inputs/bfo-btn", true );
     adf_freq = fgGetNode( "/radios/kr-87/outputs/selected-khz", true );
@@ -501,7 +502,7 @@ bool FGATC610x::do_analog_in() {
 
     // adf volume
     tmp = (float)analog_in_data[26] / 1024.0f;
-    fgSetFloat( "/radios/kr-87/inputs/on-off-volume", tmp );
+    fgSetFloat( "/radios/kr-87/inputs/volume", tmp );
 
     // nav2 obs tuner
     tmp = (float)analog_in_data[29] * 360.0f / 1024.0f;
@@ -898,6 +899,8 @@ bool FGATC610x::do_radio_switches() {
              !(radio_switch_data[23] >> 3 & 0x01) );
     fgSetInt( "/radios/kr-87/inputs/set-rst-btn",
               !(radio_switch_data[23] >> 4 & 0x01) );
+    fgSetInt( "/radios/kr-87/inputs/power-btn",
+              radio_switch_data[23] >> 4 & 0x01 );
     /* cout << "adf = " << !(radio_switch_data[23] & 0x01)
          << " bfo = " << !(radio_switch_data[23] >> 1 & 0x01)
          << " stby = " << !(radio_switch_data[23] >> 2 & 0x01)
@@ -1137,7 +1140,7 @@ bool FGATC610x::do_radio_display() {
     // turns on the decimal point
 
     // ADF standby frequency / timer
-    if ( adf_on_off_vol->getDoubleValue() >= 0.01 ) {
+    if ( adf_vol->getDoubleValue() >= 0.01 ) {
         if ( adf_stby_mode->getIntValue() == 0 ) {
             // frequency
             float adf_stby = adf_stby_freq->getFloatValue();
index 3f849e892ab42fa2bead509b8bc2db76976074e3..5adf18b7042dd87663e5aded1bceab333dc77784 100644 (file)
@@ -77,7 +77,7 @@ class FGATC610x : public FGProtocol {
     SGPropertyNode *nav1_freq, *nav1_stby_freq;
     SGPropertyNode *nav2_freq, *nav2_stby_freq;
     SGPropertyNode *adf_adf_btn, *adf_bfo_btn;
-    SGPropertyNode *adf_on_off_vol;
+    SGPropertyNode *adf_power, *adf_vol;
     SGPropertyNode *adf_freq, *adf_stby_freq;
     SGPropertyNode *adf_stby_mode, *adf_timer_mode;
     SGPropertyNode *adf_count_mode, *adf_flight_timer, *adf_elapsed_timer;