homebridge-melcloud-control 4.4.0-beta.13 → 4.4.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/functions.js +14 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"displayName": "MELCloud Control",
|
|
3
3
|
"name": "homebridge-melcloud-control",
|
|
4
|
-
"version": "4.4.0-beta.
|
|
4
|
+
"version": "4.4.0-beta.14",
|
|
5
5
|
"description": "Homebridge plugin to control Mitsubishi Air Conditioner, Heat Pump and Energy Recovery Ventilation.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "grzegorz914",
|
package/src/functions.js
CHANGED
|
@@ -242,33 +242,38 @@ class Functions extends EventEmitter {
|
|
|
242
242
|
let min = oldMin;
|
|
243
243
|
let max = oldMax;
|
|
244
244
|
|
|
245
|
-
// Zmiana MIN
|
|
246
245
|
if (newValue !== oldMin) {
|
|
246
|
+
// użytkownik zmienił MIN
|
|
247
247
|
min = Math.min(Math.max(newValue, minRangeMin), maxRangeMin);
|
|
248
248
|
|
|
249
|
-
// jeśli min rośnie i różnica < 2 → podbij max
|
|
250
249
|
if (min > oldMin && max - min < 2) {
|
|
250
|
+
// podbij max minimalnie potrzebną wartość
|
|
251
251
|
max = Math.min(min + 2, maxRangeMax);
|
|
252
|
+
return { min, max };
|
|
252
253
|
}
|
|
253
|
-
|
|
254
|
-
|
|
254
|
+
// min maleje → zwracamy tylko min
|
|
255
|
+
return { min };
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
-
|
|
257
|
+
|
|
258
|
+
if (newValue !== oldMax) {
|
|
259
|
+
// użytkownik zmienił MAX
|
|
258
260
|
max = Math.min(Math.max(newValue, minRangeMax), maxRangeMax);
|
|
259
261
|
|
|
260
|
-
// jeśli max maleje i różnica < 2 → obniż min
|
|
261
262
|
if (max < oldMax && max - min < 2) {
|
|
263
|
+
// obniż min minimalnie potrzebną wartość
|
|
262
264
|
min = Math.max(max - 2, minRangeMin);
|
|
265
|
+
return { min, max };
|
|
263
266
|
}
|
|
264
|
-
|
|
265
|
-
|
|
267
|
+
// max rośnie → zwracamy tylko max
|
|
268
|
+
return { max };
|
|
266
269
|
}
|
|
267
270
|
|
|
271
|
+
// brak zmiany
|
|
268
272
|
return { min, max };
|
|
269
273
|
}
|
|
270
274
|
|
|
271
275
|
|
|
276
|
+
|
|
272
277
|
}
|
|
273
278
|
|
|
274
279
|
export default Functions
|