cronologic-de / xhptdc8_babel

Wrappers, Utilities and Examples for using the xHPTDC8 with various programming languages.
Mozilla Public License 2.0
0 stars 1 forks source link

xhptdc8_info ignores command line arguments when -tdc=[TDC] is missing #48

Closed ahofmann75 closed 2 years ago

ahofmann75 commented 3 years ago

The application always prints the static_info of the device when -tdc=[TDC] is missing. This does not match the help text.

PS C:\Users\andreas\Desktop\yaml-test> .\xhptdc8_info_64.exe -temperature
Info: No device selected.
-----------------------------------------------------------------------------
               xHPTDC8 Information Utility Application
-----------------------------------------------------------------------------

Installed Devices Serials for 1 TDC(s):
1 ) index: 0 xHPTDC8 serial 21.348

About the application
Command:
  xhptdc8_info.exe [TDC] [Flags]
Usage:
  [TDC]   is either an integer as the index of the TDC, or a serial number of the TDC
  [Flags] Can be one or more of the following flags:
          -tdc=[TDC]    is either an integer as the index of the TDC, or a serial number of the TDC
          -v            show size and version information for all selected structures
          -static       show static_info
          -temp         show temperature_info
          -temperature  show_temperature_info
          -fast         show fast_info
          -clock        show clock_info
          -all          show all infos structures
          -h            show this help
          -d            output requested data in JSON only with no headers

Static Information of all TDC(s):
static_info of xHPTDC8 serial 21.348 at index 0
{
  "size": 80,
  "version": 1,
  "board_id": 0,
  "driver_revision": "0.19.0",
  "driver_build_revision": 2136,
  "firmware_revision": 2,
  "board_revision": 3,
  "board_configuration": 1,
  "subversion_revision": 1124,
  "chip_id": [
    "0x8010",
    "0x8010"
  ],
  "board_serial": 21.348,
  "flash_serial_high": "0x28362c5f",
  "flash_serial_low": "0x26a467d2",
  "flash_valid": 1,
  "calibration_date": "2021-10-18 19:25"
}

-----------------------------------------------------------------------------
                          End of Application
-----------------------------------------------------------------------------
Bassem-Ramzy commented 3 years ago

Right, apparently we need to update the help to be:

If nothing is passed to the application command line or no device is specified, then the following will be displayed:

@sulimma please advise, should we update only the help, or should we update the behavior?

ahofmann75 commented 3 years ago

As the typical user has a single device a missing device number should be treated as -tdc=0

sulimma commented 3 years ago

This is partly intended behaviour. The idea was, that the tool without any parameters provides an overview over the available TDCs.

sulimma commented 3 years ago

However, the behaviour also is not implemented correctly.

If you look at the issued that I provided for specification: https://github.com/cronologic-de/xhptdc8_babel/issues/19

It says: If there is at least one command line switch, only the selected structures are printed. Note the plural in "structures".

However, in the wiki you differentiate between "-all", "one structure" or "one structure and -v". https://github.com/cronologic-de/xhptdc8_babel/wiki/using_info_tool That is not the intended behaviour.

The idea was that the user can list any combination of structures or -v and then everything that was specified is printed out. There is no need for special cases in the documentation. Please simplify the wiki accordingly.

The code should:

1) add "-static" to the set of print methods to run. 2) clear the set of methods whenever the first flag specifying a print option is found on the command line 3) add whatever options are found on the command line to the set of print methods


Independently (orthogonally) from that 1) the set of TDCs to process is set to all TDCs 2) if the first command line option is not a flag, the TDC it specified is added to the set of TDCs to process 3) if a flag "-tdc" is encountered, the TDC is added to the set of boards to be processed 4) loop over the set of tdcs and call each print method from the set of print methods on each of these