Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajdust the frequency of every using the value of an external signal? #163

Open
saolof opened this issue Oct 27, 2017 · 2 comments
Open

Ajdust the frequency of every using the value of an external signal? #163

saolof opened this issue Oct 27, 2017 · 2 comments

Comments

@saolof
Copy link

saolof commented Oct 27, 2017

Title says it all. Would it be possible to change the time between the next triggers of every by adjusting a signal? Right now as I understand it, you can only set the timer once, i.e. on initialization.

It would also be nice to have a clock signal that starts/stops efficiently depending on the value of another boolean signal, though that can already sort of be achieved using filterwhen on the clock signal.

@JobJob
Copy link
Member

JobJob commented Oct 28, 2017

It would also be nice to have a clock signal that starts/stops efficiently depending on the value of another boolean signal

See fpswhen(switch, rate)

Would it be possible to change the time between the next triggers of every by adjusting a signal?

I think you might be able to implement this with these minor changes:

  1. modify the existing fpswhen to fpswhen(switch::Signal, rate::Signal), and add fpswhen(switch::Signal, rate) = fpswhen(switch, Signal(rate))
  2. modify fpswhen_connect to take a signal rather than a constant
  3. change the dt = 1.0/rate to dt = 1.0/rate.value and move it to be at the top of fpswhen_runner()

PR welcome if you get it working.

@saolof
Copy link
Author

saolof commented Oct 28, 2017

I got it working!

PR submitted: #164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants