chore: 细节调整。#5.
This commit is contained in:
parent
4e3b765059
commit
5422cca393
@ -184,7 +184,7 @@ impl CoreManager {
|
||||
if global_sub_pixels.len() >= total_colors_count * 3 {
|
||||
let mut colors = vec![];
|
||||
for index in 0..global_sub_pixels.len() {
|
||||
colors.push(*global_sub_pixels.get(&index).unwrap());
|
||||
colors.push(*global_sub_pixels.get(&index).unwrap_or(&100));
|
||||
}
|
||||
// info!("{:?}", colors);
|
||||
global_sub_pixels = HashMap::new();
|
||||
|
@ -1,5 +1,5 @@
|
||||
use ddc_hi::Display;
|
||||
use paris::{info, error};
|
||||
use paris::{error, info};
|
||||
use tokio::sync::{broadcast, OnceCell};
|
||||
|
||||
use crate::{display::Brightness, rpc};
|
||||
@ -26,9 +26,11 @@ impl Manager {
|
||||
}
|
||||
|
||||
pub async fn subscribe_display_brightness(mut rx: broadcast::Receiver<DisplayBrightness>) {
|
||||
while let Ok(display_brightness) = rx.recv().await {
|
||||
if let Err(err) = Self::set_display_brightness(display_brightness) {
|
||||
error!("set_display_brightness failed. {:?}", err);
|
||||
loop {
|
||||
if let Ok(display_brightness) = rx.recv().await {
|
||||
if let Err(err) = Self::set_display_brightness(display_brightness) {
|
||||
error!("set_display_brightness failed. {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,12 @@ use crate::display;
|
||||
use image::EncodableLayout;
|
||||
use paris::warn;
|
||||
use rumqttc::{AsyncClient, Event, Incoming, MqttOptions, QoS};
|
||||
use serde::Deserialize;
|
||||
use std::time::Duration;
|
||||
use time::{format_description, OffsetDateTime};
|
||||
use tokio::{sync::broadcast, task};
|
||||
|
||||
const DISPLAY_TOPIC: &'static str = "display-ambient-light/display";
|
||||
const DISPLAY_BRIGHTNESS_TOPIC: &'static str = "display-ambient-light/display/brightness";
|
||||
const DISPLAY_BRIGHTNESS_TOPIC: &'static str = "display-ambient-light/board/brightness";
|
||||
|
||||
pub struct MqttRpc {
|
||||
client: AsyncClient,
|
||||
|
Loading…
Reference in New Issue
Block a user