mirror of
https://github.com/MatMoul/g810-led.git
synced 2024-12-23 09:16:11 +00:00
Add natives effects support in profile
This commit is contained in:
parent
c019e1d125
commit
56d5307043
2
sample_profiles/fx_breathing_red
Normal file
2
sample_profiles/fx_breathing_red
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
fx-breathing ff0000 10 # Set breathing effect with red color and speed 10
|
3
sample_profiles/fx_color_green
Normal file
3
sample_profiles/fx_color_green
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Green Profile
|
||||||
|
|
||||||
|
fx-color 00ff00 # Set all keys green
|
2
sample_profiles/fx_colorcycle
Normal file
2
sample_profiles/fx_colorcycle
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
fx-cycle 10 # Set color cycle effect with speed 10
|
2
sample_profiles/fx_cwave
Normal file
2
sample_profiles/fx_cwave
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
fx-cwave 10 # Set center wave effect with speed 10
|
2
sample_profiles/fx_hwave
Normal file
2
sample_profiles/fx_hwave
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
fx-hwave 10 # Set horizontal wave effect with speed 10
|
2
sample_profiles/fx_vwave
Normal file
2
sample_profiles/fx_vwave
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
fx-vwave 10 # Set vertical wave effect with speed 10
|
101
src/main.cpp
101
src/main.cpp
@ -340,6 +340,7 @@ int loadProfile(string profileFile) {
|
|||||||
Keyboard::KeyAddress keyAddress;
|
Keyboard::KeyAddress keyAddress;
|
||||||
Keyboard::KeyValue keyValue;
|
Keyboard::KeyValue keyValue;
|
||||||
Keyboard::KeyColors colors;
|
Keyboard::KeyColors colors;
|
||||||
|
uint8_t speedValue;
|
||||||
|
|
||||||
map<string, string> var;
|
map<string, string> var;
|
||||||
vector<Keyboard::KeyValue> keys;
|
vector<Keyboard::KeyValue> keys;
|
||||||
@ -396,6 +397,106 @@ int loadProfile(string profileFile) {
|
|||||||
lg_kbd.setKeys(&keys[0], keys.size());
|
lg_kbd.setKeys(&keys[0], keys.size());
|
||||||
keys.clear();
|
keys.clear();
|
||||||
lg_kbd.commit();
|
lg_kbd.commit();
|
||||||
|
} else if (line.substr(0,8) == "fx-color") {
|
||||||
|
line = line.substr(9);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)];
|
||||||
|
} else line = line.substr(0, 6);
|
||||||
|
if (lg_kbd.parseColor(line, colors) == true) {
|
||||||
|
keys.clear();
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXColor(colors);
|
||||||
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else if (line.substr(0,12) == "fx-breathing") {
|
||||||
|
line = line.substr(13);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)] + " " + line.substr(ind + 1);
|
||||||
|
}
|
||||||
|
if (lg_kbd.parseColor(line.substr(0, 6), colors) == true) {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = line.substr(ind + 1, 2);
|
||||||
|
if (lg_kbd.parseSpeed(line, speedValue) == true) {
|
||||||
|
keys.clear();
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXBreathing(colors, speedValue);
|
||||||
|
} else cout<<"Error1 on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else cout<<"Error2 on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else if (line.substr(0,8) == "fx-cycle") {
|
||||||
|
line = line.substr(9);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)];
|
||||||
|
} else line = line.substr(0, 2);
|
||||||
|
if (lg_kbd.parseSpeed(line, speedValue) == true) {
|
||||||
|
keys.clear();
|
||||||
|
colors.red = 0xff;
|
||||||
|
colors.green = 0xff;
|
||||||
|
colors.blue = 0xff;
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXColorCycle(speedValue);
|
||||||
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else if (line.substr(0,8) == "fx-hwave") {
|
||||||
|
line = line.substr(9);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)];
|
||||||
|
} else line = line.substr(0, 2);
|
||||||
|
if (lg_kbd.parseSpeed(line, speedValue) == true) {
|
||||||
|
keys.clear();
|
||||||
|
colors.red = 0xff;
|
||||||
|
colors.green = 0xff;
|
||||||
|
colors.blue = 0xff;
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXHWave(speedValue);
|
||||||
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else if (line.substr(0,8) == "fx-vwave") {
|
||||||
|
line = line.substr(9);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)];
|
||||||
|
} else line = line.substr(0, 2);
|
||||||
|
if (lg_kbd.parseSpeed(line, speedValue) == true) {
|
||||||
|
keys.clear();
|
||||||
|
colors.red = 0xff;
|
||||||
|
colors.green = 0xff;
|
||||||
|
colors.blue = 0xff;
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXVWave(speedValue);
|
||||||
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
|
} else if (line.substr(0,8) == "fx-cwave") {
|
||||||
|
line = line.substr(9);
|
||||||
|
if (line.substr(0, 1) == "$") {
|
||||||
|
ind = line.find(" ");
|
||||||
|
line = var[line.substr(1, ind - 1)];
|
||||||
|
} else line = line.substr(0, 2);
|
||||||
|
if (lg_kbd.parseSpeed(line, speedValue) == true) {
|
||||||
|
keys.clear();
|
||||||
|
colors.red = 0xff;
|
||||||
|
colors.green = 0xff;
|
||||||
|
colors.blue = 0xff;
|
||||||
|
lg_kbd.setGroupKeys(Keyboard::KeyGroup::indicators, colors);
|
||||||
|
lg_kbd.commit();
|
||||||
|
lg_kbd.detach();
|
||||||
|
lg_kbd.attach();
|
||||||
|
lg_kbd.setFXCWave(speedValue);
|
||||||
|
} else cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
} else if ((line.substr(0, 1) != "#") && (line.substr(0, 1) != "")) {
|
} else if ((line.substr(0, 1) != "#") && (line.substr(0, 1) != "")) {
|
||||||
cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
cout<<"Error on line "<<lineCount<<" : "<<line<<"\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user