937 views
in System Integration by

Good day to all.

Thank you for all the responses on my earlier questions.
My current problem is as follows.


i have a horizontal slider to control the backlight of my screen. On my hardware there is DimmerButton which pops up the backlight component when pressed. The green triangle moves to the slider thumb area and simulates the DriveCursorHitting operation. Here is the code.


var int32 val = Application::Storage.Backlight;

x1 = 401 - 26 + (val * 5 / 2);
y1 = 442;
Triangle.Bounds = rect(x1, y1, x1 + 16, y1 + 16);

if (Application::Storage.BacklightBoolStatus == true)
{
    this.Setup_Backlight.Visible = true;
    this.Setup_Backlight.Enabled = true;
    this.Focus = this.Setup_Backlight;
    Triangle.Visible = true;
    GetRoot().DriveCursorHitting(true, 0, Triangle.Bounds.origin);
}
else
{
    this.Setup_Backlight.Visible = false;
    this.Setup_Backlight.Enabled = false;
    Triangle.Visible = false;
    GetRoot().DriveCursorHitting(false, 0, Triangle.Bounds.origin);
}

Application::Storage.BacklightBoolStatus = !Application::Storage.BacklightBoolStatus; // open if closed, close if opened


i also have a on my hardware an encoder button. when i turn it left or right my triangle position gets updated and by simulating DriveCursorMovement i can do the press and drag operation. Encoder and dimmer algorithms work fine. Here is the Code.

x1 = Triangle.Bounds.x1;
y1 = Triangle.Bounds.y1;
if (sender == EncoderRight)
{
    y1 = y1;
    if (x1 - 2 <= 401)
    {
        x1 = 401;
    }
    else
    {
        x1 = x1 - 2;
    }
}
if (sender == EncoderLeft)
{
    y1 = y1;
    if (x1 + 2 >= 625)
    {
        x1 = 625;
    }
    else
    {
        x1 = x1 + 2;
    }
}
Triangle.Bounds = rect(x1, y1, x1 + 16, y1 + 16);
GetRoot().DriveMultiTouchMovement(0, Triangle.Bounds.origin);


While controlling the backlight slider with encoder if by any chance i touch somewhere on the actual LCD Touch panel. GetRoot.DriveCursorMovement functions thinks that i tried to drag it to the last touch position (not the triangle is currently on) and moves the slider all the way to right or left depending on where LCD press happened. Any suggestions?

1 Answer

0 votes
by

Hello,

if I understand your application case, you want the GUI to be controlled by hardware buttons and an encoder. The touch screen is not needed in this case. The simplest would be to comment out the code sections responsible for processing touch events. Please see the section: Main Loop.

The exact code may differ from target system to target system. You can search in your build environment for the invokation of the functions CoreRoot__DriveCursorHitting() or CoreRoot__DriveMultiTouchHitting() and then comment out all belonging code sections. For example comment out following code:

With this step, the touch events are not relayed to the GUI application anymore.

Best regards

Paul Banach

by
Thank you for the response. Touch screen needs to be active.

We need the option to be able to use both of them if required maybe sometimes at the same time.
by
Hello,

in such case you would need to manage some status variable to enable/disable the real touch events. When the user presses the HW button, you increment the variable. When the user releases the HW button then the variable is decremented. Consequently, as long as the variable is > 0, the user is pressing some button.

Then you adapt the code where real touch events received from the touch screen driver are fed to the GUI application (see my comment above) and add an additional if-condition to test the variable. If the variable is not 0, the events are ignored.

Is this the expected solution?

Best regards

Paul Banach

Ask Embedded Wizard - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...