<commit_before>// Author: <NAME>
// Copyright (c) 2016 Agponics

#include "ds18b20_sensor.h"

void CDs18b20Sensor::set_pin(int pin) 
{
    CDevice::set_pin(pin); 

    m_one_wire = OneWire(pin); 
    m_dt       = DallasTemperature(&m_one_wire);

    m_dt.begin();
}

String CDs18b20Sensor::get_status_str()
{
    double  temp = 0.0;
    uint8_t probe_cnt = 0;
    
    String out = "";

    // have all probes read temp
    m_dt.requestTemperatures();

    probe_cnt = m_dt.getDeviceCount();

    for (uint8_t i = 0; i < probe_cnt; i++)
    {
        float temp_celsius = m_dt.getTempCByIndex(i);
        out += CDevice::get_status_str();
        out += "probe" + String(i) + ":temp:";
        out += String(int(celsius_to_fahrenheit(temp_celsius)));
        out += "\n";
    }
            
    return out;   
}

String CDs18b20Sensor::get_addrs()
{
    uint8_t next_addr[8] = {0};
    uint8_t i = 0;

    String out = "One-wire Addresses Found:\n";
    
    while (m_dt.getAddress(next_addr, i))
    {
        out += String(i) + ":";
        for (int j = 0; j < 8; j++)<commit_msg>Switch to DT Fahrenheit call<commit_after>// Author: <NAME>
// Copyright (c) 2016 Agponics

#include "ds18b20_sensor.h"

void CDs18b20Sensor::set_pin(int pin) 
{
    CDevice::set_pin(pin); 

    m_one_wire = OneWire(pin); 
    m_dt       = DallasTemperature(&m_one_wire);

    m_dt.begin();
}

String CDs18b20Sensor::get_status_str()
{
    double  temp = 0.0;
    uint8_t probe_cnt = 0;
    
    String out = "";

    // have all probes read temp
    m_dt.requestTemperatures();

    probe_cnt = m_dt.getDeviceCount();

    for (uint8_t i = 0; i < probe_cnt; i++)
    {
        temp = m_dt.getTempFByIndex(i);
        out += CDevice::get_status_str();
        out += "probe" + String(i) + ":temp:";
        out += String(int(temp));
        out += "\n";
    }
            
    return out;   
}

String CDs18b20Sensor::get_addrs()
{
    uint8_t next_addr[8] = {0};
    uint8_t i = 0;

    String out = "One-wire Addresses Found:\n";
    
    while (m_dt.getAddress(next_addr, i))
    {
        out += String(i) + ":";
        for (int j = 0; j < 8; j++)
{'fraction_non_alphanumeric': 0.14995313964386128, 'fraction_numerical': 0.030927835051546393, 'mean_word_length': 2.421474358974359, 'pattern_counts': {'":': 4, '<': 9, '<?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': '7536772', 'n_tokens_mistral': 872, 'n_tokens_neox': 818, 'n_words': 168}