fix: Remove TAMA/AUTOSHIFT from Refresh All, add query delay
TAMA? and AUTOSHIFT? commands were causing keyboard to malfunction. Added 50ms delay between serial queries to prevent buffer corruption. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d3ee9ef16f
commit
a8f621e3d6
1 changed files with 9 additions and 2 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -894,9 +894,16 @@ fn main() {
|
||||||
let tx = tx.clone();
|
let tx = tx.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
let mut ser = serial.lock().unwrap_or_else(|e| e.into_inner());
|
let mut ser = serial.lock().unwrap_or_else(|e| e.into_inner());
|
||||||
for (tag, cmd) in [("td", "TD?"), ("combo", "COMBO?"), ("leader", "LEADER?"), ("ko", "KO?"), ("bt", "BT?"), ("tama", "TAMA?"), ("autoshift", "AUTOSHIFT?")] {
|
// Use binary protocol if v2, text fallback otherwise
|
||||||
|
let queries: &[(&str, &str)] = if ser.v2 {
|
||||||
|
&[("td", "TD?"), ("combo", "COMBO?"), ("leader", "LEADER?"), ("ko", "KO?"), ("bt", "BT?")]
|
||||||
|
} else {
|
||||||
|
&[("td", "TD?"), ("combo", "COMBO?"), ("leader", "LEADER?"), ("ko", "KO?"), ("bt", "BT?")]
|
||||||
|
};
|
||||||
|
for (tag, cmd) in queries {
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(50));
|
||||||
let lines = ser.query_command(cmd).unwrap_or_default();
|
let lines = ser.query_command(cmd).unwrap_or_default();
|
||||||
let _ = tx.send(BgMsg::TextLines(tag.into(), lines));
|
let _ = tx.send(BgMsg::TextLines((*tag).into(), lines));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue