Compare commits

...

32 Commits

Author SHA1 Message Date
HarukiToreda
d5ef68314b Fixed missing stray endiff 2025-12-21 01:37:27 -05:00
HarukiToreda
3baba4b1a1 Merge branch 'develop' into InkHUD-Improvements 2025-12-21 00:33:29 -05:00
HarukiToreda
791fb86c7c added ADC calibration feature 2025-12-21 00:17:33 -05:00
HarukiToreda
c1c5d36e86 Added ADC multiplier value display on power config 2025-12-20 21:02:27 -05:00
HarukiToreda
050371adc5 Fix to tips to work with new joystick input 2025-12-20 17:00:00 -05:00
HarukiToreda
f409645ad3 Trunk Fix 2025-12-20 16:38:20 -05:00
HarukiToreda
25d7db65ea quick fix to joystick 2025-12-20 16:29:51 -05:00
HarukiToreda
e0ceaaff38 Merge branch 'develop' into InkHUD-Improvements 2025-12-20 16:29:08 -05:00
HarukiToreda
6431c76aac Merge branch 'develop' into InkHUD-Improvements 2025-12-19 09:49:26 -05:00
HarukiToreda
ac0b3613ec Added ResetDB and keep only favorite commands 2025-12-19 04:41:36 -05:00
HarukiToreda
9ad7d39051 Make Tips show after first boot if the region is Unset 2025-12-19 03:54:10 -05:00
HarukiToreda
b3e6731c85 Trunk fix 2025-12-17 13:01:04 -05:00
HarukiToreda
ef36a5a24d Added "Saving Changes" screen when reboot is needed 2025-12-17 12:38:04 -05:00
HarukiToreda
66d9c430d8 Trunk fix 2025-12-16 02:23:51 -05:00
HarukiToreda
ac05337e42 Timezone labels easier to understand 2025-12-16 02:23:04 -05:00
HarukiToreda
1d4e295471 Recent list with checkboxes 2025-12-16 01:38:03 -05:00
HarukiToreda
c761444bee Reduce line spacing to fit more content 2025-12-16 01:01:40 -05:00
HarukiToreda
929aa5c968 Wifi details 2025-12-15 22:31:33 -05:00
HarukiToreda
cc6265e9b1 Network Config for ESP32 2025-12-15 21:48:17 -05:00
HarukiToreda
958e1f73ef Position Toggle added 2025-12-15 21:07:04 -05:00
HarukiToreda
96e82f1ec1 Merge branch 'develop' into InkHUD-Improvements 2025-12-15 03:22:52 -05:00
HarukiToreda
83ec37113d Display config added 2025-12-15 02:47:09 -05:00
HarukiToreda
5acf72243d Add back to all Options 2025-12-15 01:38:22 -05:00
HarukiToreda
bd18a171d4 Cleaning some behavior 2025-12-15 01:00:54 -05:00
HarukiToreda
6e05c554b8 Channel Config 2025-12-15 00:40:01 -05:00
HarukiToreda
5f9a6a38e6 Config section Headers 2025-12-14 20:56:08 -05:00
HarukiToreda
a332ca978b Power save mode and bluetooth configs 2025-12-14 20:06:24 -05:00
HarukiToreda
7b4315421b Timezone picker added 2025-12-14 18:36:22 -05:00
HarukiToreda
60389e84e6 Preset Picker 2025-12-14 17:22:14 -05:00
HarukiToreda
cd0843c7db Role picker 2025-12-14 16:54:10 -05:00
HarukiToreda
d9dab0cd6c Added Node Config menu with Lora Region Picker 2025-12-14 15:53:44 -05:00
HarukiToreda
87114f4052 InkHUD: Region Picker on initial setup 2025-12-14 04:34:29 -05:00
15 changed files with 1354 additions and 137 deletions

View File

