Author Topic: reversed encoders problem  (Read 8731 times)

grm

  • Team member
  • *
  • Posts: 4
    • View Profile
reversed encoders problem
« on: January 27, 2019, 03:23:13 AM »
hi everybody and especially Xavier,

just finished the build of a new preenFM2 with a friend and we are happy that all (almost!) worked on the first try. thanks for this wonderful project.

now the question, as some people have had before (here: http://ixox.fr/forum/index.php?topic=2320.msg2781#msg2781), for this build we used cheap encoders, that are reacting in reverse direction (the value steps per click work fine). we thought we would find an easy fix as it seemed to be solved in the thread, but the special firmware link is dead now. also it was a fix for the BLUE one from 2012.

is there a new firmware fix for this to be found somewhere and how can that be embedded into the existing one, how does the update work?

any hints highly appreciated. thanks

here are the specs for the encoders we have used:
Position: 20
Puls: 20
2-Bit Gray-Code
Closed Circuit resistance: 3 Ohm Maxima
Max. : 10 mA at 5 VDC

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: reversed encoders problem
« Reply #1 on: January 27, 2019, 09:57:59 AM »
Hi,

It's a simple change ;) I wanted to add that for a long time.
I've pushed the change list in a new branch.
https://github.com/Ixox/preenfm2/commit/1a73d150ee31136a00183db9969c230b979fc4ef

Firmware 2.09a is attached.

Go in the encoders menu : Tools > Set > Rot. Enc.
Then you have 2 new encoders 12i and 24i which are inversed version of 12 and 24.

There's a trap, as soon as you select one of the "i" encoders, the encoders are inversed. So to go from 12i to 24i turn the other way.
Reminder : once you have the encoder you want. Press MENU twice to save.

Xavier


[attachment deleted by admin]

grm

  • Team member
  • *
  • Posts: 4
    • View Profile
Re: reversed encoders problem
« Reply #2 on: January 30, 2019, 01:25:41 AM »
Thanks for your incredibly quick response and help.
You are awesome!

<3

spatulacity

  • Team member
  • *
  • Posts: 1
    • View Profile
Re: reversed encoders problem
« Reply #3 on: February 01, 2019, 09:32:14 PM »
Hello all,
and thanks a million Xavier from me too!
Awesome synth.

I got my backwards encoders working perfect now, although it did require modifying the <SETTINGS.txt> by hand ("encoders=3" in my case). The menu item says "i24", but if i change it the options turn to only 12 and 24, getting back to i24 only through reboot.
Anybody else experiencing the same?


grm

  • Team member
  • *
  • Posts: 4
    • View Profile
Re: reversed encoders problem
« Reply #4 on: February 03, 2019, 01:51:34 AM »
a feedback.

well, i have the same issue after flashing the 2.09a Firmware:

still only 2 encoder options. no inverse.

i might try itthe SPATULACITY way, but i am a bit concerned, because i have zero coding $KILL$.

grm

  • Team member
  • *
  • Posts: 4
    • View Profile
Re: reversed encoders problem
« Reply #5 on: February 03, 2019, 02:08:53 AM »
managed to set the device to the INVERTED ENCODERS setting the SPATULACITY way. thanks to you, as well!

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: reversed encoders problem
« Reply #6 on: February 03, 2019, 06:59:33 PM »
Yes, the problem is that the driver is changed as soon as it shows up in the menu.
So with some "24i" encoder type, it's possible that some settings cannot be reached when coming from 12.
You could try to turn very very slowly the encoder, should change at half step.

Anyway, modifyting directly settings.txt sounds like a very good solution  as you have to do that only once :)
« Last Edit: February 03, 2019, 08:28:02 PM by Xavier »

Zedius

  • Team member
  • *
  • Posts: 2
    • View Profile
Re: reversed encoders problem
« Reply #7 on: May 27, 2019, 09:04:01 AM »
I'm having this problem as well. My two left-most encoders are inverted, but my two right-most encoders are correct.

I've tried switching my Encoders setting in the settings.txt file to 3, but this resulted in my left-most encoder turning correctly but also simultaneously affecting the 3rd field instead of just the 1st. Super weird.

I would like to try the firmware linked above, but I'm not sure how to compile the cpp files into a .bin that can be flashed to the PreenFM2. Am I missing something?

Thanks!

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: reversed encoders problem
« Reply #8 on: June 04, 2019, 09:24:38 AM »
Sorry to reply so late, i missed this one.

If you have different encoders on the same preenfm you have 2 solutions :
. unsolder you encoders and put 4 similar ones.
. compile a custom firmware. It's explained here :
https://github.com/Ixox/preenfm2
And what you need to override inversedEnc variable here:
https://github.com/Ixox/preenfm2/blob/master/src/hardware/Encoders.cpp#L163&ts=4
inversedEnc = (k<2 ? -1 : 1);
 or
inversedEnc = (k<2 ? 1 : -1);
That should work.

Zedius

  • Team member
  • *
  • Posts: 2
    • View Profile
Re: reversed encoders problem
« Reply #9 on: June 06, 2019, 05:40:36 PM »
Thanks, I'll give that a shot! Looking at encoders.cpp I see that the inversed encoder may already be defined here:

   int inversedEnc = (encoderType & 0x2) == 0 ? 1 : -1;

Is that a different way of writing the inversedEnc = (k<2 ? -1 : 1); code that you mentioned? Or do I need to add that somewhere?


Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2259
    • View Profile
Re: reversed encoders problem
« Reply #10 on: June 08, 2019, 10:21:37 AM »
Thanks, I'll give that a shot! Looking at encoders.cpp I see that the inversed encoder may already be defined here:
   int inversedEnc = (encoderType & 0x2) == 0 ? 1 : -1;

This initialized the type of encoder by the value you put in the menu setting.

    Is that a different way of writing the inversedEnc = (k<2 ? -1 : 1); code that you mentioned? Or do I need to add that somewhere?

if you add that line 163, this override the initialization above.
And you'll have the 2 encoders 1 & 2 of one type and the encoders 3 and 4 of the other type.