Add unit support to sensors

This commit is contained in:
Carl Philipp Klemm 2026-03-29 22:11:10 +02:00
parent 3e0ba165e8
commit 37c0c5d17b
12 changed files with 73 additions and 41 deletions

View file

@ -65,7 +65,7 @@ void PolynomalActor::load(const QJsonObject& json, bool preserve)
pow2_ = json["Pow2"].toDouble(0);
pow1_ = json["Pow1"].toDouble(1);
pow0_ = json["Pow0"].toDouble(0);
sensor_.type = json["SensorType"].toInt(0);
sensor_.type = static_cast<Sensor::sensor_type_t>(json["SensorType"].toInt(0));
sensor_.id = json["SensorId"].toInt(0);
sensor_.field = json["SensorField"].toInt(0);
sensor_.name = json["SensorName"].toString("Sensor");

View file

@ -100,7 +100,7 @@ void Regulator::load(const QJsonObject& json, bool preserve)
setPoint_ = json["SetPoint"].toDouble(22);
safeValue_ = json["SafeValue"].toDouble(0);
timeout_ = json["Timeout"].toDouble(1800);
sensor_.type = json["SensorType"].toInt(0);
sensor_.type = static_cast<Sensor::sensor_type_t>(json["SensorType"].toInt(0));
sensor_.id = json["SensorId"].toInt(0);
sensor_.field = json["SensorField"].toInt(0);
sensor_.name = json["SensorName"].toString("Sensor");

View file

@ -65,7 +65,7 @@ void SensorActor::load(const QJsonObject& json, bool preserve)
Actor::load(json, preserve);
sloap_ = json["Sloap"].toInt(0);
threshold_ = json["Threshold"].toDouble(0);
sensor_.type = json["SensorType"].toInt(0);
sensor_.type = static_cast<Sensor::sensor_type_t>(json["SensorType"].toInt(0));
sensor_.id = json["SensorId"].toInt(0);
sensor_.field = json["SensorField"].toInt(0);
sensor_.name = json["SensorName"].toString("Sensor");