mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
fix prediction order
This commit is contained in:
parent
7f7f30f23d
commit
3cec151ffd
2 changed files with 4 additions and 5 deletions
|
|
@ -481,7 +481,6 @@ impl InputTracker {
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
what else do we need:
|
what else do we need:
|
||||||
- debug prediction order
|
|
||||||
- registration for listening to string results
|
- registration for listening to string results
|
||||||
*/
|
*/
|
||||||
// prediction area is drawn second because the area could be cleared on behalf of a resize of the text box
|
// prediction area is drawn second because the area could be cleared on behalf of a resize of the text box
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ fn xmain() -> ! {
|
||||||
let mut history: Queue<xous::String<64>, U4> = Queue::new(); // this has 2^4 elements = 16??? or does it just have 4 elements.
|
let mut history: Queue<xous::String<64>, U4> = Queue::new(); // this has 2^4 elements = 16??? or does it just have 4 elements.
|
||||||
let history_max = 4;
|
let history_max = 4;
|
||||||
|
|
||||||
if true { // loads defaults into the predictor array to test things
|
if false { // loads defaults into the predictor array to test things
|
||||||
use core::fmt::Write as CoreWriter;
|
use core::fmt::Write as CoreWriter;
|
||||||
let mut test1: xous::String::<64> = xous::String::new();
|
let mut test1: xous::String::<64> = xous::String::new();
|
||||||
write!(test1, "This〰should overflow the box").unwrap();
|
write!(test1, "This〰should overflow the box").unwrap();
|
||||||
|
|
@ -33,7 +33,7 @@ fn xmain() -> ! {
|
||||||
write!(test2, "Another string too long").unwrap();
|
write!(test2, "Another string too long").unwrap();
|
||||||
history.enqueue(test2).unwrap();
|
history.enqueue(test2).unwrap();
|
||||||
let mut test3: xous::String::<64> = xous::String::new();
|
let mut test3: xous::String::<64> = xous::String::new();
|
||||||
write!(test3, "Mary had a little lamb").unwrap();
|
write!(test3, "未雨绸缪").unwrap();
|
||||||
history.enqueue(test3).unwrap();
|
history.enqueue(test3).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ fn xmain() -> ! {
|
||||||
if index >= history.len() as u32 {
|
if index >= history.len() as u32 {
|
||||||
index = history.len() as u32 - 1;
|
index = history.len() as u32 - 1;
|
||||||
}
|
}
|
||||||
let mut i = history.len() as u32;
|
let mut i = 1;
|
||||||
for &s in history.iter() {
|
for &s in history.iter() {
|
||||||
// iterator is from oldest to newest, so do some math to go from newest to oldest
|
// iterator is from oldest to newest, so do some math to go from newest to oldest
|
||||||
if (history.len() as u32 - i) == index {
|
if (history.len() as u32 - i) == index {
|
||||||
|
|
@ -121,7 +121,7 @@ fn xmain() -> ! {
|
||||||
prediction.valid = true;
|
prediction.valid = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
i = i - 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
} else { // there is no history
|
} else { // there is no history
|
||||||
prediction.valid = false;
|
prediction.valid = false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue