espressif / esp-adf

Espressif Audio Development Framework
Other
1.55k stars 685 forks source link

Wrong order of buttons in input_key_com_user_id.h ? (AUD-4586) #993

Closed Gaai closed 1 year ago

Gaai commented 1 year ago

----------------------------- Delete below -----------------------------

Reminder: If your issue is a general question, start similar to "How do I..". If it is related to 3rd party development kits/libs, please discuss this on our community forum at https://esp32.com instead.

INSTRUCTIONS

Before submitting a new issue, please follow the checklist and try to find the answer.

If the issue cannot be solved after the steps above, please follow these instructions so we can get the needed information to help you quickly and effectively.

  1. Fill in all the fields under Environment marked with [ ] by picking the correct option for you in each case and deleting the others.
  2. Describe your issues.
  3. Include debug logs from the "monitor" tool, or coredumps.
  4. Providing as much information as possible under Other Items If Possible will help us locate and fix the problem.
  5. Use Markdown (see formatting buttons above) and the Preview tab to check what the issue will look like.
  6. Delete these instructions from the above to the below marker lines before submitting this issue.

IMPORTANT: Please follow the above instructions and provide as many details as possible. It will save a lot of communication time and improve the efficiency of problem solving. The more details you provide, the faster we may be able to reproduce and resolve the issue. Thanks!

----------------------------- Delete above -----------------------------

Environment

Problem Description

// Detailed problem description goes here. Am I missing something or are these in the wrong order? Think it needs to be REC, MODE, PLAY, SET, VOLDOWN, VOLUP. Haven't yet come across a board with different layout. Let me know if I should do a pull request.

Expected Behavior

typedef enum {
    INPUT_KEY_USER_ID_UNKNOWN                   = -1,   /*!< unknown user id */
    INPUT_KEY_USER_ID_REC                       = 0x01, /*!< user id for recording */
    INPUT_KEY_USER_ID_MODE                      = 0x02, /*!< user id for settings */
    INPUT_KEY_USER_ID_PLAY                      = 0x03, /*!< user id for playing */
    INPUT_KEY_USER_ID_SET                       = 0x04, /*!< user id for mode */
    INPUT_KEY_USER_ID_VOLDOWN                   = 0x05, /*!< user id for volume down */
    INPUT_KEY_USER_ID_VOLUP                     = 0x06, /*!< user id for volume up */
    INPUT_KEY_USER_ID_MUTE                      = 0x07, /*!< user id for mute */
    INPUT_KEY_USER_ID_CAPTURE                   = 0x08, /*!< user id for capture photo */
    INPUT_KEY_USER_ID_MSG                       = 0x09, /*!< user id for message */
    INPUT_KEY_USER_ID_BATTERY_CHARGING          = 0x0A, /*!< user id for battery charging */
    INPUT_KEY_USER_ID_WAKEUP                    = 0x0B, /*!< user id for GPIO wakeup */
    INPUT_KEY_USER_ID_COLOR                     = 0x0C, /*!< user id for color */

    INPUT_KEY_USER_ID_MAX                       = 0x101,
} input_key_user_id_t;

Actual Behavior

typedef enum {
    INPUT_KEY_USER_ID_UNKNOWN                   = -1,   /*!< unknown user id */
    INPUT_KEY_USER_ID_REC                       = 0x01, /*!< user id for recording */
    INPUT_KEY_USER_ID_SET                       = 0x02, /*!< user id for settings */
    INPUT_KEY_USER_ID_PLAY                      = 0x03, /*!< user id for playing */
    INPUT_KEY_USER_ID_MODE                      = 0x04, /*!< user id for mode */
    INPUT_KEY_USER_ID_VOLDOWN                   = 0x05, /*!< user id for volume down */
    INPUT_KEY_USER_ID_VOLUP                     = 0x06, /*!< user id for volume up */
    INPUT_KEY_USER_ID_MUTE                      = 0x07, /*!< user id for mute */
    INPUT_KEY_USER_ID_CAPTURE                   = 0x08, /*!< user id for capture photo */
    INPUT_KEY_USER_ID_MSG                       = 0x09, /*!< user id for message */
    INPUT_KEY_USER_ID_BATTERY_CHARGING          = 0x0A, /*!< user id for battery charging */
    INPUT_KEY_USER_ID_WAKEUP                    = 0x0B, /*!< user id for GPIO wakeup */
    INPUT_KEY_USER_ID_COLOR                     = 0x0C, /*!< user id for color */

    INPUT_KEY_USER_ID_MAX                       = 0x101,
} input_key_user_id_t;

Steps to Reproduce

  1. Examples use this enum like this: if (evt->type == INPUT_KEY_SERVICE_ACTION_CLICK_RELEASE) { ESP_LOGD(TAG, "[ * ] input key id is %d", (int)evt->data); switch ((int)evt->data) { case INPUT_KEY_USER_ID_MODE:

// If possible, attach a picture of your setup/wiring here.

Code to Reproduce This Issue

// the code should be wrapped in the ```cpp tag so that it will be displayed better.
#include "esp_log.h"

void app_main()
{

}

// If your code is longer than 30 lines, GIST is preferred.

Debug Logs

Debug log goes here. It should contain the backtrace, as well as the reset source if it is a crash.
Please copy the plaintext here for us to search the error log. Or attach the complete logs and leave the main part here if the log is *too* long.

Other Items If Possible

TempoTian commented 1 year ago

The definition for common used id is just a ID and have no relation with the key layout. The actual key map is defined in custom board. It will use the key map to search the key pressed is actually which ID. image

Gaai commented 1 year ago

Yes I did find this out. But still. It only works now because the layout/order is wrong everywhere.

Gaai commented 1 year ago

Wrong for the proposed boards at least. LyraT 3.4, the Mini I think. And all clones. Not sure about the others. More logical to follow the order they appear on the board imho. Saves someone from confusing results in the future I'm sure.

Gaai commented 1 year ago

Or does the order really make no difference? I remember having to change the order to get my board working. Else play and set would be wrong way around. Is the order in board definition supposed to reflect the order in the input_key_com_user_id.h?

If I remember correctly I changed the order in board file first for my own reading convenience and then had to change it in input_key_com_user_id.h else it wasn't working. Maybe I remember wrong.

jason-mao commented 1 year ago

This topic has become inactive so I'm going to close the issue. Please reopen this if you have any questions or need any further assistance.