use vergen

This commit is contained in:
Empire 2023-11-27 01:07:07 +01:00
parent d35b814047
commit 031e8de99f
4 changed files with 10 additions and 8 deletions

View File

@ -66,14 +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"
#?bq34z100 required
[build-dependencies]
embuild = "0.31.3"
vergen = { version = "8.2.6", features = ["build", "git", "gitcl"] }

View File

@ -1,3 +1,5 @@
use vergen::EmitBuilder;
fn main() {
embuild::espidf::sysenv::output();
let _ = EmitBuilder::builder().all_git().emit();
}

View File

@ -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;
@ -26,8 +25,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()?;

View File

@ -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