Skip to content

Commit

Permalink
snychronize enable button lights to clock always
Browse files Browse the repository at this point in the history
  • Loading branch information
wlaub committed Feb 11, 2022
1 parent f008cfa commit 45f34ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,17 @@ Button light colors:
Button Modes:
* Toggle Gate
* Toggle the corresponding gate output on the next clock edge.
* Enable button lights up green
* Enable button lights up green when clock low and white when clock high
* Pulse
* Produce a single pulse on the gate output on the next clock edge.
* Enable button flashes green
* Enable button lights up green and flashes white on clock edges
* Pass Clock
* On the next edge, start passing the logic state of the clock to the corresponding gate output.
* Enabled button lights up blue when clock is low and white when clock is high
* Pulse on Clock
* Procue a pulse on the gate output on every clock edge.
* Enabled button lights up blue and flashes white on clock edges

TODO:
* Maybe enable can substitute for the clock when the clock isn't patched?
* Maybe mode indicator blinking should always synchronize to the clock?

### Cobalt I

Expand Down
17 changes: 5 additions & 12 deletions src/Once.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,14 @@ struct Once : Module {
void process(const ProcessArgs& args) override {

float deltaTime = args.sampleTime;

/*
blink_counter += deltaTime;
if(blink_counter > 0.5)
{
blink_counter -= 0.5;
blink = 1-blink;
if(button_mode.mode == ButtonMode::TRIGGER_MODE)
{
vis_pulse.trigger(0.1);
}
}

*/
/* Handle button presses */

for(int i = 0; i < N; ++i)
Expand Down Expand Up @@ -191,10 +187,7 @@ struct Once : Module {

if(clk_trigger_value && enabled)
{
if(button_mode.mode == ButtonMode::PASS_TRIGGER_MODE)
{
vis_pulse.trigger(0.1);
}
vis_pulse.trigger(0.1);

clk_pulse.trigger();
for(int i = 0; i < N; ++i)
Expand Down Expand Up @@ -252,11 +245,11 @@ struct Once : Module {
{
if(button_mode.mode == ButtonMode::TOGGLE_MODE)
{
set_light(ENABLE_LIGHT, 0,1,0);
set_light(ENABLE_LIGHT, clk,1,clk);
}
else if(button_mode.mode == ButtonMode::TRIGGER_MODE)
{
set_light(ENABLE_LIGHT, 0, vis_pulse_value, 0);
set_light(ENABLE_LIGHT, vis_pulse_value, 1, vis_pulse_value);
}
else if(button_mode.mode == ButtonMode::PASS_MODE)
{
Expand Down

0 comments on commit 45f34ec

Please sign in to comment.