Timer Segment Issue

Hello, I’m using the segments dat feature of the timer chop and would like to restart the timer if some specific segments end. I’ve attached a sample which shows my issue, not sure what I’m doing wrong or if it’s a bug.

When in the sample, click the error 1 button to go into the error1 state. When that state ends, I’d like to go back to the idle state, for some reason when called within the timer callbacks the gotodone.pulse() doesn’t work. The back to idle button works, but I should be doing the same thing?

@snaut The sample you sent me works but clearly I’m having trouble recreating it. Likely a me issue.

Timer_issue.toe (6.0 KB)

Hi @amulder,

will check why pulsing the parameter doesn’t have the expected effect. For now I would just use the .goTo method to switch back to the first sgment:

def onSegmentExit(timerOp, segment, interrupt):
	if segment.index == 1 or segment.index == 2:
		timerOp.goTo(segment=0)
		debug('restart timer')
	return

cheers
Markus

That works. Thanks Markus!

New question, same topic.

I’m trying to run code within onSegmentExit() if the segment has completed (state timed out) but not if the segment was interrupted (user interacted), which I thought could be done with the interrupt Boolean but the state is false even if I call goTo(). Is this a bug or how should this be done?

I was able to get the interrupt flag True if I click next or previous segment parameter pulse.