Save ODE solution for specific values of one state variable

Hello,

I am using DifferentialEquations.jl to solve a system of ordinary differential equations (an ODEProblem) of the form du = f(u, p, t) where u is a vector.

One component of u, say u[1], is monotonically increasing over the integration time span (0, tf), with known initial and final values u1_0, u1_f.

How can I store the solution to the ODE on a uniform grid over the values of u[1], i.e. for u1_0:u1_step:u1_f, where u1_step is given in input?

Note that this will result in a non-uniform time grid due to the nonlinearity in the ODEs, and I am interested in extracting this time grid together with the values of the other components of u.

I thought about using a ContinuousCallback to store the values on the fly, or to store the dense solution and then search for the tk such that sol(tk)[1] % u1_step == 0.

Which would be the preferred approach to follow?