Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
honjow committed May 18, 2024
1 parent 1001f67 commit b756b84
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
15 changes: 8 additions & 7 deletions backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_all_howmon_fans():
return fans_confs


def get_device_ec_fans(product_name, product_version):
def get_device_ec_fans(p_name, p_version):
with open(EC_SCHEMA, "r") as f:
ec_schema = json.load(f)

Expand Down Expand Up @@ -199,20 +199,21 @@ def get_device_ec_fans(product_name, product_version):
confs_with_name = []

# 通过产品名获得所有配置,然后分成带版本号和不带版本号的配置
for conf in FAN_EC_CONFIG_MAP.get(product_name, []):
for conf in FAN_EC_CONFIG_MAP.get(p_name, []):
logging.info(f"conf of {p_name}: {conf}")
if (
product_version in conf["product_version"]
and data["product_version"] != None
and isinstance(data["product_version"], list)
and len(data["product_version"]) > 0
p_version in conf["product_version"]
and conf["product_version"] != None
and isinstance(conf["product_version"], list)
and len(conf["product_version"]) > 0
):
confs_with_name_version.append(conf)
else:
confs_with_name.append(conf)

# 优先匹配带版本号的配置
for conf in confs_with_name_version:
if product_version in conf["product_version"]:
if p_version in conf["product_version"]:
return conf["fans"]
# 其次匹配不带版本号的配置 (如果有)
for conf in confs_with_name:
Expand Down
5 changes: 3 additions & 2 deletions backend/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,8 @@ def set_fanAuto(self, index: int, value: bool):
fc = self.fan_config_list[index]

# HWMON 写入
self.__set_fanAuto_HWMON(fc, value)
if fc.is_found_hwmon:
self.__set_fanAuto_HWMON(fc, value)

# ECRAM 写入
if fc.ram_manual_offset:
Expand Down Expand Up @@ -841,7 +842,7 @@ def __set_fanAuto_ECRAM(self, fc: FanConfig, value: bool):
return False
fanIsManual = auto_value if value else manual_value
EC.RamWrite(reg_addr, reg_data, manual_offset, fanIsManual)
logging.info(
logging.debug(
f"写入ECRAM数据 写入EC地址:{hex(manual_offset)} 写入风扇是否控制:{fanIsManual}"
)
return True
Expand Down
1 change: 0 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from fan import fanManager
from sysInfo import sysInfoManager
import update

except Exception as e:
# 堆栈跟踪
logging.error(traceback.format_exc())
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "PowerControl",
"version": "2.5.6",
"version": "2.5.7",
"description": "PowerControl plugin.",
"scripts": {
"build": "shx rm -rf dist && rollup -c",
Expand Down

0 comments on commit b756b84

Please sign in to comment.