<commit_before>#include "create.h"
#include <math.h>

// Number of "create ticks" per centimeter moved
#define CTICK_PER_CM 9.6

// Clearing Create measured values (distance traveled & angle turned)

void clear_create_distance() {
 	set_create_distance(0);
}

void clear_create_angle() {
 	set_create_total_angle(0);
}

// iRobot2 Open Interface : https://www.adafruit.com/datasheets/create_2_Open_Interface_Spec.pdf

#define get_high_byte(byte) ((byte >> 8) & 255)
#define get_low_byte(byte) (byte & 255)

void create_write_int(int value) {
  	// [high byte][low byte]
 	create_write_byte(get_high_byte(value));
  	create_write_byte(get_low_byte(value));
}

// Helper Conversions (converting "create ticks" to centimeters)

float CTICKtoCM(long tick) {
 	return (float)(tick / CTICK_PER_CM);
}

long CMtoCTICK(float cm) {
  	return (long)(cm * CTICK_PER_CM);
}

// Create General Movement

void create_left(int angle, float radius, int speed) {
  	if(radius < 0.)
      	return;
  	if (speed < -500 || speed > 500)
      	return;

  	if(angle < 0.) {
     	create_right(-angle, radius, speed);
      	return;
    }

  	long radiusTicks = CMtoCTICK(radius);

  	clear_create_angle();

  	// create turn byte (decimal): 137
  	// [137][speed high][speed low][radius high][radius low]
  	create_write_byte(137);
  	create_write_int(speed);
  	if(radius == 0) {
      	create_write_int(1);
    else
     	create_write_int(radiusTicks);

  	while(get_create_total_angle() < angle)
     	 msleep(10);

  	create_stop();
}

void create_right(int angle, float radius, int speed) {
  	if(radius < 0.)
      	return;
  	if (speed < -500 || speed > 500)
      	return;

  	if(angle < 0.) {
     	create_left(-angle, radius, speed);
      	return;
    }

  	long radiusTicks = CMtoCTICK(radius);

  	clear_create_angle();

  	// create turn byte (decimal): 137
  	// [137][speed high][speed low][radius high][radius low]
  	create_write_byte(137);
  	create_write_int(speed);
    
  	if(radius == 0)
      	create_write_int(-1);
    else
     	create_write_int(-radiusTicks);

  	while(get_create_total_angle() > -angle) {
     	 msleep(10);
    }

  	create_stop();
}

void create_forward(float dist, int speed) {<commit_msg>Test style change<commit_after>#include "create.h"
#include <math.h>

// Number of "create ticks" per centimeter moved
#define CTICK_PER_CM 9.6

// Clearing Create measured values (distance traveled & angle turned)

void clear_create_distance() {
    set_create_distance(0);
}

void clear_create_angle() {
    set_create_total_angle(0);
}

// iRobot2 Open Interface : https://www.adafruit.com/datasheets/create_2_Open_Interface_Spec.pdf

#define get_high_byte(byte) ((byte >> 8) & 255)
#define get_low_byte(byte) (byte & 255)

void create_write_int(int value) {
  	// [high byte][low byte]
    create_write_byte(get_high_byte(value));
    create_write_byte(get_low_byte(value));
}

// Helper Conversions (converting "create ticks" to centimeters)

float CTICKtoCM(long tick) {
    return (float)(tick / CTICK_PER_CM);
}

long CMtoCTICK(float cm) {
    return (long)(cm * CTICK_PER_CM);
}

// Create General Movement

void create_left(int angle, float radius, int speed) {
    if(radius < 0.)
        return;
    if (speed < -500 || speed > 500)
        return;

    if(angle < 0.) {
        create_right(-angle, radius, speed);
        return;
    }

    long radiusTicks = CMtoCTICK(radius);

    clear_create_angle();

  	// create turn byte (decimal): 137
  	// [137][speed high][speed low][radius high][radius low]
    create_write_byte(137);
    create_write_int(speed);
    if(radius == 0) {
        create_write_int(1);
    else
        create_write_int(radiusTicks);

    while(get_create_total_angle() < angle)
        msleep(10);

    create_stop();
}

void create_right(int angle, float radius, int speed) {
  	if(radius < 0.)
      	return;
  	if (speed < -500 || speed > 500)
      	return;

  	if(angle < 0.) {
     	create_left(-angle, radius, speed);
      	return;
    }

  	long radiusTicks = CMtoCTICK(radius);

  	clear_create_angle();

  	// create turn byte (decimal): 137
  	// [137][speed high][speed low][radius high][radius low]
  	create_write_byte(137);
  	create_write_int(speed);

  	if(radius == 0)
      	create_write_int(-1);
    else
     	create_write_int(-radiusTicks);

    while(get_create_total_angle() > -angle) {
     	 msleep(10);
    }

  	create_stop();
}

void create_forward(float dist, int speed) {
{'fraction_non_alphanumeric': 0.12869955156950671, 'fraction_numerical': 0.02466367713004484, 'mean_word_length': 3.3352769679300294, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '3548557', 'n_tokens_mistral': 1698, 'n_tokens_neox': 1572, 'n_words': 342}