From d8381aa905dbe48daa3569fecde137547c9664eb Mon Sep 17 00:00:00 2001 From: Markus <974709+Links2004@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:32:56 +0200 Subject: [PATCH] Fix init for InputEvent (#8015) --- src/input/ExpressLRSFiveWay.cpp | 2 +- src/input/LinuxInput.cpp | 2 +- src/input/RotaryEncoderInterruptBase.cpp | 2 +- src/input/SeesawRotary.cpp | 2 +- src/input/SerialKeyboard.cpp | 4 ++-- src/input/TouchScreenImpl1.cpp | 2 +- src/input/TrackballInterruptBase.cpp | 2 +- src/input/UpDownInterruptBase.cpp | 2 +- src/input/kbI2cBase.cpp | 10 +++++----- src/input/kbMatrixBase.cpp | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/input/ExpressLRSFiveWay.cpp b/src/input/ExpressLRSFiveWay.cpp index 776b9001d..01712ad2a 100644 --- a/src/input/ExpressLRSFiveWay.cpp +++ b/src/input/ExpressLRSFiveWay.cpp @@ -188,7 +188,7 @@ void ExpressLRSFiveWay::determineAction(KeyType key, PressLength length) // Feed input to the canned messages module void ExpressLRSFiveWay::sendKey(input_broker_event key) { - InputEvent e; + InputEvent e = {}; e.source = inputSourceName; e.inputEvent = key; notifyObservers(&e); diff --git a/src/input/LinuxInput.cpp b/src/input/LinuxInput.cpp index 1f80fd5d3..fee7c8ded 100644 --- a/src/input/LinuxInput.cpp +++ b/src/input/LinuxInput.cpp @@ -73,7 +73,7 @@ int32_t LinuxInput::runOnce() int rd = read(events[i].data.fd, ev, sizeof(ev)); assert(rd > ((signed int)sizeof(struct input_event))); for (int j = 0; j < rd / ((signed int)sizeof(struct input_event)); j++) { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; e.kbchar = 0; diff --git a/src/input/RotaryEncoderInterruptBase.cpp b/src/input/RotaryEncoderInterruptBase.cpp index 204a0fbf0..016727cd7 100644 --- a/src/input/RotaryEncoderInterruptBase.cpp +++ b/src/input/RotaryEncoderInterruptBase.cpp @@ -45,7 +45,7 @@ void RotaryEncoderInterruptBase::init( int32_t RotaryEncoderInterruptBase::runOnce() { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; unsigned long now = millis(); diff --git a/src/input/SeesawRotary.cpp b/src/input/SeesawRotary.cpp index c212773c4..0a6e6e974 100644 --- a/src/input/SeesawRotary.cpp +++ b/src/input/SeesawRotary.cpp @@ -49,7 +49,7 @@ bool SeesawRotary::init() int32_t SeesawRotary::runOnce() { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; bool currentlyPressed = !ss.digitalRead(SS_SWITCH); diff --git a/src/input/SerialKeyboard.cpp b/src/input/SerialKeyboard.cpp index 63501bda5..2df1ace70 100644 --- a/src/input/SerialKeyboard.cpp +++ b/src/input/SerialKeyboard.cpp @@ -29,7 +29,7 @@ SerialKeyboard::SerialKeyboard(const char *name) : concurrency::OSThread(name) void SerialKeyboard::erase() { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_BACK; e.kbchar = 0x08; e.source = this->_originName; @@ -80,7 +80,7 @@ int32_t SerialKeyboard::runOnce() if (keys < prevKeys) { // a new key has been pressed (and not released), doesn't works for multiple presses at once but // shouldn't be a limitation - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; // SELECT OR SEND OR CANCEL EVENT diff --git a/src/input/TouchScreenImpl1.cpp b/src/input/TouchScreenImpl1.cpp index c0e220941..69dcab04e 100644 --- a/src/input/TouchScreenImpl1.cpp +++ b/src/input/TouchScreenImpl1.cpp @@ -47,7 +47,7 @@ bool TouchScreenImpl1::getTouch(int16_t &x, int16_t &y) */ void TouchScreenImpl1::onEvent(const TouchEvent &event) { - InputEvent e; + InputEvent e = {}; e.source = event.source; e.kbchar = 0; e.touchX = event.x; diff --git a/src/input/TrackballInterruptBase.cpp b/src/input/TrackballInterruptBase.cpp index 4c8ce6409..4ddaf7064 100644 --- a/src/input/TrackballInterruptBase.cpp +++ b/src/input/TrackballInterruptBase.cpp @@ -51,7 +51,7 @@ void TrackballInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinLef int32_t TrackballInterruptBase::runOnce() { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; // Handle long press detection for press button diff --git a/src/input/UpDownInterruptBase.cpp b/src/input/UpDownInterruptBase.cpp index 0bf0f5cd4..d597c8d8f 100644 --- a/src/input/UpDownInterruptBase.cpp +++ b/src/input/UpDownInterruptBase.cpp @@ -48,7 +48,7 @@ void UpDownInterruptBase::init(uint8_t pinDown, uint8_t pinUp, uint8_t pinPress, int32_t UpDownInterruptBase::runOnce() { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; unsigned long now = millis(); diff --git a/src/input/kbI2cBase.cpp b/src/input/kbI2cBase.cpp index 5db1e39a9..3f5d4d184 100644 --- a/src/input/kbI2cBase.cpp +++ b/src/input/kbI2cBase.cpp @@ -90,7 +90,7 @@ int32_t KbI2cBase::runOnce() while (keyCount--) { const BBQ10Keyboard::KeyEvent key = Q10keyboard.keyEvent(); if ((key.key != 0x00) && (key.state == BBQ10Keyboard::StateRelease)) { - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; switch (key.key) { @@ -187,7 +187,7 @@ int32_t KbI2cBase::runOnce() } case 0x37: { // MPR121 MPRkeyboard.trigger(); - InputEvent e; + InputEvent e = {}; while (MPRkeyboard.hasEvent()) { char nextEvent = MPRkeyboard.dequeueEvent(); @@ -250,7 +250,7 @@ int32_t KbI2cBase::runOnce() } case 0x84: { // Adafruit TCA8418 TCAKeyboard.trigger(); - InputEvent e; + InputEvent e = {}; while (TCAKeyboard.hasEvent()) { char nextEvent = TCAKeyboard.dequeueEvent(); e.inputEvent = INPUT_BROKER_ANYKEY; @@ -350,7 +350,7 @@ int32_t KbI2cBase::runOnce() } if (PrintDataBuf != 0) { LOG_DEBUG("RAK14004 key 0x%x pressed", PrintDataBuf); - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_MATRIXKEY; e.source = this->_originName; e.kbchar = PrintDataBuf; @@ -365,7 +365,7 @@ int32_t KbI2cBase::runOnce() if (i2cBus->available()) { char c = i2cBus->read(); - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; switch (c) { diff --git a/src/input/kbMatrixBase.cpp b/src/input/kbMatrixBase.cpp index 05f4d8177..18243f3bf 100644 --- a/src/input/kbMatrixBase.cpp +++ b/src/input/kbMatrixBase.cpp @@ -72,7 +72,7 @@ int32_t KbMatrixBase::runOnce() if (key != 0) { LOG_DEBUG("Key 0x%x pressed", key); // reset shift now that we have a keypress - InputEvent e; + InputEvent e = {}; e.inputEvent = INPUT_BROKER_NONE; e.source = this->_originName; switch (key) {