Current version of the OpenAuto Pro is 12
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotary Encoder idea for menu navigation
#1
Lightbulb 
Hi, I'm going to setup a rotary encoder in my car to use it as a navigation knob for the main menu of aop.
As you all know you can set only 3 key strokes, for example left and right to the rotations and enter for the button.
I was wondering if it is possible to add a esc "button" to go back in the menu in order to use only the encoder to navigate.

So I came with the idea to not add another push button to do the job but use a software way. 
I want to use the built in button of the rotary encoder to do more key strokes by pressing it twice or holding it down for example. 

Is it possible to do that? I think it would be a useful feature to add.
Other ideas are welcome

Thanks
Reply
#2
You can experiment and asses how many keys you need. Then you have to write appropriate script that will handle all needed buttons.
Supported in OAP key strokes:
https://bluewavestudio.io/community/show...p?tid=2048

Good staring point:
https://bluewavestudio.io/community/showthread.php?tid=1811&highlight=rotary+encoder
https://bluewavestudio.io/community/show...p?tid=2222
Reply
#3
(02-12-2021, 12:12 PM)Daniel_BlueWave Wrote: You can experiment and asses how many keys you need. Then you have to write appropriate script that will handle all needed buttons.
Supported in OAP key strokes:
https://bluewavestudio.io/community/show...p?tid=2048

Good staring point:
https://bluewavestudio.io/community/showthread.php?tid=1811&highlight=rotary+encoder
https://bluewavestudio.io/community/show...p?tid=2222

ok Thanks.Then can you give me the path of the code linked to 
controller_service /home/pi/.openauto/config/openauto_controller_service.ini
in order to modify it and create the variables of the long press and double press and integrate this mod to the default controller service?
Reply
#4
I think you get it wrong. You supposed to not use our solution, as it not fit to your need. You have to create your own script that fulfill your expectations.
Those links should help you to understand scope of work, that has to be done.
Reply
#5
(02-12-2021, 03:23 PM)Daniel_BlueWave Wrote: I think you get it wrong. You supposed to not use our solution, as it not fit to your need. You have to create your own script that fulfill your expectations.
Those links should help you to understand scope of work, that has to be done.
Ok, I got it. I misunderstood. I thought it would be simpler to modify an already existing code since I am not really much into coding.
Reply
#6
at least can you provide me the original code of the rotary encoder in order to understand how to use key stroke inputs? Thanks
Reply
#7
Have a look in my thread. Bluewave already provided a good config for that.

[Controller]
Type=5

[RotaryEncoder]
SiaPinNumber=5
SibPinNumber=6
SwPinNumber=13
LeftKeyStrokes=1
RightKeyStrokes=2
SwitchKeyStrokes=Return

Instead of Return you would have to use Escape. Also make sure to use PinNumbers that suit your configuration. The PinNumbers are where your rotary encoder is connected to. Make sure to use the GPIO numbers! Have a look here for the exact pinout: https://hackster.imgix.net/uploads/attachments/217647/oDRh4lpYwoZHHrJiQR64.png?auto=compress%2Cformat&w=740&h=555&fit=max
You can see that I used 3 Pins in a row on the lower left. It's PIN 29, 31 and 33 but it's GPIO Pin 5, 6 and 13.

1 and 2 buttons (LeftKeyStroke and RightKeyStroke) are for navigating through the menu. Same as if you connected a keyboard and pressed "1" and "2" on the keyboard.


Now create a file whereever you want. 

Maybe in
/home/pi/.openauto/config/
and name it whatever you like. I used 
openauto_controller_service_CONTROL.ini


Now open

/etc/xdg/lxsession/LXDE-pi/autostart
and append the file with following
controller_service /home/pi/.openauto/config/openauto_controller_service_CONTROL.ini

To make it work, REBOOT!


If you want to use multiple rotary encoders, do the same thing again but create a NEW file and give it a DIFFERENT name and connect it to DIFFERENT GPIO pins

[Controller]
Type=5

[RotaryEncoder]
SiaPinNumber=XXX
SibPinNumber=XXX
SwPinNumber=XXX
LeftKeyStrokes=XXX
RightKeyStrokes=XXX
SwitchKeyStrokes=XXX

Append the
/etc/xdg/lxsession/LXDE-pi/autostart

with the new file so it looks like
controller_service /home/pi/.openauto/config/openauto_controller_service_CONTROL.ini
controller_service /home/pi/.openauto/config/openauto_controller_service_WHATEVER.ini


I don't think it's possible to configure double presses.
What you can do is copy the rotary encoder file that I used with "Return" as KeyStroke and connect a GPIO Pin that only presses Escape. So you have an actual Escape Button. I have a few gpio buttons but did'nt connect them to the raspberry yet, so I don't really know how to use them and configure them in OAP.
Reply
#8
[font="Lucida Console", "Courier New", Mono]t[/font]
take a look at this thread too. shows you how to get additional functionality out of the rotary encoder. I used it to trigger a script that toggles the LCD screen.

https://bluewavestudio.io/community/show...p?tid=2351
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)