IHS1.1-STM32F303K8
Diff: CLED.cpp
- Revision:
- 1:62baf2ea5573
- Parent:
- 0:0fcc82d7750c
--- a/CLED.cpp Thu Jul 16 08:20:57 2020 +0000
+++ b/CLED.cpp Fri Oct 23 06:37:09 2020 +0000
@@ -15,17 +15,18 @@
// ************************* object ********************************
Ticker indiTic;
-CLED::CLED(int ver) : indVal(0) {
+CLED::CLED(int ver) : inOn(false) {
if (ver == 10) color = c10;
if (ver == 11) color = c11;
indiTic.attach(callback(this, &CLED::indiBlink), 400e-3);
}
-void CLED::set(byte* ary12, bool indi) { // 1-12[8]:{7, 3,..}
+void CLED::set(byte* ary12, bool indiRow) { // 1-12[8]:{7, 3,..}
int val24 = 0;
for (int col = 0; col < COL_LEN; col++) { // LED number is opposit direction
- byte cVal = (indi && (col == COL_LEN - 1) ? indVal : ary12[col]) >> 1;
+ bool isIndi = inOn && indiRow && (col == COL_LEN - 1) && (ary12[col] == 0);
+ byte cVal = (isIndi ? INDI_COLOR : ary12[col]) >> 1;
val24 += color[cVal] << col * 3;
}
sel_sen = 0; //digitalWrite(sel_sen, LOW);
@@ -49,5 +50,5 @@
// *************** PWM callback function ****************
void CLED::indiBlink() { // indicator blink
- indVal = (indVal > 0) ? 0 : INDI_COLOR;
+ inOn = !inOn;
}