437 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PAUSED", "%d", (unsigned int)tmp3->prof_paused)) < 0) { |
437 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PAUSED", "%d", (unsigned int)tmp3->prof_paused)) < 0) { |
438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
438 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
439 return 1; |
439 return 1; |
440 } |
440 } |
441 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STATE", "%s", PROFSTATE[tmp3->prof_state] )) < 0) { |
441 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_STATE", "%s", PROFSTATE[tmp3->prof_state] )) < 0) { |
|
442 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
443 return 1; |
|
444 } |
|
445 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_ABS", "%.3f", tmp3->prof_peak_abs)) < 0) { |
|
446 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
447 return 1; |
|
448 } |
|
449 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PEAK_REL", "%.3f", tmp3->prof_peak_rel)) < 0) { |
|
450 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
|
451 return 1; |
|
452 } |
|
453 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROF_PRIMARY_DONE", "%d", (unsigned int)tmp3->prof_primary_done)) < 0) { |
442 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
454 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); |
443 return 1; |
455 return 1; |
444 } |
456 } |
445 } |
457 } |
446 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
458 if ((rc = xmlTextWriterEndElement(writer)) < 0) { |
847 unit = (units_list *)malloc(sizeof(units_list)); |
859 unit = (units_list *)malloc(sizeof(units_list)); |
848 unit->next = NULL; |
860 unit->next = NULL; |
849 unit->version = 1; |
861 unit->version = 1; |
850 unit->uuid = unit->name = unit->air_address = unit->beer_address = unit->heater_address = \ |
862 unit->uuid = unit->name = unit->air_address = unit->beer_address = unit->heater_address = \ |
851 unit->cooler_address = unit->fan_address = unit->door_address = unit->profile = NULL; |
863 unit->cooler_address = unit->fan_address = unit->door_address = unit->profile = NULL; |
852 unit->volume = 0.0; |
864 unit->volume = unit->prof_peak_abs = unit->prof_peak_rel = 0.0; |
853 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0; |
865 unit->air_temperature = unit->beer_temperature = unit->beer_set = unit->fridge_set = 20.0; |
854 unit->air_state = unit->beer_state = 1; // missing |
866 unit->air_state = unit->beer_state = 1; // missing |
855 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; |
867 unit->heater_state = unit->cooler_state = unit->fan_state = unit->door_state = unit->mode = unit->prof_state = 0; |
856 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ |
868 unit->heater_delay = unit->cooler_delay = unit->fan_delay = 20; /* 5 minutes delay */ |
857 unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0; |
869 unit->heater_wait = unit->cooler_wait = unit->fan_wait = 0; |
858 unit->temp_set_min = 1.0; |
870 unit->temp_set_min = 1.0; |
859 unit->temp_set_max = 30.0; |
871 unit->temp_set_max = 30.0; |
860 unit->idle_rangeH = 1.0; |
872 unit->idle_rangeH = 1.0; |
861 unit->idle_rangeL = -1.0; |
873 unit->idle_rangeL = -1.0; |
862 unit->prof_started = unit->prof_paused = (time_t)0; |
874 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; |
863 unit->prof_percent = 0; |
875 unit->prof_percent = 0; |
864 unit->PID_err_old = unit->PID_I_err = 0.0; |
876 unit->PID_err_old = unit->PID_I_err = 0.0; |
865 |
877 |
866 cur = cur->xmlChildrenNode; |
878 cur = cur->xmlChildrenNode; |
867 while (cur != NULL) { |
879 while (cur != NULL) { |
1013 if (! xmlStrcmp(key, (const xmlChar *)PROFSTATE[i])) { |
1025 if (! xmlStrcmp(key, (const xmlChar *)PROFSTATE[i])) { |
1014 unit->prof_state = i; |
1026 unit->prof_state = i; |
1015 break; |
1027 break; |
1016 } |
1028 } |
1017 } |
1029 } |
|
1030 xmlFree(key); |
|
1031 } |
|
1032 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_ABS"))) { |
|
1033 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1034 if (sscanf((const char *)key, "%f", &val) == 1) |
|
1035 unit->prof_peak_abs = val; |
|
1036 xmlFree(key); |
|
1037 } |
|
1038 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PEAK_REL"))) { |
|
1039 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1040 if (sscanf((const char *)key, "%f", &val) == 1) |
|
1041 unit->prof_peak_rel = val; |
|
1042 xmlFree(key); |
|
1043 } |
|
1044 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROF_PRIMARY_DONE"))) { |
|
1045 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); |
|
1046 if (sscanf((const char *)key, "%d", &ival) == 1) |
|
1047 unit->prof_primary_done = ival; |
1018 xmlFree(key); |
1048 xmlFree(key); |
1019 } |
1049 } |
1020 cur = cur->next; |
1050 cur = cur->next; |
1021 } |
1051 } |
1022 |
1052 |