commit c82c4ea046c700b26a6a05427afa0240fef5f310
parent 0d2b4f88fa0f08ab223ddf5f495f46e8312f7acc
Author: Adam M <[email protected]>
Date: Thu, 1 Nov 2018 20:04:10 -0500
added forward input and trigger
Diffstat:
1 file changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp
@@ -13,12 +13,14 @@ struct ComputerscareDebug : Module {
PITCH_PARAM,
MANUAL_TRIGGER,
MANUAL_CLEAR_TRIGGER,
+ MANUAL_FORWARD_TRIGGER,
NUM_PARAMS
};
enum InputIds {
VAL_INPUT,
TRG_INPUT,
CLR_INPUT,
+ FORWARD_INPUT,
NUM_INPUTS
};
enum OutputIds {
@@ -39,8 +41,11 @@ struct ComputerscareDebug : Module {
SchmittTrigger clockTrigger;
SchmittTrigger clearTrigger;
+ SchmittTrigger forwardTrigger;
+
SchmittTrigger manualClockTrigger;
SchmittTrigger manualClearTrigger;
+ SchmittTrigger manualForwardTrigger;
ComputerscareDebug() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {}
void step() override;
@@ -76,6 +81,22 @@ void ComputerscareDebug::step() {
}
strValue = defaultStrValue;
}
+ if (forwardTrigger.process(inputs[FORWARD_INPUT].value / 2.f) || manualForwardTrigger.process(params[MANUAL_FORWARD_TRIGGER].value)) {
+ float newFirstVal = logLines[NUM_LINES-1];
+ for( unsigned int a = NUM_LINES-1; a > 0; a = a - 1 )
+ {
+ logLines[a] = logLines[a-1];
+ }
+ logLines[0] = newFirstVal;
+
+ thisVal = std::to_string(logLines[0]).substr(0,10);
+ for( unsigned int a = 1; a < NUM_LINES; a = a + 1 )
+ {
+ thisVal = thisVal + "\n" + std::to_string(logLines[a]).substr(0,10);
+ }
+
+ strValue = thisVal;
+ }
for(int i = 0; i < 16; i++ ){
outputs[SAMPLE_OUTPUTS + i].value = logLines[i];
@@ -135,9 +156,14 @@ struct ComputerscareDebugWidget : ModuleWidget {
addInput(Port::create<InPort>(Vec(33, 330), Port::INPUT, module, ComputerscareDebug::VAL_INPUT));
addInput(Port::create<InPort>(Vec(63, 330), Port::INPUT, module, ComputerscareDebug::CLR_INPUT));
+
addParam(ParamWidget::create<LEDButton>(Vec(6, 290), module, ComputerscareDebug::MANUAL_TRIGGER, 0.0, 1.0, 0.0));
+ addInput(Port::create<InPort>(Vec(33, 290), Port::INPUT, module, ComputerscareDebug::FORWARD_INPUT));
+ addParam(ParamWidget::create<LEDButton>(Vec(33, 280), module, ComputerscareDebug::MANUAL_FORWARD_TRIGGER, 0.0, 1.0, 0.0));
+
addParam(ParamWidget::create<LEDButton>(Vec(66, 290), module, ComputerscareDebug::MANUAL_CLEAR_TRIGGER, 0.0, 1.0, 0.0));
+
StringDisplayWidget3 *display = new StringDisplayWidget3();
display->box.pos = Vec(1,24);
display->box.size = Vec(48, 250);