Merge pull request #1338 from meshtastic/patch-1

Remove OSThread from UpDown Input.
pull/1339/head^2
Thomas Göttgens 2022-03-30 15:20:58 +02:00 zatwierdzone przez GitHub
commit 9586a2e932
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 2 dodań i 14 usunięć

Wyświetl plik

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

Wyświetl plik

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