Basic mac vs linux modes

This commit is contained in:
2026-03-14 19:02:08 -07:00
committed by Zuckerberg
parent bedac2945a
commit 8431906337
9 changed files with 271 additions and 10 deletions

View File

@@ -0,0 +1,31 @@
#include "os_detection.h"
#include "timer.h"
#include "rgb_matrix.h"
#include "mac_mode.h"
bool mac_mode = false;
bool mac_mode_manual = false;
static bool os_detected = false;
static uint32_t flash_start = 0;
// Poll OS detection after USB enumeration settles (~2s)
// Flash indicator color for 500ms then restore default animation
void matrix_scan_user(void) {
if (!os_detected && !mac_mode_manual && timer_elapsed32(0) > 2000) {
os_detected = true;
os_variant_t os = detected_host_os();
mac_mode = (os == OS_MACOS || os == OS_IOS);
rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR);
if (mac_mode) {
rgb_matrix_sethsv_noeeprom(HSV_GREEN);
} else {
rgb_matrix_sethsv_noeeprom(HSV_BLUE);
}
flash_start = timer_read32();
}
if (flash_start && timer_elapsed32(flash_start) > 500) {
flash_start = 0;
rgb_matrix_reload_from_eeprom();
}
}