Skip to content

Commit

Permalink
Merge pull request #1070 from UltimateHackingKeyboard/keep_pairing_sc…
Browse files Browse the repository at this point in the history
…reen_alive

Make pairing screen always on.
  • Loading branch information
mondalaci authored Jan 1, 2025
2 parents ead30c6 + 73a9430 commit 560418b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion device/src/keyboard/oled/screens/screen_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@

screen_id_t ActiveScreen = ScreenId_Main;

bool InteractivePairingInProgress = false;

static void onExit(screen_id_t screen) {
switch(screen) {
case ScreenId_Pairing:
InteractivePairingInProgress = false;
Ledmap_ResetTemporaryLedBacklightingMode();
Ledmap_UpdateBacklightLeds();
EventVector_Set(EventVector_LedManagerFullUpdateNeeded);
break;
default:
break;
Expand All @@ -30,8 +33,10 @@ void ScreenManager_ActivateScreen(screen_id_t screen)

switch(screen) {
case ScreenId_Pairing:
InteractivePairingInProgress = true;
screenPtr = PairingScreen;
Ledmap_SetTemporaryLedBacklightingMode(BacklightingMode_Numpad);
EventVector_Set(EventVector_LedManagerFullUpdateNeeded);
Ledmap_UpdateBacklightLeds();
break;
case ScreenId_Debug:
Expand Down
2 changes: 2 additions & 0 deletions device/src/keyboard/oled/screens/screen_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
extern bool ScreenManager_AwaitsInput;
extern screen_id_t ActiveScreen;

extern bool InteractivePairingInProgress;

// Functions:

void ScreenManager_ActivateScreen(screen_id_t screen);
Expand Down
8 changes: 7 additions & 1 deletion right/src/led_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
#include "device.h"
#endif

#if DEVICE_IS_UHK80_RIGHT
#include "keyboard/oled/screens/screen_manager.h"
#else
#define InteractivePairingInProgress false;
#endif

bool KeyBacklightSleepModeActive = false;
bool DisplaySleepModeActive = false;

Expand All @@ -27,7 +33,7 @@ uint8_t KeyBacklightBrightness = 0xff;
static void recalculateLedBrightness()
{
bool globalSleepMode = !Cfg.LedsEnabled || CurrentPowerMode > PowerMode_Awake || Cfg.LedBrightnessMultiplier == 0.0f;
bool globalAlwaysOn = Cfg.LedsAlwaysOn || Ledmap_AlwaysOn;
bool globalAlwaysOn = Cfg.LedsAlwaysOn || Ledmap_AlwaysOn || InteractivePairingInProgress;

if (!globalAlwaysOn && (globalSleepMode || KeyBacklightSleepModeActive)) {
KeyBacklightBrightness = 0;
Expand Down

0 comments on commit 560418b

Please sign in to comment.