]> git.tdb.fi Git - r2c2.git/commitdiff
Avoid hogging the serial link with S88 read commands
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 20:23:37 +0000 (22:23 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 20:23:37 +0000 (22:23 +0200)
source/libr2c2/arducontrol.cpp
source/libr2c2/arducontrol.h

index 2361d8540d561ccff6477836b36fc41ebba114dc..dd4e0574eb7d52c4714e8740db3e99c20be40ed8 100644 (file)
@@ -721,11 +721,17 @@ void ArduControl::RefreshTask::advance()
 ArduControl::S88Task::S88Task(ArduControl &c):
        control(c),
        n_octets(0),
-       octets_remaining(0)
+       octets_remaining(0),
+       delay(0)
 { }
 
 bool ArduControl::S88Task::get_work(PendingCommand &cmd)
 {
+       if(delay)
+       {
+               --delay;
+               return false;
+       }
        if(octets_remaining || !n_octets)
                return false;
 
@@ -734,6 +740,8 @@ bool ArduControl::S88Task::get_work(PendingCommand &cmd)
        cmd.command[1] = octets_remaining;
        cmd.length = 2;
 
+       delay = 4;
+
        return true;
 }
 
index 1f45534a1ca472ee22cfbd40159fe2be806cf7a7..a8bdfa7a7ba1b018d3798c9ff3d50f25f8d640ff 100644 (file)
@@ -269,6 +269,7 @@ private:
                ArduControl &control;
                unsigned n_octets;
                unsigned octets_remaining;
+               unsigned delay;
 
        public:
                S88Task(ArduControl &);