count-limit

samele1222/ship-data/count-limit

No description
count-limit
@/count-limit
Limitnumber
STEPnumber
Value to add on each increment. Use a negative value (e.g. -1) to make decrements.
INCpulse
Triggers a single increment.
RSTpulse
Resets the accumulated value to zero.
count-limit
Limit
STEP
INC
RST
OUT
DONE
DONEpulse
OUTnumber
The accumulated value.
To use the node in your project you should have the samele1222/ship-data 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);
    Number Limit = getValue<input_Limit>(ctx);
    if (isInputDirty<input_RST>(ctx))
        count = 0;
    else if (isInputDirty<input_INC>(ctx))
        count += getValue<input_STEP>(ctx);
    
    if(count>=Limit){
        emitValue<output_DONE>(ctx, 1);
        count = 0;
    }
    else {
        emitValue<output_DONE>(ctx, 0);
    }
    
    emitValue<output_OUT>(ctx, count);
}