* Improve the processing speed of virtual keyboards
* Remove the disable GPS feature, as it would interfere with the normal use of TFT
* Changed the default screen sleep time to 30s
This commit is contained in:
Daniel Cao 2024-11-08 15:01:49 +08:00 committed by Tom Fifield
parent 2c2213ef9b
commit 551ff1df7b
5 changed files with 46 additions and 2 deletions

View File

@ -165,6 +165,7 @@ int32_t ButtonThread::runOnce()
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
switch (multipressClickCount) {
#if HAS_GPS
#ifndef RAK14014 //The power supply of the GPS of RAK14014 cannot be turned off. Once turned off, the screen will not be usedThey are the same power source
// 3 clicks: toggle GPS
case 3:
if (!config.device.disable_triple_click && (gps != nullptr)) {
@ -174,6 +175,7 @@ int32_t ButtonThread::runOnce()
}
break;
#endif
#endif
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
// 4 clicks: toggle backlight
case 4:

View File

@ -1,6 +1,10 @@
#include "TouchScreenBase.h"
#include "main.h"
#if defined(RAK14014) && !defined(MESHTASTIC_EXCLUDE_CANNEDMESSAGES)
#include "modules/CannedMessageModule.h"
#endif
#ifndef TIME_LONG_PRESS
#define TIME_LONG_PRESS 400
#endif
@ -102,12 +106,32 @@ int32_t TouchScreenBase::runOnce()
}
_touchedOld = touched;
#if defined RAK14014
// Speed up the processing speed of the keyboard in virtual keyboard mode
auto state = cannedMessageModule->getRunState();
if ( state == CANNED_MESSAGE_RUN_STATE_FREETEXT ) {
if(_tapped)
{
_tapped = false;
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y);
}
} else
{
if (_tapped && (time_t(millis()) - _start) > TIME_LONG_PRESS - 50) {
_tapped = false;
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y);
}
}
#else
// fire TAP event when no 2nd tap occured within time
if (_tapped && (time_t(millis()) - _start) > TIME_LONG_PRESS - 50) {
_tapped = false;
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)", _last_x, _last_y);
}
#endif
// fire LONG_PRESS event without the need for release
if (touched && (time_t(millis()) - _start) > TIME_LONG_PRESS) {

View File

@ -473,7 +473,7 @@ void NodeDB::initConfigIntervals()
config.display.screen_on_secs = default_screen_on_secs;
#if defined(T_WATCH_S3) || defined(T_DECK)
#if defined(T_WATCH_S3) || defined(T_DECK) || defined(RAK14014)
config.power.is_power_saving = true;
config.display.screen_on_secs = 30;
config.power.wait_bluetooth_secs = 30;

View File

@ -325,7 +325,9 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
this->shift = !this->shift;
} else if (keyTapped == "") {
#ifndef RAK14014
this->highlight = keyTapped[0];
#endif
this->payload = 0x08;
@ -341,7 +343,9 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
validEvent = true;
} else if (keyTapped == " ") {
#ifndef RAK14014
this->highlight = keyTapped[0];
#endif
this->payload = keyTapped[0];
@ -361,7 +365,9 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
this->shift = false;
} else if (keyTapped != "") {
#ifndef RAK14014
this->highlight = keyTapped[0];
#endif
this->payload = this->shift ? keyTapped[0] : std::tolower(keyTapped[0]);
@ -830,6 +836,12 @@ void CannedMessageModule::drawKeyboard(OLEDDisplay *display, OLEDDisplayUiState
Letter updatedLetter = {letter.character, letter.width, xOffset, yOffset, cellWidth, cellHeight};
#ifdef RAK14014 //Optimize the touch range of the virtual keyboard in the bottom row
if(outerIndex == outerSize - 1)
{
updatedLetter.rectHeight = 240 - yOffset;
}
#endif
this->keyboard[this->charSet][outerIndex][innerIndex] = updatedLetter;
float characterOffset = ((cellWidth / 2) - (letter.width / 2));

View File

@ -68,6 +68,12 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
String drawWithCursor(String text, int cursor);
#ifdef RAK14014
cannedMessageModuleRunState getRunState() const {
return runState;
}
#endif
/*
-Override the wantPacket method. We need the Routing Messages to look for ACKs.
*/