Skip to content

Commit

Permalink
Reset Button Refinement
Browse files Browse the repository at this point in the history
Refined the action of reset button and inputs so that they only trigger once per gate.
  • Loading branch information
codygeary authored Mar 28, 2024
1 parent bcc8bcd commit 2e4da28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Magnets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ struct Magnets : Module {

// Initialize variables for trigger detection
dsp::SchmittTrigger Reset;
dsp::SchmittTrigger ResetBut;


float resetCount=0;
float head = 0.0f;
Expand Down Expand Up @@ -146,7 +148,7 @@ struct Magnets : Module {
polarization = 0.5f * polarization + 0.5f;
interactionStrength = clamp(interactionStrength, 0.f, 1.f);

if ( Reset.process( inputs[RESET_INPUT].getVoltage() ) || params[RESET_BUTTON].getValue() > 0.5f ) {
if ( Reset.process( inputs[RESET_INPUT].getVoltage() ) || ResetBut.process(params[RESET_BUTTON].getValue()) ) {
resetSpinStates(polarization);
}

Expand Down

0 comments on commit 2e4da28

Please sign in to comment.