Переглянути джерело

北向用户自定义寄存器!!!!

liyi 1 рік тому
батько
коміт
b4739ccc77
5 змінених файлів з 449 додано та 6 видалено
  1. 4 2
      pro/config/cfg.h
  2. 144 0
      pro/src/app.c
  3. 258 2
      pro/src/cascade_slave.c
  4. 41 0
      pro/src/common.h
  5. 2 2
      pub

+ 4 - 2
pro/config/cfg.h

@@ -13,7 +13,7 @@
 //#define PRJ_USASL_AC_I3_O3
 //#define PRJ_ITK_AC_I1_O1
 //#define PRJ_ITK_AC_I3_O1
-//#define PRJ_STSC_I3_O3
+#define PRJ_STSC_I3_O3
 //#define PRJ_STSC_I3_O1_OLED
 //#define PRJ_LITECH_AC_I1_O1
 //#define PRJ_LITECH_AC_I3_O1
@@ -22,7 +22,7 @@
 //#define PRJ_HYPERTEC_AC_I3_O1
 //#define PRJ_SG_I3_O3
 //#define PRJ_TEST
-#define PRJ_TEST_AC_I1_O1
+//#define PRJ_TEST_AC_I1_O1
 //#define PRJ_TEST_AC_I3_O1
 //#define PRJ_IP_AC_I3_O3
 //#define PRJ_INST2302_DC_OLED
@@ -123,6 +123,8 @@
 
     #define PROD_POWER_TYPE                     3
 
+    #define NORTH_USER_SPECILS                              //north user specification            
+
 #elif defined PRJ_STSC_I3_O1_OLED
     #define LANGUAGE                            0           //english
     #define SMPLE_TIME                          30          //ms

+ 144 - 0
pro/src/app.c

@@ -592,6 +592,81 @@ static void* power_thread(void* arg)
                             __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_power = _pTreeACPowerMangerTemp->_PowerInfo.power * 1000;
                             __globalDeviceManage.triphasic_mmap->pw_o_chn[_chn].chn[k].o_voltage = _pTreeACPowerMangerTemp->_PowerInfo.voltage * 1000;
                             __globalDeviceManage.triphasic_mmap->chn_info[_chn].chn_type = _pTreeACPowerMangerTemp->product_ph_type;
+#ifdef NORTH_USER_SPECILS
+                            uint8_t wanning = 0;
+                            if(_globalTACWarningInfo.w_voltage_up == true)
+                            {
+                                wanning++;
+                            }
+                            if(_globalTACWarningInfo.w_voltage_down == true)
+                            {
+                                wanning++;
+                            }
+                            if(_globalTACWarningInfo.w_current == true)
+                            {
+                                wanning++;
+                            }
+                            if(_globalTACWarningInfo.w_consumption == true)
+                            {
+                                wanning++;
+                            }
+                            if(_globalTACWarningInfo.w_power == true)
+                            {
+                                wanning++;
+                            }
+                            //uint16_t mask = 0xFFFF & (0 << (_chn % 16));
+                            uint16_t data_temp = 0;
+   
+                            switch(_chn)
+                            {
+                                case 0 ... 15:
+                                {   
+                                    data_temp = __globalDeviceManage.north_user.fault_1_16;
+                                    data_temp &= ~(1 << (_chn % 16));
+                                    if(wanning > 0)
+                                    {
+                                        data_temp |= (1 << (_chn % 16));
+                                    } 
+                                    __globalDeviceManage.north_user.fault_1_16 = data_temp;       
+                                }
+                                break;
+                                case 16 ... 31:
+                                {
+                                    data_temp = __globalDeviceManage.north_user.fault_17_32;
+                                    data_temp &= ~(1 << (_chn % 16));
+                                    if(wanning > 0)
+                                    {
+                                        data_temp |= (1 << (_chn % 16));
+                                    } 
+                                    __globalDeviceManage.north_user.fault_17_32 = data_temp; 
+                                }
+                                break;
+                                case 32 ... 47:
+                                {
+                                    data_temp = __globalDeviceManage.north_user.fault_33_48;
+                                    data_temp &= ~(1 << (_chn % 16));
+                                    if(wanning > 0)
+                                    {
+                                        data_temp |= (1 << (_chn % 16));
+                                    } 
+                                    __globalDeviceManage.north_user.fault_33_48 = data_temp; 
+                                }
+                                break;
+                                case 48 ... 63:
+                                {
+                                    data_temp = __globalDeviceManage.north_user.fault_49_64;
+                                    data_temp &= ~(1 << (_chn % 16));
+                                    if(wanning > 0)
+                                    {
+                                        data_temp |= (1 << (_chn % 16));
+                                    } 
+                                    __globalDeviceManage.north_user.fault_49_64 = data_temp; 
+                                }
+                                break;
+                                default:
+                                break;
+                            }                               
+#endif
                         }
 
                         if(_globalPowerInfo._power_info.status==0)
@@ -631,6 +706,7 @@ static void* power_thread(void* arg)
                                 log_d("ph_ch%d insert data error.\n", _pTreeACPowerMangerTemp->product_ch_id);
                             }
                         }
+
                         // 判断阈值状态
                         if (_globalTACWarningInfo.w_voltage_up != _pTreeACPowerMangerTemp->_PowerWarninginfo.w_voltage_up )
                         {
@@ -702,6 +778,55 @@ static void* power_thread(void* arg)
                          _globalDeviceManager->triphasic_mmap->chn_status[_chn] = _globalPowerInfo._power_info.status;
                          _globalDeviceManager->triphasic_mmap->open_delay[_chn] = _globalPowerMangerTemp->product_ch_start_delay;
                          _globalDeviceManager->triphasic_mmap->close_delay[_chn] = _globalPowerMangerTemp->product_ch_stop_delay;
+#ifdef NORTH_USER_SPECILS
+                        switch (_chn)
+                        {
+                            case 0 ... 15:
+                            {
+                                if(_globalDeviceManager->triphasic_mmap->chn_status[_chn])
+                                {
+                                    __globalDeviceManage.north_user.status_1_16 |= (1 << (_chn %16));
+                                }else
+                                {
+                                    __globalDeviceManage.north_user.status_1_16 &= ~(1 << (_chn %16));
+                                }
+                            }
+                            break;
+                            case 16 ... 31:
+                            {
+                                if(_globalDeviceManager->triphasic_mmap->chn_status[_chn])
+                                {
+                                    __globalDeviceManage.north_user.status_17_32 |= (1 << (_chn %16));
+                                }else
+                                {
+                                    __globalDeviceManage.north_user.status_17_32 &= ~(1 << (_chn %16));
+                                }
+                            }
+                            break;
+                            case 32 ... 47:
+                            {
+                                if(_globalDeviceManager->triphasic_mmap->chn_status[_chn])
+                                {
+                                    __globalDeviceManage.north_user.status_33_48 |= (1 << (_chn %16));
+                                }else
+                                {
+                                    __globalDeviceManage.north_user.status_33_48 &= ~(1 << (_chn %16));
+                                }
+                            }
+                            break;
+                            case 48 ... 63:
+                            {
+                                if(_globalDeviceManager->triphasic_mmap->chn_status[_chn])
+                                {
+                                    __globalDeviceManage.north_user.status_49_64 |= (1 << (_chn %16));
+                                }else
+                                {
+                                    __globalDeviceManage.north_user.status_49_64 &= ~(1 << (_chn %16));
+                                }
+                            }
+                            break;
+                        }
+#endif
                      }
 
                     //累加总电源信息
@@ -938,6 +1063,12 @@ static void* power_thread(void* arg)
                     _globalDeviceManager->triphasic_mmap->i_total.pw_i_total[nTreeACType].i_total_power = _pTreeACPowerMangerTemp->_PowerInfo.power * 1000;
                     _globalDeviceManager->triphasic_mmap->i_total.pw_i_total[nTreeACType].i_total_voltage = _pTreeACPowerMangerTemp->_PowerInfo.voltage * 1000;
                     _globalDeviceManager->triphasic_mmap->i_total.pw_i_total[nTreeACType].i_total_current = _pTreeACPowerMangerTemp->_PowerInfo.current * 1000;
+#ifdef NORTH_USER_SPECILS
+                    __globalDeviceManage.north_user.wire_voltage[nTreeACType] = 
+                                        _globalDeviceManager->triphasic_mmap->i_total.pw_i_total[nTreeACType].i_total_voltage * 1.732 / 100;
+                    __globalDeviceManage.north_user.wire_current[nTreeACType] = 
+                                        _globalDeviceManager->triphasic_mmap->i_total.pw_i_total[nTreeACType].i_total_current / 10;
+#endif               
                 }
                 time_t now;
                 time(&now);
@@ -971,9 +1102,22 @@ static void* power_thread(void* arg)
                 _globalDeviceManager->_globalPowerManger._PowerInfo.consumption += _pTreeACPowerMangerTemp->_PowerInfo.consumption;
                 _globalDeviceManager->_globalPowerManger._PowerInfo.factor = _pTreeACPowerMangerTemp->_PowerInfo.factor;
             }
+
             if (__globalDeviceManage.triphasic_mmap)
             {
                 __globalDeviceManage.triphasic_mmap->dev_chn = __globalDeviceManage._globalDevInfo.product.pwr_type << 8 | _chn;
+#ifdef NORTH_USER_SPECILS
+                    uint32_t c_data = 0;
+                    uint32_t p_data = 0;
+                    for(int i = 0; i < 3;i++)
+                    {
+                        c_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_consumption / 100);
+                        p_data +=  (_globalDeviceManager->triphasic_mmap->i_total.pw_i_total[i].i_total_power / 100);                      
+                    }
+                    __globalDeviceManage.north_user.total_elec_energy = c_data;
+                    __globalDeviceManage.north_user.total_power = p_data;
+                    __globalDeviceManage.north_user.frequency = _globalDeviceManager->_globalPowerManger._PowerInfo.freq * 100;         
+#endif
             }
         }
         if (__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One_B)

+ 258 - 2
pro/src/cascade_slave.c

@@ -22,12 +22,46 @@
 #define ALL_SET_SWITCH_REG          (5192)
 
 
+#ifdef NORTH_USER_SPECILS
+
+    #define  SPAECIL_USER_TOTAL_CONSUMER                  (40  )
+    #define  SPAECIL_USER_TOTAL_POWER                     (49  )
+    #define  SPAECIL_USER_STATUS                          (100 )
+    #define  SPAECIL_USER_STATUS_64                       (103 )
+    #define  SPAECIL_USER_WANING                          (2000)
+    #define  SPAECIL_USER_FATAL_64                        (2005)
+    #define  SPAECIL_USER_SET_1                           (3001)
+    #define  SPAECIL_USER_SET_64                          (3004)  
+
+enum{
+    N_SPAECIL_CON = 0,
+    N_SPAECIL_STA,
+    N_SPAECIL_WANING,
+    N_SPAECIL_SET,
+};
+
+
+
+static mmap_modbus_t north_specil[] = {
+    [N_SPAECIL_CON       ]{.offset = SPAECIL_USER_TOTAL_CONSUMER             },
+    [N_SPAECIL_STA       ]{.offset = SPAECIL_USER_STATUS                     },
+    [N_SPAECIL_WANING    ]{.offset = SPAECIL_USER_WANING                     },
+    [N_SPAECIL_SET       ]{.offset = SPAECIL_USER_SET_1                     },
+};
+
+
+#endif
+
 
 enum{
     TYPE_U16,
     TYPE_U32
 };
-
+enum{
+    NO_OPPERATION = 0,
+    OPEN,
+    CLOSE,
+};
 
 enum {
     DS_R_DEV_CHN = 0,
@@ -96,6 +130,7 @@ static inline GlobalDeviceManager* get_dm2(void)
     return &__globalDeviceManage2;
 }
 
+
 static mmap_modbus_t modbus_single[] = {
     [DS_R_DEV_CHN       ]{.offset = DEV_CHN_REG             },
     [DS_R_OUT_INFO      ]{.offset = OUT_INFO_REG            },
@@ -178,6 +213,7 @@ int cascade_slave_init(void)
             free(sh->map);
             sh->map = NULL;
         }
+#ifndef NORTH_USER_SPECILS
         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_INPUT_ALL_A     ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[0];
@@ -196,6 +232,13 @@ int cascade_slave_init(void)
         modbus_three[TREE_W_CLOSE_DELAY     ].addr = &mgr->triphasic_mmap->set_chn_close_delay;
         modbus_three[TREE_W_CHN_SWITCH_STA  ].addr = &mgr->triphasic_mmap->set_chn_switch_status;
         modbus_three[TREE_W_ALL_CHN_STA     ].addr = &mgr->triphasic_mmap->set_chn_all_switch_status;
+#else
+        sh->map =  modbus_mapping_new_start_address(0,0,0,0,SPAECIL_USER_TOTAL_CONSUMER,4000,0,0);
+        north_specil[N_SPAECIL_CON          ].addr = &mgr->north_user.total_elec_energy;
+        north_specil[N_SPAECIL_STA          ].addr = &mgr->north_user.status_1_16;
+        north_specil[N_SPAECIL_WANING       ].addr = &mgr->north_user.total_wanning;
+        north_specil[N_SPAECIL_SET          ].addr = &mgr->north_user.set_1_16 ;
+#endif
         printf("triphasic address init 6000\n");
         //return -1;
     }
@@ -262,7 +305,53 @@ static void slave_read(slave_handle_t *sh, uint32_t addr,int num,uint32_t reg_ty
 }
 
 
+
 void cascade_slave_read(uint32_t addr,uint32_t lenth)
+#ifdef NORTH_USER_SPECILS
+{
+    slave_handle_t *sh=&slHandle;
+    GlobalDeviceManager* mgr=get_dm();
+    /*
+        #define  SPAECIL_USER_TOTAL_CONSUMER                  (40  )
+        #define  SPAECIL_USER_TOTAL_POWER                     (49  )
+        #define  SPAECIL_USER_STATUS                          (100 )
+        #define  SPAECIL_USER_STATUS_64                       (103 )
+        #define  SPAECIL_USER_WANING                          (2000)
+        #define  SPAECIL_USER_FATAL_64                        (2005)
+        #define  SPAECIL_USER_SET_1                           (3001)
+        #define  SPAECIL_USER_SET_64                          (3004)  
+    */
+    switch(addr)
+    {
+        case SPAECIL_USER_TOTAL_CONSUMER ... SPAECIL_USER_TOTAL_POWER:
+        {
+            int step = addr - SPAECIL_USER_TOTAL_CONSUMER;
+            uint16_t *map_addr = (uint16_t *)&(sh->map->tab_registers[addr - SPAECIL_USER_TOTAL_CONSUMER]);
+            uint16_t *offset_addr = (uint16_t*)(north_specil[N_SPAECIL_CON].addr) + step;
+            memcpy(map_addr,offset_addr,lenth*2);
+        }
+        break;
+        case SPAECIL_USER_STATUS ... SPAECIL_USER_STATUS_64:
+        {
+            int step = addr - SPAECIL_USER_STATUS;
+            uint16_t *map_addr = (uint16_t *)&(sh->map->tab_registers[addr - SPAECIL_USER_TOTAL_CONSUMER]);
+            uint16_t *offset_addr = (uint16_t*)(north_specil[N_SPAECIL_STA].addr) + step;
+            memcpy(map_addr,offset_addr,lenth*2);
+        }
+        break;
+        case SPAECIL_USER_WANING ... SPAECIL_USER_FATAL_64:
+        {
+            int step = addr - SPAECIL_USER_WANING;
+            uint16_t *map_addr = (uint16_t *)&(sh->map->tab_registers[addr - SPAECIL_USER_TOTAL_CONSUMER]);
+            uint16_t *offset_addr = (uint16_t*)(north_specil[N_SPAECIL_WANING].addr) + step;
+            memcpy(map_addr,offset_addr,lenth*2);
+        }
+        break;
+        default:
+            break;
+    }
+}
+#else
 {
     slave_handle_t *sh=&slHandle;
 
@@ -348,9 +437,176 @@ void cascade_slave_read(uint32_t addr,uint32_t lenth)
         break;
     }
 }
+#endif
+
+
+
 
 
 void cascade_slave_write(uint32_t addr, uint16_t val)
+#ifdef NORTH_USER_SPECILS
+{
+    GlobalDeviceManager* mgr=get_dm();
+    if(mgr->_globalDevInfo.product.pwr_type == SmartPDU_AC 
+            || mgr->_globalDevInfo.product.pwr_type == SmartPDU_DC) 
+    {
+
+    }else
+    {
+        switch(addr)
+        {
+            case SPAECIL_USER_SET_1 ... SPAECIL_USER_SET_64:
+            {
+                int step = addr - SPAECIL_USER_SET_1;
+                uint16_t * offset_addr = (uint16_t*)(north_specil[SPAECIL_USER_STATUS].addr + step);
+                uint16_t buff[16] = {0};
+                if(*offset_addr != val)
+                {
+                    uint16_t data = (*offset_addr ^ val); 
+                    for(int i = 0; i < 16;i++)
+                    {
+                        if(data & (1 << i))
+                        {
+                            //buff[i] = 1;
+                            if(val & (1 << i))
+                            {
+                                // open
+                                buff[i] = OPEN;
+                            }else
+                            {
+                                // close
+                                buff[i] = CLOSE;
+                            }
+                        }
+                    }
+                    for(int i = 0; i < 16;i++)
+                    {
+                        if(buff[i])
+                        {
+                            int start_chn = step*16 + i;
+                            GlobalPowerManger* _globalPowerMangerTemp = NULL ;
+                            list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list){
+                                if(_globalPowerMangerTemp==NULL)
+                                        break;
+                                if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
+                                {
+                                    int t_ac_CtrlType=0;
+                                    int nRet = 0;
+                                    uint16_t write_data =  buff[i] == OPEN ? 1 : 0;
+                                    _globalPowerMangerTemp->product_ch_status = write_data;
+
+                                    GlobalTreeACManager *_globalTACManager = NULL;
+                                    list_for_each_entry(_globalTACManager, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
+                                    {
+                                        t_ac_CtrlType=_globalTACManager->product_ph_outputType;
+                                    }
+                                    if (t_ac_CtrlType == 2&&(__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_Tree
+                                    ||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One
+                                    ||__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One_B))
+                                    {
+                                        if(_globalPowerMangerTemp->product_ch_type == AC_SINGLE_S_TYPE || _globalPowerMangerTemp->product_ch_type == AC_SINGLE_B_TYPE)
+                                        {
+                                            
+                                            if (write_data == 1)
+                                            {
+                                                if (_globalPowerMangerTemp->global_over_manager.product_vol_upper_enable == 1)
+                                                    write_data |= ENABLE_TAC_V_UP;
+                                                if (_globalPowerMangerTemp->global_over_manager.product_vol_lower_enable == 1)
+                                                    write_data |= ENABLE_TAC_V_DOWN;
+                                                if (_globalPowerMangerTemp->global_over_manager.product_cur_upper_enable == 1)
+                                                    write_data |= ENABLE_TAC_A_UP;
+                                                if (_globalPowerMangerTemp->global_over_manager.product_pwr_upper_enable == 1)
+                                                    write_data |= ENABLE_TAC_W_UP;
+                                                if (_globalPowerMangerTemp->global_over_manager.product_pwrcon_upper_enable == 1)
+                                                    write_data |= ENABLE_TAC_P_UP;
+                                            }
+                                            g_switch_set_ac_single_s_chn_ctrl(&__globalDeviceManage._globalRelaySampManger,  _globalPowerMangerTemp->product_saddr, 
+                                                            (_globalPowerMangerTemp->product_ch_addr- 1), write_data);
+                                            break;
+                                        }
+                                        unsigned short phsts=0;
+                                        list_for_each_entry(_globalTACManager, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
+                                        {
+                                            if (write_data == 1 && _globalTACManager->product_ph_outputStatus==1)
+                                            {
+                                                phsts=1;
+                                                if (_globalTACManager->global_over_manager.product_vol_upper_enable == 1)
+                                                    phsts |= ENABLE_TAC_V_UP;
+                                                if (_globalTACManager->global_over_manager.product_vol_lower_enable == 1)
+                                                    phsts |= ENABLE_TAC_V_DOWN;
+                                                if (_globalTACManager->global_over_manager.product_cur_upper_enable == 1)
+                                                    phsts |= ENABLE_TAC_A_UP;
+                                                if (_globalTACManager->global_over_manager.product_pwr_upper_enable == 1)
+                                                    phsts |= ENABLE_TAC_W_UP;
+                                                if (_globalTACManager->global_over_manager.product_pwrcon_upper_enable == 1)
+                                                    phsts |= ENABLE_TAC_P_UP;
+                                            }else{
+                                                phsts=0;
+                                            }
+                                            nRet= g_switch_set_t_ac_phchn_ctrl(&__globalDeviceManage._globalRelaySampManger,
+                                                                _globalTACManager->product_saddr, 
+                                                                _globalTACManager->product_ch_addr - 1, 
+                                                                phsts);
+                                        }
+                                        g_switch_set_t_ac_chn_NF_ctrl(&__globalDeviceManage._globalRelaySampManger, _globalPowerMangerTemp->product_saddr, _globalPowerMangerTemp->product_ch_addr, write_data);
+                                        break;
+                                    }else
+                                    {
+                                        if (write_data == 1)
+                                        {
+                                            if (_globalPowerMangerTemp->global_over_manager.product_vol_upper_enable == 1)
+                                                write_data |= ENABLE_TAC_V_UP;
+                                            if (_globalPowerMangerTemp->global_over_manager.product_vol_lower_enable == 1)
+                                                write_data |= ENABLE_TAC_V_DOWN;
+                                            if (_globalPowerMangerTemp->global_over_manager.product_cur_upper_enable == 1)
+                                                write_data |= ENABLE_TAC_A_UP;
+                                            if (_globalPowerMangerTemp->global_over_manager.product_pwr_upper_enable == 1)
+                                                write_data |= ENABLE_TAC_W_UP;
+                                            if (_globalPowerMangerTemp->global_over_manager.product_pwrcon_upper_enable == 1)
+                                                write_data |= ENABLE_TAC_P_UP;
+                                        }
+                                        /*
+                                        if (isgroup)
+                                        {
+                                            sts |= ENABLE_TAC_STIME;
+                                            sts |= ENABLE_TAC_ETIME;
+                                        }*/
+                                        if (__globalDeviceManage._globalDevInfo.product.pwr_type == SmartPDU_Tree_AC_One)
+                                        {
+                                            g_switch_set_t_ac_phchn_ctrl(&__globalDeviceManage._globalRelaySampManger,
+                                                                            _globalPowerMangerTemp->product_saddr,
+                                                                            _globalPowerMangerTemp->product_ch_addr - 1,
+                                                                            write_data);
+                                        }else{
+                                            g_switch_set_t_ac_chn_ctrl(&__globalDeviceManage._globalRelaySampManger,
+                                                                            _globalPowerMangerTemp->product_saddr,
+                                                                            _globalPowerMangerTemp->product_ch_addr - 1,
+                                                                            write_data);
+                                        }
+                                    }
+                                }
+                            }
+                            ////////////////////////////////////////////////////////////////
+                            // if(buff[i] == OPEN)
+                            // {
+                            //     *offset_addr |= (1 << i); 
+                            // }else
+                            // {
+                            //     *offset_addr &= ~(1 << i);
+                            // }
+                            buff[i] = 0;
+                        }
+                    }
+                }
+
+            }
+            break;
+            default:
+                break;
+        }
+    }
+}
+#else
 {
     slave_handle_t *sh=&slHandle;
     GlobalDeviceManager* mgr=get_dm();
@@ -678,4 +934,4 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
         }
     }
 }
-
+#endif

+ 41 - 0
pro/src/common.h

@@ -48,6 +48,7 @@
 
 #define INFO_FILE_PATH      "/usr/share/PDUInfo.txt"
 
+
 #if (CHIP_TYPE == CHIP_T113s)
 
 //控制板通信串口
@@ -68,7 +69,11 @@
 #define INTERL_MODBUS_BAUD 115200
 //表头级联通讯串口
 #define CASCADE_MODBUS_PORT     "/dev/ttyAS4"
+#ifdef NORTH_USER_SPECILS
+#define CASCADE_MODBUS_BAUD     9600
+#else
 #define CASCADE_MODBUS_BAUD     115200
+#endif
 //传感器通信串口
 #define INTERL_SENSOR_MODBUS_PORT "/dev/ttyAS2"
 #define INTERL_SENSOR_MODBUS_BAUD 9600
@@ -980,6 +985,39 @@ typedef struct cascade_single_mmap{
     uint16_t set_chn_all_switch_status;
 }cascade_single_mmap_t;
 
+
+#ifdef NORTH_USER_SPECILS
+
+
+typedef struct cascade_north_user{
+    uint32_t total_elec_energy;
+    uint16_t frequency;
+    uint16_t wire_voltage[3];
+    uint16_t wire_current[3];
+    uint16_t total_power;
+    uint16_t status_1_16;
+    uint16_t status_17_32;
+    uint16_t status_33_48;
+    uint16_t status_49_64;
+    uint16_t total_wanning;
+    uint16_t current_wanning;
+    uint16_t fault_1_16;
+    uint16_t fault_17_32;
+    uint16_t fault_33_48;
+    uint16_t fault_49_64;
+    uint16_t set_1_16;
+    uint16_t set_17_32;
+    uint16_t set_33_48;
+    uint16_t set_49_64;
+}cascade_north_user_t;
+
+
+
+
+#endif
+
+
+
 #pragma pack ()
 
 
@@ -1194,6 +1232,9 @@ typedef struct
     mail_info_t          mailInfo;
     mqtt_info_t          mqttInfo;
     Modbus_Manger_Tcp *md_tcp;
+#ifdef NORTH_USER_SPECILS
+    cascade_north_user_t north_user;
+#endif
 }GlobalDeviceManager;
 
 extern GlobalDeviceManager __globalDeviceManage;

+ 2 - 2
pub

@@ -14,7 +14,7 @@
 #PRJS="PRJ_RELEASE_AC_I1_O1"
 #PRJS="PRJ_RELEASE_AC_I3_O1"
 #PRJS="PRJ_RELEASE_AC_I3_O3"
-#PRJS="PRJ_STSC_I3_O3"
+PRJS="PRJ_STSC_I3_O3"
 #PRJS="PRJ_STSC_I3_O1_OLED"
 #PRJS="PRJ_SG_I3_O3"
 #PRJS="PRJ_TEST"
@@ -31,7 +31,7 @@
 #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3"
 #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1 PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
 #PRJS="PRJ_IP_AC_I3_O3"
-PRJS="PRJ_IP_AC_I3_O1"
+#PRJS="PRJ_IP_AC_I3_O1"
 fulldir=$(realpath $0)
 curdir=$(dirname $fulldir)