Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rak10701 (rak wismeshtap) optimization #5280

Merged
merged 18 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = tbeam
;default_envs = tbeam
;default_envs = pico
;default_envs = tbeam-s3-core
;default_envs = tbeam0.7
Expand All @@ -29,7 +29,7 @@ default_envs = tbeam
;default_envs = rak4631
;default_envs = rak4631_eth_gw
;default_envs = rak2560
;default_envs = rak10701
default_envs = rak_wismeshtap
DanielCao0 marked this conversation as resolved.
Show resolved Hide resolved
;default_envs = wio-e5
;default_envs = radiomaster_900_bandit_nano
;default_envs = radiomaster_900_bandit_micro
Expand Down
3 changes: 3 additions & 0 deletions src/ButtonThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ 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
// used,They are the same power source
// 3 clicks: toggle GPS
case 3:
if (!config.device.disable_triple_click && (gps != nullptr)) {
Expand All @@ -174,6 +176,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:
Expand Down
22 changes: 22 additions & 0 deletions src/input/TouchScreenBase.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -102,12 +106,30 @@ 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) {
Expand Down
2 changes: 1 addition & 1 deletion src/mesh/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions src/modules/CannedMessageModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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];

Expand All @@ -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]);

Expand Down Expand Up @@ -830,6 +836,11 @@ 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));
Expand Down
4 changes: 4 additions & 0 deletions src/modules/CannedMessageModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ 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.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
; The very slick RAK wireless RAK10701 Field Tester device. Note you will have to flash to Arduino bootloader to use this firmware. Be aware touch is not currently working.
[env:rak10701]
[env:rak_wismeshtap]
extends = nrf52840_base
board_level = extra
board = wiscore_rak4631
build_flags = ${nrf52840_base.build_flags} -Ivariants/rak10701 -D RAK_4631
build_flags = ${nrf52840_base.build_flags} -Ivariants/rak_wismeshtap -D RAK_4631
-L "${platformio.libdeps_dir}/${this.__env__}/bsec2/src/cortex-m4/fpv4-sp-d16-hard"
-DGPS_POWER_TOGGLE ; comment this line to disable triple press function on the user button to turn off gps entirely.
-DEINK_DISPLAY_MODEL=GxEPD2_213_BN
-DEINK_WIDTH=250
-DEINK_HEIGHT=122
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak10701> +<mesh/eth/> +<mesh/api/> +<mqtt/>
build_src_filter = ${nrf52_base.build_src_filter} +<../variants/rak_wismeshtap> +<mesh/eth/> +<mesh/api/> +<mqtt/>
lib_deps =
${nrf52840_base.lib_deps}
${networking_base.lib_deps}
Expand Down
File renamed without changes.
File renamed without changes.