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:
@@ -38,6 +38,9 @@ void initVariant()
|
||||
pinMode(PIN_3V3_ACC_EN, OUTPUT);
|
||||
digitalWrite(PIN_3V3_ACC_EN, HIGH);
|
||||
|
||||
pinMode(T1000X_SENSOR_EN_PIN, OUTPUT);
|
||||
digitalWrite(T1000X_SENSOR_EN_PIN, HIGH);
|
||||
|
||||
pinMode(BUZZER_EN_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_EN_PIN, HIGH);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ extern "C" {
|
||||
#define BATTERY_PIN 2 // P0.02/AIN0, BAT_ADC
|
||||
#define BATTERY_IMMUTABLE
|
||||
#define ADC_MULTIPLIER (2.0F)
|
||||
// P0.04/AIN2 is VCC_ADC, P0.05/AIN3 is CHARGER_DET, P1.03 is CHARGE_STA, P1.04 is CHARGE_DONE
|
||||
// P0.04 is sensor power enable, P0.05/AIN3 is CHARGER_DET, P1.03 is CHARGE_STA, P1.04 is CHARGE_DONE
|
||||
|
||||
#define EXT_CHRG_DETECT (32 + 3) // P1.03
|
||||
#define EXT_CHRG_DETECT_VALUE LOW
|
||||
@@ -148,9 +148,9 @@ extern "C" {
|
||||
#define PIN_BUZZER (0 + 25) // P0.25, pwm output
|
||||
|
||||
#define T1000X_SENSOR_EN
|
||||
#define T1000X_VCC_PIN (0 + 4) // P0.4
|
||||
#define T1000X_NTC_PIN (0 + 31) // P0.31/AIN7
|
||||
#define T1000X_LUX_PIN (0 + 29) // P0.29/AIN5
|
||||
#define T1000X_SENSOR_EN_PIN (0 + 4) // P0.4, Power to Sensor (GPIO, not ADC)
|
||||
#define T1000X_NTC_PIN (0 + 31) // P0.31/AIN7
|
||||
#define T1000X_LUX_PIN (0 + 29) // P0.29/AIN5
|
||||
|
||||
#define HAS_SCREEN 0
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ void initVariant()
|
||||
pinMode(PIN_3V3_ACC_EN, OUTPUT);
|
||||
digitalWrite(PIN_3V3_ACC_EN, LOW);
|
||||
|
||||
pinMode(T1000X_SENSOR_EN_PIN, OUTPUT);
|
||||
digitalWrite(T1000X_SENSOR_EN_PIN, HIGH);
|
||||
|
||||
pinMode(BUZZER_EN_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_EN_PIN, HIGH);
|
||||
|
||||
|
||||
@@ -143,9 +143,9 @@ extern "C" {
|
||||
#define PIN_BUZZER (0 + 25) // P0.25, pwm output
|
||||
|
||||
#define T1000X_SENSOR_EN
|
||||
#define T1000X_VCC_PIN (0 + 4) // P0.4
|
||||
#define T1000X_NTC_PIN (0 + 31) // P0.31
|
||||
#define T1000X_LUX_PIN (0 + 29) // P0.29
|
||||
#define T1000X_SENSOR_EN_PIN (0 + 4) // P0.4, Power to Sensor (GPIO, not ADC)
|
||||
#define T1000X_NTC_PIN (0 + 31) // P0.31
|
||||
#define T1000X_LUX_PIN (0 + 29) // P0.29
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user