1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
use serde;
use serde::{Serialize, Deserialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use crate::structures::none_function;





#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Light {
    /// % of brightness to set (to limit power, if you set it to 50 and set bri to 255, actual brightness will be 127)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    #[serde(rename = "scale-bri")]
    pub scale_bri: Option<u8>,

    /// paletteBlend: 0 - wrap when moving, 1 - always wrap, 2 - never wrap, 3 - none (undefined)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    #[serde(rename = "pal-mode")]
    pub pal_mode: Option<u8>,

    /// If true, a segment per bus will be created on boot and LED settings save.
    /// If false, only one segment spanning the total LEDs is created,
    /// but not on LED settings save if there is more than one segment currently
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub aseg: Option<bool>,

    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub gc: Option<Gc>,

    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub tr: Option<Tr>,

    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub nl: Option<Nl>,
}

/// gamma correction shit, tired of documenting speghetti
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Gc {
    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub bri: Option<f64>,

    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub col: Option<f64>,

    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub val: Option<f64>,
}

/// transition stuff, tired of documenting speghetti
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Tr {
    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub mode: Option<bool>,

    /// default transition time / 100
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub dur: Option<u16>,

    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub pal: Option<u8>,

    /// amount of time [s] between random palette changes (min: 1s, max: 255s)
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub rpc: Option<u8>,
}

/// night light stuff, tired of documenting speghetti
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Nl {

    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub mode: Option<NightLightMode>,

    /// see struct documentation
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub dur: Option<u8>,

    /// brightness after nightlight is over
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    pub tbri: Option<u8>,

    /// after nightlight delay over
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(default = "none_function")]
    #[serde(rename = "macro")]
    pub macro_field: Option<u8>,
}




/// Modes for night light
#[allow(non_camel_case_types)]
#[derive(Serialize_repr, Deserialize_repr, PartialEq, Debug, Clone)]
#[repr(u8)]
pub enum NightLightMode {
    /// After nightlight time elapsed, set to target brightness
    NL_MODE_SET,
    /// Fade to target brightness gradually
    NL_MODE_FADE,
    /// Fade to target brightness and secondary color gradually
    NL_MODE_COLORFADE,
    /// Sunrise/sunset. Target brightness is set immediately, then Sunrise effect is started. Max 60 min.
    NL_MODE_SUN,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD1,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD2,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD3,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD4,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD5,
    /// Reserved to keep some semblance of backwards compatibility when new WLED versions come out with more Night Light modes
    RSVD6,

}