Rotary encoder problem
-
How do I make the system understand that the encoder increment is Key_Left and Key_Right decrement?
I believe I should have to direct this in a module, correct? If yes, how to do it? Thanks for listening!For example,
void FControl::onKeyPress(int Key)
{
qDebug() << "received";
qDebug() << Page;
int press;switch(key) { case Qt::Key_Enter: case Qt::Key_Return: press=0; break; case Qt::Key_Left: press= -120; break; case Qt::Key_Right: press= +120; break; case Qt::Key_Return: }
........
-
Hi and welcome to devnet,
How is that method called in your code ?
-
Hello, how are you? Thanks my dear!
I'm using a toradex verdin, I've already generated the kernel and binaries for the rotary encoder. I tested the encoder with the multimeter and everything is ok.
My application uses the left key for decrement and right for increment. I would like to make the encoder work in the application in the same way, when turning the encoder, the app already understands the side and increments or decrements.
Today I'm using onKeyPress. -
Hence my question: how is that method called ? Do you have a signal connected to it ?
-
Yes, I have some knobs connected to the application, which increment or decrement with the rotation. It's a lung ventilator project, each knob has a function, such as: tidal volume, frequency, flow, peep, limit pressure... when I click on the screen, I can control these knobs through the left and right keys, however I would like to use an encoder for this and also keep the keys working!
-
That is clear and understood. What you are not answering is: how is onKeyPress called ?
What is the flow between your encoder back to your GUI ? -
Then how is KeyPress emitted ?
-
Doesn't rotary encoder outputs min of two "digits" ? Then you compare previous to current output to determine direction of rotation and from that derive "up or down " value to be added / deleted .
-
@mchinand Hi, how are you? Have a great day. No, It is found as rotary encoder even by the operating system, but the qt app was configured to detect only the keyboard keys, and I would like to make the keyboard and the encoder work simultaneously. But I'm not sure how to make the encoder work in the qt application.
-
Can you explain how it is "working with the OS" ?
How would you retrieve the data ?