forked from M-Labs/thermostat
Compare commits
1 Commits
show-firmw
...
master
Author | SHA1 | Date | |
---|---|---|---|
0dc7b248b7 |
158
Cargo.lock
generated
158
Cargo.lock
generated
@ -62,21 +62,6 @@ version = "1.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "2.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "built"
|
|
||||||
version = "0.7.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c360505aed52b7ec96a3636c3f039d99103c37d1d9b4f7a8c743d3ea9ffcd03b"
|
|
||||||
dependencies = [
|
|
||||||
"git2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.3.4"
|
version = "1.3.4"
|
||||||
@ -89,16 +74,6 @@ version = "0.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.0.83"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
|
|
||||||
dependencies = [
|
|
||||||
"jobserver",
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -229,15 +204,6 @@ dependencies = [
|
|||||||
"void",
|
"void",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "form_urlencoded"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generic-array"
|
name = "generic-array"
|
||||||
version = "0.12.3"
|
version = "0.12.3"
|
||||||
@ -266,19 +232,6 @@ dependencies = [
|
|||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "git2"
|
|
||||||
version = "0.19.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.4.2",
|
|
||||||
"libc",
|
|
||||||
"libgit2-sys",
|
|
||||||
"log",
|
|
||||||
"url",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hash32"
|
name = "hash32"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@ -301,61 +254,12 @@ dependencies = [
|
|||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "0.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-bidi",
|
|
||||||
"unicode-normalization",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jobserver"
|
|
||||||
version = "0.1.27"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc"
|
|
||||||
version = "0.2.152"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libgit2-sys"
|
|
||||||
version = "0.17.0+1.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"libz-sys",
|
|
||||||
"pkg-config",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
|
checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libz-sys"
|
|
||||||
version = "1.1.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.11"
|
version = "0.4.11"
|
||||||
@ -438,18 +342,6 @@ dependencies = [
|
|||||||
"cortex-m-semihosting",
|
"cortex-m-semihosting",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "percent-encoding"
|
|
||||||
version = "2.3.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pkg-config"
|
|
||||||
version = "0.3.29"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "postcard"
|
name = "postcard"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
@ -577,7 +469,7 @@ version = "0.7.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3e4a069bef843d170df47e7c0a8bf8d037f217d9f5b325865acc3e466ffe40d3"
|
checksum = "3e4a069bef843d170df47e7c0a8bf8d037f217d9f5b325865acc3e466ffe40d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1",
|
"bitflags",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"log",
|
"log",
|
||||||
"managed",
|
"managed",
|
||||||
@ -661,7 +553,6 @@ version = "0.0.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bare-metal 1.0.0",
|
"bare-metal 1.0.0",
|
||||||
"bit_field",
|
"bit_field",
|
||||||
"built",
|
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"cortex-m 0.6.7",
|
"cortex-m 0.6.7",
|
||||||
"cortex-m-log",
|
"cortex-m-log",
|
||||||
@ -685,42 +576,12 @@ dependencies = [
|
|||||||
"usbd-serial",
|
"usbd-serial",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec"
|
|
||||||
version = "1.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec_macros"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "typenum"
|
name = "typenum"
|
||||||
version = "1.12.0"
|
version = "1.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-bidi"
|
|
||||||
version = "0.3.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-normalization"
|
|
||||||
version = "0.1.22"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
@ -738,17 +599,6 @@ dependencies = [
|
|||||||
"typenum",
|
"typenum",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "url"
|
|
||||||
version = "2.5.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
|
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"idna",
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "usb-device"
|
name = "usb-device"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
@ -772,12 +622,6 @@ version = "0.1.2"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c"
|
checksum = "876e32dcadfe563a4289e994f7cb391197f362b6315dc45e8ba4aa6f564a4b3c"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vcpkg"
|
|
||||||
version = "0.2.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.2"
|
version = "0.9.2"
|
||||||
|
@ -38,9 +38,6 @@ heapless = "0.5"
|
|||||||
serde-json-core = "0.1"
|
serde-json-core = "0.1"
|
||||||
sfkv = "0.1"
|
sfkv = "0.1"
|
||||||
|
|
||||||
[build-dependencies]
|
|
||||||
built = { version = "0.7", features = ["git2"] }
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
semihosting = ["panic-semihosting", "cortex-m-log/semihosting"]
|
semihosting = ["panic-semihosting", "cortex-m-log/semihosting"]
|
||||||
|
|
||||||
|
@ -127,7 +127,6 @@ formatted as line-delimited JSON.
|
|||||||
| `fcurve <a> <b> <c>` | Set fan controller curve coefficients (see *Fan control* section) |
|
| `fcurve <a> <b> <c>` | Set fan controller curve coefficients (see *Fan control* section) |
|
||||||
| `fcurve default` | Set fan controller curve coefficients to defaults (see *Fan control* section) |
|
| `fcurve default` | Set fan controller curve coefficients to defaults (see *Fan control* section) |
|
||||||
| `hwrev` | Show hardware revision, and settings related to it |
|
| `hwrev` | Show hardware revision, and settings related to it |
|
||||||
| `firmware` | Show firmware details |
|
|
||||||
|
|
||||||
|
|
||||||
## USB
|
## USB
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
diff --git a/build.rs b/build.rs
|
|
||||||
index 03826ef7..35551b5c 100644
|
|
||||||
--- a/build.rs
|
|
||||||
+++ b/build.rs
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
use std::env;
|
|
||||||
-use std::fs::File;
|
|
||||||
+use std::fs::{read_to_string, write, File};
|
|
||||||
use std::io::Write;
|
|
||||||
use std::path::PathBuf;
|
|
||||||
@@ -25,3 +25,14 @@ fn main() {
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
+ let built_info = read_to_string(out.join("built.rs"))
|
|
||||||
+ .unwrap()
|
|
||||||
+ .replace(
|
|
||||||
+ "GIT_DIRTY: Option<bool> = None",
|
|
||||||
+ "GIT_DIRTY: Option<bool> = Some(@gitDirty@)",
|
|
||||||
+ )
|
|
||||||
+ .replace(
|
|
||||||
+ "GIT_COMMIT_HASH: Option<&str> = None",
|
|
||||||
+ "GIT_COMMIT_HASH: Option<&str> = Some(\"@gitCommitHash@\")",
|
|
||||||
+ );
|
|
||||||
+ write(out.join("built.rs"), built_info).unwrap();
|
|
||||||
}
|
|
9
build.rs
9
build.rs
@ -15,13 +15,4 @@ fn main() {
|
|||||||
// Only re-run the build script when memory.x is changed,
|
// Only re-run the build script when memory.x is changed,
|
||||||
// instead of when any part of the source code changes.
|
// instead of when any part of the source code changes.
|
||||||
println!("cargo:rerun-if-changed=memory.x");
|
println!("cargo:rerun-if-changed=memory.x");
|
||||||
|
|
||||||
// Embed build-time information, such as the Git hash.
|
|
||||||
// Use stub file if acquiring fails.
|
|
||||||
if built::write_built_file().is_err() {
|
|
||||||
File::create(out.join("built.rs"))
|
|
||||||
.unwrap()
|
|
||||||
.write_all(include_bytes!("src/built.rs"))
|
|
||||||
.unwrap();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -42,15 +42,6 @@
|
|||||||
|
|
||||||
nativeBuildInputs = [ pkgs.llvm ];
|
nativeBuildInputs = [ pkgs.llvm ];
|
||||||
|
|
||||||
patches = pkgs.lib.lists.optional (self ? rev || self ? dirtyRev) (
|
|
||||||
# TODO: use pkgs.replaceVars after Nixpkgs 24.11
|
|
||||||
pkgs.substituteAll {
|
|
||||||
src = ./add-git-info.patch;
|
|
||||||
gitDirty = pkgs.lib.boolToString (self ? dirtyRev);
|
|
||||||
gitCommitHash = self.rev or (pkgs.lib.removeSuffix "-dirty" self.dirtyRev);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
cargo build --release --bin thermostat
|
cargo build --release --bin thermostat
|
||||||
'';
|
'';
|
||||||
|
114
src/built.rs
114
src/built.rs
@ -1,114 +0,0 @@
|
|||||||
//
|
|
||||||
// Stub file for when acquiring build-time information fails
|
|
||||||
//
|
|
||||||
#[doc = r#"The Continuous Integration platform detected during compilation."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CI_PLATFORM: Option<&str> = None;
|
|
||||||
#[doc = r#"The full version."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_VERSION: &str = r"";
|
|
||||||
#[doc = r#"The major version."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_VERSION_MAJOR: &str = r"";
|
|
||||||
#[doc = r#"The minor version."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_VERSION_MINOR: &str = r"";
|
|
||||||
#[doc = r#"The patch version."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_VERSION_PATCH: &str = r"";
|
|
||||||
#[doc = r#"The pre-release version."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_VERSION_PRE: &str = r"";
|
|
||||||
#[doc = r#"A colon-separated list of authors."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_AUTHORS: &str = r"";
|
|
||||||
#[doc = r#"The name of the package."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_NAME: &str = r"";
|
|
||||||
#[doc = r#"The description."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_DESCRIPTION: &str = r"";
|
|
||||||
#[doc = r#"The homepage."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_HOMEPAGE: &str = r"";
|
|
||||||
#[doc = r#"The license."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_LICENSE: &str = r"";
|
|
||||||
#[doc = r#"The source repository as advertised in Cargo.toml."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PKG_REPOSITORY: &str = r"";
|
|
||||||
#[doc = r#"The target triple that was being compiled for."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const TARGET: &str = r"";
|
|
||||||
#[doc = r#"The host triple of the rust compiler."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const HOST: &str = r"";
|
|
||||||
#[doc = r#"`release` for release builds, `debug` for other builds."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const PROFILE: &str = r"";
|
|
||||||
#[doc = r#"The compiler that cargo resolved to use."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const RUSTC: &str = r"";
|
|
||||||
#[doc = r#"The documentation generator that cargo resolved to use."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const RUSTDOC: &str = r"";
|
|
||||||
#[doc = r#"Value of OPT_LEVEL for the profile used during compilation."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const OPT_LEVEL: &str = r"";
|
|
||||||
#[doc = r#"The parallelism that was specified during compilation."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const NUM_JOBS: u32 = 0;
|
|
||||||
#[doc = r#"Value of DEBUG for the profile used during compilation."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const DEBUG: bool = false;
|
|
||||||
#[doc = r#"The features that were enabled during compilation."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const FEATURES: [&str; 0] = [];
|
|
||||||
#[doc = r#"The features as a comma-separated string."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const FEATURES_STR: &str = r"";
|
|
||||||
#[doc = r#"The features as above, as lowercase strings."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const FEATURES_LOWERCASE: [&str; 0] = [];
|
|
||||||
#[doc = r#"The feature-string as above, from lowercase strings."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const FEATURES_LOWERCASE_STR: &str = r"";
|
|
||||||
#[doc = r#"The output of `rustc -V`"#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const RUSTC_VERSION: &str = r"";
|
|
||||||
#[doc = r#"The output of `rustdoc -V`"#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const RUSTDOC_VERSION: &str = r"";
|
|
||||||
#[doc = r#"The target architecture, given by `CARGO_CFG_TARGET_ARCH`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_TARGET_ARCH: &str = r"";
|
|
||||||
#[doc = r#"The endianness, given by `CARGO_CFG_TARGET_ENDIAN`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_ENDIAN: &str = r"";
|
|
||||||
#[doc = r#"The toolchain-environment, given by `CARGO_CFG_TARGET_ENV`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_ENV: &str = r"";
|
|
||||||
#[doc = r#"The OS-family, given by `CARGO_CFG_TARGET_FAMILY`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_FAMILY: &str = r"";
|
|
||||||
#[doc = r#"The operating system, given by `CARGO_CFG_TARGET_OS`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_OS: &str = r"";
|
|
||||||
#[doc = r#"The pointer width, given by `CARGO_CFG_TARGET_POINTER_WIDTH`."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const CFG_POINTER_WIDTH: &str = r"";
|
|
||||||
#[doc = r#"If the crate was compiled from within a git-repository, `GIT_VERSION` contains HEAD's tag. The short commit id is used if HEAD is not tagged."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const GIT_VERSION: Option<&str> = None;
|
|
||||||
#[doc = r#"If the repository had dirty/staged files."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const GIT_DIRTY: Option<bool> = None;
|
|
||||||
#[doc = r#"If the crate was compiled from within a git-repository, `GIT_HEAD_REF` contains full name to the reference pointed to by HEAD (e.g.: `refs/heads/master`). If HEAD is detached or the branch name is not valid UTF-8 `None` will be stored."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const GIT_HEAD_REF: Option<&str> = None;
|
|
||||||
#[doc = r#"If the crate was compiled from within a git-repository, `GIT_COMMIT_HASH` contains HEAD's full commit SHA-1 hash."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const GIT_COMMIT_HASH: Option<&str> = None;
|
|
||||||
#[doc = r#"If the crate was compiled from within a git-repository, `GIT_COMMIT_HASH_SHORT` contains HEAD's short commit SHA-1 hash."#]
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub const GIT_COMMIT_HASH_SHORT: Option<&str> = None;
|
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
ad7172, b_parameter as bp,
|
ad7172, b_parameter as bp,
|
||||||
command_parser::{CenterPoint, Polarity},
|
command_parser::{CenterPoint, Polarity},
|
||||||
config::PwmLimits,
|
config::OutputLimits,
|
||||||
pid,
|
pid,
|
||||||
};
|
};
|
||||||
use num_traits::Zero;
|
use num_traits::Zero;
|
||||||
@ -29,7 +29,7 @@ pub struct ChannelState {
|
|||||||
pub center: CenterPoint,
|
pub center: CenterPoint,
|
||||||
pub dac_value: ElectricPotential,
|
pub dac_value: ElectricPotential,
|
||||||
pub i_set: ElectricCurrent,
|
pub i_set: ElectricCurrent,
|
||||||
pub pwm_limits: PwmLimits,
|
pub output_limits: OutputLimits,
|
||||||
pub pid_engaged: bool,
|
pub pid_engaged: bool,
|
||||||
pub pid: pid::Controller,
|
pub pid: pid::Controller,
|
||||||
pub bp: bp::Parameters,
|
pub bp: bp::Parameters,
|
||||||
@ -47,7 +47,7 @@ impl ChannelState {
|
|||||||
center: CenterPoint::VRef,
|
center: CenterPoint::VRef,
|
||||||
dac_value: ElectricPotential::new::<volt>(0.0),
|
dac_value: ElectricPotential::new::<volt>(0.0),
|
||||||
i_set: ElectricCurrent::new::<ampere>(0.0),
|
i_set: ElectricCurrent::new::<ampere>(0.0),
|
||||||
pwm_limits: PwmLimits {
|
output_limits: OutputLimits {
|
||||||
max_v: ElectricPotential::zero(),
|
max_v: ElectricPotential::zero(),
|
||||||
max_i_pos: ElectricCurrent::zero(),
|
max_i_pos: ElectricCurrent::zero(),
|
||||||
max_i_neg: ElectricCurrent::zero(),
|
max_i_neg: ElectricCurrent::zero(),
|
||||||
|
@ -363,15 +363,15 @@ impl Channels {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_max_v(&mut self, channel: usize) -> ElectricPotential {
|
pub fn get_max_v(&mut self, channel: usize) -> ElectricPotential {
|
||||||
self.channel_state(channel).pwm_limits.max_v
|
self.channel_state(channel).output_limits.max_v
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_max_i_pos(&mut self, channel: usize) -> ElectricCurrent {
|
pub fn get_max_i_pos(&mut self, channel: usize) -> ElectricCurrent {
|
||||||
self.channel_state(channel).pwm_limits.max_i_pos
|
self.channel_state(channel).output_limits.max_i_pos
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_max_i_neg(&mut self, channel: usize) -> ElectricCurrent {
|
pub fn get_max_i_neg(&mut self, channel: usize) -> ElectricCurrent {
|
||||||
self.channel_state(channel).pwm_limits.max_i_neg
|
self.channel_state(channel).output_limits.max_i_neg
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get current passing through TEC
|
// Get current passing through TEC
|
||||||
@ -419,7 +419,7 @@ impl Channels {
|
|||||||
let max_v = max_v.min(MAX_TEC_V).max(ElectricPotential::zero());
|
let max_v = max_v.min(MAX_TEC_V).max(ElectricPotential::zero());
|
||||||
let duty = (max_v / max).get::<ratio>();
|
let duty = (max_v / max).get::<ratio>();
|
||||||
let duty = self.set_pwm(channel, PwmPin::MaxV, duty);
|
let duty = self.set_pwm(channel, PwmPin::MaxV, duty);
|
||||||
self.channel_state(channel).pwm_limits.max_v = max_v;
|
self.channel_state(channel).output_limits.max_v = max_v;
|
||||||
(duty * max, max)
|
(duty * max, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ impl Channels {
|
|||||||
Polarity::Normal => self.set_pwm(channel, PwmPin::MaxIPos, duty),
|
Polarity::Normal => self.set_pwm(channel, PwmPin::MaxIPos, duty),
|
||||||
Polarity::Reversed => self.set_pwm(channel, PwmPin::MaxINeg, duty),
|
Polarity::Reversed => self.set_pwm(channel, PwmPin::MaxINeg, duty),
|
||||||
};
|
};
|
||||||
self.channel_state(channel).pwm_limits.max_i_pos = max_i_pos;
|
self.channel_state(channel).output_limits.max_i_pos = max_i_pos;
|
||||||
(duty * MAX_TEC_I_DUTY_TO_CURRENT_RATE, max)
|
(duty * MAX_TEC_I_DUTY_TO_CURRENT_RATE, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ impl Channels {
|
|||||||
Polarity::Normal => self.set_pwm(channel, PwmPin::MaxINeg, duty),
|
Polarity::Normal => self.set_pwm(channel, PwmPin::MaxINeg, duty),
|
||||||
Polarity::Reversed => self.set_pwm(channel, PwmPin::MaxIPos, duty),
|
Polarity::Reversed => self.set_pwm(channel, PwmPin::MaxIPos, duty),
|
||||||
};
|
};
|
||||||
self.channel_state(channel).pwm_limits.max_i_neg = max_i_neg;
|
self.channel_state(channel).output_limits.max_i_neg = max_i_neg;
|
||||||
(duty * MAX_TEC_I_DUTY_TO_CURRENT_RATE, max)
|
(duty * MAX_TEC_I_DUTY_TO_CURRENT_RATE, max)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use super::{
|
|||||||
BpParameter, CenterPoint, Command, Ipv4Config, PidParameter, Polarity, PwmPin, ShowCommand,
|
BpParameter, CenterPoint, Command, Ipv4Config, PidParameter, Polarity, PwmPin, ShowCommand,
|
||||||
},
|
},
|
||||||
config::ChannelConfig,
|
config::ChannelConfig,
|
||||||
dfu, firmware,
|
dfu,
|
||||||
flash_store::FlashStore,
|
flash_store::FlashStore,
|
||||||
hw_rev::HWRev,
|
hw_rev::HWRev,
|
||||||
net, FanCtrl, CHANNEL_CONFIG_KEY,
|
net, FanCtrl, CHANNEL_CONFIG_KEY,
|
||||||
@ -99,13 +99,13 @@ impl Handler {
|
|||||||
Ok(Handler::Handled)
|
Ok(Handler::Handled)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_pwm(socket: &mut TcpSocket, channels: &mut Channels) -> Result<Handler, Error> {
|
fn show_output(socket: &mut TcpSocket, channels: &mut Channels) -> Result<Handler, Error> {
|
||||||
match channels.output_summaries_json() {
|
match channels.output_summaries_json() {
|
||||||
Ok(buf) => {
|
Ok(buf) => {
|
||||||
send_line(socket, &buf);
|
send_line(socket, &buf);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
error!("unable to serialize pwm summary: {:?}", e);
|
error!("unable to serialize output summary: {:?}", e);
|
||||||
let _ = writeln!(socket, "{{\"error\":\"{:?}\"}}", e);
|
let _ = writeln!(socket, "{{\"error\":\"{:?}\"}}", e);
|
||||||
return Err(Error::Report);
|
return Err(Error::Report);
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ impl Handler {
|
|||||||
Ok(Handler::Handled)
|
Ok(Handler::Handled)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_pwm(
|
fn set_output(
|
||||||
socket: &mut TcpSocket,
|
socket: &mut TcpSocket,
|
||||||
channels: &mut Channels,
|
channels: &mut Channels,
|
||||||
channel: usize,
|
channel: usize,
|
||||||
@ -463,20 +463,6 @@ impl Handler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn show_firmware(socket: &mut TcpSocket) -> Result<Handler, Error> {
|
|
||||||
match firmware::summary() {
|
|
||||||
Ok(buf) => {
|
|
||||||
send_line(socket, &buf);
|
|
||||||
Ok(Handler::Handled)
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
error!("unable to serialize Firmware summary: {:?}", e);
|
|
||||||
let _ = writeln!(socket, "{{\"error\":\"{:?}\"}}", e);
|
|
||||||
Err(Error::Report)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn handle_command(
|
pub fn handle_command(
|
||||||
command: Command,
|
command: Command,
|
||||||
socket: &mut TcpSocket,
|
socket: &mut TcpSocket,
|
||||||
@ -490,7 +476,7 @@ impl Handler {
|
|||||||
Command::Quit => Ok(Handler::CloseSocket),
|
Command::Quit => Ok(Handler::CloseSocket),
|
||||||
Command::Show(ShowCommand::Input) => Handler::show_report(socket, channels),
|
Command::Show(ShowCommand::Input) => Handler::show_report(socket, channels),
|
||||||
Command::Show(ShowCommand::Pid) => Handler::show_pid(socket, channels),
|
Command::Show(ShowCommand::Pid) => Handler::show_pid(socket, channels),
|
||||||
Command::Show(ShowCommand::Output) => Handler::show_pwm(socket, channels),
|
Command::Show(ShowCommand::Output) => Handler::show_output(socket, channels),
|
||||||
Command::Show(ShowCommand::BParameter) => Handler::show_b_parameter(socket, channels),
|
Command::Show(ShowCommand::BParameter) => Handler::show_b_parameter(socket, channels),
|
||||||
Command::Show(ShowCommand::PostFilter) => Handler::show_post_filter(socket, channels),
|
Command::Show(ShowCommand::PostFilter) => Handler::show_post_filter(socket, channels),
|
||||||
Command::Show(ShowCommand::Ipv4) => Handler::show_ipv4(socket, ipv4_config),
|
Command::Show(ShowCommand::Ipv4) => Handler::show_ipv4(socket, ipv4_config),
|
||||||
@ -502,7 +488,7 @@ impl Handler {
|
|||||||
channel,
|
channel,
|
||||||
pin,
|
pin,
|
||||||
value,
|
value,
|
||||||
} => Handler::set_pwm(socket, channels, channel, pin, value),
|
} => Handler::set_output(socket, channels, channel, pin, value),
|
||||||
Command::CenterPoint { channel, center } => {
|
Command::CenterPoint { channel, center } => {
|
||||||
Handler::set_center_point(socket, channels, channel, center)
|
Handler::set_center_point(socket, channels, channel, center)
|
||||||
}
|
}
|
||||||
@ -537,7 +523,6 @@ impl Handler {
|
|||||||
}
|
}
|
||||||
Command::FanCurveDefaults => Handler::fan_defaults(socket, fan_ctrl),
|
Command::FanCurveDefaults => Handler::fan_defaults(socket, fan_ctrl),
|
||||||
Command::ShowHWRev => Handler::show_hwrev(socket, hwrev),
|
Command::ShowHWRev => Handler::show_hwrev(socket, hwrev),
|
||||||
Command::ShowFirmware => Handler::show_firmware(socket),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ pub enum Command {
|
|||||||
Reset,
|
Reset,
|
||||||
Ipv4(Ipv4Config),
|
Ipv4(Ipv4Config),
|
||||||
Show(ShowCommand),
|
Show(ShowCommand),
|
||||||
/// PWM parameter setting
|
/// Output parameter setting
|
||||||
Output {
|
Output {
|
||||||
channel: usize,
|
channel: usize,
|
||||||
pin: PwmPin,
|
pin: PwmPin,
|
||||||
@ -194,7 +194,6 @@ pub enum Command {
|
|||||||
},
|
},
|
||||||
FanCurveDefaults,
|
FanCurveDefaults,
|
||||||
ShowHWRev,
|
ShowHWRev,
|
||||||
ShowFirmware,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn end(input: &[u8]) -> IResult<&[u8], ()> {
|
fn end(input: &[u8]) -> IResult<&[u8], ()> {
|
||||||
@ -579,7 +578,6 @@ fn command(input: &[u8]) -> IResult<&[u8], Result<Command, Error>> {
|
|||||||
fan,
|
fan,
|
||||||
fan_curve,
|
fan_curve,
|
||||||
value(Ok(Command::ShowHWRev), tag("hwrev")),
|
value(Ok(Command::ShowHWRev), tag("hwrev")),
|
||||||
value(Ok(Command::ShowFirmware), tag("firmware")),
|
|
||||||
))(input)
|
))(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -869,10 +867,4 @@ mod test {
|
|||||||
let command = Command::parse(b"hwrev");
|
let command = Command::parse(b"hwrev");
|
||||||
assert_eq!(command, Ok(Command::ShowHWRev));
|
assert_eq!(command, Ok(Command::ShowHWRev));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn parse_firmware() {
|
|
||||||
let command = Command::parse(b"firmware");
|
|
||||||
assert_eq!(command, Ok(Command::ShowFirmware));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,14 @@ pub struct ChannelConfig {
|
|||||||
i_set: ElectricCurrent,
|
i_set: ElectricCurrent,
|
||||||
polarity: Polarity,
|
polarity: Polarity,
|
||||||
bp: b_parameter::Parameters,
|
bp: b_parameter::Parameters,
|
||||||
pwm: PwmLimits,
|
output_limits: OutputLimits,
|
||||||
/// uses variant `PostFilter::Invalid` instead of `None` to save space
|
/// uses variant `PostFilter::Invalid` instead of `None` to save space
|
||||||
adc_postfilter: PostFilter,
|
adc_postfilter: PostFilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChannelConfig {
|
impl ChannelConfig {
|
||||||
pub fn new(channels: &mut Channels, channel: usize) -> Self {
|
pub fn new(channels: &mut Channels, channel: usize) -> Self {
|
||||||
let pwm = PwmLimits::new(channels, channel);
|
let output_limits = OutputLimits::new(channels, channel);
|
||||||
|
|
||||||
let adc_postfilter = channels
|
let adc_postfilter = channels
|
||||||
.adc
|
.adc
|
||||||
@ -47,7 +47,7 @@ impl ChannelConfig {
|
|||||||
i_set,
|
i_set,
|
||||||
polarity: state.polarity.clone(),
|
polarity: state.polarity.clone(),
|
||||||
bp: state.bp.clone(),
|
bp: state.bp.clone(),
|
||||||
pwm,
|
output_limits,
|
||||||
adc_postfilter,
|
adc_postfilter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ impl ChannelConfig {
|
|||||||
state.pid_engaged = self.pid_engaged;
|
state.pid_engaged = self.pid_engaged;
|
||||||
state.bp = self.bp.clone();
|
state.bp = self.bp.clone();
|
||||||
|
|
||||||
self.pwm.apply(channels, channel);
|
self.output_limits.apply(channels, channel);
|
||||||
|
|
||||||
let adc_postfilter = match self.adc_postfilter {
|
let adc_postfilter = match self.adc_postfilter {
|
||||||
PostFilter::Invalid => None,
|
PostFilter::Invalid => None,
|
||||||
@ -73,18 +73,18 @@ impl ChannelConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct PwmLimits {
|
pub struct OutputLimits {
|
||||||
pub max_v: ElectricPotential,
|
pub max_v: ElectricPotential,
|
||||||
pub max_i_pos: ElectricCurrent,
|
pub max_i_pos: ElectricCurrent,
|
||||||
pub max_i_neg: ElectricCurrent,
|
pub max_i_neg: ElectricCurrent,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PwmLimits {
|
impl OutputLimits {
|
||||||
pub fn new(channels: &mut Channels, channel: usize) -> Self {
|
pub fn new(channels: &mut Channels, channel: usize) -> Self {
|
||||||
let max_v = channels.get_max_v(channel);
|
let max_v = channels.get_max_v(channel);
|
||||||
let max_i_pos = channels.get_max_i_pos(channel);
|
let max_i_pos = channels.get_max_i_pos(channel);
|
||||||
let max_i_neg = channels.get_max_i_neg(channel);
|
let max_i_neg = channels.get_max_i_neg(channel);
|
||||||
PwmLimits {
|
OutputLimits {
|
||||||
max_v,
|
max_v,
|
||||||
max_i_pos,
|
max_i_pos,
|
||||||
max_i_neg,
|
max_i_neg,
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
use crate::command_handler::JsonBuffer;
|
|
||||||
use serde::Serialize;
|
|
||||||
|
|
||||||
mod built_info {
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/built.rs"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize)]
|
|
||||||
pub struct FirmwareSummary {
|
|
||||||
git_commit_hash: Option<&'static str>,
|
|
||||||
git_dirty: Option<bool>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FirmwareSummary {
|
|
||||||
pub const fn get() -> FirmwareSummary {
|
|
||||||
FirmwareSummary {
|
|
||||||
git_commit_hash: built_info::GIT_COMMIT_HASH,
|
|
||||||
git_dirty: built_info::GIT_DIRTY,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn summary() -> Result<JsonBuffer, serde_json_core::ser::Error> {
|
|
||||||
serde_json_core::to_vec(&FirmwareSummary::get())
|
|
||||||
}
|
|
@ -50,7 +50,6 @@ mod flash_store;
|
|||||||
use command_handler::Handler;
|
use command_handler::Handler;
|
||||||
mod fan_ctrl;
|
mod fan_ctrl;
|
||||||
use fan_ctrl::FanCtrl;
|
use fan_ctrl::FanCtrl;
|
||||||
mod firmware;
|
|
||||||
mod hw_rev;
|
mod hw_rev;
|
||||||
|
|
||||||
const HSE: MegaHertz = MegaHertz(8);
|
const HSE: MegaHertz = MegaHertz(8);
|
||||||
|
Loading…
Reference in New Issue
Block a user