fix(board): Farbtemperaturbereiche der Weiss-Varianten korrigieren

Die vier reinen Weiss-Lampen standen flach auf 2500-6500 K, was fuer keine
von ihnen stimmte. Nach Michaels Produktdaten:

- E27 CW/WW, E14 CW/WW, GU10 CW/WW: 2700-6500 K (vorher 2500-5000)
- G95 Vintage:                      2000-5000 K (vorher 2500-5000)

Die drei erstgenannten haben damit oben 1500 K verschenkt, die G95 unten
500 K. Die RGB-Varianten und das EVK standen schon richtig auf 2700-6500.

test_board.c prueft die Bereiche jetzt pro Board statt ueber die Faustregel
"RGB oder nicht" - die G95 ist die Ausnahme, und eine Faustregel, die eine
Ausnahme hat, ist keine. Die beiden Clamp-Tests in test_boot_state.c lesen
die Obergrenze jetzt vom Board, statt die Zahl zu wiederholen: sie pruefen
das Begrenzen, nicht die Konstante.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Michael Sauer
2026-09-13 21:28:33 +02:00
co-authored by Claude Opus 5
parent 00d5a4c532
commit 7a5f26d717
4 changed files with 22 additions and 12 deletions
+9 -4
View File
@@ -55,11 +55,15 @@ static void test_off_forces_off(void)
static void test_sanitizes_stored_values(void)
{
const nl_board_t *b = nl_board_find("e27_cw");
nl_light_state_t last = {true, 0, NL_MODE_COLOR, 1, 2, 3, 9000};
nl_light_state_t s = nl_boot_state(NL_POB_LAST, &last, nl_board_find("e27_cw"), false);
nl_light_state_t s = nl_boot_state(NL_POB_LAST, &last, b, false);
TEST_ASSERT_EQUAL_UINT8(100, s.brightness); /* invalid 0 -> 100 */
TEST_ASSERT_EQUAL(NL_MODE_WHITE, s.mode); /* no RGB on this board */
TEST_ASSERT_EQUAL_UINT16(5000, s.ct); /* clamped */
/* Clamped to whatever this board can do. Deliberately read from the board instead of
repeating the number: the range itself is nailed down in test_board.c, and this test
is about the clamping, not about the constant. */
TEST_ASSERT_EQUAL_UINT16(b->ct_max, s.ct);
}
/* Spec 8.2: a reboot caused by an OTA is not a power cut - the light comes back effectively as
@@ -84,12 +88,13 @@ static void test_after_ota_ignores_pob_on(void)
static void test_after_ota_still_sanitizes(void)
{
const nl_board_t *b = nl_board_find("e27_cw");
nl_light_state_t last = {true, 200, NL_MODE_COLOR, 1, 2, 3, 9000};
nl_light_state_t s = nl_boot_state(NL_POB_OFF, &last, nl_board_find("e27_cw"), true);
nl_light_state_t s = nl_boot_state(NL_POB_OFF, &last, b, true);
TEST_ASSERT_TRUE(s.on);
TEST_ASSERT_EQUAL_UINT8(100, s.brightness);
TEST_ASSERT_EQUAL(NL_MODE_WHITE, s.mode);
TEST_ASSERT_EQUAL_UINT16(5000, s.ct);
TEST_ASSERT_EQUAL_UINT16(b->ct_max, s.ct);
}
/* Nothing stored (first boot after a migration): there is no "last" to restore, so the normal