Pārlūkot izejas kodu

Remove bat_alarm and cleanup

Avetisyan Karen 8 gadi atpakaļ
vecāks
revīzija
fc7e36e6fc
1 mainītis faili ar 8 papildinājumiem un 62 dzēšanām
  1. 8 62
      web_interface/src/wui/main.js

+ 8 - 62
web_interface/src/wui/main.js

@@ -33,7 +33,7 @@ var ac          = $('AC'),
   bat_cap       = $('bat_cap'),
   inner_temp    = $('inner_temp'),
   battimeleft   = $('bat_time_left'),
-  alarm         = $('alarm'),
+  // alarm         = $('alarm'),
   sPower        = $('sPower'),
   sBattery      = $('sBattery');
 var battempCtrlChecked;
@@ -65,47 +65,8 @@ function Dec2Bin(n){if(!checkDec(n)||n<0)return 0;return n.toString(2);}
 
 // Alarm colors
 var ALARM_RED    = '#ff5050',
-    ALARM_YELLOW = '#f0ad4e',
-    ALARM_GREEN  = '#33cc00';
-
-
-
-function checkState() {
-
-  // Asign variable to alarm bit mask number
-  var INPUT_VOLTAGE_H = 0,
-      INPUT_VOLTAGE_L = 1,
-      OUTPUT_VOLTAGE  = 2,
-      CURRENT_CONS    = 3,
-      LOAD_VOLTAGE    = 4,
-      LOAD_CURRENT    = 5,
-      INNER_TEMP      = 6,
-      DOOR_SENS       = 7,
-      ACB_TEMP        = 8,
-      ACB_VOLTAGE     = 9,
-      ACB_CURRENT     = 10,
-      ACB_SYMMETRY    = 11,
-      CURRENT_CONS_A  = 12;
-
-  // Alarm bit mask parser
-  function A (num) {
-    var a = alarm.innerHTML;
-    var b = parseInt(a.split('').reverse().join(''), 2);
-    var answ = (b & (1 << num)) >> num;
-    return answ;
-  }
-  function rgb2hex(rgb) {
-    if (/^#[0-9A-F]{6}$/i.test(rgb)) return rgb;
-
-    rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
-    function hex(x) {
-      return ('0' + parseInt(x).toString(16)).slice(-2);
-    }
-    return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
-  }
-}
-
-
+  ALARM_YELLOW = '#f0ad4e',
+  ALARM_GREEN  = '#33cc00';
 
 //########## Settings Inform Boxes ############
 
@@ -118,19 +79,7 @@ function HTMLcreate(htmlStr) {
   }
   return frag;
 }
-// fade out animation
-// function fadeOut(el){
-//   el.style.opacity = 1;
-
-//   (function fade() {
-//     if ((val -= 0.05) < 0) {
-//       el.style.display = 'none';
-//     } else {
-//       var request = window.requestFrame('request');
-//       request(fade);
-//     }
-//   })();
-// }
+
 // fade in animation
 function fadeIn(el, display){
   el.style.opacity = 0;
@@ -492,13 +441,11 @@ function paramsRefresh() {
     var alrm = Dec2Bin(+data.alarm);
     var pstate = [];
     var bstate = [];
-    // var alrm = data.alarm;
     var ups_bypass =   Alarm(alrm, 5),
       ups_alarm =    Alarm(alrm, 4) || Alarm(alrm, 7),
       ups_standby =  Alarm(alrm, 3),
       ups_shutdown = Alarm(alrm, 1),
 
-      bat_alarm =    Alarm(alrm, 1),
       bat_low =      Alarm(alrm, 6),
       bat_test =     Alarm(alrm, 2);
     // PPS
@@ -514,8 +461,7 @@ function paramsRefresh() {
     ups_standby ? pstate.push('clock') : null;
     ups_shutdown ? pstate.push('shutdown') : null;
 
-    bat_alarm ? bstate.push('exclamination') : bstate.push('normal');
-    bat_low ? bstate.push('batteryLow') : null;
+    bat_low ? bstate.push('batteryLow') : bstate.push('normal');
     bat_test ? bstate.push('batTest') : null;
 
     setIcons('pstate_icons', pstate);
@@ -574,9 +520,9 @@ function getPage(pn){
       $('history_data').appendChild(tr);
     }
     // utcParam = data.utc;
-    setCookie('netsettings_changed', data.netsettings_changed);
-    setCookie('profilaction_changed', data.profilaction_changed);
-    setCookie('need_confirm', data.need_confirm);
+    window.setCookie('netsettings_changed', data.netsettings_changed);
+    window.setCookie('profilaction_changed', data.profilaction_changed);
+    window.setCookie('need_confirm', data.need_confirm);
     // checkNotify();
     clearTimeout(mint);
     mint = setTimeout(history_dataref, 5000);