Merge pull request #1338 from meshtastic/patch-1

Remove OSThread from UpDown Input.
This commit is contained in:
Thomas Göttgens 2022-03-30 15:20:58 +02:00 committed by GitHub
commit 9586a2e932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 14 deletions

View File

@ -2,8 +2,7 @@
#include "UpDownInterruptBase.h" #include "UpDownInterruptBase.h"
UpDownInterruptBase::UpDownInterruptBase( UpDownInterruptBase::UpDownInterruptBase(
const char *name) : const char *name)
concurrency::OSThread(name)
{ {
this->_originName = name; this->_originName = name;
} }
@ -31,11 +30,6 @@ void UpDownInterruptBase::init(
this->_pinDown, this->_pinUp, pinPress); this->_pinDown, this->_pinUp, pinPress);
} }
int32_t UpDownInterruptBase::runOnce()
{
return 30000; // TODO: technically this can be MAX_INT
}
void UpDownInterruptBase::intPressHandler() void UpDownInterruptBase::intPressHandler()
{ {
InputEvent e; InputEvent e;
@ -43,7 +37,6 @@ void UpDownInterruptBase::intPressHandler()
DEBUG_MSG("GPIO event Press\n"); DEBUG_MSG("GPIO event Press\n");
e.inputEvent = this->_eventPressed; e.inputEvent = this->_eventPressed;
this->notifyObservers(&e); this->notifyObservers(&e);
setIntervalFromNow(20); // TODO: this modifies a non-volatile variable!
} }
void UpDownInterruptBase::intDownHandler() void UpDownInterruptBase::intDownHandler()
@ -53,7 +46,6 @@ void UpDownInterruptBase::intDownHandler()
DEBUG_MSG("GPIO event Down\n"); DEBUG_MSG("GPIO event Down\n");
e.inputEvent = this->_eventDown; e.inputEvent = this->_eventDown;
this->notifyObservers(&e); this->notifyObservers(&e);
setIntervalFromNow(20);
} }
void UpDownInterruptBase::intUpHandler() void UpDownInterruptBase::intUpHandler()
@ -63,5 +55,4 @@ void UpDownInterruptBase::intUpHandler()
DEBUG_MSG("GPIO event Up\n"); DEBUG_MSG("GPIO event Up\n");
e.inputEvent = this->_eventUp; e.inputEvent = this->_eventUp;
this->notifyObservers(&e); this->notifyObservers(&e);
setIntervalFromNow(20);
} }

View File

@ -4,8 +4,7 @@
#include "InputBroker.h" #include "InputBroker.h"
class UpDownInterruptBase : class UpDownInterruptBase :
public Observable<const InputEvent *>, public Observable<const InputEvent *>
private concurrency::OSThread
{ {
public: public:
explicit UpDownInterruptBase( explicit UpDownInterruptBase(
@ -18,8 +17,6 @@ class UpDownInterruptBase :
void intDownHandler(); void intDownHandler();
void intUpHandler(); void intUpHandler();
protected:
virtual int32_t runOnce() override;
private: private:
uint8_t _pinDown = 0; uint8_t _pinDown = 0;
uint8_t _pinUp = 0; uint8_t _pinUp = 0;