Solved
First I tried using Heading Up and Heading Down for the On Press and On Release options. That worked sort of; the heading bug would move around in both directions, but faster than normal, and if I twisted the knob fast it would just bounce.
Finally switched to lower resolution encoder, the kind with clicks(20 detents) and a push button action, used the same settings in mobiflight and it works just as it should, after setting the number of detents from 1 detent per cycle (11) to 1 detent per cycle (00)
It worked o.k. at 1 detent per cycle (11), but would jump a number sometimes, and would hesitate for 1 click when changing direction. 1 detent per cycle (00) works flawlessly.
--------------------------------------------------------------------------------------
My conclusion: Switch Bounce
I'm working out a solution that I think will work....
O.K.; I couldn't figure out a solution using Mobiflight; now I'm thinking either hardcode it in Arduino, or do it mechanically with either a gear reduction device, or a friction device that introduces just enough friction to prevent you from turning the knob too fast.
I'm beginning to think my encoder(digital or maybe optical) is too fast or has too many inputs for mobiflight or arduino or xplane to keep up with; if only there was a way to delay the input a little or more, then maybe it would work well. Or maybe I'll just use a different encoder.
Tried using Keyboard Input option in output configs, but Xplane keep resetting to defaults.
In Xplane 11
Rotary encoder 600BM 2 phase I think
Trying to control heading bug with encoder
In Inputs I'm using Xplane (all versions)
Autopilot
Heading The heading to fly (true, legacy), unit: degt (same in output)
I have it set DatRef sim/cockpit/autopilot/heading
Value for On Left: if($>1,($-1),($-1))
Value for On Right: if($>1,($-1),($+1))
With values above it turns very smoothly, but it only turns in one direction not matter which way I turn the knob, counterclockwise in this case.
I've tried changing the values but it either turns only counterclockwise or clockwise, or gets jittery depending on the settings.
Values for On Left Fast and On Right Fast are set to none
Before I was using Command for both On Left and On Right, it worked o.k. in both directions if I turned the knob very slowly, but if I turn at normal speed the bug would only jitter in place. I also used On Left and On Right values of $-1 and $+1 respectively, but the output was jittery.
I've tried different detent per cycle settings, no change in behavior.
Any idea how to make it turn smoothly in the direction I'm turning the knob?