@@ -155,6 +155,18 @@ void InkHUD::LogoApplet::onShutdown()
// This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete // This is then drawn by InkHUD::Events::onShutdown, with a blocking FULL update, after InkHUD's flash write is complete
} }
void InkHUD::LogoApplet::onApplyingChanges()
{
bringToForeground();
textLeft = "";
textRight = "";
textTitle = "Applying changes";
fontTitle = fontSmall;
inkhud->forceUpdate(Drivers::EInk::FAST, false);
}
void InkHUD::LogoApplet::onReboot() void InkHUD::LogoApplet::onReboot()
{ {
bringToForeground(); bringToForeground();

View File

@@ -26,6 +26,7 @@ class LogoApplet : public SystemApplet, public concurrency::OSThread
void onBackground() override; void onBackground() override;
void onShutdown() override; void onShutdown() override;
void onReboot() override; void onReboot() override;
void onApplyingChanges();
protected: protected:
int32_t runOnce() override; int32_t runOnce() override;

View File

@@ -22,6 +22,7 @@ enum MenuAction {
STORE_CANNEDMESSAGE_SELECTION, STORE_CANNEDMESSAGE_SELECTION,
SEND_CANNEDMESSAGE, SEND_CANNEDMESSAGE,
SHUTDOWN, SHUTDOWN,
BACK,
NEXT_TILE, NEXT_TILE,
TOGGLE_BACKLIGHT, TOGGLE_BACKLIGHT,
TOGGLE_GPS, TOGGLE_GPS,
@@ -36,6 +37,84 @@ enum MenuAction {
TOGGLE_NOTIFICATIONS, TOGGLE_NOTIFICATIONS,
TOGGLE_INVERT_COLOR, TOGGLE_INVERT_COLOR,
TOGGLE_12H_CLOCK, TOGGLE_12H_CLOCK,
// Regions
SET_REGION_US,
SET_REGION_EU_868,
SET_REGION_EU_433,
SET_REGION_CN,
SET_REGION_JP,
SET_REGION_ANZ,
SET_REGION_KR,
SET_REGION_TW,
SET_REGION_RU,
SET_REGION_IN,
SET_REGION_NZ_865,
SET_REGION_TH,
SET_REGION_LORA_24,
SET_REGION_UA_433,
SET_REGION_UA_868,
SET_REGION_MY_433,
SET_REGION_MY_919,
SET_REGION_SG_923,
SET_REGION_PH_433,
SET_REGION_PH_868,
SET_REGION_PH_915,
SET_REGION_ANZ_433,
SET_REGION_KZ_433,
SET_REGION_KZ_863,
SET_REGION_NP_865,
SET_REGION_BR_902,
// Device Roles
SET_ROLE_CLIENT,
SET_ROLE_CLIENT_MUTE,
SET_ROLE_ROUTER,
SET_ROLE_REPEATER,
// Presets
SET_PRESET_LONG_SLOW,
SET_PRESET_LONG_MODERATE,
SET_PRESET_LONG_FAST,
SET_PRESET_MEDIUM_SLOW,
SET_PRESET_MEDIUM_FAST,
SET_PRESET_SHORT_SLOW,
SET_PRESET_SHORT_FAST,
SET_PRESET_SHORT_TURBO,
// Timezones
SET_TZ_US_HAWAII,
SET_TZ_US_ALASKA,
SET_TZ_US_PACIFIC,
SET_TZ_US_ARIZONA,
SET_TZ_US_MOUNTAIN,
SET_TZ_US_CENTRAL,
SET_TZ_US_EASTERN,
SET_TZ_BR_BRAZILIA,
SET_TZ_UTC,
SET_TZ_EU_WESTERN,
SET_TZ_EU_CENTRAL,
SET_TZ_EU_EASTERN,
SET_TZ_ASIA_KOLKATA,
SET_TZ_ASIA_HONG_KONG,
SET_TZ_AU_AWST,
SET_TZ_AU_ACST,
SET_TZ_AU_AEST,
SET_TZ_PACIFIC_NZ,
// Power
TOGGLE_POWER_SAVE,
CALIBRATE_ADC,
// Bluetooth
TOGGLE_BLUETOOTH,
TOGGLE_BLUETOOTH_PAIR_MODE,
// Channel
TOGGLE_CHANNEL_UPLINK,
TOGGLE_CHANNEL_DOWNLINK,
TOGGLE_CHANNEL_POSITION,
SET_CHANNEL_PRECISION,
// Display
TOGGLE_DISPLAY_UNITS,
// Network
TOGGLE_WIFI,
// Administration
RESET_NODEDB_ALL,
RESET_NODEDB_KEEP_FAVORITES,
}; };
} // namespace NicheGraphics::InkHUD } // namespace NicheGraphics::InkHUD

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,7 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
void onRender() override; void onRender() override;
void show(Tile *t); // Open the menu, onto a user tile void show(Tile *t); // Open the menu, onto a user tile
void setStartPage(MenuPage page);
protected: protected:
Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton Drivers::LatchingBacklight *backlight = nullptr; // Convenient access to the backlight singleton
@@ -56,6 +57,7 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
void sendText(NodeNum dest, ChannelIndex channel, const char *message); // Send a text message to mesh void sendText(NodeNum dest, ChannelIndex channel, const char *message); // Send a text message to mesh
void freeCannedMessageResources(); // Clear MenuApplet's canned message processing data void freeCannedMessageResources(); // Clear MenuApplet's canned message processing data
MenuPage startPageOverride = MenuPage::ROOT;
MenuPage currentPage = MenuPage::ROOT; MenuPage currentPage = MenuPage::ROOT;
MenuPage previousPage = MenuPage::EXIT; MenuPage previousPage = MenuPage::EXIT;
uint8_t cursor = 0; // Which menu item is currently highlighted uint8_t cursor = 0; // Which menu item is currently highlighted
@@ -63,7 +65,14 @@ class MenuApplet : public SystemApplet, public concurrency::OSThread
uint16_t systemInfoPanelHeight = 0; // Need to know before we render uint16_t systemInfoPanelHeight = 0; // Need to know before we render
std::vector<MenuItem> items; // MenuItems for the current page. Filled by ShowPage std::vector<MenuItem> items; // MenuItems for the current page. Filled by ShowPage
std::vector<std::string> nodeConfigLabels; // Persistent labels for Node Config pages
uint8_t selectedChannelIndex = 0; // Currently selected LoRa channel (Node Config → Radio → Channel)
bool channelPositionEnabled = false;
// Recents menu checkbox state (derived from settings.recentlyActiveSeconds)
static constexpr uint8_t RECENTS_COUNT = 6;
bool recentsSelected[RECENTS_COUNT] = {};
// Data for selecting and sending canned messages via the menu // Data for selecting and sending canned messages via the menu
// Placed into a sub-class for organization only // Placed into a sub-class for organization only

View File

@@ -30,6 +30,7 @@ class MenuItem
MenuAction action = NO_ACTION; MenuAction action = NO_ACTION;
MenuPage nextPage = EXIT; MenuPage nextPage = EXIT;
bool *checkState = nullptr; bool *checkState = nullptr;
bool isHeader = false; // Non-selectable section label
// Various constructors, depending on the intended function of the item // Various constructors, depending on the intended function of the item
@@ -40,6 +41,12 @@ class MenuItem
: label(label), action(action), nextPage(nextPage), checkState(checkState) : label(label), action(action), nextPage(nextPage), checkState(checkState)
{ {
} }
static MenuItem Header(const char *label)
{
MenuItem item(label, NO_ACTION, EXIT);
item.isHeader = true;
return item;
}
}; };
} // namespace NicheGraphics::InkHUD } // namespace NicheGraphics::InkHUD

