// This file contains the DCC and LED definitions.
//
// It was automatically generated by the program Prog_Generator_MobaLedLib.xlsm Ver. 3.5.0D4      by Hardi
// File creation: 17.04.2026 16:11:07
// (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: ESP32 3.5.0D4 17.04.26 16:11"

#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 ",19,1"

#define USE_PROTOCOL_DCC

#define RECEIVE_LED_COLOR_PER_RS232

#define GEN_BUTTON_RELEASE
#define GEN_BUTTON_RELEASE_COM GEN_OFF
// Input channel defines for local inputs and expert users


//*** Digital switches ***

#define SwitchB1                0
#define SwitchB2                1
// Reserve channels: 6 because MobaLedLib_Copy_to_InpStruct always writes multiple of 8 channels

//*** Output Channels ***
#define START_VARIABLES   8                                        // Define the start number for the variables.
#define Test0                   8
#define Test1                   9


#define CTR_CHANNELS_1    2                                        // Number of used counter channels for keyboard 1. Up to 10 if one CD4017 is used, up to 18 if two CD4017 are used, ...
#define CTR_CHANNELS_2    0                                        // Number of used counter channels for keyboard 2. Up to 10 if one CD4017 is used, up to 18 if two CD4017 are used, ...
#define BUTTON_INP_LIST_1 34                                       // Comma separated list of the button input pins
#define BUTTON_INP_LIST_2 Unused                                   // Comma separated list of the button input pins
#define CLK_PIN           15                                       // Pin number used for the CD4017 clock
#define RESET_PIN         33                                       // Pin number used for the CD4017 reset

#ifndef CONFIG_ONLY
#include <Keys_4017.h>                                             // Keyboard library which uses the CD4017 counter to save Arduino pins. Attention: The pins (CLK_PIN, ...) must be defined prior.
#endif

#define START_SWITCHES_1  0                                        // Define the start number for the first keyboard.
#define START_SWITCHES_2  8                                        // Define the start number for the second keyboard.
#define START_SWITCHES_B  0                                        // Define the start number for the first keyboard.

#define START_SEND_INPUTS 0                                        // Start address of all switches/variables
#define TOTAL_SEND_INPUTS 10                                       // Number of used switches/variables
#define TOTAL_SWITCHES_A  0                                        // Number of used inputs for analog keyboard
#define TOTAL_SWITCHES_B  8                                        // 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   2                                        // Number of used variables
/*********************/
#define SETUP_FASTLED()                                                      \
/*********************/                                                      \
  CLEDController& controller0 = FastLED.addLeds<NEOPIXEL, 27>(leds+  0, 19); \
  CLEDController& controller1 = FastLED.addLeds<NEOPIXEL, 32>(leds+ 19,  1); \
                                                                             \
  controller0.clearLeds(256);                                                \
  controller1.clearLeds(256);                                                \
  FastLED.setDither(DISABLE_DITHER);       // avoid sending slightly modified brightness values
/*End*/

#define USE_ADDITIONAL_SETUP_PROC                                  // Activate the usage of the Additional_Setup_Proc()

//--------------------------
void Additional_Setup_Proc()
//--------------------------
{
#ifndef CONFIG_ONLY
  Keys_4017_Setup(); // Initialize the keyboard scanning process
#endif
}

/****************************/
#define Additional_Loop_Proc() \
/****************************/ \
{                              \
  MobaLedLib_Copy_to_InpStruct(Keys_Array_1, KEYS_ARRAY_BYTE_SIZE_1, START_SWITCHES_1);  \
}


//*******************************************************************
// *** Configuration array which defines the behavior of the LEDs ***
MobaLedLib_Configuration()
  {
  RGB_Heartbeat(0)                                                                                            /* Excel row 3                                                                                                                                                                                 */
  ConstRGB(1, Test0, 0, 0, 0, 0, 127, 0)                                                                      /* Excel row 5                                                                                                                                                                                 */
  PushButton_w_LED_BL_0_1(19, C1, SwitchB2, Test0, 1, 0, 1, 0, 30 Sek, 127, 31)                               /* Excel row 8                                                                                                                                                                                 */

  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)
//---------------------------------------------
{
}


// No macros used which are stored to the EEPROM => Disable the ENABLE_STORE_STATUS flag in case it was set in the excel sheet
#ifdef ENABLE_STORE_STATUS
  #undef ENABLE_STORE_STATUS
#endif

#ifndef CONFIG_ONLY
#endif // CONFIG_ONLY





#endif // __LEDS_AUTOPROG_H__
