Remove hysteresis (smoothing handles noise); values now step ±1 per update
This commit is contained in:
@@ -24,7 +24,6 @@ private:
|
||||
uint8_t midi_channel;
|
||||
uint8_t midi_cc;
|
||||
|
||||
static const uint8_t HYSTERESIS = 3;
|
||||
static const uint16_t READ_INTERVAL_MS = 5;
|
||||
uint32_t last_read_time;
|
||||
|
||||
|
||||
@@ -38,12 +38,7 @@ void ExpressionPedal::update(UsbMidiTransport& midi) {
|
||||
current_raw = analogRead(adc_pin);
|
||||
smoothed_raw = (smoothed_raw * 7 + current_raw + 4) / 8;
|
||||
uint8_t new_value = adc_to_midi(smoothed_raw);
|
||||
|
||||
if (new_value > current_value + HYSTERESIS ||
|
||||
new_value + HYSTERESIS < current_value ||
|
||||
(new_value != current_value && (new_value == 0 || new_value == 127))) {
|
||||
current_value = new_value;
|
||||
}
|
||||
|
||||
if (current_value != last_sent_value) {
|
||||
last_sent_value = current_value;
|
||||
|
||||
Reference in New Issue
Block a user