feat: 支持翻转灯条段。

This commit is contained in:
2023-04-02 17:45:18 +08:00
parent fa5e27f72a
commit 822d470605
6 changed files with 94 additions and 39 deletions

View File

@ -175,6 +175,18 @@ async fn move_strip_part(display_id: u32, border: Border, target_start: usize) -
})
}
#[tauri::command]
async fn reverse_led_strip_part(display_id: u32, border: Border) -> Result<(), String> {
let config_manager = ambient_light::ConfigManager::global().await;
config_manager
.reverse_led_strip_part(display_id, border)
.await
.map_err(|e| {
error!("can not reverse led strip part: {}", e);
e.to_string()
})
}
#[tokio::main]
async fn main() {
env_logger::init();
@ -197,6 +209,7 @@ async fn main() {
patch_led_strip_len,
send_colors,
move_strip_part,
reverse_led_strip_part,
])
.register_uri_scheme_protocol("ambient-light", move |_app, request| {
let response = ResponseBuilder::new().header("Access-Control-Allow-Origin", "*");