The return value indicates if the caller should continue to call
the function. It only returns false once COMMAND_START_APP is seen.
The idea is that after run() returns false, the we can jump to the
application code.
}
}
- pub fn run(&mut self) {
+ pub fn run(&mut self) -> bool {
if self.command_bytes < 4 {
if let Some(b) = try_read_u8() {
self.command >>= 8;
}
}
- if self.command_bytes == 4 {
+ if self.command_bytes != 4 {
+ true
+ } else {
self.command_bytes = 0;
self.process_command();
+
+ self.command != COMMAND_START_APP
}
}