diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 4193551..0d1d835 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -8,19 +8,25 @@ rust-version = "1.71" [profile.release] # Explicitly disable LTO which the Xtensa codegen backend has issues -lto = "thin" +#lto = "thin" opt-level = "s" strip = false -codegen-units = 1 -debug = true +#codegen-units = 1 +debug = true +overflow-checks = true +panic = "unwind" +incremental = true [profile.dev] # Explicitly disable LTO which the Xtensa codegen backend has issues -lto = "thin" -debug = true # Symbols are nice and they don't increase the size on Flash +#lto = "thin" opt-level = "s" strip = false -codegen-units = 1 +#codegen-units = 1 +debug = true +overflow-checks = true +panic = "unwind" +incremental = true [package.metadata.cargo_runner] # The string `$TARGET_FILE` will be replaced with the path from cargo. @@ -60,15 +66,16 @@ esp-idf-hal = "0.42.5" esp-idf-sys = { version = "0.33.7", features = ["binstart", "native"] } esp-ota = "0.2.0" esp_idf_build = "0.1.3" -build-time = "0.1.2" chrono = { version = "0.4.23", default-features = false , features = ["iana-time-zone"] } chrono-tz = {version="0.8.0", default-features = false , features = [ "filter-by-regex" ]} embedded-hal = "0.2.7" shift-register-driver = "0.1.1" one-wire-bus = "0.1.1" anyhow = { version = "1.0.75", features = ["std", "backtrace"] } +schemars = "0.8.16" heapless = { version = "0.8.0", features = ["serde"] } #?bq34z100 required [build-dependencies] embuild = "0.31.3" +vergen = { version = "8.2.6", features = ["build", "git", "gitcl"] } diff --git a/rust/build.rs b/rust/build.rs index 112ec3f..a72435f 100644 --- a/rust/build.rs +++ b/rust/build.rs @@ -1,3 +1,5 @@ +use vergen::EmitBuilder; fn main() { embuild::espidf::sysenv::output(); -} + let _ = EmitBuilder::builder().all_git().emit(); +} \ No newline at end of file diff --git a/rust/src/main.rs b/rust/src/main.rs index f07e236..ef40660 100644 --- a/rust/src/main.rs +++ b/rust/src/main.rs @@ -1,5 +1,4 @@ use chrono::{Datelike, Timelike, NaiveDateTime}; -use build_time::build_time_utc; use chrono_tz::Europe::Berlin; use esp_idf_hal::delay::Delay; @@ -23,8 +22,8 @@ fn main() -> Result<()>{ log::info!("Startup Rust"); - let utc_build_time = build_time_utc!(); - println!("Version was build {}", utc_build_time); + let git_hash = env!("VERGEN_GIT_DESCRIBE"); + println!("Version useing git has {}", git_hash); let mut board = PlantHal::create()?; diff --git a/rust/src/webserver/webserver.rs b/rust/src/webserver/webserver.rs index bf150b1..039fad7 100644 --- a/rust/src/webserver/webserver.rs +++ b/rust/src/webserver/webserver.rs @@ -1,6 +1,5 @@ //offer ota and config mode -use build_time::build_time_utc; use embedded_svc::http::Method; use esp_idf_svc::http::server::EspHttpServer; use esp_ota::OtaUpdate; @@ -20,9 +19,9 @@ pub fn httpd(initial_config:bool) -> EspHttpServer<'static> { return Ok(()) }).unwrap(); server - .fn_handler("/buildtime",Method::Get, |request| { + .fn_handler("/version",Method::Get, |request| { let mut response = request.into_ok_response()?; - response.write(build_time_utc!().as_bytes())?; + response.write(env!("VERGEN_GIT_DESCRIBE").as_bytes())?; return Ok(()) }).unwrap(); server