<commit_before>#include <Arduino.h>
#include <vector>

#include <commons.h>
#include <file_system.h>
#include <service_rest.h>
#include <service_ota.h>
#include <service_hid.h>

#define JS_HID "/js/hid.js"
#define HTML_HID "/html/hid.html"

std::vector<Service *> services;

void ICACHE_FLASH_ATTR setup() {
#ifdef __DEBUG__
    Log::init();
#endif
    if (!SPIFFS.begin()) {
#ifdef __DEBUG__
        Log::println("SPIFFS failed to initialize flash corrupted?");
#endif
        ESP.restart();
    }
    {   // Services setup
        char *admin_acc = ConfigJSON::getString(CONFIG_GLOBAL_JSON, {"rest-acc"}),
                *admin_pass = ConfigJSON::getString(CONFIG_GLOBAL_JSON, {"rest-pass"});
#ifdef __DEBUG__
        services.push_back(Log::getInstance());
#endif
        services.push_back(HID::getInstance());
        //services.push_back(HID::getInstance(admin_acc, admin_pass));
        services.push_back(OtaService::get_instance(admin_pass));
        RestService *rest_service = RestService::initialize(new RestService(admin_acc, admin_pass, 80),
                                                            (REST_INIT) (CALLBACKS_SYSTEM | CALLBACKS_WIFI |
                                                                         #ifdef __DEBUG__
                                                                         LOGGING |
                                                                         #endif
                                                                         HTML_COMMON_FILES | HTML_ADMIN_FILES |
                                                                         HTML_STATUS_FILES));
        rest_service->add_handler_file(HTML_HID, HTTP_ANY, RESP_HTML, HTML_HID
                ".gz", true);
        rest_service->add_handler_file(JS_HID, HTTP_ANY, RESP_JS, JS_HID
                ".gz", true);
        services.push_back((Service *&&) rest_service);
#ifdef __DEBUG__
        Log::println("Credentials: [%s:%s]", admin_acc, admin_pass);
#endif
        checked_free(admin_acc);
        checked_free(admin_pass);
    }
    wifi_config_reset();
    delay(500);
}

void loop() {
    for (std::vector<Service *>::iterator i = services.begin();
         i != services.end(); i++)
        (*i)->cycle_routine();
    yield(); // WATCHDOG/WIFI feed
}
<commit_msg>Fix missing initializers in HID-Emulator projects<commit_after>#include <Arduino.h>
#include <vector>

#include <commons.h>
#include <file_system.h>
#include <service_rest.h>
#include <service_ota.h>
#include <service_hid.h>
#include <configuration.h>

#define JS_HID "/js/hid.js"
#define HTML_HID "/html/hid.html"

std::vector<Service *> services;

void ICACHE_FLASH_ATTR setup() {
#ifdef __DEBUG__
    Log::init();
#endif
    if (!SPIFFS.begin()) {
#ifdef __DEBUG__
        Log::println("SPIFFS failed to initialize flash corrupted?");
#endif
        ESP.restart();
    }
    {   // Services setup
        char *admin_acc = ConfigJSON::getString(CONFIG_GLOBAL_JSON, {"rest-acc"}),
                *admin_pass = ConfigJSON::getString(CONFIG_GLOBAL_JSON, {"rest-pass"});
#ifdef __DEBUG__
        services.push_back(Log::getInstance());
#endif
        services.push_back(HID::getInstance());
        //services.push_back(HID::getInstance(admin_acc, admin_pass));
        services.push_back(OtaService::get_instance(admin_pass));
        RestService *rest_service = init_rest(new RestService(admin_acc, admin_pass, 80),
                                              (REST_INIT) (CALLBACKS_SYSTEM | CALLBACKS_WIFI |
                                                                         #ifdef __DEBUG__
                                                                         LOGGING |
                                                                         #endif
                                                                         HTML_COMMON_FILES | HTML_ADMIN_FILES |
                                                                         HTML_STATUS_FILES));
        rest_service->add_handler_file(HTML_HID, HTTP_ANY, RESP_HTML, HTML_HID
                ".gz", true);
        rest_service->add_handler_file(JS_HID, HTTP_ANY, RESP_JS, JS_HID
                ".gz", true);
        services.push_back((Service *&&) rest_service);
#ifdef __DEBUG__
        Log::println("Credentials: [%s:%s]", admin_acc, admin_pass);
#endif
        checked_free(admin_acc);
        checked_free(admin_pass);
    }
    wifi_config_reset();
    delay(500);
}

void loop() {
    for (std::vector<Service *>::iterator i = services.begin();
         i != services.end(); i++)
        (*i)->cycle_routine();
    yield(); // WATCHDOG/WIFI feed
}

{'fraction_non_alphanumeric': 0.11865139399178734, 'fraction_numerical': 0.002161227577263886, 'mean_word_length': 1.846248462484625, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3915000', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1275, 'n_words': 233}