fix: simple mode hero not taken into account

This commit is contained in:
Cyrix126 2024-11-02 16:42:33 +01:00
parent 5241d81f68
commit e1ba63e0d2
3 changed files with 14 additions and 7 deletions

View file

@ -22,6 +22,7 @@ use crate::helper::p2pool::PubP2poolApi;
use crate::helper::xrig::xmrig::ImgXmrig;
use crate::helper::xrig::xmrig::PubXmrigApi;
use crate::helper::xrig::xmrig_proxy::PubXmrigProxyApi;
use crate::helper::xvb::priv_stats::RuntimeMode;
use crate::helper::xvb::PubXvbApi;
use crate::helper::Helper;
use crate::helper::Process;
@ -596,7 +597,14 @@ impl App {
// Set saved Hero mode to runtime.
debug!("Setting runtime_mode & runtime_manual_amount");
app.xvb_api.lock().unwrap().stats_priv.runtime_mode = app.state.xvb.mode.clone().into();
// apply hero if simple mode saved with checkbox true, will let default to auto otherwise
if app.state.xvb.simple {
if app.state.xvb.simple_hero_mode {
app.xvb_api.lock().unwrap().stats_priv.runtime_mode = RuntimeMode::Hero
}
} else {
app.xvb_api.lock().unwrap().stats_priv.runtime_mode = app.state.xvb.mode.clone().into();
}
app.xvb_api.lock().unwrap().stats_priv.runtime_manual_amount =
app.state.xvb.manual_amount_raw;
// Check if [P2pool.node] exists

View file

@ -129,15 +129,13 @@ impl crate::disk::state::Xvb {
ui.style_mut().spacing.icon_spacing = space_h;
// --------------------------- XVB Simple -------------------------------------------
if self.simple {
if ui.checkbox(&mut self.simple_hero_mode, "Hero Mode").on_hover_text(XVB_HERO_SELECT).clicked() {
// also change hero mode of runtime.
if self.simple && ui.checkbox(&mut self.simple_hero_mode, "Hero Mode").on_hover_text(XVB_HERO_SELECT).clicked() {
// change rutime mode immediatly.
if self.simple_hero_mode {
api.lock().unwrap().stats_priv.runtime_mode = RuntimeMode::Hero;
} else {
} else {
api.lock().unwrap().stats_priv.runtime_mode = RuntimeMode::Auto;
}
}
});

View file

@ -822,6 +822,7 @@ fn signal_interrupt(
}
fn reset_data_xvb(pub_api: &Arc<Mutex<PubXvbApi>>, gui_api: &Arc<Mutex<PubXvbApi>>) {
let current_node = mem::take(&mut pub_api.lock().unwrap().current_node.clone());
// even if it is a restart, we want to keep set values by the user without the need from him to click on save button.
let runtime_mode = mem::take(&mut gui_api.lock().unwrap().stats_priv.runtime_mode);
let runtime_manual_amount =
mem::take(&mut gui_api.lock().unwrap().stats_priv.runtime_manual_amount);