new light schema file

Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
2025-09-30 20:47:08 +02:00
parent 99aa30c8e5
commit 9ae568c2f4
3 changed files with 100 additions and 58 deletions

View File

@@ -78,16 +78,20 @@ esp_err_t add_light_item(const char time[5], uint8_t red, uint8_t green, uint8_t
} }
rgb_t color = {.red = red, .green = green, .blue = blue}; rgb_t color = {.red = red, .green = green, .blue = blue};
hsv_t hsv = rgb_to_hsv(color);
hsv.v = brightness;
hsv.s = saturation;
rgb_t adjusted_color = hsv_to_rgb(hsv);
// Initialize the data of the new node. if (saturation < 255)
{
hsv_t hsv = rgb_to_hsv(color);
hsv.s = hsv.s * (saturation / 255.0f);
// color = hsv_to_rgb(hsv);
}
float brightness_factor = brightness / 255.0f;
memcpy(new_node->time, time, sizeof(new_node->time)); memcpy(new_node->time, time, sizeof(new_node->time));
new_node->red = adjusted_color.red; new_node->red = (uint8_t)(color.red * brightness_factor);
new_node->green = adjusted_color.green; new_node->green = (uint8_t)(color.green * brightness_factor);
new_node->blue = adjusted_color.blue; new_node->blue = (uint8_t)(color.blue * brightness_factor);
new_node->next = NULL; new_node->next = NULL;
// Append the new node to the end of the list. // Append the new node to the end of the list.
@@ -133,7 +137,7 @@ static void initialize_light_items(void)
} }
initialize_storage(); initialize_storage();
load_file("/spiffs/schema_02.csv"); load_file("/spiffs/schema_03.csv");
if (head == NULL) if (head == NULL)
{ {

View File

@@ -57,6 +57,21 @@ void load_file(const char *filename)
*pos = '\0'; *pos = '\0';
} }
if (strlen(line) == 0)
{
continue;
}
char *trimmed = line;
while (*trimmed == ' ' || *trimmed == '\t')
{
trimmed++;
}
if (*trimmed == '#' || *trimmed == '\0')
{
continue;
}
char time[10] = {0}; char time[10] = {0};
int red, green, blue, white, brightness, saturation; int red, green, blue, white, brightness, saturation;
@@ -79,5 +94,5 @@ void load_file(const char *filename)
} }
fclose(f); fclose(f);
ESP_LOGI(TAG, "Finished loading file."); ESP_LOGI(TAG, "Finished loading file. Loaded %d entries.", line_number);
} }

View File

