Translate

Oct 10, 2017

Improved Encoder processing (ArdSimX.2)

In ArdSimX.2  Encoder processing has been totally reprogrammed. The new algorithm takes into account huge timing difference between  encoder scanning period and X-Plane frame rate, and counts precisely each encoder state change, with mininal missing steps probability.

The plugin in X-Plane can accept new data only with its frames frequency,  while ArdSimX firmware can check the encoder state about 150 times between each X-Plane frame.

In previous versions the program code couldn't send all fast state changes in one frame without missing steps while single slow changes were received by the plugin without problems.

Later (in ArdSimX) a "code crutch" was added to catch all encoder state changes and send them as multiple data packets, but this code has always been "beta" and was highly demanding to  processing time. This is why we recommended not to use encoders on the same board with steppers, for example.

In ArdSimX.2 all these problems were resolved. Now the program code reads all encoder inputs between X-Plane frames, takes into account every change and sums them, then sends the number of steps and direction in one single data packet, while at the same time using the algorithm of steps multiplication depending on rotation speed.


Also, along  with direct connection to the pins, every encoder can be  connected to the inputs of a multiplexer. I.e. you can use any pair of extended inputs for an encoder.



Furthermore, the tests show that using multiplexers for encoder inputs is even more efficient than direct inputs. Mainly this is because of direct manipulations with Arduino ports which are used to control multiplexers in ArdSimX.2.

Now, there will be no missing rapid-rotation steps, it will be smooth, non-jerking parameter changes and the additional acceleration applied to fast rotation will be more consistent.

With one quick finger movement you will be able to rotate the instrument needle/card  to 360 degrees, while keeping the ability to do slow and precise rotation.

Videos to be added....

Vlad

10 comments:

  1. This is looking very good, thanks for all the hard work!

    ReplyDelete
  2. Thanks for the plans it's possible we have "how to" max 7219

    ReplyDelete
    Replies
    1. 7-Segment displays connection options (using the MAX7219, registers HC595 or drivers DM13A) will be published in next post tomorrow.
      Vlad

      Delete
    2. Thanks Vlad

      When I use the registry hc595 this one no longer works from 5 Led the DM13a is better?

      Delete
    3. This is not 595 issue, maybe some errors in the configuration file (or bug, but we haven't noticed some).

      Vlad

      Delete
  3. Great work, as always. I too am REALLY looking forward to a "how-to" on the MAX7219 LED displays. These will make my sim look really professional/ realistic! Thanks!

    ReplyDelete
  4. Vlad, great to hear. Answered my question from the encoder blog also. Looking forward to testing v2!!

    ReplyDelete
  5. I'm getting the opposite. The faster I turn the slower the OBS changes, for example. Single degree changes are very responsive but it takes a gazillion turns to get around the compass. The encoder is 20 detent wired directly.

    ReplyDelete
    Replies
    1. It looks like you have your own "custom" code and other libraries in your Arduino sketch besides ArdSimX. It's very important that your part of code doesn't take much time in the whole loop - preferably no more than 1-2 ms! (It's not so important if you use Arduino for switch inputs only).

      If you are using it for outputs and encoder inputs then additional code in each loop can lead to jerking outputs or unstable encoder input. The whole ArdSimX loop must be no more than 2-5 ms.

      Some 3rd-party libraries may take a huge amount of loop time - for example one of MAX7219 library takes 50-100 ms in cycle!
      Vlad

      Delete
  6. How made the configuration is made by ardsimx configurator or there is another way?.

    ReplyDelete