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 all 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
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
;default_envs = wio-e5
;default_envs = radiomaster_900_bandit_nano
;default_envs = radiomaster_900_bandit_micro
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,18 @@
; 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/>
-DMESHTASTIC_EXCLUDE_WIFI=1
-DMESHTASTIC_EXCLUDE_EXTERNALNOTIFICATION=1
-DMESHTASTIC_EXCLUDE_WAYPOINT=1
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.
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ SO GPIO 39/TXEN MAY NOT BE DEFINED FOR SUCCESSFUL OPERATION OF THE SX1262 - TG
// Therefore must be 1 to keep peripherals powered
// Power is on the controllable 3V3_S rail
// #define PIN_GPS_RESET (34)
#define PIN_GPS_EN PIN_3V3_EN
// #define PIN_GPS_EN PIN_3V3_EN
#define PIN_GPS_PPS (17) // Pulse per second input from the GPS

#define GPS_RX_PIN PIN_SERIAL1_RX
Expand Down
Loading