Skip to content

Commit ae284f2

Browse files
authored
Merge pull request #124 from Legion2/dev
Version 0.11.0
2 parents 1627603 + 4fd82a1 commit ae284f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1319
-1374
lines changed

.clang-format

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BasedOnStyle: Google
2+
ColumnLimit: 120
3+
IndentWidth: 4
4+
TabWidth: 4
5+
UseTab: ForContinuationAndIndentation
6+
AccessModifierOffset: -4

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
indent_size = 4
6+
charset = utf-8
7+
trim_trailing_whitespace = false
8+
insert_final_newline = true
9+
10+
[*.{yml,yaml}]
11+
indent_style = space
12+
indent_size = 2

.github/workflows/lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Check Code Format
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v1
11+
- name: Check src format
12+
uses: DoozyX/[email protected]
13+
with:
14+
source: './src'
15+
extensions: 'h,cpp'
16+
clangFormatVersion: 9
17+
- name: Check examples format
18+
uses: DoozyX/[email protected]
19+
with:
20+
source: './examples'
21+
extensions: 'h,cpp,ino'
22+
clangFormatVersion: 9

.github/workflows/push.yml

Lines changed: 47 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2,85 +2,65 @@ on: [push, pull_request]
22
name: Test
33
jobs:
44
test:
5-
name: Test ${{ matrix.sketch }} for ${{ matrix.board }}
5+
name: Test for ${{ matrix.board }}
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE, NonAddressable, AmbientBacklight]
10-
board: ["arduino:avr:leonardo", "arduino:avr:micro", "SparkFun:avr:promicro:cpu=16MHzatmega32U4"]
9+
board:
10+
[
11+
"Legion2:avr:leonardoclp",
12+
"Legion2:avr:promicro5vclp",
13+
"Legion2:avr:promicro3vclp",
14+
]
1115
steps:
12-
- uses: actions/checkout@master
13-
- name: Install FastLED
14-
uses: Legion2/download-release-action@master
15-
with:
16-
repository: FastLED/FastLED
17-
tag: '3.2.0'
18-
path: libraries
19-
- name: Install SparkFun boards
20-
if: contains(matrix.board, 'SparkFun')
21-
run: |
22-
mkdir -p hardware/SparkFun
23-
cd hardware/SparkFun
24-
wget https://github.com/sparkfun/Arduino_Boards/raw/master/IDE_Board_Manager/sparkfunboards.1.1.5.tar.bz2
25-
tar -xvjf sparkfunboards.1.1.5.tar.bz2
26-
rm sparkfunboards.1.1.5.tar.bz2
27-
mv avr-1.1.5 avr
28-
- name: Build ${{ matrix.sketch }} for ${{ matrix.board }}
29-
uses: Legion2/[email protected]
30-
with:
31-
board: ${{ matrix.board }}
32-
sketch: ./examples/${{ matrix.sketch }}/${{ matrix.sketch }}.ino
16+
- uses: actions/checkout@master
17+
- name: Build for ${{ matrix.board }}
18+
uses: ArminJo/[email protected]
19+
with:
20+
arduino-board-fqbn: ${{ matrix.board }}
21+
platform-url: https://raw.githubusercontent.com/sparkfun/Arduino_Boards/master/IDE_Board_Manager/package_sparkfun_index.json,https://raw.githubusercontent.com/Legion2/CorsairLightingProtocolBoards/master/package_Legion2_CorsairLightingProtocolBoards_index.json
22+
arduino-platform: arduino:[email protected],SparkFun:[email protected],Legion2:[email protected]
23+
required-libraries: [email protected]
24+
sketch-names: LightingNodePRO.ino,
25+
SingleStripLightingNodePRO.ino,
26+
CommanderPRO.ino,
27+
DeviceIDTool.ino,
28+
RepeatAndScale.ino,
29+
TransformLLFansFormatToStrip.ino,
30+
LS100.ino,
31+
LightingNodeCORE.ino,
32+
NonAddressable.ino,
33+
AmbientBacklight.ino,
34+
DebugSketch.ino
35+
examples-build-properties: '{"DebugSketch": "-DDEBUG -DVERBOSE -DPRINT_COMMAND=true -DPRINT_RESPONSE=true -DPRINT_LOOP=true -DPRINT_UPDATE=true"}'
3336
testUnoMega:
34-
name: Test UnoMega ${{ matrix.sketch }} for ${{ matrix.board }}
37+
name: Test UnoMega sketches for ${{ matrix.board }}
3538
runs-on: ubuntu-latest
3639
strategy:
3740
matrix:
38-
sketch: [HoodLoader2UnoMegaController]
3941
board: ["arduino:avr:uno", "arduino:avr:mega:cpu=atmega2560"]
4042
steps:
41-
- uses: actions/checkout@master
42-
- name: Install FastLED
43-
uses: Legion2/download-release-action@master
44-
with:
45-
repository: FastLED/FastLED
46-
tag: '3.2.0'
47-
path: libraries
48-
- name: Build ${{ matrix.sketch }} for ${{ matrix.board }}
49-
uses: Legion2/[email protected]
50-
with:
51-
board: ${{ matrix.board }}
52-
sketch: ./examples/${{ matrix.sketch }}/${{ matrix.sketch }}.ino
43+
- uses: actions/checkout@master
44+
- name: Build for ${{ matrix.board }}
45+
uses: ArminJo/[email protected]
46+
with:
47+
arduino-board-fqbn: ${{ matrix.board }}
48+
arduino-platform: arduino:[email protected]
49+
required-libraries: [email protected]
50+
sketch-names: HoodLoader2UnoMegaController.ino
5351
test16u2:
54-
name: Test 16u2 ${{ matrix.sketch }} for ${{ matrix.board }}
52+
name: Test 16u2 sketch for ${{ matrix.board }}
5553
runs-on: ubuntu-latest
5654
strategy:
5755
matrix:
58-
sketch: [HoodLoader2CLPBridge]
59-
board: ["HoodLoader2:avr:HoodLoader2atmega16u2:board=uno", "HoodLoader2:avr:HoodLoader2atmega16u2:board=mega2560"]
56+
board: ["Legion2:avr:HoodLoader2atmega16u2clp"]
6057
steps:
61-
- uses: actions/checkout@master
62-
- name: Install FastLED
63-
uses: Legion2/download-release-action@master
64-
with:
65-
repository: FastLED/FastLED
66-
tag: '3.2.0'
67-
path: libraries
68-
- name: Download HoodLoader2
69-
uses: Legion2/download-release-action@master
70-
with:
71-
repository: NicoHood/HoodLoader2
72-
tag: '2.0.5'
73-
path: hardware/HoodLoader2
74-
file: '2.0.5-boards_manager.zip'
75-
- name: Install HoodLoader2
76-
run: |
77-
cd hardware/HoodLoader2
78-
sudo mv 2.0.5-boards_manager.zip some.zip
79-
sudo unzip some.zip
80-
sudo rm some.zip
81-
sudo mv * avr
82-
- name: Build ${{ matrix.sketch }} for ${{ matrix.board }}
83-
uses: Legion2/[email protected]
84-
with:
85-
board: ${{ matrix.board }}
86-
sketch: ./examples/${{ matrix.sketch }}/${{ matrix.sketch }}.ino
58+
- uses: actions/checkout@master
59+
- name: Build for ${{ matrix.board }}
60+
uses: ArminJo/[email protected]
61+
with:
62+
arduino-board-fqbn: ${{ matrix.board }}
63+
platform-url: https://raw.githubusercontent.com/NicoHood/HoodLoader2/master/package_NicoHood_HoodLoader2_index.json,https://raw.githubusercontent.com/Legion2/CorsairLightingProtocolBoards/master/package_Legion2_CorsairLightingProtocolBoards_index.json
64+
arduino-platform: arduino:[email protected],HoodLoader2:[email protected],Legion2:[email protected]
65+
required-libraries: [email protected]
66+
sketch-names: HoodLoader2CLPBridge.ino

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,7 @@ __vm/
272272

