Skip to content

Commit

Permalink
Parse float as brightness (#3539)
Browse files Browse the repository at this point in the history
Similar to #3490, but also for brightness in floats, e.g. `23.0`.

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Dec 16, 2023
1 parent 132cb10 commit fd59648
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ data class ParsedState internal constructor(
// fall through
}
}
val stateAsInt = state.toIntOrNull()
if (stateAsInt in 0..100) {
return stateAsInt
val stateAsFloat = state.toFloatOrNull() ?: return null
if (stateAsFloat in 0f .. 100f) {
return stateAsFloat.toInt()
}
return null
}
Expand Down

0 comments on commit fd59648

Please sign in to comment.