mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 00:18:11 +01:00
Calibrate Beken internal temperature (#6599)
This commit is contained in:
parent
927caf062b
commit
50e3ce4c80
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