OS Detection - Entire file should not be wrapped with ifdef (#23108)

This commit is contained in:
Joel Challis 2024-02-19 15:37:51 +00:00 committed by GitHub
parent 8df2e70ae4
commit 9f95577ef2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 49 deletions

View file

@ -16,8 +16,6 @@
#include "os_detection.h" #include "os_detection.h"
#ifdef OS_DETECTION_ENABLE
#include <string.h> #include <string.h>
#include "timer.h" #include "timer.h"
#ifdef OS_DETECTION_KEYBOARD_RESET #ifdef OS_DETECTION_KEYBOARD_RESET
@ -35,6 +33,16 @@
static uint16_t usb_setups[STORED_USB_SETUPS]; static uint16_t usb_setups[STORED_USB_SETUPS];
#endif #endif
#ifndef OS_DETECTION_DEBOUNCE
# define OS_DETECTION_DEBOUNCE 200
#endif
// 2s should always be more than enough (otherwise, you may have other issues)
#if OS_DETECTION_DEBOUNCE > 2000
# undef OS_DETECTION_DEBOUNCE
# define OS_DETECTION_DEBOUNCE 2000
#endif
struct setups_data_t { struct setups_data_t {
uint8_t count; uint8_t count;
uint8_t cnt_02; uint8_t cnt_02;
@ -50,18 +58,6 @@ struct setups_data_t setups_data = {
.cnt_ff = 0, .cnt_ff = 0,
}; };
# ifndef OS_DETECTION_DEBOUNCE
# define OS_DETECTION_DEBOUNCE 200
# endif
// 2s should always be more than enough (otherwise, you may have other issues)
# if OS_DETECTION_DEBOUNCE > 2000
# undef OS_DETECTION_DEBOUNCE
# define OS_DETECTION_DEBOUNCE 2000
# endif
typedef uint16_t debouncing_t;
static volatile os_variant_t detected_os = OS_UNSURE; static volatile os_variant_t detected_os = OS_UNSURE;
static os_variant_t reported_os = OS_UNSURE; static os_variant_t reported_os = OS_UNSURE;
@ -202,5 +198,3 @@ void store_setups_in_eeprom(void) {
} }
#endif // OS_DETECTION_DEBUG_ENABLE #endif // OS_DETECTION_DEBUG_ENABLE
#endif

View file

@ -16,8 +16,6 @@
#pragma once #pragma once
#ifdef OS_DETECTION_ENABLE
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "usb_device_state.h" #include "usb_device_state.h"
@ -48,5 +46,3 @@ void slave_update_detected_host_os(os_variant_t os);
void print_stored_setups(void); void print_stored_setups(void);
void store_setups_in_eeprom(void); void store_setups_in_eeprom(void);
#endif #endif
#endif // OS_DETECTION_ENABLE