<commit_before>#include <esp8266.h>
#include "repl.h"
#include "led.h"
#include "button.h"
#include "httpd.h"
#include "httpdespfs.h"
#include "espfs.h"
#include "webpages-espfs.h"
#include "cgi.h"
#include "data.h"
#include "layer.h"
#include "json.h"

//#define SHOW_HEAP_USE

static struct mdns_info mdns_info;

#ifdef SHOW_HEAP_USE
static ETSTimer prHeapTimer;

static void ICACHE_FLASH_ATTR
prHeapTimerCb(void *arg)
{
	printf("Heap: %ld\n", (unsigned long)system_get_free_heap_size());
}
#endif

static void ICACHE_FLASH_ATTR wifi_handle_event(System_Event_t *evt)
{
	switch (evt->event) {
	case EVENT_STAMODE_DISCONNECTED:
		espconn_mdns_disable();
		espconn_mdns_close();
		break;

	case EVENT_STAMODE_GOT_IP:
		mdns_info.host_name = wifi_station_get_hostname();
		mdns_info.ipAddr = evt->event_info.got_ip.ip.addr;
		mdns_info.server_name = "http";
		mdns_info.server_port = 80;
		mdns_info.txt_data[0] = "api=sol";
		espconn_mdns_init(&mdns_info);
		espconn_mdns_enable();
		break;
	}
}

HttpdBuiltInUrl builtInUrls[] = {
	{ "/", cgiRedirect, "/index.html" },
	{ "/layer.json", cgiJson, &json_layer_callback },
	{ "/led.json", cgiJson, &json_led_callback },
	{ "/settings.json", cgiJson, &json_settings_callback },
	{ "*", cgiEspFsHook, NULL },
	{ NULL }
};

os_timer_t fade_timer;

static void ICACHE_FLASH_ATTR fade_timer_cb(void *arg)
{
	os_timer_arm(&fade_timer, 17, 1);

	if (led_current[0] >= 5) {
		led_current[0] -= 5;
	}
	else {
		led_current[0] = 0;<commit_msg>move json to /cgi/<commit_after>#include <esp8266.h>
#include "repl.h"
#include "led.h"
#include "button.h"
#include "httpd.h"
#include "httpdespfs.h"
#include "espfs.h"
#include "webpages-espfs.h"
#include "cgi.h"
#include "data.h"
#include "layer.h"
#include "json.h"

//#define SHOW_HEAP_USE

static struct mdns_info mdns_info;

#ifdef SHOW_HEAP_USE
static ETSTimer prHeapTimer;

static void ICACHE_FLASH_ATTR
prHeapTimerCb(void *arg)
{
	printf("Heap: %ld\n", (unsigned long)system_get_free_heap_size());
}
#endif

static void ICACHE_FLASH_ATTR wifi_handle_event(System_Event_t *evt)
{
	switch (evt->event) {
	case EVENT_STAMODE_DISCONNECTED:
		espconn_mdns_disable();
		espconn_mdns_close();
		break;

	case EVENT_STAMODE_GOT_IP:
		mdns_info.host_name = wifi_station_get_hostname();
		mdns_info.ipAddr = evt->event_info.got_ip.ip.addr;
		mdns_info.server_name = "http";
		mdns_info.server_port = 80;
		mdns_info.txt_data[0] = "api=sol";
		espconn_mdns_init(&mdns_info);
		espconn_mdns_enable();
		break;
	}
}

HttpdBuiltInUrl builtInUrls[] = {
	{ "/", cgiRedirect, "/index.html" },
	{ "/cgi/layer.json", cgiJson, &json_layer_callback },
	{ "/cgi/led.json", cgiJson, &json_led_callback },
	{ "/cgi/settings.json", cgiJson, &json_settings_callback },
	{ "*", cgiEspFsHook, NULL },
	{ NULL }
};

os_timer_t fade_timer;

static void ICACHE_FLASH_ATTR fade_timer_cb(void *arg)
{
	os_timer_arm(&fade_timer, 17, 1);

	if (led_current[0] >= 5) {
		led_current[0] -= 5;
	}
	else {
		led_current[0] = 0;
{'fraction_non_alphanumeric': 0.15015115888478334, 'fraction_numerical': 0.010749076251259657, 'mean_word_length': 5.431965442764579, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '4569076', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1284, 'n_words': 214}