Compare commits

...
1 Commits
Author SHA1 Message Date
noahandClaude Opus 4.8 77399bdd06 GUI round 9 (batch 1): column-reorder persistence, post-action refresh, algorithm column, hashrate KPI label
- #1 Column reorder now persists (incl. after sorting a moved column). On wxGTK,
  GetColumnPosition() does not reflect a native GtkTreeView column drag, so the
  reorder was read as a no-op and the rebuild snapped columns back. dvlc_col_at_pos
  now reads the real display order from the GtkTreeView (gtk_tree_view_get_columns
  + GTKColumnToWX) on __WXGTK__, falling back to GetColumnPosition elsewhere.
- #2 A right-click config action (e.g. Flash lights) now re-probes the miners it
  targeted when it finishes, so the change shows in the table (skipped after a
  flash, since the unit is rebooting). New App.action_targets.
- #7 New Algorithm column (from asic-rs hashrate.algo: SHA256/Scrypt/Equihash/...),
  categorical so it is filterable via the value checklist.
- #9 SHA-256 Hashrate KPI: card relabelled "SHA-256 Hashrate" and the value drops
  the "/s" ("685 TH", "1.2 PH"). (Per-algorithm click-cycling deferred.)

Note on #8 (Z15 shows T not k): our formatting already derives the SI prefix from
the base value (si_mantissa), so a wrong 'T' means asic-rs reports the wrong unit
for that Equihash model -- an asic-rs backend fix that needs a live Z15 to verify.

