From 57ea602b5a0bdbc79c1fdd909446cf93d41f596e Mon Sep 17 00:00:00 2001 From: xyqyear Date: Thu, 14 Sep 2023 20:14:28 +0800 Subject: [PATCH 1/6] lower clock for better resistence to noise --- maimaiTouchControl.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maimaiTouchControl.ino b/maimaiTouchControl.ino index 168e28b..25dbba6 100644 --- a/maimaiTouchControl.ino +++ b/maimaiTouchControl.ino @@ -30,7 +30,7 @@ void setup() mpr[1].begin(0x5B, &Wire); mpr[2].begin(0x5C, &Wire); mpr[3].begin(0x5D, &Wire); - Wire.setClock(400000); + Wire.setClock(100000); // config conversion From a5e0353a57cd4506b436a59f60ad8acb33a0f465 Mon Sep 17 00:00:00 2001 From: xyqyear Date: Thu, 2 Nov 2023 12:02:21 +0800 Subject: [PATCH 2/6] change filtering settings, change threashold --- config.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/config.h b/config.h index 7523704..5c4b8e2 100644 --- a/config.h +++ b/config.h @@ -7,18 +7,18 @@ public: }; const uint8_t MPR_PADNUMS[] = {8, 9, 9, 8}; -const uint8_t THREASHOLD = 35; +const uint8_t THREASHOLD = 25; touchblock touchmap[34] = { // Group A - {3, 4, 0}, // 1 - {3, 0, 0}, // 2 - {2, 4, 0}, // 3 - {2, 0, 0}, // 4 - {1, 5, 0}, // 5 - {1, 0, 0}, // 6 - {0, 4, 0}, // 7 - {0, 0, 0}, // 8 + {3, 4, -5}, // 1 + {3, 0, -5}, // 2 + {2, 4, -5}, // 3 + {2, 0, -5}, // 4 + {1, 5, -5}, // 5 + {1, 0, -5}, // 6 + {0, 4, -5}, // 7 + {0, 0, -5}, // 8 // Group B {3, 5, 0}, // 1 {3, 1, 0}, // 2 @@ -77,14 +77,14 @@ const uint8_t RELEASE_THREASHOLD_OFFSET = 0; // rising NCL being smaller than falling NCL is because of the same reason // the user can experiment with different values to find the best one // but those values should be good for most cases -const uint8_t MHDR = 2; -const uint8_t NHDR = 2; -const uint8_t NCLR = 4; +const uint8_t MHDR = 1; +const uint8_t NHDR = 1; +const uint8_t NCLR = 0; const uint8_t FDLR = 0; -const uint8_t MHDF = 2; +const uint8_t MHDF = 1; const uint8_t NHDF = 1; -const uint8_t NCLF = 32; -const uint8_t FDLF = 4; +const uint8_t NCLF = 255; +const uint8_t FDLF = 2; // range: 0 - 3 // 0: 6 samples From 802cbe6e7ec8b55ffe8986042770b70bf24883f9 Mon Sep 17 00:00:00 2001 From: xyqyear Date: Thu, 2 Nov 2023 12:06:16 +0800 Subject: [PATCH 3/6] change threashold --- config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.h b/config.h index 5c4b8e2..418cb37 100644 --- a/config.h +++ b/config.h @@ -7,7 +7,7 @@ public: }; const uint8_t MPR_PADNUMS[] = {8, 9, 9, 8}; -const uint8_t THREASHOLD = 25; +const uint8_t THREASHOLD = 32; touchblock touchmap[34] = { // Group A From fa927b2fcf3e2b92548cde7d145b0b28b3fe3892 Mon Sep 17 00:00:00 2001 From: xyqyear Date: Thu, 2 Nov 2023 12:06:26 +0800 Subject: [PATCH 4/6] change group a threashold --- config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config.h b/config.h index 418cb37..b5703bb 100644 --- a/config.h +++ b/config.h @@ -11,14 +11,14 @@ const uint8_t THREASHOLD = 32; touchblock touchmap[34] = { // Group A - {3, 4, -5}, // 1 - {3, 0, -5}, // 2 - {2, 4, -5}, // 3 - {2, 0, -5}, // 4 - {1, 5, -5}, // 5 - {1, 0, -5}, // 6 - {0, 4, -5}, // 7 - {0, 0, -5}, // 8 + {3, 4, -3}, // 1 + {3, 0, -3}, // 2 + {2, 4, -3}, // 3 + {2, 0, -3}, // 4 + {1, 5, -3}, // 5 + {1, 0, -3}, // 6 + {0, 4, -3}, // 7 + {0, 0, -3}, // 8 // Group B {3, 5, 0}, // 1 {3, 1, 0}, // 2 From abe3530ee8074aa5798be484fe56be45c51909d7 Mon Sep 17 00:00:00 2001 From: xyqyear Date: Thu, 2 Nov 2023 19:56:18 +0800 Subject: [PATCH 5/6] revert filter changes --- config.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index b5703bb..914c229 100644 --- a/config.h +++ b/config.h @@ -77,14 +77,14 @@ const uint8_t RELEASE_THREASHOLD_OFFSET = 0; // rising NCL being smaller than falling NCL is because of the same reason // the user can experiment with different values to find the best one // but those values should be good for most cases -const uint8_t MHDR = 1; -const uint8_t NHDR = 1; -const uint8_t NCLR = 0; +const uint8_t MHDR = 2; +const uint8_t NHDR = 2; +const uint8_t NCLR = 4; const uint8_t FDLR = 0; -const uint8_t MHDF = 1; +const uint8_t MHDF = 2; const uint8_t NHDF = 1; -const uint8_t NCLF = 255; -const uint8_t FDLF = 2; +const uint8_t NCLF = 32; +const uint8_t FDLF = 4; // range: 0 - 3 // 0: 6 samples From 9076898b2bca679c80e150c5704b3744857bcf39 Mon Sep 17 00:00:00 2001 From: xyqyear Date: Fri, 1 Dec 2023 11:16:38 +0800 Subject: [PATCH 6/6] provide a set of alternative values for baseline tracking disable release debounce to make touch notes more easier, but it might make hold notes miss a tick or two. I think it's worth it. --- config.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/config.h b/config.h index 914c229..b60f10a 100644 --- a/config.h +++ b/config.h @@ -72,6 +72,16 @@ const uint8_t RELEASE_THREASHOLD_OFFSET = 0; // NHDF = 1 // NCLF = 16 // FDLF = 4 +// if some regions get stuck easily, you can try the following values +// to make the system more sensitive to environmental changes +// MHDR = 2; +// NHDR = 2; +// NCLR = 4; +// FDLR = 0; +// MHDF = 4; +// NHDF = 2; +// NCLF = 16; +// FDLF = 2; // rising NHD is larger than falling NHD because rising is the release direction // the rising changes are more likely to be environmental changes // rising NCL being smaller than falling NCL is because of the same reason @@ -125,7 +135,7 @@ const uint8_t ELECTRODE_SAMPLE_INTERVAL = 0; // this smoothes out the signal and prevents false release // however, a debounce value that's too high might cause releases that are too short to be missed // if the user notices too many false releases, try to increase this value. but don't set it too high -const uint8_t RELEASE_DEBOUNCE = 1; +const uint8_t RELEASE_DEBOUNCE = 0; // range: 0 - 7 // when DT + 1 samples are higher than the threshold, the electrode is touched