main/task_ds18b20.c

changeset 103
1885d0c75c48
parent 88
7f02dbee58d0
equal deleted inserted replaced
102:96e30a3a3980 103:1885d0c75c48
24 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR 24 #ifdef CONFIG_TEMP_SENSORS_SIMULATOR
25 #define SAMPLE_PERIOD (750) // milliseconds 25 #define SAMPLE_PERIOD (750) // milliseconds
26 26
27 float Fake_MLT = 18.90; 27 float Fake_MLT = 18.90;
28 float Fake_HLT = 18.70; 28 float Fake_HLT = 18.70;
29 extern double Output;
29 #endif 30 #endif
30 31
31 static const char *TAG = "task_ds18b20"; 32 static const char *TAG = "task_ds18b20";
32 33
33 SemaphoreHandle_t xSemaphoreDS18B20 = NULL; 34 SemaphoreHandle_t xSemaphoreDS18B20 = NULL;
216 if (Plate_MLT > Fake_MLT) 217 if (Plate_MLT > Fake_MLT)
217 Plate_MLT -= SAMPLE_PERIOD * 0.00002 * (Plate_MLT - Fake_MLT); 218 Plate_MLT -= SAMPLE_PERIOD * 0.00002 * (Plate_MLT - Fake_MLT);
218 } 219 }
219 // If plate is hotter then the water with a offset so that cooling later works. 220 // If plate is hotter then the water with a offset so that cooling later works.
220 if (Plate_MLT > (Fake_MLT + 5.0)) { 221 if (Plate_MLT > (Fake_MLT + 5.0)) {
221 if (Fake_MLT < 100.05) 222 if (Fake_MLT < 100.05) {
222 Fake_MLT += SAMPLE_PERIOD * 0.000001 * (Plate_MLT - Fake_MLT); 223 if (equipment.Hendi)
224 Fake_MLT += SAMPLE_PERIOD * 0.000001 * (Plate_MLT - Fake_MLT) * (Output / 255.0) * 2;
225 else
226 Fake_MLT += SAMPLE_PERIOD * 0.000001 * (Plate_MLT - Fake_MLT);
227 }
223 } 228 }
224 // Allways loose heat to the air 229 // Allways loose heat to the air
225 if (Fake_MLT > 16.0) { 230 if (Fake_MLT > 16.0) {
226 Fake_MLT -= SAMPLE_PERIOD * 0.00000010 * (Fake_MLT - 16.0); 231 Fake_MLT -= SAMPLE_PERIOD * 0.00000010 * (Fake_MLT - 16.0);
227 } 232 }

mercurial