diff --git a/crates/alkane-gui/src/fixtures.rs b/crates/alkane-gui/src/fixtures.rs index 313d0dd3..16094fc8 100644 --- a/crates/alkane-gui/src/fixtures.rs +++ b/crates/alkane-gui/src/fixtures.rs @@ -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") { diff --git a/crates/alkane-gui/src/model.rs b/crates/alkane-gui/src/model.rs index 1c1f1776..6160487f 100644 --- a/crates/alkane-gui/src/model.rs +++ b/crates/alkane-gui/src/model.rs @@ -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(), diff --git a/crates/alkane-gui/src/scan.rs b/crates/alkane-gui/src/scan.rs index 1a68ce58..68bb9152 100644 --- a/crates/alkane-gui/src/scan.rs +++ b/crates/alkane-gui/src/scan.rs @@ -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, diff --git a/crates/alkane-gui/src/ui.rs b/crates/alkane-gui/src/ui.rs index 40a3a58b..d8600fd0 100644 --- a/crates/alkane-gui/src/ui.rs +++ b/crates/alkane-gui/src/ui.rs @@ -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, // A confirmation dialog for disruptive actions, plus its pending target. confirm_dialog: Widget, pending_confirm: Option<(Vec, 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 { diff --git a/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch b/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch index b5ffac76..2dc13cb1 100644 --- a/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch +++ b/thirdparty/wx-rs/patches/0003-widget-bridge-cpp.patch @@ -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; 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 8fdbd578..ccb766b0 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 @@ -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;