<commit_before>#include "Atm_fade.h"

Atm_fade & Atm_fade::begin( int attached_pin )
{  
	const static state_t state_table[] PROGMEM = {
	/*               ON_ENTER    ON_LOOP       ON_EXIT  EVT_CNT_FADE EVT_TM_FADE   EVT_TM_ON  EVT_TM_OFF   EVT_CNT_RPT  EVT_ON EVT_OFF EVT_BLINK    ELSE  */
	/* IDLE   */      ACT_OFF, ATM_SLEEP,           -1,           -1,         -1,         -1,         -1,           -1,     ON,     -1,    START,     -1,  // LED off
	/* ON     */       ACT_ON, ATM_SLEEP,           -1,           -1,         -1,         -1,         -1,           -1,     -1,   IDLE,    START,     -1,  // LED on
	/* START  */      ACT_OFF,        -1,           -1,           -1,         -1,         -1,         -1,           -1,     ON,     -1,       -1, STARTU,  // Start fading
	/* STARTU */    ACT_START,        -1,           -1,           -1,         -1,         -1,         UP,           -1,     ON,     -1,       -1,     -1,  
	/* UP     */       ACT_UP,        -1,           -1,       STARTD,         UP,         -1,         -1,           -1,     ON,     -1,       -1,     -1,
	/* STARTD */    ACT_START,        -1,           -1,           -1,         -1,       DOWN,         -1,           -1,     ON,     -1,       -1,     -1,
	/* DOWN   */     ACT_DOWN,        -1,           -1,       REPEAT,       DOWN,         -1,         -1,           -1,     ON,     -1,       -1,     -1,
	/* REPEAT */   ACT_REPEAT,        -1,           -1,           -1,         -1,         -1,         -1,         IDLE,     ON,   IDLE,       -1, STARTU,
    };
	Machine::begin( state_table, ELSE );
	pin = attached_pin; 
	pinMode( pin, OUTPUT );
	timer_fade.set( 0 ); // Number of ms per slope step (slope duration: rate * 32 ms)
	timer_on.set( 500 ); // Plateau between slopes (in which led is fully on)
	timer_off.set( 500 ); // Pause between slopes (in which led is fully off)
	counter_fade.set( SLOPE_SIZE );
	counter_repeat.set( ATM_COUNTER_OFF );
	repeat_count = ATM_COUNTER_OFF;
	return *this;
}

Atm_fade & Atm_fade::blink( uint32_t duration ) 
{
	timer_on.set( duration ); // Plateau between slopes (in which led is fully on)
	return *this;
}

Atm_fade & Atm_fade::pause( uint32_t duration ) 
{
	timer_off.set( duration ); // Pause between slopes (in which led is fully off)
	return *this;
}

Atm_fade & Atm_fade::fade( int fade ) 
{
	timer_fade.set( fade >= 0 ? fade : ATM_TIMER_OFF ); // Number of ms per slope step (slope duration: rate * 32 ms)
	return *this;<commit_msg>Atm_fade:: dded extra EVT_ON/EVT_BLINK/EVT_OFF states<commit_after>#include "Atm_fade.h"

Atm_fade & Atm_fade::begin( int attached_pin )
{  
	const static state_t state_table[] PROGMEM = {
	/*               ON_ENTER    ON_LOOP       ON_EXIT  EVT_CNT_FADE EVT_TM_FADE   EVT_TM_ON  EVT_TM_OFF   EVT_CNT_RPT  EVT_ON EVT_OFF EVT_BLINK    ELSE  */
	/* IDLE   */      ACT_OFF, ATM_SLEEP,           -1,           -1,         -1,         -1,         -1,           -1,     ON,   IDLE,    START,     -1,  // LED off
	/* ON     */       ACT_ON, ATM_SLEEP,           -1,           -1,         -1,         -1,         -1,           -1,     ON,   IDLE,    START,     -1,  // LED on
	/* START  */      ACT_OFF,        -1,           -1,           -1,         -1,         -1,         -1,           -1,     ON,   IDLE,    START, STARTU,  // Start fading
	/* STARTU */    ACT_START,        -1,           -1,           -1,         -1,         -1,         UP,           -1,     ON,   IDLE,    START,     -1,  
	/* UP     */       ACT_UP,        -1,           -1,       STARTD,         UP,         -1,         -1,           -1,     ON,   IDLE,    START,     -1,
	/* STARTD */    ACT_START,        -1,           -1,           -1,         -1,       DOWN,         -1,           -1,     ON,   IDLE,    START,     -1,
	/* DOWN   */     ACT_DOWN,        -1,           -1,       REPEAT,       DOWN,         -1,         -1,           -1,     ON,   IDLE,    START,     -1,
	/* REPEAT */   ACT_REPEAT,        -1,           -1,           -1,         -1,         -1,         -1,         IDLE,     ON,   IDLE,    START, STARTU,
    };
	Machine::begin( state_table, ELSE );
	pin = attached_pin; 
	pinMode( pin, OUTPUT );
	timer_fade.set( 0 ); // Number of ms per slope step (slope duration: rate * 32 ms)
	timer_on.set( 500 ); // Plateau between slopes (in which led is fully on)
	timer_off.set( 500 ); // Pause between slopes (in which led is fully off)
	counter_fade.set( SLOPE_SIZE );
	counter_repeat.set( ATM_COUNTER_OFF );
	repeat_count = ATM_COUNTER_OFF;
	return *this;
}

Atm_fade & Atm_fade::blink( uint32_t duration ) 
{
	timer_on.set( duration ); // Plateau between slopes (in which led is fully on)
	return *this;
}

Atm_fade & Atm_fade::pause( uint32_t duration ) 
{
	timer_off.set( duration ); // Pause between slopes (in which led is fully off)
	return *this;
}

Atm_fade & Atm_fade::fade( int fade ) 
{
	timer_fade.set( fade >= 0 ? fade : ATM_TIMER_OFF ); // Number of ms per slope step (slope duration: rate * 32 ms)
	return *this;
{'fraction_non_alphanumeric': 0.13067041348855882, 'fraction_numerical': 0.030309112806101966, 'mean_word_length': 1.2527124773960217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '594037', 'n_tokens_mistral': 1944, 'n_tokens_neox': 1827, 'n_words': 483}