From a6eebc409e7d793e2c4f87cfbd05431781bdb389 Mon Sep 17 00:00:00 2001 From: peppidesu Date: Sat, 19 Oct 2024 15:53:39 +0200 Subject: [PATCH] added update interval to config --- src/config.rs | 1 + src/main.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 366179f..92a2fa6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -3,6 +3,7 @@ use std::time::Duration; pub const GRID_LENGTH: usize = 1; pub const HOST: &str = "0.0.0.0:7791"; pub const IMAGE_SAVE_INTERVAL: Duration = Duration::from_secs(5); +pub const JPEG_UPDATE_INTERVAL: Duration = Duration::from_millis(20); pub const HELP_TEXT: &[u8] = b"Flurry is a pixelflut implementation, this means you can use commands to get and set pixels in the canvas SIZE returns the size of the canvas diff --git a/src/main.rs b/src/main.rs index db0c21a..278f0dd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use std::{ use chrono::Local; use debug_print::{debug_eprintln, debug_println}; use flurry::{ - config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL}, + config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL}, flutclient::FlutClient, grid::{self, Flut}, COUNTER, @@ -70,7 +70,7 @@ async fn handle_flut(flut_listener: TcpListener, grids: Arc<[grid::Flut]>) } async fn jpeg_update_loop(grids: Arc<[Flut]>) -> io::Result { - let mut interval = interval(Duration::from_millis(20)); + let mut interval = interval(JPEG_UPDATE_INTERVAL); loop { interval.tick().await; for grid in grids.as_ref() {