added update interval to config

This commit is contained in:
peppidesu 2024-10-19 15:53:39 +02:00
parent a1f7b3ab52
commit a6eebc409e
No known key found for this signature in database
GPG key ID: 4E9BA776E329260F
2 changed files with 3 additions and 2 deletions

View file

@ -3,6 +3,7 @@ use std::time::Duration;
pub const GRID_LENGTH: usize = 1; pub const GRID_LENGTH: usize = 1;
pub const HOST: &str = "0.0.0.0:7791"; pub const HOST: &str = "0.0.0.0:7791";
pub const IMAGE_SAVE_INTERVAL: Duration = Duration::from_secs(5); 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 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 SIZE returns the size of the canvas

View file

@ -5,7 +5,7 @@ use std::{
use chrono::Local; use chrono::Local;
use debug_print::{debug_eprintln, debug_println}; use debug_print::{debug_eprintln, debug_println};
use flurry::{ use flurry::{
config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL}, config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL},
flutclient::FlutClient, flutclient::FlutClient,
grid::{self, Flut}, grid::{self, Flut},
COUNTER, COUNTER,
@ -70,7 +70,7 @@ async fn handle_flut(flut_listener: TcpListener, grids: Arc<[grid::Flut<u32>]>)
} }
async fn jpeg_update_loop(grids: Arc<[Flut<u32>]>) -> io::Result<Never> { async fn jpeg_update_loop(grids: Arc<[Flut<u32>]>) -> io::Result<Never> {
let mut interval = interval(Duration::from_millis(20)); let mut interval = interval(JPEG_UPDATE_INTERVAL);
loop { loop {
interval.tick().await; interval.tick().await;
for grid in grids.as_ref() { for grid in grids.as_ref() {