|
@@ -4998,12 +4998,13 @@ void Temp_Shutdown_ONOFF(uint8_t val){
|
4998
|
4998
|
|
4999
|
4999
|
#define OVERPOWER_STR "Overpower"
|
5000
|
5000
|
#define OVER_INPUT_STR "Over-Input"
|
|
5001
|
+#define ALARM_REPORT_LENGTH 42
|
5001
|
5002
|
//uint8_t AlarmReport_History[Alarm_type_IndexMax] = {0,};
|
|
5003
|
+volatile uint8_t Alarm_ReportData[40 + 2 + 22 + 3] = {0,}; // 40 Alarm Data + 2 UNIT ID, 21 Header , 3 Tail
|
5002
|
5004
|
uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
|
5003
|
5005
|
// if(AlarmReport_History[Alarm_type] != true){
|
5004
|
5006
|
// return;
|
5005
|
5007
|
// }
|
5006
|
|
- static uint8_t Alarm_ReportData[40 + 2 + 21 + 3] = {0,}; // 40 Alarm Data + 2 UNIT ID, 21 Header , 3 Tail
|
5007
|
5008
|
uint8_t index = 0;
|
5008
|
5009
|
Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0x00; //UNIT ID0
|
5009
|
5010
|
Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0xF1; //UNIT ID1
|
|
@@ -5029,7 +5030,7 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
|
5029
|
5030
|
Alarm_ReportData[MBIC_PAYLOADSTART + index++] = 0;//Alarm SeqNum1 RF Board Default 0
|
5030
|
5031
|
|
5031
|
5032
|
// 0~ 19
|
5032
|
|
- for(int i = MBIC_PAYLOADSTART + 22; i < MBIC_PAYLOADSTART + 42; i++)
|
|
5033
|
+ for(int i = MBIC_PAYLOADSTART + 22; i < MBIC_PAYLOADSTART + ALARM_REPORT_LENGTH; i++)
|
5033
|
5034
|
Alarm_ReportData[i] = 0;
|
5034
|
5035
|
|
5035
|
5036
|
|
|
@@ -5152,8 +5153,8 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
|
5152
|
5153
|
// Alarm_ReportData[MBIC_PAYLOADSTART + 2] = val;
|
5153
|
5154
|
|
5154
|
5155
|
printf("%s \r\n",&Alarm_ReportData[MBIC_PAYLOADSTART + 22]);
|
5155
|
|
- printf("Type : %x size length : %d \r\n",Alarm_type,sizeof(Alarm_ReportData));
|
5156
|
|
-// MBIC_HeaderMergeFunction(Alarm_ReportData,42);
|
|
5156
|
+// printf("Type : %x size length : %d \r\n",Alarm_type,sizeof(Alarm_ReportData));
|
|
5157
|
+// MBIC_HeaderMergeFunction(Alarm_ReportData,ALARM_REPORT_LENGTH);
|
5157
|
5158
|
Alarm_ReportData[MBIC_PREAMBLE_0] = MBIC_PREAMBLE0;
|
5158
|
5159
|
Alarm_ReportData[MBIC_PREAMBLE_1] = MBIC_PREAMBLE1;
|
5159
|
5160
|
Alarm_ReportData[MBIC_PREAMBLE_2] = MBIC_PREAMBLE2;
|
|
@@ -5184,19 +5185,23 @@ uint8_t* Alarm_Report_Send(uint16_t Alarm_type,uint8_t val){
|
5184
|
5185
|
|
5185
|
5186
|
|
5186
|
5187
|
|
5187
|
|
- Alarm_ReportData[MBIC_LENGTH_0] = (sizeof(Alarm_ReportData) & 0xFF00) >> 8;
|
5188
|
|
- Alarm_ReportData[MBIC_LENGTH_1] = sizeof(Alarm_ReportData) & 0x00FF;
|
|
5188
|
+ Alarm_ReportData[MBIC_LENGTH_0] = (ALARM_REPORT_LENGTH & 0xFF00) >> 8;
|
|
5189
|
+ Alarm_ReportData[MBIC_LENGTH_1] = ALARM_REPORT_LENGTH & 0x00FF;
|
5189
|
5190
|
|
5190
|
5191
|
Alarm_ReportData[MBIC_HEADERCHECKSUM_0] = Chksum_Create(Alarm_ReportData);
|
5191
|
5192
|
|
5192
|
5193
|
|
5193
|
|
- uint16_t crcret = ((CRC16_Generate(&Alarm_ReportData[MBIC_PAYLOADSTART], 42) ) );
|
|
5194
|
+ uint16_t crcret =CRC16_Generate(&Alarm_ReportData[MBIC_PAYLOADSTART], ALARM_REPORT_LENGTH);
|
5194
|
5195
|
|
5195
|
5196
|
// printf("\r\n crc ret : %x \r\n",crcret);
|
5196
|
|
- Alarm_ReportData[MBIC_PAYLOADSTART + 41] =(( crcret & 0xFF00)>> 8);
|
5197
|
|
- Alarm_ReportData[MBIC_PAYLOADSTART + 42] = (( crcret & 0x00FF));
|
5198
|
|
- Alarm_ReportData[MBIC_PAYLOADSTART + 43] = 0x03;
|
5199
|
|
- Uart1_Data_Send(Alarm_ReportData,sizeof(Alarm_ReportData));
|
|
5197
|
+ Alarm_ReportData[MBIC_PAYLOADSTART + 42] =(( crcret & 0xFF00)>> 8);
|
|
5198
|
+// printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 41] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 41]);
|
|
5199
|
+ Alarm_ReportData[MBIC_PAYLOADSTART + 43] = (( crcret & 0x00FF));
|
|
5200
|
+// printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);
|
|
5201
|
+ Alarm_ReportData[MBIC_PAYLOADSTART + 44] = 0x03;
|
|
5202
|
+// printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 43] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 43]);
|
|
5203
|
+ Uart1_Data_Send(&Alarm_ReportData[0],sizeof(Alarm_ReportData));
|
|
5204
|
+ printf(" Alarm_ReportData[MBIC_PAYLOADSTART + 42] : %x \r\n", Alarm_ReportData[MBIC_PAYLOADSTART + 42]);
|
5200
|
5205
|
}
|
5201
|
5206
|
|
5202
|
5207
|
bool MBIC_Operate(uint8_t* data){
|