<commit_before>#ifdef __linux__
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>

#include <ws2811.h>
#include <wiringPi.h>
#include <wiringSerial.h>

#include "definitions.h"
#include "main_rpi.h"
#include "SerialPort.h"
#include "LedStripController.h"
#include "LayerController.h"

#define NUM_LEDS 300
#define GPIO_PIN 18
#define DMA 5
#define TARGET_FREQ     WS2811_TARGET_FREQ
#define STRIP_TYPE      SK6812_STRIP_GRBW

ws2811_t ledStrip {
    .render_wait_time = 0,
    .device = nullptr,
    .rpi_hw = nullptr,
    .freq = TARGET_FREQ,
    .dmanum = DMA,
    .channel =
    {
        {
            .gpionum = GPIO_PIN,
            .invert = 0,
            .count = NUM_LEDS,
            .strip_type = STRIP_TYPE,
            .leds = nullptr,
            .brightness = 255,
            .wshift = 0,
            .rshift = 0,
            .gshift = 0,
            .bshift = 0,
            .gamma = 0
        }
    },
};

SerialPort serial;
LedStripController controller;

int main(int argc, char **argv) {
    char *virtSerial = 0;
    if ((argc > 2) && (strcmp(argv[1], "-D") == 0)) {
        virtSerial = argv[2];
        print("Override serial port: %s\n", virtSerial);
    }
    if (!setup(virtSerial)) {
        return 1;
    }
    while (running) {
        loop();
    }
    cleanup();
    return 0;
}

static void ctrl_c_handler(int signum) {
    (void)(signum);
    printf("Terminating...\n");
    running = false;
}

static void setup_handlers(void) {
    struct sigaction sa;
    sa.sa_handler = ctrl_c_handler;

    sigaction(SIGINT, &sa, NULL);
    sigaction(SIGTERM, &sa, NULL);
}

bool setup(char *virtSerial) {
    if (virtSerial) {
        serial.begin(virtSerial, 9600);
    } else {
        serial.begin("/dev/ttyAMA0", 9600);
    }
<commit_msg>Fix compile bug<commit_after>#ifdef __linux__
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>

#include <ws2811.h>
#include <wiringPi.h>
#include <wiringSerial.h>

#include "definitions.h"
#include "main_rpi.h"
#include "SerialPort.h"
#include "LedStripController.h"
#include "LayerController.h"

#define NUM_LEDS 300
#define GPIO_PIN 18
#define DMA 5
#define TARGET_FREQ     WS2811_TARGET_FREQ
#define STRIP_TYPE      SK6812_STRIP_GRBW

ws2811_t ledStrip {
    .render_wait_time = 0,
    .device = nullptr,
    .rpi_hw = nullptr,
    .freq = TARGET_FREQ,
    .dmanum = DMA,
    .channel =
    {
        {
            .gpionum = GPIO_PIN,
            .invert = 0,
            .count = NUM_LEDS,
            .strip_type = STRIP_TYPE,
            .leds = nullptr,
            .brightness = 255,
            .wshift = 0,
            .rshift = 0,
            .gshift = 0,
            .bshift = 0,
            .gamma = 0
        }
    },
};

SerialPort serial;
LedStripController controller;

int main(int argc, char **argv) {
    char *virtSerial = 0;
    if ((argc > 2) && (strcmp(argv[1], "-D") == 0)) {
        virtSerial = argv[2];
        print("Override serial port: %s\n", virtSerial);
    }
    if (!setup(virtSerial)) {
        return 1;
    }
    while (running) {
        loop();
    }
    cleanup();
    return 0;
}

static void ctrl_c_handler(int signum) {
    (void)(signum);
    printf("Terminating...\n");

    LayerController &layerControl = controller.layerController();
    layerControl.addColorLayer(0, 60, 40, 5, 100);
    layerControl.addColorLayer(1, 0, 0, 0, 0);
    layerControl.addFadeLayer(2, 0, 1, 0, FadeLayer::InterpolatorDecelerate, 2000);
    layerControl.setAsRootLayer(2);
    sleep(2100);

    running = false;
}

static void setup_handlers(void) {
    struct sigaction sa;
    sa.sa_handler = ctrl_c_handler;

    sigaction(SIGINT, &sa, NULL);
    sigaction(SIGTERM, &sa, NULL);
}

bool setup(char *virtSerial) {
    if (virtSerial) {
        serial.begin(virtSerial, 9600);
    } else {
        serial.begin("/dev/ttyAMA0", 9600);
    }

{'fraction_non_alphanumeric': 0.13563627127254255, 'fraction_numerical': 0.031242062484124967, 'mean_word_length': 2.3715753424657535, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '1424316', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1412, 'n_words': 313}