mirror of
https://github.com/kaesaecracker/servicepoint-simulator.git
synced 2025-01-18 02:20:14 +01:00
fix brightness, rest of the update to servicepoint 0.7
This commit is contained in:
parent
0fff7a20d0
commit
feacd6c01e
2
.github/workflows/rust.yml
vendored
2
.github/workflows/rust.yml
vendored
|
@ -18,5 +18,3 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
# - name: Run tests
|
||||
# run: cargo test --verbose
|
||||
|
|
76
Cargo.lock
generated
76
Cargo.lock
generated
|
@ -278,6 +278,27 @@ version = "1.6.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "bzip2"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8"
|
||||
dependencies = [
|
||||
"bzip2-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bzip2-sys"
|
||||
version = "0.1.11+1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
version = "0.12.4"
|
||||
|
@ -466,6 +487,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.19"
|
||||
|
@ -598,6 +628,16 @@ dependencies = [
|
|||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "float-ord"
|
||||
version = "0.3.2"
|
||||
|
@ -1606,12 +1646,16 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "servicepoint"
|
||||
version = "0.6.0"
|
||||
source = "git+https://github.com/cccb/servicepoint.git?branch=fix-brightness#fc0705b826cd8b3c458fbb4d512307891486dcc2"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95a65a19c938a6b227fd9360ecfbfd5a5891543f446bcc2077342a5641c9a0b1"
|
||||
dependencies = [
|
||||
"bitvec",
|
||||
"bzip2",
|
||||
"flate2",
|
||||
"log",
|
||||
"rust-lzma",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2590,3 +2634,31 @@ dependencies = [
|
|||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a"
|
||||
dependencies = [
|
||||
"zstd-safe",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-safe"
|
||||
version = "7.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a"
|
||||
dependencies = [
|
||||
"zstd-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd-sys"
|
||||
version = "2.0.11+zstd.1.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
|
|
@ -7,7 +7,7 @@ license = "GPL-3.0-or-later"
|
|||
|
||||
[dependencies]
|
||||
# packet parsing
|
||||
servicepoint = { git = "https://github.com/cccb/servicepoint.git", branch = "fix-brightness" }
|
||||
servicepoint = { version = "0.7.0", features = ["all_compressions"] }
|
||||
|
||||
# gui
|
||||
winit = { version = "0.30", features = ["rwh_05"] } # for creating a window
|
||||
|
|
20
src/gui.rs
20
src/gui.rs
|
@ -67,21 +67,17 @@ impl<'t> App<'t> {
|
|||
|
||||
for x in 0..PIXEL_WIDTH {
|
||||
let is_set = display.get(x, y);
|
||||
let brightness = luma.get(x / TILE_SIZE, y / TILE_SIZE);
|
||||
let brightness: u8 = luma.get(x / TILE_SIZE, y / TILE_SIZE).into();
|
||||
let max_brightness: u8 = Brightness::MAX.into();
|
||||
let scale: f32 = (u8::MAX as f32) / (max_brightness as f32);
|
||||
|
||||
let brightness = (scale * brightness as f32) as u8;
|
||||
|
||||
let color = if is_set {
|
||||
[
|
||||
if self.cli.red { brightness.into() } else { 0u8 },
|
||||
if self.cli.green {
|
||||
brightness.into()
|
||||
} else {
|
||||
0u8
|
||||
},
|
||||
if self.cli.blue {
|
||||
brightness.into()
|
||||
} else {
|
||||
0u8
|
||||
},
|
||||
if self.cli.red { brightness } else { 0u8 },
|
||||
if self.cli.green { brightness } else { 0u8 },
|
||||
if self.cli.blue { brightness } else { 0u8 },
|
||||
255,
|
||||
]
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue