bootloader: Make run() function return a bool.
[gps-watch.git] / src / bootloader / bootloader.rs
index cf4bca2926638a34be6be5572d9a3a241970f32c..311b1a60e6a2ed491474eecf0d986c10d58d54a3 100644 (file)
@@ -121,7 +121,7 @@ impl Bootloader {
         }
     }
 
-    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;
@@ -131,10 +131,14 @@ impl Bootloader {
             }
         }
 
-        if self.command_bytes == 4 {
+        if self.command_bytes != 4 {
+            true
+        } else {
             self.command_bytes = 0;
 
             self.process_command();
+
+            self.command != COMMAND_START_APP
         }
     }