Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/cargo/embassy-rp-0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewdavidmackenzie authored Aug 20, 2024
2 parents 7ef7df2 + b6851ce commit 082b8c5
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 27 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
all: picomon collectr configr viewr wimon
all: build

.PHONY: build
build: picomon collectr configr viewr wimon

.PHONY: deploy
deploy:
Expand Down
4 changes: 2 additions & 2 deletions collectr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ name = "worker"
path = "src/worker.rs"

[dependencies]
data_model = { path = "../data_model"}
worker = { version = "0.3.0", features = ["queue"]}
data_model = { path = "../data_model" }
worker = { version = "0.3.4", features = ["queue"] }
serde_derive = "~1.0"
serde = "~1.0"
serde_json = "1.0.107"
7 changes: 5 additions & 2 deletions collectr/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
all: build

.PHONY: build
build:
.PHONY: clippy
clippy:
cargo clippy

.PHONY: build
build: clippy
wrangler deploy --dry-run --outdir=dist

local:
Expand Down
14 changes: 9 additions & 5 deletions picomon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ version = "0.1.0"
readme = "README.md"
edition = "2021"

[features]
default = ["pico"]
pico = []

[dependencies]
embassy-time = { version = "0.3.0", default-features = false, features = ["defmt", "defmt-timestamp-uptime"] }
embassy-executor = { version = "0.6.0", default-features = false, features = ["task-arena-size-65536", "arch-cortex-m", "executor-thread", "executor-interrupt", "defmt", "integrated-timers"] }
Expand All @@ -14,19 +18,19 @@ cyw43 = { version = "0.1.0", default-features = false, features = ["defmt"] }
cyw43-pio = { version = "0.1.0", default-features = false, features = ["defmt"] }
panic-probe = { version = "0.3", default-features = false, features = ["print-defmt"] }
portable-atomic = { version = "1.5", default-features = false, features = ["critical-section"] }
defmt = { version = "0.3", default-features = false}
defmt = { version = "0.3", default-features = false }
defmt-rtt = { version = "0.4", default-features = false }
cortex-m-rt = { version = "0.7.0", default-features = false }
static_cell = { version = "2", default-features = false}
static_cell = { version = "2", default-features = false }
log = "0.4"

# To convert device_id into hex for use as a string
faster-hex = { version = "0.9.0", default-features = false }
faster-hex = { version = "0.9.0", default-features = false }

# To make httpclient requests to the server, with TLS
reqwless = { version="0.12.0", default-features = false, features = ["embedded-tls"]}
reqwless = { version = "0.12.0", default-features = false, features = ["embedded-tls"] }
# Needed to workaround an embassy dns server count bug
smoltcp = { version = "0.11.0", default-features = false, features = ["dns-max-server-count-4"]}
smoltcp = { version = "0.11.0", default-features = false, features = ["dns-max-server-count-4"] }

[build-dependencies]
# for reading config from a file in build.rs
Expand Down
6 changes: 3 additions & 3 deletions viewr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ path = "src/viewr.rs"
[dependencies]
data_model = { path = "../data_model" }
console_error_panic_hook = "0.1.7"
leptos = { version = "0.6.9", features = ["csr"] }
leptos_router = { version = "0.6.9", features = ["csr"] }
leptos = { version = "0.6.13", features = ["csr"] }
leptos_router = { version = "0.6.13", features = ["csr"] }
reqwasm = "0.5"
serde = { version = "1", features = ["derive"] }
chrono = "0.4.34"
chrono = "0.4.38"
3 changes: 1 addition & 2 deletions viewr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ all: build
build:
trunk build --release

deploy:
trunk build --release
deploy: build
wrangler pages deploy dist

local:
Expand Down
3 changes: 2 additions & 1 deletion wimon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ path = "src/main.rs"
[features]
default = []
ssids = ["wifiscanner"]
pico = []

[dependencies]
data_model = { path = "../data_model" }
Expand All @@ -35,7 +36,7 @@ curl = { version = "~0.4", default-features = false, features = ["rustls"] }
ctrlc = { version = "3.4.1", features = ["termination"] }

# for installing as a system service
service-manager = "0.6.0"
service-manager = "0.7.1"

# for scanning wifi and getting SSIDs visible
wifiscanner = { version = "0.5.1", optional = true }
6 changes: 3 additions & 3 deletions wimon/src/lib/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde_derive::{Deserialize, Serialize};
use url::Url;

#[cfg_attr(
not(target_abi = "eabi"),
not(feature = "pico"),
derive(Default, Serialize, Deserialize, Debug, PartialEq)
)]
pub enum MonitorSpec {
Expand All @@ -18,7 +18,7 @@ pub enum MonitorSpec {
}

#[cfg_attr(
not(target_abi = "eabi"),
not(feature = "pico"),
derive(Serialize, Deserialize, Debug, PartialEq)
)]
pub struct ReportSpec {
Expand All @@ -27,7 +27,7 @@ pub struct ReportSpec {
}

#[cfg_attr(
not(target_abi = "eabi"),
not(feature = "pico"),
derive(Default, Serialize, Deserialize)
)]
pub struct Config {
Expand Down
21 changes: 13 additions & 8 deletions wimon/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use config::MonitorSpec;
use std::{env, io};
use std::path::PathBuf;
use std::sync::mpsc::channel;
use std::time::Duration;

use service_manager::{
ServiceInstallCtx, ServiceLabel, ServiceManager, ServiceStartCtx, ServiceStopCtx,
ServiceUninstallCtx,
};
use std::path::PathBuf;
use std::sync::mpsc::channel;
use std::time::Duration;
use std::{env, io};

use config::MonitorSpec;

mod monitor;

Expand Down Expand Up @@ -47,7 +49,7 @@ fn run(config_file_path: &PathBuf) -> Result<(), io::Error> {
println!("Control-C captured, sending Stop report");
tx.send(()).expect("Could not send signal on channel.")
})
.expect("Error setting Ctrl-C handler");
.expect("Error setting Ctrl-C handler");

monitor::monitor_loop(config, rx)?;

Expand Down Expand Up @@ -86,6 +88,7 @@ fn install_service(service_name: &ServiceLabel, path_to_exec: &str) -> Result<()
username: None, // Optional String for alternative user to run service.
working_directory: Some(exec_dir),
environment: None, // Optional list of environment variables to supply the service process.
autostart: true, // autostart on reboot
})?;

// Start our service using the underlying service management platform
Expand Down Expand Up @@ -128,10 +131,12 @@ fn uninstall_service(service_name: &ServiceLabel) -> Result<(), io::Error> {

#[cfg(test)]
mod test {
use super::CONFIG_FILE_NAME;
use config::{Config, MonitorSpec};
use std::path::PathBuf;

use config::{Config, MonitorSpec};

use super::CONFIG_FILE_NAME;

#[test]
fn bundled_spec() {
let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
Expand Down

0 comments on commit 082b8c5

Please sign in to comment.