Compare commits
No commits in common. "69b619dbf5fc26996cbfb4bb0244a108c3162150" and "5ff4ecacdd4b4d5d15cb4e37609cd49eb86daaa3" have entirely different histories.
69b619dbf5
...
5ff4ecacdd
28
src/main.rs
28
src/main.rs
@ -16,7 +16,7 @@ use std::sync::Arc;
|
||||
use redis_ctrl::{RedisCtrl, Order};
|
||||
use conf::Conf;
|
||||
use errors::LJResult;
|
||||
use point::{Point,Color};
|
||||
use point::Point;
|
||||
use transformer::Transformers;
|
||||
use log::{LevelFilter, info, /* warn, */ error};
|
||||
use env_logger::Builder;
|
||||
@ -87,10 +87,9 @@ fn run_all() -> LJResult<()> {
|
||||
// 6 : Max Intensity Change = reread redis key /intensity
|
||||
// 7 : kpps change = reread redis key /kpps
|
||||
// 8 : color balance change = reread redis keys /red /green /blue
|
||||
match order {
|
||||
Order::Draw | Order::Black => {
|
||||
world_state.black = order == Order::Black;
|
||||
|
||||
match order {
|
||||
Order::Draw => {
|
||||
let frame = get_next_frame(
|
||||
&config,
|
||||
&transformers,
|
||||
@ -157,27 +156,6 @@ fn get_next_frame(
|
||||
line = transformer.apply(&line, world_state);
|
||||
}
|
||||
|
||||
info!("-> {}", world_state.black);
|
||||
|
||||
// LIMITER and BLACK
|
||||
line = line.into_iter()
|
||||
.map(| p | {
|
||||
|
||||
let color = if world_state.black {
|
||||
Color { r: 0, g: 0, b: 0 }
|
||||
} else {
|
||||
Color {
|
||||
r: p.color.r.min(world_state.intensity),
|
||||
g: p.color.g.min(world_state.intensity),
|
||||
b: p.color.b.min(world_state.intensity)
|
||||
}
|
||||
};
|
||||
Point { color,
|
||||
..p
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
//info!("Line: {:?}", line);
|
||||
Ok(line)
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ pub struct Point {
|
||||
|
||||
#[derive(Debug,Clone,Copy,Default,PartialEq)]
|
||||
pub struct Color {
|
||||
pub r: u8,
|
||||
pub g: u8,
|
||||
pub b: u8
|
||||
r: u8,
|
||||
g: u8,
|
||||
b: u8
|
||||
}
|
||||
|
||||
impl From<(f32,f32,u32)> for Point {
|
||||
|
@ -43,8 +43,7 @@ pub struct WorldState {
|
||||
pub client_key: String, //u8,
|
||||
pub intensity: u8,
|
||||
pub kpps: u32,
|
||||
pub color: Color,
|
||||
pub black: bool
|
||||
pub color: Color
|
||||
}
|
||||
|
||||
impl WorldState {
|
||||
|
Loading…
Reference in New Issue
Block a user