Format code according to conventions (#16322)
This commit is contained in:
@ -43,14 +43,14 @@
|
||||
// Set to 0 to disable the disconnection check altogether.
|
||||
#ifndef SPLIT_MAX_CONNECTION_ERRORS
|
||||
# define SPLIT_MAX_CONNECTION_ERRORS 10
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS
|
||||
|
||||
// How long (in milliseconds) to block all connection attempts after the communication has been flagged as disconnected.
|
||||
// One communication attempt will be allowed everytime this amount of time has passed since the last attempt. If that attempt succeeds, the communication is seen as working again.
|
||||
// Set to 0 to disable communication throttling while disconnected
|
||||
#ifndef SPLIT_CONNECTION_CHECK_TIMEOUT
|
||||
# define SPLIT_CONNECTION_CHECK_TIMEOUT 500
|
||||
#endif // SPLIT_CONNECTION_CHECK_TIMEOUT
|
||||
#endif // SPLIT_CONNECTION_CHECK_TIMEOUT
|
||||
|
||||
static uint8_t connection_errors = 0;
|
||||
|
||||
@ -68,7 +68,9 @@ static bool usbIsActive(void) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
static inline bool usbIsActive(void) { return usb_vbus_state(); }
|
||||
static inline bool usbIsActive(void) {
|
||||
return usb_vbus_state();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SPLIT_HAND_MATRIX_GRID
|
||||
@ -83,7 +85,7 @@ static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
|
||||
uint8_t pin_state = readPin(in_pin);
|
||||
// Set out_pin to a setting that is less susceptible to noise.
|
||||
setPinInputHigh(out_pin);
|
||||
matrix_io_delay(); // Wait for the pull-up to go HIGH.
|
||||
matrix_io_delay(); // Wait for the pull-up to go HIGH.
|
||||
return pin_state;
|
||||
}
|
||||
#endif
|
||||
@ -158,7 +160,9 @@ void split_post_init(void) {
|
||||
}
|
||||
}
|
||||
|
||||
bool is_transport_connected(void) { return connection_errors < SPLIT_MAX_CONNECTION_ERRORS; }
|
||||
bool is_transport_connected(void) {
|
||||
return connection_errors < SPLIT_MAX_CONNECTION_ERRORS;
|
||||
}
|
||||
|
||||
bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t slave_matrix[]) {
|
||||
#if SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0
|
||||
@ -169,7 +173,7 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl
|
||||
if (is_disconnected && timer_elapsed(connection_check_timer) < SPLIT_CONNECTION_CHECK_TIMEOUT) {
|
||||
return false;
|
||||
}
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS > 0 && SPLIT_CONNECTION_CHECK_TIMEOUT > 0
|
||||
|
||||
__attribute__((unused)) bool okay = transport_master(master_matrix, slave_matrix);
|
||||
#if SPLIT_MAX_CONNECTION_ERRORS > 0
|
||||
@ -186,10 +190,10 @@ bool transport_master_if_connected(matrix_row_t master_matrix[], matrix_row_t sl
|
||||
return connected;
|
||||
} else if (is_disconnected) {
|
||||
dprintln("Target connected");
|
||||
# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0
|
||||
# endif // SPLIT_CONNECTION_CHECK_TIMEOUT > 0
|
||||
}
|
||||
|
||||
connection_errors = 0;
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS > 0
|
||||
#endif // SPLIT_MAX_CONNECTION_ERRORS > 0
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user