diff options
Diffstat (limited to 'app/Sensor.hs')
-rw-r--r-- | app/Sensor.hs | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/app/Sensor.hs b/app/Sensor.hs index 21c7f09..612b2bc 100644 --- a/app/Sensor.hs +++ b/app/Sensor.hs @@ -294,24 +294,29 @@ printBatCharging value = printBatDischarging :: (S.MonadSensor m) => Float -> S.Sensor m () P.Doc printBatDischarging value = - fmap mconcat $ - sequence - [ if - | value >= 0.95 -> pure (P.pretty "\xf0079") - | value >= 0.9 -> pure (P.pretty "\xf0082") - | value >= 0.8 -> pure (P.pretty "\xf0081") - | value >= 0.7 -> pure (P.pretty "\xf0080") - | value >= 0.6 -> pure (P.pretty "\xf007f") - | value >= 0.5 -> pure (P.pretty "\xf007e") - | value >= 0.4 -> pure (P.pretty "\xf007d") - | value >= 0.3 -> pure (P.pretty "\xf007c") - | value >= 0.2 -> pure (P.pretty "\xf007b") - | value >= 0.1 -> pure (P.pretty "\xf007a") - | otherwise -> - (\b -> if b then P.pretty "\xf008e" else (P.color P.Red) (P.pretty "\xf0083")) - <$> blink, - pure (P.pretty "\xf433") - ] + if value < 0.1 + then + ( \b -> + if b + then mconcat [P.pretty batValue, P.pretty "\xf433"] + else (P.color P.Red) (mconcat [P.pretty "\xf0083", P.pretty "\xf433"]) + ) + <$> blink + else pure (mconcat [P.pretty batValue, P.pretty "\xf433"]) + where + batValue = + if + | value >= 0.95 -> "\xf0079" + | value >= 0.9 -> "\xf0082" + | value >= 0.8 -> "\xf0081" + | value >= 0.7 -> "\xf0080" + | value >= 0.6 -> "\xf007f" + | value >= 0.5 -> "\xf007e" + | value >= 0.4 -> "\xf007d" + | value >= 0.3 -> "\xf007c" + | value >= 0.2 -> "\xf007b" + | value >= 0.1 -> "\xf007a" + | otherwise -> "\xf008e" data Blink = Blink deriving (Show) |