// This file contains the DCC and LED definitions.
//
// It was automatically generated by the program ProgGenerator Ver. 3.5.0C1      by Hardi
// File creation: 03/25/26 18:32:23
// (Attention: The display in the Arduino IDE is not updated if Options/External Editor is disabled)

#ifndef __LEDS_AUTOPROG_H__
#define __LEDS_AUTOPROG_H__

#ifndef CONFIG_ONLY
#ifndef ARDUINO_RASPBERRY_PI_PICO
#ifndef FASTLED_ESP32_I2S
#define FASTLED_INTERNAL       // Disable version number message in FastLED library (looks like an error)
#endif
#include <FastLED.h>           // The FastLED library must be installed in addition if you got the error message "..fatal error: FastLED.h: No such file or directory"
                               // Arduino IDE: Sketch / Include library / Manage libraries                    Deutsche IDE: Sketch / Bibliothek einbinden / Bibliothek verwalten
                               //              Type "FastLED" in the "Filter your search..." field                          "FastLED" in das "Grenzen Sie ihre Suche ein" Feld eingeben
                               //              Select the entry and click "Install"                                         Gefundenen Eintrag auswaehlen und "Install" anklicken
#else
#include <PicoFastLED.h>       // Juergens minimum version or FastLED for Raspberry Pico
#endif
#endif // CONFIG_ONLY

#include <MobaLedLib.h>

#define START_MSG "LEDs_AutoProg Ver 3: PICO 3.5.0C1 03.25.26 18:32"

#define TWO_BUTTONS_PER_ADDRESS 1      // Two buttons (Red/Green) are used (DCC/LNet/CAN)
#ifdef NUM_LEDS
  #warning "'NUM_LEDS' definition in the main program is replaced by the included 'LEDs_AutoProg.h' with 20"
  #undef NUM_LEDS
#endif

#define NUM_LEDS 20                    // Number of LEDs (Maximal 256 RGB LEDs could be used)

#define LEDS_PER_CHANNEL ",20"

#define USE_PROTOCOL_DCC

#define RECEIVE_LED_COLOR_PER_RS232

#define GEN_BUTTON_RELEASE
#define GEN_BUTTON_RELEASE_COM GEN_OFF
#define USE_EXT_ADDR
#define USE_RS232_OR_SPI_AS_INPUT      // Use the RS232 or SPI Input to read DCC/SX commands from the second Arduino and from the PC (The SPI is only used if enabled with USE_SPI_COM)
#define ADDR_OFFSET 0

#define ADDR_MSK  0x3FFF  // 14 Bits are used for the Address

#define S_ONOFF   (uint16_t)0
#define B_RED     (uint16_t)(1<<14)
#define B_GREEN   (uint16_t)(2<<14)
#define O_RET_MSG (uint16_t)(3<<14)    // Return messages (Rueckmelder)
#define B_TAST    B_RED


typedef struct
    {
    uint16_t AddrAndTyp; // Addr range: 0..16383. The upper two bytes are used for the type
    uint8_t  InCnt;
    } __attribute__ ((packed)) Ext_Addr_T;

// Definition of external adresses
#ifdef CONFIG_ONLY
const Ext_Addr_T Ext_Addr[] __attribute__ ((section (".MLLAddressConfig"))) =
#else
const PROGMEM Ext_Addr_T Ext_Addr[] =
#endif
         { // Addr & Typ    InCnt
           { 104  + B_RED,     1 },      // Excel row 13
           { 105  + S_ONOFF,   1 },      // test
         };


// Input channel defines for local inputs and expert users
#define INCH_DCC_104_RED        0      // Excel row 13
#define INCH_DCC_105_ONOFF      1      // test



#define TOTAL_SWITCHES_A  0                                        // Number of used inputs for analog keyboard
#define TOTAL_SWITCHES_B  0                                        // Number of used inputs for keyboard 1
#define TOTAL_SWITCHES_C  0                                        // Number of used inputs for keyboard 2
#define TOTAL_SWITCHES_D  0                                        // Number of used inputs for main board switches
#define TOTAL_VARIABLES   1                                        // Number of used variables
/*********************/
#define SETUP_FASTLED()                                                      \
/*********************/                                                      \
  CLEDController& controller0 = FastLED.addLeds<NEOPIXEL,  0>(leds+  0, 20); \
                                                                             \
  controller0.clearLeds(256);                                                \
  FastLED.setDither(DISABLE_DITHER);       // avoid sending slightly modified brightness values
/*End*/

// ----- dynamic extensions section begin -----
#define MLL_EXTENSIONS_ACTIVE
#include <MLLExtension.h>

// Extension ab!
#include <ab!.h>
// Extension HLMakro
#include <HLMakro.h>
// Extension HLMakro2
#include <HLMakro2.h>
// Extension HLtest
#include <HLtest.h>
// Extension HL_test
#include <HL_test.h>
// Extension HL_Test1
#include <HL_Test1.h>
// Extension HL_test7
#include <HL_test7.h>
// Extension HL_TestMacro
#include <HL_TestMacro.h>
// Extension HL_Testmacro2
#include <HL_Testmacro2.h>
// Extension HL_TestMacro_a
#include <HL_TestMacro_a.h>
// ----- dynamic Extensions section end -----


//*******************************************************************
// *** Configuration array which defines the behavior of the LEDs ***
MobaLedLib_Configuration()
  {
  RGB_Heartbeat(0)                                                                                            /* LED auf dem Mainboard                                                                                                                                                                       */
  // Activation: Binary #ServoAnim(2,0,500,20,220,2500,2500,0,0,0,0,1,1,0,0,1)                                /* Excel row 13                                                                                                                                                                                */
  Bin_InCh_to_TmpVar(0, 1)                                                                                    /*     "                                                                                                                                                                                       */
  #define ENABLE_STORE_STATUS()                                                                               /*     "                                                                                                                                                                                       */
  APatternT1(1,28,SI_LocalVar,1,0,128,0,PM_NORMAL,500,20,60,100,140,180,220,180,140,100,60,20  ,0,0,0,0,0,63,128,0,0,0,63) /*     "                                                                                                                                                                          */
  HL_TestMacro_a(2, SI_1, 1 Sek)                                                                              /* Excel row 14                                                                                                                                                                                */
  HL_TestMacro_a(3, SI_1, 2 Sek)                                                                              /* Excel row 15                                                                                                                                                                                */
  House(4, 1, 1, 2, ROOM_DARK, ROOM_BRIGHT, ROOM_WARM_W)                                                      /* test                                                                                                                                                                                        */

  EndCfg // End of the configuration
  };
//*******************************************************************

#ifndef COPYLED_OFF
#define COPYLED_OFF 0
#endif

#ifndef COPYLED_OFF_ONCE
#define COPYLED_OFF_ONCE 1
#endif

//---------------------------------------------
void Set_Start_Values(MobaLedLib_C &MobaLedLib)
//---------------------------------------------
{
}


// if function returns TRUE the calling loop stops
typedef bool(*HandleValue_t) (uint8_t CallbackType, uint8_t ValueId, uint8_t* Value, uint16_t EEPromAddr, uint8_t TargetValueId, uint8_t Options);


#define InCnt_MSK  0x003F  // 6 bits are used for the InCnt, 2 bits for the type ttcc cccc => Max InCnt=63
#define IS_COUNTER (uint8_t)0x80
#define IS_PULSE   (uint8_t)0x40
#define IS_TOGGLE  (uint8_t)0x00
#define COUNTER_ID

typedef struct
    {
    uint8_t TypAndInCnt; // Type bits 7 & 6, InCnt 0..5
    uint8_t Channel;
    } __attribute__ ((packed)) Store_Channel_T;

// Definition of channels and counters that need to store state in EEProm
const PROGMEM Store_Channel_T Store_Values[] =
         { // Mode + InCnt , Channel
           { IS_TOGGLE + 1 , INCH_DCC_105_ONOFF  },      // test
         };

#ifndef CONFIG_ONLY
// ----- dynamic extensions section begin -----
#include <MLLExtension.h>











// Extension P_ScheduleMLX
#include <P_ScheduleMLX.h>


// ----- dynamic Extensions section end -----

#endif // CONFIG_ONLY





#endif // __LEDS_AUTOPROG_H__
