Remove hysteresis (smoothing handles noise); values now step ±1 per update

This commit is contained in:
ash
2026-07-04 05:11:47 +00:00
parent 4f58d4b8e6
commit 17def39f93
2 changed files with 1 additions and 7 deletions
-1
View File
@@ -24,7 +24,6 @@ private:
uint8_t midi_channel; uint8_t midi_channel;
uint8_t midi_cc; uint8_t midi_cc;
static const uint8_t HYSTERESIS = 3;
static const uint16_t READ_INTERVAL_MS = 5; static const uint16_t READ_INTERVAL_MS = 5;
uint32_t last_read_time; uint32_t last_read_time;
+1 -6
View File
@@ -38,12 +38,7 @@ void ExpressionPedal::update(UsbMidiTransport& midi) {
current_raw = analogRead(adc_pin); current_raw = analogRead(adc_pin);
smoothed_raw = (smoothed_raw * 7 + current_raw + 4) / 8; smoothed_raw = (smoothed_raw * 7 + current_raw + 4) / 8;
uint8_t new_value = adc_to_midi(smoothed_raw); uint8_t new_value = adc_to_midi(smoothed_raw);
current_value = new_value;
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) { if (current_value != last_sent_value) {
last_sent_value = current_value; last_sent_value = current_value;