273273
# VS Code settings
274274
.vscode/
275+
276+
# Arduino CLI
277+
*.elf
278+
*.hex

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
**This library can be used to integrate custom/unofficial RGB strips with iCUE.**
44

55
## Features
6-
* Add support of the Lighting Node PRO protocol to Arduino.
7-
* Control LEDs with the Corsair Link or the iCUE software.
6+
* Add support of Corsair DIY device protocol to Arduino.
7+
* Control LEDs with the [Corsair iCUE software](https://www.corsair.com/icue).
88
* Easy to use with [FastLED](http://fastled.io/).
9-
* [Supported LED chipsets](https://github.com/FastLED/FastLED/wiki/Overview#chipsets).
9+
* [Supported LED chipsets](https://github.com/FastLED/FastLED/wiki/Overview#chipsets). (e.g. WS2812B, WS2801)
10+
* Supported platform: Arduino AVR
1011
* Persistent settings for use without a USB connection.
1112
* Use multiple devices at the same time.
1213
* Repeat or scale LED channels to arbitrary size.

examples/.clang-format

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
BasedOnStyle: Google
2+
ColumnLimit: 120
3+
IndentWidth: 4
4+
TabWidth: 4
5+
UseTab: ForContinuationAndIndentation
6+
AccessModifierOffset: -4
7+
8+
AllowShortBlocksOnASingleLine: false
9+
AllowShortFunctionsOnASingleLine: false
10+
AllowShortLambdasOnASingleLine: false

examples/AmbientBacklight/AmbientBacklight.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <FastLED.h>
1818

1919
// Hint: The channels are swapped in iCUE, so the first channel in iCUE is here channel 2
20-
#define DATA_PIN_CHANNEL_1 2 // For the monitor backlight
20+
#define DATA_PIN_CHANNEL_1 2 // For the monitor backlight
2121
#define DATA_PIN_CHANNEL_2 3
2222

2323
CRGB ledsChannel1[84];
@@ -36,7 +36,7 @@ void setup() {
3636
ledController.onUpdateHook(0, []() {
3737
// gamma correction with gamma value 2.0. Use napplyGamma_video for other gamma values.
3838
CLP::gammaCorrection(&ledController, 0);
39-
//napplyGamma_video(ledsChannel1, 84, 2.2);
39+
// napplyGamma_video(ledsChannel1, 84, 2.2);
4040
});
4141
}
4242

examples/CommanderPRO/CommanderPRO.ino

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
#include "SimpleFanController.h"
17-
#include "ThermistorTemperatureController.h"
1816
#include <CorsairLightingProtocol.h>
1917
#include <FastLED.h>
2018

19+
#include "SimpleFanController.h"
20+
#include "ThermistorTemperatureController.h"
21+
2122
#define DATA_PIN_CHANNEL_1 2
2223
#define DATA_PIN_CHANNEL_2 3
2324

@@ -35,7 +36,8 @@
3536
CorsairLightingFirmware firmware = corsairCommanderPROFirmware();
3637
ThermistorTemperatureController temperatureController;
3738
FastLEDController ledController(&temperatureController, true);
38-
SimpleFanController fanController(&temperatureController, FAN_UPDATE_RATE, EEPROM_ADDRESS + ledController.getEEPROMSize());
39+
SimpleFanController fanController(&temperatureController, FAN_UPDATE_RATE,
40+
EEPROM_ADDRESS + ledController.getEEPROMSize());
3941
CorsairLightingProtocolController cLP(&ledController, &temperatureController, &fanController, &firmware);
4042
CorsairLightingProtocolHID cHID(&cLP);
4143

@@ -68,4 +70,4 @@ void loop() {
6870
FastLED.show();
6971
}
7072
fanController.updateFans();
71-
}
73+
}

examples/CommanderPRO/PWMFan.cpp

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,46 @@
1515
*/
1616
#include "PWMFan.h"
1717

18-
PWMFan::PWMFan(uint8_t pwmPin, uint16_t minRPM ,uint16_t maxRPM) : pwmPin(pwmPin), minRPM(minRPM), maxRPM(maxRPM)
19-
{
18+
PWMFan::PWMFan(uint8_t pwmPin, uint16_t minRPM, uint16_t maxRPM) : pwmPin(pwmPin), minRPM(minRPM), maxRPM(maxRPM) {
2019
pinMode(pwmPin, OUTPUT);
2120
analogWrite(pwmPin, 0);
2221
switch (digitalPinToTimer(pwmPin)) {
23-
case TIMER0B:/* 3 */
22+
case TIMER0B: /* 3 */
2423
#ifdef DEBUG
25-
Serial.println(F("Pin not supported as PWM fan pin"));
26-
Serial.println(F("We don't want to mess up Arduino time functions"));
27-
#endif // DEBUG
28-
break;
29-
case TIMER3A:/* 5 */
30-
TCCR3B = (TCCR3B & B11111000) | 0x01;
31-
break;
32-
case TIMER4D:/* 6 */
33-
//PLLFRQ = (PLLFRQ & B11001111) | (0x03 << PLLTM0);
34-
TCCR4B = (TCCR4B & B11110000) | 0x01;
35-
break;
36-
case TIMER1A:/* 9 */
37-
TCCR1B = (TCCR1B & B11111000) | 0x01;
38-
break;
39-
case TIMER1B:/* 10 */
40-
TCCR1B = (TCCR1B & B11111000) | 0x01;
41-
break;
42-
default:
24+
Serial.println(F("Pin not supported as PWM fan pin"));
25+
Serial.println(F("We don't want to mess up Arduino time functions"));
26+
#endif // DEBUG
27+
break;
28+
case TIMER3A: /* 5 */
29+
TCCR3B = (TCCR3B & B11111000) | 0x01;
30+
break;
31+
case TIMER4D: /* 6 */
32+
// PLLFRQ = (PLLFRQ & B11001111) | (0x03 << PLLTM0);
33+
TCCR4B = (TCCR4B & B11110000) | 0x01;
34+
break;
35+
case TIMER1A: /* 9 */
36+
TCCR1B = (TCCR1B & B11111000) | 0x01;
37+
break;
38+
case TIMER1B: /* 10 */
39+
TCCR1B = (TCCR1B & B11111000) | 0x01;
40+
break;
41+
default:
4342
#ifdef DEBUG
44-
Serial.println(F("Pin not supported as PWM fan pin"));
45-
#endif // DEBUG
46-
break;
43+
Serial.println(F("Pin not supported as PWM fan pin"));
44+
#endif // DEBUG
45+
break;
4746
}
4847
}
4948

50-
void PWMFan::setPower(uint8_t percentage)
51-
{
49+
void PWMFan::setPower(uint8_t percentage) {
5250
analogWrite(pwmPin, percentage);
5351
}
5452

55-
uint8_t PWMFan::calculatePowerFromSpeed(uint16_t rpm)
56-
{
53+
uint8_t PWMFan::calculatePowerFromSpeed(uint16_t rpm) {
5754
rpm = constrain(rpm, minRPM, maxRPM);
5855
return ((float)(rpm - minRPM) / (float)(maxRPM - minRPM)) * 255;
5956
}
6057

61-
uint16_t PWMFan::calculateSpeedFromPower(uint8_t power)
62-
{
58+
uint16_t PWMFan::calculateSpeedFromPower(uint8_t power) {
6359
return map(power, 0, 255, minRPM, maxRPM);
6460
}

examples/CommanderPRO/PWMFan.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
class PWMFan {
2121
public:
2222
/**
23-
* PWM fan which maps speed to power using linear interpolation.
24-
* This fan does not read the real RPM values. The Arduino timer for the given pin will be set to higher speed.
25-
*
23+
* PWM fan which maps speed to power using linear interpolation. This fan does not read the real RPM values. The
24+
* Arduino timer for the given pin will be set to higher speed.
25+
*
2626
* @param pwmPin the Arduino pwm pin for this fan. Not all PWM pins are supported.
2727
* @param minRPM the speed in RPM at 0% power
2828
* @param maxRPM the speed in RPM at 100% power
@@ -31,6 +31,7 @@ class PWMFan {
3131
virtual void setPower(uint8_t percentage);
3232
virtual uint8_t calculatePowerFromSpeed(uint16_t rpm);
3333
virtual uint16_t calculateSpeedFromPower(uint8_t power);
34+
3435
protected:
3536
const uint8_t pwmPin;
3637
const uint16_t minRPM;

0 commit comments

Comments
 (0)