From b65f2bebd3963e6f65aeb653834e4bb3c1260c85 Mon Sep 17 00:00:00 2001 From: gferraro Date: Mon, 18 Mar 2024 15:40:51 +1300 Subject: [PATCH] slight tidy up --- src/device_config.rs | 1 - src/main.rs | 22 ++-------------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/device_config.rs b/src/device_config.rs index bd7a5fa..30ff942 100644 --- a/src/device_config.rs +++ b/src/device_config.rs @@ -573,7 +573,6 @@ impl DeviceConfig { pub fn load_last_offload(&mut self) { let offload_fs = fs::read("/etc/cacophony/.offload_time"); - // .map_err(|_| "Error reading file from disk")?; let last_offload = match offload_fs{ Ok(file_data) => Some(LittleEndian::read_i64(&file_data[0..8])), _ => { diff --git a/src/main.rs b/src/main.rs index 3c6b1ac..917a3f9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,7 @@ mod telemetry; mod utils; use byteorder::{BigEndian, ByteOrder, LittleEndian}; -use chrono::{DateTime, NaiveDateTime}; +use chrono::{ NaiveDateTime}; use rppal::spi::BitOrder; use rppal::{ gpio::{Gpio, Trigger}, @@ -37,7 +37,7 @@ use crate::event_logger::{LoggerEvent, LoggerEventKind}; use crate::mode_config::ModeConfig; use crate::socket_stream::{get_socket_address, SocketStream}; use crate::telemetry::{read_telemetry, Telemetry}; -use crate::utils::{u8_slice_as_u16_slice}; +use crate::utils::u8_slice_as_u16_slice; use crate::ExtTransferMessage::{ BeginAndEndFileTransfer, BeginFileTransfer, CameraConnectInfo, CameraRawFrameTransfer, EndFileTransfer, GetMotionDetectionMask, ResumeFileTransfer, @@ -197,23 +197,6 @@ fn save_audio_file_to_disk(audio_bytes: Vec, output_dir: &str) { } } - // NOTE: For debug purposes, we may want to also save the CPTV file locally for inspection. - // let path = format!( - // "{}/{}.cptv", - // "/home/pi", - // recording_date_time.format("%Y-%m-%d--%H-%M-%S") - // ); - // match fs::write(&path, &cptv_bytes) { - // Ok(()) => { - // info!("Saved CPTV file {}", path); - // } - // Err(e) => { - // error!( - // "Failed writing CPTV file to storage at {}, reason: {}", - // path, e - // ); - // } - // } } else { error!("File {} already exists, discarding duplicate", path); } @@ -666,7 +649,6 @@ fn main() { LittleEndian::write_u16(&mut return_payload_buf[6..8], 0); spi.write(&return_payload_buf).unwrap(); if process_interrupted(&term, &mut attiny_i2c_interface) { - info!("ENDING PROCESS"); break 'transfer; } continue 'transfer;