Showing 2 changed files with 31 additions and 0 deletions
+26
Nasal/buttons.nas
... ...
@@ -305,6 +305,32 @@ var buttonsClass = {
305 305
                     }
306 306
                 }
307 307
             },
308
+            {text: 'Volume    :', type: 'normal', scrollgroup: 6},
309
+            {text: units.volume.from_l == 1 ? '   l  >' : (units.volume.from_gal == 1 ?  '< gal  ' : '<  m3  '),
310
+                type: 'editable|end-of-line',
311
+                choices: ['   l  >', '<  m3 >', '< gal  '],
312
+                scrollgroup: 6,
313
+                callback: func (id, selected) {
314
+                    var u = string.trim(me.device.windows.state[id].objects[selected].text, 0, func (c) c == ` ` or c == `<` or c == `>`);
315
+                    if (u == 'l') {
316
+                        units.volume.from_l   = 1;
317
+                        units.volume.from_gal = 3.78541178;
318
+                        units.volume.from_m3  = 1000;
319
+                    }
320
+                    elsif (u == 'm3') {
321
+                        units.volume.from_l   = 0.001;
322
+                        units.volume.from_gal = 1 / 0.26417 / 1000;
323
+                        units.volume.from_m3  = 1;
324
+                    }
325
+                    else {
326
+                        units.volume.from_l   = 0.26417;
327
+                        units.volume.from_gal = 1;
328
+                        units.volume.from_m3  = units.volume.from_l / 1000;
329
+                    }
330
+                    foreach (var from; keys(units.volume))
331
+                        zkv.getNode('save/volume', 1).setDoubleValue(from, units.volume[from]);
332
+                }
333
+            },
308 334
             {type: 'separator'},
309 335
             {text: 'TIME REF: ', type: 'normal'},
310 336
             {text: data.settings.time.actual,
+5
zkv1000.nas
... ...
@@ -48,6 +48,11 @@ var units = {
48 48
         from_C : func (c) return c,
49 49
         from_F : func (f) return (f -32) / 1.8,
50 50
     },
51
+    volume: {
52
+        from_l: 1,
53
+        from_gal: 3.78541178,
54
+        from_m3: 1000,
55
+    },
51 56
 };
52 57
 
53 58
 var data = { # set of data common to all devices