Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: main.cpp
- Revision:
- 42:c4e9c1116af4
- Parent:
- 40:ee217eff826c
- Child:
- 44:46e25fa1669b
--- a/main.cpp Wed Mar 26 10:04:01 2014 +0000 +++ b/main.cpp Fri Mar 28 10:18:38 2014 +0000 @@ -195,18 +195,27 @@ // Potentiometer, switches, etc: //(1) Check for change of threshold mode button (switch one): - //!!! ATTENTION: this does not work very well to say the truth: bouncing+adc settings problems... - bool stateswitch; - if (IO.switchOneCheck(stateswitch)) { - if (stateswitch) pc.printf("Setting AUTO threshold mode\n"); else pc.printf("Setting FIXED threshold mode\n"); - for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setThresholdMode((stateswitch? 1 : 0)); - } + //!!! ATTENTION: this does not work very well to say the truth: bouncing+adc settings problems... better use a TWO STATE SWITCH: + bool stateswitch; + // if (IO.switchOneCheck(stateswitch)) { + //if (stateswitch) pc.printf("Setting AUTO threshold mode\n"); else pc.printf("Setting FIXED threshold mode\n"); + // for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setThresholdMode((stateswitch? 1 : 0)); + // } + if (IO.twoStateSwitchCheck(stateswitch)) { // if there is a change... + for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setThresholdMode((stateswitch? 1 : 0)); + } + //(2) in case the the second switch was pressed, check the current pot value and update the fixed threshold (regardless of the threshold mode) - if (IO.switchTwoCheck(stateswitch)) { - IO.updatePotValue(); - for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setFixedThreshold(IO.potValue); - pc.printf("Got :%d\n", IO.potValue); - } + // NOTE: using the potentiometer FAILS because I cannot properly switch back and forth between ADC modes (burst and normal) + //if (IO.switchTwoCheck(stateswitch)) { + // IO.updatePotValue(); + // for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setFixedThreshold(IO.potValue); + // pc.printf("Got :%d\n", IO.potValue); + // } + if (rotaryEncoder1.CheckNew()) for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setFixedThreshold(rotaryEncoder1.Get()); + + // (3) Change additional mirror delay from rotary encoder: + if (rotaryEncoder2.CheckNew()) for (int i=0; i< blobconf.numBlobs; i++) blobconf.blobArray[i]->displaySensingBuffer.setDelayMirrors(rotaryEncoder2.Get()); // text: