liyi пре 2 година
родитељ
комит
8452e5ab8f
3 измењених фајлова са 10 додато и 6 уклоњено
  1. 2 2
      pro/src/app.c
  2. 2 2
      pro/src/cascade_slave.c
  3. 6 2
      pro/src/common.h

+ 2 - 2
pro/src/app.c

@@ -882,8 +882,8 @@ void* sensor_thread(void* arg)
                 if(_globalDeviceManager->_global_device_info->product_pwr_type == SmartPDU_AC ||
                 if(_globalDeviceManager->_global_device_info->product_pwr_type == SmartPDU_AC ||
                 _globalDeviceManager->_global_device_info->product_pwr_type == SmartPDU_DC)
                 _globalDeviceManager->_global_device_info->product_pwr_type == SmartPDU_DC)
                 {
                 {
-                    _globalDeviceManager->single_mmap->total_temp = temperature *1000;
-                    _globalDeviceManager->single_mmap->total_humidity = humidity * 1000;
+                    _globalDeviceManager->single_mmap->total_temp.temperature = _globalSensorInfo.val1 *100;
+                    _globalDeviceManager->single_mmap->total_temp.humidity = _globalSensorInfo.val2 *100;
                 }else
                 }else
                 {
                 {
                     _globalDeviceManager->triphasic_mmap->temperature = temperature *100;
                     _globalDeviceManager->triphasic_mmap->temperature = temperature *100;

+ 2 - 2
pro/src/cascade_slave.c

@@ -152,7 +152,7 @@ int cascade_slave_init(void)
         printf("single dc address init 4000\n");
         printf("single dc address init 4000\n");
     }else
     }else
     {
     {
-        sh->map =  modbus_mapping_new_start_address(0,0,0,0,TREE_R_DEV_CHN,7000,0,0);
+        sh->map =  modbus_mapping_new_start_address(0,0,0,0,TREE_DEV_CHN_REG,7000,0,0);
         modbus_three[TREE_R_DEV_CHN         ].addr = &mgr->triphasic_mmap->dev_chn;
         modbus_three[TREE_R_DEV_CHN         ].addr = &mgr->triphasic_mmap->dev_chn;
         modbus_three[TREE_R_INPUT_ALL_A     ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[0];
         modbus_three[TREE_R_INPUT_ALL_A     ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[0];
         modbus_three[TREE_R_INPUT_ALL_B     ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[1];
         modbus_three[TREE_R_INPUT_ALL_B     ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[1];
@@ -249,7 +249,7 @@ void cascade_slave_read(uint32_t addr,uint32_t lenth)
             slave_read(sh,addr,lenth,DS_R_IN_TOTAL,TYPE_U32);
             slave_read(sh,addr,lenth,DS_R_IN_TOTAL,TYPE_U32);
         break;
         break;
         case 4777 ... 4778:
         case 4777 ... 4778:
-            slave_read(sh,addr,lenth,DS_R_TEMP_HUM,TYPE_U32);
+            slave_read(sh,addr,lenth,DS_R_TEMP_HUM,TYPE_U16);
         case 4779 ... 4842:
         case 4779 ... 4842:
             slave_read(sh,addr,lenth,DS_R_SWITCH_STA,TYPE_U16);
             slave_read(sh,addr,lenth,DS_R_SWITCH_STA,TYPE_U16);
         break;
         break;

+ 6 - 2
pro/src/common.h

@@ -648,6 +648,11 @@ typedef struct cascade_pw_info{
     uint32_t           factor                                      ;//功率因素 
     uint32_t           factor                                      ;//功率因素 
 }cascade_single_chn_info;     //siggle hell 
 }cascade_single_chn_info;     //siggle hell 
 
 
+typedef struct temp_hum{
+    uint16_t temperature;
+    uint16_t humidity;
+}temp_hum_t;
+
 #pragma pack (1)
 #pragma pack (1)
 typedef struct cascade_single_mmap{
 typedef struct cascade_single_mmap{
     uint16_t dev_chn;
     uint16_t dev_chn;
@@ -655,8 +660,7 @@ typedef struct cascade_single_mmap{
     uint32_t total_valtage;
     uint32_t total_valtage;
     uint32_t total_current;
     uint32_t total_current;
     uint32_t total_power;
     uint32_t total_power;
-    uint32_t total_temp;
-    uint32_t total_humidity;
+    temp_hum_t total_temp;
     uint16_t chn_status[64];
     uint16_t chn_status[64];
     uint16_t open_delay[64];
     uint16_t open_delay[64];
     uint16_t close_delay[64];
     uint16_t close_delay[64];