]> git.tdb.fi Git - r2c2.git/commitdiff
Properly handle setting multiple functions in rapid succession
authorMikko Rasa <tdb@tdb.fi>
Sat, 4 Apr 2015 16:11:45 +0000 (19:11 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 4 Apr 2015 16:11:45 +0000 (19:11 +0300)
source/libr2c2/arducontrol.cpp

index 7b5fc108f09bf0864776c67b0a9ce7f717edd4c7..8aced3be4ad9d15f137da9a93f38c1e4abf96284 100644 (file)
@@ -208,7 +208,7 @@ void ArduControl::set_loco_function(unsigned id, unsigned func, bool state)
                throw invalid_argument("ArduControl::set_loco_function");
 
        unsigned mask = 1<<func;
-       if(loco.funcs.set((loco.funcs&~mask)|(mask*state)))
+       if(loco.funcs.set((loco.funcs.pending&~mask)|(mask*state)))
        {
                if(func>0 || loco.proto!=MM)
                {