Easytherm : temperature setpoint = 0 ... not communicated to the Easytherm (= no change) ... is the default value, ver. 2.14.576
This commit is contained in:
@@ -128,22 +128,25 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
/// <returns>true = OK, false = any error</returns>
|
||||
public bool SetTemperatureSetpoint(float temperature)
|
||||
{
|
||||
if (temperature < 0 || temperature > 100.0f)
|
||||
if (temperature != 0 && (temperature < 5 || temperature > 95.0f))
|
||||
{
|
||||
return false; /// required temperature out of range
|
||||
return false; /// required temperature out of range
|
||||
}
|
||||
|
||||
if (temperatureSetPointValid && (temperature == temperatureSetPoint))
|
||||
{
|
||||
return true; /// already set to the required temperature
|
||||
return true; /// already set to the required temperature
|
||||
}
|
||||
|
||||
//ushort temperatureSetpoint = (ushort)temperature; // in °C
|
||||
//ushort destAddress = (ushort)1002;
|
||||
ushort usTempSetpoint = (ushort)((10000.0f / 400.0f) * temperature); // in 0.01% of range (400 °C)
|
||||
ushort destAddress = (ushort)2;
|
||||
///
|
||||
SendValueToEasytherm(Function.PresetSingleRegister, destAddress, usTempSetpoint);
|
||||
if (temperature != 0) /// temperature==0 disables sending the setpoint
|
||||
{
|
||||
//ushort temperatureSetpoint = (ushort)temperature; // in °C
|
||||
//ushort destAddress = (ushort)1002;
|
||||
ushort usTempSetpoint = (ushort)((10000.0f / 400.0f) * temperature); // in 0.01% of range (400 °C)
|
||||
ushort destAddress = (ushort)2;
|
||||
///
|
||||
SendValueToEasytherm(Function.PresetSingleRegister, destAddress, usTempSetpoint);
|
||||
}
|
||||
|
||||
temperatureSetPoint = temperature;
|
||||
temperatureSetPointValid = true;
|
||||
|
||||
@@ -11,12 +11,12 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
public class ProcParams : ProcedureParamsBase, IParamsProvider, IProcedureParams
|
||||
{
|
||||
public float RequiredTemp; /// [°C] target temperature for temperature controlled
|
||||
public float RequiredTemp; /// [°C] target temperature for a temperature controller or 0=not communicated to the controller
|
||||
|
||||
|
||||
public override void InitializeAll()
|
||||
{
|
||||
RequiredTemp = 20.0f;
|
||||
RequiredTemp = 0.0f;
|
||||
}
|
||||
|
||||
string[] paramNames = new string[]
|
||||
@@ -30,7 +30,7 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: return RequiredTemp.ToString();
|
||||
case 0: return (RequiredTemp == 0) ? "---" : RequiredTemp.ToString();
|
||||
default: return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,18 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: RequiredTemp = Utils.ParseUFloat(strValue); return;
|
||||
default: return;
|
||||
case 0:
|
||||
if (strValue == "-" || strValue == "--" || strValue == "---")
|
||||
{
|
||||
RequiredTemp = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
RequiredTemp = Utils.ParseUFloat(strValue);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +69,11 @@ namespace TBF.BenchControl.Modbus.Easytherm
|
||||
switch (i)
|
||||
{
|
||||
case 0: /// T_hot_heating
|
||||
if (Utils.TryParseUFloat(strValue, out temp) && temp > 0 && temp < 100.0f)
|
||||
if (strValue == "-" || strValue == "--" || strValue == "---" ||
|
||||
(Utils.TryParseUFloat(strValue, out temp) && (temp == 0 || (temp >= 5 && temp <= 95.0f))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
message = "Invalid index";
|
||||
|
||||
Reference in New Issue
Block a user