BCDA-APS / adl2pydm

Convert MEDM's .adl files to PyDM's .ui format
Other
0 stars 4 forks source link

Can PyDM accept a float for precision? (MEDM `valuator` widget) #79

Open prjemian opened 2 years ago

prjemian commented 2 years ago

Can PyDM accept a float for precision? (MEDM valuator widget) Precision seems as if it should be an integer value while a float shows a roundoff level. In that case, we should compute an integer by -log10(float_precision) but what to do for precision 1.2 truncated to 1 reported while converting from std-R3-6-2/stdApp/op/adl/Nano2k.adl?

valuator {
    object {
        x=3
        y=136
        width=243
        height=35
    }
    control {
        chan="$(P)$(S)$(p)_set_position.VAL"
        clr=14
        bclr=3
    }
    label="outline"
    clrmod="alarm"
    dPrecision=1.200000
}

Originally posted by @prjemian in https://github.com/BCDA-APS/adl2pydm/issues/73#issuecomment-951187980

prjemian commented 2 years ago

The valuator documentation states:

Valuator/Scale

The valuator/scale object has several modes of operation, which implement fine/coarse sensitivity, as well as direct value selection.

Dragging the valuator/scale with MB1 depressed moves and transmits values proportional to the range of the valuator scaled into the width of the valuator (usually >= 1% for this application, depending upon the selected width of the valuator). Clicking MB1 on either side of the valuator selector moves and transmits a value increment or decrement of specified precision (for this application) of the valuator object. Clicking Control-MB1 on either side of the valuator selector moves and transmits a value increment or decrement of 10x specified precision of the valuator object.

In addition to the normal mouse-activated mode of usage for the valuator/scale, the arrow keys and shift key take on functions as well. Fine-grained Increment and Decrement are accomplished with the up/down or left/right arrow keys, depending upon the orientation of the valuator/scale. The slider will move in the direction "pointed to" by the arrow key being pressed (as expected), when input focus is set to that widget. For instance, will move the slider by +1 precision unit when the orientation is HORIZONTAL and processingDirection is MAX_ON_RIGHT.

In conjunction with increment/decrement, the key can be used to specify a coarse-grained increment/decrement. Hence, , for instance, will move the slider by +10 precision units when the orientation is VERTICAL and processingDirection is MAX_ON_TOP.

The specified precision for motion of the valuator is specified in a dialog box which is popped up by depressing MB3 in the valuator/scale. A series of toggle buttons with values of log10(precision) are selectable, with the current precision indicated by the depressed toggle.

Also, for the highest precision modification of associated process variables, the keyboard entry dialog box can be used to specify a direct-entry value to be written to the valuator and channel.

prjemian commented 2 years ago

Needs a demonstration with the MEDM "slider" widget (which is described in the .adl file as a valuator object. The precision (dPrecision) is a floating-point step size to use when motion is directed by the arrow buttons.

Is there other use for the precision in this instance?