Fix a bug in "lf config"

When executing "lf config --reset", the averaging will be 0 rather than 1(default).
This is because the config.averaging is set to 1 at first.(line 621)
Then this argument is overwritten unconditionally by
"config.averaging = (avg == 1);"(line 634)
This commit is contained in:
wh201906 2022-04-08 19:50:38 +08:00 committed by GitHub
parent aec3ff64e2
commit 4a8f425379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -631,7 +631,9 @@ int CmdLFConfig(const char *Cmd) {
if (use_134)
config.divisor = LF_DIVISOR_134;
config.averaging = (avg == 1);
// check if the config.averaging is not set by if(reset){...}
if (config.averaging == -1)
config.averaging = (avg == 1);
if (bps > -1) {
// bps is limited to 8