-
Notifications
You must be signed in to change notification settings - Fork 91
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
Updating enums_addon and system tests for nifgen #586
Conversation
Adding RelativeTo enum to enums_ addon
Adding system tests
src/nifgen/metadata/enums_addon.py
Outdated
'RelativeTo': { | ||
'values': [ | ||
{ | ||
'name': 'WAVEFORM_POSITION_START', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a change I am working on that will remove common prefixes and suffix like WAVEFORM_POSITION_
from enum names, if they all have it.
Since we are explicitly adding this enum, I think we should not have that common prefix. I.e. make these START
and CURRENT
.
Updating with changes requested
Updating with changes requested
src/nifgen/metadata/enums_addon.py
Outdated
'values': [ | ||
{ | ||
'name': 'START', | ||
'value': 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need prefix key as 'WAVEFORM_POSITION' ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marcoskirsch and I discussed this. Instead of removing the common prefix, we think you should make the name match the C API completely. Then the codegen step can operate like normal and it will put the prefix in the processed metadata for you. So this 'name' should be changed to NIFGEN_VAL_WAVEFORM_POSITION_START
and the other should be changed to NIFGEN_VAL_WAVEFORM_POSITION_CURRENT
.
Sorry about changing this again.
fixing flake8 errors
Fixing flake8 errors
Fixing flake8 errors
Why this branch is not showing conflicts ? There should be 142 systemtests in master now. This branch shows 79!! |
src/nifgen/metadata/enums_addon.py
Outdated
'TriggerWhen': { | ||
'values': [ | ||
{ | ||
'name': 'HighLevel', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use name 'NIFGEN_VAL_ACTIVE_HIGH'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, all names should be identical to the names used by the C API.
src/nifgen/metadata/enums_addon.py
Outdated
'value': 101, | ||
}, | ||
{ | ||
'name': 'LowLevel', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use name 'NIFGEN_VAL_ACTIVE_LOW'
delay = 1e-09 | ||
session.adjust_sample_clock_relative_delay(delay) | ||
def test_adjust_sample_clock_relative_delay(): | ||
with nifgen.Session('', False, 'Simulate=1, DriverSetup=Model:5421;BoardType:PXI') as session: # 5433 is not supporting adjust_sample_clock_relative_delay right now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment makes it impossible for us to follow up in the future. Anything that says "right now" can be fixed at some point. So the comment should indicate so either by pointing to an issue or by being a TODO.
In this specific case, however, support has been added to NI-FGEN in 17.8 which will be released soon. I'm going to upgrade nimi-bot to pre-release NI-FGEN 17.8d25. This means you will be able to use 5433 in this test and it should work and hopefully the prerelease software doesn't break anything.
This will leave a window of time between now and NI-FGEN 17.8 being publicly released in which non-NI contributors will have a problem running this system test,
src/nifgen/metadata/enums_addon.py
Outdated
'trigger_when': { | ||
'values': [ | ||
{ | ||
'name': 'HighLevel', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@texasaggie97 shouldn't these names match the names of the corresponding C API constants?
src/nifgen/metadata/enums_addon.py
Outdated
'TriggerWhen': { | ||
'values': [ | ||
{ | ||
'name': 'HighLevel', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In other words, all names should be identical to the names used by the C API.
@@ -71,6 +71,7 @@ | |||
'SetWaveformNextWritePosition': { 'parameters': { 3: { 'enum': 'RelativeTo', }, }, }, # TODO: issue #538 | |||
'GetHardwareState': { 'parameters': { 1: { 'enum': 'HardwareState', }, }, }, # TODO: issue #538 | |||
'SendSoftwareEdgeTrigger': { 'parameters': { 1: { 'enum': 'Trigger', }, }, }, # TODO: issue #538 | |||
'ConfigureDigitalLevelScriptTrigger': { 'parameters': { 3: { 'enum': 'TriggerWhen', }, }, }, # TODO: issue #538 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these TODOs still here? Isn't this precisely what this PR is taking care of?
session.clear_user_standard_waveform() | ||
|
||
|
||
# TODO(bhaswath): Doesn't work, issue #596 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try my suggestion?
#596 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried and it did not throw a driver error.
Have updated in the issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@texasaggie97 got to the bottom of it, we'll have to tackle it separately.
Does this fix #538 |
session.configure_digital_level_script_trigger('ScriptTrigger0', 'PXI_Trig0', nifgen.TriggerWhen.HIGH) | ||
|
||
|
||
# TODO(bhaswath): Enable after Issue 597 is fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added all except one enum in this PR, maybe you can finish it and close #597 too?
system tests succeeded |
Putting 'Triggers' enum in a different dictionary than other enums, because 'Trigger' matches multiple entries like 'TriggerMode' and 'TriggerSource', so they all end up with the values from 'Trigger' if it is in the enums_additional_enums dictionary. It can be moved to be with the others once issue #624 is fixed. |
system tests succeeded |
system tests succeeded |
Talked with Bhaswath and these changes have been implemented
Diff looks fine, but the PR description appears to be very outdated. PR does more, and fixes more issues. Please make sure it's accurate. |
system tests succeeded |
[X ] This contribution adheres to CONTRIBUTING.md.
[] I've updated CHANGELOG.md if applicable.[X] I've added tests applicable for this pull request
What does this Pull Request accomplish?
List issues fixed by this Pull Request below, if any.
What testing has been done?
System tests pass