<commit_before>
#include <vt100.h>
#include <syscall.h>

#include <tasks/calibrate.h>
#include <tasks/clock_server.h>
#include <tasks/train_station.h>
#include <tasks/mission_control.h>


void accelerate() {

    int tid = 0;
    int train_num = 0;
    Receive(&tid, (char*)&train_num, sizeof(train_num));
    Reply(tid, NULL, 0);

    int adjust_speed = train_num == 51 ? 5 : 2;

    reset_train_state();
    update_turnout(8,  'S');
    update_turnout(9,  'S');
    update_turnout(11, 'S');
    update_turnout(12, 'S');
    update_turnout(14, 'S');
    update_turnout(16, 'S');
    update_turnout(17, 'S');

    log("Please get train %d to sensor E9", train_num);
    delay_sensor('E', 9);

    for (int speed = 10; speed; speed--) {
        train_set_speed(train_num, speed);
        Delay(30);
    }

    train_set_speed(train_num, adjust_speed);

    int speed = 1;
    for (; speed < 5; speed++) {
        // in position, so stop!
        delay_sensor('E', 8);
        train_set_speed(train_num, 0);
        Delay(200); // wait for full stop (estimate)

        // start the test
        train_set_speed(train_num, speed);
        Delay(400);

        // done, so reset
        train_reverse(train_num);
        train_set_speed(train_num, 10);
        delay_sensor('E', 7);
        train_set_speed(train_num, 4);
        train_reverse(train_num);
        train_set_speed(train_num, adjust_speed);
    }

    for (; speed < 15; speed++) {
        // in position, so stop!
        delay_sensor('E', 8);
        train_set_speed(train_num, 0);
        Delay(200); // wait for full stop (estimate)

        // start the test
        train_set_speed(train_num, speed);
        delay_sensor('C', 14);
<commit_msg>Give train more time to stop and/or reach max speed<commit_after>
#include <vt100.h>
#include <syscall.h>

#include <tasks/calibrate.h>
#include <tasks/clock_server.h>
#include <tasks/train_station.h>
#include <tasks/mission_control.h>


void accelerate() {

    int tid = 0;
    int train_num = 0;
    Receive(&tid, (char*)&train_num, sizeof(train_num));
    Reply(tid, NULL, 0);

    int adjust_speed = train_num == 51 ? 5 : 2;

    reset_train_state();
    update_turnout(8,  'S');
    update_turnout(9,  'S');
    update_turnout(11, 'S');
    update_turnout(12, 'S');
    update_turnout(14, 'S');
    update_turnout(16, 'S');
    update_turnout(17, 'S');

    log("Please get train %d to sensor E9", train_num);
    delay_sensor('E', 9);

    for (int speed = 10; speed; speed--) {
        train_set_speed(train_num, speed);
        Delay(30);
    }

    train_set_speed(train_num, adjust_speed);

    int speed = 1;
    for (; speed < 5; speed++) {
        // in position, so stop!
        delay_sensor('E', 8);
        train_set_speed(train_num, 0);
        Delay(400); // wait for full stop (estimate)

        // start the test
        train_set_speed(train_num, speed);
        Delay(600);

        // done, so reset
        train_reverse(train_num);
        train_set_speed(train_num, 10);
        delay_sensor('E', 7);
        train_set_speed(train_num, 4);
        train_reverse(train_num);
        train_set_speed(train_num, adjust_speed);
    }

    for (; speed < 15; speed++) {
        // in position, so stop!
        delay_sensor('E', 8);
        train_set_speed(train_num, 0);
        Delay(400); // wait for full stop (estimate)

        // start the test
        train_set_speed(train_num, speed);
        delay_sensor('C', 14);

{'fraction_non_alphanumeric': 0.14355863662622761, 'fraction_numerical': 0.029462738301559793, 'mean_word_length': 2.618599791013584, 'pattern_counts': {'":': 0, '<': 19, '<?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': '3355761', 'n_tokens_mistral': 1303, 'n_tokens_neox': 1181, 'n_words': 277}