mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 02:15:41 +00:00
Add osk_found On-Screen Keyboard found as the global variable.
This commit is contained in:
parent
de5e581f1e
commit
f4af02544e
@ -1,5 +1,6 @@
|
|||||||
#include "RotaryEncoderInterruptImpl1.h"
|
#include "RotaryEncoderInterruptImpl1.h"
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
|
extern bool osk_found;
|
||||||
|
|
||||||
RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ bool RotaryEncoderInterruptImpl1::init()
|
|||||||
RotaryEncoderInterruptImpl1::handleIntA, RotaryEncoderInterruptImpl1::handleIntB,
|
RotaryEncoderInterruptImpl1::handleIntA, RotaryEncoderInterruptImpl1::handleIntB,
|
||||||
RotaryEncoderInterruptImpl1::handleIntPressed);
|
RotaryEncoderInterruptImpl1::handleIntPressed);
|
||||||
inputBroker->registerSource(this);
|
inputBroker->registerSource(this);
|
||||||
|
osk_found = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "UpDownInterruptImpl1.h"
|
#include "UpDownInterruptImpl1.h"
|
||||||
#include "InputBroker.h"
|
#include "InputBroker.h"
|
||||||
|
extern bool osk_found;
|
||||||
|
|
||||||
UpDownInterruptImpl1 *upDownInterruptImpl1;
|
UpDownInterruptImpl1 *upDownInterruptImpl1;
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ bool UpDownInterruptImpl1::init()
|
|||||||
eventDownLong, UpDownInterruptImpl1::handleIntDown, UpDownInterruptImpl1::handleIntUp,
|
eventDownLong, UpDownInterruptImpl1::handleIntDown, UpDownInterruptImpl1::handleIntUp,
|
||||||
UpDownInterruptImpl1::handleIntPressed);
|
UpDownInterruptImpl1::handleIntPressed);
|
||||||
inputBroker->registerSource(this);
|
inputBroker->registerSource(this);
|
||||||
|
osk_found = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +187,8 @@ ScanI2C::DeviceAddress cardkb_found = ScanI2C::ADDRESS_NONE;
|
|||||||
uint8_t kb_model;
|
uint8_t kb_model;
|
||||||
// global bool to record that a kb is present
|
// global bool to record that a kb is present
|
||||||
bool kb_found = false;
|
bool kb_found = false;
|
||||||
|
// global bool to record that on-screen keyboard (OSK) is present
|
||||||
|
bool osk_found = false;
|
||||||
|
|
||||||
// The I2C address of the RTC Module (if found)
|
// The I2C address of the RTC Module (if found)
|
||||||
ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
|
ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
|
||||||
@ -1390,6 +1392,10 @@ void setup()
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(HAS_TRACKBALL) || (defined(INPUTDRIVER_ENCODER_TYPE) && INPUTDRIVER_ENCODER_TYPE == 2)
|
||||||
|
osk_found = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER
|
#if defined(ARCH_ESP32) && !MESHTASTIC_EXCLUDE_WEBSERVER
|
||||||
// Start web server thread.
|
// Start web server thread.
|
||||||
webServerThread = new WebServerThread();
|
webServerThread = new WebServerThread();
|
||||||
|
@ -32,6 +32,7 @@ extern ScanI2C::DeviceAddress screen_found;
|
|||||||
extern ScanI2C::DeviceAddress cardkb_found;
|
extern ScanI2C::DeviceAddress cardkb_found;
|
||||||
extern uint8_t kb_model;
|
extern uint8_t kb_model;
|
||||||
extern bool kb_found;
|
extern bool kb_found;
|
||||||
|
extern bool osk_found;
|
||||||
extern ScanI2C::DeviceAddress rtc_found;
|
extern ScanI2C::DeviceAddress rtc_found;
|
||||||
extern ScanI2C::DeviceAddress accelerometer_found;
|
extern ScanI2C::DeviceAddress accelerometer_found;
|
||||||
extern ScanI2C::FoundDevice rgb_found;
|
extern ScanI2C::FoundDevice rgb_found;
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
extern ScanI2C::DeviceAddress cardkb_found;
|
extern ScanI2C::DeviceAddress cardkb_found;
|
||||||
extern bool graphics::isMuted;
|
extern bool graphics::isMuted;
|
||||||
|
extern bool osk_found;
|
||||||
|
|
||||||
static const char *cannedMessagesConfigFile = "/prefs/cannedConf.proto";
|
static const char *cannedMessagesConfigFile = "/prefs/cannedConf.proto";
|
||||||
|
|
||||||
@ -125,20 +126,11 @@ int CannedMessageModule::splitConfiguredMessages()
|
|||||||
int tempCount = 0;
|
int tempCount = 0;
|
||||||
// Insert at position 0 (top)
|
// Insert at position 0 (top)
|
||||||
tempMessages[tempCount++] = "[Select Destination]";
|
tempMessages[tempCount++] = "[Select Destination]";
|
||||||
|
|
||||||
#if defined(USE_VIRTUAL_KEYBOARD)
|
#if defined(USE_VIRTUAL_KEYBOARD)
|
||||||
// Add a "Free Text" entry at the top if using a touch screen virtual keyboard
|
// Add a "Free Text" entry at the top if using a touch screen virtual keyboard
|
||||||
tempMessages[tempCount++] = "[-- Free Text --]";
|
tempMessages[tempCount++] = "[-- Free Text --]";
|
||||||
#else
|
#else
|
||||||
// For devices with encoder input or trackball, also add Free Text option
|
if (osk_found && screen) {
|
||||||
#if HAS_TRACKBALL
|
|
||||||
extern TrackballInterruptImpl1 *trackballInterruptImpl1;
|
|
||||||
if (trackballInterruptImpl1) {
|
|
||||||
#else
|
|
||||||
extern RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
|
||||||
extern UpDownInterruptImpl1 *upDownInterruptImpl1;
|
|
||||||
if (rotaryEncoderInterruptImpl1 || upDownInterruptImpl1) {
|
|
||||||
#endif
|
|
||||||
tempMessages[tempCount++] = "[-- Free Text --]";
|
tempMessages[tempCount++] = "[-- Free Text --]";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -610,18 +602,9 @@ bool CannedMessageModule::handleMessageSelectorInput(const InputEvent *event, bo
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (strcmp(current, "[-- Free Text --]") == 0) {
|
if (strcmp(current, "[-- Free Text --]") == 0) {
|
||||||
#if HAS_TRACKBALL
|
if (osk_found && screen) {
|
||||||
extern TrackballInterruptImpl1 *trackballInterruptImpl1;
|
|
||||||
if (trackballInterruptImpl1 && screen) {
|
|
||||||
#else
|
|
||||||
extern RotaryEncoderInterruptImpl1 *rotaryEncoderInterruptImpl1;
|
|
||||||
extern UpDownInterruptImpl1 *upDownInterruptImpl1;
|
|
||||||
if ((rotaryEncoderInterruptImpl1 || upDownInterruptImpl1) && screen) {
|
|
||||||
#endif
|
|
||||||
screen->showTextInput("Free Text", "", 300000, [this](const std::string &text) {
|
screen->showTextInput("Free Text", "", 300000, [this](const std::string &text) {
|
||||||
LOG_INFO("Free text submitted: '%s'", text.c_str());
|
|
||||||
if (!text.empty()) {
|
if (!text.empty()) {
|
||||||
LOG_INFO("Storing message for delayed sending: '%s'", text.c_str());
|
|
||||||
this->freetext = text.c_str();
|
this->freetext = text.c_str();
|
||||||
this->payload = CANNED_MESSAGE_RUN_STATE_FREETEXT;
|
this->payload = CANNED_MESSAGE_RUN_STATE_FREETEXT;
|
||||||
runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
|
runState = CANNED_MESSAGE_RUN_STATE_SENDING_ACTIVE;
|
||||||
@ -633,7 +616,6 @@ bool CannedMessageModule::handleMessageSelectorInput(const InputEvent *event, bo
|
|||||||
screen->forceDisplay();
|
screen->forceDisplay();
|
||||||
|
|
||||||
setIntervalFromNow(500);
|
setIntervalFromNow(500);
|
||||||
LOG_INFO("Free text callback completed safely");
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// Don't delete virtual keyboard immediately - it might still be executing
|
// Don't delete virtual keyboard immediately - it might still be executing
|
||||||
|
Loading…
Reference in New Issue
Block a user