Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77399bdd06 |
@@ -106,8 +106,9 @@ impl Board {
|
|||||||
tuning: self.mining,
|
tuning: self.mining,
|
||||||
firmware_flash,
|
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).
|
// show variety offline).
|
||||||
|
algorithm: "SHA256".to_string(),
|
||||||
control_board: if self.model.contains("S17") {
|
control_board: if self.model.contains("S17") {
|
||||||
"Xilinx".to_string()
|
"Xilinx".to_string()
|
||||||
} else if self.model.contains("S19j") || self.model.contains("S19k") {
|
} else if self.model.contains("S19j") || self.model.contains("S19k") {
|
||||||
|
|||||||
@@ -243,6 +243,8 @@ pub struct MinerRow {
|
|||||||
pub firmware: String,
|
pub firmware: String,
|
||||||
pub api_version: String,
|
pub api_version: String,
|
||||||
pub control_board: 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
|
/// 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):
|
/// the network, so it is a best-effort inference (model-string heuristic):
|
||||||
/// `None` = unknown, `Some(true)` = PIC, `Some(false)` = noPIC. True
|
/// `None` = unknown, `Some(true)` = PIC, `Some(false)` = noPIC. True
|
||||||
@@ -369,6 +371,7 @@ pub enum Column {
|
|||||||
Serial,
|
Serial,
|
||||||
ApiVersion,
|
ApiVersion,
|
||||||
ControlBoard,
|
ControlBoard,
|
||||||
|
Algorithm,
|
||||||
Pic,
|
Pic,
|
||||||
Locked,
|
Locked,
|
||||||
Error,
|
Error,
|
||||||
@@ -389,7 +392,7 @@ pub enum Column {
|
|||||||
|
|
||||||
/// Every column, in registry order. Ip first, then the default-visible set
|
/// Every column, in registry order. Ip first, then the default-visible set
|
||||||
/// (UI-SPEC order), then all remaining metrics.
|
/// (UI-SPEC order), then all remaining metrics.
|
||||||
pub const ALL_COLUMNS: [Column; 38] = [
|
pub const ALL_COLUMNS: [Column; 39] = [
|
||||||
Column::Ip,
|
Column::Ip,
|
||||||
Column::Hashrate,
|
Column::Hashrate,
|
||||||
Column::Power,
|
Column::Power,
|
||||||
@@ -412,6 +415,7 @@ pub const ALL_COLUMNS: [Column; 38] = [
|
|||||||
Column::Serial,
|
Column::Serial,
|
||||||
Column::ApiVersion,
|
Column::ApiVersion,
|
||||||
Column::ControlBoard,
|
Column::ControlBoard,
|
||||||
|
Column::Algorithm,
|
||||||
Column::Pic,
|
Column::Pic,
|
||||||
Column::Locked,
|
Column::Locked,
|
||||||
Column::Error,
|
Column::Error,
|
||||||
@@ -467,6 +471,7 @@ impl Column {
|
|||||||
Column::Serial => "Serial",
|
Column::Serial => "Serial",
|
||||||
Column::ApiVersion => "API ver",
|
Column::ApiVersion => "API ver",
|
||||||
Column::ControlBoard => "Control board",
|
Column::ControlBoard => "Control board",
|
||||||
|
Column::Algorithm => "Algorithm",
|
||||||
Column::Pic => "PIC",
|
Column::Pic => "PIC",
|
||||||
Column::Locked => "Access",
|
Column::Locked => "Access",
|
||||||
Column::Error => "Errors",
|
Column::Error => "Errors",
|
||||||
@@ -503,6 +508,7 @@ impl Column {
|
|||||||
Column::Mac | Column::Hostname | Column::Serial => 150,
|
Column::Mac | Column::Hostname | Column::Serial => 150,
|
||||||
Column::ApiVersion | Column::Light => 90,
|
Column::ApiVersion | Column::Light => 90,
|
||||||
Column::ControlBoard => 130,
|
Column::ControlBoard => 130,
|
||||||
|
Column::Algorithm => 100,
|
||||||
Column::Pic => 70,
|
Column::Pic => 70,
|
||||||
Column::Locked => 90,
|
Column::Locked => 90,
|
||||||
Column::Error => 160,
|
Column::Error => 160,
|
||||||
@@ -644,6 +650,7 @@ impl Column {
|
|||||||
Column::Serial => r.serial.clone(),
|
Column::Serial => r.serial.clone(),
|
||||||
Column::ApiVersion => r.api_version.clone(),
|
Column::ApiVersion => r.api_version.clone(),
|
||||||
Column::ControlBoard => r.control_board.clone(),
|
Column::ControlBoard => r.control_board.clone(),
|
||||||
|
Column::Algorithm => r.algorithm.clone(),
|
||||||
Column::Pic => match r.pic_present {
|
Column::Pic => match r.pic_present {
|
||||||
Some(true) => "PIC".to_string(),
|
Some(true) => "PIC".to_string(),
|
||||||
Some(false) => "noPIC".to_string(),
|
Some(false) => "noPIC".to_string(),
|
||||||
|
|||||||
@@ -498,6 +498,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
.iter()
|
.iter()
|
||||||
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
|
.filter_map(|f| f.rpm.as_ref().map(|r| r.as_rpm()))
|
||||||
.fold(0.0f64, f64::max);
|
.fold(0.0f64, f64::max);
|
||||||
|
let algorithm = data.hashrate.as_ref().map(|h| h.algo.to_string()).unwrap_or_default();
|
||||||
let is_mining = data.is_mining;
|
let is_mining = data.is_mining;
|
||||||
let slow = crate::model::is_slow(is_mining, hashrate_ths, expected_ths);
|
let slow = crate::model::is_slow(is_mining, hashrate_ths, expected_ths);
|
||||||
let operating_state = data.operating_state.as_ref().map(|s| s.to_string()).unwrap_or_default();
|
let operating_state = data.operating_state.as_ref().map(|s| s.to_string()).unwrap_or_default();
|
||||||
@@ -525,6 +526,7 @@ async fn to_row(miner: &dyn Miner) -> MinerRow {
|
|||||||
ip: data.ip.to_string(),
|
ip: data.ip.to_string(),
|
||||||
selected: false,
|
selected: false,
|
||||||
caps,
|
caps,
|
||||||
|
algorithm,
|
||||||
pic_present,
|
pic_present,
|
||||||
write_locked,
|
write_locked,
|
||||||
errors,
|
errors,
|
||||||
|
|||||||
@@ -327,6 +327,9 @@ pub struct App {
|
|||||||
action_is_power: bool,
|
action_is_power: bool,
|
||||||
action_total: usize,
|
action_total: usize,
|
||||||
action_done: 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.
|
// A confirmation dialog for disruptive actions, plus its pending target.
|
||||||
confirm_dialog: Widget,
|
confirm_dialog: Widget,
|
||||||
pending_confirm: Option<(Vec<String>, scan::ConfigAction)>,
|
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_slow, kpi_slow) = mk_card("Slow", ColorKind::Amber);
|
||||||
let (card_not, kpi_not) = mk_card("Not hashing", ColorKind::Red);
|
let (card_not, kpi_not) = mk_card("Not hashing", ColorKind::Red);
|
||||||
let (card_paused, kpi_paused) = mk_card("Paused", ColorKind::Blue);
|
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);
|
let (_card_power, kpi_power) = mk_card("Est. power", ColorKind::Neutral);
|
||||||
drop(mk_card);
|
drop(mk_card);
|
||||||
// The 4 status cards double as quick-filters: clicking one narrows the
|
// 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_is_power: false,
|
||||||
action_total: 0,
|
action_total: 0,
|
||||||
action_done: 0,
|
action_done: 0,
|
||||||
|
action_targets: Vec::new(),
|
||||||
confirm_dialog: frame,
|
confirm_dialog: frame,
|
||||||
pending_confirm: None,
|
pending_confirm: None,
|
||||||
flash_confirm_dialog: frame,
|
flash_confirm_dialog: frame,
|
||||||
@@ -743,7 +747,8 @@ impl App {
|
|||||||
self.kpi_slow.set_label(&k.slow.to_string());
|
self.kpi_slow.set_label(&k.slow.to_string());
|
||||||
self.kpi_not.set_label(&k.not_hashing.to_string());
|
self.kpi_not.set_label(&k.not_hashing.to_string());
|
||||||
self.kpi_paused.set_label(&k.paused.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"));
|
self.kpi_power.set_label(&format_si(k.total_power_w, "W"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -912,6 +917,7 @@ impl App {
|
|||||||
old.stop();
|
old.stop();
|
||||||
}
|
}
|
||||||
let msg = format!("applying {} to {} miner(s)...", action.label(), ips.len());
|
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));
|
self.action = Some(scan::start_config_action(ips, action));
|
||||||
wx_rs::set_status_text(&msg);
|
wx_rs::set_status_text(&msg);
|
||||||
}
|
}
|
||||||
@@ -1505,6 +1511,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
if finished {
|
if finished {
|
||||||
self.action = None;
|
self.action = None;
|
||||||
|
let was_flash = self.flashing;
|
||||||
// Release the firmware-flash exclusive lock (harmless no-op for a
|
// Release the firmware-flash exclusive lock (harmless no-op for a
|
||||||
// plain config action, which never set it).
|
// plain config action, which never set it).
|
||||||
self.flashing = false;
|
self.flashing = false;
|
||||||
@@ -1512,6 +1519,13 @@ impl App {
|
|||||||
// action's outcome (incl. failures) isn't clobbered by the next tick.
|
// action's outcome (incl. failures) isn't clobbered by the next tick.
|
||||||
self.action_result = status.clone();
|
self.action_result = status.clone();
|
||||||
self.action_result_ticks = ACTION_RESULT_TICKS;
|
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 {
|
if let Some(s) = status {
|
||||||
wx_rs::set_status_text(&s);
|
wx_rs::set_status_text(&s);
|
||||||
@@ -2519,7 +2533,7 @@ impl App {
|
|||||||
(self.kpi_slow, "Slow", "1"),
|
(self.kpi_slow, "Slow", "1"),
|
||||||
(self.kpi_not, "Not hashing", "1"),
|
(self.kpi_not, "Not hashing", "1"),
|
||||||
(self.kpi_paused, "Paused", "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"),
|
(self.kpi_power, "Est. power", "21.3 kW"),
|
||||||
];
|
];
|
||||||
for (w, name, want) in want_kpis {
|
for (w, name, want) in want_kpis {
|
||||||
|
|||||||
+20
-1
@@ -1,6 +1,6 @@
|
|||||||
--- a/cpp_src/widgets_bridge.cpp
|
--- a/cpp_src/widgets_bridge.cpp
|
||||||
+++ b/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
|
+// widgets_bridge.cpp — alkane-toolkit extension to wx-rs
|
||||||
+// Adds the widget/event surface the toolkit UI needs on top of the upstream
|
+// Adds the widget/event surface the toolkit UI needs on top of the upstream
|
||||||
+// render-callback bridge (which is kept untouched).
|
+// render-callback bridge (which is kept untouched).
|
||||||
@@ -777,6 +777,25 @@
|
|||||||
+ wxDataViewCtrl* dv = (wxDataViewCtrl*)win;
|
+ wxDataViewCtrl* dv = (wxDataViewCtrl*)win;
|
||||||
+ unsigned n = dv->GetColumnCount();
|
+ unsigned n = dv->GetColumnCount();
|
||||||
+ if (pos < 0 || (unsigned)pos >= n) return -1;
|
+ 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++) {
|
+ for (unsigned i = 0; i < n; i++) {
|
||||||
+ wxDataViewColumn* c = dv->GetColumn(i);
|
+ wxDataViewColumn* c = dv->GetColumn(i);
|
||||||
+ if (c && dv->GetColumnPosition(c) == (unsigned)pos) return (int)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;
|
wxDataViewCtrl* dv = (wxDataViewCtrl*)win;
|
||||||
unsigned n = dv->GetColumnCount();
|
unsigned n = dv->GetColumnCount();
|
||||||
if (pos < 0 || (unsigned)pos >= n) return -1;
|
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++) {
|
for (unsigned i = 0; i < n; i++) {
|
||||||
wxDataViewColumn* c = dv->GetColumn(i);
|
wxDataViewColumn* c = dv->GetColumn(i);
|
||||||
if (c && dv->GetColumnPosition(c) == (unsigned)pos) return (int)i;
|
if (c && dv->GetColumnPosition(c) == (unsigned)pos) return (int)i;
|
||||||
|
|||||||
Reference in New Issue
Block a user