fix(t1000e): reclassify P0.04 as sensor power enable GPIO (#9826)

P0.04 is a digital power-enable pin for the NTC/LUX sensors, not an ADC
input. The old code was calling analogRead() on a floating GPIO that
happened to read ~mid-rail, coincidentally producing reasonable
temperature values.

- Rename T1000X_VCC_PIN to T1000X_SENSOR_EN_PIN and drive it HIGH in
initVariant() for both T1000-E and T1000-S variants
- Read BATTERY_PIN (with ADC_MULTIPLIER) instead, clamped to the 3.0V
LDO output (NTC_REF_VCC) for the NTC resistance calculation
This commit is contained in:
Wessel
2026-03-06 05:41:37 -06:00
committed by GitHub
co-authored by GitHub
parent 969aefa551
commit cb28c38828
5 changed files with 19 additions and 9 deletions
@@ -73,11 +73,15 @@ float T1000xSensor::getTemp()
float Vout = 0, Rt = 0, temp = 0;
float Temp = 0;
// P0.4 is a sensor power enable GPIO, not a VCC ADC pin.
// Read BATTERY_PIN (with voltage divider) and cap at NTC_REF_VCC to estimate the sensor rail voltage.
for (uint32_t i = 0; i < T1000X_SENSE_SAMPLES; i++) {
vcc_vot += analogRead(T1000X_VCC_PIN);
vcc_vot += analogRead(BATTERY_PIN);
}
vcc_vot = vcc_vot / T1000X_SENSE_SAMPLES;
vcc_vot = 2 * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * vcc_vot;
vcc_vot = ADC_MULTIPLIER * ((1000 * AREF_VOLTAGE) / pow(2, BATTERY_SENSE_RESOLUTION_BITS)) * vcc_vot;
if (vcc_vot > NTC_REF_VCC)
vcc_vot = NTC_REF_VCC;
for (uint32_t i = 0; i < T1000X_SENSE_SAMPLES; i++) {
ntc_vot += analogRead(T1000X_NTC_PIN);