Skip to content

Commit c97592d

Browse files
committed
Fix RGB шим
1 parent d37675d commit c97592d

3 files changed

+8
-8
lines changed

RGBJAL.ino

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ void initRGB() {
2525
sendStatus(brightnessRGBS, readArgsInt()); //яркость
2626
sendStatus(modeRGBS, readArgsInt()); //режим
2727
String title = readArgsString(); // Пятый аргумент подпись
28-
if (title=="" ) title = rgbS;
28+
if (title == "" ) title = rgbS;
2929
sendStatus(stateRGBS, state);
30-
sCmd.readStr("wReg toggle "+rgbS+" "+title);
30+
sCmd.readStr("wReg toggle " + rgbS + " " + title);
3131
ws2812fx.init();
3232
ws2812fx.setMode(getStatusInt(modeRGBS)); // Режим
3333
setColorString(colorRGBS); // Начальный цвет
@@ -140,9 +140,9 @@ void initRGBSHIM() {
140140
sendStatus(speedSRGBS, readArgsInt()); //скорость
141141
sendStatus(brightnessSRGBS, readArgsInt()); //яркость
142142
//sendStatus(modeSRGBS, readArgsInt()); //режим
143-
String title = readArgsString(); // Пятый аргумент подпись
144-
if (title=="" ) title = rgbSS;
145-
sCmd.readStr("wReg toggle "+rgbSS+" "+title);
143+
String title = readArgsString(); // Пятый аргумент подпись
144+
if (title == "" ) title = rgbSS;
145+
sCmd.readStr("wReg toggle " + rgbSS + " " + title);
146146

147147
//регистрируем модуль
148148

@@ -153,9 +153,9 @@ String title = readArgsString(); // Пятый аргумент подпись
153153
}
154154
void setColorSString(String color) {
155155
if (color.length() == 6) {
156-
analogWrite(getOptionsInt("rgbSPin0"), hexToUint32(color.substring(0, 2)));
157-
analogWrite(getOptionsInt("rgbSPin1"), hexToUint32(color.substring(2, 4)));
158-
analogWrite(getOptionsInt("rgbSPin2"), hexToUint32(color.substring(4, 6)));
156+
analogWrite(getOptionsInt("rgbSPin0"), map(hexToUint32(color.substring(0, 2)), 0, 255, 0, 1023));
157+
analogWrite(getOptionsInt("rgbSPin1"), map(hexToUint32(color.substring(2, 4)), 0, 255, 0, 1023));
158+
analogWrite(getOptionsInt("rgbSPin2"), map(hexToUint32(color.substring(4, 6)), 0, 255, 0, 1023));
159159
}
160160
}
161161

Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)