Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7a77cbed8 | ||
|
|
606ae85781 | ||
|
|
ad9b0dc868 | ||
|
|
aaf049bbfc | ||
|
|
8b7b0c70b4 | ||
|
|
3ae80efdde | ||
|
|
7901d82c4b | ||
|
|
8f7aab3f80 |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M240 8L48 296h112L128 504 336 216H224L272 8z"/></svg>
|
||||
|
After Width: | Height: | Size: 145 B |
@@ -0,0 +1 @@
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="511.104248pt" height="512.144915pt" viewBox="0 0 511.104248 512.144915" preserveAspectRatio="xMidYMid meet"><g transform="translate(-0.500000,511.997478) scale(0.100000,-0.100000)" fill="currentColor" stroke="none"><path d="M82 5103 c-52 -25 -77 -69 -77 -133 0 -41 6 -63 22 -86 49 -68 -31 -64 1237 -64 l1146 0 0 -150 0 -150 -323 0 c-292 0 -332 -2 -403 -20 -201 -52 -370 -228 -414 -432 -8 -34 -11 -94 -8 -155 5 -90 12 -119 52 -214 6 -14 -9 -17 -121 -22 -142 -7 -205 -22 -304 -73 -123 -65 -229 -192 -272 -329 -33 -106 -30 -264 7 -360 15 -38 30 -77 32 -85 4 -12 -9 -20 -49 -33 -76 -24 -163 -83 -228 -156 -160 -176 -193 -424 -86 -638 61 -123 195 -242 315 -280 40 -13 52 -21 48 -33 -2 -8 -17 -46 -32 -85 -38 -95 -41 -253 -7 -360 56 -178 206 -323 393 -380 32 -9 108 -19 182 -22 l126 -6 -25 -66 c-31 -81 -42 -233 -23 -319 45 -210 221 -387 433 -437 94 -22 1622 -22 1716 0 108 26 188 71 272 155 126 125 176 255 167 437 -5 90 -12 119 -52 214 -6 14 9 17 122 22 147 6 246 33 337 92 110 70 199 186 238 310 33 106 30 264 -7 360 -15 39 -30 77 -32 85 -4 12 9 20 49 33 211 67 377 303 377 537 0 233 -167 470 -378 537 -40 13 -52 21 -48 33 2 8 17 47 32 85 37 96 40 254 7 360 -39 122 -130 241 -240 311 -89 58 -188 85 -335 91 -113 5 -128 8 -122 22 40 95 47 124 52 214 6 119 -7 184 -55 287 -46 97 -157 210 -254 257 -117 58 -159 63 -516 63 l-323 0 0 150 0 150 618 0 617 0 210 -211 c116 -116 227 -219 247 -230 122 -63 256 59 207 187 -5 16 -60 79 -121 141 l-112 113 313 0 c346 0 360 2 404 64 31 43 31 129 0 172 -50 70 173 64 -2535 64 -2230 0 -2446 -2 -2476 -17z m3337 -918 c94 -52 141 -134 141 -244 -1 -102 -60 -192 -155 -237 l-50 -24 -795 0 -795 0 -50 24 c-61 28 -116 87 -140 149 -26 70 -17 172 21 235 31 49 104 105 158 121 18 6 363 9 821 8 l790 -2 54 -30z m649 -834 c95 -43 162 -147 162 -251 0 -66 -30 -131 -85 -187 -84 -83 -84 -83 -593 -83 l-434 0 -55 50 c-281 257 -719 257 -1005 0 l-57 -51 -453 3 c-452 3 -453 3 -500 26 -92 45 -158 151 -158 252 0 119 99 235 221 259 24 5 688 8 1474 8 l1430 -2 53 -24z m-1317 -623 c130 -64 224 -184 249 -317 5 -29 10 -98 10 -151 0 -53 -5 -122 -10 -151 -25 -133 -119 -253 -249 -317 -73 -36 -77 -37 -191 -37 -114 0 -118 1 -191 37 -125 62 -210 164 -244 293 -20 79 -20 271 0 350 39 149 147 263 300 318 38 13 74 17 151 15 93 -3 107 -6 175 -40z m-924 -235 c-16 -51 -16 -415 0 -465 l11 -38 -547 0 -548 0 -62 31 c-87 43 -138 117 -148 213 -11 110 44 211 145 263 l64 33 548 0 548 0 -11 -37z m2580 24 c60 -22 117 -72 148 -128 26 -46 30 -64 30 -129 0 -65 -4 -83 -30 -129 -31 -56 -88 -106 -148 -128 -23 -8 -187 -12 -578 -12 l-546 -1 13 68 c17 86 17 318 0 405 l-13 67 546 -1 c391 0 555 -4 578 -12z m-2349 -878 c286 -256 725 -255 1006 1 l55 51 453 -3 c452 -3 453 -3 500 -26 90 -44 158 -151 158 -247 0 -99 -69 -204 -162 -246 l-53 -24 -1455 0 -1455 0 -53 24 c-95 43 -162 147 -162 251 0 66 30 131 85 187 83 82 79 81 588 82 l439 1 56 -51z m1342 -820 c97 -43 160 -138 160 -240 0 -111 -47 -192 -141 -244 l-54 -30 -783 -3 c-518 -2 -796 1 -822 8 -59 16 -131 70 -164 122 -38 63 -47 165 -21 235 24 62 79 121 140 149 l50 24 795 0 c778 0 796 -1 840 -21z"/></g></svg>
|
||||
|
After Width: | Height: | Size: 3.0 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M181.5 261.1L194.4 267.5C200.3 270.5 206.8 272 213.5 272C237 272 256.1 252.9 256.1 229.4L256.1 208C256.1 172.7 227.4 144 192.1 144L128.1 144C92.8 144 64.1 172.7 64.1 208L64.1 229.4C64.1 252.9 83.2 272 106.7 272C113.3 272 119.8 270.5 125.8 267.5C135.1 262.8 142.2 259.3 147 256.9L135.1 249C130.6 246 128 241 128 235.7L128 232C128 218.7 138.7 208 152 208L168 208C181.3 208 192 218.7 192 232L192 235.7C192 241 189.3 246 184.9 249L173.1 256.9L181.5 261.1zM172.9 310.5L160 304.1L147.1 310.5C134.5 316.8 120.6 320.1 106.6 320.1C103 320.1 99.5 319.9 96 319.5L96 320.1C96 355.4 124.7 384.1 160 384.1L224 384.1C241.7 384.1 256 398.4 256 416.1C256 433.8 241.7 448.1 224 448.1L384 448.1L384 384.1C384 360.4 396.9 339.7 416 328.7C425.4 323.3 436.3 320.1 448 320.1L448 304.1C448 277.6 469.5 256.1 496 256.1C504.8 256.1 512 263.3 512 272.1L512 368.1C512 376.9 519.2 384.1 528 384.1C536.8 384.1 544 376.9 544 368.1L544 268.4C544 220.2 513.2 177.4 467.4 162.1L458.9 159.3C450.9 156.6 446.3 148.2 448.5 140C450.7 131.8 458.8 126.8 467.1 128.4L487 132.4C576 150.1 640 228.2 640 318.9L640 320L640 320C640 443.7 539.7 544 416 544L255.4 544C132 544 32 444 32 320.6L32 280.8C21.9 266.2 16 248.5 16 229.4L16 208L16 206.6C6.7 203.3 0 194.5 0 184C0 170.7 10.7 160 24 160L26.8 160C44.8 122.2 83.3 96 128 96L192 96C236.7 96 275.2 122.2 293.2 160L296 160C309.3 160 320 170.7 320 184C320 194.5 313.3 203.3 304 206.6L304 208L304 229.4C304 230.8 304 232.2 303.9 233.7C315.9 227.5 329.6 224.1 344 224.1L352 224.1C369.7 224.1 384 238.4 384 256.1C384 273.8 369.7 288.1 352 288.1L344 288.1C330.7 288.1 320 298.8 320 312.1L320 320.1L376.4 320.1C361.2 337.1 352 359.5 352 384.1L320 384.1C277.7 384.1 241.8 356.7 229 318.8C223.9 319.7 218.7 320.1 213.4 320.1C199.3 320.1 185.5 316.8 172.9 310.5zM96 192C104.8 192 112 199.2 112 208C112 216.8 104.8 224 96 224C87.2 224 80 216.8 80 208C80 199.2 87.2 192 96 192zM208 208C208 199.2 215.2 192 224 192C232.8 192 240 199.2 240 208C240 216.8 232.8 224 224 224C215.2 224 208 216.8 208 208z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M460.7 39.3l-2.2-2.1c-4.7-4.6-11.5-6.4-17.9-4.7s-11.4 6.6-13.1 13l-.8 2.9c-3.3 11.8-5.1 23.7-5.5 35.6 24.3 20.6 42.9 47.8 53.3 78.8-8.2-1.9-16.5-2.9-25-2.9-.6 0-1.1 0-1.7 0-18.4-44-56.5-77.4-103.6-89.3l-3.4-.9c-6.2-1.6-12.9-.6-18.5 2.6-10.8 6.2-15.6 19.5-11.2 31.1 14.9 39.5 44.3 71.4 81.4 89.7-3.7 6.6-6.4 14-7.6 21.8L279.7 154.9c-30.9-17.7-65.9-26.9-101.5-26.9-32.3 0-62.2 16.8-78.9 44.4-10.3-12.5-25.8-20.4-43.2-20.4-30.9 0-56 25.1-56 56s25.1 56 56 56c11.3 0 21.8-3.3 30.6-9.1 4.9 17.2 14.5 33.1 28.4 45.9L257.2 431.2C269 442 284.4 448 300.4 448L416 448c17.7 0 32-14.3 32-32s-14.3-32-32-32l-96 0 0-43.5c0-42.9-28.4-80.5-69.6-92.3l-30.8-8.8c-8.5-2.4-13.4-11.3-11-19.8s11.3-13.4 19.8-11l30.8 8.8c55 15.7 92.8 65.9 92.8 123.1l0 15.7 56-32.4 6.4-3.7 101.3 0c33.3 0 60.3-27 60.3-60.3 0-18.1-8.2-35.3-22.2-46.7l-34.6-28.2c-4.6-3.7-9.4-7.1-14.5-10 8.4-49.3-7.8-100-43.9-135.5zm-318.5 382c-14.7 9.8-18.7 29.7-8.9 44.4s29.7 18.7 44.4 8.9l46-30.7-48.6-44.5-32.9 22zM480 240a16 16 0 1 1 32 0 16 16 0 1 1 -32 0z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M384 249.2c0 21.4-17.4 38.8-38.8 38.8L70.8 288C49.4 288 32 270.6 32 249.2L32 208c0-97.2 78.8-176 176-176s176 78.8 176 176l0 41.2zM480 288c-2 0-4-.1-5.9-.3-16.3 53.3-64.3 92.7-122.1 96l0 56.2c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-56-32 0 0 56c0 22.1-17.9 40-40 40l-48 0c-22.1 0-40-17.9-40-40l0-56-32 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l312 0c39.8 0 72-32.2 72-72l0-72c0-35.3 28.7-64 64-64 53 0 96 43 96 96l0 16c0 35.3-28.7 64-64 64l-32 0zm16-64a16 16 0 1 0 0-32 16 16 0 1 0 0 32z"/></svg>
|
||||
|
After Width: | Height: | Size: 761 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--! Font Awesome Pro 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2026 Fonticons, Inc. --><path fill="currentColor" d="M205 64L434.9 64L439.3 82.4L475.6 234.9C478.5 247 480 259.5 480 272C480 352.2 421 418.7 344 430.2L344 560L432 560L432 608L208 608L208 560L296 560L296 430.2C219 418.6 160 352.2 160 272C160 259.5 161.5 247 164.4 234.9L200.7 82.4L205 64zM243 112L211 246C209 254.5 208 263.2 208 272C208 333.9 258.2 384 320 384C381.8 384 432 333.8 432 272C432 263.3 431 254.5 429 246L397.1 112L371.3 112L384.1 176L320.1 216L352.1 320L256.1 216L328.1 144L306.8 112L243.1 112z"/></svg>
|
||||
|
After Width: | Height: | Size: 721 B |
@@ -546,7 +546,7 @@ impl Column {
|
||||
Column::Serial => "Serial",
|
||||
Column::ApiVersion => "API ver",
|
||||
Column::Cpu => "CPU",
|
||||
Column::BoardCode => "Board",
|
||||
Column::BoardCode => "Control Board",
|
||||
Column::Algorithm => "Algorithm",
|
||||
Column::Pic => "PIC",
|
||||
Column::Locked => "Access",
|
||||
@@ -682,7 +682,21 @@ impl Column {
|
||||
Column::FanCount => SortKey::Num(r.fan_count.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::ExpectedFans => SortKey::Num(r.expected_fans.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::TotalChips => SortKey::Num(r.total_chips.map(|v| v as f64).unwrap_or(none)),
|
||||
Column::Hashboards => SortKey::Num(r.hashboards.map(|v| v as f64).unwrap_or(none)),
|
||||
// The Boards column shows per-hashboard health dots, so sort by the
|
||||
// number of ONLINE (green) boards -- surfacing units with dead/missing
|
||||
// boards -- with the total board count as a tiebreaker (so full-health
|
||||
// units still order by how many boards they have). Falls back to the
|
||||
// reported board count when no per-board health is available (round 11).
|
||||
Column::Hashboards => {
|
||||
if r.board_status.is_empty() {
|
||||
SortKey::Num(r.hashboards.map(|v| v as f64).unwrap_or(none))
|
||||
} else {
|
||||
let online =
|
||||
r.board_status.iter().filter(|h| matches!(h, BoardHealth::Ok)).count();
|
||||
let total = r.board_status.len();
|
||||
SortKey::Num((online * 100 + total) as f64)
|
||||
}
|
||||
}
|
||||
Column::Uptime => SortKey::Num(if r.uptime_secs > 0 { r.uptime_secs as f64 } else { none }),
|
||||
Column::BestShare => SortKey::Num(r.best_share.unwrap_or(none)),
|
||||
Column::SessionBestShare => SortKey::Num(r.session_best_share.unwrap_or(none)),
|
||||
|
||||
@@ -25,17 +25,28 @@ pub struct SshCreds {
|
||||
pub pass: String,
|
||||
}
|
||||
|
||||
/// Which I2C bus to probe, chosen from the control-board family. AMLogic uses
|
||||
/// i2c-1, BeagleBone uses i2c-0; for anything else (Xilinx/CVITek/unknown) we
|
||||
/// try both. The wiki confirms the AML/BB buses; Zynx/CVITek are unconfirmed.
|
||||
/// I2C buses to probe for the hashboard MCU/LM75 at 0x48, most-likely first,
|
||||
/// chosen from the control-board family. `probe_pic` tries them in order and
|
||||
/// stops at the first bus that classifies definitively, so extra fallbacks only
|
||||
/// cost an SSH round-trip when earlier buses are absent/indeterminate.
|
||||
///
|
||||
/// Confirmed live (2026-09-19): a VNish CVITek S19k Pro exposes the hashboard
|
||||
/// MCU on i2c-3 (i2c-4 is the second, usually empty); its buses are i2c-3/i2c-4,
|
||||
/// NOT i2c-0/i2c-1 -- the earlier CVITek -> [1,0] guess never found the MCU,
|
||||
/// which is why PIC detection appeared not to work. AMLogic=i2c-1 and
|
||||
/// BeagleBone=i2c-0 are from the wiki; buses vary across firmware, so each family
|
||||
/// also lists the others as fallbacks.
|
||||
pub fn bus_candidates(control_board: &str) -> Vec<u8> {
|
||||
let cb = control_board.to_lowercase();
|
||||
if cb.contains("amlogic") || cb.contains("aml") {
|
||||
vec![1]
|
||||
if cb.contains("cvi") {
|
||||
vec![3, 4, 1, 0]
|
||||
} else if cb.contains("amlogic") || cb.contains("aml") {
|
||||
vec![1, 3, 4, 0]
|
||||
} else if cb.contains("beaglebone") || cb.contains("bb") {
|
||||
vec![0]
|
||||
vec![0, 1, 3, 4]
|
||||
} else {
|
||||
vec![1, 0]
|
||||
// Xilinx / unknown: try the common buses.
|
||||
vec![1, 0, 3, 4]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,9 +226,13 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn bus_from_control_board() {
|
||||
assert_eq!(bus_candidates("AMLogic"), vec![1]);
|
||||
assert_eq!(bus_candidates("BeagleBone Black"), vec![0]);
|
||||
assert_eq!(bus_candidates("Xilinx"), vec![1, 0]);
|
||||
assert_eq!(bus_candidates(""), vec![1, 0]);
|
||||
// Most-likely bus first, then fallbacks. CVITek's i2c-3 first is the live
|
||||
// fix; AMLogic i2c-1 and BeagleBone i2c-0 keep their wiki-confirmed lead.
|
||||
assert_eq!(bus_candidates("CVI (C88)"), vec![3, 4, 1, 0]);
|
||||
assert_eq!(bus_candidates("CVITek"), vec![3, 4, 1, 0]);
|
||||
assert_eq!(bus_candidates("AMLogic")[0], 1);
|
||||
assert_eq!(bus_candidates("BeagleBone Black")[0], 0);
|
||||
assert_eq!(bus_candidates("Xilinx")[0], 1);
|
||||
assert_eq!(bus_candidates("")[0], 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,15 +449,19 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
||||
.as_ref()
|
||||
.map(|t| t.as_celsius())
|
||||
.unwrap_or(0.0);
|
||||
// Per-hashboard chip temperature (hottest chip per board, falling back to
|
||||
// the board/PCB temp), for the "77 / 64 / 74" Chip-temp cell.
|
||||
// Per-hashboard temperature for the "77 / 64 / 74" Chip-temp cell. Prefer the
|
||||
// board/PCB temperature over the hottest-chip (outlet) reading: WhatsMiner's
|
||||
// outlet_chip is the max chip temp (~100C on the hottest board), which read
|
||||
// alarmingly high and didn't match the temperature the miner itself reports;
|
||||
// the board temperature (~60-79C) is the figure the miner's own UI shows
|
||||
// (round 12 #3). Falls back to the chip temp when no board temp is reported.
|
||||
let board_temps: Vec<f64> = data
|
||||
.hashboards
|
||||
.iter()
|
||||
.filter_map(|b| {
|
||||
b.outlet_chip_temperature
|
||||
b.board_temperature
|
||||
.as_ref()
|
||||
.or(b.board_temperature.as_ref())
|
||||
.or(b.outlet_chip_temperature.as_ref())
|
||||
.map(|t| t.as_celsius())
|
||||
})
|
||||
.filter(|&t| t > 0.0)
|
||||
@@ -606,7 +610,22 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
||||
submodel,
|
||||
mac: data.mac.map(|m| m.to_string()).unwrap_or_default(),
|
||||
hostname: data.hostname.clone().unwrap_or_default(),
|
||||
serial: data.serial_number.clone().unwrap_or_default(),
|
||||
serial: {
|
||||
// Some miners report a placeholder serial ("N/A", "none", ...); show
|
||||
// those as an empty cell rather than the literal placeholder (round 12).
|
||||
let s = data.serial_number.clone().unwrap_or_default();
|
||||
let t = s.trim();
|
||||
if t.is_empty()
|
||||
|| t.eq_ignore_ascii_case("n/a")
|
||||
|| t.eq_ignore_ascii_case("na")
|
||||
|| t.eq_ignore_ascii_case("none")
|
||||
|| t.eq_ignore_ascii_case("null")
|
||||
{
|
||||
String::new()
|
||||
} else {
|
||||
s
|
||||
}
|
||||
},
|
||||
firmware,
|
||||
fw_version,
|
||||
api_version: data.api_version.clone().unwrap_or_default(),
|
||||
|
||||
+89
-27
@@ -285,6 +285,49 @@ fn encode_light_dot(pal: &Palette, flashing: Option<bool>) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
// KPI card icons (round 11 #15). The animal/wine-glass SVGs are Font Awesome Pro
|
||||
// (operator-supplied); bolt/hive are matching in-repo SVGs. All use
|
||||
// fill="currentColor", recoloured per card at render time.
|
||||
const SVG_RABBIT: &str = include_str!("../assets/icons/rabbit.svg");
|
||||
const SVG_TURTLE: &str = include_str!("../assets/icons/turtle.svg");
|
||||
const SVG_WINE_CRACK: &str = include_str!("../assets/icons/wine-glass-crack.svg");
|
||||
const SVG_OTTER: &str = include_str!("../assets/icons/otter.svg");
|
||||
const SVG_HIVE: &str = include_str!("../assets/icons/hive.svg");
|
||||
const SVG_BOLT: &str = include_str!("../assets/icons/bolt.svg");
|
||||
|
||||
/// KPI card minimum widths. The count cards (Total/Hashing/...) are narrow; the
|
||||
/// two wide cards (SHA-256 Hashrate, Est. power) need more room so their
|
||||
/// icon + units-bearing value never clips (round 12 #2). The wide floor fits the
|
||||
/// widest realistic value the card can show -- a ~20px icon + 5px gap + a value
|
||||
/// text up to "118.0 PH" (~127px at 19pt bold) + the card's 16px side inset --
|
||||
/// so the units ("kW"/"PH"/...) stay visible instead of being squeezed off; the
|
||||
/// row collapses the wide cards entirely (see `on_resize`) rather than shrink
|
||||
/// them below this and clip.
|
||||
const KPI_MIN: i32 = 116;
|
||||
const KPI_WIDE_MIN: i32 = 176;
|
||||
|
||||
/// Recolour an SVG to the KPI card's colour (round 11 #15). Some Font Awesome
|
||||
/// exports use fill="currentColor" (replaced here); others omit fill entirely and
|
||||
/// default to black, so a root `fill` is also injected for shapes to inherit.
|
||||
fn svg_recolored(svg: &str, color: (u8, u8, u8)) -> String {
|
||||
let hex = format!("#{:02X}{:02X}{:02X}", color.0, color.1, color.2);
|
||||
let s = svg.replace("currentColor", &hex);
|
||||
s.replacen("<svg ", &format!("<svg fill=\"{hex}\" "), 1)
|
||||
}
|
||||
|
||||
/// Width to render an SVG at, preserving its viewBox aspect ratio at height `h`.
|
||||
fn svg_width_for_height(svg: &str, h: i32) -> i32 {
|
||||
svg.split("viewBox=\"")
|
||||
.nth(1)
|
||||
.and_then(|s| s.split('"').next())
|
||||
.and_then(|vb| {
|
||||
let n: Vec<f64> = vb.split_whitespace().filter_map(|x| x.parse().ok()).collect();
|
||||
(n.len() == 4 && n[3] > 0.0).then(|| ((h as f64) * n[2] / n[3]).round() as i32)
|
||||
})
|
||||
.unwrap_or(h)
|
||||
.max(1)
|
||||
}
|
||||
|
||||
/// Build the segment-encoded cell text for the Cooling column: each fan's RPM
|
||||
/// gets its own grey-to-blue colour by speed, and the "/" separators between
|
||||
/// them stay in the default text colour.
|
||||
@@ -522,13 +565,13 @@ pub fn build(frame: Widget) -> App {
|
||||
// min size floors them at their largest content's width.
|
||||
let kpi_row = Widget::box_sizer(false);
|
||||
let mut kpi_cards: Vec<(Widget, Widget, Widget, ColorKind)> = Vec::new();
|
||||
let mut mk_card = |label: &str, kind: ColorKind, icon: Option<i32>| -> (Widget, Widget) {
|
||||
let mut mk_card = |label: &str, kind: ColorKind, icon: Option<&'static str>| -> (Widget, Widget) {
|
||||
let vc = kind_color(&pal, kind);
|
||||
let card = Widget::panel(panel);
|
||||
card.set_bg(pal.card_bg.0, pal.card_bg.1, pal.card_bg.2);
|
||||
// Min-content floor (the widest label/value); cards grow equally past
|
||||
// this to fill the window (proportion 1 + EXPAND on add).
|
||||
card.set_min_size(116, 62);
|
||||
card.set_min_size(KPI_MIN, 62);
|
||||
let cs = Widget::box_sizer(true);
|
||||
let value = Widget::static_text(card, "0");
|
||||
value.set_font_size(19);
|
||||
@@ -559,9 +602,12 @@ pub fn build(frame: Widget) -> App {
|
||||
let value_row = {
|
||||
let row = Widget::box_sizer(false);
|
||||
row.add_stretch(1);
|
||||
if let Some(ik) = icon {
|
||||
let icol = if matches!(kind, ColorKind::Neutral) { pal.amber } else { vc };
|
||||
let ic = Widget::kpi_icon(card, ik, icol);
|
||||
if let Some(svg) = icon {
|
||||
// Icon takes the card's value colour, so each icon matches its KPI
|
||||
// text (otter = paused colour, bolt = est-power colour, etc.).
|
||||
let icol = vc;
|
||||
let h = 20;
|
||||
let ic = Widget::svg_icon(card, &svg_recolored(svg, icol), svg_width_for_height(svg, h), h);
|
||||
row.add(ic, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_RIGHT, 5);
|
||||
}
|
||||
row.add(value, 0, sf::ALIGN_CENTRE_VERTICAL, 0);
|
||||
@@ -577,16 +623,23 @@ pub fn build(frame: Widget) -> App {
|
||||
kpi_cards.push((card, value, lbl, kind));
|
||||
(card, value)
|
||||
};
|
||||
// Icons (round 11 #15): rabbit=hashing, turtle=slow, broken glass=not
|
||||
// Icons (round 11 #15): rabbit=hashing, turtle=slow, cracked wine glass=not
|
||||
// hashing, otter=paused, hive=hashrate, lightning=power; Total has none.
|
||||
let (_card_total, kpi_total) = mk_card("Total", ColorKind::Neutral, None);
|
||||
let (card_hashing, kpi_hashing) = mk_card("Hashing", ColorKind::Green, Some(0));
|
||||
let (card_slow, kpi_slow) = mk_card("Slow", ColorKind::Amber, Some(1));
|
||||
let (card_not, kpi_not) = mk_card("Not hashing", ColorKind::Red, Some(2));
|
||||
let (card_paused, kpi_paused) = mk_card("Paused", ColorKind::Blue, Some(3));
|
||||
let (card_hashrate, kpi_hashrate) = mk_card("SHA-256 Hashrate", ColorKind::Accent, Some(4));
|
||||
let (_card_power, kpi_power) = mk_card("Est. power", ColorKind::Neutral, Some(5));
|
||||
let (card_hashing, kpi_hashing) = mk_card("Hashing", ColorKind::Green, Some(SVG_RABBIT));
|
||||
let (card_slow, kpi_slow) = mk_card("Slow", ColorKind::Amber, Some(SVG_TURTLE));
|
||||
let (card_not, kpi_not) = mk_card("Not hashing", ColorKind::Red, Some(SVG_WINE_CRACK));
|
||||
let (card_paused, kpi_paused) = mk_card("Paused", ColorKind::Blue, Some(SVG_OTTER));
|
||||
// Total-hashrate value renders in the default (black) text colour, not accent
|
||||
// (round 12 #1); it still dims with focus like the other neutral cards.
|
||||
let (card_hashrate, kpi_hashrate) = mk_card("SHA-256 Hashrate", ColorKind::Neutral, Some(SVG_HIVE));
|
||||
let (card_power, kpi_power) = mk_card("Est. power", ColorKind::Neutral, Some(SVG_BOLT));
|
||||
drop(mk_card);
|
||||
// The two wide cards carry a units-bearing value (icon + e.g. "685 TH" /
|
||||
// "21.3 kW"); give them a larger min width so the value never clips, and
|
||||
// collapse them before the row would squeeze them below it (round 12 #2).
|
||||
card_hashrate.set_min_size(KPI_WIDE_MIN, 62);
|
||||
card_power.set_min_size(KPI_WIDE_MIN, 62);
|
||||
let _ = (card_hashing, card_slow, card_not, card_paused);
|
||||
// The hashrate card is kpi_cards[5] in build order (Total, Hashing, Slow,
|
||||
// Not, Paused, Hashrate, Power); its caption is retitled per algorithm.
|
||||
@@ -795,23 +848,32 @@ impl App {
|
||||
/// seven cards at their minimum width, the two wide cards are hidden so the
|
||||
/// five miner-count cards fill the row; they return when there is room again.
|
||||
fn on_resize(&mut self, width: i32) {
|
||||
// Each card is a ~116px min + BORDER_ALL*2 (8px); the row itself is
|
||||
// inset by the root border. Below the width needed for all seven, drop
|
||||
// the two wide cards.
|
||||
const CARD_SLOT: i32 = 116 + 8;
|
||||
let need_all = CARD_SLOT * 7 + 12;
|
||||
// Each card occupies its min width + BORDER_ALL*2 (8px); the row itself is
|
||||
// inset by the root border (~12px). Collapse the two wide cards below the
|
||||
// width where all seven fit at their mins, so the wide cards' units-bearing
|
||||
// value never gets squeezed/clipped (round 12 #2) -- they drop out cleanly
|
||||
// instead.
|
||||
let need_all = 5 * (KPI_MIN + 8) + 2 * (KPI_WIDE_MIN + 8) + 12;
|
||||
let want_collapsed = width < need_all;
|
||||
if want_collapsed == self.kpi_collapsed {
|
||||
return;
|
||||
if want_collapsed != self.kpi_collapsed {
|
||||
self.kpi_collapsed = want_collapsed;
|
||||
let show = !want_collapsed;
|
||||
// kpi_cards[5] = Hashrate card, [6] = Est. power card (build order).
|
||||
let hashrate_card = self.kpi_cards[5].0;
|
||||
let power_card = self.kpi_cards[6].0;
|
||||
self.kpi_row.sizer_show(hashrate_card, show);
|
||||
self.kpi_row.sizer_show(power_card, show);
|
||||
self.panel.layout();
|
||||
}
|
||||
// A nested wxPanel does not re-run its own sizer when the parent resizes
|
||||
// it, so the value/label centring spacers keep the slot sizes they were
|
||||
// given at the previous width. Re-layout each card here so the value
|
||||
// (which may carry a units suffix like "kW"/"PH") stays centred and its
|
||||
// full text is allocated -- otherwise the suffix reads as clipped when
|
||||
// the row is squeezed (round 12 #2).
|
||||
for (card, _, _, _) in &self.kpi_cards {
|
||||
card.layout();
|
||||
}
|
||||
self.kpi_collapsed = want_collapsed;
|
||||
let show = !want_collapsed;
|
||||
// kpi_cards[5] = Hashrate card, [6] = Est. power card (build order).
|
||||
let hashrate_card = self.kpi_cards[5].0;
|
||||
let power_card = self.kpi_cards[6].0;
|
||||
self.kpi_row.sizer_show(hashrate_card, show);
|
||||
self.kpi_row.sizer_show(power_card, show);
|
||||
self.panel.layout();
|
||||
}
|
||||
|
||||
pub fn rebuild_table(&mut self) {
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
Subject: [PATCH 0003] antminer: recognise VNish short control-board platforms (CV, XIL)
|
||||
|
||||
Round-11 #5 -- VNish reports the control board in short form via /api/v1/info
|
||||
"platform": "cv" (CVITek), "xil" (Xilinx), "aml" (AMLogic). asic-rs's
|
||||
AntMinerControlBoard::parse matched the full names (CVITEK, XILINX) but not the
|
||||
short "CV"/"XIL", so VNish CVITek and Xilinx boards showed a blank control board
|
||||
(the "can't scan XIL or CVITek boards" bug). Add the short forms. Verified live:
|
||||
S19k Pro platform "cv" -> CVITek, S19 platform "xil" -> Xilinx.
|
||||
|
||||
diff --git a/vendor/asic-rs-makes-antminer/src/hardware.rs b/vendor/asic-rs-makes-antminer/src/hardware.rs
|
||||
index 41a73240..aa0923c8 100644
|
||||
--- a/vendor/asic-rs-makes-antminer/src/hardware.rs
|
||||
+++ b/vendor/asic-rs-makes-antminer/src/hardware.rs
|
||||
@@ -268,11 +268,13 @@ impl AntMinerControlBoard {
|
||||
.collect::<String>();
|
||||
|
||||
match compact.as_str() {
|
||||
- "XILINX" => Some(Self::Xilinx),
|
||||
+ // "XIL" is VNish's short platform form for a Xilinx control board.
|
||||
+ "XILINX" | "XIL" => Some(Self::Xilinx),
|
||||
"BBB" | "BBCTRL" | "BB" | "BEAGLEBONE" | "BEAGLEBONEBLACK" => {
|
||||
Some(Self::BeagleBoneBlack)
|
||||
}
|
||||
- "CVITEK" | "CVCTRL" => Some(Self::CVITek),
|
||||
+ // "CV" is VNish's short platform form for a CVITek control board.
|
||||
+ "CVITEK" | "CVCTRL" | "CV" => Some(Self::CVITek),
|
||||
"AMLOGIC" | "AML" => Some(Self::AMLogic),
|
||||
"AMCB07" => Some(Self::Xilinx), // Mara FW
|
||||
"ZYNQ7007" => Some(Self::Xilinx),
|
||||
@@ -0,0 +1,65 @@
|
||||
Subject: [PATCH 0004] whatsminer v1: control-board fallback + optional ALLWINNER_ prefix
|
||||
|
||||
Round-11 #5 -- older M30S firmware (< 2022.7.29, the v1 backend) often omits
|
||||
"CB Platform" from the summary RPC, and its parse mandatorily stripped an
|
||||
"ALLWINNER_" prefix (strip_prefix(..)? -> None when absent), so those units
|
||||
showed a blank control board. Add get_version /Msg/platform (the source v2 uses)
|
||||
as a fallback location, and make the ALLWINNER_ strip optional. Verified live:
|
||||
M30S+ VE40 (fw 20220422, v1) blank -> H6OS.
|
||||
|
||||
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 b4a27db8..f95a22ae 100644
|
||||
--- a/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs
|
||||
+++ b/vendor/asic-rs-firmwares-whatsminer/src/backends/v1/mod.rs
|
||||
@@ -131,14 +131,28 @@ impl GetDataLocations for WhatsMinerV1 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
- DataField::ControlBoardVersion => vec![(
|
||||
- RPC_SUMMARY,
|
||||
- DataExtractor {
|
||||
- func: get_by_pointer,
|
||||
- key: Some("/SUMMARY/0/CB Platform"),
|
||||
- tag: None,
|
||||
- },
|
||||
- )],
|
||||
+ DataField::ControlBoardVersion => vec![
|
||||
+ (
|
||||
+ RPC_SUMMARY,
|
||||
+ DataExtractor {
|
||||
+ func: get_by_pointer,
|
||||
+ key: Some("/SUMMARY/0/CB Platform"),
|
||||
+ tag: None,
|
||||
+ },
|
||||
+ ),
|
||||
+ // Older M30S firmware (< 2022.7.29, so this v1 backend) often omits
|
||||
+ // "CB Platform" from summary but still reports the board under
|
||||
+ // get_version /Msg/platform (the source v2 uses). Fall back to it so
|
||||
+ // those units don't show a blank control board.
|
||||
+ (
|
||||
+ RPC_GET_VERSION,
|
||||
+ DataExtractor {
|
||||
+ func: get_by_pointer,
|
||||
+ key: Some("/Msg/platform"),
|
||||
+ tag: None,
|
||||
+ },
|
||||
+ ),
|
||||
+ ],
|
||||
DataField::TuningTarget => vec![(
|
||||
RPC_SUMMARY,
|
||||
DataExtractor {
|
||||
@@ -285,8 +299,12 @@ impl GetControlBoardVersion for WhatsMinerV1 {
|
||||
) -> Option<MinerControlBoard> {
|
||||
data.extract::<String>(DataField::ControlBoardVersion)
|
||||
.and_then(|s| {
|
||||
- WhatsMinerControlBoard::parse(s.to_uppercase().strip_prefix("ALLWINNER_")?)
|
||||
- .map(|cb| cb.into())
|
||||
+ // The "ALLWINNER_" prefix is optional: summary's CB Platform carries
|
||||
+ // it (e.g. "ALLWINNER_H6"), but the get_version /Msg/platform fallback
|
||||
+ // does not (e.g. "H6OS"). Strip it only when present.
|
||||
+ let up = s.to_uppercase();
|
||||
+ let board = up.strip_prefix("ALLWINNER_").unwrap_or(&up);
|
||||
+ WhatsMinerControlBoard::parse(board).map(|cb| cb.into())
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
Subject: [PATCH 0005] vnish: surface the partner build name in the firmware version
|
||||
|
||||
Round-11 #6b/#11 -- VNish /api/v1/info carries a partner/reseller "build_name"
|
||||
("WildRose", "vnishreturn", ...) alongside "fw_version"; it is shown in the
|
||||
Hashcore toolkit but asic-rs did not expose it. Point the FirmwareVersion
|
||||
extractor at /build_name and combine it with the /fw_version number (still on
|
||||
ApiVersion) in parse_firmware_version, so firmware_version reads "<build>
|
||||
<version>", e.g. "WildRose 1.2.7". Applies to both the v1_2_0 and v1_3_0
|
||||
backends. Verified live: S19j Pro -> "WildRose 1.2.7", S19k Pro -> "vnishreturn 1.3.5".
|
||||
|
||||
diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
|
||||
index 4cc1434a..e734a03e 100644
|
||||
--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
|
||||
+++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_2_0/mod.rs
|
||||
@@ -179,11 +179,15 @@ impl GetDataLocations for VnishV120 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
+ // The partner/reseller build name ("WildRose", "vnishreturn", ...) --
|
||||
+ // combined with the version number in parse_firmware_version so the FW
|
||||
+ // Version column shows e.g. "WildRose 1.3.5". ApiVersion still carries
|
||||
+ // the bare /fw_version.
|
||||
DataField::FirmwareVersion => vec![(
|
||||
WEB_INFO,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
- key: Some("/fw_version"),
|
||||
+ key: Some("/build_name"),
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
@@ -415,7 +419,20 @@ impl GetApiVersion for VnishV120 {
|
||||
|
||||
impl GetFirmwareVersion for VnishV120 {
|
||||
fn parse_firmware_version(&self, data: &HashMap<DataField, Value>) -> Option<String> {
|
||||
- data.extract::<String>(DataField::FirmwareVersion)
|
||||
+ // FirmwareVersion carries /build_name (the partner build), ApiVersion the
|
||||
+ // /fw_version number; show "<build> <version>" when both are present, else
|
||||
+ // whichever is available.
|
||||
+ let build = data
|
||||
+ .extract::<String>(DataField::FirmwareVersion)
|
||||
+ .filter(|b| !b.is_empty());
|
||||
+ let version = data
|
||||
+ .extract::<String>(DataField::ApiVersion)
|
||||
+ .filter(|v| !v.is_empty());
|
||||
+ match (build, version) {
|
||||
+ (Some(b), Some(v)) => Some(format!("{b} {v}")),
|
||||
+ (Some(b), None) => Some(b),
|
||||
+ (None, v) => v,
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
|
||||
index 6975d9e5..0a5d694e 100644
|
||||
--- a/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
|
||||
+++ b/vendor/asic-rs-firmwares-vnish/src/backends/v1_3_0/mod.rs
|
||||
@@ -179,11 +179,13 @@ impl GetDataLocations for VnishV130 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
+ // Partner/reseller build name; combined with the version number in
|
||||
+ // parse_firmware_version (FW Version shows e.g. "WildRose 1.3.5").
|
||||
DataField::FirmwareVersion => vec![(
|
||||
WEB_INFO,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
- key: Some("/fw_version"),
|
||||
+ key: Some("/build_name"),
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
@@ -423,7 +425,19 @@ impl GetApiVersion for VnishV130 {
|
||||
|
||||
impl GetFirmwareVersion for VnishV130 {
|
||||
fn parse_firmware_version(&self, data: &HashMap<DataField, Value>) -> Option<String> {
|
||||
- data.extract::<String>(DataField::FirmwareVersion)
|
||||
+ // FirmwareVersion carries /build_name (partner build), ApiVersion the
|
||||
+ // /fw_version number; show "<build> <version>" when both are present.
|
||||
+ let build = data
|
||||
+ .extract::<String>(DataField::FirmwareVersion)
|
||||
+ .filter(|b| !b.is_empty());
|
||||
+ let version = data
|
||||
+ .extract::<String>(DataField::ApiVersion)
|
||||
+ .filter(|v| !v.is_empty());
|
||||
+ match (build, version) {
|
||||
+ (Some(b), Some(v)) => Some(format!("{b} {v}")),
|
||||
+ (Some(b), None) => Some(b),
|
||||
+ (None, v) => v,
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
+8
-14
@@ -10,7 +10,7 @@
|
||||
+pub use widgets::*;
|
||||
--- a/src/widgets.rs
|
||||
+++ b/src/widgets.rs
|
||||
@@ -0,0 +1,800 @@
|
||||
@@ -0,0 +1,794 @@
|
||||
+// widgets.rs — alkane-toolkit extension: Rust bindings for the widget bridge
|
||||
+// in cpp_src/widgets_bridge.cpp. Handles are opaque pointers owned by the
|
||||
+// wxWidgets object tree (parents own children; nothing to free in Rust).
|
||||
@@ -116,7 +116,7 @@
|
||||
+ pub fn wxbr_choice_get_selection(win: *mut c_void) -> c_int;
|
||||
+ pub fn wxbr_choice_set_selection(win: *mut c_void, i: c_int);
|
||||
+ pub fn wxbr_media_button(parent: *mut c_void, id: c_int, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
|
||||
+ pub fn wxbr_kpi_icon(parent: *mut c_void, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
|
||||
+ pub fn wxbr_svg_icon(parent: *mut c_void, svg: *const c_char, w: c_int, h: c_int) -> *mut c_void;
|
||||
+ pub fn wxbr_bind_sys_colour(win: *mut c_void);
|
||||
+ pub fn wxbr_destroy(win: *mut c_void);
|
||||
+ pub fn wxbr_destroy_children(win: *mut c_void);
|
||||
@@ -781,18 +781,12 @@
|
||||
+ })
|
||||
+ }
|
||||
+
|
||||
+ /// A small drawn KPI icon (static bitmap). kind: 0 rabbit, 1 turtle,
|
||||
+ /// 2 broken wine glass, 3 otter, 4 hive, 5 lightning bolt (round 11 #15).
|
||||
+ pub fn kpi_icon(parent: Widget, kind: i32, color: (u8, u8, u8)) -> Widget {
|
||||
+ Widget(unsafe {
|
||||
+ notsafe::wxbr_kpi_icon(
|
||||
+ parent.0,
|
||||
+ kind,
|
||||
+ color.0 as c_int,
|
||||
+ color.1 as c_int,
|
||||
+ color.2 as c_int,
|
||||
+ )
|
||||
+ })
|
||||
+ /// Render an SVG string (recolour it first -- its fill must be an explicit
|
||||
+ /// colour, not "currentColor") into a static-bitmap icon at `w`x`h` px
|
||||
+ /// (round 11 #15).
|
||||
+ pub fn svg_icon(parent: Widget, svg: &str, w: i32, h: i32) -> Widget {
|
||||
+ let c = CString::new(svg).unwrap_or_default();
|
||||
+ Widget(unsafe { notsafe::wxbr_svg_icon(parent.0, c.as_ptr(), w as c_int, h as c_int) })
|
||||
+ }
|
||||
+
|
||||
+ /// Listen for OS light/dark theme changes on this window (emits `SysColour`).
|
||||
|
||||
+80
-103
@@ -1,6 +1,6 @@
|
||||
--- a/cpp_src/widgets_bridge.cpp
|
||||
+++ b/cpp_src/widgets_bridge.cpp
|
||||
@@ -0,0 +1,1483 @@
|
||||
@@ -0,0 +1,1460 @@
|
||||
+// widgets_bridge.cpp — alkane-toolkit extension to wx-rs
|
||||
+// Adds the widget/event surface the toolkit UI needs on top of the upstream
|
||||
+// render-callback bridge (which is kept untouched).
|
||||
@@ -27,6 +27,7 @@
|
||||
+#include <wx/choice.h>
|
||||
+#include <wx/bmpbuttn.h>
|
||||
+#include <wx/bitmap.h>
|
||||
+#include <wx/bmpbndl.h>
|
||||
+#include <wx/image.h>
|
||||
+#include <wx/dcmemory.h>
|
||||
+#include <wx/dcgraph.h>
|
||||
@@ -230,16 +231,20 @@
|
||||
+ dc->SetBrush(wxBrush(GetAttr().GetBackgroundColour()));
|
||||
+ dc->SetPen(*wxTRANSPARENT_PEN);
|
||||
+ // The `cell` rect wx hands a custom renderer is shrunk to the content
|
||||
+ // (text/shape) size by the alignment logic, so filling it alone left the
|
||||
+ // zebra covering only the text and looking inconsistent with the full-cell
|
||||
+ // native columns. Fill the whole column-wide cell instead; wxGTK clips the
|
||||
+ // cell DC to the visible cell area, so the over-wide rect lands exactly on
|
||||
+ // this cell without bleeding into the next column (round 11 #3).
|
||||
+ // (text/shape) size in BOTH dimensions by the alignment logic, so filling
|
||||
+ // it alone left the zebra covering only a content-sized band -- and since
|
||||
+ // shape cells (dots) and text cells have different content heights, the
|
||||
+ // stripes ended up unequal across columns. Fill an over-sized rect (full
|
||||
+ // column width, and well beyond the row vertically); wxGTK clips the cell
|
||||
+ // DC to the real cell background area, so this lands exactly on the full
|
||||
+ // row height of this cell without bleeding into neighbours (round 11 #1/#3).
|
||||
+ wxRect bg = cell;
|
||||
+ if (wxDataViewColumn* owner = const_cast<SegmentRenderer*>(this)->GetOwner()) {
|
||||
+ int cw = owner->GetWidth();
|
||||
+ if (cw > bg.width) bg.width = cw;
|
||||
+ }
|
||||
+ bg.y -= 40;
|
||||
+ bg.height += 80;
|
||||
+ dc->DrawRectangle(bg);
|
||||
+ }
|
||||
+ wxColour highlight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
||||
@@ -313,12 +318,23 @@
|
||||
+ if (col && col->GetOwner()) {
|
||||
+ GtkWidget* tv = col->GetOwner()->GtkGetTreeView();
|
||||
+ if (tv && GTK_IS_WIDGET(tv)) {
|
||||
+ // The treeview's own state flags do NOT reliably carry
|
||||
+ // GTK_STATE_FLAG_BACKDROP (that lives on the toplevel), so query the
|
||||
+ // toplevel window's active state directly and force BACKDROP onto the
|
||||
+ // style-context state when it is inactive. Then the themed cell text
|
||||
+ // colour matches what GTK paints on the native columns when the window
|
||||
+ // loses focus (round 11 #1/#7).
|
||||
+ GtkWidget* top = gtk_widget_get_toplevel(tv);
|
||||
+ bool active = GTK_IS_WINDOW(top) && gtk_window_is_active(GTK_WINDOW(top));
|
||||
+ GtkStyleContext* ctx = gtk_widget_get_style_context(tv);
|
||||
+ GtkStateFlags st = gtk_widget_get_state_flags(tv);
|
||||
+ st = active ? (GtkStateFlags)(st & ~GTK_STATE_FLAG_BACKDROP)
|
||||
+ : (GtkStateFlags)(st | GTK_STATE_FLAG_BACKDROP);
|
||||
+ GdkRGBA c;
|
||||
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
+ gtk_style_context_get_color(ctx, st, &c);
|
||||
+ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
+ gtk_style_context_save(ctx);
|
||||
+ gtk_style_context_set_state(ctx, st);
|
||||
+ gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &c);
|
||||
+ gtk_style_context_restore(ctx);
|
||||
+ return wxColour((unsigned char)(c.red * 255.0 + 0.5),
|
||||
+ (unsigned char)(c.green * 255.0 + 0.5),
|
||||
+ (unsigned char)(c.blue * 255.0 + 0.5));
|
||||
@@ -536,12 +552,31 @@
|
||||
+// ---- check list box ---------------------------------------------------------
|
||||
+
|
||||
+void* wxbr_check_list_box(void* parent) {
|
||||
+ // wxLB_EXTENDED so several rows can be selected at once (ctrl/shift-click and
|
||||
+ // rubber-band drag, native to wxListBox); a checkbox toggle on any selected
|
||||
+ // row then applies to every selected row (see the handler below). This is the
|
||||
+ // Excel-style batch-check the filter menu needs (round 12 #7).
|
||||
+ wxCheckListBox* clb = new wxCheckListBox((wxWindow*)parent, wxID_ANY,
|
||||
+ wxDefaultPosition, wxSize(-1, -1),
|
||||
+ 0, NULL, wxLB_SINGLE | wxLB_NEEDED_SB);
|
||||
+ 0, NULL, wxLB_EXTENDED | wxLB_NEEDED_SB);
|
||||
+ clb->Bind(wxEVT_CHECKLISTBOX, [clb](wxCommandEvent& e) {
|
||||
+ int idx = e.GetInt();
|
||||
+ // Batch toggle: if the clicked row is part of a multi-row selection, give
|
||||
+ // every selected row the clicked row's new state. Check() does not itself
|
||||
+ // fire wxEVT_CHECKLISTBOX, so there is no recursion.
|
||||
+ wxArrayInt sel;
|
||||
+ clb->GetSelections(sel);
|
||||
+ if (sel.GetCount() > 1) {
|
||||
+ bool inSel = false;
|
||||
+ for (size_t i = 0; i < sel.GetCount(); i++)
|
||||
+ if (sel[i] == idx) { inSel = true; break; }
|
||||
+ if (inSel) {
|
||||
+ bool state = clb->IsChecked(idx);
|
||||
+ for (size_t i = 0; i < sel.GetCount(); i++) clb->Check(sel[i], state);
|
||||
+ }
|
||||
+ }
|
||||
+ if (g_widget_event)
|
||||
+ g_widget_event(WxEV_CLB_TOGGLED, (long)(intptr_t)clb, e.GetInt());
|
||||
+ g_widget_event(WxEV_CLB_TOGGLED, (long)(intptr_t)clb, idx);
|
||||
+ });
|
||||
+ return (void*)clb;
|
||||
+}
|
||||
@@ -1139,6 +1174,34 @@
|
||||
+ lc->SetItemData(row, (long)idx);
|
||||
+ lc->CheckItem(row, enc >= 0);
|
||||
+ }
|
||||
+ // Batch checkbox toggle: checking/unchecking a row that is part of a
|
||||
+ // multi-row selection applies the same state to every selected row, so the
|
||||
+ // user can ctrl/shift-click several columns and show/hide them together
|
||||
+ // (round 12 #7). CheckItem() re-enters this handler, so guard against it.
|
||||
+ auto batchCheck = [lc](long item, bool state) {
|
||||
+ static bool busy = false;
|
||||
+ if (busy) return;
|
||||
+ if (!(lc->GetItemState(item, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED))
|
||||
+ return;
|
||||
+ wxVector<long> sel;
|
||||
+ long it = -1;
|
||||
+ for (;;) {
|
||||
+ it = lc->GetNextItem(it, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
+ if (it == -1) break;
|
||||
+ sel.push_back(it);
|
||||
+ }
|
||||
+ if (sel.size() <= 1) return;
|
||||
+ busy = true;
|
||||
+ for (size_t i = 0; i < sel.size(); i++)
|
||||
+ if (sel[i] != item) lc->CheckItem(sel[i], state);
|
||||
+ busy = false;
|
||||
+ };
|
||||
+ lc->Bind(wxEVT_LIST_ITEM_CHECKED, [batchCheck](wxListEvent& e) {
|
||||
+ batchCheck(e.GetIndex(), true);
|
||||
+ });
|
||||
+ lc->Bind(wxEVT_LIST_ITEM_UNCHECKED, [batchCheck](wxListEvent& e) {
|
||||
+ batchCheck(e.GetIndex(), false);
|
||||
+ });
|
||||
+ lc->Bind(wxEVT_LIST_BEGIN_DRAG, [lc](wxListEvent&) {
|
||||
+ g_reorder_drag.clear();
|
||||
+ g_reorder_list = lc;
|
||||
@@ -1309,98 +1372,12 @@
|
||||
+ return (void*)btn;
|
||||
+}
|
||||
+
|
||||
+// A small vector icon drawn into a transparent bitmap and wrapped in a
|
||||
+// wxStaticBitmap, for the KPI cards (round 11 #15). kind: 0 rabbit (hashing),
|
||||
+// 1 turtle (slow), 2 broken wine glass (not hashing), 3 otter (paused),
|
||||
+// 4 hive (hashrate), 5 lightning bolt (power). Drawn as simple silhouettes so
|
||||
+// they read at ~22px; the colour matches the card's value colour.
|
||||
+void* wxbr_kpi_icon(void* parent, int kind, int r, int g, int b) {
|
||||
+ const int sz = 22;
|
||||
+ wxImage img(sz, sz);
|
||||
+ img.InitAlpha();
|
||||
+ unsigned char* a = img.GetAlpha();
|
||||
+ if (a) memset(a, 0, (size_t)sz * sz);
|
||||
+ wxBitmap bmp(img);
|
||||
+ {
|
||||
+ wxMemoryDC mdc(bmp);
|
||||
+ wxGraphicsContext* gc = wxGraphicsContext::Create(mdc);
|
||||
+ if (gc) {
|
||||
+ gc->SetAntialiasMode(wxANTIALIAS_DEFAULT);
|
||||
+ wxColour col(r, g, b);
|
||||
+ wxColour dark((unsigned char)(r * 0.5), (unsigned char)(g * 0.5), (unsigned char)(b * 0.5));
|
||||
+ gc->SetBrush(wxBrush(col));
|
||||
+ gc->SetPen(wxPen(col, 1.0));
|
||||
+ switch (kind) {
|
||||
+ case 0: { // rabbit: low haunch body + head + two long spread ears
|
||||
+ gc->DrawEllipse(4, 12, 14, 8); // haunch (low, wide)
|
||||
+ gc->DrawEllipse(6.5, 7, 8, 8); // head
|
||||
+ gc->DrawEllipse(6, 0, 2.6, 9); // left ear (long)
|
||||
+ gc->DrawEllipse(12, 0, 2.6, 9); // right ear (long, spread)
|
||||
+ break;
|
||||
+ }
|
||||
+ case 1: { // turtle: wide shell + head + two visible legs
|
||||
+ gc->DrawEllipse(4, 6, 13, 9);
|
||||
+ gc->DrawEllipse(15.5, 8, 4.5, 4.5); // head
|
||||
+ gc->DrawEllipse(4.5, 12.5, 4, 4); // front leg
|
||||
+ gc->DrawEllipse(11, 12.5, 4, 4); // back leg
|
||||
+ break;
|
||||
+ }
|
||||
+ case 2: { // broken wine glass: bowl + stem + base, with a crack
|
||||
+ wxGraphicsPath bowl = gc->CreatePath();
|
||||
+ bowl.MoveToPoint(5, 3);
|
||||
+ bowl.AddLineToPoint(17, 3);
|
||||
+ bowl.AddLineToPoint(11, 12);
|
||||
+ bowl.CloseSubpath();
|
||||
+ gc->FillPath(bowl);
|
||||
+ gc->DrawRectangle(10.2, 12, 1.6, 6);
|
||||
+ gc->DrawRoundedRectangle(7, 18, 8, 2, 1);
|
||||
+ wxGraphicsPath crack = gc->CreatePath(); // jagged crack across the bowl
|
||||
+ crack.MoveToPoint(11, 3);
|
||||
+ crack.AddLineToPoint(9, 6);
|
||||
+ crack.AddLineToPoint(12.5, 8);
|
||||
+ crack.AddLineToPoint(10.5, 11.5);
|
||||
+ gc->SetPen(wxPen(dark, 1.4));
|
||||
+ gc->StrokePath(crack);
|
||||
+ break;
|
||||
+ }
|
||||
+ case 3: { // otter: upright tapered body + head + small ears + thick tail
|
||||
+ wxGraphicsPath tail = gc->CreatePath(); // thick tapering tail curving right
|
||||
+ tail.MoveToPoint(13, 17);
|
||||
+ tail.AddCurveToPoint(19, 16, 21, 20, 19, 21);
|
||||
+ tail.AddCurveToPoint(17, 21, 15, 20, 12, 19);
|
||||
+ tail.CloseSubpath();
|
||||
+ gc->FillPath(tail);
|
||||
+ gc->DrawEllipse(6, 8, 10, 13); // body (tapered upright)
|
||||
+ gc->DrawEllipse(7, 3, 8, 8); // head (wide)
|
||||
+ gc->DrawEllipse(7, 2.5, 2.6, 2.6); // ear L
|
||||
+ gc->DrawEllipse(12.4, 2.5, 2.6, 2.6);// ear R
|
||||
+ break;
|
||||
+ }
|
||||
+ case 4: { // hive (skep): three stacked bands narrowing upward + entrance
|
||||
+ gc->DrawRoundedRectangle(6, 2.5, 10, 4, 2);
|
||||
+ gc->DrawRoundedRectangle(4, 7, 14, 4, 2);
|
||||
+ gc->DrawRoundedRectangle(2.5, 11.5, 17, 5, 2.5);
|
||||
+ gc->SetBrush(wxBrush(dark));
|
||||
+ gc->SetPen(wxPen(dark, 1.0));
|
||||
+ gc->DrawEllipse(9.3, 13, 3.4, 3.6);
|
||||
+ break;
|
||||
+ }
|
||||
+ default: { // 5 lightning bolt
|
||||
+ wxGraphicsPath p = gc->CreatePath();
|
||||
+ p.MoveToPoint(13, 2);
|
||||
+ p.AddLineToPoint(5, 12);
|
||||
+ p.AddLineToPoint(10, 12);
|
||||
+ p.AddLineToPoint(8, 20);
|
||||
+ p.AddLineToPoint(17, 9);
|
||||
+ p.AddLineToPoint(11, 9);
|
||||
+ p.CloseSubpath();
|
||||
+ gc->FillPath(p);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ delete gc;
|
||||
+ }
|
||||
+ }
|
||||
+// Render an SVG (already recoloured on the Rust side -- its fill is an explicit
|
||||
+// #RRGGBB) into a wxStaticBitmap for the KPI cards (round 11 #15). The caller
|
||||
+// passes the target pixel size (w chosen from the SVG aspect ratio, h fixed).
|
||||
+void* wxbr_svg_icon(void* parent, const char* svg, int w, int h) {
|
||||
+ wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg, wxSize(w, h));
|
||||
+ wxBitmap bmp = bundle.GetBitmap(wxSize(w, h));
|
||||
+ return (void*)new wxStaticBitmap((wxWindow*)parent, wxID_ANY, bmp);
|
||||
+}
|
||||
+
|
||||
|
||||
+79
-102
@@ -24,6 +24,7 @@
|
||||
#include <wx/choice.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/bmpbndl.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/dcmemory.h>
|
||||
#include <wx/dcgraph.h>
|
||||
@@ -227,16 +228,20 @@ class SegmentRenderer : public wxDataViewCustomRenderer {
|
||||
dc->SetBrush(wxBrush(GetAttr().GetBackgroundColour()));
|
||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
||||
// The `cell` rect wx hands a custom renderer is shrunk to the content
|
||||
// (text/shape) size by the alignment logic, so filling it alone left the
|
||||
// zebra covering only the text and looking inconsistent with the full-cell
|
||||
// native columns. Fill the whole column-wide cell instead; wxGTK clips the
|
||||
// cell DC to the visible cell area, so the over-wide rect lands exactly on
|
||||
// this cell without bleeding into the next column (round 11 #3).
|
||||
// (text/shape) size in BOTH dimensions by the alignment logic, so filling
|
||||
// it alone left the zebra covering only a content-sized band -- and since
|
||||
// shape cells (dots) and text cells have different content heights, the
|
||||
// stripes ended up unequal across columns. Fill an over-sized rect (full
|
||||
// column width, and well beyond the row vertically); wxGTK clips the cell
|
||||
// DC to the real cell background area, so this lands exactly on the full
|
||||
// row height of this cell without bleeding into neighbours (round 11 #1/#3).
|
||||
wxRect bg = cell;
|
||||
if (wxDataViewColumn* owner = const_cast<SegmentRenderer*>(this)->GetOwner()) {
|
||||
int cw = owner->GetWidth();
|
||||
if (cw > bg.width) bg.width = cw;
|
||||
}
|
||||
bg.y -= 40;
|
||||
bg.height += 80;
|
||||
dc->DrawRectangle(bg);
|
||||
}
|
||||
wxColour highlight = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
||||
@@ -310,12 +315,23 @@ class SegmentRenderer : public wxDataViewCustomRenderer {
|
||||
if (col && col->GetOwner()) {
|
||||
GtkWidget* tv = col->GetOwner()->GtkGetTreeView();
|
||||
if (tv && GTK_IS_WIDGET(tv)) {
|
||||
// The treeview's own state flags do NOT reliably carry
|
||||
// GTK_STATE_FLAG_BACKDROP (that lives on the toplevel), so query the
|
||||
// toplevel window's active state directly and force BACKDROP onto the
|
||||
// style-context state when it is inactive. Then the themed cell text
|
||||
// colour matches what GTK paints on the native columns when the window
|
||||
// loses focus (round 11 #1/#7).
|
||||
GtkWidget* top = gtk_widget_get_toplevel(tv);
|
||||
bool active = GTK_IS_WINDOW(top) && gtk_window_is_active(GTK_WINDOW(top));
|
||||
GtkStyleContext* ctx = gtk_widget_get_style_context(tv);
|
||||
GtkStateFlags st = gtk_widget_get_state_flags(tv);
|
||||
st = active ? (GtkStateFlags)(st & ~GTK_STATE_FLAG_BACKDROP)
|
||||
: (GtkStateFlags)(st | GTK_STATE_FLAG_BACKDROP);
|
||||
GdkRGBA c;
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_color(ctx, st, &c);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_save(ctx);
|
||||
gtk_style_context_set_state(ctx, st);
|
||||
gtk_style_context_get_color(ctx, gtk_style_context_get_state(ctx), &c);
|
||||
gtk_style_context_restore(ctx);
|
||||
return wxColour((unsigned char)(c.red * 255.0 + 0.5),
|
||||
(unsigned char)(c.green * 255.0 + 0.5),
|
||||
(unsigned char)(c.blue * 255.0 + 0.5));
|
||||
@@ -533,12 +549,31 @@ void wxbr_check_box_set(void* win, int v) {
|
||||
// ---- check list box ---------------------------------------------------------
|
||||
|
||||
void* wxbr_check_list_box(void* parent) {
|
||||
// wxLB_EXTENDED so several rows can be selected at once (ctrl/shift-click and
|
||||
// rubber-band drag, native to wxListBox); a checkbox toggle on any selected
|
||||
// row then applies to every selected row (see the handler below). This is the
|
||||
// Excel-style batch-check the filter menu needs (round 12 #7).
|
||||
wxCheckListBox* clb = new wxCheckListBox((wxWindow*)parent, wxID_ANY,
|
||||
wxDefaultPosition, wxSize(-1, -1),
|
||||
0, NULL, wxLB_SINGLE | wxLB_NEEDED_SB);
|
||||
0, NULL, wxLB_EXTENDED | wxLB_NEEDED_SB);
|
||||
clb->Bind(wxEVT_CHECKLISTBOX, [clb](wxCommandEvent& e) {
|
||||
int idx = e.GetInt();
|
||||
// Batch toggle: if the clicked row is part of a multi-row selection, give
|
||||
// every selected row the clicked row's new state. Check() does not itself
|
||||
// fire wxEVT_CHECKLISTBOX, so there is no recursion.
|
||||
wxArrayInt sel;
|
||||
clb->GetSelections(sel);
|
||||
if (sel.GetCount() > 1) {
|
||||
bool inSel = false;
|
||||
for (size_t i = 0; i < sel.GetCount(); i++)
|
||||
if (sel[i] == idx) { inSel = true; break; }
|
||||
if (inSel) {
|
||||
bool state = clb->IsChecked(idx);
|
||||
for (size_t i = 0; i < sel.GetCount(); i++) clb->Check(sel[i], state);
|
||||
}
|
||||
}
|
||||
if (g_widget_event)
|
||||
g_widget_event(WxEV_CLB_TOGGLED, (long)(intptr_t)clb, e.GetInt());
|
||||
g_widget_event(WxEV_CLB_TOGGLED, (long)(intptr_t)clb, idx);
|
||||
});
|
||||
return (void*)clb;
|
||||
}
|
||||
@@ -1136,6 +1171,34 @@ void* wxbr_reorder_list(void* parent, int n, const int* order, const char** item
|
||||
lc->SetItemData(row, (long)idx);
|
||||
lc->CheckItem(row, enc >= 0);
|
||||
}
|
||||
// Batch checkbox toggle: checking/unchecking a row that is part of a
|
||||
// multi-row selection applies the same state to every selected row, so the
|
||||
// user can ctrl/shift-click several columns and show/hide them together
|
||||
// (round 12 #7). CheckItem() re-enters this handler, so guard against it.
|
||||
auto batchCheck = [lc](long item, bool state) {
|
||||
static bool busy = false;
|
||||
if (busy) return;
|
||||
if (!(lc->GetItemState(item, wxLIST_STATE_SELECTED) & wxLIST_STATE_SELECTED))
|
||||
return;
|
||||
wxVector<long> sel;
|
||||
long it = -1;
|
||||
for (;;) {
|
||||
it = lc->GetNextItem(it, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
|
||||
if (it == -1) break;
|
||||
sel.push_back(it);
|
||||
}
|
||||
if (sel.size() <= 1) return;
|
||||
busy = true;
|
||||
for (size_t i = 0; i < sel.size(); i++)
|
||||
if (sel[i] != item) lc->CheckItem(sel[i], state);
|
||||
busy = false;
|
||||
};
|
||||
lc->Bind(wxEVT_LIST_ITEM_CHECKED, [batchCheck](wxListEvent& e) {
|
||||
batchCheck(e.GetIndex(), true);
|
||||
});
|
||||
lc->Bind(wxEVT_LIST_ITEM_UNCHECKED, [batchCheck](wxListEvent& e) {
|
||||
batchCheck(e.GetIndex(), false);
|
||||
});
|
||||
lc->Bind(wxEVT_LIST_BEGIN_DRAG, [lc](wxListEvent&) {
|
||||
g_reorder_drag.clear();
|
||||
g_reorder_list = lc;
|
||||
@@ -1306,98 +1369,12 @@ void* wxbr_media_button(void* parent, int id, int kind, int r, int g, int b) {
|
||||
return (void*)btn;
|
||||
}
|
||||
|
||||
// A small vector icon drawn into a transparent bitmap and wrapped in a
|
||||
// wxStaticBitmap, for the KPI cards (round 11 #15). kind: 0 rabbit (hashing),
|
||||
// 1 turtle (slow), 2 broken wine glass (not hashing), 3 otter (paused),
|
||||
// 4 hive (hashrate), 5 lightning bolt (power). Drawn as simple silhouettes so
|
||||
// they read at ~22px; the colour matches the card's value colour.
|
||||
void* wxbr_kpi_icon(void* parent, int kind, int r, int g, int b) {
|
||||
const int sz = 22;
|
||||
wxImage img(sz, sz);
|
||||
img.InitAlpha();
|
||||
unsigned char* a = img.GetAlpha();
|
||||
if (a) memset(a, 0, (size_t)sz * sz);
|
||||
wxBitmap bmp(img);
|
||||
{
|
||||
wxMemoryDC mdc(bmp);
|
||||
wxGraphicsContext* gc = wxGraphicsContext::Create(mdc);
|
||||
if (gc) {
|
||||
gc->SetAntialiasMode(wxANTIALIAS_DEFAULT);
|
||||
wxColour col(r, g, b);
|
||||
wxColour dark((unsigned char)(r * 0.5), (unsigned char)(g * 0.5), (unsigned char)(b * 0.5));
|
||||
gc->SetBrush(wxBrush(col));
|
||||
gc->SetPen(wxPen(col, 1.0));
|
||||
switch (kind) {
|
||||
case 0: { // rabbit: low haunch body + head + two long spread ears
|
||||
gc->DrawEllipse(4, 12, 14, 8); // haunch (low, wide)
|
||||
gc->DrawEllipse(6.5, 7, 8, 8); // head
|
||||
gc->DrawEllipse(6, 0, 2.6, 9); // left ear (long)
|
||||
gc->DrawEllipse(12, 0, 2.6, 9); // right ear (long, spread)
|
||||
break;
|
||||
}
|
||||
case 1: { // turtle: wide shell + head + two visible legs
|
||||
gc->DrawEllipse(4, 6, 13, 9);
|
||||
gc->DrawEllipse(15.5, 8, 4.5, 4.5); // head
|
||||
gc->DrawEllipse(4.5, 12.5, 4, 4); // front leg
|
||||
gc->DrawEllipse(11, 12.5, 4, 4); // back leg
|
||||
break;
|
||||
}
|
||||
case 2: { // broken wine glass: bowl + stem + base, with a crack
|
||||
wxGraphicsPath bowl = gc->CreatePath();
|
||||
bowl.MoveToPoint(5, 3);
|
||||
bowl.AddLineToPoint(17, 3);
|
||||
bowl.AddLineToPoint(11, 12);
|
||||
bowl.CloseSubpath();
|
||||
gc->FillPath(bowl);
|
||||
gc->DrawRectangle(10.2, 12, 1.6, 6);
|
||||
gc->DrawRoundedRectangle(7, 18, 8, 2, 1);
|
||||
wxGraphicsPath crack = gc->CreatePath(); // jagged crack across the bowl
|
||||
crack.MoveToPoint(11, 3);
|
||||
crack.AddLineToPoint(9, 6);
|
||||
crack.AddLineToPoint(12.5, 8);
|
||||
crack.AddLineToPoint(10.5, 11.5);
|
||||
gc->SetPen(wxPen(dark, 1.4));
|
||||
gc->StrokePath(crack);
|
||||
break;
|
||||
}
|
||||
case 3: { // otter: upright tapered body + head + small ears + thick tail
|
||||
wxGraphicsPath tail = gc->CreatePath(); // thick tapering tail curving right
|
||||
tail.MoveToPoint(13, 17);
|
||||
tail.AddCurveToPoint(19, 16, 21, 20, 19, 21);
|
||||
tail.AddCurveToPoint(17, 21, 15, 20, 12, 19);
|
||||
tail.CloseSubpath();
|
||||
gc->FillPath(tail);
|
||||
gc->DrawEllipse(6, 8, 10, 13); // body (tapered upright)
|
||||
gc->DrawEllipse(7, 3, 8, 8); // head (wide)
|
||||
gc->DrawEllipse(7, 2.5, 2.6, 2.6); // ear L
|
||||
gc->DrawEllipse(12.4, 2.5, 2.6, 2.6);// ear R
|
||||
break;
|
||||
}
|
||||
case 4: { // hive (skep): three stacked bands narrowing upward + entrance
|
||||
gc->DrawRoundedRectangle(6, 2.5, 10, 4, 2);
|
||||
gc->DrawRoundedRectangle(4, 7, 14, 4, 2);
|
||||
gc->DrawRoundedRectangle(2.5, 11.5, 17, 5, 2.5);
|
||||
gc->SetBrush(wxBrush(dark));
|
||||
gc->SetPen(wxPen(dark, 1.0));
|
||||
gc->DrawEllipse(9.3, 13, 3.4, 3.6);
|
||||
break;
|
||||
}
|
||||
default: { // 5 lightning bolt
|
||||
wxGraphicsPath p = gc->CreatePath();
|
||||
p.MoveToPoint(13, 2);
|
||||
p.AddLineToPoint(5, 12);
|
||||
p.AddLineToPoint(10, 12);
|
||||
p.AddLineToPoint(8, 20);
|
||||
p.AddLineToPoint(17, 9);
|
||||
p.AddLineToPoint(11, 9);
|
||||
p.CloseSubpath();
|
||||
gc->FillPath(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
delete gc;
|
||||
}
|
||||
}
|
||||
// Render an SVG (already recoloured on the Rust side -- its fill is an explicit
|
||||
// #RRGGBB) into a wxStaticBitmap for the KPI cards (round 11 #15). The caller
|
||||
// passes the target pixel size (w chosen from the SVG aspect ratio, h fixed).
|
||||
void* wxbr_svg_icon(void* parent, const char* svg, int w, int h) {
|
||||
wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg, wxSize(w, h));
|
||||
wxBitmap bmp = bundle.GetBitmap(wxSize(w, h));
|
||||
return (void*)new wxStaticBitmap((wxWindow*)parent, wxID_ANY, bmp);
|
||||
}
|
||||
|
||||
|
||||
+7
-13
@@ -103,7 +103,7 @@ mod notsafe {
|
||||
pub fn wxbr_choice_get_selection(win: *mut c_void) -> c_int;
|
||||
pub fn wxbr_choice_set_selection(win: *mut c_void, i: c_int);
|
||||
pub fn wxbr_media_button(parent: *mut c_void, id: c_int, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
|
||||
pub fn wxbr_kpi_icon(parent: *mut c_void, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
|
||||
pub fn wxbr_svg_icon(parent: *mut c_void, svg: *const c_char, w: c_int, h: c_int) -> *mut c_void;
|
||||
pub fn wxbr_bind_sys_colour(win: *mut c_void);
|
||||
pub fn wxbr_destroy(win: *mut c_void);
|
||||
pub fn wxbr_destroy_children(win: *mut c_void);
|
||||
@@ -768,18 +768,12 @@ impl Widget {
|
||||
})
|
||||
}
|
||||
|
||||
/// A small drawn KPI icon (static bitmap). kind: 0 rabbit, 1 turtle,
|
||||
/// 2 broken wine glass, 3 otter, 4 hive, 5 lightning bolt (round 11 #15).
|
||||
pub fn kpi_icon(parent: Widget, kind: i32, color: (u8, u8, u8)) -> Widget {
|
||||
Widget(unsafe {
|
||||
notsafe::wxbr_kpi_icon(
|
||||
parent.0,
|
||||
kind,
|
||||
color.0 as c_int,
|
||||
color.1 as c_int,
|
||||
color.2 as c_int,
|
||||
)
|
||||
})
|
||||
/// Render an SVG string (recolour it first -- its fill must be an explicit
|
||||
/// colour, not "currentColor") into a static-bitmap icon at `w`x`h` px
|
||||
/// (round 11 #15).
|
||||
pub fn svg_icon(parent: Widget, svg: &str, w: i32, h: i32) -> Widget {
|
||||
let c = CString::new(svg).unwrap_or_default();
|
||||
Widget(unsafe { notsafe::wxbr_svg_icon(parent.0, c.as_ptr(), w as c_int, h as c_int) })
|
||||
}
|
||||
|
||||
/// Listen for OS light/dark theme changes on this window (emits `SysColour`).
|
||||
|
||||
+1
-1
@@ -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":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"c87949458cf3c73ef957b319abc1a39c4755d709d7e3cf5ea9b9b326eb054605","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"722301b45abe8177269cc008a528ae5c5b122f4d0ced28aaa5bee6b5b9f0c062","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"}
|
||||
{"$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":"de321c89f62a60690ba07d6bb145ac688c6141c458638e68b3ed36b50b8de1f1","Cargo.lock":"5942ec7c9cf5c201bd32442d65020dc3ae72e33cb5aaf374b2a26501571a1487","Cargo.toml":"cb9ee00cbb415fa66a71a7d4822839bb3552336ec9ab975ae7b1137c711449cb","Cargo.toml.orig":"08409c395e4d502015da62e97efdc9c5bc6e3076031144f3f5aa35c900c7c735","src/backends/mod.rs":"26591e67688f8d015242295dde5050c4b34986e9980018a855346291a0472206","src/backends/v1_2_0/mod.rs":"fc68a12769890e18231255c6a53cb2c68e4706a887d91f49113c6192684340d2","src/backends/v1_2_0/web.rs":"ac89f16bf623f7d85590d34b45c99b0e522d9d434b4c22af7fa8a8a653e09d2e","src/backends/v1_3_0/mod.rs":"0bba1bf94e7a86d763dbedda3bb5d68cf760e17f744204b0bbc0de4e3754f795","src/backends/v1_3_0/web.rs":"1ec4cbe6bdc26f165d9e54e9bf2aac4c3706357ce4677dc21113710d4a26c3c1","src/firmware.rs":"168eeffaef90cb1525bb2e126e73905b5205d49215437263813e30323f6b7a05","src/lib.rs":"16ea1c0007fa6d6c86c1f83d3ac9cdf065cd9936cd52f35ef89c227397bbc54a","src/timezone.rs":"309bf23de1bdc9126bde5db8dabff0d2c0fea797dbf2630a772a18539838a05e"},"package":"1cb662e56f104c0fe45c8ccdac13f60cbcaad45ac228f939c6ac46ff40335052"}
|
||||
+19
-2
@@ -179,11 +179,15 @@ impl GetDataLocations for VnishV120 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
// The partner/reseller build name ("WildRose", "vnishreturn", ...) --
|
||||
// combined with the version number in parse_firmware_version so the FW
|
||||
// Version column shows e.g. "WildRose 1.3.5". ApiVersion still carries
|
||||
// the bare /fw_version.
|
||||
DataField::FirmwareVersion => vec![(
|
||||
WEB_INFO,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
key: Some("/fw_version"),
|
||||
key: Some("/build_name"),
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
@@ -415,7 +419,20 @@ impl GetApiVersion for VnishV120 {
|
||||
|
||||
impl GetFirmwareVersion for VnishV120 {
|
||||
fn parse_firmware_version(&self, data: &HashMap<DataField, Value>) -> Option<String> {
|
||||
data.extract::<String>(DataField::FirmwareVersion)
|
||||
// FirmwareVersion carries /build_name (the partner build), ApiVersion the
|
||||
// /fw_version number; show "<build> <version>" when both are present, else
|
||||
// whichever is available.
|
||||
let build = data
|
||||
.extract::<String>(DataField::FirmwareVersion)
|
||||
.filter(|b| !b.is_empty());
|
||||
let version = data
|
||||
.extract::<String>(DataField::ApiVersion)
|
||||
.filter(|v| !v.is_empty());
|
||||
match (build, version) {
|
||||
(Some(b), Some(v)) => Some(format!("{b} {v}")),
|
||||
(Some(b), None) => Some(b),
|
||||
(None, v) => v,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-2
@@ -179,11 +179,13 @@ impl GetDataLocations for VnishV130 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
// Partner/reseller build name; combined with the version number in
|
||||
// parse_firmware_version (FW Version shows e.g. "WildRose 1.3.5").
|
||||
DataField::FirmwareVersion => vec![(
|
||||
WEB_INFO,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
key: Some("/fw_version"),
|
||||
key: Some("/build_name"),
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
@@ -423,7 +425,19 @@ impl GetApiVersion for VnishV130 {
|
||||
|
||||
impl GetFirmwareVersion for VnishV130 {
|
||||
fn parse_firmware_version(&self, data: &HashMap<DataField, Value>) -> Option<String> {
|
||||
data.extract::<String>(DataField::FirmwareVersion)
|
||||
// FirmwareVersion carries /build_name (partner build), ApiVersion the
|
||||
// /fw_version number; show "<build> <version>" when both are present.
|
||||
let build = data
|
||||
.extract::<String>(DataField::FirmwareVersion)
|
||||
.filter(|b| !b.is_empty());
|
||||
let version = data
|
||||
.extract::<String>(DataField::ApiVersion)
|
||||
.filter(|v| !v.is_empty());
|
||||
match (build, version) {
|
||||
(Some(b), Some(v)) => Some(format!("{b} {v}")),
|
||||
(Some(b), None) => Some(b),
|
||||
(None, v) => v,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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":"80f3915f1e87c6f7483e9bd0e5b1fb5552f8d017634c82eea6150fe5134b171f","src/backends/v1/rpc.rs":"4cee9caeb9bc291c4efec04f4b7fc2b8eaead904a1f2d0f30e13236476d9aac5","src/backends/v2/mod.rs":"68fd8c1762b424a7785174fdb3ae4fede1d599632657808d4b7c76bcfbfb202c","src/backends/v2/rpc.rs":"b7afc5357d24de42350d4ec15a6b5a37698e4fd77b2c2cc8071f303ee62e957c","src/backends/v3/mod.rs":"f19e673c47c2cc366e2ff7782bca93daf750563d62221a12a043b3ee79a15251","src/backends/v3/rpc.rs":"7a5f80aec4af1bcaa0d36e67345aa9acbbd8ead73c0be474f06305358b38e81b","src/error_codes.rs":"de85845f52b1d4e1a0bff73462cef00962b60fad8a3ed71c7bb083c02df3a413","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":"b96cd7679b575335d716b114a3986167b2696b9e94a1a06a4696757aef08c7d1","src/backends/v1/rpc.rs":"4cee9caeb9bc291c4efec04f4b7fc2b8eaead904a1f2d0f30e13236476d9aac5","src/backends/v2/mod.rs":"68fd8c1762b424a7785174fdb3ae4fede1d599632657808d4b7c76bcfbfb202c","src/backends/v2/rpc.rs":"b7afc5357d24de42350d4ec15a6b5a37698e4fd77b2c2cc8071f303ee62e957c","src/backends/v3/mod.rs":"f19e673c47c2cc366e2ff7782bca93daf750563d62221a12a043b3ee79a15251","src/backends/v3/rpc.rs":"7a5f80aec4af1bcaa0d36e67345aa9acbbd8ead73c0be474f06305358b38e81b","src/error_codes.rs":"de85845f52b1d4e1a0bff73462cef00962b60fad8a3ed71c7bb083c02df3a413","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"}
|
||||
+28
-10
@@ -131,14 +131,28 @@ impl GetDataLocations for WhatsMinerV1 {
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
DataField::ControlBoardVersion => vec![(
|
||||
RPC_SUMMARY,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
key: Some("/SUMMARY/0/CB Platform"),
|
||||
tag: None,
|
||||
},
|
||||
)],
|
||||
DataField::ControlBoardVersion => vec![
|
||||
(
|
||||
RPC_SUMMARY,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
key: Some("/SUMMARY/0/CB Platform"),
|
||||
tag: None,
|
||||
},
|
||||
),
|
||||
// Older M30S firmware (< 2022.7.29, so this v1 backend) often omits
|
||||
// "CB Platform" from summary but still reports the board under
|
||||
// get_version /Msg/platform (the source v2 uses). Fall back to it so
|
||||
// those units don't show a blank control board.
|
||||
(
|
||||
RPC_GET_VERSION,
|
||||
DataExtractor {
|
||||
func: get_by_pointer,
|
||||
key: Some("/Msg/platform"),
|
||||
tag: None,
|
||||
},
|
||||
),
|
||||
],
|
||||
DataField::TuningTarget => vec![(
|
||||
RPC_SUMMARY,
|
||||
DataExtractor {
|
||||
@@ -285,8 +299,12 @@ impl GetControlBoardVersion for WhatsMinerV1 {
|
||||
) -> Option<MinerControlBoard> {
|
||||
data.extract::<String>(DataField::ControlBoardVersion)
|
||||
.and_then(|s| {
|
||||
WhatsMinerControlBoard::parse(s.to_uppercase().strip_prefix("ALLWINNER_")?)
|
||||
.map(|cb| cb.into())
|
||||
// The "ALLWINNER_" prefix is optional: summary's CB Platform carries
|
||||
// it (e.g. "ALLWINNER_H6"), but the get_version /Msg/platform fallback
|
||||
// does not (e.g. "H6OS"). Strip it only when present.
|
||||
let up = s.to_uppercase();
|
||||
let board = up.strip_prefix("ALLWINNER_").unwrap_or(&up);
|
||||
WhatsMinerControlBoard::parse(board).map(|cb| cb.into())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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":"aaaa0f14e3aff2543d3d09a4515efa5ab439f0651a36b582e87b9843d0475752","Cargo.lock":"58da2f3399ff680bf7d619204897b4edf5c03d336a8c3cceb54c9aba280bfed1","Cargo.toml":"57f92bf3808fa6f468dbabf43763a808d9ead128eef83b748f940ef3b219a80e","Cargo.toml.orig":"cbfb99fc843dd61ad2025dcfc16bd435afd2b6d43c2c983867af08af415916f1","src/hardware.rs":"77612b4f39e9c15355172b0582693d86b2fe44a305f5b01eef592e5a34b37188","src/lib.rs":"b2f55767a7f3fdacb1e898c5cb961c2dec8481823f94386ee67628960e91bf7d","src/make.rs":"e968e4dbd745d485fc9ad4c5a4c081d679eddce11f66e572f81f2dbe37ede3f0","src/models.rs":"da72a570d8cbb2c843c04047c3d879ca9709455f9bd6a02c3f2ab739e1b5be60"},"package":"67cca6e6bf4ac14562084ce7534521ffa7cd313fa39e2392f98ff98a047a4353"}
|
||||
{"$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":"aaaa0f14e3aff2543d3d09a4515efa5ab439f0651a36b582e87b9843d0475752","Cargo.lock":"58da2f3399ff680bf7d619204897b4edf5c03d336a8c3cceb54c9aba280bfed1","Cargo.toml":"57f92bf3808fa6f468dbabf43763a808d9ead128eef83b748f940ef3b219a80e","Cargo.toml.orig":"cbfb99fc843dd61ad2025dcfc16bd435afd2b6d43c2c983867af08af415916f1","src/hardware.rs":"c3edc06f2404efd473bcc4ab16d66bb647369f2d43c0a10cb77bbc12cb98bf43","src/lib.rs":"b2f55767a7f3fdacb1e898c5cb961c2dec8481823f94386ee67628960e91bf7d","src/make.rs":"e968e4dbd745d485fc9ad4c5a4c081d679eddce11f66e572f81f2dbe37ede3f0","src/models.rs":"da72a570d8cbb2c843c04047c3d879ca9709455f9bd6a02c3f2ab739e1b5be60"},"package":"67cca6e6bf4ac14562084ce7534521ffa7cd313fa39e2392f98ff98a047a4353"}
|
||||
+4
-2
@@ -268,11 +268,13 @@ impl AntMinerControlBoard {
|
||||
.collect::<String>();
|
||||
|
||||
match compact.as_str() {
|
||||
"XILINX" => Some(Self::Xilinx),
|
||||
// "XIL" is VNish's short platform form for a Xilinx control board.
|
||||
"XILINX" | "XIL" => Some(Self::Xilinx),
|
||||
"BBB" | "BBCTRL" | "BB" | "BEAGLEBONE" | "BEAGLEBONEBLACK" => {
|
||||
Some(Self::BeagleBoneBlack)
|
||||
}
|
||||
"CVITEK" | "CVCTRL" => Some(Self::CVITek),
|
||||
// "CV" is VNish's short platform form for a CVITek control board.
|
||||
"CVITEK" | "CVCTRL" | "CV" => Some(Self::CVITek),
|
||||
"AMLOGIC" | "AML" => Some(Self::AMLogic),
|
||||
"AMCB07" => Some(Self::Xilinx), // Mara FW
|
||||
"ZYNQ7007" => Some(Self::Xilinx),
|
||||
|
||||
Reference in New Issue
Block a user