From 0811221943560790817abff63b3104c4ea6183fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 30 Apr 2020 13:42:39 +0200 Subject: [PATCH] [python] Clean port ColorParser --- python/port/port.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/port/port.cpp b/python/port/port.cpp index 29be768e4..027543d10 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -221,12 +221,9 @@ KDColor MicroPython::ColorParser::ParseColor(mp_obj_t input, ColorMode ColorMode } mp_float_t GreyLevel = mp_obj_float_get(mp_parse_num_decimal(color, strlen(color), false, false, NULL)); - if(GreyLevel >= 0.0 && GreyLevel <= 1.0){ - return KDColor::RGB888( - maxColorIntensity * (float) GreyLevel, - maxColorIntensity * (float) GreyLevel, - maxColorIntensity * (float) GreyLevel - ); + if (GreyLevel >= 0.0 && GreyLevel <= 1.0) { + uint8_t color = maxColorIntensity * (float) GreyLevel; + return KDColor::RGB888(color, color, color); } mp_raise_ValueError("Grey levels are between 0.0 and 1.0"); } else if(mp_obj_is_int(input)) {