1
#ifndef TK_CALIBRATION_H
2
#define TK_CALIBRATION_H
4
* Attiny calibration header.
5
* This allows using a single set of hardcoded values across multiple projects.
7
* Copyright (C) 2015 Selene Scriven
9
* This program is free software: you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation, either version 3 of the License, or
12
* (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
/********************** Voltage ADC calibration **************************/
26
// First values are from Dale's wight+1 driver measurements - these
27
// value also work well for the BLF Q8 SRK drivers
29
// See battcheck/readings.txt for reference values.
32
// The ADC values we expect for specific voltages: 2.2v to 4.4v. This is
33
// for using R1=220K/22K, R2=47K/4.7K, and direct connection from Batt+
34
// to R1, no diode in-between
37
#define ADC_42 175 // 100%
39
#define ADC_40 167 // 75%
41
#define ADC_38 159 // 50%
44
#define ADC_35 146 // 25%
49
#define ADC_30 124 // 0%
61
// The ADC values we expect for specific voltages: 4.4V to 8.8V (2.2v to 4.4v). This is
62
// for using R1=360K/36K, R2=47K/4.7K, and direct connection from Batt+
63
// to R1, no diode in-between, with an LDO and a 2S battery configuration.
66
#define ADC_42 225 // 100%
68
#define ADC_40 214 // 75%
70
#define ADC_38 203 // 50%
73
#define ADC_35 187 // 25%
78
#define ADC_30 161 // 0%
90
//#define ADC_100p ADC_42 // the ADC value for 100% full (resting)
91
//#define ADC_75p ADC_40 // the ADC value for 75% full (resting)
92
//#define ADC_50p ADC_38 // the ADC value for 50% full (resting)
93
//#define ADC_25p ADC_35 // the ADC value for 25% full (resting)
94
//#define ADC_0p ADC_30 // the ADC value for 0% full (resting)
95
#define ADC_LOW ADC_32 // When do we start ramping down
96
#define ADC_CRIT ADC_30 // When do we shut the light off
99
/********************** Offtime capacitor calibration ********************/
100
// Values are between 1 and 255, and can be measured with offtime-cap.c
101
// See battcheck/otc-readings.txt for reference values.
102
// These #defines are the edge boundaries, not the center of the target.
104
// The OTC value 0.5s after being disconnected from power
105
// (anything higher than this is a "short press")
106
#define CAP_SHORT 190
107
// The OTC value 1.5s after being disconnected from power
108
// Between CAP_MED and CAP_SHORT is a "medium press"
110
// Below CAP_MED is a long press
112
// The OTC value 1.0s after being disconnected from power
113
// Anything higher than this is a short press, lower is a long press
114
#define CAP_SHORT 115
118
#endif // TK_CALIBRATION_H