Run if (or similar) statement once

Ah, yes of course! I am already adding another term which counts in exactly the same way you have mentioned, to be used in a calculation for position, not just speed.

Then simply I can do;

if{since_lastpulse >= reset_period)
{
dpm = 0;
}