rebase: Phase B — trivial files for the v0.6.0 base
Build-system, config, usb, and CI wiring on top of upstream's
v0.6.0-hotfix tree. Build will still fail until Phase C+D land bt.h
accessors that oled.cpp references; that's expected mid-rebase.
CMakeLists.txt: add src/oled.cpp + src/slots.cpp to add_executable,
link hardware_spi, restore OUTPUT_NAME ds5-bridge-oled.
src/config.h: append the 4 OLED Edition Config_body fields
(current_slot + auto_haptics_enable/gain/lowpass). Preserves
upstream's field order for the first 8 fields.
src/config.cpp:
- speaker_volume validity default -100 dB → 0 dB (footgun fix)
- 4 new validity guards for the appended fields with sensible
defaults (Fallback / 100 % / 160 Hz / slot 0)
- config_default() impl (was declared in upstream's config.h since
v0.5.4 but never defined; the OLED Edition's "Reset to defaults"
Settings item calls it)
src/usb.cpp: drop the UAC1 SET_CUR Volume → flash-config sync that
let PipeWire/Pulse silently override the user's saved Spk Vol on
every device reconnect. Borrowed from loteran/DS5Dongle commit
03fa1e4.
src/usb_descriptors.cpp: restore iSerialNumber = STRID_SERIAL.
Upstream's commit e79c762 zeroed it to work around SpecialK (#32),
but that broke Windows device identity (#100) — users lost
per-device volume / app preferences when moving USB ports. The
OLED Edition prioritizes Windows device-identity stability for
the broader user base over SpecialK compat for a narrower one.
.github/workflows/{build,release}.yml: artifact filenames use
ds5-bridge-oled.uf2 (and -debug / -picow variants) per the
OUTPUT_NAME rebrand.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
0ed05d3f56
commit
4b6a72b70a
+27
-2
@@ -52,8 +52,8 @@ void config_valid() {
|
||||
printf("[Config] Haptics Gain value is invalid\n");
|
||||
}
|
||||
if (std::isnan(body->speaker_volume) || body->speaker_volume < -100 || body->speaker_volume > 0) {
|
||||
body->speaker_volume = -100;
|
||||
printf("[Config] Speaker Volume is invalid\n");
|
||||
body->speaker_volume = 0; // OLED Edition: 0 dB default (unity); -100 would be silent
|
||||
printf("[Config] Speaker Volume is invalid, defaulting to 0 dB\n");
|
||||
}
|
||||
if (body->inactive_time < 5 || body->inactive_time > 60) {
|
||||
body->inactive_time = 30;
|
||||
@@ -79,6 +79,22 @@ void config_valid() {
|
||||
body->controller_mode = 2;
|
||||
printf("[Config] controller_mode is invalid\n");
|
||||
}
|
||||
if (body->current_slot >= 4) {
|
||||
body->current_slot = 0;
|
||||
printf("[Config] current_slot is invalid\n");
|
||||
}
|
||||
if (body->auto_haptics_enable > 3) {
|
||||
body->auto_haptics_enable = 1; // Fallback default
|
||||
printf("[Config] auto_haptics_enable invalid, defaulting to 1 (Fallback)\n");
|
||||
}
|
||||
if (body->auto_haptics_gain > 200) {
|
||||
body->auto_haptics_gain = 100;
|
||||
printf("[Config] auto_haptics_gain invalid, defaulting to 100\n");
|
||||
}
|
||||
if (body->auto_haptics_lowpass > 3) {
|
||||
body->auto_haptics_lowpass = 1; // 160 Hz
|
||||
printf("[Config] auto_haptics_lowpass invalid, defaulting to 1 (160 Hz)\n");
|
||||
}
|
||||
if (body->config_version != CONFIG_VERSION) {
|
||||
body->config_version = CONFIG_VERSION;
|
||||
printf("[Config] Warning: Config may breaking change\n");
|
||||
@@ -91,6 +107,15 @@ void config_load() {
|
||||
config_valid();
|
||||
}
|
||||
|
||||
// Reset RAM-resident config body to firmware defaults. Caller must
|
||||
// config_save() to persist. Filling with 0xFF mirrors the byte pattern
|
||||
// of a freshly-erased flash sector, so every field fails validity and
|
||||
// gets re-initialized to its documented default by config_valid().
|
||||
void config_default() {
|
||||
memset(&config.body, 0xFF, sizeof(config.body));
|
||||
config_valid();
|
||||
}
|
||||
|
||||
bool config_save() {
|
||||
config.crc32 = calc_config_crc(config);
|
||||
alignas(4) uint8_t page[FLASH_PAGE_SIZE];
|
||||
|
||||
Reference in New Issue
Block a user