]> git.mxchange.org Git - flightgear.git/blobdiff - src/Autopilot/flipflop.cxx
Trivial cleanup commit, to test continuous integration server.
[flightgear.git] / src / Autopilot / flipflop.cxx
index aba5883c5a06da0200ec9f98007ad63d38a003b4..076b2db48eae542ecdeba2013170a8d3bb36acb2 100644 (file)
@@ -24,7 +24,7 @@
 #include "inputvalue.hxx"
 #include <Main/fg_props.hxx>
 
-using namespace FGXMLAutopilot;
+namespace FGXMLAutopilot {
 
 /**
  * @brief Flip flop implementation for a RS flip flop with dominant RESET
@@ -279,6 +279,10 @@ public:
   virtual bool getState( double dt, DigitalComponent::InputMap input, bool & q );
 };
 
+} // namespace
+
+using namespace FGXMLAutopilot;
+
 bool MonoFlopImplementation::configure( const std::string & nodeName, SGPropertyNode_ptr configNode )
 {
   if( JKFlipFlopImplementation::configure( nodeName, configNode ) )
@@ -330,14 +334,15 @@ bool RSFlipFlopImplementation::getState( double dt, DigitalComponent::InputMap i
 
 bool ClockedFlipFlopImplementation::getState( double dt, DigitalComponent::InputMap input, bool & q )
 {
-  if( RSFlipFlopImplementation::getState( dt, input, q ) )
-    return true;
-
   bool c = input.get_value("clock");
   bool raisingEdge = c && !_clock;
     
   _clock = c;
 
+  if( RSFlipFlopImplementation::getState( dt, input, q ) )
+    return true;
+
+
   if( !raisingEdge ) return false; //signal no change
   return onRaisingEdge( input, q );
 }
@@ -448,7 +453,7 @@ void FlipFlop::update( bool firstTime, double dt )
 
   q0 = q = get_output();
 
-  if( _implementation->getState( dt, _input, q ) ) {
+  if( _implementation->getState( dt, _input, q ) && q0 != q ) {
     set_output( q );
 
     if(_debug) {