Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d378a484d6 | ||
|
|
64e084ddee | ||
|
|
93bd528430 | ||
|
|
e45e6eaf91 | ||
|
|
e5a6cc2b5e |
+115
-49
@@ -75,6 +75,23 @@ pub fn format_hashrate_ths(ths: f64) -> Option<String> {
|
|||||||
si_mantissa_and_prefix(ths * 1e12).map(|(num, prefix)| format!("{num}{prefix}"))
|
si_mantissa_and_prefix(ths * 1e12).map(|(num, prefix)| format!("{num}{prefix}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A hashrate number (no unit) for a given mining algorithm (round 18 #7). asic-rs
|
||||||
|
/// stores every hashrate normalised to "TH/s", but for Equihash the underlying
|
||||||
|
/// count is Sol/s that it reinterprets through the base H unit, so `ths * 1e12`
|
||||||
|
/// recovers the real Sol/s count. SHA256/Scrypt show the TH/s value directly
|
||||||
|
/// ("33.5"); Equihash shows the Sol/s count with an SI prefix ("167.8K"). Pair
|
||||||
|
/// with [`MinerRow::hashrate_unit`]. `None` for a non-positive reading.
|
||||||
|
pub fn hashrate_num_for(algo: &str, ths: f64) -> Option<String> {
|
||||||
|
if ths <= 0.0 {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
if algo.eq_ignore_ascii_case("equihash") {
|
||||||
|
si_mantissa_and_prefix(ths * 1e12).map(|(num, prefix)| format!("{num}{prefix}"))
|
||||||
|
} else {
|
||||||
|
Some(format!("{ths:.1}"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The actual/expected ratio, or `None` when the expected value is unknown
|
/// The actual/expected ratio, or `None` when the expected value is unknown
|
||||||
/// (<= 0.0) so a ratio-based color/warning never divides by zero or treats an
|
/// (<= 0.0) so a ratio-based color/warning never divides by zero or treats an
|
||||||
/// unknown expectation as a 0% shortfall.
|
/// unknown expectation as a 0% shortfall.
|
||||||
@@ -420,6 +437,10 @@ pub struct MinerRow {
|
|||||||
/// = board 1). Drives the per-board Health tooltip (round 17 R2). Empty when
|
/// = board 1). Drives the per-board Health tooltip (round 17 R2). Empty when
|
||||||
/// the firmware reports no per-board hashrate.
|
/// the firmware reports no per-board hashrate.
|
||||||
pub board_hashrates: Vec<f64>,
|
pub board_hashrates: Vec<f64>,
|
||||||
|
/// Per-hashboard EXPECTED hashrate in TH/s, index-aligned with the hashboards.
|
||||||
|
/// The per-board tooltip shows actual / expected (round 18 #3). Empty when the
|
||||||
|
/// firmware reports no per-board expected hashrate.
|
||||||
|
pub board_expected_hashrates: Vec<f64>,
|
||||||
#[allow(dead_code)] // retained for the "slow" band; not shown as its own column
|
#[allow(dead_code)] // retained for the "slow" band; not shown as its own column
|
||||||
pub efficiency: f64,
|
pub efficiency: f64,
|
||||||
pub power_w: f64,
|
pub power_w: f64,
|
||||||
@@ -516,12 +537,17 @@ impl MinerRow {
|
|||||||
/// live); grey (unknown) otherwise -- asic-rs has no direct PSU-fault flag, so
|
/// live); grey (unknown) otherwise -- asic-rs has no direct PSU-fault flag, so
|
||||||
/// a missing wattage reading is treated as unknown, never a false "down".
|
/// a missing wattage reading is treated as unknown, never a false "down".
|
||||||
pub fn power_health(&self) -> CompHealth {
|
pub fn power_health(&self) -> CompHealth {
|
||||||
// A reported power-supply fault (round 16 #2) is authoritative: red, even
|
// A miner drawing power / spinning its PSU fan / actively mining has a live
|
||||||
// if a residual wattage is still being read.
|
// PSU regardless of any warning flag.
|
||||||
|
let delivering = self.power_w > 0.0 || self.psu_fan_rpm > 0.0 || self.is_mining;
|
||||||
|
// A reported PSU fault while the miner is actually mining is a warning, not
|
||||||
|
// a failure -- yellow, not red (round 18 #2: some WhatsMiners flag a PSU
|
||||||
|
// error while running fine). A fault on a miner that is not mining is a real
|
||||||
|
// failure (red).
|
||||||
if self.faults_for(FaultComponent::Power).next().is_some() {
|
if self.faults_for(FaultComponent::Power).next().is_some() {
|
||||||
return CompHealth::Down;
|
return if self.is_mining { CompHealth::Degraded } else { CompHealth::Down };
|
||||||
}
|
}
|
||||||
if self.power_w > 0.0 || self.psu_fan_rpm > 0.0 || self.is_mining {
|
if delivering {
|
||||||
CompHealth::Ok
|
CompHealth::Ok
|
||||||
} else {
|
} else {
|
||||||
CompHealth::Unreachable
|
CompHealth::Unreachable
|
||||||
@@ -557,12 +583,6 @@ impl MinerRow {
|
|||||||
.filter(|f| f.is_error && matches!(f.component, FaultComponent::Other))
|
.filter(|f| f.is_error && matches!(f.component, FaultComponent::Other))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// True when the miner reports a power-supply fault, which means the
|
|
||||||
/// hashboards cannot be powered or evaluated (round 16 #2).
|
|
||||||
fn power_supply_faulted(&self) -> bool {
|
|
||||||
self.faults_for(FaultComponent::Power).next().is_some()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Per-fan health (round 13 #3), front-to-back / top-to-bottom in the order
|
/// Per-fan health (round 13 #3), front-to-back / top-to-bottom in the order
|
||||||
/// the miner reports its fans. A spinning fan is green, unless it is running
|
/// the miner reports its fans. A spinning fan is green, unless it is running
|
||||||
/// well below its fastest sibling (< 50% of the max reported RPM), which is a
|
/// well below its fastest sibling (< 50% of the max reported RPM), which is a
|
||||||
@@ -621,16 +641,22 @@ impl MinerRow {
|
|||||||
if base.is_empty() {
|
if base.is_empty() {
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
// 3. A PSU fault means no board can be powered/tested -> all grey.
|
// 2. Board-specific faults are authoritative: red the named boards. A board
|
||||||
if self.power_supply_faulted() {
|
// is grey ONLY when it is genuinely not detected (base Missing); a board
|
||||||
return vec![CompHealth::Unreachable; base.len()];
|
// that is running stays green and a faulted board is red, even when the
|
||||||
}
|
// PSU also reports a fault (round 18 #4b -- WhatsMiner codes 540/560 must
|
||||||
// 2. Board-specific faults are authoritative: red only the named boards,
|
// show red, not grey, and boards still hashing during a PSU fault stay
|
||||||
// green the rest (overriding a stall-induced all-red).
|
// green). A whole-miner stall reds every board's base, so exonerate the
|
||||||
|
// boards the fault codes did NOT name back to healthy.
|
||||||
let board_faulted = |i: usize| self.faults_for(FaultComponent::Board(i)).next().is_some();
|
let board_faulted = |i: usize| self.faults_for(FaultComponent::Board(i)).next().is_some();
|
||||||
if (0..base.len()).any(board_faulted) {
|
if (0..base.len()).any(board_faulted) {
|
||||||
for (i, h) in base.iter_mut().enumerate() {
|
for (i, h) in base.iter_mut().enumerate() {
|
||||||
*h = if board_faulted(i) { CompHealth::Down } else { ok };
|
if board_faulted(i) {
|
||||||
|
*h = CompHealth::Down;
|
||||||
|
} else if *h == CompHealth::Down {
|
||||||
|
*h = ok; // stall-reddened but not named by the fault codes
|
||||||
|
}
|
||||||
|
// else keep the base (green Ok / grey Missing).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
base
|
base
|
||||||
@@ -736,22 +762,28 @@ impl MinerRow {
|
|||||||
tips.push(t);
|
tips.push(t);
|
||||||
}
|
}
|
||||||
// Hashboards -- an operating board shows its number (counting DOWN, n-1..0,
|
// Hashboards -- an operating board shows its number (counting DOWN, n-1..0,
|
||||||
// left to right) and hashrate; a faulted board shows its error+code; a
|
// left to right) and actual/expected hashrate; a faulted board shows its
|
||||||
// board the failed PSU left untested shows "unpowered" (round 17 R2,
|
// error+code; a board that is genuinely not detected shows "not detected"
|
||||||
// round 16 #2/#3). No generic "Hashboard N: faulted" prose.
|
// (round 17 R2, round 18 #3 actual/expected + #4b). No generic
|
||||||
|
// "Hashboard N: faulted" prose.
|
||||||
let boards = self.board_healths();
|
let boards = self.board_healths();
|
||||||
let psu_down = self.power_supply_faulted();
|
|
||||||
let n = self.hashboards.map(|v| v as usize).unwrap_or(boards.len());
|
let n = self.hashboards.map(|v| v as usize).unwrap_or(boards.len());
|
||||||
|
let unit = self.hashrate_unit();
|
||||||
for i in 0..max_boards {
|
for i in 0..max_boards {
|
||||||
let fault = self.fault_texts_for(FaultComponent::Board(i));
|
let fault = self.fault_texts_for(FaultComponent::Board(i));
|
||||||
let t = if !fault.is_empty() {
|
let t = if !fault.is_empty() {
|
||||||
fault.join("\n")
|
fault.join("\n")
|
||||||
} else if matches!(boards.get(i), Some(CompHealth::Unreachable)) && psu_down {
|
} else if matches!(boards.get(i), Some(CompHealth::Unreachable)) {
|
||||||
"unpowered (PSU fault)".to_string()
|
"not detected".to_string()
|
||||||
} else if i < n {
|
} else if i < n {
|
||||||
let num = n - 1 - i; // count down, left to right
|
let num = n - 1 - i; // count down, left to right
|
||||||
match self.board_hashrates.get(i).copied() {
|
let actual = self.board_hashrates.get(i).copied().unwrap_or(0.0);
|
||||||
Some(hr) if hr > 0.0 => format!("{num} \u{00b7} {hr:.1} TH/s"),
|
let expected = self.board_expected_hashrates.get(i).copied().unwrap_or(0.0);
|
||||||
|
let a = hashrate_num_for(&self.algorithm, actual);
|
||||||
|
let e = hashrate_num_for(&self.algorithm, expected);
|
||||||
|
match (a, e) {
|
||||||
|
(Some(a), Some(e)) => format!("{num} \u{00b7} {a} / {e} {unit}"),
|
||||||
|
(Some(a), None) => format!("{num} \u{00b7} {a} {unit}"),
|
||||||
_ => num.to_string(),
|
_ => num.to_string(),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -773,6 +805,17 @@ impl MinerRow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The display unit for this miner's hashrate, by mining algorithm (round 18
|
||||||
|
/// #7). SHA256/Scrypt miners report TH/s; Equihash miners (Antminer Z15 /
|
||||||
|
/// Zcash) report in Sol/s and must not be labelled TH/s.
|
||||||
|
pub fn hashrate_unit(&self) -> &'static str {
|
||||||
|
if self.algorithm.eq_ignore_ascii_case("equihash") {
|
||||||
|
"Sol/s"
|
||||||
|
} else {
|
||||||
|
"TH/s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Compact plain-text summary of component health (round 13 #3), used as the
|
/// Compact plain-text summary of component health (round 13 #3), used as the
|
||||||
/// Health column's filter/sort-fallback text and the base of its hover
|
/// Health column's filter/sort-fallback text and the base of its hover
|
||||||
/// tooltip. e.g. "power ok, fans 3/4, boards 3/3".
|
/// tooltip. e.g. "power ok, fans 3/4, boards 3/3".
|
||||||
@@ -1290,20 +1333,14 @@ impl Column {
|
|||||||
Column::Cpu => r.cpu.clone(),
|
Column::Cpu => r.cpu.clone(),
|
||||||
Column::BoardCode => r.board_code.clone(),
|
Column::BoardCode => r.board_code.clone(),
|
||||||
Column::Algorithm => r.algorithm.clone(),
|
Column::Algorithm => r.algorithm.clone(),
|
||||||
Column::Pic => {
|
Column::Pic => match r.pic_present {
|
||||||
// A per-board PIC MCU is an Antminer hashboard property; it has no
|
// A per-board PIC MCU is a known Antminer-hashboard property. Show
|
||||||
// meaning for WhatsMiner or any other make, which show nothing
|
// it only when known; anything unknown (non-Antminer makes, or an
|
||||||
// rather than a "?" that implies an unanswered Antminer question.
|
// Antminer model we can't classify) is blank, never "?" (round 18 #11).
|
||||||
if !r.brand.eq_ignore_ascii_case("antminer") {
|
Some(true) => "PIC".to_string(),
|
||||||
String::new()
|
Some(false) => "noPIC".to_string(),
|
||||||
} else {
|
None => String::new(),
|
||||||
match r.pic_present {
|
},
|
||||||
Some(true) => "PIC".to_string(),
|
|
||||||
Some(false) => "noPIC".to_string(),
|
|
||||||
None => "?".to_string(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column::Locked => match r.write_locked {
|
Column::Locked => match r.write_locked {
|
||||||
Some(true) => "locked".to_string(),
|
Some(true) => "locked".to_string(),
|
||||||
Some(false) => "unlocked".to_string(),
|
Some(false) => "unlocked".to_string(),
|
||||||
@@ -1749,22 +1786,51 @@ mod tests {
|
|||||||
assert!(board_tips[0].contains("Slot 0 error reading chip id."));
|
assert!(board_tips[0].contains("Slot 0 error reading chip id."));
|
||||||
assert!(!board_tips[2].contains("Slot"), "board 3 has no fault text");
|
assert!(!board_tips[2].contains("Slot"), "board 3 has no fault text");
|
||||||
|
|
||||||
// Round 16 #2: a power-supply fault greys every board (they can't be
|
// Round 18 #2/#4b: a PSU fault while the miner is NOT mining is a real
|
||||||
// powered/tested), turns the bolt red, and the PSU message shows on the
|
// failure (red bolt), and boards keep their own reported state -- a PSU
|
||||||
// power tooltip.
|
// fault no longer greys them. Faulted boards stay red.
|
||||||
let psu = MinerRow {
|
let psu = MinerRow {
|
||||||
power_w: 40.0,
|
power_w: 40.0,
|
||||||
board_status: vec![BoardHealth::Fault, BoardHealth::Fault, BoardHealth::Fault],
|
board_status: vec![BoardHealth::Fault, BoardHealth::Fault, BoardHealth::Fault],
|
||||||
expected_fans: Some(2),
|
expected_fans: Some(2),
|
||||||
fan_rpms: vec![6000.0, 6000.0],
|
fan_rpms: vec![6000.0, 6000.0],
|
||||||
faults: vec![fault(FaultComponent::Power, "Power current error.")],
|
faults: vec![fault(FaultComponent::Power, "Power current error.")],
|
||||||
..Default::default()
|
..Default::default() // is_mining = false
|
||||||
};
|
};
|
||||||
assert_eq!(psu.power_health(), CompHealth::Down);
|
assert_eq!(psu.power_health(), CompHealth::Down); // fault + not mining -> red
|
||||||
assert!(psu.board_healths().iter().all(|h| *h == CompHealth::Unreachable));
|
assert!(psu.board_healths().iter().all(|h| *h == CompHealth::Down)); // faulted -> red, not grey
|
||||||
let ptips = psu.health_tooltips(2, 3);
|
let ptips = psu.health_tooltips(2, 3);
|
||||||
assert!(ptips[0].contains("Power current error."));
|
assert!(ptips[0].contains("Power current error."));
|
||||||
assert!(ptips[2 + 2].contains("unpowered")); // first board tooltip
|
|
||||||
|
// Round 18 #2: the SAME PSU fault while the miner IS mining is a warning
|
||||||
|
// (yellow bolt), and running boards stay GREEN (not grey). Round 18 #4b:
|
||||||
|
// grey is reserved for genuinely-undetected boards.
|
||||||
|
let psu_running = MinerRow {
|
||||||
|
is_mining: true,
|
||||||
|
power_w: 3000.0,
|
||||||
|
board_status: vec![BoardHealth::Ok, BoardHealth::Ok, BoardHealth::Missing],
|
||||||
|
faults: vec![fault(FaultComponent::Power, "Power vout warning.")],
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
|
assert_eq!(psu_running.power_health(), CompHealth::Degraded); // yellow, not red
|
||||||
|
let rb = psu_running.board_healths();
|
||||||
|
assert_eq!(rb[0], CompHealth::Ok); // running -> green despite PSU fault
|
||||||
|
assert_eq!(rb[1], CompHealth::Ok);
|
||||||
|
assert_eq!(rb[2], CompHealth::Unreachable); // only the undetected board is grey
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn equihash_hashrate_units_round18() {
|
||||||
|
// SHA256 shows the TH/s value directly; Equihash shows the Sol/s count
|
||||||
|
// (ths * 1e12) with an SI prefix (round 18 #7).
|
||||||
|
assert_eq!(hashrate_num_for("SHA256", 80.5).as_deref(), Some("80.5"));
|
||||||
|
// 167,764 Sol/s -> SI mantissa+prefix ("168k"); paired with the "Sol/s" unit.
|
||||||
|
assert_eq!(hashrate_num_for("Equihash", 167_764.0 / 1e12).as_deref(), Some("168k"));
|
||||||
|
assert_eq!(hashrate_num_for("Equihash", 0.0), None);
|
||||||
|
let sha = MinerRow { algorithm: "SHA256".into(), ..Default::default() };
|
||||||
|
let equi = MinerRow { algorithm: "Equihash".into(), ..Default::default() };
|
||||||
|
assert_eq!(sha.hashrate_unit(), "TH/s");
|
||||||
|
assert_eq!(equi.hashrate_unit(), "Sol/s");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -2099,12 +2165,12 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pic_locked_error_columns_render() {
|
fn pic_locked_error_columns_render() {
|
||||||
// PIC (best-effort): Antminer known -> PIC/noPIC, unknown Antminer -> "?".
|
// PIC: known -> PIC/noPIC; anything unknown -> blank, never "?" (round 18 #11).
|
||||||
let am = |pic| MinerRow { brand: "Antminer".into(), pic_present: pic, ..Default::default() };
|
let am = |pic| MinerRow { brand: "Antminer".into(), pic_present: pic, ..Default::default() };
|
||||||
assert_eq!(Column::Pic.cell(&am(Some(true))), "PIC");
|
assert_eq!(Column::Pic.cell(&am(Some(true))), "PIC");
|
||||||
assert_eq!(Column::Pic.cell(&am(Some(false))), "noPIC");
|
assert_eq!(Column::Pic.cell(&am(Some(false))), "noPIC");
|
||||||
assert_eq!(Column::Pic.cell(&am(None)), "?");
|
assert_eq!(Column::Pic.cell(&am(None)), ""); // unknown Antminer model -> blank
|
||||||
// Non-Antminer makes: PIC has no meaning -> blank, never "?".
|
// Non-Antminer makes: PIC has no meaning -> blank.
|
||||||
let wm = MinerRow { brand: "WhatsMiner".into(), pic_present: None, ..Default::default() };
|
let wm = MinerRow { brand: "WhatsMiner".into(), pic_present: None, ..Default::default() };
|
||||||
assert_eq!(Column::Pic.cell(&wm), "");
|
assert_eq!(Column::Pic.cell(&wm), "");
|
||||||
|
|
||||||
|
|||||||
@@ -287,6 +287,22 @@ fn is_aml_140mm(clean_model: &str) -> bool {
|
|||||||
m.contains("XP") || m.starts_with("S19k") || m.starts_with("S21")
|
m.contains("XP") || m.starts_with("S19k") || m.starts_with("S21")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Nameplate expected hashrate in Sol/s for an Equihash (Zcash) miner model, when
|
||||||
|
/// the firmware itself does not report an expected hashrate (round 18 #6). Plain
|
||||||
|
/// Antminer Z15 firmware omits the cgminer `total_rateideal` field (the Z15j does
|
||||||
|
/// report it), so its actual-vs-expected column and colour would otherwise be
|
||||||
|
/// blank. The Z15 nameplate is 420 KSol/s. Returns `None` for models with no known
|
||||||
|
/// nameplate (the caller then leaves expected unknown).
|
||||||
|
pub fn equihash_expected_sols(clean_model: &str) -> Option<f64> {
|
||||||
|
let m = clean_model.to_ascii_lowercase();
|
||||||
|
// Match the Z15 family (z15, z15j); both share the 420 KSol/s nameplate.
|
||||||
|
if m.contains("z15") {
|
||||||
|
Some(420_000.0)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
@@ -478,6 +478,35 @@ fn summarize_messages(messages: &[asic_rs::core::data::message::MinerMessage]) -
|
|||||||
/// component (round 16 #1/#2/#3), so the Health column can colour and describe
|
/// component (round 16 #1/#2/#3), so the Health column can colour and describe
|
||||||
/// each icon from the actual per-component faults. Info-severity messages are
|
/// each icon from the actual per-component faults. Info-severity messages are
|
||||||
/// dropped; Error and Warning are kept (only Error drives colour).
|
/// dropped; Error and Warning are kept (only Error drives colour).
|
||||||
|
/// Best-effort hashboard index from a fault message that names a board (round 18
|
||||||
|
/// #5). Only WhatsMiner's asic-rs backends attribute a message to a specific
|
||||||
|
/// `HashBoard { idx }`; every Antminer-hardware firmware (stock, VNish, Braiins,
|
||||||
|
/// LuxOS) builds messages with no component, so a real per-board fault would
|
||||||
|
/// otherwise land on the control-board (brain) tooltip instead of the board it
|
||||||
|
/// names. The message text is self-describing (e.g. "Chain 2 ... temperature"),
|
||||||
|
/// so pull the first integer after a board keyword and attribute the fault to that
|
||||||
|
/// board. Returns None when no board keyword is present.
|
||||||
|
fn board_index_from_text(text: &str) -> Option<usize> {
|
||||||
|
let lower = text.to_ascii_lowercase();
|
||||||
|
// Longest/most-specific keywords first so "hashboard" wins over "board".
|
||||||
|
for kw in ["hashboard", "hash board", "chain", "slot", "board"] {
|
||||||
|
let mut from = 0;
|
||||||
|
while let Some(rel) = lower[from..].find(kw) {
|
||||||
|
let after = &lower[from + rel + kw.len()..];
|
||||||
|
let digits: String = after
|
||||||
|
.trim_start_matches(|c: char| !c.is_ascii_digit())
|
||||||
|
.chars()
|
||||||
|
.take_while(|c| c.is_ascii_digit())
|
||||||
|
.collect();
|
||||||
|
if let Ok(n) = digits.parse::<usize>() {
|
||||||
|
return Some(n);
|
||||||
|
}
|
||||||
|
from += rel + kw.len();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn messages_to_faults(
|
fn messages_to_faults(
|
||||||
messages: &[asic_rs::core::data::message::MinerMessage],
|
messages: &[asic_rs::core::data::message::MinerMessage],
|
||||||
) -> Vec<crate::model::Fault> {
|
) -> Vec<crate::model::Fault> {
|
||||||
@@ -500,7 +529,12 @@ fn messages_to_faults(
|
|||||||
Some(MinerComponent::ControlBoard {}) => FaultComponent::Control,
|
Some(MinerComponent::ControlBoard {}) => FaultComponent::Control,
|
||||||
Some(MinerComponent::Fan { idx }) => FaultComponent::Fan(*idx as usize),
|
Some(MinerComponent::Fan { idx }) => FaultComponent::Fan(*idx as usize),
|
||||||
Some(MinerComponent::HashBoard { idx, .. }) => FaultComponent::Board(*idx as usize),
|
Some(MinerComponent::HashBoard { idx, .. }) => FaultComponent::Board(*idx as usize),
|
||||||
None => FaultComponent::Other,
|
// Unattributed (every Antminer-hardware firmware): recover a board
|
||||||
|
// index from the message text so hashboard faults show on the board
|
||||||
|
// they name, not the control-board tooltip (round 18 #5).
|
||||||
|
None => board_index_from_text(text)
|
||||||
|
.map(FaultComponent::Board)
|
||||||
|
.unwrap_or(FaultComponent::Other),
|
||||||
};
|
};
|
||||||
Some(Fault {
|
Some(Fault {
|
||||||
component,
|
component,
|
||||||
@@ -512,6 +546,21 @@ fn messages_to_faults(
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod board_index_tests {
|
||||||
|
use super::board_index_from_text;
|
||||||
|
#[test]
|
||||||
|
fn extracts_board_index_from_common_fault_texts() {
|
||||||
|
assert_eq!(board_index_from_text("Chain 2 temperature sensor error"), Some(2));
|
||||||
|
assert_eq!(board_index_from_text("hashboard 0 loss of balance"), Some(0));
|
||||||
|
assert_eq!(board_index_from_text("Slot 1 error reading chip id."), Some(1));
|
||||||
|
assert_eq!(board_index_from_text("Board #3 not responding"), Some(3));
|
||||||
|
// No board keyword -> not attributed to a board.
|
||||||
|
assert_eq!(board_index_from_text("Environment temperature is too high."), None);
|
||||||
|
assert_eq!(board_index_from_text("Power current error."), None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Infer whether an Antminer's hashboards carry a per-board PIC MCU from the
|
/// Infer whether an Antminer's hashboards carry a per-board PIC MCU from the
|
||||||
/// model string (round 14 #2). No firmware (stock cgminer, Vnish, LuxOS, Braiins)
|
/// model string (round 14 #2). No firmware (stock cgminer, Vnish, LuxOS, Braiins)
|
||||||
/// exposes a PIC flag over the network; PIC-vs-noPIC is fixed by the hashboard
|
/// exposes a PIC flag over the network; PIC-vs-noPIC is fixed by the hashboard
|
||||||
@@ -572,7 +621,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
|
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
|
||||||
.unwrap_or(0.0);
|
.unwrap_or(0.0);
|
||||||
let expected_ths = data
|
let mut expected_ths = data
|
||||||
.expected_hashrate
|
.expected_hashrate
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
|
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
|
||||||
@@ -614,6 +663,18 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
.unwrap_or(0.0)
|
.unwrap_or(0.0)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
// Per-board expected hashrate (TH/s), index-aligned, for the actual/expected
|
||||||
|
// per-board tooltip (round 18 #3).
|
||||||
|
let board_expected_hashrates: Vec<f64> = data
|
||||||
|
.hashboards
|
||||||
|
.iter()
|
||||||
|
.map(|b| {
|
||||||
|
b.expected_hashrate
|
||||||
|
.as_ref()
|
||||||
|
.map(|h| h.clone().as_unit(asic_rs::core::data::hashrate::HashRateUnit::TeraHash).value)
|
||||||
|
.unwrap_or(0.0)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
let fan_rpms: Vec<f64> = data
|
let fan_rpms: Vec<f64> = data
|
||||||
.fans
|
.fans
|
||||||
.iter()
|
.iter()
|
||||||
@@ -699,6 +760,14 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
|
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
|
||||||
.fold(0.0f64, f64::max);
|
.fold(0.0f64, f64::max);
|
||||||
let algorithm = data.hashrate.as_ref().map(|h| h.algo.to_string()).unwrap_or_default();
|
let algorithm = data.hashrate.as_ref().map(|h| h.algo.to_string()).unwrap_or_default();
|
||||||
|
// Equihash (Z15) fallback: plain Z15 firmware omits the expected hashrate, so
|
||||||
|
// fill it from the model nameplate (Sol/s -> the ths-normalised value) so the
|
||||||
|
// actual/expected column + colour work like every other miner (round 18 #6).
|
||||||
|
if expected_ths <= 0.0 && algorithm.eq_ignore_ascii_case("equihash") {
|
||||||
|
if let Some(sols) = crate::naming::equihash_expected_sols(&model) {
|
||||||
|
expected_ths = sols / 1e12;
|
||||||
|
}
|
||||||
|
}
|
||||||
let is_mining = data.is_mining;
|
let is_mining = data.is_mining;
|
||||||
let slow = crate::model::is_slow(is_mining, hashrate_ths, expected_ths);
|
let slow = crate::model::is_slow(is_mining, hashrate_ths, expected_ths);
|
||||||
let operating_state = data.operating_state.as_ref().map(|s| s.to_string()).unwrap_or_default();
|
let operating_state = data.operating_state.as_ref().map(|s| s.to_string()).unwrap_or_default();
|
||||||
@@ -843,6 +912,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
hashrate_ths,
|
hashrate_ths,
|
||||||
expected_ths,
|
expected_ths,
|
||||||
board_hashrates,
|
board_hashrates,
|
||||||
|
board_expected_hashrates,
|
||||||
efficiency: data.efficiency.unwrap_or(0.0),
|
efficiency: data.efficiency.unwrap_or(0.0),
|
||||||
power_w,
|
power_w,
|
||||||
// PSU info (round 17 R5/G15; ePIC exposes it today). A reported-but-zero
|
// PSU info (round 17 R5/G15; ePIC exposes it today). A reported-but-zero
|
||||||
|
|||||||
+27
-14
@@ -1311,14 +1311,16 @@ impl App {
|
|||||||
// With a single algorithm running (the common case) the card shows that
|
// With a single algorithm running (the common case) the card shows that
|
||||||
// algorithm's total under a "<Algo> Hashrate" caption; when several are
|
// algorithm's total under a "<Algo> Hashrate" caption; when several are
|
||||||
// running, clicking the card cycles `hashrate_algo_idx` through them.
|
// running, clicking the card cycles `hashrate_algo_idx` through them.
|
||||||
let (algo_label, algo_ths) = if k.hashrate_by_algo.is_empty() {
|
let (algo_label, algo_ths, algo_unit) = if k.hashrate_by_algo.is_empty() {
|
||||||
("SHA-256".to_string(), 0.0)
|
("SHA-256".to_string(), 0.0, "H")
|
||||||
} else {
|
} else {
|
||||||
let i = self.hashrate_algo_idx % k.hashrate_by_algo.len();
|
let i = self.hashrate_algo_idx % k.hashrate_by_algo.len();
|
||||||
let (a, t) = &k.hashrate_by_algo[i];
|
let (a, t) = &k.hashrate_by_algo[i];
|
||||||
(pretty_algo(a), *t)
|
// Equihash miners (Z15/Zcash) are counted in Sol/s, not H/s (round 18 #7).
|
||||||
|
let unit = if a.eq_ignore_ascii_case("equihash") { "Sol" } else { "H" };
|
||||||
|
(pretty_algo(a), *t, unit)
|
||||||
};
|
};
|
||||||
self.kpi_hashrate.set_label(&format_si(algo_ths * 1e12, "H"));
|
self.kpi_hashrate.set_label(&format_si(algo_ths * 1e12, algo_unit));
|
||||||
self.kpi_hashrate_lbl.set_label(&format!("{algo_label} Hashrate"));
|
self.kpi_hashrate_lbl.set_label(&format!("{algo_label} Hashrate"));
|
||||||
self.kpi_power.set_label(&format_si(k.total_power_w, "W"));
|
self.kpi_power.set_label(&format_si(k.total_power_w, "W"));
|
||||||
// set_label resizes the static text; re-run each card's sizer so the
|
// set_label resizes the static text; re-run each card's sizer so the
|
||||||
@@ -1472,8 +1474,14 @@ impl App {
|
|||||||
if !caps.is_empty() {
|
if !caps.is_empty() {
|
||||||
let sfx = if n == 1 { String::new() } else { format!(" ({n})") };
|
let sfx = if n == 1 { String::new() } else { format!(" ({n})") };
|
||||||
if caps.fault_light {
|
if caps.fault_light {
|
||||||
menu.menu_append(ID_CTX_LIGHT_ON, &format!("Flash lights on{sfx}"));
|
// A single state-based toggle (round 18 #9): if any selected miner's
|
||||||
menu.menu_append(ID_CTX_LIGHT_OFF, &format!("Flash lights off{sfx}"));
|
// locate light is on, offer to stop; otherwise offer to flash.
|
||||||
|
let any_on = selected.iter().any(|r| r.light_flashing == Some(true));
|
||||||
|
if any_on {
|
||||||
|
menu.menu_append(ID_CTX_LIGHT_OFF, &format!("Stop flashing lights{sfx}"));
|
||||||
|
} else {
|
||||||
|
menu.menu_append(ID_CTX_LIGHT_ON, &format!("Flash lights{sfx}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if caps.pause {
|
if caps.pause {
|
||||||
menu.menu_append(ID_CTX_PAUSE, &format!("Pause mining{sfx}"));
|
menu.menu_append(ID_CTX_PAUSE, &format!("Pause mining{sfx}"));
|
||||||
@@ -1579,16 +1587,19 @@ impl App {
|
|||||||
l.set_min_size(w, -1);
|
l.set_min_size(w, -1);
|
||||||
l
|
l
|
||||||
};
|
};
|
||||||
|
// Each column on screen is the text field PLUS its 34px "+" button, so each
|
||||||
|
// header must span field_width + 34 to line up with the boxes below it
|
||||||
|
// (round 18 #8c). The Pool-label column is 46 to match the row label.
|
||||||
|
const PLUS_W: i32 = 34;
|
||||||
|
let widths = [170, 110, 110, 70]; // address, account, worker, password
|
||||||
head.add(hl("", 46), 0, sf::BORDER_LEFT, 6);
|
head.add(hl("", 46), 0, sf::BORDER_LEFT, 6);
|
||||||
head.add(hl("Address", 176), 0, sf::BORDER_LEFT, 6);
|
head.add(hl("Address", widths[0] + PLUS_W), 0, sf::BORDER_LEFT, 6);
|
||||||
head.add(hl("Account", 116), 0, sf::BORDER_LEFT, 6);
|
head.add(hl("Account", widths[1] + PLUS_W), 0, sf::BORDER_LEFT, 6);
|
||||||
head.add(hl("Worker", 116), 0, sf::BORDER_LEFT, 6);
|
head.add(hl("Worker", widths[2] + PLUS_W), 0, sf::BORDER_LEFT, 6);
|
||||||
head.add(hl("Password", 76), 0, sf::BORDER_LEFT, 6);
|
head.add(hl("Password", widths[3] + PLUS_W), 0, sf::BORDER_LEFT, 6);
|
||||||
root.add_sizer(head, 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 6);
|
root.add_sizer(head, 0, sf::BORDER_LEFT | sf::BORDER_RIGHT | sf::BORDER_TOP, 6);
|
||||||
|
|
||||||
let mut fields: Vec<Widget> = Vec::with_capacity(12);
|
let mut fields: Vec<Widget> = Vec::with_capacity(12);
|
||||||
// widths per field type (address, account, worker, password).
|
|
||||||
let widths = [170, 110, 110, 70];
|
|
||||||
for row in 0..3usize {
|
for row in 0..3usize {
|
||||||
let rsizer = Widget::box_sizer(false);
|
let rsizer = Widget::box_sizer(false);
|
||||||
let lbl = Widget::static_text(dlg, &format!("Pool {}", row + 1));
|
let lbl = Widget::static_text(dlg, &format!("Pool {}", row + 1));
|
||||||
@@ -1599,7 +1610,7 @@ impl App {
|
|||||||
input.set_min_size(widths[field], -1);
|
input.set_min_size(widths[field], -1);
|
||||||
rsizer.add(input, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT, 6);
|
rsizer.add(input, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_LEFT, 6);
|
||||||
let plus = Widget::button(dlg, "+", ID_POOL_PLUS_BASE + (row * 4 + field) as i32);
|
let plus = Widget::button(dlg, "+", ID_POOL_PLUS_BASE + (row * 4 + field) as i32);
|
||||||
plus.set_min_size(34, -1); // wide enough that the "+" glyph isn't clipped
|
plus.set_min_size(PLUS_W, -1); // wide enough that the "+" glyph isn't clipped
|
||||||
rsizer.add(plus, 0, sf::ALIGN_CENTRE_VERTICAL, 0);
|
rsizer.add(plus, 0, sf::ALIGN_CENTRE_VERTICAL, 0);
|
||||||
fields.push(input);
|
fields.push(input);
|
||||||
}
|
}
|
||||||
@@ -1611,7 +1622,9 @@ impl App {
|
|||||||
btns.add(Widget::button(dlg, "Cancel", ID_POOLS_CANCEL), 0, sf::BORDER_ALL, 6);
|
btns.add(Widget::button(dlg, "Cancel", ID_POOLS_CANCEL), 0, sf::BORDER_ALL, 6);
|
||||||
root.add_sizer(btns, 0, sf::EXPAND | sf::BORDER_ALL, 6);
|
root.add_sizer(btns, 0, sf::EXPAND | sf::BORDER_ALL, 6);
|
||||||
root.set_sizer_on(dlg);
|
root.set_sizer_on(dlg);
|
||||||
dlg.set_min_size(560, 220); // round 16 #5: narrower; fit() grows to content
|
// Wide enough for the label + all four field+button columns so the "+"
|
||||||
|
// buttons on the right (Password) are never clipped (round 18 #8a).
|
||||||
|
dlg.set_min_size(700, 220);
|
||||||
dlg.fit(dlg);
|
dlg.fit(dlg);
|
||||||
self.pools_dialog = dlg;
|
self.pools_dialog = dlg;
|
||||||
self.pool_fields = fields;
|
self.pool_fields = fields;
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
Subject: [PATCH 0020] braiins v26_04: PSU info (type + rated voltage envelope)
|
||||||
|
|
||||||
|
Round 17 R5/G15 extension. BOS reports PSU info at miner/details -> psu_info
|
||||||
|
{version, min_voltage.volt, max_voltage.volt}. Map DataField::Psu to it and parse
|
||||||
|
model (the "version" type code, 117 = the same APW12 ePIC reports) + voltage
|
||||||
|
min/max. Verified live on Braiins S19j Pro (10.4.1.83/.27): model 117, Vmin
|
||||||
|
11.96 V, Vmax 15.2 V.
|
||||||
|
diff --git a/vendor/asic-rs-firmwares-braiins/src/backends/v26_04/mod.rs b/vendor/asic-rs-firmwares-braiins/src/backends/v26_04/mod.rs
|
||||||
|
index e65fb201..9b72ed94 100644
|
||||||
|
--- a/vendor/asic-rs-firmwares-braiins/src/backends/v26_04/mod.rs
|
||||||
|
+++ b/vendor/asic-rs-firmwares-braiins/src/backends/v26_04/mod.rs
|
||||||
|
@@ -22,6 +22,7 @@ use asic_rs_core::{
|
||||||
|
miner::TuningTarget,
|
||||||
|
operating_state::OperatingState,
|
||||||
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
+ psu::PsuInfo,
|
||||||
|
},
|
||||||
|
traits::{miner::*, model::MinerModel},
|
||||||
|
};
|
||||||
|
@@ -294,6 +295,16 @@ impl GetDataLocations for BraiinsV2604 {
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
|
+ // PSU identity + rated voltage envelope (round 17 R5/G15). BOS reports
|
||||||
|
+ // it at miner/details -> psu_info {version, min_voltage, max_voltage}.
|
||||||
|
+ DataField::Psu => vec![(
|
||||||
|
+ WEB_MINER_DETAILS,
|
||||||
|
+ DataExtractor {
|
||||||
|
+ func: get_by_pointer,
|
||||||
|
+ key: Some("/psu_info"),
|
||||||
|
+ tag: None,
|
||||||
|
+ },
|
||||||
|
+ )],
|
||||||
|
DataField::TuningTarget => vec![
|
||||||
|
(
|
||||||
|
WEB_MINER_CONFIGURATION,
|
||||||
|
@@ -663,6 +674,22 @@ impl GetWattage for BraiinsV2604 {
|
||||||
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
|
data.extract_map::<i64, _>(DataField::Wattage, |w| Power::from_watts(w as f64))
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
+ // BOS miner/details -> psu_info {version, min_voltage.volt, max_voltage.volt}.
|
||||||
|
+ // "version" is the PSU type code (117 = the APW12 ePIC also reports as model
|
||||||
|
+ // 117), so expose it as the model for consistency across firmwares.
|
||||||
|
+ let d = data.get(&DataField::Psu)?;
|
||||||
|
+ let psu = PsuInfo {
|
||||||
|
+ model: d.pointer("/version").and_then(|v| v.as_i64()).map(|n| n.to_string()),
|
||||||
|
+ version: None,
|
||||||
|
+ voltage_min: d.pointer("/min_voltage/volt").and_then(|v| v.as_f64()),
|
||||||
|
+ voltage_max: d.pointer("/max_voltage/volt").and_then(|v| v.as_f64()),
|
||||||
|
+ output_voltage: None,
|
||||||
|
+ output_current: None,
|
||||||
|
+ };
|
||||||
|
+ (psu != PsuInfo::default()).then_some(psu)
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
impl GetTuningTarget for BraiinsV2604 {
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
Subject: [PATCH 0021] whatsminer v1/v2: PSU info + fix pre-existing parse_messages test
|
||||||
|
|
||||||
|
Round 17 R5/G15 extension. get_psu /Msg exposes the PSU model + hw/sw version
|
||||||
|
(no DC output voltage or rated envelope). Map DataField::Psu to it in v1 and v2
|
||||||
|
and parse model + version. Verified live on a WhatsMiner M30S+ (10.8.1.214, v2):
|
||||||
|
model P221C, version H20201205. (v3 uses a different /msg/power shape and no v3
|
||||||
|
unit was available to verify, so it is left for a follow-up.)
|
||||||
|
|
||||||
|
Also fixes a pre-existing test bug: test_whatsminer_v1_parse_messages asserted 2
|
||||||
|
messages but never mocked get_error_code (its only source since patch 0012), so it
|
||||||
|
returned 0 and failed whenever the vendored backend tests were run (CI runs only
|
||||||
|
the GUI selftest, so it went unnoticed). Adds a get_error_code.json mock. v1 tests
|
||||||
|
now 41/41.
|
||||||
|
diff --git a/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs b/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs
|
||||||
|
index 67907049..3c8512ad 100644
|
||||||
|
--- a/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs
|
||||||
|
+++ b/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs
|
||||||
|
@@ -18,6 +18,7 @@ use asic_rs_core::{
|
||||||
|
message::{MessageSeverity, MinerMessage},
|
||||||
|
miner::TuningTarget,
|
||||||
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
+ psu::PsuInfo,
|
||||||
|
},
|
||||||
|
traits::{miner::*, model::MinerModel},
|
||||||
|
};
|
||||||
|
@@ -193,6 +194,16 @@ impl GetDataLocations for WhatsMinerV1 {
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
|
+ // PSU identity from get_psu (round 17 R5/G15). WhatsMiner exposes the
|
||||||
|
+ // model + hw/sw version but not a DC output voltage or rated envelope.
|
||||||
|
+ DataField::Psu => vec![(
|
||||||
|
+ RPC_GET_PSU,
|
||||||
|
+ DataExtractor {
|
||||||
|
+ func: get_by_pointer,
|
||||||
|
+ key: Some("/Msg"),
|
||||||
|
+ tag: None,
|
||||||
|
+ },
|
||||||
|
+ )],
|
||||||
|
DataField::Hashboards => vec![(
|
||||||
|
RPC_DEVS,
|
||||||
|
DataExtractor {
|
||||||
|
@@ -463,6 +474,22 @@ impl GetWattage for WhatsMinerV1 {
|
||||||
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
|
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
+ // get_psu /Msg -> {model, hw_version, sw_version, ...} (values are strings).
|
||||||
|
+ // No DC output voltage or rated envelope is exposed, so only identity is set.
|
||||||
|
+ let d = data.get(&DataField::Psu)?;
|
||||||
|
+ let s = |k: &str| d.pointer(k).and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string);
|
||||||
|
+ let psu = PsuInfo {
|
||||||
|
+ model: s("/model").or_else(|| s("/name")),
|
||||||
|
+ version: s("/hw_version").or_else(|| s("/sw_version")),
|
||||||
|
+ voltage_min: None,
|
||||||
|
+ voltage_max: None,
|
||||||
|
+ output_voltage: None,
|
||||||
|
+ output_current: None,
|
||||||
|
+ };
|
||||||
|
+ (psu != PsuInfo::default()).then_some(psu)
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
impl GetTuningTarget for WhatsMinerV1 {
|
||||||
|
fn parse_tuning_target(&self, data: &HashMap<DataField, Value>) -> Option<TuningTarget> {
|
||||||
|
@@ -805,8 +832,8 @@ mod integration_tests {
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
use crate::test::json::v1::{
|
||||||
|
- DEVS_COMMAND, GET_PSU_COMMAND, GET_VERSION_COMMAND, POOLS_COMMAND, STATUS_COMMAND,
|
||||||
|
- SUMMARY_COMMAND, SUMMARY_WITH_ERRORS_COMMAND,
|
||||||
|
+ DEVS_COMMAND, GET_ERROR_CODE_COMMAND, GET_PSU_COMMAND, GET_VERSION_COMMAND, POOLS_COMMAND,
|
||||||
|
+ STATUS_COMMAND, SUMMARY_COMMAND, SUMMARY_WITH_ERRORS_COMMAND,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
@@ -943,6 +970,13 @@ mod integration_tests {
|
||||||
|
},
|
||||||
|
Value::from_str(GET_PSU_COMMAND)?,
|
||||||
|
);
|
||||||
|
+ results.insert(
|
||||||
|
+ MinerCommand::RPC {
|
||||||
|
+ command: "get_error_code",
|
||||||
|
+ parameters: None,
|
||||||
|
+ },
|
||||||
|
+ Value::from_str(GET_ERROR_CODE_COMMAND)?,
|
||||||
|
+ );
|
||||||
|
|
||||||
|
let mock_api = MockAPIClient::new(results);
|
||||||
|
|
||||||
|
diff --git a/vendor/asic-rs-firmwares-whatsminer/src/backends/v2/mod.rs b/vendor/asic-rs-firmwares-whatsminer/src/backends/v2/mod.rs
|
||||||
|
index 096b2fcb..de36a126 100644
|
||||||
|
--- a/vendor/asic-rs-firmwares-whatsminer/src/backends/v2/mod.rs
|
||||||
|
+++ b/vendor/asic-rs-firmwares-whatsminer/src/backends/v2/mod.rs
|
||||||
|
@@ -20,6 +20,7 @@ use asic_rs_core::{
|
||||||
|
message::{MessageSeverity, MinerMessage},
|
||||||
|
miner::{MiningMode, TuningTarget},
|
||||||
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
+ psu::PsuInfo,
|
||||||
|
},
|
||||||
|
traits::{miner::*, model::MinerModel},
|
||||||
|
util::is_expected_write_error,
|
||||||
|
@@ -205,6 +206,15 @@ impl GetDataLocations for WhatsMinerV2 {
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
|
+ // PSU identity from get_psu (round 17 R5/G15): model + hw/sw version.
|
||||||
|
+ DataField::Psu => vec![(
|
||||||
|
+ RPC_GET_PSU,
|
||||||
|
+ DataExtractor {
|
||||||
|
+ func: get_by_pointer,
|
||||||
|
+ key: Some("/Msg"),
|
||||||
|
+ tag: None,
|
||||||
|
+ },
|
||||||
|
+ )],
|
||||||
|
DataField::Hashboards => vec![(
|
||||||
|
RPC_DEVS,
|
||||||
|
DataExtractor {
|
||||||
|
@@ -471,6 +481,22 @@ impl GetWattage for WhatsMinerV2 {
|
||||||
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
|
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
+ // get_psu /Msg -> {model, hw_version, sw_version} (string values). No DC
|
||||||
|
+ // output voltage or rated envelope is exposed, so only identity is set.
|
||||||
|
+ let d = data.get(&DataField::Psu)?;
|
||||||
|
+ let s = |k: &str| d.pointer(k).and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string);
|
||||||
|
+ let psu = PsuInfo {
|
||||||
|
+ model: s("/model").or_else(|| s("/name")),
|
||||||
|
+ version: s("/hw_version").or_else(|| s("/sw_version")),
|
||||||
|
+ voltage_min: None,
|
||||||
|
+ voltage_max: None,
|
||||||
|
+ output_voltage: None,
|
||||||
|
+ output_current: None,
|
||||||
|
+ };
|
||||||
|
+ (psu != PsuInfo::default()).then_some(psu)
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
/// Parses tuning target from V2 summary data.
|
||||||
|
/// Low/High → MiningMode, Normal/unknown/empty → Power(limit).
|
||||||
|
diff --git a/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/get_error_code.json b/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/get_error_code.json
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..1d87b18b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/get_error_code.json
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+{
|
||||||
|
+ "Code": 131,
|
||||||
|
+ "Description": "",
|
||||||
|
+ "Msg": {
|
||||||
|
+ "error_code": [
|
||||||
|
+ {
|
||||||
|
+ "110": "2024-06-15 09:15:00"
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ "600": "2024-06-15 10:30:00"
|
||||||
|
+ }
|
||||||
|
+ ]
|
||||||
|
+ },
|
||||||
|
+ "STATUS": "S",
|
||||||
|
+ "When": 1773871985
|
||||||
|
+}
|
||||||
|
diff --git a/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/mod.rs b/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/mod.rs
|
||||||
|
index 0b3442db..c94c354f 100644
|
||||||
|
--- a/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/mod.rs
|
||||||
|
+++ b/vendor/asic-rs-firmwares-whatsminer/src/test/json/v1/mod.rs
|
||||||
|
@@ -6,4 +6,5 @@ pub(crate) const POOLS_COMMAND: &str = include_str!("pools.json");
|
||||||
|
pub(crate) const DEVS_COMMAND: &str = include_str!("devs.json");
|
||||||
|
pub(crate) const GET_VERSION_COMMAND: &str = include_str!("get_version.json");
|
||||||
|
pub(crate) const GET_PSU_COMMAND: &str = include_str!("get_psu.json");
|
||||||
|
+pub(crate) const GET_ERROR_CODE_COMMAND: &str = include_str!("get_error_code.json");
|
||||||
|
pub(crate) const SUMMARY_WITH_ERRORS_COMMAND: &str = include_str!("summary_with_errors.json");
|
||||||
@@ -335,14 +335,15 @@ int DrawShape(wxDC* dc, wxUniChar shape, wxCoord x, const wxRect& cell,
|
|||||||
if (h < 8) h = 8;
|
if (h < 8) h = 8;
|
||||||
int w = (sv->vbh > 0) ? (int)((double)h * sv->vbw / sv->vbh + 0.5) : h;
|
int w = (sv->vbh > 0) ? (int)((double)h * sv->vbw / sv->vbh + 0.5) : h;
|
||||||
if (w < 1) w = 1;
|
if (w < 1) w = 1;
|
||||||
// The Font Awesome fan glyph fills its square box more than the other health
|
// The Font Awesome fan and brain glyphs fill their square box more than the
|
||||||
// icons (brain/chip/bolt), so at the shared size it reads as oversized. Draw
|
// other health icons (chip/bolt), so at the shared size they read as oversized.
|
||||||
// it a bit smaller, centred in its full-size slot, so the slot advance and the
|
// Draw them a bit smaller, centred in their full-size slot, so the slot advance
|
||||||
// per-icon tooltip hit-test (both keyed to the full width) are unchanged
|
// and the per-icon tooltip hit-test (both keyed to the full width) are
|
||||||
// (round 17 R1).
|
// unchanged (round 17 R1; round 18 #1 brain).
|
||||||
int dw = w, dh = h;
|
int dw = w, dh = h;
|
||||||
if (shape == SHAPE_FAN) {
|
double glyph_scale = (shape == SHAPE_FAN) ? 0.80 : (shape == SHAPE_BRAIN) ? 0.82 : 1.0;
|
||||||
dh = (int)(h * 0.80 + 0.5);
|
if (glyph_scale < 1.0) {
|
||||||
|
dh = (int)(h * glyph_scale + 0.5);
|
||||||
if (dh < 8) dh = 8;
|
if (dh < 8) dh = 8;
|
||||||
dw = (sv->vbh > 0) ? (int)((double)dh * sv->vbw / sv->vbh + 0.5) : dh;
|
dw = (sv->vbh > 0) ? (int)((double)dh * sv->vbw / sv->vbh + 0.5) : dh;
|
||||||
if (dw < 1) dw = 1;
|
if (dw < 1) dw = 1;
|
||||||
@@ -982,6 +983,17 @@ static gboolean dvlc_query_tooltip(GtkWidget* tv, gint x, gint y, gboolean keybo
|
|||||||
if (slot >= (int)iit->second.size()) slot = (int)iit->second.size() - 1;
|
if (slot >= (int)iit->second.size()) slot = (int)iit->second.size() - 1;
|
||||||
const wxString& tip = iit->second[(size_t)slot];
|
const wxString& tip = iit->second[(size_t)slot];
|
||||||
if (tip.IsEmpty()) return FALSE;
|
if (tip.IsEmpty()) return FALSE;
|
||||||
|
// Scope the tooltip's "tip area" to just this icon's slot (round 18 #4a).
|
||||||
|
// Without a tip area GTK defaults it to the whole widget, so it never re-queries
|
||||||
|
// or moves the tooltip as the pointer crosses from one icon to the next -- the
|
||||||
|
// old tooltip just stays put with stale text. Setting a per-slot area makes GTK
|
||||||
|
// hide + re-show + reposition the tooltip for each icon.
|
||||||
|
GdkRectangle area;
|
||||||
|
area.x = crect.x + slot * adv;
|
||||||
|
area.y = crect.y;
|
||||||
|
area.width = adv;
|
||||||
|
area.height = crect.height;
|
||||||
|
gtk_tooltip_set_tip_area(tooltip, &area);
|
||||||
gtk_tooltip_set_text(tooltip, tip.utf8_str());
|
gtk_tooltip_set_text(tooltip, tip.utf8_str());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -22,6 +22,7 @@ use asic_rs_core::{
|
|||||||
miner::TuningTarget,
|
miner::TuningTarget,
|
||||||
operating_state::OperatingState,
|
operating_state::OperatingState,
|
||||||
pool::{PoolData, PoolGroupData, PoolURL},
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
psu::PsuInfo,
|
||||||
},
|
},
|
||||||
traits::{miner::*, model::MinerModel},
|
traits::{miner::*, model::MinerModel},
|
||||||
};
|
};
|
||||||
@@ -294,6 +295,16 @@ impl GetDataLocations for BraiinsV2604 {
|
|||||||
tag: None,
|
tag: None,
|
||||||
},
|
},
|
||||||
)],
|
)],
|
||||||
|
// PSU identity + rated voltage envelope (round 17 R5/G15). BOS reports
|
||||||
|
// it at miner/details -> psu_info {version, min_voltage, max_voltage}.
|
||||||
|
DataField::Psu => vec![(
|
||||||
|
WEB_MINER_DETAILS,
|
||||||
|
DataExtractor {
|
||||||
|
func: get_by_pointer,
|
||||||
|
key: Some("/psu_info"),
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
DataField::TuningTarget => vec![
|
DataField::TuningTarget => vec![
|
||||||
(
|
(
|
||||||
WEB_MINER_CONFIGURATION,
|
WEB_MINER_CONFIGURATION,
|
||||||
@@ -663,6 +674,22 @@ impl GetWattage for BraiinsV2604 {
|
|||||||
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
data.extract_map::<i64, _>(DataField::Wattage, |w| Power::from_watts(w as f64))
|
data.extract_map::<i64, _>(DataField::Wattage, |w| Power::from_watts(w as f64))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
// BOS miner/details -> psu_info {version, min_voltage.volt, max_voltage.volt}.
|
||||||
|
// "version" is the PSU type code (117 = the APW12 ePIC also reports as model
|
||||||
|
// 117), so expose it as the model for consistency across firmwares.
|
||||||
|
let d = data.get(&DataField::Psu)?;
|
||||||
|
let psu = PsuInfo {
|
||||||
|
model: d.pointer("/version").and_then(|v| v.as_i64()).map(|n| n.to_string()),
|
||||||
|
version: None,
|
||||||
|
voltage_min: d.pointer("/min_voltage/volt").and_then(|v| v.as_f64()),
|
||||||
|
voltage_max: d.pointer("/max_voltage/volt").and_then(|v| v.as_f64()),
|
||||||
|
output_voltage: None,
|
||||||
|
output_current: None,
|
||||||
|
};
|
||||||
|
(psu != PsuInfo::default()).then_some(psu)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetTuningTarget for BraiinsV2604 {
|
impl GetTuningTarget for BraiinsV2604 {
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"30f09ad063df45fdf223aff235fe2da15cb1a7e79e86d7012074153b91662fc4","Cargo.lock":"9d0886791db53421d3218ab72d964145b86cfbe9738eaf09aac5d3c89a1c0190","Cargo.toml":"8c2e9938436850f2e250e8268ed7b385fce903e2077923b207a0560ca3e3242c","Cargo.toml.orig":"891fcfa45e79d6bc4d838c4f3075618f791bd013c99231da48e752b987f409d5","src/backends/mod.rs":"0f5a0ae31d5443d0d0f41a2540def806196238c92d22761b3ad9843cb2e77f45","src/backends/v1/mod.rs":"3a8bdecd1eb271de474b2aca85b5f8e598ba64fe5defc9c8dd9b8c66444a2ed4","src/backends/v1/rpc.rs":"72f9b67c2389ab6e9968e0eb340bd2b6aad9aaf059f4429eb31398863bb87f42","src/backends/v2/mod.rs":"68fd8c1762b424a7785174fdb3ae4fede1d599632657808d4b7c76bcfbfb202c","src/backends/v2/rpc.rs":"52f8d504c236009b020bf33b5550236e36d07b2c73a15bdcfcafa5188e4e1cb6","src/backends/v3/mod.rs":"f19e673c47c2cc366e2ff7782bca93daf750563d62221a12a043b3ee79a15251","src/backends/v3/rpc.rs":"7a5f80aec4af1bcaa0d36e67345aa9acbbd8ead73c0be474f06305358b38e81b","src/error_codes.rs":"b2af610880fb400a9e6297662371a6b3b55077b72cf11115b77fd4d2df44e6a1","src/firmware.rs":"6d002e481ce0a897c0485b9393b0382fcb25811164e893eb8eb67b2ff392ca0d","src/lib.rs":"710b46c9d934f26f900e1366ca1df5f872896e7d8da03569c0f159859e899cc9","src/test/json/mod.rs":"99760925ccfefc40d2455d3567fb1ecfc99e9e55e70478190ef372a954825909","src/test/json/v1/devs.json":"b4fd010f0bae3584efde93387cf2dab5933b499cc30a2dd7635fdc994b56c3b8","src/test/json/v1/get_psu.json":"8c11b6495e0bd5da496dd5c10ca53ec53b2d8fe9a3737f470ec9ce2c1aaf9d99","src/test/json/v1/get_version.json":"c43e947e654792ab191210d50c6f793ee0dd7af41e8cb59f0722b70f32a203bc","src/test/json/v1/mod.rs":"e79509eee78a1fef63735afe385299813726822c8259a02d1dcf5e8b4db9d04e","src/test/json/v1/pools.json":"b570808a3428a0773d7d2ee322150d8fd0794a33804af970300a7fef128a8a01","src/test/json/v1/status.json":"00ec38dd9f980b7ac0ffd6f815374afdbbed98d601bd8ef18bcf0f76ae0aa853","src/test/json/v1/summary.json":"d6e3e75654eb4019e1f479b3d9cf3097130f1afb85dd3338682c094fd4ab498a","src/test/json/v1/summary_with_errors.json":"1ba682f6ad5c43e41ae22a4069d0f52f04da3f07a18031bf4c07e07b3c59cc97","src/test/json/v2/devs.json":"2d203e41ef6ef337c0c81456b73d08730882c3167403c557c3c9776022a972d1","src/test/json/v2/get_error_code.json":"e90b702fd97bceb4f62dcb8228f75ff5ce930290355dca94eefd7192f7f57009","src/test/json/v2/get_error_code_with_errors.json":"6cb6038366eb3835684421c41be0b2b30ae8ce79a7ed51a85f4f52f70da9df16","src/test/json/v2/get_miner_info.json":"55d2af984833a692f502188ae4df4e41bdc10386b47f921c896a452ef1de9062","src/test/json/v2/get_psu.json":"b43086b65897061521d1f6611e200ef372a1724f9ea1876e347c03d5fb19b8f2","src/test/json/v2/get_version.json":"b17e3a81603b43186b2e15745e6822b6c82b3c6f5928b22f84e683d7728dbfcd","src/test/json/v2/mod.rs":"c847205d076323bbd9698e393d241b08f3cf75d32aae86f7058cf8748266b935","src/test/json/v2/pools.json":"926d34e8dae774473ebfec83d4a38e77ca73231708f07683763e212be7af0580","src/test/json/v2/status.json":"fc268cd23864ef99e84813dbf8eb916b2e6f339351a0ee5dab217cbe02569fc3","src/test/json/v2/summary.json":"4e4c01b986e2960893f58d0f1ea4dce23b8ef88db4985348f7f0183eb4818478","src/test/json/v3/get_device_info.json":"83ac22ea9a11adbceb4c963db80aa62d9a2aa50d019a372394dece817d924cda","src/test/json/v3/get_device_info_with_errors.json":"24cee4b7840e87e12147cbfddf6c361f3b378a15bb85330b339d3be9e17cdbd5","src/test/json/v3/get_miner_status_edevs.json":"2d831c06113f555e0988df994c2e602a053a4aea603dded0db8f0f80e191ca5a","src/test/json/v3/get_miner_status_pools.json":"cd65c2efd3a5ce80b57aae46c420298a34ca06df7ac7f8c36fd556217703d242","src/test/json/v3/get_miner_status_summary.json":"799a94ba13ef54aed0f81a3d041d6c1fa263d4183754b384c69ca12d85a8d3ba","src/test/json/v3/mod.rs":"7ea3a8ff1b81c7a5b0f44f7c12dda880a9aeac5b0e6b56ac4fff4f4a7cbfe451","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"c85da6325b62f061327dc5f7605dd3721c823a9e8a2cfd6a356363dfbc84d66e"}
|
{"$comment":"This file only protects against accidental modifications. It is not a security mechanism and does not protect against malicious changes.","files":{".cargo_vcs_info.json":"30f09ad063df45fdf223aff235fe2da15cb1a7e79e86d7012074153b91662fc4","Cargo.lock":"9d0886791db53421d3218ab72d964145b86cfbe9738eaf09aac5d3c89a1c0190","Cargo.toml":"8c2e9938436850f2e250e8268ed7b385fce903e2077923b207a0560ca3e3242c","Cargo.toml.orig":"891fcfa45e79d6bc4d838c4f3075618f791bd013c99231da48e752b987f409d5","src/backends/mod.rs":"0f5a0ae31d5443d0d0f41a2540def806196238c92d22761b3ad9843cb2e77f45","src/backends/v1/mod.rs":"1ada5892a5758e97d315b7e6550623bd1cf7062c84e701a7145fe4e9b84068a3","src/backends/v1/rpc.rs":"72f9b67c2389ab6e9968e0eb340bd2b6aad9aaf059f4429eb31398863bb87f42","src/backends/v2/mod.rs":"b9c23ad19f8921052b909d4f98e989ee0d0cecc4bd738f47e80404eb3d762656","src/backends/v2/rpc.rs":"52f8d504c236009b020bf33b5550236e36d07b2c73a15bdcfcafa5188e4e1cb6","src/backends/v3/mod.rs":"f19e673c47c2cc366e2ff7782bca93daf750563d62221a12a043b3ee79a15251","src/backends/v3/rpc.rs":"7a5f80aec4af1bcaa0d36e67345aa9acbbd8ead73c0be474f06305358b38e81b","src/error_codes.rs":"b2af610880fb400a9e6297662371a6b3b55077b72cf11115b77fd4d2df44e6a1","src/firmware.rs":"6d002e481ce0a897c0485b9393b0382fcb25811164e893eb8eb67b2ff392ca0d","src/lib.rs":"710b46c9d934f26f900e1366ca1df5f872896e7d8da03569c0f159859e899cc9","src/test/json/mod.rs":"99760925ccfefc40d2455d3567fb1ecfc99e9e55e70478190ef372a954825909","src/test/json/v1/devs.json":"b4fd010f0bae3584efde93387cf2dab5933b499cc30a2dd7635fdc994b56c3b8","src/test/json/v1/get_psu.json":"8c11b6495e0bd5da496dd5c10ca53ec53b2d8fe9a3737f470ec9ce2c1aaf9d99","src/test/json/v1/get_version.json":"c43e947e654792ab191210d50c6f793ee0dd7af41e8cb59f0722b70f32a203bc","src/test/json/v1/mod.rs":"a12ec375a02238d5e26b64e2f7aeb0fc336747d86ae012dc154265ee5afaabbf","src/test/json/v1/pools.json":"b570808a3428a0773d7d2ee322150d8fd0794a33804af970300a7fef128a8a01","src/test/json/v1/status.json":"00ec38dd9f980b7ac0ffd6f815374afdbbed98d601bd8ef18bcf0f76ae0aa853","src/test/json/v1/summary.json":"d6e3e75654eb4019e1f479b3d9cf3097130f1afb85dd3338682c094fd4ab498a","src/test/json/v1/summary_with_errors.json":"1ba682f6ad5c43e41ae22a4069d0f52f04da3f07a18031bf4c07e07b3c59cc97","src/test/json/v2/devs.json":"2d203e41ef6ef337c0c81456b73d08730882c3167403c557c3c9776022a972d1","src/test/json/v2/get_error_code.json":"e90b702fd97bceb4f62dcb8228f75ff5ce930290355dca94eefd7192f7f57009","src/test/json/v2/get_error_code_with_errors.json":"6cb6038366eb3835684421c41be0b2b30ae8ce79a7ed51a85f4f52f70da9df16","src/test/json/v2/get_miner_info.json":"55d2af984833a692f502188ae4df4e41bdc10386b47f921c896a452ef1de9062","src/test/json/v2/get_psu.json":"b43086b65897061521d1f6611e200ef372a1724f9ea1876e347c03d5fb19b8f2","src/test/json/v2/get_version.json":"b17e3a81603b43186b2e15745e6822b6c82b3c6f5928b22f84e683d7728dbfcd","src/test/json/v2/mod.rs":"c847205d076323bbd9698e393d241b08f3cf75d32aae86f7058cf8748266b935","src/test/json/v2/pools.json":"926d34e8dae774473ebfec83d4a38e77ca73231708f07683763e212be7af0580","src/test/json/v2/status.json":"fc268cd23864ef99e84813dbf8eb916b2e6f339351a0ee5dab217cbe02569fc3","src/test/json/v2/summary.json":"4e4c01b986e2960893f58d0f1ea4dce23b8ef88db4985348f7f0183eb4818478","src/test/json/v3/get_device_info.json":"83ac22ea9a11adbceb4c963db80aa62d9a2aa50d019a372394dece817d924cda","src/test/json/v3/get_device_info_with_errors.json":"24cee4b7840e87e12147cbfddf6c361f3b378a15bb85330b339d3be9e17cdbd5","src/test/json/v3/get_miner_status_edevs.json":"2d831c06113f555e0988df994c2e602a053a4aea603dded0db8f0f80e191ca5a","src/test/json/v3/get_miner_status_pools.json":"cd65c2efd3a5ce80b57aae46c420298a34ca06df7ac7f8c36fd556217703d242","src/test/json/v3/get_miner_status_summary.json":"799a94ba13ef54aed0f81a3d041d6c1fa263d4183754b384c69ca12d85a8d3ba","src/test/json/v3/mod.rs":"7ea3a8ff1b81c7a5b0f44f7c12dda880a9aeac5b0e6b56ac4fff4f4a7cbfe451","src/test/mod.rs":"ed52c3d613eabc4a0346bb38bcfdf7a94933d61e368d3c9094821edeab92f81b"},"package":"c85da6325b62f061327dc5f7605dd3721c823a9e8a2cfd6a356363dfbc84d66e"}
|
||||||
+36
-2
@@ -18,6 +18,7 @@ use asic_rs_core::{
|
|||||||
message::{MessageSeverity, MinerMessage},
|
message::{MessageSeverity, MinerMessage},
|
||||||
miner::TuningTarget,
|
miner::TuningTarget,
|
||||||
pool::{PoolData, PoolGroupData, PoolURL},
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
psu::PsuInfo,
|
||||||
},
|
},
|
||||||
traits::{miner::*, model::MinerModel},
|
traits::{miner::*, model::MinerModel},
|
||||||
};
|
};
|
||||||
@@ -193,6 +194,16 @@ impl GetDataLocations for WhatsMinerV1 {
|
|||||||
tag: None,
|
tag: None,
|
||||||
},
|
},
|
||||||
)],
|
)],
|
||||||
|
// PSU identity from get_psu (round 17 R5/G15). WhatsMiner exposes the
|
||||||
|
// model + hw/sw version but not a DC output voltage or rated envelope.
|
||||||
|
DataField::Psu => vec![(
|
||||||
|
RPC_GET_PSU,
|
||||||
|
DataExtractor {
|
||||||
|
func: get_by_pointer,
|
||||||
|
key: Some("/Msg"),
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
DataField::Hashboards => vec![(
|
DataField::Hashboards => vec![(
|
||||||
RPC_DEVS,
|
RPC_DEVS,
|
||||||
DataExtractor {
|
DataExtractor {
|
||||||
@@ -463,6 +474,22 @@ impl GetWattage for WhatsMinerV1 {
|
|||||||
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
// get_psu /Msg -> {model, hw_version, sw_version, ...} (values are strings).
|
||||||
|
// No DC output voltage or rated envelope is exposed, so only identity is set.
|
||||||
|
let d = data.get(&DataField::Psu)?;
|
||||||
|
let s = |k: &str| d.pointer(k).and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string);
|
||||||
|
let psu = PsuInfo {
|
||||||
|
model: s("/model").or_else(|| s("/name")),
|
||||||
|
version: s("/hw_version").or_else(|| s("/sw_version")),
|
||||||
|
voltage_min: None,
|
||||||
|
voltage_max: None,
|
||||||
|
output_voltage: None,
|
||||||
|
output_current: None,
|
||||||
|
};
|
||||||
|
(psu != PsuInfo::default()).then_some(psu)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
impl GetTuningTarget for WhatsMinerV1 {
|
impl GetTuningTarget for WhatsMinerV1 {
|
||||||
fn parse_tuning_target(&self, data: &HashMap<DataField, Value>) -> Option<TuningTarget> {
|
fn parse_tuning_target(&self, data: &HashMap<DataField, Value>) -> Option<TuningTarget> {
|
||||||
@@ -805,8 +832,8 @@ mod integration_tests {
|
|||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::test::json::v1::{
|
use crate::test::json::v1::{
|
||||||
DEVS_COMMAND, GET_PSU_COMMAND, GET_VERSION_COMMAND, POOLS_COMMAND, STATUS_COMMAND,
|
DEVS_COMMAND, GET_ERROR_CODE_COMMAND, GET_PSU_COMMAND, GET_VERSION_COMMAND, POOLS_COMMAND,
|
||||||
SUMMARY_COMMAND, SUMMARY_WITH_ERRORS_COMMAND,
|
STATUS_COMMAND, SUMMARY_COMMAND, SUMMARY_WITH_ERRORS_COMMAND,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
@@ -943,6 +970,13 @@ mod integration_tests {
|
|||||||
},
|
},
|
||||||
Value::from_str(GET_PSU_COMMAND)?,
|
Value::from_str(GET_PSU_COMMAND)?,
|
||||||
);
|
);
|
||||||
|
results.insert(
|
||||||
|
MinerCommand::RPC {
|
||||||
|
command: "get_error_code",
|
||||||
|
parameters: None,
|
||||||
|
},
|
||||||
|
Value::from_str(GET_ERROR_CODE_COMMAND)?,
|
||||||
|
);
|
||||||
|
|
||||||
let mock_api = MockAPIClient::new(results);
|
let mock_api = MockAPIClient::new(results);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ use asic_rs_core::{
|
|||||||
message::{MessageSeverity, MinerMessage},
|
message::{MessageSeverity, MinerMessage},
|
||||||
miner::{MiningMode, TuningTarget},
|
miner::{MiningMode, TuningTarget},
|
||||||
pool::{PoolData, PoolGroupData, PoolURL},
|
pool::{PoolData, PoolGroupData, PoolURL},
|
||||||
|
psu::PsuInfo,
|
||||||
},
|
},
|
||||||
traits::{miner::*, model::MinerModel},
|
traits::{miner::*, model::MinerModel},
|
||||||
util::is_expected_write_error,
|
util::is_expected_write_error,
|
||||||
@@ -205,6 +206,15 @@ impl GetDataLocations for WhatsMinerV2 {
|
|||||||
tag: None,
|
tag: None,
|
||||||
},
|
},
|
||||||
)],
|
)],
|
||||||
|
// PSU identity from get_psu (round 17 R5/G15): model + hw/sw version.
|
||||||
|
DataField::Psu => vec![(
|
||||||
|
RPC_GET_PSU,
|
||||||
|
DataExtractor {
|
||||||
|
func: get_by_pointer,
|
||||||
|
key: Some("/Msg"),
|
||||||
|
tag: None,
|
||||||
|
},
|
||||||
|
)],
|
||||||
DataField::Hashboards => vec![(
|
DataField::Hashboards => vec![(
|
||||||
RPC_DEVS,
|
RPC_DEVS,
|
||||||
DataExtractor {
|
DataExtractor {
|
||||||
@@ -471,6 +481,22 @@ impl GetWattage for WhatsMinerV2 {
|
|||||||
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
fn parse_wattage(&self, data: &HashMap<DataField, Value>) -> Option<Power> {
|
||||||
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
data.extract_map::<f64, _>(DataField::Wattage, Power::from_watts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_psu(&self, data: &HashMap<DataField, Value>) -> Option<PsuInfo> {
|
||||||
|
// get_psu /Msg -> {model, hw_version, sw_version} (string values). No DC
|
||||||
|
// output voltage or rated envelope is exposed, so only identity is set.
|
||||||
|
let d = data.get(&DataField::Psu)?;
|
||||||
|
let s = |k: &str| d.pointer(k).and_then(|v| v.as_str()).filter(|s| !s.is_empty()).map(str::to_string);
|
||||||
|
let psu = PsuInfo {
|
||||||
|
model: s("/model").or_else(|| s("/name")),
|
||||||
|
version: s("/hw_version").or_else(|| s("/sw_version")),
|
||||||
|
voltage_min: None,
|
||||||
|
voltage_max: None,
|
||||||
|
output_voltage: None,
|
||||||
|
output_current: None,
|
||||||
|
};
|
||||||
|
(psu != PsuInfo::default()).then_some(psu)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// Parses tuning target from V2 summary data.
|
/// Parses tuning target from V2 summary data.
|
||||||
/// Low/High → MiningMode, Normal/unknown/empty → Power(limit).
|
/// Low/High → MiningMode, Normal/unknown/empty → Power(limit).
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"Code": 131,
|
||||||
|
"Description": "",
|
||||||
|
"Msg": {
|
||||||
|
"error_code": [
|
||||||
|
{
|
||||||
|
"110": "2024-06-15 09:15:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"600": "2024-06-15 10:30:00"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"STATUS": "S",
|
||||||
|
"When": 1773871985
|
||||||
|
}
|
||||||
@@ -6,4 +6,5 @@ pub(crate) const POOLS_COMMAND: &str = include_str!("pools.json");
|
|||||||
pub(crate) const DEVS_COMMAND: &str = include_str!("devs.json");
|
pub(crate) const DEVS_COMMAND: &str = include_str!("devs.json");
|
||||||
pub(crate) const GET_VERSION_COMMAND: &str = include_str!("get_version.json");
|
pub(crate) const GET_VERSION_COMMAND: &str = include_str!("get_version.json");
|
||||||
pub(crate) const GET_PSU_COMMAND: &str = include_str!("get_psu.json");
|
pub(crate) const GET_PSU_COMMAND: &str = include_str!("get_psu.json");
|
||||||
|
pub(crate) const GET_ERROR_CODE_COMMAND: &str = include_str!("get_error_code.json");
|
||||||
pub(crate) const SUMMARY_WITH_ERRORS_COMMAND: &str = include_str!("summary_with_errors.json");
|
pub(crate) const SUMMARY_WITH_ERRORS_COMMAND: &str = include_str!("summary_with_errors.json");
|
||||||
|
|||||||
Reference in New Issue
Block a user