trunk fmt

This commit is contained in:
Daniel Cao 2024-11-08 16:55:09 +08:00 committed by Tom Fifield
parent 551ff1df7b
commit ac912c9bf9
4 changed files with 20 additions and 24 deletions

View File

@ -165,7 +165,8 @@ int32_t ButtonThread::runOnce()
LOG_BUTTON("Mulitipress! %hux", multipressClickCount); LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
switch (multipressClickCount) { switch (multipressClickCount) {
#if HAS_GPS #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 #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 // 3 clicks: toggle GPS
case 3: case 3:
if (!config.device.disable_triple_click && (gps != nullptr)) { if (!config.device.disable_triple_click && (gps != nullptr)) {
@ -174,7 +175,7 @@ int32_t ButtonThread::runOnce()
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
} }
break; break;
#endif #endif
#endif #endif
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo #if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
// 4 clicks: toggle backlight // 4 clicks: toggle backlight

View File

@ -109,20 +109,18 @@ int32_t TouchScreenBase::runOnce()
#if defined RAK14014 #if defined RAK14014
// Speed up the processing speed of the keyboard in virtual keyboard mode // Speed up the processing speed of the keyboard in virtual keyboard mode
auto state = cannedMessageModule->getRunState(); auto state = cannedMessageModule->getRunState();
if ( state == CANNED_MESSAGE_RUN_STATE_FREETEXT ) { if (state == CANNED_MESSAGE_RUN_STATE_FREETEXT) {
if(_tapped) if (_tapped) {
{
_tapped = false; _tapped = false;
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP); e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y); LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y);
} }
} else } else {
{ if (_tapped && (time_t(millis()) - _start) > TIME_LONG_PRESS - 50) {
if (_tapped && (time_t(millis()) - _start) > TIME_LONG_PRESS - 50) {
_tapped = false; _tapped = false;
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP); e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y); LOG_DEBUG("action TAP(%d/%d)\n", _last_x, _last_y);
} }
} }
#else #else
// fire TAP event when no 2nd tap occured within time // fire TAP event when no 2nd tap occured within time
@ -131,7 +129,7 @@ int32_t TouchScreenBase::runOnce()
e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP); e.touchEvent = static_cast<char>(TOUCH_ACTION_TAP);
LOG_DEBUG("action TAP(%d/%d)", _last_x, _last_y); LOG_DEBUG("action TAP(%d/%d)", _last_x, _last_y);
} }
#endif #endif
// fire LONG_PRESS event without the need for release // fire LONG_PRESS event without the need for release
if (touched && (time_t(millis()) - _start) > TIME_LONG_PRESS) { if (touched && (time_t(millis()) - _start) > TIME_LONG_PRESS) {

View File

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

View File

@ -69,9 +69,7 @@ class CannedMessageModule : public SinglePortModule, public Observable<const UIF
String drawWithCursor(String text, int cursor); String drawWithCursor(String text, int cursor);
#ifdef RAK14014 #ifdef RAK14014
cannedMessageModuleRunState getRunState() const { cannedMessageModuleRunState getRunState() const { return runState; }
return runState;
}
#endif #endif
/* /*