Perform the specified encoder action If 'action' is zero then the button was pressed, else 'action' is the number of clicks (+ve for clockwise) EncoderAction is what's called in response to all wheel/button actions; a convenient place to set new timeout values
| 661 | // If 'action' is zero then the button was pressed, else 'action' is the number of clicks (+ve for clockwise) |
| 662 | // EncoderAction is what's called in response to all wheel/button actions; a convenient place to set new timeout values |
| 663 | void Menu::EncoderAction(int action) noexcept |
| 664 | { |
| 665 | if (displayingErrorMessage) |
| 666 | { |
| 667 | // Allow the message to be cancelled by a push |
| 668 | if (action == 0) |
| 669 | { |
| 670 | timeoutValue = 1; // cancel the timeout at the next tick |
| 671 | } |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | if (itemIsSelected) // send the wheel action (scroll or click) to the item itself |
| 676 | { |
| 677 | if (highlightedItem != nullptr && highlightedItem->IsVisible()) |
| 678 | { |
| 679 | const bool done = highlightedItem->Adjust(action); |
| 680 | if (done) |
| 681 | { |
| 682 | itemIsSelected = false; |
| 683 | } |
| 684 | } |
| 685 | else |
| 686 | { |
| 687 | itemIsSelected = false; // should not get here |
| 688 | } |
| 689 | } |
| 690 | else if (action != 0) // scroll without an item under selection |
| 691 | { |
| 692 | EncoderActionScrollItemHelper(action); |
| 693 | } |
| 694 | else // click without an item under selection |
| 695 | { |
| 696 | EncoderActionEnterItemHelper(); |
| 697 | } |
| 698 | |
| 699 | if (!displayingErrorMessage && !displayingMessageBox) // if the operation did not result in an error and we are not displaying a message box |
| 700 | { |
| 701 | lastActionTime = millis(); |
| 702 | timeoutValue = InactivityTimeout; |
| 703 | } |
| 704 | } |
| 705 | } |
| 706 | |
| 707 | /*static*/ const char *_ecv_array Menu::SkipWhitespace(const char *_ecv_array s) noexcept |
| 708 | { |