stepintorange

dinosalvioni/functionslibrary/stepintorange

Incrementa o decrementa un valore numerico dello step impostato all'inbterno di un range di valori prestabilito. Con RST viene richiamato il valore inziale
stepintorange
@/stepintorange
Incrementa o decrementa un valore numerico dello step impostato all'inbterno di un range di valori prestabilito. Con RST viene richiamato il valore inziale
INITnumber
valore iniziale assegnato
STEPnumber
valore dello step
INCpulse
incrementa il valore di uno step
DECpulse
decementa i valore di uno step
Minnumber
valore minimo del range
Maxnumber
valore massimo del range
RSTpulse
resetta il valore di uscita al valore iniziale
stepintorange
INIT
STEP
INC
DEC
Min
Max
RST
OUT
DONE
DONEpulse
comando eseguito
OUTnumber
valore di uscita
To use the node in your project you should have the dinosalvioni/functionslibrary library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    
    Number count = getValue<output_OUT>(ctx);
    
    if (isSettingUp()) //all'avvio imposto valore iniziale
        count = getValue<input_INIT>(ctx); 

       
    if (isInputDirty<input_RST>(ctx)) //su reset imposto valore iniziale
        count = getValue<input_INIT>(ctx);
    
    else if (isInputDirty<input_INC>(ctx))
        count += getValue<input_STEP>(ctx);
    else if (isInputDirty<input_DEC>(ctx))
        count -= getValue<input_STEP>(ctx);

   
    if (count < getValue<input_Min>(ctx)) {
    count = getValue<input_Min>(ctx);
    }
    
    if (count > getValue<input_Max>(ctx)) {
    count = getValue<input_Max>(ctx);
    }

    emitValue<output_OUT>(ctx, count);
    emitValue<output_DONE>(ctx, true);
}