@@ -22,7 +22,7 @@ PROGRAMME FUNCTION: EVI Wind Controller using the Freescale MP3V5004GP breath
2222
2323// Compile options, comment/uncomment to change
2424
25- #define FIRMWARE_VERSION " 1.2.8 " // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
25+ #define FIRMWARE_VERSION " 1.2.9 " // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
2626
2727#define REVB
2828
@@ -633,9 +633,8 @@ void setup() {
633633 writeSetting (VIB_SQUELCH_ADDR,VIB_SQUELCH_FACTORY);
634634 writeSetting (VIB_DIRECTION_ADDR,VIB_DIRECTION_FACTORY);
635635
636- // Set threshold/max sensor values only if upgrading from something before version 24
637- // In other cases, these values are saved between factory resets
638- if (readSetting (VERSION_ADDR) < 24 ) {
636+ // if stored settings are not for current version, or Enter+Menu are pressed at startup, they are replaced by factory settings
637+ if (((readSetting (VERSION_ADDR) != VERSION) && (readSetting (VERSION_ADDR) < 24 )) || (!digitalRead (ePin) && !digitalRead (mPin ))){
639638 writeSetting (VERSION_ADDR,VERSION);
640639 writeSetting (BREATH_THR_ADDR,BREATH_THR_FACTORY);
641640 writeSetting (BREATH_MAX_ADDR,BREATH_MAX_FACTORY);
@@ -648,6 +647,7 @@ void setup() {
648647 writeSetting (CTOUCH_THR_ADDR,CTOUCH_THR_FACTORY);
649648 }
650649 }
650+
651651 // read settings from EEPROM
652652 breathThrVal = readSetting (BREATH_THR_ADDR);
653653 breathMaxVal = readSetting (BREATH_MAX_ADDR);
@@ -1501,14 +1501,31 @@ void pitch_bend(){
15011501 vibThr=vibZero-vibSquelch;
15021502 vibThrLo=vibZero+vibSquelch;
15031503
1504+ int pbPos = map (constrain (pbUp,pitchbThrVal,pitchbMaxVal),pitchbThrVal,pitchbMaxVal,0 ,calculatedPBdepth);
1505+ int pbNeg = map (constrain (pbDn,pitchbThrVal,pitchbMaxVal),pitchbThrVal,pitchbMaxVal,0 ,calculatedPBdepth);
1506+ int pbSum = 8193 + pbPos - pbNeg;
1507+ int pbDif = abs (pbPos - pbNeg);
1508+
1509+ /*
15041510 if ((pbUp > pitchbThrVal) && PBdepth){
15051511 pitchBend=pitchBend*0.6+0.4*map(constrain(pbUp,pitchbThrVal,pitchbMaxVal),pitchbThrVal,pitchbMaxVal,8192,(8193 + calculatedPBdepth));
1506- pbTouched = 1 ;
1512+ pbTouched++ ;
15071513 }
15081514 if ((pbDn > pitchbThrVal) && PBdepth){
15091515 pitchBend=pitchBend*0.6+0.4*map(constrain(pbDn,pitchbThrVal,pitchbMaxVal),pitchbThrVal,pitchbMaxVal,8192,(8192 - calculatedPBdepth));
1510- pbTouched = 1 ;
1516+ pbTouched++ ;
15111517 }
1518+ */
1519+
1520+ if (((pbUp > pitchbThrVal) && PBdepth) || ((pbDn > pitchbThrVal) && PBdepth)){
1521+ if (pbDif < 10 ){
1522+ pitchBend = 8192 ;
1523+ } else {
1524+ pitchBend=pitchBend*0.6 +0.4 *pbSum;
1525+ }
1526+ pbTouched = 1 ;
1527+ }
1528+
15121529 if (!pbTouched) {
15131530 pitchBend = pitchBend*0.6 +8192 *0.4 ; // released, so smooth your way back to zero
15141531 if ((pitchBend > 8187 ) && (pitchBend < 8197 )) pitchBend = 8192 ; // 8192 is 0 pitch bend, don't miss it bc of smoothing
@@ -3364,7 +3381,7 @@ void menu() {
33643381 // down
33653382 plotVelSmpDl (BLACK);
33663383 if (velSmpDl > 0 ){
3367- velSmpDl-=5 ;
3384+ velSmpDl-=1 ;
33683385 } else velSmpDl = 30 ;
33693386 plotVelSmpDl (WHITE);
33703387 cursorNow = BLACK;
@@ -3383,7 +3400,7 @@ void menu() {
33833400 // up
33843401 plotVelSmpDl (BLACK);
33853402 if (velSmpDl < 30 ){
3386- velSmpDl+=5 ;
3403+ velSmpDl+=1 ;
33873404 } else velSmpDl = 0 ;
33883405 plotVelSmpDl (WHITE);
33893406 cursorNow = BLACK;
@@ -3667,7 +3684,7 @@ void menu() {
36673684 // down
36683685 if (deglitch > 0 ){
36693686 plotDeglitch (BLACK);
3670- deglitch-=5 ;
3687+ deglitch-=1 ;
36713688 plotDeglitch (WHITE);
36723689 cursorNow = BLACK;
36733690 display.display ();
@@ -3686,7 +3703,7 @@ void menu() {
36863703 // up
36873704 if (deglitch < 70 ){
36883705 plotDeglitch (BLACK);
3689- deglitch+=5 ;
3706+ deglitch+=1 ;
36903707 plotDeglitch (WHITE);
36913708 cursorNow = BLACK;
36923709 display.display ();
0 commit comments