View File

@@ -20,10 +20,27 @@ enum MenuPage : uint8_t {
SEND, SEND,
CANNEDMESSAGE_RECIPIENT, // Select destination for a canned message CANNEDMESSAGE_RECIPIENT, // Select destination for a canned message
OPTIONS, OPTIONS,
NODE_CONFIG,
NODE_CONFIG_LORA,
NODE_CONFIG_CHANNELS, // List of channels
NODE_CONFIG_CHANNEL_DETAIL, // Per-channel options
NODE_CONFIG_CHANNEL_PRECISION,
NODE_CONFIG_PRESET,
NODE_CONFIG_DEVICE,
NODE_CONFIG_DEVICE_ROLE,
NODE_CONFIG_POWER,
NODE_CONFIG_POWER_ADC_CAL,
NODE_CONFIG_NETWORK,
NODE_CONFIG_DISPLAY,
NODE_CONFIG_BLUETOOTH,
NODE_CONFIG_POSITION,
NODE_CONFIG_ADMIN_RESET,
TIMEZONE,
APPLETS, APPLETS,
AUTOSHOW, AUTOSHOW,
RECENTS, // Select length of "recentlyActiveSeconds" RECENTS, // Select length of "recentlyActiveSeconds"
EXIT, // Dismiss the menu applet REGION,
EXIT, // Dismiss the menu applet
}; };
} // namespace NicheGraphics::InkHUD } // namespace NicheGraphics::InkHUD

