chore: 更好地按帧发送灯条数据。

This commit is contained in:
2023-01-15 20:47:21 +08:00
parent a12c503e81
commit a3e2b5a234
4 changed files with 383 additions and 5 deletions

View File

@@ -27,11 +27,13 @@ impl Picker {
SCREEN_COLOR_PICKER
.get_or_init(|| async {
let configs = config::Manager::global().get_config().await.display_configs;
info!("Global Picker use configs. {:?}", configs);
Picker {
screens: Arc::new(Mutex::new(vec![])),
screenshots: Arc::new(Mutex::new(vec![])),
display_configs: Arc::new(Mutex::new(
config::Manager::global().get_config().await.display_configs,
configs,
)),
}
})
@@ -39,12 +41,12 @@ impl Picker {
}
pub async fn list_displays(&self) -> anyhow::Result<Vec<ScreenshotDto>> {
let mut configs = self.display_configs.lock().await;
let mut configs = vec![];
let displays = Display::all()
.map_err(|error| anyhow::anyhow!("Can not get all of displays. {}", error))?;
configs.clear();
// configs.clear();
let mut futs = FuturesUnordered::new();
for (index, display) in displays.iter().enumerate() {