Friday, July 11, 2014

How to fix RepRapDiscount Smart Controller encoder rotation

I really enjoy being able to control my smartrap with the LCD controller.


But even if I've had my smartrap for about 4 months now, I still couldn't get used to the direction the knob responds in the LCD controller.  The knob (aka encoder) works in a way that when you turn it clockwise, the values gets smaller.  I just find it very unnatural.

This caused a couple of crashes and almost broke my print bed a few times while trying to move the nozzle up.

A new post in the smartrap forum by someone also annoyed with this made me look at it again and still could not find a good info on the net. What I'm sure of is that it is just a setting on the firmware.

In my case, I am using a RAMPS 1.4 and Arduino Mega 2560. I traced the code backwards from the point where the LCD controller was defined in configuration.h and tried to find a trail. I ended up in pins.h of the smartrap firmware which is based on marlin.

Here's the exact code where I needed to change it in pins.h:

#if MOTHERBOARD == 33 || MOTHERBOARD == 34 || MOTHERBOARD == 35 || MOTHERBOARD == 77 || MOTHERBOARD == 67 || MOTHERBOARD == 68
    ----- a lot of code here in between -------

#ifdef ULTRA_LCD

#ifdef NEWPANEL
#define LCD_PINS_RS 16
#define LCD_PINS_ENABLE 17
#define LCD_PINS_D4 23
#define LCD_PINS_D5 25
#define LCD_PINS_D6 27
#define LCD_PINS_D7 29

#ifdef REPRAP_DISCOUNT_SMART_CONTROLLER
#define BEEPER 37
#define BTN_EN1 33 //<---swap this

#define BTN_EN2 31 //<---with this
#define BTN_ENC 35

 After swapping the pins of BTN_EN1 and BTN_EN2 and re-uploading the firmware, the encoder now works the way I wanted it to =)

Depending on what board you're using, it will just be a matter of swapping the pins, too. Give it a try! 
  


5 comments:

  1. Is there also a way to get it to feel less numb and unresponsive? It seems you have to turn the knob three or four clicks before it does anything.

    ReplyDelete
  2. The using a controller with these parameters helps to avoid unnecessary workload. You should choose the right connection to keep a match.

    ReplyDelete
  3. It would be great if you'll share more details on that. That was an interesting topic but it requires more details.

    ReplyDelete
  4. An interesting idea for programming a controller. It seems to me that you did everything right

    ReplyDelete