Minor change for previous filter bug fix

This commit is contained in:
whowechina
2025-02-03 15:10:11 +08:00
parent 64d019053c
commit c094ecc03b
3 changed files with 5 additions and 9 deletions
+3 -3
View File
@@ -328,10 +328,10 @@ static void handle_ir(int argc, char *argv[])
static void handle_filter(int argc, char *argv[])
{
const char *usage = "Usage: filter <first> <second> [interval]\n"
"Adjusts MPR121 noise filtering parameters. See datasheets for more details.\n"
"Adjusts MPR121 noise filtering parameters (see datasheets).\n"
" first: First Filter Iterations (FFI) [0..3]\n"
" second: Second Filter Iterations (SFI) [0..3]\n"
" interval: Electode Sample Interval (ESI) [0..7]\n";
" interval: Electrode Sample Interval (ESI) [0..7]\n";
if ((argc < 2) || (argc > 3)) {
printf(usage);
return;
@@ -349,7 +349,7 @@ static void handle_filter(int argc, char *argv[])
printf(usage);
return;
}
chu_cfg->sense.filter = (uint8_t)((ffi << 6) | (sfi << 4) | intv );
chu_cfg->sense.filter = (ffi << 6) | (sfi << 4) | intv;
slider_update_config();
config_changed();
disp_sense();
+1 -5
View File
@@ -61,11 +61,7 @@ static void config_loaded()
chu_cfg->tof = default_cfg.tof;
config_changed();
}
if (
((chu_cfg->sense.filter & 0x07) > 7) ||
((chu_cfg->sense.filter >> 6) > 3) ||
(((chu_cfg->sense.filter >> 4) & 0x03) > 3)
) {
if ((chu_cfg->sense.filter & 0x07) > 7) {
chu_cfg->sense.filter = default_cfg.sense.filter;
config_changed();
}
+1 -1
View File
@@ -28,7 +28,7 @@ typedef struct __attribute__((packed)) {
uint8_t pitch;
} tof;
struct {
uint8_t filter;
uint8_t filter; // FFI[6..7], SFI[4..5], ESI[0..3]
int8_t global;
uint8_t debounce_touch;
uint8_t debounce_release;