feat(board): ledshield_rgb — Montana Black RGB-LED-Shield (analoge RGB-Streifen)
Viertes Analog-Profil neben den SM2135EH-Lampen: PWM-Kanaele R=PB13 (ch1), G=PB16 (ch2), B=PB15 (ch3) bei 800 Hz, PIN-belegt aus der Original-Firmware (qcl_build_config_lamp.h, HARDWARE_MOBL_LED_SHIELD). Kein CW/WW-Zweig: ct_min == ct_max ist das Erkennungszeichen fuer 'weiss = RGB-Mischung', nl_color.c gibt in diesem Fall alle drei Farbkanalgleich. Neues Bauziel in allen Skripten; test_release zaehlt Dateizahlen jetzt aus TARGETS statt hart 8/16.
This commit is contained in:
+17
-7
@@ -5,12 +5,12 @@
|
||||
void setUp(void) {}
|
||||
void tearDown(void) {}
|
||||
|
||||
static const char *IDS[] = {"evk", "e27_rgb", "e14_rgb", "gu10_rgb", "e27_cw", "e14_cw", "gu10_cw", "g95_cw"};
|
||||
static const char *IDS[] = {"evk", "e27_rgb", "e14_rgb", "gu10_rgb", "e27_cw", "e14_cw", "gu10_cw", "g95_cw", "ledshield_rgb"};
|
||||
|
||||
static void test_all_devices_present(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL_UINT(8, nl_boards_count);
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
TEST_ASSERT_EQUAL_UINT(9, nl_boards_count);
|
||||
for (size_t i = 0; i < 9; i++) {
|
||||
const nl_board_t *b = nl_board_find(IDS[i]);
|
||||
TEST_ASSERT_NOT_NULL_MESSAGE(b, IDS[i]);
|
||||
TEST_ASSERT_EQUAL_STRING(IDS[i], b->id);
|
||||
@@ -34,9 +34,12 @@ static void test_rgb_flags_and_ct_ranges(void)
|
||||
5000 K - hard-coded per board rather than derived, because "warm variant" is a
|
||||
property of that one product, not of a class of them. */
|
||||
bool g95 = strcmp(b->id, "g95_cw") == 0;
|
||||
/* ledshield_rgb has no white LEDs at all: ct_min == ct_max is the
|
||||
sentinel "white mode renders as an RGB mix" (see nl_color.c). */
|
||||
bool shield = strcmp(b->id, "ledshield_rgb") == 0;
|
||||
TEST_ASSERT_EQUAL_MESSAGE(rgb, b->has_rgb, b->id);
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(g95 ? 2000 : 2700, b->ct_min, b->id);
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(g95 ? 5000 : 6500, b->ct_max, b->id);
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(shield ? 4000 : (g95 ? 2000 : 2700), b->ct_min, b->id);
|
||||
TEST_ASSERT_EQUAL_UINT16_MESSAGE(shield ? 4000 : (g95 ? 5000 : 6500), b->ct_max, b->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +50,15 @@ static void test_pwm_boards_consistent(void)
|
||||
if (b->driver != NL_DRV_PWM)
|
||||
continue;
|
||||
TEST_ASSERT_TRUE(b->pwm_freq_hz > 0);
|
||||
TEST_ASSERT_TRUE(b->pwm[NL_CH_CW].pwm_ch >= 0);
|
||||
TEST_ASSERT_TRUE(b->pwm[NL_CH_WW].pwm_ch >= 0);
|
||||
if (b->ct_min == b->ct_max) {
|
||||
/* RGB-only board: white is an RGB mix, no white channels wired. */
|
||||
TEST_ASSERT_TRUE(b->has_rgb);
|
||||
TEST_ASSERT_EQUAL(-1, b->pwm[NL_CH_CW].pwm_ch);
|
||||
TEST_ASSERT_EQUAL(-1, b->pwm[NL_CH_WW].pwm_ch);
|
||||
} else {
|
||||
TEST_ASSERT_TRUE(b->pwm[NL_CH_CW].pwm_ch >= 0);
|
||||
TEST_ASSERT_TRUE(b->pwm[NL_CH_WW].pwm_ch >= 0);
|
||||
}
|
||||
for (int c = NL_CH_R; c <= NL_CH_B; c++)
|
||||
TEST_ASSERT_EQUAL_MESSAGE(b->has_rgb, b->pwm[c].pwm_ch >= 0, b->id);
|
||||
for (int c = 0; c < NL_CH_COUNT; c++) {
|
||||
|
||||
@@ -88,6 +88,22 @@ static void test_one_percent_is_visible(void)
|
||||
TEST_ASSERT_EQUAL_INT(1, ch[NL_CH_CW] + ch[NL_CH_WW]);
|
||||
}
|
||||
|
||||
static void test_rgb_only_white_mode(void)
|
||||
{
|
||||
uint8_t ch[NL_CH_COUNT];
|
||||
/* ct_min == ct_max: RGB-only board, white = equal RGB mix, no division. */
|
||||
nl_visual_t v = vis(10000, NL_MODE_WHITE, 0, 0, 0, 4000);
|
||||
nl_visual_to_channels(&v, 4000, 4000, ch);
|
||||
TEST_ASSERT_EQUAL_UINT8(255, ch[NL_CH_R]);
|
||||
TEST_ASSERT_EQUAL_UINT8(255, ch[NL_CH_G]);
|
||||
TEST_ASSERT_EQUAL_UINT8(255, ch[NL_CH_B]);
|
||||
TEST_ASSERT_EQUAL_UINT8(0, ch[NL_CH_CW]);
|
||||
TEST_ASSERT_EQUAL_UINT8(0, ch[NL_CH_WW]);
|
||||
v.bri = 100; /* 1 % stays visible */
|
||||
nl_visual_to_channels(&v, 4000, 4000, ch);
|
||||
TEST_ASSERT_EQUAL_UINT8(1, ch[NL_CH_R]);
|
||||
}
|
||||
|
||||
static void test_zero_brightness_is_dark(void)
|
||||
{
|
||||
uint8_t ch[NL_CH_COUNT];
|
||||
@@ -107,6 +123,7 @@ int main(void)
|
||||
RUN_TEST(test_white_mix_keeps_total);
|
||||
RUN_TEST(test_color_mode);
|
||||
RUN_TEST(test_one_percent_is_visible);
|
||||
RUN_TEST(test_rgb_only_white_mode);
|
||||
RUN_TEST(test_zero_brightness_is_dark);
|
||||
return UNITY_END();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user