From 1bdb4ea2adeebf77163f1e468081272f7a2502a9 Mon Sep 17 00:00:00 2001 From: Rory Date: Tue, 31 Aug 2021 22:01:34 -0400 Subject: [PATCH] limit brightness error added --- src/main.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main.rs b/src/main.rs index 13359b1..8ee9591 100644 --- a/src/main.rs +++ b/src/main.rs @@ -470,6 +470,20 @@ pub fn arguments() -> Result<(String, String, u8, String, String), Box()?; + // exit if the brightness is too high for TM1637 + if clock_brightness > 7 && clock_type == "TM1637".to_string() { + panic!( + "Clock brightness limit of 7 for TM1637. Value input is {}", + clock_brightness + ); + }; + // exit if the brightness is too high for HT16K33 + if clock_brightness > 9 && clock_type == "HT16K33".to_string() { + panic!( + "Clock brightness limit of 9 for HT16K33. Value input is {}", + clock_brightness + ); + }; return Ok(( dir_code, station,