thewh1teagle / happy

Control HappyLight LED Strip with ease
MIT License
24 stars 3 forks source link

feat: add brightness slider #5

Closed tnc1997 closed 4 weeks ago

tnc1997 commented 3 months ago

Closes #4

tnc1997 commented 3 months ago

Hi @thewh1teagle, thank you for your work on this application!

I am experiencing a few difficulties attempting to test the production build of the application due to this error:

thread 'tokio-runtime-worker' panicked at rust/src-tauri/src/controller.rs:94:14: called Option::unwrap() on a None value stack backtrace: 0: rust_begin_unwind 1: core::panicking::panic_fmt 2: core::panicking::panic 3: core::option::unwrap_failed 4: happy::controller::Controller::set_rgb::{{closure}} 5: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll 6: <futures_util::future::future::map::Map<Fut,F> as core::future::future::Future>::poll 7: tauri::ipc::InvokeResolver::respond_async_serialized::{{closure}} 8: tokio::runtime::task::core::Core<T,S>::poll 9: tokio::runtime::task::harness::Harness<T,S>::poll 10: tokio::runtime::scheduler::multi_thread::worker::Context::run_task 11: tokio::runtime::scheduler::multi_thread::worker::Context::run 12: tokio::runtime::context::runtime::enter_runtime 13: tokio::runtime::scheduler::multi_thread::worker::run 14: tokio::runtime::task::core::Core<T,S>::poll 15: tokio::runtime::task::harness::Harness<T,S>::poll 16: tokio::runtime::blocking::pool::Inner::run

EDIT: Please accept my apologies I realise now that this was likely being caused by the device not being set 😳

thewh1teagle commented 3 months ago

Hey!

Thanks for your work on this. I tested it and found an issue with the PR. The color state isn't persistent when using the brightness slider. It always changes to green when adjusting the brightness, instead of maintaining the selected color.

tnc1997 commented 3 months ago

No worries, you're welcome! Thanks for giving these changes a test. I might have misunderstood as I was (maybe wrongly) basing these changes on the set intensity logic here.

cjwomack commented 2 months ago

Just a random comment. Maybe try converting the RGB color to HSL and then modifying the lightness value? When I get time to play around with the code to compile a 32 bit windows version and/or a 32 bit linux version (I have an Intel PC stick and some old netbooks), I might give this a go.

tnc1997 commented 2 months ago

Hi @thewh1teagle, I was just wondering if you might be able to review my amendments to change the brightness of the picked colour, instead of resetting the colour to white?

thewh1teagle commented 4 weeks ago

@tnc1997

I tested it just now on macOS. It works great!

I'll merge and release new version that include it. Thanks for your contribution!

thewh1teagle commented 4 weeks ago

Released to 1.0.5