mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-09-22 19:57:42 -04:00
reduce redundant checks
This commit is contained in:
parent
f083338851
commit
80682e8204
1 changed files with 22 additions and 16 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "halcyon.h"
|
#include "halcyon.h"
|
||||||
#include "transactions.h"
|
#include "transactions.h"
|
||||||
#include "split_util.h"
|
#include "split_util.h"
|
||||||
|
#include "_wait.h"
|
||||||
|
|
||||||
__attribute__((weak)) bool module_post_init_kb(void) {
|
__attribute__((weak)) bool module_post_init_kb(void) {
|
||||||
return module_post_init_user();
|
return module_post_init_user();
|
||||||
|
@ -76,30 +77,35 @@ void keyboard_post_init_kb(void) {
|
||||||
|
|
||||||
void housekeeping_task_kb(void) {
|
void housekeeping_task_kb(void) {
|
||||||
if (is_keyboard_master()) {
|
if (is_keyboard_master()) {
|
||||||
static bool synced = 0;
|
static bool synced = false;
|
||||||
if(is_transport_connected() && synced == 0) {
|
|
||||||
|
if (!synced) {
|
||||||
|
if(is_transport_connected()) {
|
||||||
transaction_rpc_send(MODULE_SYNC, sizeof(module), &module); // Sync to slave
|
transaction_rpc_send(MODULE_SYNC, sizeof(module), &module); // Sync to slave
|
||||||
|
wait_ms(10);
|
||||||
// Good moment to make sure the backlight wakes up after boot for both halves
|
// Good moment to make sure the backlight wakes up after boot for both halves
|
||||||
backlight_wakeup();
|
backlight_wakeup();
|
||||||
synced = 1;
|
synced = true;
|
||||||
}
|
|
||||||
display_module_housekeeping_task_kb(false); // Is master so can never be the second display
|
|
||||||
}
|
|
||||||
if (!is_keyboard_master()) {
|
|
||||||
if (module_master == hlc_tft_display) {
|
|
||||||
display_module_housekeeping_task_kb(true); // If there is a display on master, become the second display
|
|
||||||
} else {
|
|
||||||
display_module_housekeeping_task_kb(false); // Otherwise be the main display
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
display_module_housekeeping_task_kb(false); // Is master so can never be the second display
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_keyboard_master()) {
|
||||||
|
display_module_housekeeping_task_kb(module_master == hlc_tft_display);
|
||||||
|
}
|
||||||
|
|
||||||
// Backlight feature
|
// Backlight feature
|
||||||
if (backlight_off && last_input_activity_elapsed() <= HLC_BACKLIGHT_TIMEOUT) {
|
if (last_input_activity_elapsed() <= HLC_BACKLIGHT_TIMEOUT) {
|
||||||
|
if (backlight_off) {
|
||||||
backlight_wakeup();
|
backlight_wakeup();
|
||||||
}
|
}
|
||||||
if (!backlight_off && last_input_activity_elapsed() > HLC_BACKLIGHT_TIMEOUT) {
|
} else {
|
||||||
|
if (!backlight_off) {
|
||||||
backlight_suspend();
|
backlight_suspend();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module_housekeeping_task_kb();
|
module_housekeeping_task_kb();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue