1503 unit->temp_set_max = 30.0; |
1503 unit->temp_set_max = 30.0; |
1504 unit->idle_rangeH = 1.0; |
1504 unit->idle_rangeH = 1.0; |
1505 unit->idle_rangeL = -1.0; |
1505 unit->idle_rangeL = -1.0; |
1506 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; |
1506 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; |
1507 unit->prof_percent = 0; |
1507 unit->prof_percent = 0; |
1508 unit->PID_err_old = unit->PID_I_err = 0.0; |
1508 unit->PID_err_old = unit->PID_I_err = unit->PID_Kp = unit->PID_Kd = unit->PID_Ki = 0.0; |
1509 |
1509 |
1510 /* |
1510 /* |
1511 * Block main process |
1511 * Block main process |
1512 */ |
1512 */ |
1513 run_pause = TRUE; |
1513 run_pause = TRUE; |
1613 srv_send((char *)"PROF_PRIMARY_DONE,%d", (int)unit->prof_primary_done); |
1613 srv_send((char *)"PROF_PRIMARY_DONE,%d", (int)unit->prof_primary_done); |
1614 srv_send((char *)"TEMP_SET_MIN,%.1f", unit->temp_set_min); |
1614 srv_send((char *)"TEMP_SET_MIN,%.1f", unit->temp_set_min); |
1615 srv_send((char *)"TEMP_SET_MAX,%.1f", unit->temp_set_max); |
1615 srv_send((char *)"TEMP_SET_MAX,%.1f", unit->temp_set_max); |
1616 srv_send((char *)"IDLE_RANGE_L,%.1f", unit->idle_rangeL); |
1616 srv_send((char *)"IDLE_RANGE_L,%.1f", unit->idle_rangeL); |
1617 srv_send((char *)"IDLE_RANGE_H,%.1f", unit->idle_rangeH); |
1617 srv_send((char *)"IDLE_RANGE_H,%.1f", unit->idle_rangeH); |
|
1618 srv_send((char *)"PID_KP,%.2f", unit->PID_Kp); |
|
1619 srv_send((char *)"PID_KD,%.2f", unit->PID_Kd); |
|
1620 srv_send((char *)"PID_KI,%.2f", unit->PID_Ki); |
1618 srv_send((char *)"."); |
1621 srv_send((char *)"."); |
1619 return 1; |
1622 return 1; |
1620 } |
1623 } |
1621 } |
1624 } |
1622 srv_send((char *)"440 No such unit"); |
1625 srv_send((char *)"440 No such unit"); |
1873 unit->fridge_set = fval; |
1876 unit->fridge_set = fval; |
1874 } |
1877 } |
1875 |
1878 |
1876 } else if (val && (strcmp(kwd, (char *)"BEER_SET") == 0)) { |
1879 } else if (val && (strcmp(kwd, (char *)"BEER_SET") == 0)) { |
1877 if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) { |
1880 if ((sscanf(val, "%f", &fval) == 1) && (fval >= unit->temp_set_min) && (fval <= unit->temp_set_max)) { |
1878 if (unit->fridge_set != fval) |
1881 if (unit->beer_set != fval) |
1879 syslog(LOG_NOTICE, "Fermenter unit %s beer temperature %.1f to %.1f", unit->uuid, unit->beer_set, fval); |
1882 syslog(LOG_NOTICE, "Fermenter unit %s beer temperature %.1f to %.1f", unit->uuid, unit->beer_set, fval); |
1880 unit->beer_set = fval; |
1883 unit->beer_set = fval; |
|
1884 } |
|
1885 |
|
1886 } else if (val && (strcmp(kwd, (char *)"PID_KP") == 0)) { |
|
1887 if ((sscanf(val, "%f", &fval) == 1) && (fval >= 0.0)) { |
|
1888 if (unit->PID_Kp != fval) |
|
1889 syslog(LOG_NOTICE, "Fermenter unit %s PID Kp %.2f to %.2f", unit->uuid, unit->PID_Kp, fval); |
|
1890 unit->PID_Kp = fval; |
|
1891 } |
|
1892 |
|
1893 } else if (val && (strcmp(kwd, (char *)"PID_KD") == 0)) { |
|
1894 if ((sscanf(val, "%f", &fval) == 1) && (fval >= 0.0)) { |
|
1895 if (unit->PID_Kd != fval) |
|
1896 syslog(LOG_NOTICE, "Fermenter unit %s PID Kd %.2f to %.2f", unit->uuid, unit->PID_Kd, fval); |
|
1897 unit->PID_Kd = fval; |
|
1898 } |
|
1899 |
|
1900 } else if (val && (strcmp(kwd, (char *)"PID_KI") == 0)) { |
|
1901 if ((sscanf(val, "%f", &fval) == 1) && (fval >= 0.0)) { |
|
1902 if (unit->PID_Ki != fval) |
|
1903 syslog(LOG_NOTICE, "Fermenter unit %s PID Ki %.2f to %.2f", unit->uuid, unit->PID_Ki, fval); |
|
1904 unit->PID_Ki = fval; |
1881 } |
1905 } |
1882 |
1906 |
1883 } else if (strcmp(kwd, (char *)"PROFILE") == 0) { |
1907 } else if (strcmp(kwd, (char *)"PROFILE") == 0) { |
1884 if (unit->prof_state == PROFILE_OFF) { |
1908 if (unit->prof_state == PROFILE_OFF) { |
1885 /* |
1909 /* |