Skip to content
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

Merged
merged 36 commits into from
Nov 22, 2017
Merged

Conversation

bhaswath
Copy link
Contributor

@bhaswath bhaswath commented Nov 13, 2017

[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?

  • Adds enums for NI-Fgen
    • ByteOrder
    • HardwareState
    • RelativeTo
    • Signal
    • Trigger
    • TriggerWhen
  • Adds system tests for NI-Fgen

List issues fixed by this Pull Request below, if any.

What testing has been done?

System tests pass

'RelativeTo': {
'values': [
{
'name': 'WAVEFORM_POSITION_START',
Copy link
Contributor

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
'values': [
{
'name': 'START',
'value': 0,
Copy link
Contributor

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' ?

Copy link
Contributor

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.

@injaleea
Copy link
Contributor

Why this branch is not showing conflicts ? There should be 142 systemtests in master now. This branch shows 79!!

'TriggerWhen': {
'values': [
{
'name': 'HighLevel',
Copy link
Contributor

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'

Copy link
Member

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.

'value': 101,
},
{
'name': 'LowLevel',
Copy link
Contributor

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
Copy link
Member

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,

'trigger_when': {
'values': [
{
'name': 'HighLevel',
Copy link
Member

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?

'TriggerWhen': {
'values': [
{
'name': 'HighLevel',
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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)

Copy link
Contributor Author

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

Copy link
Member

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.

@Fladolcetta
Copy link
Contributor

Does this fix #538

@marcoskirsch
Copy link
Member

Does this fix #538

It appears to be a partial fix. One enum "Trigger" used by SendSoftwareEdgeTrigger is still missing.

@bhaswath Maybe you can add that in this PR so we can close that too?

session.configure_digital_level_script_trigger('ScriptTrigger0', 'PXI_Trig0', nifgen.TriggerWhen.HIGH)


# TODO(bhaswath): Enable after Issue 597 is fixed
Copy link
Member

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?

@nimi-bot
Copy link

system tests succeeded

@bhaswath
Copy link
Contributor Author

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.

@nimi-bot
Copy link

system tests succeeded

@nimi-bot
Copy link

system tests succeeded

@Fladolcetta Fladolcetta dismissed stale reviews from marcoskirsch and texasaggie97-zz November 22, 2017 14:45

Talked with Bhaswath and these changes have been implemented

@marcoskirsch
Copy link
Member

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.

@nimi-bot
Copy link

system tests succeeded

@texasaggie97-zz texasaggie97-zz merged commit eaf2c75 into master Nov 22, 2017
@marcoskirsch marcoskirsch deleted the bhaswath branch December 13, 2017 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Several function enums missing from NI-FGEN metadata Write system tests for NI-FGEN
6 participants