Skip to content

Commit 6c7251e

Browse files
authored
Cleanup (#25)
* Cleanup * Update development time
1 parent 0ad4efe commit 6c7251e

File tree

8 files changed

+151
-151
lines changed

8 files changed

+151
-151
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020,2021,2022 awawa-dev
3+
Copyright (c) 2020,2021,2022,2023 awawa-dev
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

include/base.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* MIT License
44
*
5-
* Copyright (c) 2022 awawa-dev
5+
* Copyright (c) 2023 awawa-dev
66
*
77
* https://github.com/awawa-dev/HyperSerialEsp8266
88
*
@@ -69,17 +69,17 @@ class Base
6969
{
7070
ledStrip1 = new LED_DRIVER(ledsNumber);
7171
ledStrip1->Begin();
72-
}
72+
}
7373
}
7474

7575
/**
7676
* @brief Check if there is already prepared frame to display
77-
*
78-
* @return true
79-
* @return false
77+
*
78+
* @return true
79+
* @return false
8080
*/
8181
inline bool hasLateFrameToRender()
82-
{
82+
{
8383
return readyToRender;
8484
}
8585

@@ -88,26 +88,26 @@ class Base
8888
if (newFrame)
8989
readyToRender = true;
9090

91-
if (readyToRender &&
91+
if (readyToRender &&
9292
(ledStrip1 != nullptr && ledStrip1->CanShow()))
93-
{
93+
{
9494
statistics.increaseShow();
9595
readyToRender = false;
9696

9797
// display segments
98-
ledStrip1->Show(false);
98+
ledStrip1->Show(false);
9999
}
100100
}
101101

102102
inline bool setStripPixel(uint16_t pix, ColorDefinition &inputColor)
103103
{
104104
if (pix < ledsNumber)
105-
{
106-
ledStrip1->SetPixelColor(pix, inputColor);
105+
{
106+
ledStrip1->SetPixelColor(pix, inputColor);
107107
}
108108

109109
return (pix + 1 < ledsNumber);
110-
}
110+
}
111111
} base;
112112

113113
#endif

include/calibration.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* MIT License
44
*
5-
* Copyright (c) 2022 awawa-dev
5+
* Copyright (c) 2023 awawa-dev
66
*
77
* https://github.com/awawa-dev/HyperSerialEsp8266
88
*
@@ -51,17 +51,17 @@ struct
5151
class CalibrationConfig
5252
{
5353
// calibration parameters
54-
uint8_t gain = 0xFF;
54+
uint8_t gain = 0xFF;
5555
uint8_t red = 0xA0;
5656
uint8_t green = 0xA0;
5757
uint8_t blue = 0xA0;
5858

5959
/**
6060
* @brief Build the LUT table using provided parameters
61-
*
61+
*
6262
*/
6363
void prepareCalibration()
64-
{
64+
{
6565
// prepare LUT calibration table, cold white is much better than "neutral" white
6666
for (uint32_t i = 0; i < 256; i++)
6767
{
@@ -77,7 +77,7 @@ class CalibrationConfig
7777
channelCorrection.blue[i] = (uint8_t)std::min(ROUND_DIVIDE(_blue, 0xFF), (uint32_t)0xFF);
7878
}
7979
}
80-
80+
8181
public:
8282
CalibrationConfig()
8383
{
@@ -86,7 +86,7 @@ class CalibrationConfig
8686

8787
/**
8888
* @brief Compare base calibration settings
89-
*
89+
*
9090
*/
9191
bool compareCalibrationSettings(uint8_t _gain, uint8_t _red, uint8_t _green, uint8_t _blue)
9292
{
@@ -95,11 +95,11 @@ class CalibrationConfig
9595

9696
/**
9797
* @brief Set the parameters that define RGB to RGBW transformation
98-
*
99-
* @param _gain
100-
* @param _red
101-
* @param _green
102-
* @param _blue
98+
*
99+
* @param _gain
100+
* @param _red
101+
* @param _green
102+
* @param _blue
103103
*/
104104
void setParamsAndPrepareCalibration(uint8_t _gain, uint8_t _red, uint8_t _green, uint8_t _blue)
105105
{
@@ -110,16 +110,16 @@ class CalibrationConfig
110110
green = _green;
111111
blue = _blue;
112112
prepareCalibration();
113-
}
114-
}
113+
}
114+
}
115115

116116
/**
117117
* @brief print RGBW calibration parameters when no data is received
118-
*
118+
*
119119
*/
120120
void printCalibration()
121121
{
122-
#ifdef SerialPort
122+
#ifdef SerialPort
123123
SerialPort.write("\r\nRGBW => Gain: ");
124124
SerialPort.print(gain);
125125
SerialPort.write("/255, red: ");

include/framestate.h

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*
33
* MIT License
44
*
5-
* Copyright (c) 2022 awawa-dev
5+
* Copyright (c) 2023 awawa-dev
66
*
77
* https://github.com/awawa-dev/HyperSerialEsp8266
88
*
@@ -30,7 +30,7 @@
3030

3131
/**
3232
* @brief my AWA frame protocol definition
33-
*
33+
*
3434
*/
3535
enum class AwaProtocol
3636
{
@@ -53,7 +53,7 @@ enum class AwaProtocol
5353

5454
/**
5555
* @brief Contains current state of the incoming frame
56-
*
56+
*
5757
*/
5858
class
5959
{
@@ -65,13 +65,13 @@ class
6565
uint16_t fletcher1 = 0;
6666
uint16_t fletcher2 = 0;
6767

68-
public:
68+
public:
6969
ColorDefinition color;
7070

7171
/**
7272
* @brief Reset statistics for new frame
73-
*
74-
* @param input
73+
*
74+
* @param input
7575
*/
7676
inline void init(byte input)
7777
{
@@ -84,8 +84,8 @@ class
8484

8585
/**
8686
* @brief get computed CRC
87-
*
88-
* @return uint8_t
87+
*
88+
* @return uint8_t
8989
*/
9090
inline uint8_t getCRC()
9191
{
@@ -94,8 +94,8 @@ class
9494

9595
/**
9696
* @brief Get the color count reported by the frame
97-
*
98-
* @return uint16_t
97+
*
98+
* @return uint16_t
9999
*/
100100
inline uint16_t getCount()
101101
{
@@ -104,8 +104,8 @@ class
104104

105105
/**
106106
* @brief Get the Fletcher1 total sum
107-
*
108-
* @return uint16_t
107+
*
108+
* @return uint16_t
109109
*/
110110
inline uint16_t getFletcher1()
111111
{
@@ -114,8 +114,8 @@ class
114114

115115
/**
116116
* @brief Get the Fletcher2 total sum
117-
*
118-
* @return uint16_t
117+
*
118+
* @return uint16_t
119119
*/
120120
inline uint16_t getFletcher2()
121121
{
@@ -124,8 +124,8 @@ class
124124

125125
/**
126126
* @brief Get and increase the current Led index
127-
*
128-
* @return uint16_t
127+
*
128+
* @return uint16_t
129129
*/
130130
inline uint16_t getCurrentLedIndex()
131131
{
@@ -134,8 +134,8 @@ class
134134

135135
/**
136136
* @brief Set if frame protocol version 2 (contains calibration data)
137-
*
138-
* @param newVer
137+
*
138+
* @param newVer
139139
*/
140140
inline void setProtocolVersion2(bool newVer)
141141
{
@@ -144,9 +144,9 @@ class
144144

145145
/**
146146
* @brief Verify if frame protocol version 2 (contains calibration data)
147-
*
148-
* @return true
149-
* @return false
147+
*
148+
* @return true
149+
* @return false
150150
*/
151151
inline bool isProtocolVersion2()
152152
{
@@ -155,8 +155,8 @@ class
155155

156156
/**
157157
* @brief Set new AWA frame state
158-
*
159-
* @param newState
158+
*
159+
* @param newState
160160
*/
161161
inline void setState(AwaProtocol newState)
162162
{
@@ -165,18 +165,18 @@ class
165165

166166
/**
167167
* @brief Get current AWA frame state
168-
*
169-
* @return AwaProtocol
168+
*
169+
* @return AwaProtocol
170170
*/
171171
inline AwaProtocol getState()
172172
{
173173
return state;
174-
}
174+
}
175175

176176
/**
177177
* @brief Update CRC based on current and previuos input
178-
*
179-
* @param input
178+
*
179+
* @param input
180180
*/
181181
inline void computeCRC(byte input)
182182
{
@@ -186,8 +186,8 @@ class
186186

187187
/**
188188
* @brief Update Fletcher checksumn for incoming input
189-
*
190-
* @param input
189+
*
190+
* @param input
191191
*/
192192
inline void addFletcher(byte input)
193193
{
@@ -197,23 +197,23 @@ class
197197

198198
/**
199199
* @brief Check if the calibration data was updated and calculate new one
200-
*
201-
*/
200+
*
201+
*/
202202
inline void updateIncomingCalibration()
203203
{
204204
#ifdef NEOPIXEL_RGBW
205205
if (protocolVersion2)
206206
{
207-
calibrationConfig.setParamsAndPrepareCalibration(calibration.gain, calibration.red, calibration.green, calibration.blue);
207+
calibrationConfig.setParamsAndPrepareCalibration(calibration.gain, calibration.red, calibration.green, calibration.blue);
208208
}
209209
#endif
210-
}
210+
}
211+
211212

212-
213213
#ifdef NEOPIXEL_RGBW
214214
/**
215215
* @brief Compute && correct the white channel
216-
*
216+
*
217217
*/
218218
inline void rgb2rgbw()
219219
{
@@ -229,7 +229,7 @@ class
229229

230230
/**
231231
* @brief Incoming calibration data
232-
*
232+
*
233233
*/
234234
struct
235235
{
@@ -238,7 +238,7 @@ class
238238
uint8_t green = 0;
239239
uint8_t blue = 0;
240240
} calibration;
241-
241+
242242
} frameState;
243243

244244
#endif

0 commit comments

Comments
 (0)