commit 4d21ce80a726dc847c6d781c19da7199c0a8adc5
parent a0003d37a67cf22b69a3e7859f519f62fe244e2e
Author: Adam M <aemalone@gmail.com>
Date: Wed, 11 Jul 2018 20:26:42 +0300
external input to router
Diffstat:
5 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/build/src/ComputerscareDebug.cpp.o b/build/src/ComputerscareDebug.cpp.o
Binary files differ.
diff --git a/build/src/ComputerscareRouter.cpp.o b/build/src/ComputerscareRouter.cpp.o
Binary files differ.
diff --git a/res/ComputerscareRouter.svg b/res/ComputerscareRouter.svg
@@ -34,11 +34,11 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1.4142136"
- inkscape:cx="64.663598"
- inkscape:cy="196.06315"
+ inkscape:zoom="5.6568543"
+ inkscape:cx="177.80068"
+ inkscape:cy="-30.211024"
inkscape:document-units="mm"
- inkscape:current-layer="g1669"
+ inkscape:current-layer="text1651"
showgrid="false"
units="px"
inkscape:snap-bbox="true"
@@ -75,7 +75,7 @@
style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.88743967;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal" />
<g
aria-label="computerscare"
- transform="rotate(1.4468834,6.0854166,481.93263)"
+ transform="matrix(0.98163942,0.10786689,-0.19074603,0.99774398,91.993356,-1.5135239)"
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
id="text1651">
<path
@@ -119,13 +119,13 @@
id="path1715"
inkscape:connector-curvature="0" />
<path
- d="m 23.185447,294.16269 -0.03488,0.23723 q -0.09833,-0.0702 -0.208837,-0.11429 -0.110508,-0.0442 -0.233212,-0.0622 -0.186783,-0.0275 -0.289279,0.016 -0.101136,0.0437 -0.117973,0.15816 -0.01283,0.0873 0.04655,0.14753 0.05959,0.0589 0.254751,0.13358 l 0.08309,0.0317 q 0.258799,0.0966 0.355164,0.21797 0.09793,0.12025 0.07046,0.30705 -0.03127,0.21268 -0.218575,0.31189 -0.185938,0.0994 -0.480428,0.0561 -0.122703,-0.018 -0.252707,-0.0622 -0.128844,-0.0426 -0.269062,-0.11204 l 0.03809,-0.25904 q 0.128445,0.0927 0.258001,0.14937 0.129765,0.0553 0.262013,0.0747 0.17724,0.0261 0.281492,-0.0199 0.104454,-0.0473 0.120693,-0.15775 0.01504,-0.10226 -0.04648,-0.16702 -0.06015,-0.0645 -0.285871,-0.14928 l -0.08424,-0.0333 q -0.225922,-0.0833 -0.314703,-0.19949 -0.08858,-0.11748 -0.06252,-0.29473 0.03167,-0.21541 0.201614,-0.31021 0.169938,-0.0948 0.450794,-0.0535 0.139065,0.0204 0.258757,0.059 0.119693,0.0385 0.217301,0.0946 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
+ d="m 23.25356,293.8228 -0.02684,0.2786 q -0.101113,-0.0845 -0.21355,-0.13854 -0.112441,-0.0541 -0.236222,-0.0777 -0.188425,-0.036 -0.289805,0.0133 -0.100008,0.0495 -0.112966,0.18393 -0.0099,0.10252 0.0518,0.17456 0.06184,0.0705 0.260299,0.16214 l 0.08449,0.0389 q 0.263089,0.11867 0.363992,0.2634 0.102435,0.14343 0.0813,0.36281 -0.02406,0.24977 -0.208649,0.36297 -0.183208,0.11346 -0.480285,0.0568 -0.12378,-0.0235 -0.25579,-0.0781 -0.13079,-0.0526 -0.273921,-0.13705 l 0.02931,-0.30422 q 0.132116,0.11159 0.264105,0.18078 0.132153,0.0676 0.265561,0.093 0.178799,0.0341 0.281855,-0.018 0.103214,-0.0537 0.11571,-0.18339 0.01158,-0.1201 -0.0524,-0.19751 -0.0626,-0.0771 -0.292076,-0.18121 l -0.0857,-0.0408 q -0.229632,-0.10239 -0.322744,-0.24087 -0.09296,-0.14 -0.0729,-0.34816 0.02437,-0.25298 0.191682,-0.36132 0.167306,-0.10834 0.45063,-0.0543 0.140285,0.0267 0.261752,0.0744 0.121464,0.0476 0.221368,0.11553 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.28752509"
id="path1717"
inkscape:connector-curvature="0" />
<path
- d="m 24.683678,294.09303 v 0.23702 q -0.107487,-0.0593 -0.216352,-0.0882 -0.107487,-0.0303 -0.21773,-0.0303 -0.246668,0 -0.383094,0.1571 -0.136426,0.15572 -0.136426,0.43822 0,0.28249 0.136426,0.43959 0.136426,0.15572 0.383094,0.15572 0.110243,0 0.21773,-0.0289 0.108865,-0.0303 0.216352,-0.0896 v 0.23426 q -0.106108,0.0496 -0.220486,0.0744 -0.112999,0.0248 -0.241156,0.0248 -0.348644,0 -0.553972,-0.21911 -0.205327,-0.2191 -0.205327,-0.59117 0,-0.37759 0.206705,-0.59394 0.208084,-0.21635 0.56913,-0.21635 0.117133,0 0.228754,0.0248 0.111622,0.0234 0.216352,0.0717 z"
- style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.26458332"
+ d="m 24.75497,293.7695 0.0082,0.27902 q -0.109929,-0.0719 -0.220195,-0.10797 -0.10893,-0.0377 -0.219584,-0.0398 -0.247586,-0.005 -0.37911,0.1776 -0.131572,0.1807 -0.121844,0.51326 0.0097,0.33255 0.152071,0.52011 0.142296,0.18593 0.389883,0.19065 0.110653,0.002 0.217545,-0.0299 0.108227,-0.0336 0.214072,-0.10133 l 0.0081,0.27577 q -0.104795,0.0564 -0.218745,0.0834 -0.112566,0.027 -0.2412,0.0246 -0.349942,-0.007 -0.563579,-0.26856 -0.213636,-0.26186 -0.226449,-0.69986 -0.013,-0.44451 0.187023,-0.69524 0.201408,-0.2507 0.563798,-0.24378 0.117569,0.002 0.23046,0.0336 0.112843,0.0297 0.219626,0.0886 z"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222223px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start;stroke-width:0.28752509"
id="path1719"
inkscape:connector-curvature="0" />
<path
@@ -146,7 +146,7 @@
</g>
<g
aria-label="router"
- transform="matrix(1.033705,0.06259817,-0.33553856,0.94707474,12.298202,-0.63637663)"
+ transform="matrix(1.033705,0.06259817,-0.33553856,0.94707474,26.05654,-0.63637663)"
style="font-style:normal;font-weight:normal;font-size:6.75034046px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.16875851"
id="text2005">
<path
diff --git a/src/ComputerscareDebug.cpp b/src/ComputerscareDebug.cpp
@@ -11,6 +11,8 @@
struct ComputerscareDebug : Module {
enum ParamIds {
PITCH_PARAM,
+ MANUAL_TRIGGER,
+ MANUAL_CLEAR_TRIGGER,
NUM_PARAMS
};
enum InputIds {
@@ -39,6 +41,8 @@ struct ComputerscareDebug : Module {
SchmittTrigger clockTrigger;
SchmittTrigger clearTrigger;
+ SchmittTrigger manualClockTrigger;
+ SchmittTrigger manualClearTrigger;
ComputerscareDebug() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS) {}
void step() override;
@@ -52,7 +56,7 @@ struct ComputerscareDebug : Module {
void ComputerscareDebug::step() {
std::string thisVal;
- if (clockTrigger.process(inputs[TRG_INPUT].value / 2.f)) {
+ if (clockTrigger.process(inputs[TRG_INPUT].value / 2.f) || manualClockTrigger.process(params[MANUAL_TRIGGER].value)) {
//textField->text = inputs[VAL_INPUT].value;
//std::stringstream ss;
//ss << "Hello, world, " << myInt << niceToSeeYouString;
@@ -77,10 +81,11 @@ void ComputerscareDebug::step() {
//thisVal = std::to_string(inputs[VAL_INPUT].value).substr(0,10);
strValue = thisVal;
}
- if(clearTrigger.process(inputs[CLR_INPUT].value / 2.f)) {
+ if(clearTrigger.process(inputs[CLR_INPUT].value / 2.f) || manualClearTrigger.process(params[MANUAL_CLEAR_TRIGGER].value)) {
strValue = "";
}
+
}
////////////////////////////////////
@@ -132,10 +137,14 @@ struct ComputerscareDebugWidget : ModuleWidget {
//addParam(ParamWidget::create<Davies1900hBlackKnob>(Vec(28, 287), module, ComputerscareDebug::PITCH_PARAM, -3.0, 3.0, 0.0));
- addInput(Port::create<PJ301MPort>(Vec(3, 330), Port::INPUT, module, ComputerscareDebug::TRG_INPUT));
- addInput(Port::create<PJ301MPort>(Vec(33, 330), Port::INPUT, module, ComputerscareDebug::VAL_INPUT));
- addInput(Port::create<PJ301MPort>(Vec(63, 330), Port::INPUT, module, ComputerscareDebug::CLR_INPUT));
+ addInput(Port::create<InPort>(Vec(3, 330), Port::INPUT, module, ComputerscareDebug::TRG_INPUT));
+ 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(3, 290), module, ComputerscareDebug::MANUAL_TRIGGER, 0.0, 1.0, 0.0));
+ addParam(ParamWidget::create<LEDButton>(Vec(63, 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(88, 250);
diff --git a/src/ComputerscareRouter.cpp b/src/ComputerscareRouter.cpp
@@ -11,11 +11,12 @@
struct ComputerscareRouter : Module {
enum ParamIds {
SWITCHES,
- NUM_PARAMS = SWITCHES + 102
+ NUM_PARAMS = SWITCHES + 102
};
enum InputIds {
INPUTS,
- NUM_INPUTS = INPUTS + 10
+ NUM_INPUTS = INPUTS + 10,
+ TRG_INPUT
};
enum OutputIds {
OUTPUTS,
@@ -30,7 +31,7 @@ struct ComputerscareRouter : Module {
SchmittTrigger nextAddressRead;
SchmittTrigger nextAddressEdit;
-
+ SchmittTrigger clockTrigger;
int address = 0;
int editAddress = 0;
@@ -185,7 +186,7 @@ ComputerscareRouter() : Module(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS)
void ComputerscareRouter::step() {
-
+
for ( int i = 0 ; i < 10 ; i++)
{
sums[i] = 0.0;
@@ -205,12 +206,12 @@ void ComputerscareRouter::step() {
}
}
- if(nextAddressEdit.process(params[SWITCHES + 100].value)) {
+ if(nextAddressEdit.process(params[SWITCHES + 100].value) ) {
editAddress = editAddress + 1;
editAddress = editAddress % numAddresses;
}
- if(nextAddressRead.process(params[SWITCHES + 101].value)) {
+ if(nextAddressRead.process(params[SWITCHES + 101].value) || clockTrigger.process(inputs[TRG_INPUT].value / 2.f)) {
address = address + 1;
address = address % numAddresses;
}
@@ -310,6 +311,7 @@ struct ComputerscareRouterWidget : ModuleWidget {
display->box.size = Vec(50, 20);
display->value = &module->address;
addChild(display);
+ addInput(Port::create<InPort>(Vec(20, 40), Port::INPUT, module, ComputerscareRouter::TRG_INPUT));
NumberDisplayWidget3 *displayEdit = new NumberDisplayWidget3();
displayEdit->box.pos = Vec(185,40);