diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index 32d4cc1f..8ece9fc6 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -1221,11 +1221,20 @@ impl Column { Column::Cpu => r.cpu.clone(), Column::BoardCode => r.board_code.clone(), Column::Algorithm => r.algorithm.clone(), - Column::Pic => match r.pic_present { - Some(true) => "PIC".to_string(), - Some(false) => "noPIC".to_string(), - None => "?".to_string(), - }, + Column::Pic => { + // A per-board PIC MCU is an Antminer hashboard property; it has no + // meaning for WhatsMiner or any other make, which show nothing + // rather than a "?" that implies an unanswered Antminer question. + if !r.brand.eq_ignore_ascii_case("antminer") { + String::new() + } else { + match r.pic_present { + Some(true) => "PIC".to_string(), + Some(false) => "noPIC".to_string(), + None => "?".to_string(), + } + } + } Column::Locked => match r.write_locked { Some(true) => "locked".to_string(), Some(false) => "unlocked".to_string(), @@ -1984,13 +1993,14 @@ mod tests { #[test] fn pic_locked_error_columns_render() { - // PIC (best-effort): known -> PIC/noPIC, unknown -> "?". - let pic = MinerRow { pic_present: Some(true), ..Default::default() }; - let nopic = MinerRow { pic_present: Some(false), ..Default::default() }; - let pic_unknown = MinerRow { pic_present: None, ..Default::default() }; - assert_eq!(Column::Pic.cell(&pic), "PIC"); - assert_eq!(Column::Pic.cell(&nopic), "noPIC"); - assert_eq!(Column::Pic.cell(&pic_unknown), "?"); + // PIC (best-effort): Antminer known -> PIC/noPIC, unknown Antminer -> "?". + 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(false))), "noPIC"); + assert_eq!(Column::Pic.cell(&am(None)), "?"); + // Non-Antminer makes: PIC has no meaning -> blank, never "?". + let wm = MinerRow { brand: "WhatsMiner".into(), pic_present: None, ..Default::default() }; + assert_eq!(Column::Pic.cell(&wm), ""); // Access column. let locked = MinerRow { write_locked: Some(true), ..Default::default() }; diff --git a/scripts/clean-old-builds.sh b/scripts/clean-old-builds.sh new file mode 100644 index 00000000..d8596f64 --- /dev/null +++ b/scripts/clean-old-builds.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# +# Reclaim disk from the local cargo build directory. +# +# The app and the miner_probe CLI ship as release builds, and the unit tests run +# under --release too (see the build notes), so the dev/debug profile tree, any +# cross-compile target trees, and the coverage tree are all disposable: they only +# ever reappear if something explicitly rebuilds them, and left alone they grow +# without bound (a stray `cargo check`/`cargo test` can push the debug tree past +# 30 GiB on its own). The release tree is kept warm so the next iteration is still +# incremental; only its throwaway bits are pruned. +# +# Run it right after a release push -- the pushed commit is what CI builds and +# ships, so the local intermediates are spare from that point. Safe to run any +# time; it never deletes the release build itself. +# +# Honours CARGO_TARGET_DIR (the build sets it to ~/.cache/alkane-tk-target). +set -uo pipefail + +TARGET="${CARGO_TARGET_DIR:-$HOME/.cache/alkane-tk-target}" +if [ ! -d "$TARGET" ]; then + echo "clean-old-builds: no target dir at $TARGET (nothing to do)" + exit 0 +fi + +human() { du -sh "$1" 2>/dev/null | cut -f1; } +before=$(human "$TARGET") + +# Disposable profile/aux trees -- regenerated on demand, never shipped. +rm -rf "$TARGET"/debug "$TARGET"/llvm-cov-target "$TARGET"/doc 2>/dev/null + +# Cross-compile target trees (e.g. armv7-unknown-linux-musleabihf). Rust target +# triples all carry "-unknown-"; the host release/debug trees do not, so this +# never touches the warm release build. +for d in "$TARGET"/*-unknown-*; do + [ -d "$d" ] && rm -rf "$d" +done + +# The incremental caches are rebuild accelerators, not build output -- dropping +# them costs one slightly-slower rebuild and can free a few GiB. +rm -rf "$TARGET"/release/incremental 2>/dev/null + +# If cargo-sweep is installed, additionally drop release artifacts not touched in +# the last few days (old dependency versions left by past rebuilds), keeping the +# current build. Optional: install with `cargo install cargo-sweep`. +if command -v cargo-sweep >/dev/null 2>&1; then + cargo sweep --time 3 "$TARGET" >/dev/null 2>&1 || true +fi + +after=$(human "$TARGET") +echo "clean-old-builds: $TARGET $before -> $after" diff --git a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp index d46f946f..601c676f 100644 --- a/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp +++ b/thirdparty/wx-rs/wx-rs-0.2.0-patched/cpp_src/widgets_bridge.cpp @@ -335,13 +335,26 @@ int DrawShape(wxDC* dc, wxUniChar shape, wxCoord x, const wxRect& cell, if (h < 8) h = 8; int w = (sv->vbh > 0) ? (int)((double)h * sv->vbw / sv->vbh + 0.5) : h; if (w < 1) w = 1; - const wxBitmap& bmp = ShapeBitmap(shape, *sv, colour, w, h); + // The Font Awesome fan glyph fills its square box more than the other health + // icons (brain/chip/bolt), so at the shared size it reads as oversized. Draw + // it a bit smaller, centred in its full-size slot, so the slot advance and the + // per-icon tooltip hit-test (both keyed to the full width) are unchanged + // (round 17 R1). + int dw = w, dh = h; + if (shape == SHAPE_FAN) { + dh = (int)(h * 0.80 + 0.5); + if (dh < 8) dh = 8; + dw = (sv->vbh > 0) ? (int)((double)dh * sv->vbw / sv->vbh + 0.5) : dh; + if (dw < 1) dw = 1; + } + const wxBitmap& bmp = ShapeBitmap(shape, *sv, colour, dw, dh); if (bmp.IsOk()) { if (health) { - // Left-align and advance by less than the icon width so adjacent health - // icons sit close together (the Font Awesome glyphs carry inner margin, - // so a small bounding-box overlap does not visually collide). - dc->DrawBitmap(bmp, x, cy - h / 2, true); + // Left-align in the full slot (a shrunk fan is centred within it) and + // advance by less than the full icon width so adjacent health icons sit + // close together (the Font Awesome glyphs carry inner margin, so a small + // bounding-box overlap does not visually collide). + dc->DrawBitmap(bmp, x + (w - dw) / 2, cy - dh / 2, true); int adv = w - 3; return adv < 1 ? 1 : adv; }