From 30c82a64acc31235e9bf1d978664a6f4fcee8046 Mon Sep 17 00:00:00 2001 From: pjht Date: Tue, 30 Jan 2024 13:04:14 -0600 Subject: [PATCH] Simplify setting new options on user confirmation --- src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 290de02..7ee8380 100644 --- a/src/main.rs +++ b/src/main.rs @@ -308,7 +308,6 @@ impl eframe::App for AltairEmulator { if self.running { self.run_cpu_cycle(); } - let old_fan_enabled = self.options.fan_enabled; if let Some(option_window) = self.option_window.as_mut() { if option_window.draw(ctx, &mut self.options) { self.option_window = None; @@ -320,14 +319,13 @@ impl eframe::App for AltairEmulator { .send(AudioMessage::SetVolume(self.options.volume)) .unwrap(); } - } - if (old_fan_enabled != self.options.fan_enabled) && self.fp_state.power() { - if self.options.fan_enabled { + if self.options.fan_enabled && self.fp_state.power() { self.audio_tx.send(AudioMessage::FanOn).unwrap(); } else { self.audio_tx.send(AudioMessage::FanOff).unwrap(); } } + if self.running { ctx.request_repaint(); }