mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-29 22:20:37 +00:00
Screen update event.
This commit is contained in:
@@ -146,17 +146,19 @@ int32_t CannedMessagePlugin::runOnce()
|
||||
return 30000; // TODO: should return MAX_VAL
|
||||
}
|
||||
DEBUG_MSG("Check status\n");
|
||||
UIFrameEvent e = {false, true};
|
||||
if (this->sendingState == SENDING_STATE_ACTIVE)
|
||||
{
|
||||
// TODO: might have some feedback of sendig state
|
||||
this->sendingState = SENDING_STATE_NONE;
|
||||
this->notifyObservers(NULL);
|
||||
this->notifyObservers(&e);
|
||||
}
|
||||
else if ((this->action != CANNED_MESSAGE_ACTION_NONE)
|
||||
&& (this->currentMessageIndex == -1))
|
||||
{
|
||||
this->currentMessageIndex = 0;
|
||||
DEBUG_MSG("First touch.\n");
|
||||
e.frameChanged = true;
|
||||
}
|
||||
else if (this->action == CANNED_MESSAGE_ACTION_SELECT)
|
||||
{
|
||||
@@ -166,7 +168,7 @@ int32_t CannedMessagePlugin::runOnce()
|
||||
true);
|
||||
this->sendingState = SENDING_STATE_ACTIVE;
|
||||
this->currentMessageIndex = -1;
|
||||
this->notifyObservers(NULL);
|
||||
this->notifyObservers(&e);
|
||||
return 2000;
|
||||
}
|
||||
else if (this->action == CANNED_MESSAGE_ACTION_UP)
|
||||
@@ -182,7 +184,7 @@ int32_t CannedMessagePlugin::runOnce()
|
||||
if (this->action != CANNED_MESSAGE_ACTION_NONE)
|
||||
{
|
||||
this->action = CANNED_MESSAGE_ACTION_NONE;
|
||||
this->notifyObservers(NULL);
|
||||
this->notifyObservers(&e);
|
||||
}
|
||||
|
||||
return 30000; // TODO: should return MAX_VAL
|
||||
|
||||
@@ -17,11 +17,12 @@ enum cannedMessagePluginSendigState
|
||||
SENDING_STATE_ACTIVE
|
||||
};
|
||||
|
||||
|
||||
#define CANNED_MESSAGE_PLUGIN_MESSAGE_MAX_COUNT 50
|
||||
|
||||
class CannedMessagePlugin :
|
||||
public SinglePortPlugin,
|
||||
public Observable<const meshtastic::Status *>,
|
||||
public Observable<const UIFrameEvent *>,
|
||||
private concurrency::OSThread
|
||||
{
|
||||
CallbackObserver<CannedMessagePlugin, const InputEvent *> inputObserver =
|
||||
@@ -53,6 +54,7 @@ class CannedMessagePlugin :
|
||||
|
||||
int handleInputEvent(const InputEvent *event);
|
||||
virtual bool wantUIFrame() { return this->shouldDraw(); }
|
||||
virtual Observable<const UIFrameEvent *>* getUIFrameObservable() { return this; }
|
||||
virtual void drawFrame(
|
||||
OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y);
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ int32_t RotaryEncoderInterruptBase::runOnce()
|
||||
|
||||
this->action = ROTARY_ACTION_NONE;
|
||||
|
||||
return 30000;
|
||||
return 30000; // TODO: technically this can be MAX_INT
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void RotaryEncoderInterruptBase::intPressHandler()
|
||||
{
|
||||
this->action = ROTARY_ACTION_PRESSED;
|
||||
runned(millis());
|
||||
setInterval(20);
|
||||
setInterval(20); // TODO: this modifies a non-volatile variable!
|
||||
}
|
||||
|
||||
void RotaryEncoderInterruptBase::intAHandler()
|
||||
@@ -144,7 +144,7 @@ RotaryEncoderInterruptBaseStateType RotaryEncoderInterruptBase::intHandler(
|
||||
newState = ROTARY_EVENT_CLEARED;
|
||||
}
|
||||
runned(millis());
|
||||
setInterval(50);
|
||||
setInterval(50); // TODO: this modifies a non-volatile variable!
|
||||
|
||||
return newState;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user