ODE stepping with discrete input

Hi I am using DiffEq with manual solver stepping and piecewise constant inputs.

This image shows an integrator
\frac{dx}{dt} = u
with a switching input 0 or 1.
Hence the state should never decrease, but it does.

OrdinaryDiffEq.step!(integrator, t - current_t, true)

I supply u to the right-hand side function via an object that I change before calling step!.
I know the solver cannot know that it changed, but I only do so at the step.

So now my question, how to do this properly?

Have you read:

It seems like you should use the set_u! function to update the state.

Alternatively you could use the DiscreteCallback mechanism in combination with setting tstops to implement your ODE I think: