Skip to content

Commit

Permalink
keep detected stuck notes
Browse files Browse the repository at this point in the history
  • Loading branch information
pierstitus committed Nov 7, 2021
1 parent 469c693 commit 9937f3d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
- Transpose reset with settings+up+down buttons
- Irregular tuning support, JI 7-limit on settings + A#3

### Changed
- Keep stuck notes forever. They were allowed to come back, which they often did.
This is now changed, so if a note is detected as stuck it doesn't come back (e.g. when a key is held down during start up)

### Fixed
- Correctly lower message frequency when multiple keys are pressed (was too low in some cases)

Expand Down
6 changes: 5 additions & 1 deletion button_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,11 @@ void update_button(button_t* but) {
but->zero_time++;
if (but->zero_time > ZERO_LEVEL_TIME) {
but->zero_time = 0;
#ifdef DETECT_STUCK_NOTES_DECREASE
but->zero_offset = but->zero_max * ZERO_LEVEL_FACT;
#else
but->zero_offset = max(but->zero_offset, but->zero_max * ZERO_LEVEL_FACT);
#endif
}
} else {
but->zero_time = 0;
Expand Down Expand Up @@ -753,7 +757,7 @@ void update_button(button_t* but) {
but->zero_time = 0;
} else {
but->p = 0;
#ifdef DETECT_STUCK_NOTES
#ifdef DETECT_STUCK_NOTES_DECREASE
but->zero_time++;
if (but->zero_time == ZERO_LEVEL_TIME) {
but->zero_offset = 0;
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

// #define CALIBRATION_MODE TRUE // don't linearize or calibrate sensor data
#define DETECT_STUCK_NOTES // zero level detection
// #define DETECT_STUCK_NOTES_DECREASE // zero level detection, allow notes to come back
// #define BREAKPOINT_CALIBRATION // button sensitivity correction using a breakpoint fit

#define CALIB_FORCE ((1<<18)/64 + 1) // +1 to signify hardware revision, 1k adc pull up resistors
Expand Down

0 comments on commit 9937f3d

Please sign in to comment.