-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug introduced in BitmaskEvent Reader #290
Comments
@jkbhagatio bitmask events in digital inputs and outputs pack the state of multiple IO pins in a single integer value. For example, in Output expander AuxIn state, here are a few possible values (in least significant bit first notation, and truncated for unused middle bits, the expander uses an 8-bit word where 4 bits are state and 4 bits are event signals):
If we want to detect the cases where Aux0 is high, it is not enough to simply do This worked before because the expander on each patch happened to use only exactly one digital input, but would break the moment we start using the other input for something else. I recommend we develop a few unit tests for the mecha repo to figure out how to adapt the current foraging schema to use the bitmasked event reader in its most general form. |
@jkbhagatio but yeah, on hindsight that line should probably be changed to: data = data[(data.event & self.value) == self.value] To allow matching against an exact pattern of bits, rather than just accepting when any of the bits in the mask matches. I'm flagging this as a bug. |
Ah this is still a bug: e.g. 34 & 32 = 32. Basically if you get one event that is made up of bits of another, mutually exclusive event, I think you might be screwed?
^ I am definitely happy to spend time together to do this for the repo in general |
Just thinking that for this, I guess we want make sure that we have both the ability to:
Also, I guess this latter case is what's happening with BeamBreak signals? Since the hi/lo vals are 32 & 34, I guess they are somehow sharing the 32-bit pin? |
@glopesdev , why was this change introduced? 7b3724d#diff-7dc0f0404b6e8b4e6de8ffb857524f4426c58ad38a178c1e0a56af37408824feL196
This causes a bug when trying to read a specific event from a stream - it always returns all events, not filtered by a bitmask, if the value of the bitmask > 0.
The text was updated successfully, but these errors were encountered: