Skip to content

Commit b5f577e

Browse files
author
mars
committed
changed to 50% duty cycle
1 parent 1fede7b commit b5f577e

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

firmware/Source/TapTempo.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ class TapTempo {
115115
bool on;
116116
public:
117117
uint16_t speed;
118-
TapTempo() : counter(0), goLow(TRIGGER_LIMIT>>2), goHigh(TRIGGER_LIMIT>>2),
119-
trig(TRIGGER_LIMIT), isHigh(false), on(false), speed(4095) {}
118+
TapTempo() : counter(0), goLow(TRIGGER_LIMIT>>2), goHigh(TRIGGER_LIMIT>>1),
119+
trig(0), isHigh(false), on(false), speed(4095) {}
120120
void reset(){
121121
counter = 0;
122122
setLow();
@@ -128,22 +128,23 @@ class TapTempo {
128128
if(high){
129129
setHigh();
130130
goHigh = trig;
131+
goLow = trig>>1;
131132
counter = 0;
132133
trig = 0;
133134
}else{
134135
setLow();
135-
goLow = trig;
136136
}
137137
}else if(high){
138138
trig = 0;
139139
}
140140
}
141141
void setSpeed(int16_t s){
142142
if(abs(speed-s) > 16){
143-
int64_t delta = (int64_t)goLow*(speed-s)/2048;
144-
goLow = max(1, goLow+delta);
145-
delta = (int64_t)goHigh*(speed-s)/2048;
143+
// int64_t delta = (int64_t)goLow*(speed-s)/2048;
144+
// goLow = max(1, goLow+delta);
145+
int64_t delta = (int64_t)goHigh*(speed-s)/2048;
146146
goHigh = max(1, goHigh+delta);
147+
goLow = goHigh >> 1;
147148
speed = s;
148149
}
149150
}

firmware/common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ELF=$(BUILD)/TapTempo.elf
33
BIN=$(BUILD)/TapTempo.bin
44

55
# Tool path
6-
TOOLROOT=~/devel/OwlWare/Tools/gcc-arm-none-eabi-4_8-2014q2/bin
6+
TOOLROOT=~/devel/OwlWare/Tools/gcc-arm-none-eabi-5_2-2015q4/bin
77
STLINK=~/devel/stlink/
88

99
# Tools

0 commit comments

Comments
 (0)