<commit_before>/**
 * The hung screen I used on my TiLDA during EMF.
 * In case I ever want to use it as an overengineered badge again.
 */

#include "U8glib.h"
#include "UniversalButtons.h"

#include "TiLDA_MKe.h"

TiLDA_MKe tilda;
bool torch = false;

void setup(void)
{
  tilda.setBacklight(LCD_BACKLIGHT_ON);

  // Set button callback
  tilda.buttons.setStateCycleCallback(&button_handler);
}

void loop()
{
  // See if there were any button changes
  tilda.buttons.poll();

  // Display some text on the GLCD
  tilda.glcd.firstPage();
  do
  {
    tilda.glcd.setRot270();

    tilda.glcd.setFont(u8g_font_helvB12);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 0, "Dan");
    tilda.glcd.drawStr(0, 15, "Nixon");

    tilda.glcd.setFont(u8g_font_5x7);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 32, "dan-nixon.com");
    tilda.glcd.drawStr(0, 42, "@technoducky");

    tilda.glcd.setFont(u8g_font_6x10);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 60, "Code");
    tilda.glcd.drawStr(0, 70, "moneky,");
    tilda.glcd.drawStr(0, 80, "electronics");
    tilda.glcd.drawStr(0, 90, "engineer,");
    tilda.glcd.drawStr(0, 100, "mad");
    tilda.glcd.drawStr(0, 110, "scientist.");
  }
  while(tilda.glcd.nextPage());
}

/**
 * Basic handler for button state changes.
 */
void button_handler(buttonid_t id, uint32_t time)
{
  switch(id)
  {
    // Toggle backlight on Light
    case BUTTON_LIGHT:
      tilda.toggleBacklight();
      break;

    // Toggle LEDs on B
    case BUTTON_B:
      torch = !torch;

      if(torch)
        tilda.setLEDs(255, 255, 255);
      else
        tilda.setLEDs(0, 0, 0);

      break;
  }
}<commit_msg>Fix typo, require 1 second button hold for blinding LEDs<commit_after>/**
 * The hung screen I used on my TiLDA during EMF.
 * In case I ever want to use it as an overengineered badge again.
 */

#include "U8glib.h"
#include "UniversalButtons.h"

#include "TiLDA_MKe.h"

TiLDA_MKe tilda;
bool torch = false;

void setup(void)
{
  tilda.setBacklight(LCD_BACKLIGHT_ON);

  // Set button callback
  tilda.buttons.setStateCycleCallback(&button_handler);
}

void loop()
{
  // See if there were any button changes
  tilda.buttons.poll();

  tilda.glcd.firstPage();
  do
  {
    tilda.glcd.setRot270();

    tilda.glcd.setFont(u8g_font_helvB12);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 0, "Dan");
    tilda.glcd.drawStr(0, 15, "Nixon");

    tilda.glcd.setFont(u8g_font_5x7);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 32, "dan-nixon.com");
    tilda.glcd.drawStr(0, 42, "@technoducky");

    tilda.glcd.setFont(u8g_font_6x10);
    tilda.glcd.setFontPosTop();
    tilda.glcd.drawStr(0, 60, "Code");
    tilda.glcd.drawStr(0, 70, "monkey,");
    tilda.glcd.drawStr(0, 80, "electronics");
    tilda.glcd.drawStr(0, 90, "engineer,");
    tilda.glcd.drawStr(0, 100, "mad");
    tilda.glcd.drawStr(0, 110, "scientist.");
  }
  while(tilda.glcd.nextPage());
}

/**
 * Basic handler for button state changes.
 */
void button_handler(buttonid_t id, uint32_t time)
{
  switch(id)
  {
    // Toggle backlight on Light
    case BUTTON_LIGHT:
      tilda.toggleBacklight();
      break;

    // Toggle LEDs on B
    case BUTTON_B:
      // Require a 1 second press to turn on, any length press to turn off
      if(!torch && (time < 1000))
        break;

      torch = !torch;

      if(torch)
        tilda.setLEDs(255, 255, 255);
      else
        tilda.setLEDs(0, 0, 0);

      break;
  }
}
{'fraction_non_alphanumeric': 0.14425007169486664, 'fraction_numerical': 0.03556065385718383, 'mean_word_length': 3.051103368176539, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2401041', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1393, 'n_words': 291}