diff --git a/ch32v-insert-coin/src/app.rs b/ch32v-insert-coin/src/app.rs index b4e483f..a8fdbb8 100644 --- a/ch32v-insert-coin/src/app.rs +++ b/ch32v-insert-coin/src/app.rs @@ -186,7 +186,6 @@ pub use settings::Settings; // #[cfg(feature = "enable_print")] use ch32_hal::println; -#[derive(Clone)] pub struct TimerConfig { pub sp_timer_ms: usize, pub lp_timer_ms: usize, @@ -298,11 +297,9 @@ impl Services { } } -#[derive(Clone)] pub struct Config { pub system_tick_rate_hz: usize, pub timers: TimerConfig, - pub max_volume_pct: u8, } pub struct Sequences { @@ -327,7 +324,6 @@ pub struct App { services: Services, sequences: Sequences, interfaces: Interfaces, - config: Config, } use settings::Level; @@ -339,15 +335,13 @@ impl App { interfaces: Interfaces, settings: Settings, ) -> Self { - let tmr_cfg = config.clone(); Self { state: State::default(), settings, - timers: Timers::new(tmr_cfg.timers, tmr_cfg.system_tick_rate_hz), + timers: Timers::new(config.timers, config.system_tick_rate_hz), services, sequences, interfaces, - config, } } @@ -436,13 +430,13 @@ impl App { } if self.timers.led0_timer.need_service() { let out = match self.settings.brightness { - Level::Off => 2, + Level::Off => 0, Level::Low => 5, Level::Medium => 25, Level::High => 75, Level::Maximum => { self.sequences.led0.next(); - core::cmp::max(self.sequences.led0.get_value() / 6, 2) + self.sequences.led0.get_value() / 6 } }; @@ -453,13 +447,13 @@ impl App { } if self.timers.led1_timer.need_service() { let out = match self.settings.brightness { - Level::Off => 2, + Level::Off => 0, Level::Low => 5, Level::Medium => 25, Level::High => 75, Level::Maximum => { self.sequences.led1.next(); - core::cmp::max(self.sequences.led1.get_value() / 6, 2) + self.sequences.led1.get_value() / 6 } }; self.timers.led1_timer.service(); @@ -533,14 +527,10 @@ impl App { } if self.services.synth0.need_service() { - let mut out = match self.services.synth0.service() { + let out = match self.services.synth0.service() { Some(value) => value / 6 / self.settings.volume.as_volume_divisor(), None => 0, }; - - if out > self.config.max_volume_pct { - out = self.config.max_volume_pct; - } self.interfaces .pwm_core .write_amplitude(ch32_hal::timer::Channel::Ch4, out); diff --git a/ch32v-insert-coin/src/main.rs b/ch32v-insert-coin/src/main.rs index 386a809..694ce75 100644 --- a/ch32v-insert-coin/src/main.rs +++ b/ch32v-insert-coin/src/main.rs @@ -42,7 +42,7 @@ use qingke::riscv; use crate::app::sequencer::{DynamicSequence, SequenceEntry}; -static LED0_SEQ: [u8; 8] = [5u8, 20u8, 45u8, 60u8, 75u8, 60u8, 45u8, 20u8]; +static LED0_SEQ: [u8; 8] = [0u8, 25u8, 50u8, 75u8, 100u8, 75u8, 50u8, 25u8]; pub struct Usb { usb_pin: Input<'static>, @@ -371,7 +371,6 @@ fn app_main(mut p: hal::Peripherals, app_settings: Settings) -> Settings { let app_config = Config { system_tick_rate_hz: tick_rate_hz, timers: timer_config, - max_volume_pct: 10, }; // DAC servicer setup