From c920df1f765057ba0afd074053e60ac5996375db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 28 Apr 2020 17:02:30 +0200 Subject: [PATCH] [python] Change enum class name: ColorModes --> ColorMode --- python/port/mod/turtle/modturtle.cpp | 8 ++++---- python/port/mod/turtle/turtle.h | 8 ++++---- python/port/port.cpp | 4 ++-- python/port/port.h | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/python/port/mod/turtle/modturtle.cpp b/python/port/mod/turtle/modturtle.cpp index 45658c360..36c3c9e19 100644 --- a/python/port/mod/turtle/modturtle.cpp +++ b/python/port/mod/turtle/modturtle.cpp @@ -137,7 +137,7 @@ mp_obj_t modturtle_pencolor(size_t n_args, const mp_obj_t *args) { // pencolor() KDColor c = sTurtle.color(); mp_obj_t mp_col[3]; - if(sTurtle.colorMode() == MicroPython::ColorParser::ColorModes::MaxIntensity255){ + if(sTurtle.colorMode() == MicroPython::ColorParser::ColorMode::MaxIntensity255){ mp_col[0] = mp_obj_new_int_from_uint(c.red()); mp_col[1] = mp_obj_new_int_from_uint(c.green()); mp_col[2] = mp_obj_new_int_from_uint(c.blue()); @@ -165,13 +165,13 @@ mp_obj_t modturtle_pencolor(size_t n_args, const mp_obj_t *args) { mp_obj_t modturtle_colormode(size_t n_args, const mp_obj_t *args){ if(n_args == 0){ - return (sTurtle.colorMode() == MicroPython::ColorParser::ColorModes::MaxIntensity255) ? mp_obj_new_int_from_uint(255) : mp_obj_new_int_from_uint(1); + return (sTurtle.colorMode() == MicroPython::ColorParser::ColorMode::MaxIntensity255) ? mp_obj_new_int_from_uint(255) : mp_obj_new_int_from_uint(1); } else{ int colorMode = mp_obj_get_int(args[0]); if(colorMode == 1){ - sTurtle.setColorMode(MicroPython::ColorParser::ColorModes::MaxIntensity1); + sTurtle.setColorMode(MicroPython::ColorParser::ColorMode::MaxIntensity1); } else if(colorMode == 255){ - sTurtle.setColorMode(MicroPython::ColorParser::ColorModes::MaxIntensity255); + sTurtle.setColorMode(MicroPython::ColorParser::ColorMode::MaxIntensity255); } else { mp_raise_ValueError("Colormodes can be 1 or 255"); } diff --git a/python/port/mod/turtle/turtle.h b/python/port/mod/turtle/turtle.h index 71e4ae5fe..2c49c6b1d 100644 --- a/python/port/mod/turtle/turtle.h +++ b/python/port/mod/turtle/turtle.h @@ -30,7 +30,7 @@ public: m_y(0), m_heading(0), m_color(k_defaultColor), - m_colorMode(MicroPython::ColorParser::ColorModes::MaxIntensity255), + m_colorMode(MicroPython::ColorParser::ColorMode::MaxIntensity255), m_penDown(true), m_visible(true), m_speed(k_defaultSpeed), @@ -73,8 +73,8 @@ public: void setColor(uint8_t r, uint8_t g, uint8_t b) { m_color = KDColor::RGB888(r, g, b); } - MicroPython::ColorParser::ColorModes colorMode() const {return m_colorMode; } - void setColorMode(MicroPython::ColorParser::ColorModes colorMode){ + MicroPython::ColorParser::ColorMode colorMode() const {return m_colorMode; } + void setColorMode(MicroPython::ColorParser::ColorMode colorMode){ m_colorMode = colorMode; } @@ -141,7 +141,7 @@ private: mp_float_t m_heading; KDColor m_color; - MicroPython::ColorParser::ColorModes m_colorMode; + MicroPython::ColorParser::ColorMode m_colorMode; bool m_penDown; bool m_visible; diff --git a/python/port/port.cpp b/python/port/port.cpp index 5edc4dece..ffd46218e 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -180,7 +180,7 @@ void MicroPython::collectRootsAtAddress(char * address, int byteLength) { #endif } -KDColor MicroPython::ColorParser::ParseColor(mp_obj_t input, ColorModes ColorMode){ +KDColor MicroPython::ColorParser::ParseColor(mp_obj_t input, ColorMode ColorMode){ if(mp_obj_is_str(input)){ size_t l; const char * color = mp_obj_str_get_data(input, &l); @@ -240,7 +240,7 @@ KDColor MicroPython::ColorParser::ParseColor(mp_obj_t input, ColorModes ColorMod mp_raise_TypeError("color needs 3 components"); } - if(ColorMode == MicroPython::ColorParser::ColorModes::MaxIntensity1){ + if(ColorMode == MicroPython::ColorParser::ColorMode::MaxIntensity1){ return KDColor::RGB888( 255 * mp_obj_get_float(elem[0]), 255 * mp_obj_get_float(elem[1]), diff --git a/python/port/port.h b/python/port/port.h index 73bf7f810..b337c1ef1 100644 --- a/python/port/port.h +++ b/python/port/port.h @@ -57,12 +57,12 @@ class ColorParser { }; public: - enum class ColorModes { + enum class ColorMode { MaxIntensity1, MaxIntensity255, }; - static KDColor ParseColor(mp_obj_t input, ColorModes ColorMode = ColorModes::MaxIntensity255); + static KDColor ParseColor(mp_obj_t input, ColorMode ColorMode = ColorMode::MaxIntensity255); };