瀏覽代碼

no message

MS-PDRLKVHCADMG\Administrator 5 年之前
父節點
當前提交
2030393b31
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. 13 2
      api/application/controllers/Lampcontrol.php

+ 13 - 2
api/application/controllers/Lampcontrol.php

@@ -628,6 +628,8 @@ class Lampcontrol extends Base_Controller {
         $data['tenth_light_time']    = $this->input->post('tenth_light_time',true);
         $data['tenth_light_human_power']    = $this->input->post('tenth_light_human_power',true);
         $data['tenth_light_unman_power']    = $this->input->post('tenth_light_unman_power',true);
+        $data['induction_delay_status']    = $this->input->post('induction_delay_status',true);
+        $data['induction_delay']    = $this->input->post('induction_delay',true);
         // foreach ($data as $key => $value) {
         //     $data[$key] = urldecode($value);
         // }
@@ -675,6 +677,8 @@ class Lampcontrol extends Base_Controller {
         $data['tenth_light_time']    = $this->input->post('tenth_light_time',true);
         $data['tenth_light_human_power']    = $this->input->post('tenth_light_human_power',true);
         $data['tenth_light_unman_power']    = $this->input->post('tenth_light_unman_power',true);
+        $data['induction_delay_status']    = intval($this->input->post('induction_delay_status',true));
+        $data['induction_delay']    = $this->input->post('induction_delay',true);
 
         $sendData = '';
         foreach ($data as $key => $value) {
@@ -689,6 +693,8 @@ class Lampcontrol extends Base_Controller {
                 $word = substr('00'.base_convert($m, 10, 16), -2);
             }elseif ($key == 'load_current') {
                 $word = substr('0000'.base_convert(round($value/10), 10, 16), -4);
+            }elseif ($key == 'induction_delay') {
+                $word = substr('00'.base_convert(round($value/10), 10, 16), -4);
             }else{
                 $word = substr('00'.base_convert($value, 10, 16), -2);
             }
@@ -801,11 +807,12 @@ class Lampcontrol extends Base_Controller {
         $data['light_voltage']         = $this->input->post('light_voltage',true);  // 光控电压
         $data['light_voltage']  *= 10;
         $data['light_delay_time']         = $this->input->post('light_delay_time',true);  // 光控延时时间
+        $data['light_delay_time'] = round($data['light_delay_time']/10);
 
         $lampData = $this->Lamp_model->get_one($where,'projectid,address,number');
         $sendData = '';
         foreach ($data as $k=>$v) {
-            if ($k == 'light_voltage' || $k == 'light_delay_time' || $k == 'balan_char_interval' || $k == 'temper_compen_coeff') {
+            if ($k == 'light_voltage' || $k == 'balan_char_interval' || $k == 'temper_compen_coeff') {
                 $word = substr('00'.base_convert($v, 10, 16), -2);
             }elseif ($k == 'char_upper_limit_temper' || $k == 'char_lower_limit_temper') {
                 if ($v < 0){
@@ -1068,6 +1075,8 @@ class Lampcontrol extends Base_Controller {
             $update['tenth_light_time']    = '00:00';
             $update['tenth_light_human_power']    = '50';
             $update['tenth_light_unman_power']    = '20';
+            $update['induction_delay_status']    = '0';
+            $update['induction_delay']    = '10';
         }else{  // 蓄电池参数
 
             $update['system_voltage']                 = '12';  // 电池电压
@@ -1141,6 +1150,8 @@ class Lampcontrol extends Base_Controller {
                 $data['tenth_light_time'] = base_convert(substr($res['msg'], 66,2), 16, 10).''; // 晨亮时间
                 $data['tenth_light_human_power'] = base_convert(substr($res['msg'], 68,2), 16, 10).''; // 晨亮有人功率
                 $data['tenth_light_unman_power'] = base_convert(substr($res['msg'], 70,2), 16, 10).''; // 晨亮无人功率
+                $data['induction_delay_status'] = base_convert(substr($res['msg'], 70,2), 16, 10).''; // 感应延时开关状态
+                $data['induction_delay'] = (base_convert(substr($res['msg'], 70,2), 16, 10) * 10).''; // 感应延时
                 // $data['tenth_light_human_power'] = base_convert(substr($res['msg'], 64,2), 16, 10).''; // 晨亮有人功率
                 // $data['tenth_light_unman_power'] = base_convert(substr($res['msg'], 68,2), 16, 10).''; // 晨亮无人功率
                 // $data['begin_voltage'] = round(base_convert(substr($res['msg'], 146,4), 16, 10)/10,1).''; // 智能功率USER1起始电压
@@ -1223,7 +1234,7 @@ class Lampcontrol extends Base_Controller {
             $data['reduced_start_voltage']         = round(base_convert(substr($info, 78,4), 16, 10)/1000,1);  // 智能功率起始电压
             $data['reduced_stop_voltage']         = round(base_convert(substr($info, 82,4), 16, 10)/1000,1);  // 智能功率结束电压
             $data['light_voltage']         = round(base_convert(substr($info, 86,2), 16, 10)/10);  // 光控电压
-            $data['light_delay_time']         = base_convert(substr($info, 88,2), 16, 10);  // 光控延时时间
+            $data['light_delay_time']         = base_convert(substr($info, 88,2), 16, 10)*10;  // 光控延时时间
             
             exit(json_result('0000',$this->response['0000'],$data));
         }else{