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

Bad Hex String Conversion in Command Sender #908

Closed
J-Pai opened this issue Oct 25, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@J-Pai
Copy link

commented Oct 25, 2018

Describe the bug
Using the Command Sender GUI to send parameters with String hex values with an e/E value results in COSMOS treating the String as Scientific Notation and converting it to an equivalent float/double value instead of the original String hex value when the command is sent.

e.g.

"00e5" becomes "0.0" (Expected is "00e5")
"01e1" becomes "10.0" (Expected is "01e1")

To Reproduce
Steps to reproduce the behavior:

  1. Start COSMOS
  2. Start Command and Telemetry Server
  3. Open Command Sender
  4. Use a command which sends String parameters
  5. Give it a String Hex value that looks like it’s in scientific notation.
  6. Notice the command that the String Hex value has been converted to a String double value when the command is sent.

Expected behavior
Using the following String "00e5" as a parameter should result in "00e5" being used to construct the command.
Using the following String "01e1" as a parameter should result in "01e1" being used to construct the command.

Environment (please complete the following information):

  • OS: Debian 9
  • COSMOS Version 4.1.1
  • Ruby Version 2.4.4p296

@jasonatball jasonatball added the bug label Oct 29, 2018

@jasonatball

This comment has been minimized.

Copy link
Collaborator

commented Oct 29, 2018

I agree this is an issue but as a workaround if you put your text in quotes it will be interpreted correctly.

@J-Pai

This comment has been minimized.

Copy link
Author

commented Oct 30, 2018

@jasonatball Thanks for responding!

That's an interesting workaround which fixes my issue.

That said, for my usage, the parameter that is being incorrectly converted is supposed to be a fixed/pre-calculated value. Needing to go through and add quotes around these String parameters will become very annoying and also not particularly representative of our intended use case.

As a suggestion, would it be possible to have COSMOS automatically add quotes around parameters pulled from workbooks that are designated as Strings? This way, the workaround will be incorporated by default with the added benefit of providing a visual confirmation that the value for the parameter is of type String.

@jasonatball

This comment has been minimized.

Copy link
Collaborator

commented Oct 30, 2018

I'm not sure what you mean about parameter pulled from workbooks. I think the solution is to treat any parameters marked as STRING as a string and not do this conversion into a number which then gets translated back to a string.

@J-Pai

This comment has been minimized.

Copy link
Author

commented Oct 30, 2018

I apologize. The terminology I used was incorrect.

What I meant was a target configuration/definition file. We have a command definition file that contains a line that is similar to this:

APPEND_PARAMETER INPUTVAR 32 STRING "00e5"

The code that receives this command is expecting it as a hex string. The issue right now is that the Command Sender appears to take that command definition file, and adds uses that specified ("00e5") string without quotation marks.
This leads to the hex conversion issue if I do not manually add quotes in the Command Sender.

Hopefully this clarifies the issue.

@jasonatball

This comment has been minimized.

Copy link
Collaborator

commented Oct 30, 2018

That makes sense. I think the issue is just with Command Sender interpreting strings as numbers with various prefixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.