cargo check --release --tests clean; patch 0003 regenerated + validated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Y8h447BPyJR4fioYZvQ9bh
2026-09-18 10:41:21 -06:00
6 changed files with 68 additions and 6 deletions
+2 -1
View File
@@ -106,8 +106,9 @@ impl Board {
tuning: self.mining,
firmware_flash,
},
// Demo values for the round-8 columns (synthetic, so the columns
// Demo values for the round-8/9 columns (synthetic, so the columns
// show variety offline).
algorithm: "SHA256".to_string(),
control_board: if self.model.contains("S17") {
"Xilinx".to_string()
} else if self.model.contains("S19j") || self.model.contains("S19k") {
+8 -1
View File
@@ -243,6 +243,8 @@ pub struct MinerRow {
pub firmware: String,
pub api_version: String,
pub control_board: String,
/// Mining algorithm (e.g. "SHA256", "Scrypt", "Equihash"), from asic-rs.
pub algorithm: String,
/// Whether the hashboards carry a PIC MCU. asic-rs does not report this over
/// the network, so it is a best-effort inference (model-string heuristic):
/// `None` = unknown, `Some(true)` = PIC, `Some(false)` = noPIC. True
@@ -369,6 +371,7 @@ pub enum Column {
Serial,
ApiVersion,
ControlBoard,
Algorithm,
Pic,
Locked,
Error,
@@ -389,7 +392,7 @@ pub enum Column {
/// Every column, in registry order. Ip first, then the default-visible set
/// (UI-SPEC order), then all remaining metrics.
pub const ALL_COLUMNS: [Column; 38] = [
pub const ALL_COLUMNS: [Column; 39] = [
Column::Ip,
Column::Hashrate,
Column::Power,
@@ -412,6 +415,7 @@ pub const ALL_COLUMNS: [Column; 38] = [
Column::Serial,
Column::ApiVersion,
Column::ControlBoard,
Column::Algorithm,
Column::Pic,
Column::Locked,
Column::Error,
@@ -467,6 +471,7 @@ impl Column {
Column::Serial => "Serial",
Column::ApiVersion => "API ver",
Column::ControlBoard => "Control board",
Column::Algorithm => "Algorithm",
Column::Pic => "PIC",
Column::Locked => "Access",
Column::Error => "Errors",
@@ -503,6 +508,7 @@ impl Column {
Column::Mac | Column::Hostname | Column::Serial => 150,
Column::ApiVersion | Column::Light => 90,
Column::ControlBoard => 130,
Column::Algorithm => 100,
Column::Pic => 70,
Column::Locked => 90,
Column::Error => 160,
@@ -644,6 +650,7 @@ impl Column {
Column::Serial => r.serial.clone(),
Column::ApiVersion => r.api_version.clone(),
Column::ControlBoard => r.control_board.clone(),
Column::Algorithm => r.algorithm.clone(),
Column::Pic => match r.pic_present {
Some(true) => "PIC".to_string(),
Some(false) => "noPIC".to_string(),
+2
View File
@@ -498,6 +498,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
.iter()
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
.fold(0.0f64, f64::max);
let algorithm = data.hashrate.as_ref().map(|h| h.algo.to_string()).unwrap_or_default();
let is_mining = data.is_mining;
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();
@@ -525,6 +526,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
ip: data.ip.to_string(),
selected: false,
caps,
algorithm,
pic_present,
write_locked,
errors,
+17 -3
View File
@@ -327,6 +327,9 @@ pub struct App {
action_is_power: bool,
action_total: usize,
action_done: usize,
// IPs the current config action targets, re-probed after it completes so the
// table reflects the change (e.g. the identify light toggling).
action_targets: Vec<String>,
// A confirmation dialog for disruptive actions, plus its pending target.
confirm_dialog: Widget,
pending_confirm: Option<(Vec<String>, scan::ConfigAction)>,
@@ -439,7 +442,7 @@ pub fn build(frame: Widget) -> App {
let (card_slow, kpi_slow) = mk_card("Slow", ColorKind::Amber);
let (card_not, kpi_not) = mk_card("Not hashing", ColorKind::Red);
let (card_paused, kpi_paused) = mk_card("Paused", ColorKind::Blue);
let (_card_hashrate, kpi_hashrate) = mk_card("Hashrate", ColorKind::Accent);
let (_card_hashrate, kpi_hashrate) = mk_card("SHA-256 Hashrate", ColorKind::Accent);
let (_card_power, kpi_power) = mk_card("Est. power", ColorKind::Neutral);
drop(mk_card);
// The 4 status cards double as quick-filters: clicking one narrows the
@@ -539,6 +542,7 @@ pub fn build(frame: Widget) -> App {
action_is_power: false,
action_total: 0,
action_done: 0,
action_targets: Vec::new(),
confirm_dialog: frame,
pending_confirm: None,
flash_confirm_dialog: frame,
@@ -743,7 +747,8 @@ impl App {
self.kpi_slow.set_label(&k.slow.to_string());
self.kpi_not.set_label(&k.not_hashing.to_string());
self.kpi_paused.set_label(&k.paused.to_string());
self.kpi_hashrate.set_label(&format_si(k.total_hashrate_ths * 1e12, "H/s"));
// No "/s" suffix on the KPI (per UI request): "685 TH", "1.2 PH".
self.kpi_hashrate.set_label(&format_si(k.total_hashrate_ths * 1e12, "H"));
self.kpi_power.set_label(&format_si(k.total_power_w, "W"));
}
@@ -912,6 +917,7 @@ impl App {
old.stop();
}
let msg = format!("applying {} to {} miner(s)...", action.label(), ips.len());
self.action_targets = ips.clone();
self.action = Some(scan::start_config_action(ips, action));
wx_rs::set_status_text(&msg);
}
@@ -1505,6 +1511,7 @@ impl App {
}
if finished {
self.action = None;
let was_flash = self.flashing;
// Release the firmware-flash exclusive lock (harmless no-op for a
// plain config action, which never set it).
self.flashing = false;
@@ -1512,6 +1519,13 @@ impl App {
// action's outcome (incl. failures) isn't clobbered by the next tick.
self.action_result = status.clone();
self.action_result_ticks = ACTION_RESULT_TICKS;
// Re-probe the miners the action touched so the table reflects the
// change (e.g. the identify light). Skip after a flash (the miner is
// rebooting and won't answer a refresh yet).
let targets = std::mem::take(&mut self.action_targets);
if !was_flash && !targets.is_empty() {
self.start_refresh(targets);
}
}
if let Some(s) = status {
wx_rs::set_status_text(&s);
@@ -2519,7 +2533,7 @@ impl App {
(self.kpi_slow, "Slow", "1"),
(self.kpi_not, "Not hashing", "1"),
(self.kpi_paused, "Paused", "1"),
(self.kpi_hashrate, "Hashrate", "685 TH/s"),
(self.kpi_hashrate, "SHA-256 Hashrate", "685 TH"),
(self.kpi_power, "Est. power", "21.3 kW"),
];
for (w, name, want) in want_kpis {
+20 -1
View File
@@ -1,6 +1,6 @@
--- a/cpp_src/widgets_bridge.cpp
+++ b/cpp_src/widgets_bridge.cpp
@@ -0,0 +1,1064 @@
@@ -0,0 +1,1083 @@
+// 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).
@@ -777,6 +777,25 @@
+ wxDataViewCtrl* dv = (wxDataViewCtrl*)win;
+ unsigned n = dv->GetColumnCount();
+ if (pos < 0 || (unsigned)pos >= n) return -1;
+#ifdef __WXGTK__
+ // wxGTK's GetColumnPosition() does NOT reflect a native GtkTreeView column
+ // drag, so after the user reorders columns it reports the creation order and
+ // the reorder is silently lost. Read the real display order from the
+ // GtkTreeView instead, then map the column back to its wx creation index.
+ GtkWidget* tvw = dv->GtkGetTreeView();
+ if (tvw) {
+ GList* cols = gtk_tree_view_get_columns(GTK_TREE_VIEW(tvw)); // display order
+ GtkTreeViewColumn* gcol = (GtkTreeViewColumn*)g_list_nth_data(cols, (guint)pos);
+ g_list_free(cols);
+ if (gcol) {
+ wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol);
+ for (unsigned i = 0; i < n; i++) {
+ if (dv->GetColumn(i) == wxcol) return (int)i;
+ }
+ }
+ return -1;
+ }
+#endif
+ for (unsigned i = 0; i < n; i++) {
+ wxDataViewColumn* c = dv->GetColumn(i);
+ if (c && dv->GetColumnPosition(c) == (unsigned)pos) return (int)i;
@@ -774,6 +774,25 @@ int wxbr_dvlc_col_at_pos(void* win, int pos) {
wxDataViewCtrl* dv = (wxDataViewCtrl*)win;
unsigned n = dv->GetColumnCount();
if (pos < 0 || (unsigned)pos >= n) return -1;
#ifdef __WXGTK__
// wxGTK's GetColumnPosition() does NOT reflect a native GtkTreeView column
// drag, so after the user reorders columns it reports the creation order and
// the reorder is silently lost. Read the real display order from the
// GtkTreeView instead, then map the column back to its wx creation index.
GtkWidget* tvw = dv->GtkGetTreeView();
if (tvw) {
GList* cols = gtk_tree_view_get_columns(GTK_TREE_VIEW(tvw)); // display order
GtkTreeViewColumn* gcol = (GtkTreeViewColumn*)g_list_nth_data(cols, (guint)pos);
g_list_free(cols);
if (gcol) {
wxDataViewColumn* wxcol = dv->GTKColumnToWX(gcol);
for (unsigned i = 0; i < n; i++) {
if (dv->GetColumn(i) == wxcol) return (int)i;
}
}
return -1;
}
#endif
for (unsigned i = 0; i < n; i++) {
wxDataViewColumn* c = dv->GetColumn(i);
if (c && dv->GetColumnPosition(c) == (unsigned)pos) return (int)i;