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

when we change isByteSwap and isWordSwap True with dataType value set to 64 bit we dont get the expected result. #335

Open
lsamuvel opened this issue Apr 25, 2022 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@lsamuvel
Copy link

Issue :

When we change isByteSwap and isWordSwap from False to true, both False and True produce the same result for dataType value is set to 64 bit
With 64 bit data type, byte swaps and word swaps do not work as expected, but they do work as expected with 32 bit data type.

Expected :
As long as isByteSwap and isWordSwap are both true, the results of False and True should vary as if they were 32 Bit or 64bit or anything what it is actually meant for (which data type).

Steps followed :

  1. In Edgex - Device profile added isByteSwap and isWordSwap as below
  • description: ""
    name: device_float
    isHidden: false
    tag: ""
    properties:
    valueType: Float64
    readWrite: RW
    units: ""
    minimum: ""
    maximum: ""
    defaultValue: ""
    mask: ""
    shift: ""
    scale: "0.1"
    offset: ""
    base: ""
    assertion: ""
    mediaType: ""
    attributes:
    isByteSwap: false
    isWordSwap: false
    primaryTable: HOLDING_REGISTERS
    startingAddress: 4225
  1. Navigated to Device Command
    Selected Floating device profile "device_float"

and have set device_float values as "999999999"

Observed Docker logs

level=INFO ts=2022-04-25T06:12:33.983200131Z app=device-modbus source=modbusclient.go:84 msg="Modbus client GetValue's results [66 2 160 95 31 176 0 0]"
level=INFO ts=2022-04-25T06:12:33.983425579Z app=device-modbus source=driver.go:155 msg="Read command finished. Cmd:device_float, DeviceResource: device_float, Float64: 9.99999999e+09 \n"

  1. Changed isByteSwap and isWordSwap to true

attributes:
isByteSwap: true
isWordSwap: true
primaryTable: HOLDING_REGISTERS
startingAddress: 4225

  1. Navigated to EdgeX - Device Command
    Selected Floating device profile "device_float"

and have set device_float value as "999999999"

Observed Docker logs

level=INFO ts=2022-04-25T06:15:42.238756376Z app=device-modbus source=modbusclient.go:84 msg="Modbus client GetValue's results [66 2 160 95 31 176 0 0]"
level=INFO ts=2022-04-25T06:15:42.23880021Z app=device-modbus source=driver.go:155 msg="Read command finished. Cmd:device_float, DeviceResource: device_float, Float64: 9.99999999e+09 \n"

When we are changing isByteSwap and isWordSwap from False to true , both the results of False and True shows the same result in Docker logs (check - Observed Docker logs of Step 2 and 4).

@lsamuvel lsamuvel added the bug Something isn't working label Apr 25, 2022
@lsamuvel lsamuvel changed the title when we change isByteSwap and isWordSwap True with dataType value is set to 64 bit we dont get the expected result. when we change isByteSwap and isWordSwap True with dataType value set to 64 bit we dont get the expected result. Apr 25, 2022
@weichou1229
Copy link
Member

weichou1229 commented Apr 25, 2022

@lsamuvel Because the deivce-modbus-go didn't support 64bit swap yet.
See swap32BitDataBytes https://github.com/edgexfoundry/device-modbus-go/blob/main/internal/driver/deviceclient.go#L118

@weichou1229 weichou1229 added the help wanted Extra attention is needed label May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants