<commit_before>extern "C" {
#include "ets_sys.h"
#include "user_interface.h"
#include "string.h"
#include "osapi.h"
#include "espconn.h"
#include "mem.h"
#include "driver/uart.h"
#include "sdk_missing.h"
}

#include "SSD1306Display.h"
#include "WordDisplay.h"
#include "WordParser.h"
#include "log.h"

#include "config.h"

static SSD1306Display* oled_display = 0;
static WordDisplay* display = 0;
static os_timer_t timer;

static const char text[] = "This is an ESP8266 running an OLED display.";
#include "wiki.h"

static void between_text(void* arg);

static void ICACHE_FLASH_ATTR schedule(void (*fn)(void*), int ms)
{
	os_timer_setfn(&timer, fn, NULL);
	os_timer_arm(&timer, ms, false);
}

static void ICACHE_FLASH_ATTR show_text(void* arg)
{
	display->show_text(wiki_text, between_text, NULL);
}


static void ICACHE_FLASH_ATTR between_text(void* arg)
{
	display->set_font_size(24);
	display->show("");
	schedule(show_text, 1000);
}


static void ICACHE_FLASH_ATTR check_connection(void* arg)
{
	display->set_font_size(16);

	uint8 status = wifi_station_get_connect_status();
	if (status == STATION_GOT_IP) {
		char msg[32];
		struct ip_info ip_info;
		bool ok = wifi_get_ip_info(0, &ip_info);
		if (ok) {
			os_sprintf(
				msg, "%d.%d.%d.%d", IP2STR(&ip_info.ip));
			}
		else
			os_sprintf(msg, "Problem.");
		display->show(msg);
		schedule(between_text, 3000);
		}
	else if (status == STATION_CONNECTING) {
		display->show("Connecting...");
		schedule(check_connection, 500);
		}
	else {<commit_msg>Handling STATION_WRONG_PASSWORD correctly.<commit_after>extern "C" {
#include "ets_sys.h"
#include "user_interface.h"
#include "string.h"
#include "osapi.h"
#include "espconn.h"
#include "mem.h"
#include "driver/uart.h"
#include "sdk_missing.h"
}

#include "SSD1306Display.h"
#include "WordDisplay.h"
#include "WordParser.h"
#include "log.h"

#include "config.h"

static SSD1306Display* oled_display = 0;
static WordDisplay* display = 0;
static os_timer_t timer;

static const char text[] = "This is an ESP8266 running an OLED display.";
#include "wiki.h"

static void between_text(void* arg);

static void ICACHE_FLASH_ATTR schedule(void (*fn)(void*), int ms)
{
	os_timer_setfn(&timer, fn, NULL);
	os_timer_arm(&timer, ms, false);
}

static void ICACHE_FLASH_ATTR show_text(void* arg)
{
	display->show_text(wiki_text, between_text, NULL);
}


static void ICACHE_FLASH_ATTR between_text(void* arg)
{
	display->set_font_size(24);
	display->show("");
	schedule(show_text, 1000);
}


static void ICACHE_FLASH_ATTR check_connection(void* arg)
{
	display->set_font_size(16);

	static int retries = 0;

	uint8 status = wifi_station_get_connect_status();
	if (status == STATION_GOT_IP) {
		char msg[32];
		struct ip_info ip_info;
		bool ok = wifi_get_ip_info(0, &ip_info);
		if (ok) {
			os_sprintf(
				msg, "%d.%d.%d.%d", IP2STR(&ip_info.ip));
			}
		else
			os_sprintf(msg, "Problem.");
		display->show(msg);
		schedule(between_text, 3000);
		}
	else if (status == STATION_CONNECTING) {
		retries = 0;
		display->show("Connecting...");
		schedule(check_connection, 500);
		}
	else if (status == STATION_WRONG_PASSWORD && ++retries < 10) {
		// It seems to report STATION_WRONG_PASSWORD while it's sending the
		// password.  So we give it a few seconds to exit that state before we
		// believe that the password is actually bad.
		schedule(check_connection, 500);
		}
	else {
{'fraction_non_alphanumeric': 0.1423076923076923, 'fraction_numerical': 0.022189349112426034, 'mean_word_length': 5.059139784946237, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 15, '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': '2594711', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1276, 'n_words': 302}