#pragma XOD require "https://github.com/RB-ENantel/RC_ESC"
{{#global}}
#include <ESC.h>
{{/global}}
struct State {
uint8_t mem[sizeof(ESC)];
ESC* myESC;
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
if (!isInputDirty<input_CLB>(ctx))
return;
State* state = getState(ctx);
auto port = (int)getValue<input_PORT>(ctx);
state->myESC = new (state->mem) ESC(port,1000,2000,500);
emitValue<output_STATE>(ctx, true);
state->myESC->calib();
state->myESC->stop();
emitValue<output_STATE>(ctx, false);
}