fix(radio): treat trims as controls rather than keys for backlight timeout (#7515)
This commit is contained in:
@@ -209,9 +209,14 @@ void per10ms()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (keysPollingCycle()) {
|
uint8_t keyActivity = keysPollingCycle();
|
||||||
|
if (keyActivity & KEY_ACTIVITY_KEYS) {
|
||||||
inactivityTimerReset(ActivitySource::Keys);
|
inactivityTimerReset(ActivitySource::Keys);
|
||||||
}
|
}
|
||||||
|
if (keyActivity & KEY_ACTIVITY_TRIMS) {
|
||||||
|
// Trims are controls, not keys, for backlight purposes
|
||||||
|
inactivityTimerReset(ActivitySource::MainControls);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(FUNCTION_SWITCHES)
|
#if defined(FUNCTION_SWITCHES)
|
||||||
evalFunctionSwitches();
|
evalFunctionSwitches();
|
||||||
|
|||||||
+7
-2
@@ -496,7 +496,7 @@ uint16_t keyMapping(uint16_t event)
|
|||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool keysPollingCycle()
|
uint8_t keysPollingCycle()
|
||||||
{
|
{
|
||||||
uint32_t trims_input;
|
uint32_t trims_input;
|
||||||
pollKeys();
|
pollKeys();
|
||||||
@@ -565,7 +565,12 @@ bool keysPollingCycle()
|
|||||||
if (evt) pushTrimEvent(evt | i);
|
if (evt) pushTrimEvent(evt | i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return keys_input || trims_input;
|
// Report trims separately so they count as controls, not keys, for the
|
||||||
|
// backlight. Nav hats (USE_HATS_AS_KEYS) are folded into keys_input.
|
||||||
|
uint8_t activity = 0;
|
||||||
|
if (keys_input) activity |= KEY_ACTIVITY_KEYS;
|
||||||
|
if (trims_input) activity |= KEY_ACTIVITY_TRIMS;
|
||||||
|
return activity;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(COLORLCD)
|
#if !defined(COLORLCD)
|
||||||
|
|||||||
+8
-1
@@ -186,7 +186,14 @@ void killTrimEvents(event_t event);
|
|||||||
bool keysGetState(uint8_t key);
|
bool keysGetState(uint8_t key);
|
||||||
uint8_t keysGetTrimState(uint8_t trim);
|
uint8_t keysGetTrimState(uint8_t trim);
|
||||||
|
|
||||||
bool keysPollingCycle();
|
// Activity flags returned by keysPollingCycle(). Trims are reported
|
||||||
|
// separately so they can be treated as controls, not keys, for backlight.
|
||||||
|
enum {
|
||||||
|
KEY_ACTIVITY_KEYS = 0x01,
|
||||||
|
KEY_ACTIVITY_TRIMS = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8_t keysPollingCycle();
|
||||||
bool rotaryEncoderPollingCycle();
|
bool rotaryEncoderPollingCycle();
|
||||||
|
|
||||||
// Holding the per-target combo (KEYS_LOCK_KEY1 + KEYS_LOCK_KEY2 from hal.h)
|
// Holding the per-target combo (KEYS_LOCK_KEY1 + KEYS_LOCK_KEY2 from hal.h)
|
||||||
|
|||||||
Reference in New Issue
Block a user