Compare commits
	
		
			No commits in common. "177f08e461eebc3067ff45b5ee2046a144074a89" and "9c996b102926fc1c138ddbc9dd94e037dd9567af" have entirely different histories.
		
	
	
		
			177f08e461
			...
			9c996b1029
		
	
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -1,6 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Configuration file 
 | 
					# Configuration file 
 | 
				
			||||||
settings.*
 | 
					Settings.*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Generated by Cargo
 | 
					# Generated by Cargo
 | 
				
			||||||
# will have compiled files and executables
 | 
					# will have compiled files and executables
 | 
				
			||||||
 | 
				
			|||||||
@ -5,36 +5,19 @@ use redis::{
 | 
				
			|||||||
    Connection,
 | 
					    Connection,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use std::time::Instant;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
fn do_something() -> redis::RedisResult<()> {
 | 
					fn do_something() -> redis::RedisResult<()> {
 | 
				
			||||||
    let client = Client::open("redis://127.0.0.1/")?;
 | 
					    let client = Client::open("redis://127.0.0.1/")?;
 | 
				
			||||||
    let mut con: Connection = client.get_connection()?;
 | 
					    let mut con: Connection = client.get_connection()?;
 | 
				
			||||||
    let start = Instant::now();
 | 
					
 | 
				
			||||||
 | 
					    /* do something here */
 | 
				
			||||||
 | 
					    //let val : String = con.get("/pl/0/0")?;
 | 
				
			||||||
 | 
					    let _ = con.set("/pl/0/0", "[(150.0, 230.0, 65280), \
 | 
				
			||||||
 | 
									(170.0, 170.0, 65280), \
 | 
				
			||||||
 | 
									(230.0, 170.0, 65280), \
 | 
				
			||||||
 | 
									(210.0, 230.0, 65280), \
 | 
				
			||||||
 | 
									(150.0, 230.0, 65280)]")?;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    loop {
 | 
					    Ok(())
 | 
				
			||||||
	let elapsed = start.elapsed();
 | 
					 | 
				
			||||||
	let time = 60.0 * elapsed.as_millis() as f32 / 1000.0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	let mut v : Vec<(f32,f32,u32)> = vec![];
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	for i in 0..128 {
 | 
					 | 
				
			||||||
	    let a = (time + i as f32) / 128.0 * std::f32::consts::PI * 2.0;
 | 
					 | 
				
			||||||
	    let r = 1200.0 + (a*5.0).cos() * (500.0 * (time/5.0).cos());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	    let x = a.cos() * r;
 | 
					 | 
				
			||||||
	    let y = a.sin() * r;
 | 
					 | 
				
			||||||
	    let col = if i % 8 < 4 {
 | 
					 | 
				
			||||||
		0x000000ff
 | 
					 | 
				
			||||||
	    } else {
 | 
					 | 
				
			||||||
		0x00ff0000
 | 
					 | 
				
			||||||
	    };
 | 
					 | 
				
			||||||
	    v.push((x,y,col));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	// println!("{:?}", v);
 | 
					 | 
				
			||||||
	let _ = con.set("/pl/0/0", format!("{:?}", v))?;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    // Ok(())
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
 | 
				
			|||||||
@ -42,16 +42,14 @@ impl Device for HeliosDevice {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	fn draw(&mut self,
 | 
						fn draw(&self,
 | 
				
			||||||
	        line: Vec<Point>,
 | 
						        line: Vec<Point>,
 | 
				
			||||||
	        speed: u32,
 | 
						        speed: u32,
 | 
				
			||||||
	) -> LJResult<()> {
 | 
						) -> LJResult<()> {
 | 
				
			||||||
		while let Ok(DeviceStatus::NotReady) = self.dac.status() {
 | 
							while let Ok(DeviceStatus::NotReady) = self.dac.status() {}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		let points: Vec<helios_dac::Point> = line.into_iter().map(|p| p.into()).collect();
 | 
							let points: Vec<helios_dac::Point> = line.into_iter().map(|p| p.into()).collect();
 | 
				
			||||||
		let frame = Frame::new(speed, points);
 | 
							let _frame = Frame::new(speed, points);
 | 
				
			||||||
		self.dac.write_frame(frame.clone())?;
 | 
					 | 
				
			||||||
		Ok(())
 | 
							Ok(())
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -29,7 +29,7 @@ pub struct Status {
 | 
				
			|||||||
pub trait Device {
 | 
					pub trait Device {
 | 
				
			||||||
    fn status( &self ) -> Status;
 | 
					    fn status( &self ) -> Status;
 | 
				
			||||||
    fn draw(
 | 
					    fn draw(
 | 
				
			||||||
	    &mut self,
 | 
						    &self,
 | 
				
			||||||
	    frame: Vec<Point>,
 | 
						    frame: Vec<Point>,
 | 
				
			||||||
    	speed: u32,
 | 
					    	speed: u32,
 | 
				
			||||||
    ) -> LJResult<()> ;
 | 
					    ) -> LJResult<()> ;
 | 
				
			||||||
@ -72,8 +72,9 @@ fn run_all() -> LJResult<()> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		let frame = get_next_frame(&config, &transformers,
 | 
							let frame = get_next_frame(&config, &transformers,
 | 
				
			||||||
		                           &mut rs, order == Order::Black)?;
 | 
							                           &mut rs, order == Order::Black)?;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// For now, draw all the time
 | 
							// For now, draw all the time
 | 
				
			||||||
		tracer.draw(frame, 10_000)?;
 | 
							tracer.draw(frame, 1000)?;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	info!("Exiting, stoping device.");
 | 
						info!("Exiting, stoping device.");
 | 
				
			||||||
@ -108,6 +109,6 @@ fn get_next_frame(
 | 
				
			|||||||
		line = transformer.apply(&line);
 | 
							line = transformer.apply(&line);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//info!("Line: {:?}", line);
 | 
						info!("Line: {:?}", line);
 | 
				
			||||||
	Ok(line)
 | 
						Ok(line)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user