MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.15k stars 19.21k forks source link

[FR] button multiplexing #22726

Open bulbersator opened 3 years ago

bulbersator commented 3 years ago

Is your feature request related to a problem? Please describe.

Button support has been added recently, but most motherboards don't have many pins free. Multiplexing will allow more buttons to be operated.

Are you looking for hardware support?

No response

Describe the feature you want

In the button configuration, I would like to be able to set the pins that support the buttons multiplexing. Like in the table below with pin names and button behaviour.

Screenshot_1

Additional context

No response

thinkyhead commented 2 years ago

It's a pretty neat idea and not very difficult. Someone will likely take an interest and implement it.

UMO-printing commented 2 years ago

Arduino has a library for reading matrix buttons, perhaps that would be a good point to start from. The Arduino library to start from is here: https://github.com/Nullkraft/Keypad

The original creators of this library are: Mark Stanley and Alexander Brevig The official Arduino library is owned by Alexander Brevig, but he has not been contactable for several years, so Mark Stanley has been the one who has been updating a Keypad library in recent years. And Mark Stanley's updated library is available here: https://github.com/Nullkraft/Keypad

Among other functions, the Nullkraft/Keypad library can deal with multiple, simultaneous, keypresses.

SauravMaheshkar commented 2 years ago

I'd like to take this up @thinkyhead, can anyone guide as to where the changes should be made ?

UMO-printing commented 2 years ago

Hmmm... an important part of the "challenge" is: to determine where, how and what changes should be made.

Whenever I try to implement an idea, I usually start by searching for the keywords used in the #define statements in the config.h and/or config_adv.h files. Such searches will unveil all the places in the code, where these keywords are referenced.

From there, one can try to uncover what the current code does. And once you know that, then it is time to think up how to implement the new code.

Well, these are the steps I tend to use. Others might use a different approach.

UMO-printing commented 2 years ago

It would seem that custom buttons are set in config_adv.h using the #define CUSTOM_USER_BUTTONS token

And it would seem, that much program action about custom buttons happens in MarlinCore.cpp

Does this help you to see where the current code is?

bulbersator commented 2 years ago

I started working on this, but in the meantime I switched to other firmware for other reasons. That's fairly easy to implement, you just need to use the existing custom user buttons function and simply add logic conditions for checking 3 or more pins, instead of one.

sob., 1 sty 2022, 13:43 użytkownik MrAlvin @.***> napisał:

It would seem that custom buttons are set in config_adv.h using the #define CUSTOM_USER_BUTTONS token

And it would seem, that much program action about custom buttons happens in MarlinCore.cpp

Does this help you to see where the current code is?

— Reply to this email directly, view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/22726#issuecomment-1003553638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVQ3MF27LESXFUQWVAEU3H3UT3ZHNANCNFSM5DTKVPNA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>