<commit_before>#include <ESP8266HTTPClient.h>
#include "send.h"
#include "config.h"

extern struct Configuration config;

int send_ts(uint16_t pm25, uint16_t pm10, int16_t t, uint16_t h)
{
    HTTPClient http;
    char buf[1024];

    if (strlen(config.ts_api_key)==0) {
        return -1;
    }

    snprintf(buf, sizeof(buf), "http://api.thingspeak.com/update?api_key=%s&field1=%d&field2=%d&field3=%d&field4=%d",
            config.ts_api_key, (int)pm25, (int)pm10, (int)t, (int)h);

    http.begin(buf);

    return http.GET();
}
<commit_msg>send: use floating point in send_ts<commit_after>#include <ESP8266HTTPClient.h>
#include "send.h"
#include "config.h"

extern struct Configuration config;

int send_ts(uint16_t pm25, uint16_t pm10, int16_t t, uint16_t h)
{
    HTTPClient http;
    char buf[1024];

    if (strlen(config.ts_api_key)==0) {
        return -1;
    }

    char str_pm25[6];
    char str_pm10[6];
    char str_tmp[6];
    char str_hum[6];
    dtostrf((double)pm25/10.0, 4, 1, str_pm25);
    dtostrf((double)pm10/10.0, 4, 1, str_pm10);
    dtostrf((double)t/10.0, 4, 1, str_tmp);
    dtostrf((double)h/10.0, 4, 1, str_hum);

    snprintf(buf, sizeof(buf), "http://api.thingspeak.com/update?api_key=%s&field1=%s&field2=%s&field3=%s&field4=%s",
            config.ts_api_key, str_pm25, str_pm10, (int)str_tmp, (int)str_hum);

    http.begin(buf);

    return http.GET();
}

{'fraction_non_alphanumeric': 0.16439339554917445, 'fraction_numerical': 0.06891600861450108, 'mean_word_length': 3.823529411764706, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '707994', 'n_tokens_mistral': 634, 'n_tokens_neox': 574, 'n_words': 105}