<commit_before>#include "common.h"
#include "uart.h"
#include "params.h"
#include "samples.h"

static double s_adc_top;

void samples_init(uint16_t ovs_bits) //{{{
{
	// determine ADC_TOP with ovsersampling
	s_adc_top = pow(2, (ADC_BITS + ovs_bits)) - 1;
	verb_printf("adc_top %f\n", s_adc_top);
} //}}}

double sample_v(sample* s, uint8_t warning) //{{{
{
	if (warning && s->signal == s_adc_top)
		fprintf(stderr, "WARNING: maximum voltage, won't hurt anything, but what phone battery has such a high voltage?\n");
	if (s->signal < 0)
		s->signal = 0;
	double v_adcv = (((double)(s->signal)) / s_adc_top) * VREF;<commit_msg>ADC top value should be TOP+1 not what I had which was TOP<commit_after>#include "common.h"
#include "uart.h"
#include "params.h"
#include "samples.h"

static double s_adc_top;

void samples_init(uint16_t ovs_bits) //{{{
{
	// determine ADC_TOP with ovsersampling
	s_adc_top = pow(2, (ADC_BITS + ovs_bits));
	verb_printf("adc_top %f\n", s_adc_top);
} //}}}

double sample_v(sample* s, uint8_t warning) //{{{
{
	if (warning && s->signal == s_adc_top)
		fprintf(stderr, "WARNING: maximum voltage, won't hurt anything, but what phone battery has such a high voltage?\n");
	if (s->signal < 0)
		s->signal = 0;
	double v_adcv = (((double)(s->signal)) / s_adc_top) * VREF;
{'fraction_non_alphanumeric': 0.16421378776142526, 'fraction_numerical': 0.010844306738962044, 'mean_word_length': 4.6173913043478265, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '1010735', 'n_tokens_mistral': 529, 'n_tokens_neox': 512, 'n_words': 132}