Compare commits
No commits in common. "main" and "v1.9.9-pre-30" have entirely different histories.
main
...
v1.9.9-pre
11 changed files with 17 additions and 33 deletions
|
@ -13,11 +13,10 @@ jobs:
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
- name: Select rustup channel
|
||||||
|
run: "rustup default stable"
|
||||||
- name: Update toolchain
|
- name: Update toolchain
|
||||||
run: |
|
run: "rustup target add aarch64-unknown-linux-musl"
|
||||||
rustup default stable
|
|
||||||
rustup target add aarch64-unknown-linux-musl
|
|
||||||
rustup update
|
|
||||||
- name: Install cargo-deb
|
- name: Install cargo-deb
|
||||||
run: "cargo install --locked cargo-deb"
|
run: "cargo install --locked cargo-deb"
|
||||||
- name: Build
|
- name: Build
|
|
@ -137,7 +137,7 @@ impl Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self) -> &str {
|
pub fn name(&self) -> &str {
|
||||||
self.name.as_str()
|
&self.name
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_tx_to_secondary(&mut self, tx: tokio::sync::watch::Sender<VoltageCommand>) {
|
pub fn set_tx_to_secondary(&mut self, tx: tokio::sync::watch::Sender<VoltageCommand>) {
|
||||||
|
|
|
@ -150,7 +150,6 @@ async fn watch(args: Args) -> eyre::Result<()> {
|
||||||
follow_voltage_tx,
|
follow_voltage_tx,
|
||||||
));
|
));
|
||||||
let server_task = tokio::task::spawn(server.launch());
|
let server_task = tokio::task::spawn(server.launch());
|
||||||
log::warn!("...started!");
|
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
v = controller_tasks.next() => {
|
v = controller_tasks.next() => {
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-01-16"
|
channel = "nightly"
|
||||||
targets = ["aarch64-unknown-linux-musl"]
|
|
||||||
|
|
|
@ -95,7 +95,6 @@ impl Vehicle {
|
||||||
Ok(state.charge_state)
|
Ok(state.charge_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[expect(dead_code, reason = "active charge control not yet implemented")]
|
|
||||||
pub async fn set_charging_amps(&self, charging_amps: i64) -> eyre::Result<()> {
|
pub async fn set_charging_amps(&self, charging_amps: i64) -> eyre::Result<()> {
|
||||||
self.client
|
self.client
|
||||||
.post(format!(
|
.post(format!(
|
||||||
|
|
|
@ -42,11 +42,11 @@ impl Car {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn vehicle(&self) -> &http::Vehicle {
|
pub fn vehicle(&self) -> &http::Vehicle {
|
||||||
&self.vehicle
|
&self.vehicle
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const fn state(&self) -> &tokio::sync::RwLock<CarState> {
|
pub fn state(&self) -> &tokio::sync::RwLock<CarState> {
|
||||||
&self.state
|
&self.state
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ impl ChargeState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum ChargingState {
|
pub enum ChargingState {
|
||||||
Charging,
|
Charging,
|
||||||
Stopped,
|
Stopped,
|
||||||
|
|
|
@ -60,7 +60,7 @@ impl ConfigWatcher {
|
||||||
async fn overwrite_config(config: Config) -> eyre::Result<()> {
|
async fn overwrite_config(config: Config) -> eyre::Result<()> {
|
||||||
*CONFIG
|
*CONFIG
|
||||||
.get()
|
.get()
|
||||||
.ok_or_else(|| eyre::eyre!("could not get config"))?
|
.ok_or(eyre::eyre!("could not get config"))?
|
||||||
.write()
|
.write()
|
||||||
.await = config;
|
.await = config;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -4,7 +4,6 @@ pub struct VehicleController {
|
||||||
control_state: ChargeRateControllerState,
|
control_state: ChargeRateControllerState,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[expect(dead_code, reason = "not all states are currently in use")]
|
|
||||||
pub enum ChargeRateControllerState {
|
pub enum ChargeRateControllerState {
|
||||||
Inactive,
|
Inactive,
|
||||||
Charging { rate_amps: i64 },
|
Charging { rate_amps: i64 },
|
||||||
|
@ -15,7 +14,7 @@ pub enum InterfaceRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VehicleController {
|
impl VehicleController {
|
||||||
pub const fn new(
|
pub fn new(
|
||||||
car: std::sync::Arc<crate::api::Car>,
|
car: std::sync::Arc<crate::api::Car>,
|
||||||
requests: tokio::sync::mpsc::UnboundedReceiver<InterfaceRequest>,
|
requests: tokio::sync::mpsc::UnboundedReceiver<InterfaceRequest>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
@ -51,10 +50,7 @@ impl VehicleController {
|
||||||
}
|
}
|
||||||
match self.control_state {
|
match self.control_state {
|
||||||
ChargeRateControllerState::Inactive => {
|
ChargeRateControllerState::Inactive => {
|
||||||
let car_state = self.car.state().read().await;
|
if let Some(state) = self.car.state().read().await.charge_state().await {
|
||||||
let state = car_state.charge_state().await;
|
|
||||||
|
|
||||||
if let Some(state) = state {
|
|
||||||
if state.is_charging() {
|
if state.is_charging() {
|
||||||
self.control_state = ChargeRateControllerState::Charging {
|
self.control_state = ChargeRateControllerState::Charging {
|
||||||
rate_amps: state.charge_amps,
|
rate_amps: state.charge_amps,
|
||||||
|
@ -62,14 +58,10 @@ impl VehicleController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ChargeRateControllerState::Charging { rate_amps: _ } => todo!(),
|
ChargeRateControllerState::Charging { rate_amps } => todo!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[expect(
|
|
||||||
clippy::needless_pass_by_ref_mut,
|
|
||||||
reason = "this will eventually need to mutate self"
|
|
||||||
)]
|
|
||||||
pub async fn process_requests(&mut self, req: InterfaceRequest) {
|
pub async fn process_requests(&mut self, req: InterfaceRequest) {
|
||||||
if let Err(e) = match req {
|
if let Err(e) = match req {
|
||||||
InterfaceRequest::FlashLights => self.car.vehicle().flash_lights().await,
|
InterfaceRequest::FlashLights => self.car.vehicle().flash_lights().await,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![allow(clippy::significant_drop_tightening)]
|
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
|
@ -27,7 +27,7 @@ pub struct ServerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ServerState {
|
impl ServerState {
|
||||||
pub const fn new(car: Arc<Car>, api_requests: UnboundedSender<InterfaceRequest>) -> Self {
|
pub fn new(car: Arc<Car>, api_requests: UnboundedSender<InterfaceRequest>) -> Self {
|
||||||
Self { car, api_requests }
|
Self { car, api_requests }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,12 +52,10 @@ impl Handler for UiStatic {
|
||||||
data: v.contents().to_vec(),
|
data: v.contents().to_vec(),
|
||||||
name: p,
|
name: p,
|
||||||
})
|
})
|
||||||
.or_else(|| {
|
.or(UI_DIR_FILES.get_file(&plus_index).map(|v| RawHtml {
|
||||||
UI_DIR_FILES.get_file(&plus_index).map(|v| RawHtml {
|
data: v.contents().to_vec(),
|
||||||
data: v.contents().to_vec(),
|
name: plus_index,
|
||||||
name: plus_index,
|
}));
|
||||||
})
|
|
||||||
});
|
|
||||||
file.respond_to(req).or_forward((data, Status::NotFound))
|
file.respond_to(req).or_forward((data, Status::NotFound))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue