feat:增加插卡取电驱动、无卡取电驱动设备动作上报
-> 插卡取电驱动 - 增加设备动作 - 插卡动作上报 -> 无卡取电驱动 - 增加设备动作 - 无卡动作上报
This commit is contained in:
@@ -478,12 +478,15 @@ uint8_t BLV_Rs485_Card_Check(uint32_t dev_addr,uint32_t data_addr,uint16_t len)
|
||||
{
|
||||
case 0x02: //<2F><><EFBFBD><EFBFBD> 2025-09-03 <20><>ȡ<EFBFBD><C8A1>M0<4D><30>
|
||||
Rs485CardInfo.Rs485CardFlag = 0x01;
|
||||
Udp_Addtion_Roomstate(BUS_Public.type,BUS_Public.addr,0x00,0x02);
|
||||
break;
|
||||
case 0x01: //<2F><><EFBFBD><EFBFBD> 2025-09-03 <20><>ȡ<EFBFBD><C8A1>M1<4D><31>
|
||||
Rs485CardInfo.Rs485CardFlag = 0x01;
|
||||
Udp_Addtion_Roomstate(BUS_Public.type,BUS_Public.addr,0x00,0x01);
|
||||
break;
|
||||
case 0x00: //<2F><><EFBFBD><EFBFBD>
|
||||
Rs485CardInfo.Rs485CardFlag = 0x00;
|
||||
Udp_Addtion_Roomstate(BUS_Public.type,BUS_Public.addr,0x00,0x00);
|
||||
break;
|
||||
default: //<2F><><EFBFBD><EFBFBD> 2025-09-26 <20>ϱ<EFBFBD>δ֪״̬<D7B4><CCAC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>־λ<D6BE><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯
|
||||
//Rs485CardInfo.Rs485CardFlag = 0x00;
|
||||
|
||||
@@ -370,7 +370,7 @@ uint8_t BLV_RS485_Energy_Data_Processing(uint32_t dev_addr,uint32_t data_addr,ui
|
||||
uint8_t rev = 0x01;
|
||||
uint16_t deal_len = len;
|
||||
uint8_t deal_buff[BLV_Energy_RecvData_LenMax];
|
||||
uint32_t temp_value = 0;
|
||||
uint32_t temp_value = 0,temp_flag = 0x00;
|
||||
|
||||
if((dev_addr == NULL) || (data_addr == 0x00) ) return rev;
|
||||
|
||||
@@ -452,96 +452,194 @@ uint8_t BLV_RS485_Energy_Data_Processing(uint32_t dev_addr,uint32_t data_addr,ui
|
||||
//20250829 - Ŀǰֻ<C7B0><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy PeriodicReport process");
|
||||
//Dbg_Print_Buff(DBG_BIT_DEVICE_STATUS_bit,"Energy PeriodicReport process",deal_buff,deal_len);
|
||||
|
||||
temp_value = deal_buff[9];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[8];
|
||||
Rs485EnergyInfo.voltage = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltage %dmV",Rs485EnergyInfo.voltage*10);
|
||||
|
||||
temp_value = deal_buff[11];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[10];
|
||||
Rs485EnergyInfo.current = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy current %dmA",Rs485EnergyInfo.current*10);
|
||||
|
||||
temp_value = deal_buff[15];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[14];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[13];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[12];
|
||||
Rs485EnergyInfo.active_power = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_power %dmW",Rs485EnergyInfo.active_power);
|
||||
|
||||
temp_value = deal_buff[19];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[18];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[17];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[16];
|
||||
Rs485EnergyInfo.phase_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energy %dWh",Rs485EnergyInfo.phase_energy);
|
||||
|
||||
temp_value = deal_buff[23];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[22];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[21];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[20];
|
||||
Rs485EnergyInfo.total_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy total_energy %dWh",Rs485EnergyInfo.total_energy);
|
||||
|
||||
temp_flag = deal_buff[7];
|
||||
|
||||
if( (temp_flag&0x01) != 0x00 )
|
||||
{
|
||||
temp_value = deal_buff[9];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[8];
|
||||
Rs485EnergyInfo.voltage = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltage %dmV",Rs485EnergyInfo.voltage*10);
|
||||
|
||||
temp_value = deal_buff[11];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[10];
|
||||
Rs485EnergyInfo.current = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy current %dmA",Rs485EnergyInfo.current*10);
|
||||
|
||||
temp_value = deal_buff[15];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[14];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[13];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[12];
|
||||
Rs485EnergyInfo.active_power = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_power %dmW",Rs485EnergyInfo.active_power);
|
||||
|
||||
temp_value = deal_buff[19];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[18];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[17];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[16];
|
||||
Rs485EnergyInfo.phase_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energy %dWh",Rs485EnergyInfo.phase_energy);
|
||||
|
||||
temp_value = deal_buff[23];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[22];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[21];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[20];
|
||||
Rs485EnergyInfo.total_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy total_energy %dWh",Rs485EnergyInfo.total_energy);
|
||||
}
|
||||
|
||||
if( (temp_flag&0x02) != 0x00 )
|
||||
{
|
||||
temp_value = deal_buff[25];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[24];
|
||||
Rs485EnergyInfo.voltage_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltageB %dmV",Rs485EnergyInfo.voltage_B*10);
|
||||
|
||||
temp_value = deal_buff[27];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[26];
|
||||
Rs485EnergyInfo.current_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy currentB %dmA",Rs485EnergyInfo.current_B*10);
|
||||
|
||||
temp_value = deal_buff[31];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[30];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[29];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[28];
|
||||
Rs485EnergyInfo.active_power_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_powerB %dmW",Rs485EnergyInfo.active_power_B);
|
||||
|
||||
temp_value = deal_buff[35];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[34];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[33];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[32];
|
||||
Rs485EnergyInfo.phase_energy_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energyB %dWh",Rs485EnergyInfo.phase_energy_B);
|
||||
|
||||
temp_value = deal_buff[39];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[38];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[37];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[36];
|
||||
Rs485EnergyInfo.total_energy_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy total_energyB %dWh",Rs485EnergyInfo.total_energy_B);
|
||||
}
|
||||
|
||||
BLV_Energy_PeriodicReport_Reply(&BUS_Public,deal_buff[1]);
|
||||
|
||||
break;
|
||||
case BLV_Energy_Inquire_CMD:
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy Inquire process");
|
||||
|
||||
temp_value = deal_buff[9];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[8];
|
||||
Rs485EnergyInfo.voltage = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltage %dmV",Rs485EnergyInfo.voltage*10);
|
||||
|
||||
temp_value = deal_buff[11];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[10];
|
||||
Rs485EnergyInfo.current = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy current %dmA",Rs485EnergyInfo.current*10);
|
||||
|
||||
temp_value = deal_buff[15];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[14];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[13];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[12];
|
||||
Rs485EnergyInfo.active_power = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_power %dmW",Rs485EnergyInfo.active_power);
|
||||
|
||||
temp_value = deal_buff[19];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[18];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[17];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[16];
|
||||
Rs485EnergyInfo.phase_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energy %dWh",Rs485EnergyInfo.phase_energy);
|
||||
|
||||
temp_value = deal_buff[23];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[22];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[21];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[20];
|
||||
Rs485EnergyInfo.total_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy total_energy %dWh",Rs485EnergyInfo.total_energy);
|
||||
temp_flag = deal_buff[7];
|
||||
|
||||
if( (temp_flag&0x01) != 0x00 )
|
||||
{
|
||||
temp_value = deal_buff[9];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[8];
|
||||
Rs485EnergyInfo.voltage = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltage %dmV",Rs485EnergyInfo.voltage*10);
|
||||
|
||||
temp_value = deal_buff[11];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[10];
|
||||
Rs485EnergyInfo.current = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy current %dmA",Rs485EnergyInfo.current*10);
|
||||
|
||||
temp_value = deal_buff[15];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[14];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[13];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[12];
|
||||
Rs485EnergyInfo.active_power = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_power %dmW",Rs485EnergyInfo.active_power);
|
||||
|
||||
temp_value = deal_buff[19];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[18];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[17];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[16];
|
||||
Rs485EnergyInfo.phase_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energy %dWh",Rs485EnergyInfo.phase_energy);
|
||||
|
||||
temp_value = deal_buff[23];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[22];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[21];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[20];
|
||||
Rs485EnergyInfo.total_energy = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy total_energy %dWh",Rs485EnergyInfo.total_energy);
|
||||
}
|
||||
|
||||
if( (temp_flag&0x02) != 0x00 )
|
||||
{
|
||||
temp_value = deal_buff[25];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[24];
|
||||
Rs485EnergyInfo.voltage_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy voltage %dmV",Rs485EnergyInfo.voltage*10);
|
||||
|
||||
temp_value = deal_buff[27];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[26];
|
||||
Rs485EnergyInfo.current_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy current %dmA",Rs485EnergyInfo.current*10);
|
||||
|
||||
temp_value = deal_buff[31];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[30];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[29];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[28];
|
||||
Rs485EnergyInfo.active_power_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy active_power %dmW",Rs485EnergyInfo.active_power);
|
||||
|
||||
temp_value = deal_buff[35];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[34];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[33];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[32];
|
||||
Rs485EnergyInfo.phase_energy_B = temp_value;
|
||||
//Dbg_Println(DBG_BIT_DEVICE_STATUS_bit,"BLE Energy phase_energy %dWh",Rs485EnergyInfo.phase_energy);
|
||||
|
||||
temp_value = deal_buff[39];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[38];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[37];
|
||||
temp_value <<= 8;
|
||||
temp_value |= deal_buff[36];
|
||||
Rs485EnergyInfo.total_energy_B = temp_value;
|
||||
}
|
||||
|
||||
Rs485EnergyInfo.send_flag &= ~BLV_Energy_Inquire_Flag;
|
||||
break;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#define BLV_Energy_Bus_Type 0xF4
|
||||
|
||||
#define BLV_Energy_RecvData_LenMax 30
|
||||
#define BLV_Energy_RecvData_LenMax 45
|
||||
#define BLV_Energy_RecvData_LenMin 8
|
||||
|
||||
#define BLV_Energy_DataHeard 0x8A
|
||||
@@ -38,12 +38,18 @@ typedef struct
|
||||
uint8_t DevSendSN; //<2F>豸ͨѶ SN
|
||||
uint8_t periodic_enable; //<2F><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>ʹ<EFBFBD><CAB9>״̬
|
||||
|
||||
uint16_t voltage; //<2F><>ѹ
|
||||
uint16_t current; //<2F><><EFBFBD><EFBFBD>
|
||||
uint32_t active_power; //<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t phase_energy; //<2F><EFBFBD><D7B6>ܺ<EFBFBD>
|
||||
uint32_t total_energy; //<2F><><EFBFBD>ܺ<EFBFBD>
|
||||
|
||||
uint16_t voltage; //<2F><>ѹ,ͨ<><CDA8>A<EFBFBD><41>B<EFBFBD><42>ͬ
|
||||
uint16_t current; //<2F><><EFBFBD><EFBFBD>,ͨ<><CDA8>A
|
||||
uint32_t active_power; //<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>,ͨ<><CDA8>A
|
||||
uint32_t phase_energy; //<2F><EFBFBD><D7B6>ܺ<EFBFBD>,ͨ<><CDA8>A
|
||||
uint32_t total_energy; //<2F><><EFBFBD>ܺ<EFBFBD>,ͨ<><CDA8>A
|
||||
|
||||
uint16_t voltage_B; //<2F><>ѹ,ͨ<><CDA8>A<EFBFBD><41>B<EFBFBD><42>ͬ
|
||||
uint16_t current_B; //<2F><><EFBFBD><EFBFBD>,ͨ<><CDA8>B
|
||||
uint32_t active_power_B; //<2F>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD>,ͨ<><CDA8>B
|
||||
uint32_t phase_energy_B; //<2F><EFBFBD><D7B6>ܺ<EFBFBD>,ͨ<><CDA8>B
|
||||
uint32_t total_energy_B; //<2F><><EFBFBD>ܺ<EFBFBD>,ͨ<><CDA8>B
|
||||
|
||||
uint32_t send_flag; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λ
|
||||
uint32_t periodic_time; //<2F><><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>mS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user