STM32F747 Discovery STemWin Button function inverted

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • STM32F747 Discovery STemWin Button function inverted

      Hello,

      I modified the STemWin(5.44) Font example from the Discovery H747 Cube Examples (version 1.7.0) and made a simple screen with one Button and one text element. The Button, if pressed displays a different text (not pressed = "Disc H747", pressed = "Hello").

      Source Code

      1. case ID_BUTTON_0: // Notifications sent by 'btn_00'
      2. switch(NCode) {
      3. case WM_NOTIFICATION_CLICKED:
      4. // USER START (Optionally insert code for reacting on notification message)
      5. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
      6. TEXT_SetText(hItem, "Hello");
      7. // USER END
      8. break;
      9. case WM_NOTIFICATION_RELEASED:
      10. // USER START (Optionally insert code for reacting on notification message)
      11. hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
      12. TEXT_SetText(hItem, "DiscH747");
      13. // USER END
      14. break;
      Display All
      Problem: The button functions WM_NOTIFICATION_RELEASED and WM_NOTIFICATION_CLICKED are inverted. (not pressed = "Hello", pressed = "Disc H747"). If I put my text the other way round everything works.

      I did the same modification with the Discovery F746 examples (from the Discovery F746Cube Examples) - there is no problem. Has anyone a solution for this problem? Thanks in advance,
      Dave
    • Hi,

      I suppose that there is something wrong with the touch implementation. Please check the routine which passes the touch input to emWin.

      I have found an example within an older cube package (1.4.0) for the STM32H747I Disco. The function which passes the touch to emWin is called BSP_Pointer_Update(). On the first glance it looks ok, but I can't check this on hardware.

      I would check if the parameters passed to GUI_TOUCH_StoreStateEx() are correct, especially the "Pressed" member of the GUI_PID_STATE structure.


      Regards,

      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Sven,

      thanks you very much for your answer. Sorry about the wrong thread title - it should be : STM32H747 Discovery STemWin Button ......

      I checked the GUI_PID_STATE structure members. Everything is fine - Pressed is 1 ,when pressed, and 0 when not pressed. The problem seems to appear in the ID and NCode values which are delivered to my DLG.c File. With the Keil Debugger I checked the values directly here:

      Source Code

      1. case WM_NOTIFY_PARENT:
      2. Id = WM_GetId(pMsg->hWinSrc);
      3. NCode = pMsg->Data.v;
      4. id_value = Id;
      5. n_value = NCode;
      But there is no info in the PDF about the meaning of this values in the manual.
      If I start the app id_value = 801 and n_value = 8
      If I click my button id_value = 801 and n_value = 1
      If I release my button id_value = 801 and n_value = 2
      I added a checkbox, the id = 803 and n_values click/release like the button
      I added a slider the id = 805, n_values click/release like the button, n_value for value_changed = 5

      After program start the button appears visually unpressed. After the first click the visual appearance of the Button is as well inverted.

      My impression is - from the moment on, when I click any element on the screen something happens to the Ncode values and/or ID values. The STemWin Version is 5.44, the CubeMX is the newest (1.7).

      Regards
      Dave
    • Hi,

      When receiving a WM_NOTIFY_PARENT message a widget has send it to its parent. In this case pMsg->Data.v contains the notification code the widget has send. The ID is just to distinguish between the child windows/widgets a window/widget can have.


      daveb4 wrote:

      If I start the app id_value = 801 and n_value = 8
      The child widget with ID 801 has send a WM_NOTIFICATION_GOT_FOCUS (8) message.

      daveb4 wrote:

      If I click my button id_value = 801 and n_value = 1
      Same widget has send a WM_NOTIFICATION_CLICKED (1) message.

      daveb4 wrote:

      If I release my button id_value = 801 and n_value = 2
      The widget has send a WM_NOTIFICATION_RELEASED (2) message.

      [EDIT] So, if your button has the ID 801 (most likely GUI_ID_USER + 0x01) it does send all messages required.

      Which notifiaction codes are send by a widget is described in the manual under 'Notification codes'. Each widget has this sub chapter.

      [EDIT] You will also find a list of notification code in chapter '6.1.8.10.4 Notification codes'.

      You could also check the definition of the different notification codes. It is WM.h and should be publicly available.

      Regards,
      Sven
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.