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:
Mae PUGIN 2026-04-07 10:37:42 +02:00
parent d3ee9ef16f
commit a8f621e3d6

View file

@ -894,9 +894,16 @@ fn main() {
let tx = tx.clone();
std::thread::spawn(move || {
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 _ = tx.send(BgMsg::TextLines(tag.into(), lines));
let _ = tx.send(BgMsg::TextLines((*tag).into(), lines));
}
});
});