View File

@@ -10,34 +10,37 @@ using namespace NicheGraphics;
InkHUD::TipsApplet::TipsApplet() InkHUD::TipsApplet::TipsApplet()
{ {
// Decide which tips (if any) should be shown to user after the boot screen bool needsRegion = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
bool showTutorialTips = (settings->tips.firstBoot || needsRegion);
// Welcome screen // Welcome screen
if (settings->tips.firstBoot) if (showTutorialTips)
tipQueue.push_back(Tip::WELCOME); tipQueue.push_back(Tip::WELCOME);
// Antenna, region, timezone // Finish setup
// Shown at boot if region not yet set if (needsRegion)
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET)
tipQueue.push_back(Tip::FINISH_SETUP); tipQueue.push_back(Tip::FINISH_SETUP);
// Using the UI
if (showTutorialTips) {
tipQueue.push_back(Tip::CUSTOMIZATION);
tipQueue.push_back(Tip::BUTTONS);
}
// Shutdown info // Shutdown info
// Shown until user performs one valid shutdown // Shown until user performs one valid shutdown
if (!settings->tips.safeShutdownSeen) if (!settings->tips.safeShutdownSeen)
tipQueue.push_back(Tip::SAFE_SHUTDOWN); tipQueue.push_back(Tip::SAFE_SHUTDOWN);
// Using the UI
if (settings->tips.firstBoot) {
tipQueue.push_back(Tip::CUSTOMIZATION);
tipQueue.push_back(Tip::BUTTONS);
}
// Catch an incorrect attempt at rotating display // Catch an incorrect attempt at rotating display
if (config.display.flip_screen) if (config.display.flip_screen)
tipQueue.push_back(Tip::ROTATION); tipQueue.push_back(Tip::ROTATION);
// Applet is foreground immediately at boot, but is obscured by LogoApplet, which is also foreground // Region picker
// LogoApplet can be considered to have a higher Z-index, because it is placed before TipsApplet in the systemApplets vector if (needsRegion)
tipQueue.push_back(Tip::PICK_REGION);
if (!tipQueue.empty()) if (!tipQueue.empty())
bringToForeground(); bringToForeground();
} }
@@ -51,81 +54,109 @@ void InkHUD::TipsApplet::onRender()
case Tip::FINISH_SETUP: { case Tip::FINISH_SETUP: {
setFont(fontMedium); setFont(fontMedium);
printAt(0, 0, "Tip: Finish Setup"); const char *title = "Tip: Finish Setup";
uint16_t h = getWrappedTextHeight(0, width(), title);
printWrapped(0, 0, width(), title);
setFont(fontSmall); setFont(fontSmall);
int16_t cursorY = fontMedium.lineHeight() * 1.5; int16_t cursorY = h + fontSmall.lineHeight();
printAt(0, cursorY, "- connect antenna");
cursorY += fontSmall.lineHeight() * 1.2; auto drawBullet = [&](const char *text) {
printAt(0, cursorY, "- connect a client app"); uint16_t bh = getWrappedTextHeight(0, width(), text);
printWrapped(0, cursorY, width(), text);
cursorY += bh + (fontSmall.lineHeight() / 3);
};
// Only if region not set drawBullet("- connect antenna");
if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET) { drawBullet("- connect a client app");
cursorY += fontSmall.lineHeight() * 1.2;
printAt(0, cursorY, "- set region");
}
// Only if tz not set if (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET)
if (!(*config.device.tzdef && config.device.tzdef[0] != 0)) { drawBullet("- set region");
cursorY += fontSmall.lineHeight() * 1.2;
printAt(0, cursorY, "- set timezone");
}
cursorY += fontSmall.lineHeight() * 1.5; if (!(*config.device.tzdef && config.device.tzdef[0] != 0))
printAt(0, cursorY, "More info at meshtastic.org"); drawBullet("- set timezone");
cursorY += fontSmall.lineHeight() / 2;
drawBullet("More info at meshtastic.org");
setFont(fontSmall);
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
} break; } break;
case Tip::PICK_REGION: {
setFont(fontMedium);
printAt(0, 0, "Set Region");
setFont(fontSmall);
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), "Please select your LoRa region to complete setup.");
printAt(0, Y(1.0), "Press button to choose", LEFT, BOTTOM);
} break;
case Tip::SAFE_SHUTDOWN: { case Tip::SAFE_SHUTDOWN: {
setFont(fontMedium); setFont(fontMedium);
printAt(0, 0, "Tip: Shutdown");
const char *title = "Tip: Shutdown";
uint16_t h = getWrappedTextHeight(0, width(), title);
printWrapped(0, 0, width(), title);
setFont(fontSmall); setFont(fontSmall);
std::string shutdown; int16_t cursorY = h + fontSmall.lineHeight();
shutdown += "Before removing power, please shut down from InkHUD menu, or a client app. \n";
shutdown += "\n"; const char *body = "Before removing power, please shut down from InkHUD menu, or a client app.\n\n"
shutdown += "This ensures data is saved."; "This ensures data is saved.";
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), shutdown);
uint16_t bodyH = getWrappedTextHeight(0, width(), body);
printWrapped(0, cursorY, width(), body);
cursorY += bodyH + (fontSmall.lineHeight() / 2);
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
} break; } break;
case Tip::CUSTOMIZATION: { case Tip::CUSTOMIZATION: {
setFont(fontMedium); setFont(fontMedium);
printAt(0, 0, "Tip: Customization");
const char *title = "Tip: Customization";
uint16_t h = getWrappedTextHeight(0, width(), title);
printWrapped(0, 0, width(), title);
setFont(fontSmall); setFont(fontSmall);
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), int16_t cursorY = h + fontSmall.lineHeight();
"Configure & control display with the InkHUD menu. Optional features, layout, rotation, and more.");
const char *body = "Configure & control display with the InkHUD menu. "
"Optional features, layout, rotation, and more.";
uint16_t bodyH = getWrappedTextHeight(0, width(), body);
printWrapped(0, cursorY, width(), body);
cursorY += bodyH + (fontSmall.lineHeight() / 2);
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
} break; } break;
case Tip::BUTTONS: { case Tip::BUTTONS: {
setFont(fontMedium); setFont(fontMedium);
printAt(0, 0, "Tip: Buttons");
const char *title = "Tip: Buttons";
uint16_t h = getWrappedTextHeight(0, width(), title);
printWrapped(0, 0, width(), title);
setFont(fontSmall); setFont(fontSmall);
int16_t cursorY = fontMedium.lineHeight() * 1.5; int16_t cursorY = h + fontSmall.lineHeight();
auto drawBullet = [&](const char *text) {
uint16_t bh = getWrappedTextHeight(0, width(), text);
printWrapped(0, cursorY, width(), text);
cursorY += bh + (fontSmall.lineHeight() / 3);
};
if (!settings->joystick.enabled) { if (!settings->joystick.enabled) {
printAt(0, cursorY, "User Button"); drawBullet("User Button");
cursorY += fontSmall.lineHeight() * 1.2; drawBullet("- short press: next");
printAt(0, cursorY, "- short press: next"); drawBullet("- long press: select or open menu");
cursorY += fontSmall.lineHeight() * 1.2;
printAt(0, cursorY, "- long press: select / open menu");
} else { } else {
printAt(0, cursorY, "Joystick"); drawBullet("Joystick");
cursorY += fontSmall.lineHeight() * 1.2; drawBullet("- press: open menu or select");
printAt(0, cursorY, "- open menu / select"); drawBullet("Exit Button");
cursorY += fontSmall.lineHeight() * 1.5; drawBullet("- press: switch tile or close menu");
printAt(0, cursorY, "Exit Button");
cursorY += fontSmall.lineHeight() * 1.2;
printAt(0, cursorY, "- switch tile / close menu");
} }
printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM); printAt(0, Y(1.0), "Press button to continue", LEFT, BOTTOM);
@@ -133,12 +164,21 @@ void InkHUD::TipsApplet::onRender()
case Tip::ROTATION: { case Tip::ROTATION: {
setFont(fontMedium); setFont(fontMedium);
printAt(0, 0, "Tip: Rotation");
const char *title = "Tip: Rotation";
uint16_t h = getWrappedTextHeight(0, width(), title);
printWrapped(0, 0, width(), title);
setFont(fontSmall); setFont(fontSmall);
if (!settings->joystick.enabled) { if (!settings->joystick.enabled) {
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), int16_t cursorY = h + fontSmall.lineHeight();
"To rotate the display, use the InkHUD menu. Long-press the user button > Options > Rotate.");
const char *body = "To rotate the display, use the InkHUD menu. "
"Long-press the user button > Options > Rotate.";
uint16_t bh = getWrappedTextHeight(0, width(), body);
printWrapped(0, cursorY, width(), body);
cursorY += bh + (fontSmall.lineHeight() / 2);
} else { } else {
printWrapped(0, fontMedium.lineHeight() * 1.5, width(), printWrapped(0, fontMedium.lineHeight() * 1.5, width(),
"To rotate the display, use the InkHUD menu. Press the user button > Options > Rotate."); "To rotate the display, use the InkHUD menu. Press the user button > Options > Rotate.");
@@ -159,12 +199,15 @@ void InkHUD::TipsApplet::renderWelcome()
{ {
uint16_t padW = X(0.05); uint16_t padW = X(0.05);
// Detect portrait orientation
bool portrait = height() > width();
// Block 1 - logo & title // Block 1 - logo & title
// ======================== // ========================
// Logo size // Logo size
uint16_t logoWLimit = X(0.3); uint16_t logoWLimit = portrait ? X(0.5) : X(0.3);
uint16_t logoHLimit = Y(0.3); uint16_t logoHLimit = portrait ? Y(0.25) : Y(0.3);
uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit); uint16_t logoW = getLogoWidth(logoWLimit, logoHLimit);
uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit); uint16_t logoH = getLogoHeight(logoWLimit, logoHLimit);
@@ -177,7 +220,7 @@ void InkHUD::TipsApplet::renderWelcome()
// Center the block // Center the block
// Desired effect: equal margin from display edge for logo left and title right // Desired effect: equal margin from display edge for logo left and title right
int16_t block1Y = Y(0.3); int16_t block1Y = portrait ? Y(0.2) : Y(0.3);
int16_t block1CX = X(0.5) + (logoW / 2) - (titleW / 2); int16_t block1CX = X(0.5) + (logoW / 2) - (titleW / 2);
int16_t logoCX = block1CX - (logoW / 2) - (padW / 2); int16_t logoCX = block1CX - (logoW / 2) - (padW / 2);
int16_t titleCX = block1CX + (titleW / 2) + (padW / 2); int16_t titleCX = block1CX + (titleW / 2) + (padW / 2);
@@ -192,7 +235,7 @@ void InkHUD::TipsApplet::renderWelcome()
std::string subtitle = "InkHUD"; std::string subtitle = "InkHUD";
if (width() >= 200) if (width() >= 200)
subtitle += " - A Heads-Up Display"; // Future proofing: narrower for tiny display subtitle += " - A Heads-Up Display"; // Future proofing: narrower for tiny display
printAt(X(0.5), Y(0.6), subtitle, CENTER, MIDDLE); printAt(X(0.5), portrait ? Y(0.45) : Y(0.6), subtitle, CENTER, MIDDLE);
// Block 3 - press to continue // Block 3 - press to continue
// ============================ // ============================
@@ -224,26 +267,37 @@ void InkHUD::TipsApplet::onBackground()
// While our SystemApplet::handleInput flag is true // While our SystemApplet::handleInput flag is true
void InkHUD::TipsApplet::onButtonShortPress() void InkHUD::TipsApplet::onButtonShortPress()
{ {
bool needsRegion = (config.lora.region == meshtastic_Config_LoRaConfig_RegionCode_UNSET);
// If we're prompting the user to pick a region, hand off to the menu
if (!tipQueue.empty() && tipQueue.front() == Tip::PICK_REGION) {
tipQueue.pop_front();
// Signal InkHUD to open the menu on Region page
inkhud->forceRegionMenu = true;
// Close tips and open menu
sendToBackground();
inkhud->openMenu();
return;
}
// Consume current tip
tipQueue.pop_front(); tipQueue.pop_front();
// All tips done // All tips done
if (tipQueue.empty()) { if (tipQueue.empty()) {
// Record that user has now seen the "tutorial" set of tips // Record that user has now seen the "tutorial" set of tips
// Don't show them on subsequent boots // Don't show them on subsequent boots
if (settings->tips.firstBoot) { if (settings->tips.firstBoot && !needsRegion) {
settings->tips.firstBoot = false; settings->tips.firstBoot = false;
inkhud->persistence->saveSettings(); inkhud->persistence->saveSettings();
} }
// Close applet, and full refresh to clean the screen // Close applet and clean the screen
// Need to force update, because our request would be ignored otherwise, as we are now background
sendToBackground(); sendToBackground();
inkhud->forceUpdate(EInk::UpdateTypes::FULL); inkhud->forceUpdate(EInk::UpdateTypes::FULL);
} } else {
// More tips left
else
requestUpdate(); requestUpdate();
}
} }
// Functions the same as the user button in this instance // Functions the same as the user button in this instance

View File

@@ -23,6 +23,7 @@ class TipsApplet : public SystemApplet
enum class Tip { enum class Tip {
WELCOME, WELCOME,
FINISH_SETUP, FINISH_SETUP,
PICK_REGION,
SAFE_SHUTDOWN, SAFE_SHUTDOWN,
CUSTOMIZATION, CUSTOMIZATION,
BUTTONS, BUTTONS,

View File

@@ -276,6 +276,15 @@ int InkHUD::Events::beforeDeepSleep(void *unused)
return 0; // We agree: deep sleep now return 0; // We agree: deep sleep now
} }
// Display an intermediate screen while configuration changes are applied
void InkHUD::Events::applyingChanges()
{
// Bring the logo applet forward with a temporary message
for (SystemApplet *sa : inkhud->systemApplets) {
sa->onApplyingChanges();
}
}
// Callback for rebootObserver // Callback for rebootObserver
// Same as shutdown, without drawing the logoApplet // Same as shutdown, without drawing the logoApplet
// Makes sure we don't lose message history / InkHUD config // Makes sure we don't lose message history / InkHUD config

View File

@@ -29,12 +29,13 @@ class Events
void onButtonShort(); // User button: short press void onButtonShort(); // User button: short press
void onButtonLong(); // User button: long press void onButtonLong(); // User button: long press
void onExitShort(); // Exit button: short press void applyingChanges();
void onExitLong(); // Exit button: long press void onExitShort(); // Exit button: short press
void onNavUp(); // Navigate up void onExitLong(); // Exit button: long press
void onNavDown(); // Navigate down void onNavUp(); // Navigate up
void onNavLeft(); // Navigate left void onNavDown(); // Navigate down
void onNavRight(); // Navigate right void onNavLeft(); // Navigate left
void onNavRight(); // Navigate right
int beforeDeepSleep(void *unused); // Prepare for shutdown int beforeDeepSleep(void *unused); // Prepare for shutdown
int beforeReboot(void *unused); // Prepare for reboot int beforeReboot(void *unused); // Prepare for reboot

View File

@@ -53,6 +53,13 @@ void InkHUD::InkHUD::addApplet(const char *name, Applet *a, bool defaultActive,
windowManager->addApplet(name, a, defaultActive, defaultAutoshow, onTile); windowManager->addApplet(name, a, defaultActive, defaultAutoshow, onTile);
} }
void InkHUD::InkHUD::notifyApplyingChanges()
{
if (events) {
events->applyingChanges();
}
}
// Start InkHUD! // Start InkHUD!
// Call this only after you have configured InkHUD // Call this only after you have configured InkHUD
void InkHUD::InkHUD::begin() void InkHUD::InkHUD::begin()

View File

@@ -47,6 +47,7 @@ class InkHUD
void setDriver(Drivers::EInk *driver); void setDriver(Drivers::EInk *driver);
void setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0); void setDisplayResilience(uint8_t fastPerFull = 5, float stressMultiplier = 2.0);
void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, uint8_t onTile = -1); void addApplet(const char *name, Applet *a, bool defaultActive = false, bool defaultAutoshow = false, uint8_t onTile = -1);
void notifyApplyingChanges();
void begin(); void begin();
@@ -76,6 +77,9 @@ class InkHUD
void rotateJoystick(uint8_t angle = 1); // rotate 90 deg by default void rotateJoystick(uint8_t angle = 1); // rotate 90 deg by default
void toggleBatteryIcon(); void toggleBatteryIcon();
// Used by TipsApplet to force menu to start on Region selection
bool forceRegionMenu = false;
// Updating the display // Updating the display
// - called by various InkHUD components // - called by various InkHUD components

