mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
mute false-positive underpower on cm4-based (v4) devices
This commit is contained in:
parent
7900a243a2
commit
cec03c4468
@ -10,6 +10,8 @@ kvmd:
|
|||||||
auth: !include auth.yaml
|
auth: !include auth.yaml
|
||||||
|
|
||||||
info:
|
info:
|
||||||
|
hw:
|
||||||
|
ignore_past: true
|
||||||
fan:
|
fan:
|
||||||
unix: /run/kvmd/fan.sock
|
unix: /run/kvmd/fan.sock
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,8 @@ kvmd:
|
|||||||
auth: !include auth.yaml
|
auth: !include auth.yaml
|
||||||
|
|
||||||
info:
|
info:
|
||||||
|
hw:
|
||||||
|
ignore_past: true
|
||||||
fan:
|
fan:
|
||||||
unix: /run/kvmd/fan.sock
|
unix: /run/kvmd/fan.sock
|
||||||
|
|
||||||
|
|||||||
@ -383,6 +383,7 @@ def _get_config_scheme() -> dict:
|
|||||||
"extras": Option("/usr/share/kvmd/extras", type=valid_abs_dir),
|
"extras": Option("/usr/share/kvmd/extras", type=valid_abs_dir),
|
||||||
"hw": {
|
"hw": {
|
||||||
"vcgencmd_cmd": Option(["/opt/vc/bin/vcgencmd"], type=valid_command),
|
"vcgencmd_cmd": Option(["/opt/vc/bin/vcgencmd"], type=valid_command),
|
||||||
|
"ignore_past": Option(False, type=valid_bool),
|
||||||
"state_poll": Option(10.0, type=valid_float_f01),
|
"state_poll": Option(10.0, type=valid_float_f01),
|
||||||
},
|
},
|
||||||
"fan": {
|
"fan": {
|
||||||
|
|||||||
@ -46,10 +46,12 @@ class HwInfoSubmanager(BaseInfoSubmanager):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
vcgencmd_cmd: list[str],
|
vcgencmd_cmd: list[str],
|
||||||
|
ignore_past: bool,
|
||||||
state_poll: float,
|
state_poll: float,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
self.__vcgencmd_cmd = vcgencmd_cmd
|
self.__vcgencmd_cmd = vcgencmd_cmd
|
||||||
|
self.__ignore_past = ignore_past
|
||||||
self.__state_poll = state_poll
|
self.__state_poll = state_poll
|
||||||
|
|
||||||
self.__dt_cache: dict[str, str] = {}
|
self.__dt_cache: dict[str, str] = {}
|
||||||
@ -127,6 +129,7 @@ class HwInfoSubmanager(BaseInfoSubmanager):
|
|||||||
"past": bool(flags & (1 << 18)),
|
"past": bool(flags & (1 << 18)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"ignore_past": self.__ignore_past,
|
||||||
}
|
}
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -91,8 +91,9 @@ export function Session() {
|
|||||||
var __setAboutInfoHw = function(state) {
|
var __setAboutInfoHw = function(state) {
|
||||||
if (state.health.throttling !== null) {
|
if (state.health.throttling !== null) {
|
||||||
let flags = state.health.throttling.parsed_flags;
|
let flags = state.health.throttling.parsed_flags;
|
||||||
let undervoltage = (flags.undervoltage.now || flags.undervoltage.past);
|
let ignore_past = state.health.throttling.ignore_past;
|
||||||
let freq_capped = (flags.freq_capped.now || flags.freq_capped.past);
|
let undervoltage = (flags.undervoltage.now || (flags.undervoltage.past && !ignore_past));
|
||||||
|
let freq_capped = (flags.freq_capped.now || (flags.freq_capped.past && !ignore_past));
|
||||||
|
|
||||||
tools.hidden.setVisible($("hw-health-dropdown"), (undervoltage || freq_capped));
|
tools.hidden.setVisible($("hw-health-dropdown"), (undervoltage || freq_capped));
|
||||||
$("hw-health-undervoltage-led").className = (undervoltage ? (flags.undervoltage.now ? "led-red" : "led-yellow") : "hidden");
|
$("hw-health-undervoltage-led").className = (undervoltage ? (flags.undervoltage.now ? "led-red" : "led-yellow") : "hidden");
|
||||||
@ -188,12 +189,12 @@ export function Session() {
|
|||||||
let pairs = [];
|
let pairs = [];
|
||||||
for (let field of Object.keys(throttling.parsed_flags).sort()) {
|
for (let field of Object.keys(throttling.parsed_flags).sort()) {
|
||||||
let flags = throttling.parsed_flags[field];
|
let flags = throttling.parsed_flags[field];
|
||||||
pairs.push([
|
let key = tools.upperFirst(field).replace("_", " ");
|
||||||
tools.upperFirst(field).replace("_", " "),
|
let value = (flags["now"] ? __colored("red", "RIGHT NOW") : __colored("green", "No"));
|
||||||
(flags["now"] ? __colored("red", "RIGHT NOW") : __colored("green", "No"))
|
if (!throttling.ignore_past) {
|
||||||
+ "; " +
|
value += "; " + (flags["past"] ? __colored("red", "In the past") : __colored("green", "Never"));
|
||||||
(flags["past"] ? __colored("red", "In the past") : __colored("green", "Never")),
|
}
|
||||||
]);
|
pairs.push([key, value]);
|
||||||
}
|
}
|
||||||
return __formatUl(pairs);
|
return __formatUl(pairs);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user