This repository has been archived on 2026-08-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
donglora/vendor/az/build.rs
T
swaitsandClaude Opus 4.6 3102fc747a feat: add display UI with splash screen, dashboard, and RSSI sparkline
Implement full SSD1306 OLED display support:
- Splash screen on boot (1.5s) with project name, version, board
- Dashboard showing radio state, config, counters, RSSI/SNR
- RSSI history sparkline (64-sample ring buffer, 2px-wide bars)
- DisplayOn/DisplayOff host commands routed via dedicated channel
- Pure render functions against generic DrawTarget (no hardware coupling)
- Display on/off control bypasses radio task entirely

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 20:42:54 -06:00

90 lines
2.7 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright © 2019–2021 Trevor Spiteri
// Copying and distribution of this file, with or without
// modification, are permitted in any medium without royalty provided
// the copyright notice and this notice are preserved. This file is
// offered as-is, without any warranty.
use std::{
env,
ffi::OsString,
fs::{self, File},
io::{Result as IoResult, Write},
path::{Path, PathBuf},
process::{Command, Stdio},
};
fn main() {
check_feature("track_caller", TRY_TRACK_CALLER);
}
fn check_feature(name: &str, contents: &str) {
let rustc = cargo_env("RUSTC");
let out_dir = PathBuf::from(cargo_env("OUT_DIR"));
let try_dir = out_dir.join(format!("try_{}", name));
let filename = format!("try_{}.rs", name);
create_dir_or_panic(&try_dir);
println!("$ cd {:?}", try_dir);
create_file_or_panic(&try_dir.join(&filename), contents);
let mut cmd = Command::new(&rustc);
cmd.current_dir(&try_dir)
.stdout(Stdio::null())
.stderr(Stdio::null())
.args(&[&*filename, "--emit=dep-info,metadata"]);
println!("$ {:?} >& /dev/null", cmd);
let status = cmd
.status()
.unwrap_or_else(|_| panic!("Unable to execute: {:?}", cmd));
if status.success() {
println!("cargo:rustc-cfg={}", name);
}
if cfg!(target_os = "windows") {
// remove_dir_all started to fail on rustc 1.64.0-nightly
let _ = remove_dir(&try_dir);
} else {
remove_dir_or_panic(&try_dir);
}
}
fn cargo_env(name: &str) -> OsString {
env::var_os(name)
.unwrap_or_else(|| panic!("environment variable not found: {}, please use cargo", name))
}
fn remove_dir(dir: &Path) -> IoResult<()> {
if !dir.exists() {
return Ok(());
}
assert!(dir.is_dir(), "Not a directory: {:?}", dir);
println!("$ rm -r {:?}", dir);
fs::remove_dir_all(dir)
}
fn remove_dir_or_panic(dir: &Path) {
remove_dir(dir).unwrap_or_else(|_| panic!("Unable to remove directory: {:?}", dir));
}
fn create_dir(dir: &Path) -> IoResult<()> {
println!("$ mkdir -p {:?}", dir);
fs::create_dir_all(dir)
}
fn create_dir_or_panic(dir: &Path) {
create_dir(dir).unwrap_or_else(|_| panic!("Unable to create directory: {:?}", dir));
}
fn create_file_or_panic(filename: &Path, contents: &str) {
println!("$ printf '%s' {:?}... > {:?}", &contents[0..10], filename);
let mut file =
File::create(filename).unwrap_or_else(|_| panic!("Unable to create file: {:?}", filename));
file.write_all(contents.as_bytes())
.unwrap_or_else(|_| panic!("Unable to write to file: {:?}", filename));
}
const TRY_TRACK_CALLER: &str = r#"// try_track_caller.rs
#[track_caller]
fn _tracked() {}
fn main() {}
"#;