Calibrate Beken internal temperature (#6599)

This commit is contained in:
Mat931 2024-04-22 20:59:06 +00:00 committed by GitHub
parent 927caf062b
commit 50e3ce4c80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 23 additions and 3 deletions

View file

@ -55,11 +55,13 @@ void InternalTemperatureSensor::update() {
uint32_t raw, result;
result = temp_single_get_current_temperature(&raw);
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;
#else
#else // USE_LIBRETINY_VARIANT
temperature = raw * 0.128f;
#endif // USE_LIBRETINY_VARIANT_BK7231T
#endif // USE_LIBRETINY_VARIANT
#endif // USE_BK72XX
if (success && std::isfinite(temperature)) {
this->publish_state(temperature);

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"

View file

@ -0,0 +1,3 @@
sensor:
- platform: internal_temperature
name: "Internal Temperature"