mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 02:11:57 +00:00
Add files via upload
during GPS duty-cycle sleep, displays the cached position, adds long-press Enter handling
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <helpers/ui/UIScreen.h>
|
||||
#include <Arduino.h>
|
||||
#include <math.h>
|
||||
#include "icons.h"
|
||||
#include "InfoKit.h"
|
||||
#include "PopupMenu.h"
|
||||
@@ -167,8 +168,9 @@ private:
|
||||
#endif
|
||||
if (!loc) { row(d, f, rsv, "Receiver", "none"); return; }
|
||||
const bool fix = loc->isValid();
|
||||
const bool sleeping = sensors.isGpsDutySleeping();
|
||||
if (f.place(lh + 5)) { // the fix as a chip, satellites used / in view
|
||||
const char* st = !on ? "OFF" : !fix ? "NO FIX" : (g && g->fix_mode == 2) ? "2D FIX" : "3D FIX";
|
||||
const char* st = !on ? "OFF" : sleeping ? "SLEEP" : !fix ? "NO FIX" : (g && g->fix_mode == 2) ? "2D FIX" : "3D FIX";
|
||||
info::chip(d, 1, f.at, st, on && fix);
|
||||
#ifdef STATUS_HAS_SKY
|
||||
if (g) snprintf(a, sizeof(a), "%d/%d sats", skyview::usedCount(*g), g->count);
|
||||
@@ -177,15 +179,17 @@ private:
|
||||
snprintf(a, sizeof(a), "%ld sats", loc->satellitesCount());
|
||||
d.drawTextRightAlign(d.width() - rsv - 2, f.at + 1, a);
|
||||
}
|
||||
const long lat = loc->getLatitude(), lon = loc->getLongitude();
|
||||
const long lat = fix ? loc->getLatitude() : lround(sensors.node_lat * 1000000.0);
|
||||
const long lon = fix ? loc->getLongitude() : lround(sensors.node_lon * 1000000.0);
|
||||
// The driver reports 999 deg before a first fix (0,0 in the simulator).
|
||||
const bool known = labs(lat) <= 90000000L && (lat || lon);
|
||||
if (known) snprintf(a, sizeof(a), "%.5f\xc2\xb0%c", labs(lat) / 1e6, lat < 0 ? 'S' : 'N'); else strcpy(a, "-");
|
||||
row(d, f, rsv, fix ? "Lat" : "Lat (last)", a);
|
||||
if (known) snprintf(a, sizeof(a), "%.5f\xc2\xb0%c", labs(lon) / 1e6, lon < 0 ? 'W' : 'E'); else strcpy(a, "-");
|
||||
row(d, f, rsv, fix ? "Lon" : "Lon (last)", a);
|
||||
if (fix) {
|
||||
telemetry::altText(loc->getAltitude() / 1000.0f, imperial(), L1_INFO, a, sizeof(a));
|
||||
if (fix || (sensors.node_lat != 0.0 || sensors.node_lon != 0.0)) {
|
||||
const double altitude = fix ? loc->getAltitude() / 1000.0 : sensors.node_altitude;
|
||||
telemetry::altText(altitude, imperial(), L1_INFO, a, sizeof(a));
|
||||
row(d, f, rsv, "Altitude", a);
|
||||
}
|
||||
if (g && fix) {
|
||||
|
||||
@@ -1097,6 +1097,12 @@ void UITask::pollSimpsonKeypad() {
|
||||
}
|
||||
|
||||
void UITask::handleSimpsonKeypadKey(uint8_t key) {
|
||||
if (key == SIMPSON_KEY_ENTER_LONG) {
|
||||
if (_locked && !_unlock_kb) return;
|
||||
enqueueKey(handleLongPress(KEY_ENTER));
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkDisplayOn(KEY_ENTER) == 0 || (_locked && !_unlock_kb)) return;
|
||||
|
||||
const uint32_t auto_off = autoOffMillis();
|
||||
@@ -1128,7 +1134,7 @@ void UITask::handleSimpsonKeypadKey(uint8_t key) {
|
||||
enqueueKey(KEY_RIGHT);
|
||||
break;
|
||||
case SIMPSON_KEY_ENTER:
|
||||
enqueueKey((_unlock_kb || _kb.isVisible()) ? KEY_KB_ENTER : KEY_ENTER); //enqueueKey(_unlock_kb ? KEY_KB_ENTER : KEY_ENTER);
|
||||
enqueueKey((_unlock_kb || _kb.isVisible()) ? KEY_KB_ENTER : KEY_ENTER);
|
||||
break;
|
||||
case SIMPSON_KEY_BLUETOOTH:
|
||||
if (!_unlock_kb) gotoBluetoothHomePage();
|
||||
@@ -1261,7 +1267,8 @@ void UITask::loop() {
|
||||
#if FEAT_DISPLAY_ROTATION_SETTING && defined(JOYSTICK_UPRIGHT_ROTATION)
|
||||
if (_node_prefs) joy_rot += (JOYSTICK_UPRIGHT_ROTATION - _node_prefs->display_rotation) & 3;
|
||||
#endif
|
||||
auto enterClick = [&]() {
|
||||
int ev = user_btn.check();
|
||||
if (ev == BUTTON_EVENT_CLICK) {
|
||||
if (back_btn.isPressed() && !_unlock_kb) {
|
||||
// Enter clicked while Back is held — lock/unlock sequence
|
||||
if (_display && !_display->isOn()) {
|
||||
@@ -1286,25 +1293,6 @@ void UITask::loop() {
|
||||
}
|
||||
enqueueKey(checkDisplayOn(KEY_ENTER));
|
||||
}
|
||||
};
|
||||
int ev = user_btn.check();
|
||||
#ifdef UI_ENTER_DOUBLE_BACK
|
||||
// For a joystick without a reachable Back button: a double click on Enter goes
|
||||
// back. Multi-click delays a single Enter by the click window. Where text is
|
||||
// typed (on-screen keyboard, PIN pad) or the lock sequence is counting, a
|
||||
// double is just two Enters, so a repeated letter still works.
|
||||
if (ev == BUTTON_EVENT_DOUBLE_CLICK || ev == BUTTON_EVENT_TRIPLE_CLICK) {
|
||||
int n = (ev == BUTTON_EVENT_DOUBLE_CLICK) ? 2 : 3;
|
||||
if (_unlock_kb || _kb.isVisible() || back_btn.isPressed()) {
|
||||
for (int i = 0; i < n; i++) enterClick();
|
||||
} else {
|
||||
enqueueKey(checkDisplayOn(KEY_CANCEL));
|
||||
}
|
||||
ev = BUTTON_EVENT_NONE;
|
||||
}
|
||||
#endif
|
||||
if (ev == BUTTON_EVENT_CLICK) {
|
||||
enterClick();
|
||||
} else if (ev == BUTTON_EVENT_LONG_PRESS) {
|
||||
enqueueKey(handleLongPress(KEY_ENTER)); // REVISIT: could be mapped to different key code
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user