View File

@@ -27,6 +27,7 @@ class SystemApplet : public Applet
bool lockRequests = false; // - prevent other applets from triggering display updates bool lockRequests = false; // - prevent other applets from triggering display updates
virtual void onReboot() { onShutdown(); } // - handle reboot specially virtual void onReboot() { onShutdown(); } // - handle reboot specially
virtual void onApplyingChanges() {}
// Other system applets may take precedence over our own system applet though // Other system applets may take precedence over our own system applet though
// The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank) // The order an applet is passed to WindowManager::addSystemApplet determines this hierarchy (added earlier = higher rank)

View File

@@ -756,12 +756,12 @@ This mapping of emoji to control characters is fairly arbitrary. Selection was i
| `0x03` | 🙂 | | `0x03` | 🙂 |
| `0x04` | 😆 | | `0x04` | 😆 |
| `0x05` | 👋 | | `0x05` | 👋 |
| `0x06` | ☀ | | `0x06` | ☀ |
| ~~`0x07`~~ | (bell char, unused) | | ~~`0x07`~~ | (bell char, unused) |
| `0x08` | 🌧 | | `0x08` | 🌧 |
| `0x09` | ☁ | | `0x09` | ☁ |
| ~~`0x0A`~~ | (line feed, unused) | | ~~`0x0A`~~ | (line feed, unused) |
| `0x0B` | ♥ | | `0x0B` | ♥ |
| `0x0C` | 💩 | | `0x0C` | 💩 |
| ~~`0x0D`~~ | (carriage return, unused) | | ~~`0x0D`~~ | (carriage return, unused) |
| `0x0E` | 🔔 | | `0x0E` | 🔔 |