thermferm/rdconfig.c

changeset 310
53774295e14a
parent 306
97602274eb58
child 312
7b0f819a3805
equal deleted inserted replaced
309:c0dc3cd97fa4 310:53774295e14a
464 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IDLE_RANGE_L", "%.1f", tmp3->idle_rangeL)) < 0) { 464 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IDLE_RANGE_L", "%.1f", tmp3->idle_rangeL)) < 0) {
465 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 465 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
466 return 1; 466 return 1;
467 } 467 }
468 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IDLE_RANGE_H", "%.1f", tmp3->idle_rangeH)) < 0) { 468 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "IDLE_RANGE_H", "%.1f", tmp3->idle_rangeH)) < 0) {
469 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
470 return 1;
471 }
472 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_KP", "%.2f", tmp3->PID_Kp)) < 0) {
473 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
474 return 1;
475 }
476 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_KD", "%.2f", tmp3->PID_Kd)) < 0) {
477 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
478 return 1;
479 }
480 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PID_KI", "%.2f", tmp3->PID_Ki)) < 0) {
469 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement"); 481 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteFormatElement");
470 return 1; 482 return 1;
471 } 483 }
472 if (tmp3->profile) { 484 if (tmp3->profile) {
473 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE", "%s", tmp3->profile)) < 0) { 485 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "PROFILE", "%s", tmp3->profile)) < 0) {
919 unit->temp_set_max = 30.0; 931 unit->temp_set_max = 30.0;
920 unit->idle_rangeH = 1.0; 932 unit->idle_rangeH = 1.0;
921 unit->idle_rangeL = -1.0; 933 unit->idle_rangeL = -1.0;
922 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0; 934 unit->prof_started = unit->prof_paused = unit->prof_primary_done = (time_t)0;
923 unit->prof_percent = 0; 935 unit->prof_percent = 0;
924 unit->PID_err_old = unit->PID_I_err = 0.0; 936 unit->PID_err_old = unit->PID_I_err = unit->PID_Kp = unit->PID_Kd = unit->PID_Ki = 0.0;
925 937
926 cur = cur->xmlChildrenNode; 938 cur = cur->xmlChildrenNode;
927 while (cur != NULL) { 939 while (cur != NULL) {
928 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) { 940 if ((!xmlStrcmp(cur->name, (const xmlChar *)"VERSION"))) {
929 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 941 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1084 } 1096 }
1085 if ((!xmlStrcmp(cur->name, (const xmlChar *)"IDLE_RANGE_H"))) { 1097 if ((!xmlStrcmp(cur->name, (const xmlChar *)"IDLE_RANGE_H"))) {
1086 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1098 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1087 if (sscanf((const char *)key, "%f", &val) == 1) 1099 if (sscanf((const char *)key, "%f", &val) == 1)
1088 unit->idle_rangeH = val; 1100 unit->idle_rangeH = val;
1101 xmlFree(key);
1102 }
1103 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KP"))) {
1104 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1105 if (sscanf((const char *)key, "%f", &val) == 1)
1106 unit->PID_Kp = val;
1107 xmlFree(key);
1108 }
1109 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KD"))) {
1110 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1111 if (sscanf((const char *)key, "%f", &val) == 1)
1112 unit->PID_Kd = val;
1113 xmlFree(key);
1114 }
1115 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PID_KI"))) {
1116 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1117 if (sscanf((const char *)key, "%f", &val) == 1)
1118 unit->PID_Ki = val;
1089 xmlFree(key); 1119 xmlFree(key);
1090 } 1120 }
1091 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) { 1121 if ((!xmlStrcmp(cur->name, (const xmlChar *)"PROFILE"))) {
1092 unit->profile = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1122 unit->profile = (char *)xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1093 } 1123 }

mercurial