@@ -1,48 +1,71 @@
25,24,112,0,100,250 # Nacht (Tiefblau/Dunkelblau)
25,23,106,0,100,250 15,20,40,0,80,250
25,22,100,0,100,250 15,20,45,0,80,250
25,21,95,0,100,250 15,20,50,0,85,250
25,19,89,0,100,250 15,25,55,0,85,250
25,18,84,0,100,250 20,25,60,0,90,250
25,17,78,0,100,250 20,30,65,0,90,250
62,19,72,0,100,250 25,35,70,0,95,250
102,51,67,0,100,250
140,61,48,0,115,250 # Frühe Morgendämmerung (Blau → Violett)
178,55,25,0,130,250 35,40,80,0,100,250
214,50,12,0,150,250 45,45,90,0,105,250
255,44,3,0,170,250 55,50,100,0,110,250
255,46,7,0,190,250 70,55,110,0,115,250
255,48,11,0,210,250 85,60,115,0,120,250
255,50,15,0,215,250
255,52,18,0,220,250 # Morgendämmerung (Violett → Rosa → Orange)
255,54,22,0,225,250 100,65,120,0,125,250
255,56,25,0,230,250 120,75,125,0,130,250
255,58,28,0,235,250 140,85,130,0,135,250
255,60,32,0,240,250 160,95,135,0,140,250
255,62,35,0,245,250 180,105,140,0,145,250
255,64,38,0,250,250
255,65,41,0,252,250 # Sonnenaufgang (Orange → Gelb-Orange)
255,67,45,0,255,250 200,115,130,0,150,250
255,69,44,0,252,250 220,130,120,0,160,250
255,71,44,0,250,250 235,145,110,0,170,250
255,73,44,0,247,250 245,160,100,0,180,250
255,75,43,0,245,250 250,175,90,0,190,250
255,77,42,0,242,250
255,79,40,0,240,250 # Vormittag (Warm-Weiß)
255,81,39,0,237,250 255,190,100,0,200,250
255,83,36,0,235,250 255,205,120,0,210,250
255,85,34,0,233,250 255,220,140,0,220,250
255,87,31,0,230,250
255,88,27,0,225,250 # Mittag (Helles Weiß mit leichtem Blaustich)
255,90,23,0,220,250 255,245,200,0,230,250
214,92,36,0,205,250 255,250,220,0,240,250
178,94,58,0,190,250 255,255,240,0,250,250
140,96,89,0,165,250 255,255,250,0,255,250
102,71,98,0,140,250 255,250,240,0,250,250
63,44,100,0,120,250 255,245,220,0,240,250
25,22,102,0,100,250 255,240,200,0,230,250
25,23,104,0,100,250
25,23,106,0,100,250 # Nachmittag (Warm-Weiß)
25,24,108,0,100,250 255,225,160,0,220,250
25,24,110,0,100,250 255,210,140,0,210,250
25,24,112,0,100,250 255,195,120,0,200,250
# Später Nachmittag → Abend (Gelb-Orange)
250,180,100,0,190,250
245,165,90,0,180,250
235,150,80,0,170,250
220,135,70,0,160,250
200,120,60,0,150,250
# Sonnenuntergang (Orange → Rot → Violett)
180,100,50,0,140,250
160,85,60,0,135,250
140,70,70,0,130,250
120,60,80,0,125,250
100,50,90,0,120,250
# Abenddämmerung (Violett → Blau)
80,45,95,0,115,250
60,40,100,0,110,250
45,35,95,0,105,250
30,30,85,0,100,250
25,30,75,0,95,250
20,25,65,0,90,250
15,20,50,0,85,250
1 25 # Nacht (Tiefblau/Dunkelblau) 24 112 0 100 250
2 25 15,20,40,0,80,250 23 106 0 100 250
3 25 15,20,45,0,80,250 22 100 0 100 250
4 25 15,20,50,0,85,250 21 95 0 100 250
5 25 15,25,55,0,85,250 19 89 0 100 250
6 25 20,25,60,0,90,250 18 84 0 100 250
7 25 20,30,65,0,90,250 17 78 0 100 250
8 62 25,35,70,0,95,250 19 72 0 100 250
9 102 # Frühe Morgendämmerung (Blau → Violett) 51 67 0 100 250
10 140 35,40,80,0,100,250 61 48 0 115 250
11 178 45,45,90,0,105,250 55 25 0 130 250
12 214 55,50,100,0,110,250 50 12 0 150 250
13 255 70,55,110,0,115,250 44 3 0 170 250
14 255 85,60,115,0,120,250 46 7 0 190 250
15 255 # Morgendämmerung (Violett → Rosa → Orange) 48 11 0 210 250
16 255 100,65,120,0,125,250 50 15 0 215 250
17 255 120,75,125,0,130,250 52 18 0 220 250
18 255 140,85,130,0,135,250 54 22 0 225 250
19 255 160,95,135,0,140,250 56 25 0 230 250
20 255 180,105,140,0,145,250 58 28 0 235 250
21 255 # Sonnenaufgang (Orange → Gelb-Orange) 60 32 0 240 250
22 255 200,115,130,0,150,250 62 35 0 245 250
23 255 220,130,120,0,160,250 64 38 0 250 250
24 255 235,145,110,0,170,250 65 41 0 252 250
25 255 245,160,100,0,180,250 67 45 0 255 250
26 255 250,175,90,0,190,250 69 44 0 252 250
27 255 # Vormittag (Warm-Weiß) 71 44 0 250 250
28 255 255,190,100,0,200,250 73 44 0 247 250
29 255 255,205,120,0,210,250 75 43 0 245 250
30 255 255,220,140,0,220,250 77 42 0 242 250
31 255 # Mittag (Helles Weiß mit leichtem Blaustich) 79 40 0 240 250
32 255 255,245,200,0,230,250 81 39 0 237 250
33 255 255,250,220,0,240,250 83 36 0 235 250
34 255 255,255,240,0,250,250 85 34 0 233 250
35 255 255,255,250,0,255,250 87 31 0 230 250
36 255 255,250,240,0,250,250 88 27 0 225 250
37 255 255,245,220,0,240,250 90 23 0 220 250
38 214 255,240,200,0,230,250 92 36 0 205 250
39 178 # Nachmittag (Warm-Weiß) 94 58 0 190 250
40 140 255,225,160,0,220,250 96 89 0 165 250
41 102 255,210,140,0,210,250 71 98 0 140 250
42 63 255,195,120,0,200,250 44 100 0 120 250
43 25 # Später Nachmittag → Abend (Gelb-Orange) 22 102 0 100 250
44 25 250,180,100,0,190,250 23 104 0 100 250
45 25 245,165,90,0,180,250 23 106 0 100 250
46 25 235,150,80,0,170,250 24 108 0 100 250
47 25 220,135,70,0,160,250 24 110 0 100 250
48 25 200,120,60,0,150,250 24 112 0 100 250
49 # Sonnenuntergang (Orange → Rot → Violett)
50 180,100,50,0,140,250
51 160,85,60,0,135,250
52 140,70,70,0,130,250
53 120,60,80,0,125,250
54 100,50,90,0,120,250
55 # Abenddämmerung (Violett → Blau)
56 80,45,95,0,115,250
57 60,40,100,0,110,250
58 45,35,95,0,105,250
59 30,30,85,0,100,250
60 25,30,75,0,95,250
61 20,25,65,0,90,250
62 15,20,50,0,85,250
63
64
65
66
67
68
69
70
71