Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: modm-io/modm
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d9f6de5f36b7df6dbc3e31f75cae806e5a1abfb2
Choose a base ref
..
head repository: modm-io/modm
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3a9b44e887b4deead134a8dd8a153545d5ba5f36
Choose a head ref
Showing with 8 additions and 9 deletions.
  1. +1 −2 src/modm/ui/color/rgb_pallete.hpp
  2. +3 −3 src/modm/ui/led/rgb.hpp
  3. +4 −4 test/modm/ui/color/color_test.cpp
3 changes: 1 addition & 2 deletions src/modm/ui/color/rgb_pallete.hpp
Original file line number Diff line number Diff line change
@@ -95,8 +95,6 @@ class RgbPallete
};

// accessors
constexpr T value() const { return value_; }

constexpr RedType red() const { return value_ >> (DG + DB); }
constexpr GreenType green() const { return value_ >> DB & GreenType::max;}
constexpr BlueType blue() const { return value_ & BlueType::max; }
@@ -191,6 +189,7 @@ class RgbPallete
value_ ^= T(std::pow(2, DR + DG + DB) - 1);
}

constexpr T value() const { return value_; }
private:
T value_{0};
};
6 changes: 3 additions & 3 deletions src/modm/ui/led/rgb.hpp
Original file line number Diff line number Diff line change
@@ -46,9 +46,9 @@ class RgbLed
{
absolute = color;

red.setBrightness(color.red().value());
green.setBrightness(color.green().value());
blue.setBrightness(color.blue().value());
red.setBrightness(color.red());
green.setBrightness(color.green());
blue.setBrightness(color.blue());
}

inline ::modm::color::Rgb888
8 changes: 4 additions & 4 deletions test/modm/ui/color/color_test.cpp
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ void ColorTest::testGray() {
TEST_ASSERT_EQUALS(gray4, 0u);

gray4 += 66; // over-saturation
TEST_ASSERT_EQUALS(gray4, 0b1111);
TEST_ASSERT_EQUALS(gray4, uint8_t(0b1111));

gray4 -= 3;
TEST_ASSERT_EQUALS(gray4, uint8_t(0b1100));
@@ -50,13 +50,13 @@ void ColorTest::testGray() {
// gray4 += -3;

gray8 = gray4; // upscaling
TEST_ASSERT_EQUALS(gray8, 0b11001100);
TEST_ASSERT_EQUALS(gray8, uint8_t(0b11001100));

Gray<13> gray13 = gray4; // further upscaling
TEST_ASSERT_EQUALS(gray13, 0b0001100110011000); // last digit rounds down for odd D
TEST_ASSERT_EQUALS(gray13, uint16_t(0b0001100110011000)); // last digit rounds down for odd D

gray4 = gray13; // downscaling
TEST_ASSERT_EQUALS(gray4, 0b00001100);
TEST_ASSERT_EQUALS(gray4, uint8_t(0b00001100));
}

void ColorTest::testRgb() {