-
Notifications
You must be signed in to change notification settings - Fork 20
Jig mux alternate implementation #184
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
Merged
clint-lawrence
merged 42 commits into
PyFixate:master
from
clint-lawrence:jig-mux-refactor
Jun 20, 2024
Merged
Changes from 12 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
791a7e1
Initial work of untangling VirtualMux and Address Handlers
clint-lawrence ed0604f
Implement map_tree and start on AddressHandler
clint-lawrence 9384673
minor tweaks and comment updates
clint-lawrence 5035e36
more typing
clint-lawrence 3bd974a
More annotaions and JigDriver changes
clint-lawrence 5ddeab4
Glue handlers and muxs, typing, comments etc
clint-lawrence 8b94e31
A bunch of random stuff...
clint-lawrence cebeadf
Stringify 'TreeDef' to avoid if TYPE_CHECKING
clint-lawrence 6a71fd2
Implement a Relay Matrix address handler
clint-lawrence 6a05a7e
Move Relay Matrix address handler to avoid ftdi imports
clint-lawrence 32a97c3
Remove the import that the whole last commit was meant to avoid...
clint-lawrence 8dfffd2
why test locally when you can just push, eh?
clint-lawrence 266431e
fix python 3.12 env
clint-lawrence 44e4223
Merge branch 'master' into jig-mux-refactor
clint-lawrence 6f24ea8
Add some test for VirtulMux
clint-lawrence 12c562c
I think I have a black version mis-match somewhere
clint-lawrence 73691ee
Add a test for VirtualSwitch
clint-lawrence 3d87f63
Change VirtualSwitch to use On/Off
clint-lawrence 1ac5a31
add test for RelayMatrixMux
clint-lawrence 250be7e
Don't allow explicitly defining signal ''
clint-lawrence 28895f7
Don't allow 'default_signal' on VirtualMux
clint-lawrence d6550aa
A few unrelated changes
clint-lawrence f4a0db0
Fix a missing type hint
clint-lawrence 16b81e3
Just for Jason...
clint-lawrence 03932d3
Tweak the comments a little bit
clint-lawrence 8caead4
Tidy up some debug functions
clint-lawrence db289a1
Add VirtualMux.wait_at_least()
clint-lawrence f464c4e
Add tests for VirtualAddressMap
clint-lawrence bf50400
Add some notes about ftdi baudrate
clint-lawrence 7917808
Rename signal_output to signal
clint-lawrence 19f95a4
re-organise how we export public symbols
clint-lawrence bf043da
Implement a check on jig definitions
clint-lawrence 1dbe04d
Add test for JigDriver._validate()
clint-lawrence ed21cf7
Remove type def signal stuff from the test script.
clint-lawrence 50c89cd
Another crack at AddressHandler init.
clint-lawrence 2860792
Relay matrix should open to switch to the same signal
clint-lawrence 68714b3
fix mypy config
clint-lawrence 056eb5f
Move script.py to examples
clint-lawrence d8ae041
Move _switching up out of core.
clint-lawrence 0a20ba5
blacken the jig_driver example
clint-lawrence 2add8c8
grammar fix before I get in trouble from Jason
clint-lawrence 5475f76
fix mypy config. Again...
clint-lawrence File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clint-lawrence marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| """ | ||
| This file is just a test playground that shows how the update jig classes will | ||
| fit together. | ||
| """ | ||
| from dataclasses import dataclass, field | ||
| from fixate.core.switching import VirtualMux, JigDriver, MuxGroup, PinValueAddressHandler, VirtualSwitch | ||
|
|
||
|
|
||
| class MuxOne(VirtualMux): | ||
| pin_list = ("x0", "x1", "x2") | ||
| map_list = ( | ||
| ("sig1", "x0"), | ||
| ("sig2", "x1"), | ||
| ("sig3", "x2"), | ||
| ) | ||
|
|
||
| class MuxTwo(VirtualMux): | ||
| pin_list = ("x3", "x4", "x5") | ||
| map_tree = ( | ||
| "sig4", | ||
| "sig5", | ||
| "sig6", | ||
| ( | ||
| "sig7", | ||
| "sig8", | ||
| ), | ||
| ) | ||
|
|
||
| class MuxThree(VirtualMux): | ||
| pin_list = ("x101", "x123") | ||
| map_list = (("", "x101", "x123"),) | ||
|
|
||
| class Handler(PinValueAddressHandler): | ||
| pin_list = ("x0", "x1", "x2", "x3", "x4", "x5") | ||
|
|
||
|
|
||
|
|
||
| # Problem! | ||
| # our existing scripts/jig driver, the name of the mux is the | ||
| # class of the virtual mux. This scheme below will not allow that | ||
| # to work. | ||
| # Assuming an existing script with a mux called NewVirtualMux | ||
| # 1. Update every reference in the script | ||
| # dm.jig.mux.NewVirtualMux -> dm.jig.mux.new_virtual_mux | ||
| # 2. Change the class name, but keep the attribute name | ||
| # @dataclass | ||
| # class JigMuxGroup(MuxGroup): | ||
| # NewVirtualMux: _NewVirtualMux | ||
| # Then the references in the script stay this same. | ||
| # jig.mux.NewVirtualMux | ||
| # 3. Change the attribute name on mux, like in the example below, | ||
| # but add some compatibility code to MuxGroup base class so that | ||
| # attribute lookups that match the Class of one of its attributes | ||
| # get magically mapped to the correct attribute. | ||
| @dataclass | ||
| class JigMuxGroup(MuxGroup): | ||
clint-lawrence marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| mux_one: MuxOne = field(default_factory=MuxOne) | ||
| mux_two: MuxTwo = field(default_factory=MuxTwo) | ||
| mux_three: MuxThree = field(default_factory=MuxThree) | ||
|
|
||
| jig = JigDriver(JigMuxGroup, [Handler()]) | ||
|
|
||
| jig.mux.mux_one("sig2", trigger_update=False) | ||
| jig.mux.mux_two("sig5") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.