mirror of
https://github.com/esphome/esphome.git
synced 2024-12-01 19:24:14 +01:00
Calibrate Beken internal temperature (#6599)
This commit is contained in:
parent
1a152169e0
commit
a29e634af1
7 changed files with 23 additions and 3 deletions
|
@ -55,11 +55,13 @@ void InternalTemperatureSensor::update() {
|
||||||
uint32_t raw, result;
|
uint32_t raw, result;
|
||||||
result = temp_single_get_current_temperature(&raw);
|
result = temp_single_get_current_temperature(&raw);
|
||||||
success = (result == 0);
|
success = (result == 0);
|
||||||
#ifdef USE_LIBRETINY_VARIANT_BK7231T
|
#if defined(USE_LIBRETINY_VARIANT_BK7231N)
|
||||||
|
temperature = raw * -0.38f + 156.0f;
|
||||||
|
#elif defined(USE_LIBRETINY_VARIANT_BK7231T)
|
||||||
temperature = raw * 0.04f;
|
temperature = raw * 0.04f;
|
||||||
#else
|
#else // USE_LIBRETINY_VARIANT
|
||||||
temperature = raw * 0.128f;
|
temperature = raw * 0.128f;
|
||||||
#endif // USE_LIBRETINY_VARIANT_BK7231T
|
#endif // USE_LIBRETINY_VARIANT
|
||||||
#endif // USE_BK72XX
|
#endif // USE_BK72XX
|
||||||
if (success && std::isfinite(temperature)) {
|
if (success && std::isfinite(temperature)) {
|
||||||
this->publish_state(temperature);
|
this->publish_state(temperature);
|
||||||
|
|
3
tests/components/internal_temperature/test.bk72xx.yaml
Normal file
3
tests/components/internal_temperature/test.bk72xx.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
3
tests/components/internal_temperature/test.esp32-c3.yaml
Normal file
3
tests/components/internal_temperature/test.esp32-c3.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
3
tests/components/internal_temperature/test.esp32.yaml
Normal file
3
tests/components/internal_temperature/test.esp32.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
3
tests/components/internal_temperature/test.rp2040.yaml
Normal file
3
tests/components/internal_temperature/test.rp2040.yaml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
sensor:
|
||||||
|
- platform: internal_temperature
|
||||||
|
name: "Internal Temperature"
|
Loading…
Reference in a new issue