<commit_before>#include <SPI.h>
#include <SoftwareSerial.h>
#include <Adafruit_GPS.h>

#include "nokia_5110.h"

extern "C" {
#include "time.h"
#include "types.h"
#include "haversine.h"
#include "waypoint_store.h"
}

#define GPSSerial Serial1

#define WAYPOINT_DISTANCE_THRESHOLD 50 /* meters */
#define BUSY_LED 17

void print_tracking_display(struct tracking_data_t *data)
{
    lcd_clear_display();
    lcd_pos(0, 0);
    lcd_print_float(data->instant_speed);
    lcd_pos(0, 1);
    lcd_print_float(data->average_speed);
    lcd_pos(0, 2);
    lcd_print_float(data->time_elapsed);
    lcd_pos(0, 3);
    lcd_print_float(data->total_distance);
    lcd_pos(0, 4);
    lcd_print_float(data->waypoint_distance);
}

void setup(void)
{
    /* Initialise LCD - Print startup message */
    lcd_init();
    lcd_clear_display();
    lcd_write_str("Waiting for fix...");
  
    pinMode(BUSY_LED, OUTPUT);

    /* Configure GPS - 1Hz update frequency, full NMEA output */
    Adafruit_GPS gps(&GPSSerial);
    gps.begin(9600);
    gps.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
    gps.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ) ;
    gps.sendCommand(PGCMD_ANTENNA);
    gps.sendCommand(PMTK_Q_RELEASE);

    waypoint_store_t waypoint_store;
    waypoint_store_initialize(&waypoint_store);

    point_t waypoint = waypoint_store_get_next(&waypoint_store);

    tracking_data_t tracking_data = (tracking_data_t){0.0,0.0,0.0,0.0,0.0};
    tracking_record_t tracking_record = {.num_points = 0, .aggregate_speed = 0.0};

    while (1) {

        gps_wait_for_packet(gps);

        digitalWrite(BUSY_LED, HIGH); /* turn on LED */

        point_t tracking_point = (point_t){gps.latitudeDegrees, gps.longitudeDegrees};

        tracking_record.num_points++;
        tracking_record.aggregate_speed += gps.speed;

        /* only add distance if for points 2..n */
        if (tracking_record.num_points > 1) {
            tracking_data.total_distance +=
                distance_between(tracking_record.previous_point, tracking_point);<commit_msg>Use only RMC<commit_after>#include <SPI.h>
#include <SoftwareSerial.h>
#include <Adafruit_GPS.h>

#include "nokia_5110.h"

extern "C" {
#include "time.h"
#include "types.h"
#include "haversine.h"
#include "waypoint_store.h"
}

#define GPSSerial Serial1

#define WAYPOINT_DISTANCE_THRESHOLD 50 /* meters */
#define BUSY_LED 17

void print_tracking_display(struct tracking_data_t *data)
{
    lcd_clear_display();
    lcd_pos(0, 0);
    lcd_print_float(data->instant_speed);
    lcd_pos(0, 1);
    lcd_print_float(data->average_speed);
    lcd_pos(0, 2);
    lcd_print_float(data->time_elapsed);
    lcd_pos(0, 3);
    lcd_print_float(data->total_distance);
    lcd_pos(0, 4);
    lcd_print_float(data->waypoint_distance);
}

void setup(void)
{
    /* Initialise LCD - Print startup message */
    lcd_init();
    lcd_clear_display();
    lcd_write_str("Waiting for fix...");
  
    pinMode(BUSY_LED, OUTPUT);

    /* Configure GPS - 1Hz update frequency, full NMEA output */
    Adafruit_GPS gps(&GPSSerial);
    gps.begin(9600);
    gps.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY);
    gps.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ) ;
    gps.sendCommand(PGCMD_ANTENNA);
    gps.sendCommand(PMTK_Q_RELEASE);

    waypoint_store_t waypoint_store;
    waypoint_store_initialize(&waypoint_store);

    point_t waypoint = waypoint_store_get_next(&waypoint_store);

    tracking_data_t tracking_data = (tracking_data_t){0.0,0.0,0.0,0.0,0.0};
    tracking_record_t tracking_record = {.num_points = 0, .aggregate_speed = 0.0};

    while (1) {

        gps_wait_for_packet(gps);

        digitalWrite(BUSY_LED, HIGH); /* turn on LED */

        point_t tracking_point = (point_t){gps.latitudeDegrees, gps.longitudeDegrees};

        tracking_record.num_points++;
        tracking_record.aggregate_speed += gps.speed;

        /* only add distance if for points 2..n */
        if (tracking_record.num_points > 1) {
            tracking_data.total_distance +=
                distance_between(tracking_record.previous_point, tracking_point);
{'fraction_non_alphanumeric': 0.11895360315893386, 'fraction_numerical': 0.020236920039486673, 'mean_word_length': 3.830750893921335, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2425188', 'n_tokens_mistral': 1605, 'n_tokens_neox': 1498, 'n_words': 241}