Trackball everywhere, and unPhone buttons

This commit is contained in:
Jonathan Bennett 2025-06-12 23:37:10 -05:00
parent 8794e7bae4
commit b26b74bb24
6 changed files with 29 additions and 10 deletions

View File

@ -302,6 +302,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#error HW_VENDOR must be defined
#endif
#ifndef TB_DOWN
#define TB_DOWN 255
#endif
#ifndef TB_UP
#define TB_UP 255
#endif
#ifndef TB_LEFT
#define TB_LEFT 255
#endif
#ifndef TB_RIGHT
#define TB_RIGHT 255
#endif
#ifndef TB_PRESS
#define TB_PRESS 255
#endif
// Support multiple RGB LED configuration
#if defined(HAS_NCP5623) || defined(HAS_LP5562) || defined(RGBLED_RED) || defined(HAS_NEOPIXEL) || defined(UNPHONE)
#define HAS_RGB_LED

View File

@ -8,11 +8,6 @@ TrackballInterruptImpl1::TrackballInterruptImpl1() : TrackballInterruptBase("tra
void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLeft, uint8_t pinRight, uint8_t pinPress)
{
#if !HAS_TRACKBALL
// Input device is disabled.
return;
#else
input_broker_event eventDown = INPUT_BROKER_DOWN;
input_broker_event eventUp = INPUT_BROKER_UP;
input_broker_event eventLeft = INPUT_BROKER_LEFT;
@ -24,7 +19,6 @@ void TrackballInterruptImpl1::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLe
TrackballInterruptImpl1::handleIntLeft, TrackballInterruptImpl1::handleIntRight,
TrackballInterruptImpl1::handleIntPressed);
inputBroker->registerSource(this);
#endif
}
void TrackballInterruptImpl1::handleIntDown()

View File

@ -431,6 +431,10 @@ void setup()
gpio_pullup_en((gpio_num_t)(config.device.button_gpio ? config.device.button_gpio : BUTTON_PIN));
delay(10);
#endif
#ifdef BUTTON_NEED_PULLUP2
gpio_pullup_en((gpio_num_t)BUTTON_NEED_PULLUP2);
delay(10);
#endif
#endif
#endif
#endif
@ -911,7 +915,7 @@ void setup()
pullup_sense = INPUT_PULLUP_SENSE;
#endif
#endif
#if defined(ARCH_PORTDUINO) // make it work
#if defined(ARCH_PORTDUINO)
if (settingsMap.count(userButtonPin) != 0 && settingsMap[userButtonPin] != RADIOLIB_NC) {

View File

@ -371,7 +371,8 @@ bool CannedMessageModule::isUpEvent(const InputEvent *event)
}
bool CannedMessageModule::isDownEvent(const InputEvent *event)
{
return event->inputEvent == INPUT_BROKER_DOWN;
return event->inputEvent == INPUT_BROKER_DOWN ||
(runState == CANNED_MESSAGE_RUN_STATE_ACTIVE && event->inputEvent == INPUT_BROKER_USER_PRESS);
}
bool CannedMessageModule::isSelectEvent(const InputEvent *event)
{

View File

@ -203,7 +203,7 @@ void setupModules()
aLinuxInputImpl->init();
}
#endif
#if HAS_TRACKBALL && !MESHTASTIC_EXCLUDE_INPUTBROKER
#if !MESHTASTIC_EXCLUDE_INPUTBROKER
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR) {
trackballInterruptImpl1 = new TrackballInterruptImpl1();
trackballInterruptImpl1->init(TB_DOWN, TB_UP, TB_LEFT, TB_RIGHT, TB_PRESS);

View File

@ -57,9 +57,13 @@
#define LED_PIN 13 // the red part of the RGB LED
#define LED_STATE_ON 0 // State when LED is lit
#define BUTTON_PIN 21 // Button 3 - square - top button in landscape mode
#define TB_UP 21 // Button 3 - square - top button in landscape mode
#define BUTTON_NEED_PULLUP2 TB_UP
#define BUTTON_PIN 0 // Circle button
#define BUTTON_NEED_PULLUP // we do need a helping hand up
#define CANCEL_BUTTON_PIN 45 // Button 1 - triangle - bottom button in landscape mode
#define CANCEL_BUTTON_ACTIVE_LOW true
#define CANCEL_BUTTON_ACTIVE_PULLUP true
#define I2C_SDA 3 // I2C pins for this board
#define I2C_SCL 4