diff --git a/README.md b/README.md index 9c2de03..fc69446 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ Here is an overview of what's needed to build and run the software: - When it comes to the step `espup install`, you should consider using `espup install --targets esp32h2` instead, to avoid installing lots of unnecessary dependencies for unused Espressif targets. - `cargo build` -After connecting the ESP32-H2 via a flash adapter to an USB computer port: +After connecting the ESP32-H2 via a flash adapter to a USB computer port: - `cargo run --release` _(flashes the chip)_ - `espflash monitor` _(optional – see ESP32 console output)_ diff --git a/code/Cargo.lock b/code/Cargo.lock index 6bbf005..4f4939f 100644 --- a/code/Cargo.lock +++ b/code/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "as-slice" @@ -188,9 +188,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.15" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "shlex", ] @@ -250,18 +250,18 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1" dependencies = [ "proc-macro2", "quote", @@ -1231,9 +1231,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" -version = "0.38.35" +version = "0.38.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a85d50532239da68e9addb745ba38ff4612a242c1c7ceea689c4bc7c2f43c36f" +checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" dependencies = [ "bitflags 2.6.0", "errno", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "sensor-light" -version = "1.0.2" +version = "1.0.3-pre" dependencies = [ "anyhow", "embuild", @@ -1320,18 +1320,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -1340,9 +1340,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", diff --git a/code/Cargo.toml b/code/Cargo.toml index 23cb851..abca302 100644 --- a/code/Cargo.toml +++ b/code/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sensor-light" -version = "1.0.2" +version = "1.0.3-pre" authors = ["bitmagier "] edition = "2021" resolver = "2" diff --git a/code/src/main.rs b/code/src/main.rs index 57adadc..7a8a64f 100644 --- a/code/src/main.rs +++ b/code/src/main.rs @@ -16,18 +16,18 @@ mod peripheral; pub const LED_POWER_STAGES: u32 = 1000; /// Percentage of hardware maximum LED brightness we want to reach -pub const LED_MAX_POWER_LEVEL_PERCENT: f32 = 0.18; +pub const LED_MAX_POWER_LEVEL_PERCENT: f32 = 0.15; /// max. reaction delay when LED Power Phase is in Off or ON state pub const ON_OFF_REACTION_STEP_DELAY_MS: u32 = 500; // step-delay (and also max. reaction time) when LED Power Phase is in PowerDown or PowerUp state -pub const LED_DIMM_DOWN_STEP_DELAY_MS: u32 = 18; +pub const LED_DIMM_DOWN_STEP_DELAY_MS: u32 = 15; pub const LED_DIMM_UP_STEP_DELAY_MS: u32 = 6; pub const LUX_BUFFER_SIZE: usize = 10; -pub const LUX_THRESHOLD: f32 = 0.75; +pub const LUX_THRESHOLD: f32 = 0.30; const STATUS_LOG_INTERVAL: Duration = Duration::from_secs(2); diff --git a/code/src/peripheral.rs b/code/src/peripheral.rs index d04cde1..e0772d7 100644 --- a/code/src/peripheral.rs +++ b/code/src/peripheral.rs @@ -278,8 +278,8 @@ pub fn init_veml7700( // Initialize the VEML7700 with I2C let mut veml7700_device = Veml7700::new(i2c_driver); - // PSM mode two (in combination with defaults for other settings) means a refresh time of 1.1 sec - veml7700_device.enable_power_saving(PowerSavingMode::Two).map_err(Error::from)?; + // PSM mode Three (in combination with defaults for other settings) means a refresh time of 2.1 sec + veml7700_device.enable_power_saving(PowerSavingMode::Three).map_err(Error::from)?; veml7700_device.enable().map_err(Error::from)?; Ok(veml7700_device) } @@ -299,7 +299,7 @@ where C: LedcChannel::SpeedMode>, T: LedcTimer + 'static, { - let freq = 250.Hz(); + let freq = 120.Hz(); let resolution = Resolution::Bits12; let timer_config = TimerConfig::default()