You are going to need hardware to do the trick.  Either build your own 
interface board and driver or find a commercial/open source product.  

A few years back I designed and built a set of boards for Aeronvironment for 
their Global Observer UAV.  They purchased over 20 sets of a complete pilot 
workstation.  Still have a few spares left on the shelf. I won't give the 
boards away, but it you're serious about needing a rotary encoder interface, 
can provide same plus the software at costs.

JW

----- Original Message -----
Hi,
I connected an encoder with two outputs (A and B) at a Joystick Board 
(bodnar BU0836X). I used button 1 for wire A and button 2 for wire B.
Using xml and nasal script I get the right rotation (I want to move obs 
knob). Everything works fine only if I move the knob slowly. If I move 
the knob quickly, the result is uncertain.
It's pretty clear that I cannot intercept all the steps of the encoder.
Does anyone have any idea on how to fix it?
Thanks.
Here my files:
<button>
   <name>Encoder1A</name>
   <number>
    <unix>0</unix>
    <mac>0</mac>
    <windows>0</windows>
   </number>
   <desc>Encoder1 fase A</desc>
   <repeatable>false</repeatable>
   <binding>
    <command>nasal</command>
    <script>
       bodnar.encoder1("A", 1)
    </script>
   </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>
       bodnar.encoder1("A", 0)
    </script>
   </binding>
  </mod-up>
  </button>
  <button>
   <name>Encoder1B</name>
   <number>
    <unix>1</unix>
    <mac>1</mac>
    <windows>1</windows>
   </number>
   <desc>Encoder1 fase B</desc>
   <repeatable>false</repeatable>
   <binding>
    <command>nasal</command>
    <script>
       bodnar.encoder1("B", 1)
    </script>
   </binding>
  <mod-up>
   <binding>
    <command>nasal</command>
    <script>
       bodnar.encoder1("B", 0)
    </script>
   </binding>
  </mod-up>
  </button>
Then this nasal script:
###############################################
var statusA = nil;
var statusB = nil;
var oldStatusA = nil;
var oldStatusB = nil;
var initBodnar = func() {
         print ("Loading bodnar.nas");
}
var encoder1 = func(button, status) {
         print (button , status);
         if(button == "A") {
                 statusA = status;
         }
         else if ( button == "B" ) {
                 statusB = status;
         }
         if(statusA == statusB) {
                 if(oldStatusA != statusA) {
                         direction("cw");
                 }
                 else {
                         direction("ccw")
                 }
         }
         else {
                 if(oldStatusA != statusA) {
                         direction("ccw");
                 }
                 else {
                         direction("cw")
                 }
         }
         oldStatusA = statusA;
         oldStatusB = statusB;
}
var direction = func(dir) {
         print (dir);
}
#############################################

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Flightgear-users mailing list
Flightgear-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-users

Reply via email to