new light schema file
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -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)
|
||||||
{
|
{
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
|
Reference in New Issue
Block a user