Green shading in the line number column means the source is part of the translation unit, red means it is conditionally excluded. Highlighted line numbers link to the translation unit page. Highlighted macros link to the macro page.
1: /* 2: MobaLedLib: LED library for model railways 3: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4: 5: Copyright (C) 2018 - 2023 Hardi Stengelin: https://forum.mobaledlib.de 6: Copyright (C) 2020 - 2023 Juergen Winkler: MobaLedLib@gmx.at 7: 8: This library is free software; you can redistribute it and/or 9: modify it under the terms of the GNU Lesser General Public 10: License as published by the Free Software Foundation; either 11: version 2.1 of the License, or (at your option) any later version. 12: 13: This library is distributed in the hope that it will be useful, 14: but WITHOUT ANY WARRANTY; without even the implied warranty of 15: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16: Lesser General Public License for more details. 17: 18: You should have received a copy of the GNU Lesser General Public 19: License along with this library; if not, write to the Free Software 20: Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21: ------------------------------------------------------------------------------------------------------------- 22: 23: 24: MobaLedLib.h 25: ~~~~~~~~~~~~ 26: 27: This is the main header file for the MobaLedLib. 28: 29: */ 30: #ifndef _MOBALEDLIB_H_ 31: #define _MOBALEDLIB_H_ 32: 33: #define MobaLedLib_Ver 3.0.0 // Adapt also library.properties if changed 34: 35: #define FASTLED_INTERNAL // Disable version number message in FastLED library (looks like an error) 36: 37: #ifndef CONFIG_ONLY 38: #ifdef ARDUINO_RASPBERRY_PI_PICO 39: #include "PicoFastLED.h" // Juergen: a small self made implementation of FastLED for PICO (only FastLED code needed by MLL) 40: #else 41: #include "FastLED.h" // The FastLED library must be installed in addition if you got the 42: // error message "..fatal error: FastLED.h: No such file or directory" 43: // Arduino IDE: Sketch / Include library / Manage libraries Deutsche IDE: Sketch / Bibliothek einbinden / Bibliothek verwalten 44: // Type "FastLED" in the "Filter your search..." field "FastLED" in das "Grenzen Sie ihre Suche ein" Feld eingeben 45: // Select the entry and click "Install" Gefundenen Eintrag auswaehlen und "Install" anklicken 46: 47: #endif //ARDUINO_RASPBERRY_PI_PICO 48: #endif //CONFIG_ONLY 49: #include "Dprintf.h" // Debug Ausgaben 50: 51: #include "Lib_Config.h" // Library configurarion 52: #include "IntDefs.h" // Internal defines 53: 54: #include "LED_HeartBeat.h" 55: 56: #include "Macros.h" 57: 58: 59: #ifdef _HOUSE_STATISTIC 60: #define RAMH RAM12 // Additional RAM for statistics: sizeof(House_Stat_T) 61: #else 62: #define RAMH RAM2 63: #endif //_HOUSE_STATISTIC 64: 65: /* 66: Wenn die Const() Funktion ueber die Pattern Funktion implementiert werden, 67: dann benoetigt das 13 Byte pro Konstante und 5 Bytes RAM. 68: Die Proc_Const() Funktion benoetigt 6 Byte pro Zeile und 188 Bytes C-Code 69: => Aus der Sicht des FLASH lohnt es die Proc_Const() Funktion zu verwenden 70: wenn mehr als 26 Const() Zeilen verwendet werden. 71: Man koennte die Pattern Funktion so erweitern, dass sie keinen RAM und keine Zeiten benutzt 72: Das wurde 2 Bytes FLASH sparen 73: */ 74: 75: 76: 77: #ifdef _USE_SEP_CONST 78: #define Const( LED,Cx,InCh,Val0, Val1) CONST_T, _CHKL(LED)+RAM0,Cx,_ChkIn(InCh),Val0, Val1, // 6 Bytes / 13 Bytes mit der Pattern Funktion + 5 Bytes RAM 79: #else 80: #define Const( LED,Cx,InCh,Val0, Val1) PatternT1(LED,_NStru(Cx, 1,1),InCh,_Cx2LedCnt(Cx),Val0,Val1,Val0,0,0 Sec, _Cx2P_BLINK(Cx)) 81: #endif 82: 83: #define ConstRGB( LED,InCh, R0, G0, B0, R1, G1, B1) Const(LED, C1, InCh, R0, R1) Const(LED, C2, InCh, G0, G1) Const(LED, C3, InCh, B0, B1) 84: 85: 86: #define House( LED,InCh, On_Min,On_Limit, ...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),On_Min, On_Limit,HOUSE_MIN_T,HOUSE_MAX_T,COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Room types 87: #define HouseT( LED,InCh, On_Min,On_Limit,Min_T,Max_T,...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),On_Min, On_Limit,Min_T, Max_T, COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Room types 88: #define GasLights( LED,InCh, ...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),127, 255, GAS_MIN_T, GAS_MAX_T, COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Gas lights 89: #define House_Inv( LED,InCh, On_Min,On_Limit, ...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),On_Min|0x80,On_Limit,HOUSE_MIN_T,HOUSE_MAX_T,COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Room types 90: #define HouseT_Inv( LED,InCh, On_Min,On_Limit,Min_T,Max_T,...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),On_Min|0x80,On_Limit,Min_T, Max_T, COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Room types 91: #define GasLights_Inv( LED,InCh, ...) HOUSE_T, _CHKL(LED)+RAMH,_ChkIn(InCh),127 |0x80,255, GAS_MIN_T, GAS_MAX_T, COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // Variable number of Gas lights 92: #define Fire( LED,InCh, LedCnt, Brightness) FIRE_T, _CHKL(LED)+RAM1+RAMN(LedCnt),_ChkIn(InCh),LedCnt,Brightness, 93: #ifdef _NEW_ROOM_COL 94: #define Set_ColTab( r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4,r5,g5,b5,r6,g6,b6,r7,g7,b7,r8,g8,b8,r9,g9,b9,r10,g10,b10,r11,g11,b11,r12,g12,b12,r13,g13,b13,r14,g14,b14,r15,g15,b15,r16,g16,b16) SET_COLTAB_T, r0,g0,b0,r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4,r5,g5,b5,r6,g6,b6,r7,g7,b7,r8,g8,b8,r9,g9,b9,r10,g10,b10,r11,g11,b11,r12,g12,b12,r13,g13,b13,r14,g14,b14,r15,g15,b15,r16,g16,b16, 95: #endif 96: 97: #if _USE_CANDLE // 10.06.20: 98: #define Set_CandleTab(Min_Hue, Max_Hue, Min_BrightnessD, Max_BrightnessD, Min_Brightness, Max_Brightness, Change_Probability, Chg_Hue, DarkProb) SET_CANDLETAB_T, Min_Hue, Max_Hue, Min_BrightnessD, Max_BrightnessD, Min_Brightness, Max_Brightness, Change_Probability, Chg_Hue, DarkProb, 99: #endif 100: 101: #if _USE_SET_TVTAB // 10.01.20: 102: #define Set_TV_COL1( InCh, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R_Min, R_Max, G_Min, G_Max, B_Min, B_Max) SET_TV_TAB_T, InCh, 0x00, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R_Min, R_Max, G_Min, G_Max, B_Min, B_Max, 103: #define Set_TV_COL2( InCh, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R_Min, R_Max, G_Min, G_Max, B_Min, B_Max) SET_TV_TAB_T, InCh, 0x01, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R_Min, R_Max, G_Min, G_Max, B_Min, B_Max, 104: #define Set_TV_BW1( InCh, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R, G, B) SET_TV_TAB_T, InCh, 0x00, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R, R, G, G, B, B, 105: #define Set_TV_BW2( InCh, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R, G, B) SET_TV_TAB_T, InCh, 0x01, Update_t_Min, Update_t_Max, Min_Brightness, Max_Brightness, R, R, G, G, B, B, 106: #endif 107: 108: #if _USE_DEF_NEON // 12.01.20: 109: #define Set_Def_Neon( InCh, Rand_On, RandOff, Min_Def) SET_DEF_NEON_T, InCh, Rand_On, RandOff, Min_Def, 110: #endif 111: 112: #define _CHECK_MODE_RF_NOT_SAME(Mode, DstVar1, DstVarN) (((Mode)&RF_NOT_SAME) && (DstVarN) - (DstVar1) == 0) ? ((Mode) & ~RF_NOT_SAME) : (Mode) // Prevent endless loop if DstVar1 == DstVarN // 13.01.20: 113: 114: #define Logic( DstVar, ...) LOGIC_T, DstVar, COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, 115: #define Counter( Mode, InCh, Enable, TimeOut, ...) COUNTER_T, _W2B(Mode), InCh+RAM3, Enable, _T2B((TimeOut)/16), COUNT_VARARGS(__VA_ARGS__), __VA_ARGS__, // TimeOut maximal 17 Min 116: #define RandMux( DstVar1, DstVarN, InCh, Mode, MinTime, MaxTime) RANDMUX_T, DstVar1+RAM4, DstVarN, InCh, _CHECK_MODE_RF_NOT_SAME(Mode, DstVar1, DstVarN) | _RAND_MODE2((MinTime), (MaxTime)), _Tx2B2(MinTime, MaxTime), _Tx2B2(MaxTime, MinTime), 117: #define RandCntMux( DstVar1, DstVarN, InCh, Mode, MinTime, MaxTime) RandMux(DstVar1, DstVarN, InCh, Mode|RF_SEQ, MinTime, MaxTime) 118: #define Random( DstVar, InCh, Mode, MinTime, MaxTime, MinOn, MaxOn) RANDOM_T, DstVar +RAM4, InCh, (Mode) | _RAND_MODE4((MinTime), (MaxTime), (MinOn), (MaxOn)), _Tx2B4(MinTime, MaxTime, MinOn, MaxOn), _Tx2B4(MaxTime, MinTime, MinOn, MaxOn), _Tx2B4(MinOn, MaxOn, MinTime, MaxTime), _Tx2B4(MaxOn, MinOn, MinTime, MaxTime), 119: #define WeldingCont( LED, InCh) WELDING_CONT_T, _CHKL(LED)+RAM5, InCh, 120: #define Welding( LED, InCh) WELDING_T, _CHKL(LED)+RAM5, InCh, 121: #define RandWelding( LED, InCh, Var, MinTime, MaxTime, MinOn, MaxOn) Random(Var, InCh, RM_NORMAL, MinTime, MaxTime, MinOn, MaxOn) Welding(LED, Var) 122: 123: 124: #if _USE_COPY_N_LEDS // 18.09.23: 125: #define CopyLED( LED, InCh, SrcLED) COPYLED_T, 1, _CHKL(LED), InCh, _CHKL(SrcLED), 126: #define CopyNLEDs( LED_Cnt, LED, InCh, SrcLED) COPYLED_T, (uint8_t)LED_Cnt, _CHKL(LED), InCh, _CHKL(SrcLED), 127: #else 128: #define CopyLED( LED, InCh, SrcLED) COPYLED_T, _CHKL(LED), InCh, _CHKL(SrcLED), 129: #endif 130: #define Schedule( DstVar1, DstVarN, EnableCh, Start, End) SCHEDULE_T, DstVar1+RAM3, DstVarN, EnableCh, Start, End, // Zeit- oder Helligkeitsgesteuertes Ein- und Ausschalten von Variablen. 131: #define New_HSV_Group() NEW_HSV_GROUP_T+RAM3, 132: #define New_Local_Var() NEW_LOCAL_VAR_T+RAM2, // 07.11.18: 133: #define Use_GlobalVar( GlobVarNr) USE_GLOBALVAR_T, GlobVarNr, 134: #if _USE_INCH_TRIGGER // 02.06.20: 135: #define I2X_USE_LOCALVAR 0x80 136: #define I2X_USE_START1 0x40 137: #define InCh_to_TmpVar(FirstInCh, InCh_Cnt) INCH_TO_X_VAR_T, FirstInCh, (InCh_Cnt-1), // 31.05.20: J: EndInCh is now 0..63 instead of 1..64 138: #define InCh_to_TmpVar1(FirstInCh, InCh_Cnt) INCH_TO_X_VAR_T, FirstInCh, (InCh_Cnt-1)|I2X_USE_START1, // 07.05.20: // 31.05.20: J: EndInCh is now 0..63 instead of 1..64 139: #define InCh_to_LocalVar(FirstInCh, InCh_Cnt) INCH_TO_X_VAR_T+RAM1, FirstInCh, (InCh_Cnt-1)|I2X_USE_LOCALVAR, 140: #define InCh_to_LocalVar1(FirstInCh, InCh_Cnt) INCH_TO_X_VAR_T+RAM1, FirstInCh, (InCh_Cnt-1)|I2X_USE_LOCALVAR|I2X_USE_START1, 141: #define Bin_InCh_to_TmpVar(FirstInCh, InCh_Cnt) BIN_INCH_TO_TMPVAR_T, FirstInCh, (InCh_Cnt-1), // 18.01.19: // 31.05.20: J: EndInCh is now 0..7 instead of 1..8 142: #define Bin_InCh_to_TmpVar1(FirstInCh, InCh_Cnt) BIN_INCH_TO_TMPVAR_T, FirstInCh, (InCh_Cnt-1)|0x40,// 07.05.20: // 31.05.20: J: EndInCh is now 0..7 instead of 1..8 143: #else 144: #define InCh_to_TmpVar(FirstInCh, InCh_Cnt) INCH_TO_TMPVAR_T, FirstInCh, InCh_Cnt, 145: #define InCh_to_TmpVar1(FirstInCh, InCh_Cnt) INCH_TO_TMPVAR1_T, FirstInCh, InCh_Cnt, // 07.05.20: 146: #define Bin_InCh_to_TmpVar(FirstInCh, InCh_Cnt) BIN_INCH_TO_TMPVAR_T, FirstInCh, InCh_Cnt, // 18.01.19: 147: #define Bin_InCh_to_TmpVar1(FirstInCh, InCh_Cnt) BIN_INCH_TO_TMPVAR1_T, FirstInCh, InCh_Cnt, // 07.05.20: 148: #endif 149: #define Button( LED,Cx,InCh,Duration,Val0, Val1) PatternT1(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx),Val0,Val1,Val0,PM_SEQUENZ_W_ABORT+PF_SLOW,Duration/16, _Cx2P_BLINK(Cx)) 150: #define ButtonNOff( LED,Cx,InCh,Duration,Val0, Val1) PatternT1(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx),Val0,Val1,Val0,PM_SEQUENZ_NO_RESTART+PF_SLOW,Duration/16,_Cx2P_BLINK(Cx)) // 12.03.19: 151: #define Blinker( LED,Cx,InCh,Period) PatternT1(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx), 0, 255, 0, PF_SLOW,(Period)/32, _Cx2P_BLINK(Cx)) // Blinker 31.10.20: Added PF_SLOW and /16 to all Blinker functions 152: #define BlinkerInvInp( LED,Cx,InCh,Period) PatternT1(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx), 0, 255, 0, PF_SLOW+PF_INVERT_INP,(Period)/32, _Cx2P_BLINK(Cx)) // Blinker with inverse input 153: #define BlinkerHD( LED,Cx,InCh,Period) PatternT1(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx),50, 255, 0, PF_SLOW, (Period)/32, _Cx2P_BLINK(Cx)) // Hell/Dunkel Blinken 154: #define Blink2( LED,Cx,InCh,Pause,Act,Val0,Val1) PatternT2(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx),Val0,Val1,0, PF_SLOW, Act/16, Pause/16, _Cx2P_BLINK(Cx)) // Blinken mit zwei verschiedenen Helligkeiten 155: #define Blink3( LED,Cx,InCh,Pause,Act,Val0,Val1,Off) PatternT2(LED,_NStru(Cx, 2,1),InCh,_Cx2LedCnt(Cx),Val0,Val1,Off, PF_SLOW, Act/16, Pause/16, _Cx2P_BLINK(Cx)) // Blinken mit zwei verschiedenen Helligkeiten und einen Wert wenn der Blinker aus ist 156: #define BlueLight1( LED,Cx,InCh) PatternT4(LED,_NStru(Cx, 4,1),InCh,_Cx2LedCnt(Cx),0, 255, 0,0, 48 ms, 74 ms, 48 ms, 496 ms,_Cx2P_DBLFL(Cx)) // Blaulicht 157: #define BlueLight2( LED,Cx,InCh) PatternT4(LED,_NStru(Cx, 4,1),InCh,_Cx2LedCnt(Cx),0, 255, 0,0, 24 ms, 74 ms, 24 ms, 512 ms,_Cx2P_DBLFL(Cx)) // Blaulicht (Andere Periode damit nicht synchron) 158: #define Leuchtfeuer( LED,Cx,InCh) PatternT4(LED,_NStru(Cx, 4,1),InCh,_Cx2LedCnt(Cx),0, 255, 0,0,1000 ms,500 ms,1000 ms,1500 ms,_Cx2P_DBLFL(Cx)) // Leuchtfeuer fuer Windrad 159: #define LeuchtfeuerALL(LED,InCh) PatternT4(LED,_NStru(C_ALL,4,1),InCh,_Cx2LedCnt(C_ALL),0,255, 0,0,1000 ms,500 ms,1000 ms,1500 ms,0b11000111, 0b00000001)// Leuchtfeuer fuer Windrad 160: #define Andreaskreuz( LED,Cx,InCh) APatternT1(LED,_NStru(Cx, 0,1),InCh,2,0,255,0,0,250 ms,105) // Nur fuer einzelne LEDs (C1, C2, C3). 161: #define AndreaskrRGB( LED,InCh) APatternT1(LED,0, InCh,4,0,255,0,0,250 ms,129,24) 162: 163: // 20.05.20: 164: // Flashing time see: 2:22.. in https://www.youtube.com/watch?v=aEwmf3gXAQk 165: #define AndreaskrLT(LED, Single_Cx, InCh, MaxBrightness, LT_Time,FadeTime, OnTime) \ 166: Bin_InCh_to_TmpVar(InCh, 1) \ 167: XPatternT9(LED,_Cx2StCh(Single_Cx)+132,SI_LocalVar,2,0,MaxBrightness,0,0,FadeTime,FadeTime,LT_Time,FadeTime,OnTime,OnTime,FadeTime,OnTime,FadeTime,240,15,48,204,3 ,63,128,0,0,2,64,0,0,65) 168: 169: #define AndreaskrLT3(LED, Single_Cx, InCh, MaxBrightness, LT_Time,FadeTime, OnTime) \ 170: Bin_InCh_to_TmpVar(InCh, 1) \ 171: XPatternT9(LED,_Cx2StCh(Single_Cx)+68,SI_LocalVar,3,0,MaxBrightness,0,0,FadeTime,FadeTime,LT_Time,FadeTime,OnTime,OnTime,FadeTime,OnTime,FadeTime,192,243,0,192,196,48,19 ,63,128,0,0,2,64,0,0,65) 172: 173: #define AndreaskrLT_RGB(LED, InCh, MaxBrightness, LT_Time,FadeTime, OnTime) \ 174: Bin_InCh_to_TmpVar(InCh, 1) \ 175: XPatternT9(LED,4,SI_LocalVar,4,0,MaxBrightness,0,0,FadeTime,FadeTime,LT_Time,FadeTime,OnTime,OnTime,FadeTime,OnTime,FadeTime,0,195,195,0,0,3,192,192,3 ,63,128,0,0,2,64,0,0,65) 176: 177: #define AndreaskrLT3_RGB(LED, InCh, MaxBrightness, LT_Time,FadeTime, OnTime) \ 178: Bin_InCh_to_TmpVar(InCh, 1) \ 179: XPatternT9(LED,196,SI_LocalVar,9,0,MaxBrightness,0,0,FadeTime,FadeTime,LT_Time,FadeTime,OnTime,OnTime,FadeTime,OnTime,FadeTime,0,0,12,3,48,12,0,0,0,0,0,12,64,5,12,0,48,0,3,80,1 ,63,128,0,0,2,64,0,0,65) 180: 181: #define RGB_AmpelX( LED,InCh) PatternT4(LED,0,InCh,18,0,255,0,0,3 Sec,1 Sec,10 Sec,3 Sec,1,2,100,8,0,40,0,134,0,1,2,4,200,16,0,80,0,12) // Ampel fuer Kreuzung mit 6 RGB LEDs 182: #define RGB_AmpelXFade(LED,InCh) APatternT8(LED,0,InCh,18,0,255,0,0,200,2 Sec,200,1 Sec,200,10 Sec,200,3 Sec,1,2,4,8,144,33,64,134,0,128,2,0,10,128,33,0,134,0,1,2,4,8,16,32,67,128,12,1,0,5,0,20,0,67,0,12) 183: #define RGB_AmpelX_A( LED,InCh) PatternT12(LED,0,InCh,17,0,255,0,0,2 Sec,2 sec,10 Sec,500,500,500,500,500,500,500,500,2 Sec,1,2,50,4,0,10,0,16,0,40,0,64,0,160,0,0,1,128,2,0,4,0,10,192,16,16,32,32,64,70,0,192,0,0,1,0,3,0,4,0,12,0,16,0,48,0,64,0,192,0,24) 184: 185: #define AmpelX( LED,InCh) PatternT4(LED,0,InCh,6,0, 255,0,0,3 Sec,1 Sec,10 Sec,3 Sec,201,194,40,73,22,70) // Ampel fuer Kreuzung mit 6 einzelnen LEDs (Achtung keine RGB LEDs) 186: 187: #define Flash( LED, Cx, InCh, Var, MinTime, MaxTime) Random(Var, InCh, RM_NORMAL, MinTime, MaxTime, 30 ms, 30 ms) Const(LED, Cx, Var, 0, 255) // Zufaelliges Blitzlicht (Fotograf) 188: 189: #define Def_Neon_Misha(LED, InCh, Var, Min_Delay, Max_Delay) Random(Var, InCh, RM_NORMAL, Min_Delay, Max_Delay, 500 ms, 2000 ms) \ 190: PatternT8(LED,8, Var,3,1,128,0,0,300 ms,100 ms,300 ms,100 ms,4 sec,400 ms,100 ms,100 ms,0,254,3,248,191,136,17,128,100) 191: 192: 193: 194: #define ConstrWarnLightRGB6( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT12(LED,28,InCh,18,0,255,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MaxBrightness,MaxBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0,MinBrightness,MinBrightness,0) 195: 196: #define ConstrWarnLightFlash3( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT6( LED,128,InCh,3, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitE,129,64,0,0,0) 197: #define ConstrWarnLightFlash4( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT8( LED,0, InCh,4, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,2,4,8,0,0) 198: #define ConstrWarnLightFlash5( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT10(LED,128,InCh,5, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,8,64,0,2,16,0,0) 199: #define ConstrWarnLightFlash6( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT12(LED,0, InCh,6, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,32,0,4,128,0,16,0,2) 200: #define ConstrWarnLightFlash7( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT14(LED,192,InCh,7, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,128,0,64,0,32,0,16,0,8,0,4,0) 201: #define ConstrWarnLightFlash8( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT16(LED,0, InCh,8, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,2,0,4,0,8,0,16,0,32,0,64,0,128,0) 202: #define ConstrWarnLightFlash9( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT18(LED,192,InCh,9, MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,8,0,64,0,0,2,0,16,0,128,0,0,4,0,32,0,0,1,0) 203: #define ConstrWarnLightFlash10(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT20(LED,0, InCh,10,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,32,0,0,4,0,128,0,0,16,0,0,2,0,64,0,0,8,0,0,1,0,32,0) 204: #define ConstrWarnLightFlash11(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT22(LED,192,InCh,11,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,128,0,0,64,0,0,32,0,0,16,0,0,8,0,0,4,0,0,2,0,0,1,0,128,0,0,64,0,0) 205: #define ConstrWarnLightFlash12(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT24(LED,0, InCh,12,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,0,2,0,0,4,0,0,8,0,0,16,0,0,32,0,0,64,0,0,128,0,0,0,1,0,0,2,0,0,4,0,0,8,0) 206: #define ConstrWarnLightFlash13(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT26(LED,192,InCh,13,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,0,8,0,0,64,0,0,0,2,0,0,16,0,0,128,0,0,0,4,0,0,32,0,0,0,1,0,0,8,0,0,64,0,0,0,2,0,0,16,0,0) 207: #define ConstrWarnLightFlash14(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT28(LED,0, InCh,14,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,0,32,0,0,0,4,0,0,128,0,0,0,16,0,0,0,2,0,0,64,0,0,0,8,0,0,0,1,0,0,32,0,0,0,4,0,0,128,0,0,0,16,0,0,0,2,0) 208: #define ConstrWarnLightFlash15(LED,InCh, MinBrightness, MaxBrightness, OnT, WaitT, WaitE) PatternT30(LED,192,InCh,15,MinBrightness,MaxBrightness,0,0,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitT,OnT,WaitE,1,0,0,128,0,0,0,64,0,0,0,32,0,0,0,16,0,0,0,8,0,0,0,4,0,0,0,2,0,0,0,1,0,0,128,0,0,0,64,0,0,0,32,0,0,0,16,0,0,0,8,0,0,0,4,0,0) 209: 210: #define ConstrWarnLight3( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT4( LED,128,InCh,3, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,WaitE,17,1,0,0,0) 211: #define ConstrWarnLight4( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT5( LED,0, InCh,4, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,WaitE,33,132,0,0,0,0) 212: #define ConstrWarnLight5( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT6( LED,128,InCh,5, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,WaitE,65,16,4,1,0,0,0,0) 213: #define ConstrWarnLight6( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT7( LED,0, InCh,6, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,129,64,32,16,8,0,0,0,0) 214: #define ConstrWarnLight7( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT8( LED,128,InCh,7, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,1,1,1,1,1,1,0,0,0,0) 215: #define ConstrWarnLight8( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT9( LED,0, InCh,8, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,2,4,8,16,32,64,128,0,0,0,0) 216: #define ConstrWarnLight9( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT10(LED,128,InCh,9, MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,4,16,64,0,1,4,16,64,0,1,0,0,0) 217: #define ConstrWarnLight10( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT11(LED,0, InCh,10,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,8,64,0,2,16,128,0,4,32,0,1,8,0,0) 218: #define ConstrWarnLight11( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT12(LED,128,InCh,11,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,16,0,1,16,0,1,16,0,1,16,0,1,16,0,1,0) 219: #define ConstrWarnLight12( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT13(LED,128,InCh,12,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,32,0,4,128,0,16,0,2,64,0,8,0,1,32,0,4,128,0,0) 220: #define ConstrWarnLight13( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT14(LED,64, InCh,13,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,64,0,16,0,4,0,1,64,0,16,0,4,0,1,64,0,16,0,4,0,1,0) 221: #define ConstrWarnLight14( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT15(LED,192,InCh,14,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,128,0,64,0,32,0,16,0,8,0,4,0,2,0,1,128,0,64,0,32,0,16,0,8,0,0) 222: #define ConstrWarnLight15( LED,InCh, MinBrightness, MaxBrightness, OnT, WaitE) PatternT16(LED,0, InCh,15,MinBrightness,MaxBrightness,0,0,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,OnT,WaitE,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0) 223: 224: // Control the charlieplexing Modul 225: #define Charlie_Buttons(LED, InCh, States) InCh_to_TmpVar(InCh, States) \ 226: PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,1 ms,15,15,15,35,35,35,55,55,55,75,75,75,95,95,95,115,115,115,135,135,135,155,155,155,175,175,175,195,195,195,215,215,215 ,63,191,191,191,191,191,191,191,191,191,191) 227: // Old: Channels G & B (35 Bytes) New 46 Bytes) 31.10.20: 228: // PatternT1(LED,29,SI_LocalVar,2,0,255,0,0,1 ms,15,15,35,35,55,55,75,75,95,95,115,115,135,135,155,155,175,175,195,195,215,215 ,63,191,191,191,191,191,191,191,191,191,191) 229: 230: 231: #define _GET_BIN_SIZE(n) (n<=1?0:(n<=2?1:(n<=4)?2:(n<=8?3:(n<=16?4:999)))) // Number of bits needed for n states (n up to 16) 232: #define Charlie_Binary(LED, InCh, BinStates) Bin_InCh_to_TmpVar(InCh, _GET_BIN_SIZE((BinStates))) \ 233: PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,1 ms,15,15,15,35,35,35,55,55,55,75,75,75,95,95,95,115,115,115,135,135,135,155,155,155,175,175,175,195,195,195,215,215,215 ,63,191,191,191,191,191,191,191,191,191,191) 234: // Old: Channels G & B (35 Bytes) New 46 Bytes) 31.10.20: 235: // PatternT1(LED,29,SI_LocalVar,2,0,255,0,0,1 ms,15,15,35,35,55,55,75,75,95,95,115,115,135,135,155,155,175,175,195,195,215,215 ,63,191,191,191,191,191,191,191,191,191,191) 236: 237: 238: // Entry signal with 3 aspects 239: #define EntrySignal3_RGB(LED, InCh) EntrySignal3_RGB_BT(LED,InCh,128,125 ms) 240: #define EntrySignal3_RGB_B(LED, InCh,MaxBrightness) EntrySignal3_RGB_BT(LED,InCh,MaxBrightness,125 ms) // 01.05.20: Added by Juergen 241: #define EntrySignal3_RGB_T(LED, InCh,FadeTime) EntrySignal3_RGB_BT(LED,InCh,128,FadeTime) // " 242: #define EntrySignal3_RGB_BT(LED, InCh,MaxBrightness,FadeTime) \ 243: InCh_to_TmpVar(InCh, 3) /* 29.10.19: Old: 500 ms */ \ 244: XPatternT1(LED,160,SI_LocalVar,9,0,MaxBrightness,0,0,FadeTime,64,4,104,0 ,63,191,191) // 01.05.20: Juergen added parameter MaxBrightness and FadeTime 245: 246: #define EntrySignal3(LED, InCh, MaxB128) InCh_to_TmpVar(InCh, 3) /* 29.10.19: Old: 500 ms */ \ 247: XPatternT1(LED,224,SI_LocalVar,3,0,MaxB128,0,0,125 ms,145,1 ,63,191,191) 248: 249: // Departure signal with 4 aspects 250: #define DepSignal4_RGB(LED, InCh, MaxB128) InCh_to_TmpVar(InCh, 4) /* 29.10.19: Old: 7 Input channels, 500 ms */ \ 251: XPatternT1(LED,12,SI_LocalVar,18,0,MaxB128,0,0,125 ms,0,240,0,15,0,0,0,0,0,240,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,240,15,0,240,0,0,16,17,17,1,0 ,63,191,191,191) 252: 253: #define DepSignal4(LED, InCh, MaxB128) InCh_to_TmpVar(InCh, 4) /* 29.10.19: Old: 7 Input channels, 500 ms */ \ 254: XPatternT1(LED,12,SI_LocalVar,5,0,MaxB128,0,0,125 ms,15,240,0,15,0,240,15,240,0,16 ,63,191,191,191) 255: 256: // Entry signal with 3 aspects 257: #define EntrySignal3Bin_RGB(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) /* 29.10.19: Old: 500 ms */ \ 258: XPatternT1(LED,160,SI_LocalVar,9,0,MaxB128,0,0,500 ms,64,4,104,0 ,63,191,191) 259: 260: #define EntrySignal3Bin(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) /* 29.10.19: Old: 500 ms */ \ 261: XPatternT1(LED,224,SI_LocalVar,3,0,MaxB128,0,0,125 ms,145,1 ,63,191,191) 262: 263: // Departure signal with 4 aspects 264: #define DepSignal4Bin_RGB(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) /* 29.10.19: Old: 500 ms */ \ 265: XPatternT1(LED,12,SI_LocalVar,18,0,MaxB128,0,0,125 ms,0,240,0,15,0,0,0,0,0,240,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,240,15,0,240,0,0,16,17,17,1,0 ,63,191,191,191) 266: 267: #define DepSignal4Bin(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) /* 29.10.19: Old: 500 ms */ \ 268: XPatternT1(LED,12,SI_LocalVar,5,0,MaxB128,0,0,125 ms,15,240,0,15,0,240,15,240,0,16 ,63,191,191,191) 269: 270: // 09.06.20: New signals 271: #define KS_Vorsignal_Zs3V_RGB(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 3) \ 272: XPatternT9(LED,128,SI_LocalVar,12,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,48,224,0,0,1,0,0,237,208,14,236,192,14 ,0,63,128,63,128,64,0,0,1) 273: 274: #define KS_Vorsignal_Zs3V(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 3) \ 275: XPatternT9(LED,128,SI_LocalVar,4,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,144,32,224,206,12 ,0,63,128,63,128,64,0,0,1) 276: 277: #define KS_Hauptsignal_Zs3_Zs1_RGB(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 4) \ 278: XPatternT11(LED,128,SI_LocalVar,12,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,128,0,0,0,8,0,112,8,0,128,224,8,142,0,8,0 ,0,63,128,63,128,63,128,64,0,0,1) 279: 280: #define KS_Hauptsignal_Zs3_Zs1(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 4) \ 281: XPatternT11(LED,128,SI_LocalVar,4,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,32,64,80,160,42,2 ,0,63,128,63,128,63,128,64,0,0,1) 282: 283: #define KS_Hauptsignal_Zs3_Zs6_Zs1_RGB(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 4) \ 284: XPatternT11(LED,96,SI_LocalVar,15,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,0,4,0,0,0,16,0,0,56,132,3,0,16,28,8,14,4,0,2,0 ,0,63,128,63,128,63,128,64,0,0,1) 285: 286: #define KS_Hauptsignal_Zs3_Zs6_Zs1(LED, InCh, MaxB128) InCh_to_LocalVar(InCh, 4) \ 287: XPatternT11(LED,32,SI_LocalVar,5,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,64,0,2,42,80,74,8 ,0,63,128,63,128,63,128,64,0,0,1) 288: 289: // 18.01.21: Signals from Matthias (schma29) 290: #define HS_5l_RGB(LED, InCh, MaxB64) InCh_to_TmpVar(InCh, 4) \ 291: XPatternT1(LED,12,SI_LocalVar,15,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,240,10,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,240,255 ,0,63,128,63,128,63,128,63) 292: #define HS_5r_RGB(LED, InCh, MaxB64) InCh_to_TmpVar(InCh, 4) \ 293: XPatternT1(LED,12,SI_LocalVar,15,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,240,10,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,240,255 ,0,63,128,63,128,63,128,63) 294: #define HS_5_Plus_RGB(LED, InCh, MaxB64) InCh_to_TmpVar(InCh, 8) \ 295: XPatternT1(LED,12,SI_LocalVar,27,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,128,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,52,0,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,52,0,0,53,0,0 ,0,63,128,63,128,63,128,63,128,63,128,63,128,63,128,63) 296: #define Gleissperrsignal_RGB(LED, InCh, MaxB32) InCh_to_TmpVar(InCh, 2) \ 297: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB32,0,0,600 ms,0,0,0,0,0,0,0,64,0,0,64,0,0,0,0,0,0,0,51,3,0,51,3,0 ,0,63,128,63) 298: #define HS_Einfach_RGB(LED, InCh, MaxB32) InCh_to_TmpVar(InCh, 3) \ 299: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB32,0,0,500 ms,0,0,0,0,0,0,0,240,0,0,128,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,191,0,0,192,0,0 ,0,63,128,63,128,63) 300: #define Vorsignal_RGB(LED, InCh, MaxB16) InCh_to_TmpVar(InCh, 2) \ 301: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB16,0,0,500 ms,0,0,0,0,0,0,0,128,0,0,128,0,0,0,0,0,0,0,122,0,0,122,0,0 ,0,63,128,63) 302: #define HP_2_2_RGB(LED, InCh, MaxB16) InCh_to_TmpVar(InCh, 2) \ 303: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB16,0,0,500 ms,0,0,0,0,0,0,0,128,0,8,0,0,0,0,0,0,0,0,128,0,0,0,0,8 ,0,63,128,63) 304: // Binary versions 305: #define KS_Vorsignal_Zs3VBin_RGB(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 306: XPatternT9(LED,128,SI_LocalVar,12,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,48,224,0,0,1,0,0,237,208,14,236,192,14 ,0,63,128,63,128,64,0,0,1) 307: 308: #define KS_Vorsignal_Zs3VBin(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 309: XPatternT9(LED,128,SI_LocalVar,4,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,144,32,224,206,12 ,0,63,128,63,128,64,0,0,1) 310: 311: #define KS_Hauptsignal_Zs3_Zs1Bin_RGB(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 312: XPatternT11(LED,128,SI_LocalVar,12,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,128,0,0,0,8,0,112,8,0,128,224,8,142,0,8,0 ,0,63,128,63,128,63,128,64,0,0,1) 313: 314: #define KS_Hauptsignal_Zs3_Zs1Bin(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 315: XPatternT11(LED,128,SI_LocalVar,4,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,32,64,80,160,42,2 ,0,63,128,63,128,63,128,64,0,0,1) 316: 317: #define KS_Hauptsignal_Zs3_Zs6_Zs1Bin_RGB(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 318: XPatternT11(LED,96,SI_LocalVar,15,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,0,0,4,0,0,0,16,0,0,56,132,3,0,16,28,8,14,4,0,2,0 ,0,63,128,63,128,63,128,64,0,0,1) 319: 320: #define KS_Hauptsignal_Zs3_Zs6_Zs1Bin(LED, InCh, MaxB128) Bin_InCh_to_TmpVar(InCh, 2) \ 321: XPatternT11(LED,32,SI_LocalVar,5,0,MaxB128,0,0,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,500 ms,200 ms,500 ms,200 ms,64,0,2,42,80,74,8 ,0,63,128,63,128,63,128,64,0,0,1) 322: 323: // 18.01.21: Signals from Matthias (schma29) 324: #define HS_5lBin_RGB(LED, InCh, MaxB64) Bin_InCh_to_TmpVar(InCh, 2) \ 325: XPatternT1(LED,12,SI_LocalVar,15,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,240,10,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,240,255 ,0,63,128,63,128,63,128,63) 326: #define HS_5rBin_RGB(LED, InCh, MaxB64) Bin_InCh_to_TmpVar(InCh, 2) \ 327: XPatternT1(LED,12,SI_LocalVar,15,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,240,10,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,240,255 ,0,63,128,63,128,63,128,63) 328: #define HS_5_PlusBin_RGB(LED, InCh, MaxB64) Bin_InCh_to_TmpVar(InCh, 3) \ 329: XPatternT1(LED,12,SI_LocalVar,27,0,MaxB64,0,0,500 ms,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,128,136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,112,5,0,0,4,0,0,0,52,0,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,52,0,0,53,0,0 ,0,63,128,63,128,63,128,63,128,63,128,63,128,63,128,63) 330: #define GleissperrsignalBin_RGB(LED, InCh, MaxB32) Bin_InCh_to_TmpVar(InCh, 1) \ 331: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB32,0,0,600 ms,0,0,0,0,0,0,0,64,0,0,64,0,0,0,0,0,0,0,51,3,0,51,3,0 ,0,63,128,63) 332: #define HS_EinfachBin_RGB(LED, InCh, MaxB32) Bin_InCh_to_TmpVar(InCh, 2) \ 333: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB32,0,0,500 ms,0,0,0,0,0,0,0,240,0,0,128,0,0,0,0,0,0,0,0,0,0,192,0,0,0,0,0,0,0,0,191,0,0,192,0,0 ,0,63,128,63,128,63) 334: #define VorsignalBin_RGB(LED, InCh, MaxB16) Bin_InCh_to_TmpVar(InCh, 1) \ 335: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB16,0,0,500 ms,0,0,0,0,0,0,0,128,0,0,128,0,0,0,0,0,0,0,122,0,0,122,0,0 ,0,63,128,63) 336: #define HP_2_2Bin_RGB(LED, InCh, MaxB16) Bin_InCh_to_TmpVar(InCh, 1) \ 337: XPatternT1(LED,12,SI_LocalVar,12,0,MaxB16,0,0,500 ms,0,0,0,0,0,0,0,128,0,8,0,0,0,0,0,0,0,0,128,0,0,0,0,8 ,0,63,128,63) 338: 339: // 14.01.23: A signal consisting of one 2-color red/green LED 340: #define SingleLedSignal(LED,InCh,Single_Cx, FadeTime) InCh_to_LocalVar(InCh, 4) \ 341: XPatternT1(LED,_Cx2StCh(Single_Cx)+64,SI_LocalVar,2,0,128,0,0,FadeTime,132,12 ,0,63,128,63,128,63,191) 342: #define SingleLedSignalEx(LED,InCh,Single_Cx, FadeTime, State0_0, State0_1, State1_0, State1_1, State2_0, State2_1, State3_0, State3_1) InCh_to_LocalVar(InCh, 4) \ 343: XPatternT1(LED,_Cx2StCh(Single_Cx)+28,SI_LocalVar,2,0,255,0,0,FadeTime,0,0,State0_0,State0_1,0,0,State1_0,State1_1,0,0,State2_0,State2_1,0,0, \ 344: State3_0,State3_1 ,0,63,128,63,128,63,128,63) 345: 346: #define ButtonFunc( DstVar, InCh, Duration) Random(DstVar, InCh, RF_STAY_ON, 0, 0, (Duration), (Duration)) // DstVar is turned on if InCh is activated and stays on for duration (Static (Not Edge) retiggerable mono flop) 347: 348: // 13.04.20: Swapped parameter of the RS_FlipFlop's because it makes more sense if the first parameter is R like the name RS_FlipFlop. 349: // In addition the first parameter of a DCC command is "Red" = Reset 350: // In the excel sheet the standard parameter (#InCh) is connected to the S input because it is more likely that 351: // several FlipFlops are disabled with a common Rest variable 352: // To Use a RS-flip-flop with DCC the "GREEN" channel has to be assigned to 353: 354: // Single DstVar (Q) 355: #define MonoFlop( DstVar, InCh, Duration) Counter(_CM_RS_FlipFlop1, InCh, SI_0, Duration, DstVar) // Re-trigger with rising edge (Like ButtonFunc, but edge triggered) 356: #define MonoFlopReset( DstVar, InCh, R_InCh, Duration) Counter(_CM_RS_FlipFlop1, InCh, R_InCh, Duration, DstVar) // Re-trigger with rising edge with additional Reset input 357: #define MonoFlopLongReset( DstVar, InCh, Duration) Counter(_CM_RS_FlipFlop1|CF_RESET_LONG, InCh, SI_0, Duration, DstVar) // Re-trigger with rising edge, Long press disables 358: #define RS_FlipFlop( DstVar, R_InCh, S_InCh) Counter(_CM_RS_FlipFlop1, S_InCh, R_InCh, 0, DstVar) // Edge triggered RS Flip Flop 359: #define RS_FlipFlopTimeout( DstVar, R_InCh, S_InCh, Timeout) Counter(_CM_RS_FlipFlop1, S_InCh, R_InCh, Timeout, DstVar) // Edge triggered RS Flip Flop and timeout 360: #define T_FlipFlopReset( DstVar, T_InCh, R_InCh) Counter(_CM_T_FlipFlop1, T_InCh, R_InCh, 0, DstVar) // Toggle Flip Flop with reset 361: #define T_FlipFlopResetTimeout( DstVar, T_InCh, R_InCh, Timeout) Counter(_CM_T_FlipFlop1, T_InCh, R_InCh, Timeout, DstVar) // Toggle Flip Flop with restart and timeout 362: 363: // Single DstVar which is controlled inverse (Q') => DstVar is active at the beginning and when a timeout timeout occurs. It's deactivated with the trigger 364: #define MonoFlopInv( DstVar, InCh, Duration) Counter(_CM_RS_FlipFlop2, InCh, SI_0, Duration, DstVar, DstVar) // Re-trigger with rising edge (Like ButtonFunc, but edge triggered) 365: #define MonoFlopInvLongReset( DstVar, InCh, Duration) Counter(_CM_RS_FlipFlop2|CF_RESET_LONG, InCh, SI_0, Duration, DstVar, DstVar) // Re-trigger with rising edge, Long press disables 366: #define RS_FlipFlopInv( DstVar, R_InCh, S_InCh) Counter(_CM_RS_FlipFlop2, S_InCh, R_InCh, 0, DstVar, DstVar) // Edge triggered RS Flip Flop 367: #define RS_FlipFlopInvTimeout( DstVar, R_InCh, S_InCh, Timeout) Counter(_CM_RS_FlipFlop2, S_InCh, R_InCh, Timeout, DstVar, DstVar) // Edge triggered RS Flip Flop and timeout 368: #define T_FlipFlopInvReset( DstVar, T_InCh, R_InCh) Counter(_CM_T_FlipFlopReset2, T_InCh, R_InCh, 0, DstVar, DstVar) // Toggle Flip Flop with reset Q' 369: #define T_FlipFlopInvResetTimeout( DstVar, T_InCh, R_InCh, Timeout) Counter(_CM_T_FlipFlopReset2, T_InCh, R_InCh, Timeout, DstVar, DstVar) // Toggle Flip Flop with restart and timeout Q' 370: 371: // Dual DstVar (Q and Q') 372: #define MonoFlop2( DstVar0, DstVar1, InCh, Duration) Counter(_CM_RS_FlipFlop2, InCh, SI_0, Duration, DstVar0, DstVar1) // Two Outputs, re-trigger with rising edge (Like ButtonFunc, but edge triggered) 373: #define MonoFlop2LongReset( DstVar0, DstVar1, InCh, Duration) Counter(_CM_RS_FlipFlop2|CF_RESET_LONG, InCh, SI_0, Duration, DstVar0, DstVar1) // Two Outputs, re-trigger with rising edge, Long press disables 374: #define RS_FlipFlop2( DstVar0, DstVar1, R_InCh, S_InCh) Counter(_CM_RS_FlipFlop2, S_InCh, R_InCh, 0, DstVar0, DstVar1) // Edge triggered RS Flip Flop 375: #define RS_FlipFlop2Timeout( DstVar0, DstVar1, R_InCh, S_InCh, Timeout) Counter(_CM_RS_FlipFlop2, S_InCh, R_InCh, Timeout, DstVar0, DstVar1) // Edge triggered RS Flip Flop and timeout 376: #define T_FlipFlop2Reset( DstVar0, DstVar1, T_InCh, R_InCh) Counter(_CM_T_FlipFlopReset2, T_InCh, R_InCh, 0, DstVar0, DstVar1) // Toggle Flip Flop with reset 377: #define T_FlipFlop2ResetTimeout( DstVar0, DstVar1, T_InCh, R_InCh, Timeout) Counter(_CM_T_FlipFlopReset2, T_InCh, R_InCh, Timeout, DstVar0, DstVar1) // Toggle Flip Flop with restart and timeout 378: 379: #define RGB_Heartbeat(LED) \ 380: New_HSV_Group() \ 381: APatternT2(LED,192,SI_1,1,0,255,0,PM_HSV,60 Sek,0 ms,1) \ 382: APatternT1(LED, 194,SI_1,1,10,255,0,PM_HSV|PF_EASEINOUT,1 Sek,1) // Nicht ganz aus gehen weil es sonst bei manchen Farben flackert 383: 384: #define RGB_Heartbeat2(LED, MinBrightness, MaxBrightness) \ 385: New_HSV_Group() \ 386: APatternT2(LED,192,SI_1,1,0,255,0,PM_HSV,60 Sek,0 ms,1) \ 387: APatternT1(LED, 194,SI_1,1,MinBrightness,MaxBrightness,0,PM_HSV|PF_EASEINOUT,1 Sek,1) // 18.01.19: 388: // 14.12.21: add additional heartbeat macro 389: #define RGB_Heartbeat_Color(LED, MinBrightness, MaxBrightness, Color, Duration) \ 390: New_HSV_Group() \ 391: APatternT1(LED,224,SI_1,1,Color,Color,0,PM_HSV,0 ms,1) \ 392: APatternT1(LED, 194,SI_1,1,MinBrightness,MaxBrightness,0,PM_HSV|PF_EASEINOUT,Duration,1) 393: 394: #define RGB_Ring(LED, InCh, Brightness, Duration) \ 395: APatternT1(LED,4,InCh,36,0,Brightness,0,0,Duration,137,98,8,162,28,195,52,142,34,72,162, \ 396: 24,130,40,199,48,141,163,40,146,40,134,32,202,49,76,227,56,138,36,138,33,136,114,12,211, \ 397: 52,142,34,137,98,8,162,28,195,48,141,163,72,162,24,130,40,199,49,76,227,40,146,40,134,32, \ 398: 202,114,12,211,56,138,36,138,33,136,162,28,195,52,142,34,137,98,8,130,40,199,48,141,163, \ 399: 72,162,24,134,32,202,49,76,227,40,146,40,138,33,136,114,12,211,56,138,36) // 07.01.25: Juergen include Raily's LED ring macro 400: 401: // Push Button functions which count the button press and activates temporary variables 402: // The button flashes n times if the button was pressed n times. 403: // Parameter: 404: // B_LED: LED Number of the LED in the PUSH button (Example NUM_LEDS_1) 405: // B_LED_Cx: Channel of the LED (C1..C3) 406: // InCh: Number of the input channel which is used to read in the button 407: // TmpNr: First temporary variable. There function PushButton_w_LED_0_2 uses 3 temporary variables. PushButton_w_LED_0_3 uses 4, ... 408: // Rotate: If the button is pressed n+1 times the first temporary variable is activated again 409: // Timeout: Time when the push button action is disabled again 410: // 411: 412: // 10.03.19: Added B_LED_Cx to be able to use the functions with all single button LEDs (C_1, C_2 and C_3) 413: #define Status_Button_0_1(LED,B_LED_Cx, Val1) PatternT1(LED,40 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,Val1,0,0,0.4 Sec,57,0 ,63,192,0,0,1) // 01.04.20: 414: #define Status_Button_0_2(LED,B_LED_Cx, Val1) PatternT1(LED,232+_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,Val1,0,0,0.4 Sec,57,128,227,0,0 ,63,192,0,0,1,192,0,0,0,0,2) 415: #define Status_Button_0_3(LED,B_LED_Cx, Val1) PatternT1(LED,232+_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,Val1,0,0,0.4 Sec,57,128,227,0,142,227,0,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3) 416: #define Status_Button_0_4(LED,B_LED_Cx, Val1) PatternT1(LED,40 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,Val1,0,0,0.4 Sec,57,128,227,0,142,227,0,142,227,56,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3,192,0,0,0,0,0,0,0,0,4) 417: #define Status_Button_0_5(LED,B_LED_Cx, Val1) PatternT1(LED,168+_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,Val1,0,0,0.4 Sec,57,128,227,0,142,227,0,142,227,56,128,227,56,142,3,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3,192,0,0,0,0,0,0,0,0,4,192,0,0,0,0,0,0,0,0,0,0,5) 418: 419: // 01.04.20: Buttons where the background light could be changed (The functions above have a const background light of 1/8 of Val1) 420: #define Status_ButtonBL_0_1(LED,B_LED_Cx,Val1,BackLight) PatternT1(LED,28 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,255,0,0,0.4 Sec,BackLight,Val1,0,0,0 ,63,192,0,0,1) 421: #define Status_ButtonBL_0_2(LED,B_LED_Cx,Val1,BackLight) PatternT1(LED,28 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,255,0,0,0.4 Sec,BackLight,Val1,0,0,0,Val1,0,Val1,0,0,0 ,63,192,0,0,1,192,0,0,0,0,2) 422: #define Status_ButtonBL_0_3(LED,B_LED_Cx,Val1,BackLight) PatternT1(LED,28 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,255,0,0,0.4 Sec,BackLight,Val1,0,0,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,0,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3) 423: #define Status_ButtonBL_0_4(LED,B_LED_Cx,Val1,BackLight) PatternT1(LED,28 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,255,0,0,0.4 Sec,BackLight,Val1,0,0,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,Val1,0,0,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3,192,0,0,0,0,0,0,0,0,4) 424: #define Status_ButtonBL_0_5(LED,B_LED_Cx,Val1,BackLight) PatternT1(LED,28 +_Cx2StCh(B_LED_Cx),SI_LocalVar,1,0,255,0,0,0.4 Sec,BackLight,Val1,0,0,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,Val1,0,0,0,Val1,0,Val1,0,Val1,0,Val1,0,Val1,0,0,0 ,63,192,0,0,1,192,0,0,0,0,2,192,0,0,0,0,0,0,3,192,0,0,0,0,0,0,0,0,4,192,0,0,0,0,0,0,0,0,0,0,5) 425: 426: 427: #define Status_Button_RGB_0_1(LED,R0,G0,B0,R10,G10,B10,R11,G11,B11) PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,0.5 Sec,R0,G0,B0,R10,G10,B10,R11,G11,B11 ,63,192,1) 428: #define Status_Button_RGB_0_2(LED,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21) PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,0.5 Sec,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21 ,63,192,1,192,2) 429: #define Status_Button_RGB_0_3(LED,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31) PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,0.5 Sec,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31 ,63,192,1,192,2,192,3) 430: #define Status_Button_RGB_0_4(LED,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41) PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,0.5 Sec,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41 ,63,192,1,192,2,192,3,192,4) 431: #define Status_Button_RGB_0_5(LED,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51) PatternT1(LED,28,SI_LocalVar,3,0,255,0,0,0.5 Sec,R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51 ,63,192,1,192,2,192,3,192,4,192,5) 432: 433: 434: // 28.04.20: 435: #define PushButton_0_1(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 436: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar, InCh, SI_1, Timeout, TmpNr+0, TmpNr+1) \ 437: InCh_to_TmpVar(TmpNr, 1+1) 438: 439: #define PushButton_0_2(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 440: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar, InCh, SI_1, Timeout, TmpNr+0, TmpNr+1, TmpNr+2) \ 441: InCh_to_TmpVar(TmpNr, 2+1) 442: 443: #define PushButton_0_3(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 444: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar, InCh, SI_1, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3) \ 445: InCh_to_TmpVar(TmpNr, 3+1) 446: 447: #define PushButton_0_4(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 448: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar, InCh, SI_1, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3, TmpNr+4) \ 449: InCh_to_TmpVar(TmpNr, 4+1) 450: 451: #define PushButton_0_5(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 452: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar, InCh, SI_1, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3, TmpNr+4, TmpNr+5) \ 453: InCh_to_TmpVar(TmpNr, 5+1) 454: 455: // 21.05.20: 456: #define PushButton2I_0_1(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 457: Logic(LocInCh, InCh+1 OR InCh2==SI_0?InCh+1:InCh2) \ 458: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar|CF_INV_ENABLE, LocInCh, InCh, Timeout, TmpNr+0, TmpNr+1) \ 459: InCh_to_TmpVar(TmpNr, 1+1) 460: 461: #define PushButton2I_0_2(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 462: Logic(LocInCh, InCh+1 OR InCh2==SI_0?InCh+1:InCh2) \ 463: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar|CF_INV_ENABLE, LocInCh, InCh, Timeout, TmpNr+0, TmpNr+1, TmpNr+2) \ 464: InCh_to_TmpVar(TmpNr, 2+1) 465: 466: #define PushButton2I_0_3(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 467: Logic(LocInCh, InCh+1 OR InCh2==SI_0?InCh+1:InCh2) \ 468: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar|CF_INV_ENABLE, LocInCh, InCh, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3) \ 469: InCh_to_TmpVar(TmpNr, 3+1) 470: 471: #define PushButton2I_0_4(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 472: Logic(LocInCh, InCh+1 OR InCh2==SI_0?InCh+1:InCh2) \ 473: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar|CF_INV_ENABLE, LocInCh, InCh, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3, TmpNr+4) \ 474: InCh_to_TmpVar(TmpNr, 4+1) 475: 476: #define PushButton2I_0_5(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 477: Logic(LocInCh, InCh+1 OR InCh2==SI_0?InCh+1:InCh2) \ 478: Counter((Rotate?CF_ROTATE:0)|(Use0?0:CF_SKIP0)|(ResetLong?CF_RESET_LONG:0)|OptCtrPar|CF_INV_ENABLE, LocInCh, InCh, Timeout, TmpNr+0, TmpNr+1, TmpNr+2, TmpNr+3, TmpNr+4, TmpNr+5) \ 479: InCh_to_TmpVar(TmpNr, 5+1) 480: 481: // 01.04.20: Added: PushButton_w_LED_0_1 482: // 13.04.20: Added: Use0, ResetLong, OptCtrPar 483: #define PushButton_w_LED_0_1(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 484: PushButton_0_1(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 485: Status_Button_0_1(B_LED, B_LED_Cx, 255) 486: 487: #define PushButton_w_LED_0_2(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 488: PushButton_0_2(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 489: Status_Button_0_2(B_LED, B_LED_Cx, 255) 490: 491: #define PushButton_w_LED_0_3(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 492: PushButton_0_3(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 493: Status_Button_0_3(B_LED, B_LED_Cx,255) 494: 495: #define PushButton_w_LED_0_4(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 496: PushButton_0_4(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 497: Status_Button_0_4(B_LED, B_LED_Cx,255) 498: 499: #define PushButton_w_LED_0_5(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 500: PushButton_0_5(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 501: Status_Button_0_5(B_LED, B_LED_Cx,255) 502: 503: // 01.04.20: 504: #define PushButton_w_LED_BL_0_1(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 505: PushButton_0_1(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 506: Status_ButtonBL_0_1(B_LED, B_LED_Cx, Val1, BackLight) 507: 508: #define PushButton_w_LED_BL_0_2(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 509: PushButton_0_2(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 510: Status_ButtonBL_0_2(B_LED, B_LED_Cx, Val1, BackLight) 511: 512: #define PushButton_w_LED_BL_0_3(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 513: PushButton_0_3(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 514: Status_ButtonBL_0_3(B_LED, B_LED_Cx, Val1, BackLight) 515: 516: #define PushButton_w_LED_BL_0_4(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 517: PushButton_0_4(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 518: Status_ButtonBL_0_4(B_LED, B_LED_Cx, Val1, BackLight) 519: 520: #define PushButton_w_LED_BL_0_5(B_LED, B_LED_Cx, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 521: PushButton_0_5(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 522: Status_ButtonBL_0_5(B_LED, B_LED_Cx, Val1, BackLight) 523: 524: // 28.04.20: 525: #define PushButton_RGB_0_1(B_LED, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11) \ 526: PushButton_0_1(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 527: Status_Button_RGB_0_1(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11) 528: 529: #define PushButton_RGB_0_2(B_LED, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21) \ 530: PushButton_0_2(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 531: Status_Button_RGB_0_2(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21) 532: 533: #define PushButton_RGB_0_3(B_LED, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31) \ 534: PushButton_0_3(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 535: Status_Button_RGB_0_3(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31) 536: 537: #define PushButton_RGB_0_4(B_LED, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41) \ 538: PushButton_0_4(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 539: Status_Button_RGB_0_4(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41) 540: 541: #define PushButton_RGB_0_5(B_LED, InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51) \ 542: PushButton_0_5(InCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 543: Status_Button_RGB_0_5(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51) 544: 545: // 22.05.20: 546: #define PushButton2I_w_LED_BL_0_1(B_LED, B_LED_Cx, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 547: PushButton2I_0_1(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 548: Status_ButtonBL_0_1(B_LED, B_LED_Cx, Val1, BackLight) 549: 550: #define PushButton2I_w_LED_BL_0_2(B_LED, B_LED_Cx, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 551: PushButton2I_0_2(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 552: Status_ButtonBL_0_2(B_LED, B_LED_Cx, Val1, BackLight) 553: 554: #define PushButton2I_w_LED_BL_0_3(B_LED, B_LED_Cx, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 555: PushButton2I_0_3(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 556: Status_ButtonBL_0_3(B_LED, B_LED_Cx, Val1, BackLight) 557: 558: #define PushButton2I_w_LED_BL_0_4(B_LED, B_LED_Cx, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 559: PushButton2I_0_4(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 560: Status_ButtonBL_0_4(B_LED, B_LED_Cx, Val1, BackLight) 561: 562: #define PushButton2I_w_LED_BL_0_5(B_LED, B_LED_Cx, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, Val1, BackLight) \ 563: PushButton2I_0_5(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 564: Status_ButtonBL_0_5(B_LED, B_LED_Cx, Val1, BackLight) 565: 566: 567: #define PushButton2I_RGB_0_1(B_LED, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11) \ 568: PushButton2I_0_1(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 569: Status_Button_RGB_0_1(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11) 570: 571: #define PushButton2I_RGB_0_2(B_LED, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21) \ 572: PushButton2I_0_2(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 573: Status_Button_RGB_0_2(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21) 574: 575: #define PushButton2I_RGB_0_3(B_LED, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31) \ 576: PushButton2I_0_3(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 577: Status_Button_RGB_0_3(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31) 578: 579: #define PushButton2I_RGB_0_4(B_LED, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41) \ 580: PushButton2I_0_4(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 581: Status_Button_RGB_0_4(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41) 582: 583: #define PushButton2I_RGB_0_5(B_LED, InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51) \ 584: PushButton2I_0_5(InCh, InCh2, LocInCh, TmpNr, Rotate, Use0, ResetLong, OptCtrPar, Timeout) \ 585: Status_Button_RGB_0_5(B_LED, R0,G0,B0,R10,G10,B10,R11,G11,B11,R20,G20,B20,R21,G21,B21,R30,G30,B30,R31,G31,B31,R40,G40,B40,R41,G41,B41,R50,G50,B50,R51,G51,B51) 586: 587: #define Servo2(LED, InCh, Single_Cx, Servo1, Servo2, ServoT) \ 588: InCh_to_TmpVar1(InCh, 2) \ 589: PatternT1(LED,_Cx2StCh(Single_Cx)+28,SI_LocalVar,1,0,255,0,0,ServoT,0,Servo1,Servo2 ,127,129,129) 590: 591: #define Servo3(LED, InCh, Single_Cx, Servo1, Servo2, Servo3, ServoT) \ 592: InCh_to_TmpVar1(InCh, 3) \ 593: PatternT1(LED,_Cx2StCh(Single_Cx)+28,SI_LocalVar,1,0,255,0,0,ServoT,0,Servo1,Servo2,Servo3 ,127,129,129,129) 594: 595: #define Servo4(LED, InCh, Single_Cx, Servo1, Servo2, Servo3, Servo4, ServoT) \ 596: InCh_to_TmpVar1(InCh, 4) \ 597: PatternT1(LED,_Cx2StCh(Single_Cx)+28,SI_LocalVar,1,0,255,0,0,ServoT,0,Servo1,Servo2,Servo3,Servo4 ,127,129,129,129,129) 598: 599: #define Servo5(LED, InCh, Single_Cx, Servo1, Servo2, Servo3, Servo4, Servo5, ServoT) \ 600: InCh_to_TmpVar1(InCh, 5) \ 601: PatternT1(LED,_Cx2StCh(Single_Cx)+28,SI_LocalVar,1,0,255,0,0,10 Sec,0,Servo1,Servo2,Servo3,Servo4,Servo5 ,127,129,129,129,129,129) 602: 603: // Herzstueck for the PCB Ver. 1.0 where the Red and Green Channels are swapped ;-( // 25.07.20: 604: #define Herz_BiRelais_V1_AB(LED, InCh, DelayHerz1) \ 605: InCh_to_TmpVar1(InCh, 2) \ 606: PatternT2(LED,192,SI_LocalVar,2,0,255,0,0,200 ms, DelayHerz1,32,1 ,127,128,1,128,1) 607: 608: #define Herz_BiRelais_I_V1_AB(LED, InCh, DelayHerz1) \ 609: InCh_to_TmpVar1(InCh, 2) \ 610: PatternT2(LED,192,SI_LocalVar,2,0,255,0,0,200 ms,DelayHerz1,16,2 ,127,128,1,128,1) 611: 612: 613: #define Herz_BiRelais_V1_CD(LED, InCh, DelayHerz1) \ 614: InCh_to_TmpVar1(InCh, 2) \ 615: PatternT2(LED, 98,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,4 ,127,128,1,128,1) \ 616: PatternT2(LED+1,97,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,16 ,127,128,1,128,1) 617: 618: #define Herz_BiRelais_I_V1_CD(LED, InCh, DelayHerz1) \ 619: InCh_to_TmpVar1(InCh, 2) \ 620: PatternT2(LED, 98,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,16 ,127,128,1,128,1) \ 621: PatternT2(LED+1,97,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,4 ,127,128,1,128,1) 622: 623: #define Herz_BiRelais_V1_EF(LED, InCh, DelayHerz1) \ 624: InCh_to_TmpVar1(InCh, 2) \ 625: PatternT2(LED,96,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,4 ,127,128,1,128,1) \ 626: PatternT2(LED,98,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,16 ,127,128,1,128,1) 627: 628: #define Herz_BiRelais_I_V1_EF(LED, InCh, DelayHerz1) \ 629: InCh_to_TmpVar1(InCh, 2) \ 630: PatternT2(LED,96,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,16 ,127,128,1,128,1) \ 631: PatternT2(LED,98,SI_LocalVar,1,0,255,0,0,200 ms, DelayHerz1,4 ,127,128,1,128,1) 632: 633: 634: //Herzstueck 18.05.20: 635: #define Herz_BiRelais(LED, InCh, Single_Cx, DelayHerz1) \ 636: InCh_to_TmpVar1(InCh, 2) \ 637: PatternT2(LED,_Cx2StCh(Single_Cx)+192,SI_LocalVar,2,0,255,0,0,200 ms,DelayHerz1,16,2 ,127,128,1,128,1) 638: 639: #define Herz_BiRelais_I(LED, InCh, Single_Cx, DelayHerz1) \ 640: InCh_to_TmpVar1(InCh, 2) \ 641: PatternT2(LED,_Cx2StCh(Single_Cx)+192,SI_LocalVar,2,0,255,0,0,200 ms,DelayHerz1,32,1 ,127,128,1,128,1) 642: 643: #if 1 // Herzstueck with FF 644: // Saves 2 Bytes RAM and 6 Bytes Flash compared to the Pattern version below, but it uses 7 instead of 6 InCh variables 645: #define _Herz_MoRelais_RS(LED, InCh, Single_Cx, DelayHerz1, TmpNr, Inv) \ 646: RS_FlipFlopTimeout(TmpNr+0, InCh, InCh+1, DelayHerz1 + 200 ms) \ 647: RS_FlipFlopTimeout(TmpNr+1, InCh, InCh+1, DelayHerz1) \ 648: RS_FlipFlopTimeout(TmpNr+2, InCh+1, InCh, DelayHerz1 + 200 ms) \ 649: RS_FlipFlopTimeout(TmpNr+3, InCh+1, InCh, DelayHerz1) \ 650: Logic(TmpNr+4, TmpNr+0 AND NOT TmpNr+1) \ 651: Logic(TmpNr+5, TmpNr+2 AND NOT TmpNr+3) \ 652: RS_FlipFlop(TmpNr+6, TmpNr+5-Inv, TmpNr+4+Inv) \ 653: Const(LED, Single_Cx, TmpNr+6, 0, 255) 654: 655: #define Herz_MoRelais(LED, InCh, Single_Cx, DelayHerz1, TmpNr) \ 656: _Herz_MoRelais_RS(LED, InCh, Single_Cx, DelayHerz1, TmpNr, 0) 657: 658: #define Herz_MoRelais_I(LED, InCh, Single_Cx, DelayHerz1, TmpNr) \ 659: _Herz_MoRelais_RS(LED, InCh, Single_Cx, DelayHerz1, TmpNr, 1) 660: 661: #else // Uses the Pattern function to drive the relais (Problems with the EEPron Save version prior 19.05.20) 662: #define _Herz_MoRelais_PF(LED, InCh, Single_Cx, DelayHerz1, TmpNr, Bits) \ 663: RS_FlipFlopTimeout(TmpNr+0, InCh, InCh+1, DelayHerz1 + 200 ms) \ 664: RS_FlipFlopTimeout(TmpNr+1, InCh, InCh+1, DelayHerz1) \ 665: RS_FlipFlopTimeout(TmpNr+2, InCh+1, InCh, DelayHerz1 + 200 ms) \ 666: RS_FlipFlopTimeout(TmpNr+3, InCh+1, InCh, DelayHerz1) \ 667: Logic(TmpNr+4, TmpNr+0 AND NOT TmpNr+1) \ 668: Logic(TmpNr+5, TmpNr+2 AND NOT TmpNr+3) \ 669: InCh_to_TmpVar1(TmpNr+4, 2) \ 670: PatternT1(LED,_Cx2StCh(Single_Cx)+160,SI_LocalVar,1,0,255,0,0,200 ms,Bits ,63,191,191) 671: 672: #define Herz_MoRelais(LED, InCh, Single_Cx, DelayHerz1, TmpNr) \ 673: _Herz_MoRelais_PF(LED, InCh, Single_Cx, DelayHerz1, TmpNr, 2) 674: 675: #define Herz_MoRelais_I(LED, InCh, Single_Cx, DelayHerz1, TmpNr) \ 676: _Herz_MoRelais_PF(LED, InCh, Single_Cx, DelayHerz1, TmpNr, 4) 677: #endif 678: 679: 680: #define Herz_2MoRelais(LED, InCh, Single_Cx, DelayHerz2) \ 681: InCh_to_TmpVar1(InCh, 2) \ 682: PatternT2(LED,_Cx2StCh(Single_Cx)+192,SI_LocalVar,2,0,255,0,0,200 ms,DelayHerz2,16,2 ,127,128,63,128,63) 683: 684: #define Herz_2MoRelais_I(LED, InCh, Single_Cx, DelayHerz2) \ 685: InCh_to_TmpVar1(InCh, 2) \ 686: PatternT2(LED,_Cx2StCh(Single_Cx)+192,SI_LocalVar,2,0,255,0,0,200 ms,DelayHerz2,32,1 ,127,128,63,128,63) 687: 688: 689: //--------------------------------------- MP3-TF-16P Sound modul --------------------------------------------- 690: 691: // ADKey1 ADKey2 692: #define SOUND_ADKEY10 11 // Play Mode 14 693: #define SOUND_ADKEY9 17 // U/SD/SPI 13 694: #define SOUND_ADKEY8 22 // Loop All 12 695: #define SOUND_ADKEY7 25 // Pause/Play 11 696: #define SOUND_ADKEY6 29 // Prev/Vol- 10 697: #define SOUND_ADKEY5 37 // Next/Vol+ 9 698: #define SOUND_ADKEY4 49 // 4 8 699: #define SOUND_ADKEY3 70 // 3 7 700: #define SOUND_ADKEY2 134 // 2 6 701: #define SOUND_ADKEY1 255 // 1 5 702: 703: 704: // Sound functions could be disable / enabled with the variable SI_Enable_Sound 705: #define Sound_ADKey( LED, InCh, ADKey1, ADKey2) PatternTE2(LED,28,InCh,SI_Enable_Sound,2,0,255,0,PM_SEQUENZ_NO_RESTART,200 ms,10 ms,ADKey1,ADKey2,0,0) 706: 707: // Volume changing is independent from SI_Enable_Sound 708: #define Sound_ADKeyTime(LED, InCh, ADKey1, ADKey2, Time) PatternT2( LED,28,InCh, 2,0,255,0,PM_SEQUENZ_NO_RESTART,Time,10 ms,ADKey1,ADKey2,0,0) 709: 710: #define Sound_Prev( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY5, 0) 711: #define Sound_Next( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY6, 0) 712: #define Sound_PausePlay( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY7, 0) 713: #define Sound_Loop( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY8, 0) 714: #define Sound_USDSPI( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY9, 0) // ? U / SD / SPI 715: #define Sound_PlayMode( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY10, 0) // If Loop is active the button toggles between Sequence, Sequence, Repeat same, Random, Loop off 716: 717: // Volume 718: // First Volume change after 1000 ms 719: // Then volume is changed every 150 ms 720: // According to the documentation there are 30 stepps 721: #define Sound_DecVol( LED, InCh, Steps) Sound_ADKeyTime(LED, InCh, SOUND_ADKEY5, 0, 850 ms - 75 ms + (Steps-1) * 150 ms) 722: #define Sound_IncVol( LED, InCh, Steps) Sound_ADKeyTime(LED, InCh, SOUND_ADKEY6, 0, 850 ms - 75 ms + (Steps-1) * 150 ms) 723: 724: #define Sound_Seq1( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY1, 0) 725: #define Sound_Seq2( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY2, 0) 726: #define Sound_Seq3( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY3, 0) 727: #define Sound_Seq4( LED, InCh) Sound_ADKey(LED, InCh, SOUND_ADKEY4, 0) 728: #define Sound_Seq5( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY1) 729: #define Sound_Seq6( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY2) 730: #define Sound_Seq7( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY3) 731: #define Sound_Seq8( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY4) 732: #define Sound_Seq9( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY5) 733: #define Sound_Seq10(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY6) 734: #define Sound_Seq11(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY7) 735: #define Sound_Seq12(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY8) 736: #define Sound_Seq13(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY9) 737: #define Sound_Seq14(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_ADKEY10) 738: 739: #define _LocalVar_Sound(LED) PatternT1(LED,28,SI_LocalVar,2,0,255,0,0,200 ms,0,0,SOUND_ADKEY1,0,SOUND_ADKEY2,0,SOUND_ADKEY3,0,SOUND_ADKEY4,0,0,SOUND_ADKEY1,0,SOUND_ADKEY2,0,SOUND_ADKEY3,0,SOUND_ADKEY4,0,SOUND_ADKEY5,0,SOUND_ADKEY6,0,SOUND_ADKEY7,0,SOUND_ADKEY8,0,SOUND_ADKEY9,0,SOUND_ADKEY10,0,0 ,1,129,129,129,129,129,129,129,129,129,129,129,129,129,129,127) 740: 741: #define Sound_PlayRandom(LED, InCh, MaxSoundNr) \ 742: New_Local_Var() \ 743: Counter(CF_ONLY_LOCALVAR | CF_RANDOM | CF_SKIP0, InCh, SI_1, 0 Sec, MaxSoundNr+1) \ 744: _LocalVar_Sound(LED) 745: 746: #define Sound_Next_of_N_Reset(LED, InCh, InReset, MaxSoundNr) \ 747: New_Local_Var() \ 748: Counter(CF_ONLY_LOCALVAR | CF_ROTATE | CF_SKIP0 | CF_INV_ENABLE, InCh, InReset, 0 Sec, MaxSoundNr+1) \ 749: _LocalVar_Sound(LED) 750: 751: #define Sound_Next_of_N(LED, InCh, MaxSoundNr) \ 752: Sound_Next_of_N_Reset(LED, InCh, SI_0, MaxSoundNr) 753: 754: //--------------------------------------- MP3-TF-16P Sound modul with 4.7uF capacitor and 2KHz WS2811 ------------------------ 13.10.21: 755: // The new WS2811 modules (model year >2016) generate a 2 kHz PWM Signal (Old 400 Hz) 756: // Here the filter capacitor could be reduced 4.7uF (Instead of 22uF) to support also the new 757: // MP3-TF-16P modul which use the GDB3200B chip. With 22uF the new sound modules didn't work. 758: // Modules with the old MH2024K chip could also be used this macros if the 4.7uF capacitor is used. 759: 760: #define SOUND_New_ADKEY10 11 // Play Mode 14 761: #define SOUND_New_ADKEY9 18 // U/SD/SPI 13 762: #define SOUND_New_ADKEY8 23 // Loop All 12 763: #define SOUND_New_ADKEY7 27 // Pause/Play 11 764: #define SOUND_New_ADKEY6 31 // Prev/Vol- 10 765: #define SOUND_New_ADKEY5 39 // Next/Vol+ 9 766: #define SOUND_New_ADKEY4 53 // 4 8 767: #define SOUND_New_ADKEY3 75 // 3 7 768: #define SOUND_New_ADKEY2 148 // 2 6 769: #define SOUND_New_ADKEY1 255 // 1 5 770: 771: #define Sound_New_Prev( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY5, 0) 772: #define Sound_New_Next( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY6, 0) 773: #define Sound_New_PausePlay( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY7, 0) 774: #define Sound_New_Loop( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY8, 0) 775: #define Sound_New_USDSPI( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY9, 0) // ? U / SD / SPI 776: #define Sound_New_PlayMode( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY10, 0) // If Loop is active the button toggles between Sequence, Sequence, Repeat same, Random, Loop off 777: 778: // Volume 779: // First Volume change after 1000 ms 780: // Then volume is changed every 150 ms 781: // According to the documentation there are 30 stepps // Incremented the time from 850 to 950 for the new sound modules. Otherwise sometimes the next/prev sound was played. 782: #define Sound_New_DecVol( LED, InCh, Steps) Sound_ADKeyTime(LED, InCh, SOUND_New_ADKEY5, 0, 950 ms - 75 ms + (Steps-1) * 150 ms) 783: #define Sound_New_IncVol( LED, InCh, Steps) Sound_ADKeyTime(LED, InCh, SOUND_New_ADKEY6, 0, 950 ms - 75 ms + (Steps-1) * 150 ms) 784: 785: #define Sound_New_Seq1( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY1, 0) 786: #define Sound_New_Seq2( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY2, 0) 787: #define Sound_New_Seq3( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY3, 0) 788: #define Sound_New_Seq4( LED, InCh) Sound_ADKey(LED, InCh, SOUND_New_ADKEY4, 0) 789: #define Sound_New_Seq5( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY1) 790: #define Sound_New_Seq6( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY2) 791: #define Sound_New_Seq7( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY3) 792: #define Sound_New_Seq8( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY4) 793: #define Sound_New_Seq9( LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY5) 794: #define Sound_New_Seq10(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY6) 795: #define Sound_New_Seq11(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY7) 796: #define Sound_New_Seq12(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY8) 797: #define Sound_New_Seq13(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY9) 798: #define Sound_New_Seq14(LED, InCh) Sound_ADKey(LED, InCh, 0, SOUND_New_ADKEY10) 799: 800: #define _LocalVar_New_Sound(LED) PatternT1(LED,28,SI_LocalVar,2,0,255,0,0,200 ms,0,0,SOUND_New_ADKEY1,0,SOUND_New_ADKEY2,0,SOUND_New_ADKEY3,0,SOUND_New_ADKEY4,0,0,SOUND_New_ADKEY1,0,SOUND_New_ADKEY2,0,SOUND_New_ADKEY3,0,SOUND_New_ADKEY4,0,SOUND_New_ADKEY5,0,SOUND_New_ADKEY6,0,SOUND_New_ADKEY7,0,SOUND_New_ADKEY8,0,SOUND_New_ADKEY9,0,SOUND_New_ADKEY10,0,0 ,1,129,129,129,129,129,129,129,129,129,129,129,129,129,129,127) 801: 802: #define Sound_New_PlayRandom(LED, InCh, MaxSoundNr) \ 803: New_Local_Var() \ 804: Counter(CF_ONLY_LOCALVAR | CF_RANDOM | CF_SKIP0, InCh, SI_1, 0 Sec, MaxSoundNr+1) \ 805: _LocalVar_New_Sound(LED) 806: 807: #define Sound_New_Next_of_N_Reset(LED, InCh, InReset, MaxSoundNr) \ 808: New_Local_Var() \ 809: Counter(CF_ONLY_LOCALVAR | CF_ROTATE | CF_SKIP0 | CF_INV_ENABLE, InCh, InReset, 0 Sec, MaxSoundNr+1) \ 810: _LocalVar_New_Sound(LED) 811: 812: #define Sound_New_Next_of_N(LED, InCh, MaxSoundNr) \ 813: Sound_New_Next_of_N_Reset(LED, InCh, SI_0, MaxSoundNr) 814: // 13.10.21: End od the new section 815: 816: //---------------------------- JQ6500 Sound modul --------------------------------- // 13.02.19: 817: 818: // Sound functions could be disable / enabled with the variable SI_Enable_Sound 819: #define Sound_JQ6500_ADKey( LED, InCh, ADKey) PatternTE2(LED,28,InCh,SI_Enable_Sound,1,0,255,0,PM_SEQUENZ_NO_RESTART,400 ms,10 ms,ADKey,0) // Normal WS2811 modul with G+RB outputs anf -O+ inputs 820: 821: // Volume changing is independent from SI_Enable_Sound 822: #define Sound_JQ6500_ADKeyTime( LED, InCh, ADKey, Time) PatternT2( LED,28,InCh, 1,0,255,0,PM_SEQUENZ_NO_RESTART,Time,10 ms,ADKey,0) 823: 824: // ADKey1 400ms 470 Ohm 825: #define SOUND_JQ6500_ADKEY1_N 29 // 1 826: #define SOUND_JQ6500_ADKEY2_N 40 // 2 827: #define SOUND_JQ6500_ADKEY3_N 50 // 3 828: #define SOUND_JQ6500_ADKEY4_N 60 // 4 829: #define SOUND_JQ6500_ADKEY5_N 80 // 5 830: #define SOUND_JQ6500_ADKEY6_N 162 // Prev/Vol- 831: #define SOUND_JQ6500_ADKEY7_N 231 // Next/Vol+ 832: 833: // WS2811 with swapped pins (R+GB/+O-) // ADKey1 834: #define SOUND_JQ6500_ADKEY1_BG 32 // 1 835: #define SOUND_JQ6500_ADKEY2_BG 44 // 2 836: #define SOUND_JQ6500_ADKEY3_BG 56 // 3 837: #define SOUND_JQ6500_ADKEY4_BG 68 // 4 838: #define SOUND_JQ6500_ADKEY5_BG 90 // 5 839: #define SOUND_JQ6500_ADKEY6_BG 183 // Prev/Vol- 840: #define SOUND_JQ6500_ADKEY7_BG 238 // Next/Vol+ 841: 842: 843: #define Sound_JQ6500_Prev( LED, InCh) Sound_JQ6500_ADKey( LED, InCh, SOUND_JQ6500_ADKEY6_N) 844: #define Sound_JQ6500_Next( LED, InCh) Sound_JQ6500_ADKey( LED, InCh, SOUND_JQ6500_ADKEY7_N) 845: 846: #define Sound_JQ6500_BG_Prev( LED, InCh) Sound_JQ6500_ADKey( LED, InCh, SOUND_JQ6500_ADKEY6_BG) 847: #define Sound_JQ6500_BG_Next( LED, InCh) Sound_JQ6500_ADKey( LED, InCh, SOUND_JQ6500_ADKEY7_BG) 848: 849: // Volume 850: // First Volume change after ~1000 ms ??? 851: // Then volume is changed every 150 ms ??? 852: // 30 stepps ?? 853: 854: #define Sound_JQ6500_DecVol(LED, InCh, Steps) Sound_JQ6500_ADKeyTime(LED, InCh, SOUND_JQ6500_ADKEY6_N, 1000 ms + (Steps-1) * 150 ms) 855: #define Sound_JQ6500_IncVol(LED, InCh, Steps) Sound_JQ6500_ADKeyTime(LED, InCh, SOUND_JQ6500_ADKEY7_N, 1000 ms + (Steps-1) * 150 ms) 856: 857: #define Sound_JQ6500_BG_DecVol(LED, InCh, Steps) Sound_JQ6500_ADKeyTime(LED, InCh, SOUND_JQ6500_ADKEY6_BG, 1000 ms + (Steps-1) * 150 ms) 858: #define Sound_JQ6500_BG_IncVol(LED, InCh, Steps) Sound_JQ6500_ADKeyTime(LED, InCh, SOUND_JQ6500_ADKEY7_BG, 1000 ms + (Steps-1) * 150 ms) 859: 860: 861: #define Sound_JQ6500_Seq1( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY1_N) 862: #define Sound_JQ6500_Seq2( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY2_N) 863: #define Sound_JQ6500_Seq3( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY3_N) 864: #define Sound_JQ6500_Seq4( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY4_N) 865: #define Sound_JQ6500_Seq5( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY5_N) 866: 867: #define Sound_JQ6500_BG_Seq1( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY1_BG) 868: #define Sound_JQ6500_BG_Seq2( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY2_BG) 869: #define Sound_JQ6500_BG_Seq3( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY3_BG) 870: #define Sound_JQ6500_BG_Seq4( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY4_BG) 871: #define Sound_JQ6500_BG_Seq5( LED, InCh) Sound_JQ6500_ADKey(LED, InCh, SOUND_JQ6500_ADKEY5_BG) 872: 873: #define _LocalVar_Sound_JQ6500( LED) PatternT1(LED,28,SI_LocalVar,1,0,255,0,0,400 ms,0,SOUND_JQ6500_ADKEY1_N, SOUND_JQ6500_ADKEY2_N, SOUND_JQ6500_ADKEY3_N, SOUND_JQ6500_ADKEY4_N, SOUND_JQ6500_ADKEY5_N, 0,1,129,129,129,129,129,127) 874: #define _LocalVar_Sound_JQ6500_BG(LED) PatternT1(LED,28,SI_LocalVar,1,0,255,0,0,400 ms,0,SOUND_JQ6500_ADKEY1_BG,SOUND_JQ6500_ADKEY2_BG,SOUND_JQ6500_ADKEY3_BG,SOUND_JQ6500_ADKEY4_BG,SOUND_JQ6500_ADKEY5_BG,0,1,129,129,129,129,129,127) 875: 876: 877: #define Sound_JQ6500_PlayRandom(LED, InCh, MaxSoundNr) \ 878: New_Local_Var() \ 879: Counter(CF_ONLY_LOCALVAR | CF_RANDOM | CF_SKIP0, InCh, SI_1, 0 Sec, MaxSoundNr+1) \ 880: _LocalVar_Sound_JQ6500(LED) 881: 882: #define Sound_JQ6500_Next_of_N_Reset(LED, InCh, InReset, MaxSoundNr) \ 883: New_Local_Var() \ 884: Counter(CF_ONLY_LOCALVAR | CF_ROTATE | CF_SKIP0 | CF_INV_ENABLE, InCh, InReset, 0 Sec, MaxSoundNr+1) \ 885: _LocalVar_Sound_JQ6500(LED) 886: 887: #define Sound_JQ6500_Next_of_N(LED, InCh, MaxSoundNr) \ 888: Sound_JQ6500_Next_of_N_Reset(LED, InCh, SI_0, MaxSoundNr) 889: 890: 891: #define Sound_JQ6500_BG_PlayRandom(LED, InCh, MaxSoundNr) \ 892: New_Local_Var() \ 893: Counter(CF_ONLY_LOCALVAR | CF_RANDOM | CF_SKIP0, InCh, SI_1, 0 Sec, MaxSoundNr+1) \ 894: _LocalVar_Sound_JQ6500_BG(LED) 895: 896: #define Sound_JQ6500_BG_Next_of_N_Reset(LED, InCh, InReset, MaxSoundNr) \ 897: New_Local_Var() \ 898: Counter(CF_ONLY_LOCALVAR | CF_ROTATE | CF_SKIP0 | CF_INV_ENABLE, InCh, InReset, 0 Sec, MaxSoundNr+1) \ 899: _LocalVar_Sound_JQ6500_BG(LED) 900: 901: #define Sound_JQ6500_BG_Next_of_N(LED, InCh, MaxSoundNr) \ 902: Sound_JQ6500_BG_Next_of_N_Reset(LED, InCh, SI_0, MaxSoundNr) 903: 904: /* 905: #define Sound_Seq( LED, InCh, SeqNr, SoundModul, WS2811_Typ) _Sound##SoundModul##_ADKey( LED, InCh, SOUND##SoundModul##_ADKEY##SeqNr##WS2811_Typ) 906: #define Sound_Pre( LED, InCh, SoundModul, WS2811_Typ) _Sound##SoundModul##_ADKey( LED, InCh, SOUND##SoundModul##_ADKEY6##WS2811_Typ) 907: #define Sound_Nxt( LED, InCh, SoundModul, WS2811_Typ) _Sound##SoundModul##_ADKey( LED, InCh, SOUND##SoundModul##_ADKEY7##WS2811_Typ) 908: #define Sound_DecV(LED, InCh, Steps, SoundModul, WS2811_Typ) _Sound##SoundModul##_ADKeyTime(LED, InCh, SOUND##SoundModul##_ADKEY6##WS2811_Typ, 1000 ms + (Steps-1) * 150 ms) 909: #define Sound_IncV(LED, InCh, Steps, SoundModul, WS2811_Typ) _Sound##SoundModul##_ADKeyTime(LED, InCh, SOUND##SoundModul##_ADKEY7##WS2811_Typ, 1000 ms + (Steps-1) * 150 ms) 910: */ 911: 912: #define EndCfg END_T 913: 914: 915: #ifdef CONFIG_ONLY 916: #define MobaLedLib_Configuration() const unsigned char Config[] __attribute__ ((section (".MLLLedConfig"))) = 917: #else 918: #define MobaLedLib_Configuration() const PROGMEM unsigned char Config[] = 919: #endif 920: 921: #define MobaLedLib_Prepare() MobaLedLib_C* pMobaLedLib; \ 922: uint8_t Config_RAM[__COUNTER__/2]; /* RAM used for the configuration functions. The size is calculated in the macros which are used in the Config[] table.*/ 923: 924: #if _USE_STORE_STATUS && _USE_EXT_PROC // 26.09.21: Juergen 925: #define MobaLedLib_Create(leds) MobaLedLib_CreateEx(leds, NULL, NULL) 926: #define MobaLedLib_CreateEx(leds, callback, processor) uint8_t Config_RAM[__COUNTER__/2]; /* RAM used for the configuration functions. The size is calculated in the macros which are used in the Config[] table.*/ \ 927: MobaLedLib_C MobaLedLib(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), callback, processor); // MobaLedLib_C class definition 928: #define MobaLedLibPtr_Create(leds) MobaLedLib_CreatePtrEx(leds, NULL, NULL) 929: #define MobaLedLibPtr_CreateEx(leds, callback, processor) \ 930: pMobaLedLib = new MobaLedLib_C(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), callback, processor); // MobaLedLib_C class definition 931: #elif _USE_STORE_STATUS 932: #define MobaLedLib_Create(leds) MobaLedLib_CreateEx(leds, NULL) 933: #define MobaLedLib_CreateEx(leds, callback) uint8_t Config_RAM[__COUNTER__/2]; /* RAM used for the configuration functions. The size is calculated in the macros which are used in the Config[] table.*/ \ 934: MobaLedLib_C MobaLedLib(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), callback); // MobaLedLib_C class definition 935: #define MobaLedLibPtr_Create(leds) MobaLedLib_CreatePtrEx(leds, NULL) 936: #define MobaLedLibPtr_CreateEx(leds, callback) \ 937: pMobaLedLib = new MobaLedLib_C(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), callback); // MobaLedLib_C class definition 938: #elif _USE_EXT_PROC 939: #define MobaLedLib_Create(leds) MobaLedLib_CreateEx(leds, NULL) 940: #define MobaLedLib_CreateEx(leds, processor) uint8_t Config_RAM[__COUNTER__/2]; /* RAM used for the configuration functions. The size is calculated in the macros which are used in the Config[] table.*/ \ 941: MobaLedLib_C MobaLedLib(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), processor); // MobaLedLib_C class definition 942: #define MobaLedLibPtr_Create(leds) MobaLedLib_CreatePtrEx(leds, NULL) 943: #define MobaLedLibPtr_CreateEx(leds, processor) \ 944: pMobaLedLib = new MobaLedLib_C(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM), processor); // MobaLedLib_C class definition 945: #else 946: #define MobaLedLib_Create(leds) uint8_t Config_RAM[__COUNTER__/2]; /* RAM used for the configuration functions. The size is calculated in the macros which are used in the Config[] table.*/ \ 947: MobaLedLib_C MobaLedLib(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM)); // MobaLedLib_C class definition 948: #define MobaLedLibPtr_Create(leds) \ 949: pMobaLedLib = new MobaLedLib_C(leds, sizeof(leds)/sizeof(CRGB), Config, Config_RAM, sizeof(Config_RAM)); /* MobaLedLib_C class definition */ \ 950: MobaLedLib_C& MobaLedLib = *pMobaLedLib; 951: #endif 952: 953: #if _USE_USE_GLOBALVAR 954: #define MobaLedLib_Assigne_GlobalVar(GlobalVar) MobaLedLib.Assigne_GlobalVar(GlobalVar, (uint8_t)(sizeof(GlobalVar)/sizeof(ControlVar_t))) 955: #endif 956: 957: #define _ConvChannelNr2Byte(ChannelNr) (ChannelNr%4 == 0 ? (ChannelNr)/4 : 512 + (ChannelNr)/4) // Generates a warning if the channel number can not be divided by 4 958: 959: // Attention: The function writes 8*ByteCnt input channels !!! 960: #define MobaLedLib_Copy_to_InpStruct(Src, ByteCnt, ChannelNr) \ 961: MobaLedLib.Copy_Bits_to_InpStructArray(Src, ByteCnt, _ConvChannelNr2Byte(ChannelNr)) // Attention: Channel number must be divisible by 4 962: 963: // Die Cx Konstanten bestehen aus: 964: // - LedCnt (1..3), StCh (0..2) 965: #define _Cx(LedCnt, StCh) (LedCnt + (StCh<<2)) 966: #define C1 _Cx(1, 0) 967: #define C2 _Cx(1, 1) 968: #define C3 _Cx(1, 2) 969: #define C12 _Cx(2, 0) 970: #define C23 _Cx(2, 1) 971: #define C_ALL _Cx(3, 0) 972: #define C_RED C1 973: #define C_GREEN C2 974: #define C_BLUE C3 975: #define C_WHITE C_ALL 976: #define C_YELLOW C12 977: #define C_CYAN C23 978: 979: #define _Cx2LedCnt(Cx) ((Cx)&0x03) 980: #define _Cx2StCh(Cx) (((Cx)>>2)&0x03) 981: 982: // FreeBits ist abhaengig vom Muster: 983: // - Andreaskr. 2 LEDs 0 01101001 Typ:0 984: // - Const, 1 LED 7 .......1 Typ:1 985: // - Const, 2 LEDs 6 ......11 986: // - Const, 3 LEDs 5 .....111 987: // - Blinker, 1 LED 6 ......01 Typ:2 988: // - Blinker, 2 LEDs 4 ....0011 989: // - Blinker, 3 LEDs 2 ..000111 990: // - DoublFlash, 1 LED 4 ....0101 Typ:4 991: // - DoublFlash, 2 LEDs 0 00110011 992: // - DoublFlash, 3 LEDs 4 ....0001 11000111 <= Geht nicht mit dem gleichen Makro -> LeuchtfeuerALL 993: #define _FreeBits(LedCnt, Typ) ((Typ<=2?(8-(LedCnt)*Typ):((LedCnt)==2?0:4))&0x07) 994: 995: // NStru contains the Start Channel:0-2 (Bits 0,1), the Bits per Channel-1: 1-8 (Bits 2..4) and the Number of free Bits: 0-7 (Bits 5..7) 996: // Picture NNNBBBSS 997: #define _NStru(cx, Typ, BpC) (_Cx2StCh(cx) + ((BpC-1)<<2) + (_FreeBits(_Cx2LedCnt(cx), Typ)<<5)) 998: 999: // The BlueLight and the Leuchtfeuer macros can't be used with C_ALL because in this case 1000: // the two byte pattern B11000111, 0b00000001 is needed. I don't know how to generate this 1001: // with the macro PAT_DBLFL. Therefore the following strange number is used which is printed 1002: // as a warning. Maybe this helps to find this comment ... 1003: #define _C_ALL_not_supported 33877u // Generates the warning "narrowing conversion of '33877u' from 'unsigned int' to ..." 1004: 1005: 1006: #define _PAT_BLINK(LedCnt) ((LedCnt)==1?0b00000001: ((LedCnt)==2?0b00000011:0b00000111)) 1007: #define _PAT_DBLFL(LedCnt) ((LedCnt)==1?0b00000101: ((LedCnt)==2?0b00110011:_C_ALL_not_supported)) // Doesn't work with C_ALL ;-( because in this case we need 2 parameters: B11000111, B00000001 1008: 1009: #define _Cx2P_BLINK(Cx) (_PAT_BLINK(_Cx2LedCnt(Cx))) 1010: #define _Cx2P_DBLFL(Cx) (_PAT_DBLFL(_Cx2LedCnt(Cx))) 1011: 1012: 1013: // Constants for the Button period and the times in the pattern function 1014: #define Min *60000L // min in lowercase is not possible because of the standard min macro 1015: #define Sec *1000L 1016: #define Sek Sec 1017: #define sek Sec 1018: #define sec Sec 1019: #define Ms 1020: #define ms 1021: 1022: #define PM_NORMAL 0 // Normal mode (Als Platzhalter in Excel) 1023: #define PM_SEQUENZ_W_RESTART 1 // Rising edge-triggered unique sequence. A new edge starts with state 0. 1024: #define PM_SEQUENZ_W_ABORT 2 // Rising edge-triggered unique sequence. Abort the sequence if new edge is detected during run time. 1025: #define PM_SEQUENZ_NO_RESTART 3 // Rising edge-triggered unique sequence. No restart if new edge is detected 1026: #define PM_SEQUENZ_STOP 4 // Rising edge-triggered unique sequence. A new edge starts with state 0. If input is turned off the sequence is stopped immediately. 1027: #define PM_PINGPONG 5 // Change the direction at the end: 118 bytes 1028: #define PM_HSV 6 // Use HSV values instead of RGB for the channels 1029: #define PM_RES 7 // Reserved mode 1030: #define PM_MODE_MASK 0x07 // Defines the number of bits used for the modes (currently 3 => Modes 0..7) 1031: 1032: #define PM_SEQUENCE_W_RESTART 1 // To be able to use the correct spelling also 07.10.21: 1033: #define PM_SEQUENCE_W_ABORT 2 1034: #define PM_SEQUENCE_NO_RESTART 3 1035: #define PM_SEQUENCE_STOP 4 1036: 1037: // Flags for the Pattern function 1038: #define _PF_XFADE 0x08 // Special fade mode which starts from the actual brightness value instead of the value of the previous state 1039: #define PF_NO_SWITCH_OFF 0x10 // Don't switch of the LEDs if the input is turned off. Useful if several effects use the same LEDs alternated by the input switch. 1040: #define PF_EASEINOUT 0x20 // Easing function (Uebergangsfunktion) is used because changes near 0 and 255 are noticed different than in the middle 1041: #define PF_SLOW 0x40 // Slow timer (divided by 16) to be able to use longer durations 1042: #define PF_INVERT_INP 0x80 // Invert the input switch => Effect is active if the input is 0 1043: 1044: // Flags and modes for the Random() and RandMux() function 1045: #define RM_NORMAL 0b00000000 1046: #define RF_SLOW 0b00000001 // Time base is divided by 16 This Flag is set automatically if the time is > 65535 ms 1047: #define RF_SEQ 0b00000010 // Switch the outputs of the RandMux() function sequential and not random 1048: #define RF_STAY_ON 0b00000100 // Flag for the Ranom() function. The Output stays on until the input is turned off. MinOn, MaxOn define how long it stays on. 1049: // 12.01.20: For some reasons RF_STAY_ON was equal RF_SEQ 1050: #define RF_NOT_SAME 0b00001000 // Prevent, that the same output is used two times in sequence // 13.01.20: 1051: 1052: // Flags for the Counter() function 1053: #define CM_NORMAL 0 // Normal Counter mode 1054: #define CF_INV_INPUT 0b00000001 // Invert Input 1055: #define CF_INV_ENABLE 0b00000010 // Input Enable 1056: #define CF_BINARY 0b00000100 // Maximal 8 outputs 1057: #define CF_RESET_LONG 0b00001000 // Taste Lang = Reset 1058: #define CF_UP_DOWN 0b00010000 // Ein RS-FlipFlop kann mit CM_UP_DOWN ohne CF_ROTATE gemacht werden 1059: #define CF_ROTATE 0b00100000 // Faengt am Ende wieder von vorne an 1060: #define CF_PINGPONG 0b01000000 // Wechselt am Ende die Richtung 1061: #define CF_SKIP0 0b10000000 // Ueberspringt die 0. Die 0 kommt nur bei einem Timeout oder wenn die Taste lange gerueckt wird 1062: #define CF_RANDOM (0b00000001<<8) // Generate random numbers // 07.11.18: 1063: #define CF_LOCAL_VAR (0b00000010<<8) // Write the result to a local variable which must be created with New_Local_Var() prior 1064: #define _CF_NO_LEDOUTP (0b00000100<<8) // Disable the LED output (the first DestVar contains the maximal counts-1 (counter => 0 .. n-1) ) 1065: #define CF_ONLY_LOCALVAR (CF_LOCAL_VAR|_CF_NO_LEDOUTP) // Don't write to the LEDs defined with DestVar. The first DestVar contains the number maximal number of the counter-1 (counter => 0 .. n-1). 1066: 1067: 1068: #define _CM_RS_FlipFlop1 (CF_BINARY|CF_UP_DOWN) // RS Flip Flop with one output (Edge triggered) 1069: #define _CM_T_FlipFlop1 (CF_BINARY|CF_INV_ENABLE|CF_ROTATE) // T Flip Flop with one output 1070: #define _CM_RS_FlipFlop2 (CF_UP_DOWN) // RS Flip Flop with two outputs (Edge triggered) 1071: #define _CM_T_FlipFlopEnable2 (CF_ROTATE) // T Flip Flop with two outputs and enable 1072: #define _CM_T_FlipFlopReset2 (CF_ROTATE | CF_INV_ENABLE) // T Flip Flop with two outputs and reset 1073: 1074: #define _CF_ROT_SKIP0 (CF_ROTATE | CF_SKIP0) // Rotate and Skip 0 1075: #define _CF_P_P_SKIP0 (CF_PINGPONG | CF_SKIP0) 1076: 1077: 1078: 1079: // Constants for the rooms in the HOUSE_T 1080: #define ROOM_DARK 0 // Dark light 1081: #define ROOM_BRIGHT 1 // Bright light 1082: #define ROOM_WARM_W 2 // Warm white light 1083: #define ROOM_RED 3 // Red light 1084: #define ROOM_D_RED 4 // Dark Red light 1085: #define ROOM_COL0 5 // Room with user defined color 0 1086: #define ROOM_COL1 6 // Room with user defined color 1 1087: #define ROOM_COL2 7 // Room with user defined color 2 1088: #define ROOM_COL3 8 // Room with user defined color 3 1089: #define ROOM_COL4 9 // Room with user defined color 4 1090: #define ROOM_COL5 10 // Room with user defined color 5 1091: #define ROOM_COL345 11 // Room with user defined color 3, 4 or 5 which is randomly activated 1092: #define FIRE (12 +RAM1) // Chimney fire (RAM is used to store the Heat_p) 1093: #define FIRED (13 +RAM1) // Dark chimney " 1094: #define FIREB (14 +RAM1) // Bright chimney " 1095: // Reserved don't remove 15 1096: #define ROOM_CHIMNEY (16 +RAM1) // With chimney fire or Light (RAM is used to store the Heat_p for the chimney) 1097: #define ROOM_CHIMNEYD (17 +RAM1) // With dark chimney fire or Light " 1098: #define ROOM_CHIMNEYB (18 +RAM1) // With bright chimney fire or Light " 1099: #define ROOM_TV0 19 // With TV channel 0 or Light 1100: #define ROOM_TV0_CHIMNEY (20 +RAM1) // With TV channel 0 and fire or Light 1101: #define ROOM_TV0_CHIMNEYD (21 +RAM1) // With TV channel 0 and fire or Light 1102: #define ROOM_TV0_CHIMNEYB (22 +RAM1) // With TV channel 0 and fire or Light 1103: #define ROOM_TV1 23 // With TV channel 1 or Light 1104: #define ROOM_TV1_CHIMNEY (24 +RAM1) // With TV channel 1 and fire or Light 1105: #define ROOM_TV1_CHIMNEYD (25 +RAM1) // With TV channel 1 and fire or Light 1106: #define ROOM_TV1_CHIMNEYB (26 +RAM1) // With TV channel 1 and fire or Light 1107: #define GAS_LIGHT 27 // Gas light using all channels (RGB) ATTENTION: First GAS lights are bright (Don't mix them up) 1108: #define GAS_LIGHT1 28 // Gas light using one channel (R) 1109: #define GAS_LIGHT2 29 // Gas light using one channel (G) 1110: #define GAS_LIGHT3 30 // Gas light using one channel (B) 1111: #define GAS_LIGHTD 31 // Dark gas light using all channels (RGB) ATTENTION: Following GAS lights are dark (Don't mix them up) 1112: #define GAS_LIGHT1D 32 // Dark gas light using one channel (R) 1113: #define GAS_LIGHT2D 33 // Dark gas light using one channel (G) 1114: #define GAS_LIGHT3D 34 // Dark gas light using one channel (B) 1115: #define NEON_LIGHT 35 // Neon light using all channels 1116: #define NEON_LIGHT1 36 // Neon light using one channel (R) 1117: #define NEON_LIGHT2 37 // Neon light using one channel (G) 1118: #define NEON_LIGHT3 38 // Neon light using one channel (B) 1119: #define NEON_LIGHTD 39 // Dark Neon light using all channels 1120: #define NEON_LIGHT1D 40 // Dark Neon light using one channel (R) 1121: #define NEON_LIGHT2D 41 // Dark Neon light using one channel (G) 1122: #define NEON_LIGHT3D 42 // Dark Neon light using one channel (B) 1123: #define NEON_LIGHTM 43 // Medium Neon light using all channels 1124: #define NEON_LIGHT1M 44 // Medium Neon light using one channel (R) 1125: #define NEON_LIGHT2M 45 // Medium Neon light using one channel (G) 1126: #define NEON_LIGHT3M 46 // Medium Neon light using one channel (B) 1127: #define NEON_LIGHTL 47 // Large room Neon light using all channels. A large room is equipped with several neon lights which start delayed 1128: #define NEON_LIGHT1L 48 // Large room Neon light using one channel (R) 1129: #define NEON_LIGHT2L 49 // Large room Neon light using one channel (G) 1130: #define NEON_LIGHT3L 50 // Large room Neon light using one channel (B) 1131: #define NEON_DEF_D 51 // Decective Neon light using all channels. 1132: #define NEON_DEF1D 52 // Decective Neon light using one channel (R) 1133: #define NEON_DEF2D 53 // Decective Neon light using one channel (G) 1134: #define NEON_DEF3D 54 // Decective Neon light using one channel (B) 1135: #define SINGLE_LED1 55 // Single LED connected with a WS2811 module to channel (R) // 06.09.19: 1136: #define SINGLE_LED2 56 // Single LED connected with a WS2811 module to channel (G) 1137: #define SINGLE_LED3 57 // Single LED connected with a WS2811 module to channel (B) 1138: #define SINGLE_LED1D 58 // Single dark LED connected with a WS2811 module to channel (R) 1139: #define SINGLE_LED2D 59 // Single dark LED connected with a WS2811 module to channel (G) 1140: #define SINGLE_LED3D 60 // Single dark LED connected with a WS2811 module to channel (B) // 06.09.19: End of new block 1141: #define SKIP_ROOM 61 // Room which is not controlled with by the house() function (Usefull for Shops in a house becaue this lights are always on at night) 1142: #define CANDLE (62+RAM1) // RGB Candle // 09.06.20: 1143: #define CANDLE1 63 // Single Candle LED connected with a WS2811 module to channel (R) 1144: #define CANDLE2 64 // Single Candle LED connected with a WS2811 module to channel (G) 1145: #define CANDLE3 65 // Single Candle LED connected with a WS2811 module to channel (B) 1146: 1147: #if ((FIRE & 0x03) != 0) || ((FIRED & 0x03) != 1) || ((FIREB & 0x03) != 2) || \ 1148: ((ROOM_CHIMNEY & 0x03) != 0) || ((ROOM_CHIMNEYD & 0x03) != 1) || ((ROOM_CHIMNEYB & 0x03) != 2) || \ 1149: ((ROOM_TV0_CHIMNEY & 0x03) != 0) || ((ROOM_TV0_CHIMNEYD & 0x03) != 1) || ((ROOM_TV0_CHIMNEYB & 0x03) != 2) || \ 1150: ((ROOM_TV1_CHIMNEY & 0x03) != 0) || ((ROOM_TV1_CHIMNEYD & 0x03) != 1) || ((ROOM_TV1_CHIMNEYB & 0x03) != 2) 1151: #warning Wrong number for ROOM_CHIMNEY, ... Last two bits are used in Update_TV_or_Chimney() 1152: #endif 1153: 1154: 1155: 1156: // Spezial Inputs 1157: #define SI_Enable_Sound 253 // Wird auf 1 initialisiert, kann aber vom der Konfigurarion veraendert werden 1158: #define SI_LocalVar SI_0 // Input fuer Pattern Funktion zum einlesen der Localen Variable. Diese Nummer wird verwendet weil eine Konstante 0 als Eingang keinen Sinn macht 1159: #define SI_0 254 // Immer 0 1160: #define SI_1 255 // Immer 1 1161: 1162: /* 1163: Weitere Special Inputs: ?? 1164: SI_Status_OK // Alles O.K. 1165: SI_Status_LED_Mis // Weniger LEDs erkannt als vorgegeben 1166: SI_Status_Add_LED // Mehr LEDs erkannt als vorgegeben 1167: SI_Status_CAN_OK // CAN DAten vorhanden 1168: SI_Sunrise // 1169: SI_Sunset 1170: SI_Day 1171: SI_Night 1172: */ 1173: 1174: // Constants for the Logic() function 1175: #define _OR_NR SI_0 // Number which can't be used as input channel for the logic function ( A & false is always false) 1176: #define _NOT_NR SI_1 // " " " 1177: #define OR ,_OR_NR, 1178: #define NOT _NOT_NR, 1179: #define AND , 1180: #define ENABLE _OR_NR, // Used to define an enable input. This keyword must be used at the first position in the variable argument list. An OR at this position dosn't make sence => we could use the same numner 1181: #define DISABLE _OR_NR, NOT 1182: 1183: // 'or', 'and', ... is not possible because they are used in c++ 1184: // A macro EQ:',' is not possible because then it can't be checked in the macro 1185: 1186: // Bit masks for Special SpInp[] 1187: #define _BIT_OLD 0b00000010 1188: #define _BIT_NEW 0b00000001 1189: #define _NEW_AND_OLD (_BIT_NEW + _BIT_OLD) 1190: 1191: #define _ALL_OLD_BITS 0b10101010 1192: #define _ALL_NEW_BITS 0b01010101 1193: 1194: // Results generated by Get_Input() 1195: #define INP_OFF 0b00000000 1196: #define INP_ON 0b00000011 1197: #define INP_TURNED_ON 0b00000001 1198: #define INP_TURNED_OFF 0b00000010 1199: #define INP_INIT_OFF 0b00000110 1200: 1201: 1202: 1203: //--------------------------------------------- 1204: inline bool Inp_Changed_or_InitOff(uint8_t Inp) 1205: //--------------------------------------------- 1206: { 1207: return Inp == INP_TURNED_ON || Inp == INP_TURNED_OFF || Inp == INP_INIT_OFF; 1208: } 1209: // Optimierungsuntersuchung: 1210: // Inp_Changed_or_InitOff(): 1211: // - Wenn man nur den ersten Vergleich (Inp == INP_TURNED_ON) aktiviert, dann dauert 1212: // der Update 189us anstelle von 193us bei einer Konfiguration mit 13 Pattern aufrufen 1213: // und einer Logic() Funktion. => 2% schneller. 1214: // - Ohne die (Inp == INP_INIT_OFF) Abfrage dauert es 190us => 1.5% schneller. 1215: 1216: //------------------------------------ 1217: inline uint8_t Invert_Inp(uint8_t Inp) 1218: //------------------------------------ 1219: { 1220: return Inp ^ 0b00000011; // XOR: 00 => 11, 01 => 10, 10 => 01, 11 => 00 1221: } 1222: 1223: //-------------------------------- 1224: inline bool Inp_Is_On(uint8_t Inp) 1225: //-------------------------------- 1226: { 1227: return Inp == INP_ON || Inp == INP_TURNED_ON; //Inp & _BIT_NEW; 1228: } 1229: 1230: //-------------------------------------------------- 1231: inline bool Inp_Is_TurnedOff_or_InitOff(uint8_t Inp) 1232: //-------------------------------------------------- 1233: { 1234: return Inp == INP_TURNED_OFF || Inp == INP_INIT_OFF ; 1235: } 1236: 1237: //---------------------------------- 1238: inline bool Inp_Changed(uint8_t Inp) 1239: //---------------------------------- 1240: { 1241: return Inp == INP_TURNED_ON || Inp == INP_TURNED_OFF; 1242: } 1243: 1244: 1245: #define _TV_CHANNELS 2 // If changed adapt also the constants ROOM_TV0, COLOR_TV0_A... and the corrosponding switch case statements 1246: 1247: 1248: 1249: #ifdef _USE_LOCAL_TX 1250: #define CALCULATE_t4w uint16_t t4w = (t>>4) & 0xFFFF; // Time divided by 16 1251: #define CALCULATE_t4 uint8_t t4 = (t>>4) & 0xFF; // Time divided by 16 1252: #define CALCULATE_t10 uint8_t t10 = (t>>10) & 0xFF; // Time divided by 1024 1253: #else 1254: #define CALCULATE_t4w 1255: #define CALCULATE_t4 1256: #define CALCULATE_t10 1257: #endif 1258: 1259: #define ALL_CHANNELS 4 // For RawNr. Is used with "& 0x03" to select channel 0 1260: 1261: 1262: #define TM_DISABLED 0 1263: #define TM_LED_TEST 1 // Don't change the sequence because its needed for TestName[3][4] 1264: #define TM_INP_TEST 2 1265: #define TM_BUT_TEST 3 // Reserved mode, currently no function (If the line is enabled the mode could be selected with the middle key) 1266: 1267: 1268: extern uint8_t Darkness; 1269: extern DayState_E DayState; 1270: 1271: extern uint8_t TestMode; 1272: 1273: #define ROOM_COL_CNT 17 // Number of user defined colors for the room lights (Attention: If changed the program has to be adapted at several positions) 06.09.19: Old 15 1274: 1275: #define COLOR0 0 1276: #define COLOR1 1 1277: #define COLOR2 2 1278: #define COLOR3 3 1279: #define COLOR4 4 1280: #define COLOR5 5 1281: #define COLOR_GASL_D 6 1282: #define COLOR_GASL_B 7 1283: #define COLOR_NEON_D 8 1284: #define COLOR_NEON_M 9 1285: #define COLOR_NEON_B 10 1286: #define COLOR_TV0_A 11 1287: #define COLOR_TV0_B 12 1288: #define COLOR_TV1_A 13 1289: #define COLOR_TV1_B 14 1290: #define COLOR_SINGLE 15 // 06.09.19: 1291: #define COLOR_SINGLE_D 16 // " 1292: 1293: #if _USE_STORE_STATUS // 19.05.20: Juergen 1294: typedef void(*Callback_t) (uint8_t CallbackType, uint8_t ValueId, uint8_t OldValue, uint8_t* NewValue); 1295: #endif 1296: #if _USE_EXT_PROC // 19.05.20: Juergen 1297: typedef uint8_t(*ExtProc_t) (uint8_t Type, const uint8_t* progmemAddress, bool process); 1298: #endif 1299: 1300: //::::::::::::::::::: 1301: class MobaLedLib_C 1302: //::::::::::::::::::: 1303: { 1304: public: 1305: 1306: #if _USE_STORE_STATUS // 19.05.20: Juergen 1307: #if _USE_EXT_PROC // 19.05.20: Juergen 1308: MobaLedLib_C(struct CRGB* _leds, uint16_t Num_Leds, const uint8_t Config[], uint8_t RAM[], uint16_t RamSize, Callback_t Function, ExtProc_t Processor); // Konstruktor mit 2xcallback 1309: #else 1310: MobaLedLib_C(struct CRGB* _leds, uint16_t Num_Leds, const uint8_t Config[], uint8_t RAM[], uint16_t RamSize, Callback_t Function); // Konstruktor mit callback 1311: #endif 1312: #else 1313: #if _USE_EXT_PROC // 19.05.20: Juergen 1314: MobaLedLib_C(struct CRGB* _leds, uint16_t Num_Leds, const uint8_t Config[], uint8_t RAM[], uint16_t RamSize, ExtProc_t Processor); // Konstruktor mit callback 1315: #else 1316: MobaLedLib_C(struct CRGB* _leds, uint16_t Num_Leds, const uint8_t Config[], uint8_t RAM[], uint16_t RamSize); // Konstruktor OHNE callback 1317: #endif 1318: #endif 1319: #if _USE_USE_GLOBALVAR 1320: void Assigne_GlobalVar(ControlVar_t *GlobalVar, uint8_t GlobalVar_Cnt); 1321: #endif 1322: void Update(); 1323: void Set_Input(uint8_t channel, uint8_t On); 1324: int8_t Get_Input(uint8_t channel); 1325: void Copy_Bits_to_InpStructArray(uint8_t *Src, uint8_t ByteCnt, uint8_t InpStructArrayNr); 1326: void Print_Config(); // FLASH usage ~4258 Byte RAM 175 (16.12.18), #define _PRINT_DEBUG_MESSAGES must be enabled in "Lib_Config.h" 1327: 1328: public: // Variables 1329: uint8_t Trigger20fps; // <> 0 every 50 ms for one cycle // 1 Byte 1330: CRGB* leds; // 2 Byte // 23.05.23: Moved to public from private to be able to acces it from the MML extention 1331: uint16_t Num_Leds; // 2 Byte // " 1332: 1333: private: // Variables 1334: const uint8_t *cp; // Pointer to the Config[] // 2 Byte 1335: const uint8_t *Config; // 2 Byte 1336: bool Initialize; // 1 Byte 1337: uint8_t *RAM; // 2 Byte 1338: uint8_t Last_20; // Last time for the 20fps flag // 1 Byte 1339: uint8_t TriggerCnt; // 1 Byte 1340: uint8_t *rp; // Pointer to the RAM // 2 Byte 1341: uint32_t t; // actual time [ms] // 4 Byte 1342: #ifndef _USE_LOCAL_TX 1343: uint16_t t4w; // time>>4 = / 16 // 2 Byte 1344: uint8_t t10; // time>>10 = / 1024 // 1 Byte 1345: #endif 1346: TV_Dat_T TV_Dat[_TV_CHANNELS]; // 10 Byte 1347: uint8_t InpStructArray[_INP_STRUCT_ARRAY_SIZE]; // 64 Byte Array which contains two bits for each input. One bit for the actual state and a second for the new state. (See INP_TURNED_ON) 1348: HSV_T *HSV_p; // 2 Byte 1349: ControlVar_t *ActualVar_p; // 2 Byte // 07.11.18: 1350: #if _USE_USE_GLOBALVAR 1351: ControlVar_t *GlobalVar; // 2 Byte 1352: #endif 1353: ControlVar_t TempVar; // 2 Byte 1354: uint8_t GlobalVar_Cnt; // 1 Byte 1355: Sound_Dat_t *Sound_Dat; // 2 Byte 1356: #if _USE_STORE_STATUS // 01.05.20: 1357: Callback_t CallbackFunc; // 4 Byte 1358: uint8_t ProcCounterId; // 1 Byte 1359: #endif 1360: #if _USE_EXT_PROC // 26.09.21: Jürgen 1361: ExtProc_t CommandProcessorFunc; // 4 Byte 1362: #endif 1363: // 47 Byte RoomCol[] 1364: // ------- 1365: //154 Byte + 5 StoreStatus + 4 ExtProc 1366: 1367: #if _USE_DEF_NEON // 12.01.20: 1368: uint8_t Rand_On_DefNeon; // probability that the neon light starts. 0 = don't start, 1 start seldom, 255 = Start immediately 1369: uint8_t RandOff_DefNeon; // probability that the light goes off after a while. 0 = Always on, 1 = shot flash, 255 = very long time active 1370: uint8_t Min_DefNeon; // red glow of the starter. 1 = minimal value, 5 = maximal value 1371: #endif 1372: 1373: 1374: // Private functions 1375: uint8_t *Get_LEDPtr(uint8_t &cnt); 1376: uint8_t Is_Room_On(CRGB *lp, uint8_t RawNr); 1377: void Update_TV_or_Chimney(uint8_t TVNr, CRGB *lp, uint8_t Room_Typ); 1378: uint8_t Get_RawNr(uint8_t Room_Typ); 1379: void Update_Gas_Light( uint8_t Room_Typ, CRGB *lp); 1380: void Update_Neon_Light(uint8_t Room_Typ, CRGB *lp); 1381: void Update_Candle(uint8_t Room_Typ, CRGB *lp); // 10.06.20: 1382: void Proc_Set_CandleTab(); 1383: void TurnOnRoom(CRGB* lp, uint8_t Room_Typ); 1384: void TurnOffRoom(CRGB* lp, uint8_t RawNr, uint8_t Room_Typ); 1385: void Set_Default_TV_Dat_p(); // 09.01.20: 1386: void Update_TV_Data(); 1387: void Random_Const_Light(CRGB *lp, uint8_t TVNr); 1388: void Enable_Light_or_TV(CRGB *lp, uint8_t TVNr); 1389: void Enable_Chimney(CRGB *lp); 1390: void Enable_Light_or_Chimney(CRGB *lp); 1391: void Enable_Light_TV_or_Chimney(CRGB *lp, uint8_t TVNr); 1392: void Set_Timer4Random(uint16_t Timer, TimerData16_T *dp, uint8_t P_MinTime); 1393: void Set_Dest_RandMux(uint8_t Act, uint8_t Mode); 1394: void Inp_Processed(); 1395: void CalcSwitchVal(Schedule_T *dp); 1396: uint8_t Is_Pattern(uint8_t Type); 1397: void Print_Comment(uint8_t Type); 1398: void Int_Update(uint32_t Time); 1399: void Inc_cp(uint8_t Type); 1400: uint8_t Find_Next_Priv_InpChannel(uint8_t Channel, int8_t Direction); 1401: 1402: 1403: // Test_buttons 1404: void Setup_Test_Buttons(); 1405: void Set_one_Test_Outp(uint8_t Nr, CRGB* &p); 1406: void Set_Test_Outp(uint8_t &Ch); 1407: void Speed_Test(); 1408: void Proc_Key_Test(uint8_t key); 1409: void Proc_Test_Buttons(); 1410: 1411: // Proc functions called in Update 1412: void Proc_Const(); 1413: void Proc_AnalogPattern(uint8_t TimeCnt, bool AnalogMode); 1414: void Proc_House(); 1415: void Proc_Fire(); 1416: #ifdef _NEW_ROOM_COL 1417: void Proc_Set_ColTab(); 1418: #endif 1419: void Proc_Set_TV_Tab(); // 09.01.20: 1420: void Proc_Set_Def_Neon(); // 12.01.20: 1421: void Proc_Logic(); 1422: void Proc_New_HSV_Group(); 1423: void Proc_New_Local_Var(); // 07.11.18: 1424: void Proc_Use_GlobalVar(); 1425: #if _USE_INCH_TRIGGER // 02.06.20: New trigger method from Juergen 1426: void Proc_InCh_to_X_Var(); // 07.05.20: Added Start // 31.05.20 J:remove start 1427: void Proc_Bin_InCh_to_TmpVar(); // 07.05.20: Added Start // 31.05.20 J:remove start 1428: #else 1429: void Proc_InCh_to_TmpVar(uint8_t Start); // 07.05.20: Added Start 1430: void Proc_Bin_InCh_to_TmpVar(uint8_t Start); // 07.05.20: Added Start 1431: #endif 1432: void Proc_Random(); 1433: void Proc_RandMux(); 1434: void Proc_Welding(uint8_t withbreaks); 1435: void Proc_CopyLED(); 1436: void Proc_Schedule(); 1437: void Proc_Counter(); 1438: 1439: void IncCP_House(); 1440: void IncCP_Const() { cp += 5 + ADD_WORD_OFFSET; } 1441: void IncCP_Fire() { cp += 4 + ADD_WORD_OFFSET; } 1442: #ifdef _NEW_ROOM_COL 1443: void IncCP_Set_ColTab() { cp += ROOM_COL_CNT*3; } 1444: bool Cmp_Room_Col(CRGB *lp, uint8_t ColorNr); 1445: uint8_t Get_Room_Col1(uint8_t ColorNr, uint8_t Channel); 1446: void Copy_Room_Col(CRGB *Dst, uint8_t ColorNr); 1447: void Copy_Single_Room_Col(CRGB *Dst, uint8_t Channel, uint8_t ColorNr); // 06.09.19: 1448: #endif 1449: #if _USE_CANDLE // 10.06.20: 1450: void IncCP_Set_CandleTab() { cp += sizeof(Candle_Dat_T); } 1451: #endif 1452: void IncCP_Set_TV_Tab(); // 10.01.20: 1453: void IncCP_Set_Def_Neon(); // 12.01.20: 1454: void IncCP_Pattern(uint8_t TimeCnt); 1455: void IncCP_Logic(); 1456: void IncCP_New_HSV_Group() { } 1457: void IncCP_New_Local_Var() { } // 07.11.18: 1458: void IncCP_Use_GlobalVar() { cp++; } 1459: void IncCP_InCh_to_X_Var() { cp+=2; } // 25.11.18: 1460: void IncCP_Random() { cp += EP_RANDOM_INCREMENT; } 1461: void IncCP_RandMux() { cp += EP_RANDMUX_INCREMENT; } 1462: void IncCP_Welding() { cp += EP_WELDING_INCREMENT; } 1463: void IncCP_CopyLED() { cp += EP_COPYLED_INCREMENT; } 1464: void IncCP_Schedule() { cp += EP_SCHEDULE_INCREMENT; } 1465: void IncCP_Counter(); 1466: 1467: uint8_t InpChannel_used(uint8_t Channel); 1468: bool Inp_is_Used_in_Logic(uint8_t Channel); 1469: 1470: #if _USE_STORE_STATUS // 01.05.20: 1471: void Do_Callback(uint8_t CallbackType, uint8_t ValueId, uint8_t OldValue, uint8_t *NewValue); // 19.05.20: Juergen 1472: #endif 1473: 1474: #ifdef _NEW_ROOM_COL 1475: const uint8_t *Room_ColP; 1476: #endif 1477: 1478: #if _USE_CANDLE // 10.06.20: 1479: const Candle_Dat_T *Candle_DatP; 1480: #endif 1481: 1482: #if _USE_SET_TVTAB // 09.01.20: 1483: const uint8_t *TV_Dat_p[_TV_CHANNELS]; 1484: #endif 1485: 1486: friend class MLLExtension; 1487: }; // class MobaLedLib_C 1488: 1489: 1490: 1491: #endif // _MOBALEDLIB_H_ 1492: 1493: 1494: