Skip to content

One button support in tcMenu #482

@davetcc

Description

@davetcc

Discussed in #481

Originally posted by Icesythe7 July 21, 2024
I am trying to use the 1 button already on my esp32 (as to not add more unneeded hardware), however I can't figure out how to navigate the menus as the documentation on it seems lacking?

    const auto press_type = PollButton();
    static uint8_t last_press_type = 0xFF;

    if (press_type != last_press_type) {
        last_press_type = press_type;
        switch (press_type) {
        case none:
            Serial.println("No Press Detected");
            menuMgr.onMenuSelect(false);
            break;
        case single_press:
            Serial.println("Single Press Detected");
            menuMgr.performDirectionMove(false);
            break;
        case double_press:
            Serial.println("Double Press Detected");
            menuMgr.onMenuSelect(true);
            break;
        case long_press:
            Serial.println("Long Press Detected");
            menuMgr.performDirectionMove(true);
            break;
        default:
            break;
        }
    }

This is what I am currently trying given the info I can scrape up but nothing is happening in the menu however the serial output is correct so I know it is being called.

EDIT: To be clear is there not just a simple method to call to advance the menu or select an item etc where we can handle the input on our own and just call a whatever method we need for x input?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions