2 Commits 25a589ddc2 ... cea443198e

Author SHA1 Message Date
  gaochunhui cea443198e 2024.07.03 1 year ago
  gaochunhui cdfde687c0 2024.06.28 1 year ago
3 changed files with 45 additions and 26 deletions
  1. 1 1
      App/public.h
  2. 43 24
      App/xspDataOpt.c
  3. 1 1
      Project/XspBoardPro.uvprojx

+ 1 - 1
App/public.h

@@ -7,7 +7,7 @@
 extern uint8_t g_bhavePrice;
 
 #define DEV_TYPE 0x0904
-#define APP_VERSION 0x0904302C
+#define APP_VERSION 0x0904312D
 
 
 #define BROADCAST_SN   0xFFFFFFFF // ¹ã²¥µØÖ·

+ 43 - 24
App/xspDataOpt.c

@@ -132,7 +132,7 @@ static int8_t check_segCode_first(uint8_t segcode[], Usrc7SegDa *seg, uint8_t *e
         case 0x80:// 只有点的情况,不算是错误码,直接转成空即不显示
             seg->val[i] = 0x00;
             break;
-        case 0x72: case 0x38: case 0xF2: case 0xB8: // 去掉P和L的情况
+        case 0x73: case 0x38: case 0xF3: case 0xB8: // 去掉P和L的情况
             *error = 1;
             da = -1;
             bpl = 0x01;
@@ -150,9 +150,12 @@ static int8_t check_segCode_first(uint8_t segcode[], Usrc7SegDa *seg, uint8_t *e
     }
     //printf("\n");
 
-    if(bpl == 0x01) goto ERROR_END;
-
-    if(da == 0x00){  //   考虑去掉P和L的情况
+    if(bpl == 0x01){// 说明已经是PL,
+        da = -1;
+        printf("显示为___P\n");
+        goto ERROR_END;
+    }
+    else if(da == 0x00){  //   考虑去掉P和L的情况
         if (sum == 0) da = -1;
         else da = 1;
     }
@@ -181,7 +184,7 @@ ERROR_END:
         }
     }
     else if(g_logMsg.logType == LOG_TYPE_NULL){
-        if(timeout_isOut(&g_xspErrDa.timer) && flag == 1){
+        if(timeout_isOut(&g_xspErrDa.timer) && (flag == 1)){
             for(i=0;i<16;i++){
                 if(g_xspErrDa.lastsegDa[i] != g_xspErrDa.segDa[i]) {
                     memcpy(g_xspErrDa.lastsegDa,g_xspErrDa.segDa,16);
@@ -555,6 +558,7 @@ void save_record_to_flash(uint8_t recordMode)
 //    }
 
     g_xspCollDa.lastbSaveRecord = 0;
+    if(g_xspCollDa.curDisp.price > 5000) return; // 单价大于
     if((recordMode == 0x01) &&(g_xspCollDa.bcheckDa == 0) ){//
 
         if((g_xspCollDa.curDisp.amount == 888888) || (g_xspCollDa.curDisp.oil == 888888)) return;
@@ -572,7 +576,7 @@ void save_record_to_flash(uint8_t recordMode)
     {
         if((g_xspCollDa.lastDisp.amount == 888888) || (g_xspCollDa.lastDisp.oil == 888888)) return;
         if((g_xspCollDa.lastDisp.amount == 0) || (g_xspCollDa.lastDisp.oil == 0)) return ;
-        if(g_xspCollDa.lastDisp.amount == g_xspCollDa.lastDisp.oil) return;
+        //if(g_xspCollDa.lastDisp.amount == g_xspCollDa.lastDisp.oil) return; // 油量 和金额相同的
         if(g_xspCollDa.lastDisp.amount >=999999 || g_xspCollDa.lastDisp.oil>=999999) return;
         amount = g_xspCollDa.curDisp.amount - g_xspCollDa.lastDisp.amount;
         if((g_xspCollDa.curDisp.amount!=0) &&(amount>0) && (amount <50)){ // 和当前的值校正一下
@@ -821,7 +825,9 @@ void analysis_7seg_code(uint8_t _7egDa[])
                     g_xspCollDa.startToprog++;
                     g_xspCollDa.lastTick = Get_SysTick();
                 }
-                if((g_xspCollDa.startToprog > 5)||(g_xspCollDa.gunStatus==GUN_UP)){//||(g_gunStatus[0].curst==HIGHT_LOW)||(g_gunStatus[0].curst == LOW_LEVEL)
+                else g_xspCollDa.startToprog = 0;
+
+                if((g_xspCollDa.startToprog > 5)){//||((g_xspCollDa.gunStatus==GUN_UP))  //||(g_gunStatus[0].curst==HIGHT_LOW)||(g_gunStatus[0].curst == LOW_LEVEL)
                     g_xspCollDa.curstatus = STATUS_PROG; // 加油过程
                     memcpy(&g_xspCollDa.lastDisp, &temp, sizeof(dispData));
                 }
@@ -830,21 +836,21 @@ void analysis_7seg_code(uint8_t _7egDa[])
 
         }
         else {
-            if((temp.amount==0x00)&&(temp.oil==0x00)){
-                //printf("ccccccccccccccccccc\n");
-                if(g_xspCollDa.lastbSaveRecord == 0x01) {// 判断是否需要存储记录
-                    save_record_to_flash(0x00);
-                    printf("xsp change 01 save\n");
-                    g_xspCollDa.lastbSaveRecord = 0x00;
-                }
-                memset(&g_xspCollDa.lastDisp, 0, sizeof(dispData));
-                memset(&g_xspCollDa.curDisp, 0, sizeof(dispData));
-                g_xspCollDa.lastTick = Get_SysTick();
-                g_xspCollDa.startTime = Get_SysTick();
-                g_xspCollDa.startToprog = 0;
-                g_xspCollDa.bcheckDa = 0;
-                g_xspCollDa.curstatus = STATUS_START; // 加油开始
-            }
+//            if((temp.amount==0x00)&&(temp.oil==0x00) &&(g_xspCollDa.curstatus==STATUS_STOP)){
+//                if(g_xspCollDa.lastbSaveRecord == 0x01) {// 判断是否需要存储记录
+//                    save_record_to_flash(0x00);
+//                    printf("xsp change 01 save\n");
+//                    g_xspCollDa.lastbSaveRecord = 0x00;
+//                    g_xspCollDa.bSaveRecode = 0x00;
+//                }
+//                memset(&g_xspCollDa.lastDisp, 0, sizeof(dispData));
+//                memset(&g_xspCollDa.curDisp, 0, sizeof(dispData));
+//                g_xspCollDa.lastTick = Get_SysTick();
+//                g_xspCollDa.startTime = Get_SysTick();
+//                g_xspCollDa.startToprog = 0;
+//                g_xspCollDa.bcheckDa = 0;
+//                g_xspCollDa.curstatus = STATUS_START; // 加油开始
+//            }
         }
 
         memcpy(&g_xspCollDa.curDisp, &temp, sizeof(dispData));
@@ -901,14 +907,14 @@ void analysis_7seg_code(uint8_t _7egDa[])
         else if (g_xspCollDa.curstatus == STATUS_STOP) { // 停止后,又开始变化的,要判断一下当前的数据是继续加油还是数据的查询
             eAmount = abs((int)temp.amount - (int)g_xspCollDa.lastDisp.amount);
             eOil = abs((int)temp.oil - (int)g_xspCollDa.lastDisp.oil);
-            if ((eAmount < 100) && (eOil < 10)) {
+            if ((eAmount < 100) && (eOil < 50)) {
                 printf("加油继续........(%010u) ", Get_SysTick());
                 printf("%d,%d,%d\n", temp.amount, temp.oil, temp.price);
 
                 memcpy(&g_xspCollDa.lastDisp, &temp, sizeof(dispData));
                 g_xspCollDa.lastTick = Get_SysTick();  // 只有在加油时,记录时间戳
                 g_xspCollDa.curstatus = STATUS_PROG;
-                g_xspCollDa.bSaveRecode = 1;
+                //g_xspCollDa.bSaveRecode = 1;
             }
             else {
                 printf("数据查询 ");
@@ -1003,6 +1009,7 @@ void anay_7eg(void)
 {
     uint8_t i;//,j;
     uint8_t index,pos;//,bindex
+    static uint16_t  testflag = 1;
 //    dispData tempda;
 //    static uint8_t bfirst = 0;
 //    uint8_t ret = 0;
@@ -1033,6 +1040,18 @@ void anay_7eg(void)
 
     //g_7egDa[12] = 0xFE;//g_7egDa[12]&(~0x01);
     //g_7egDa[4] &= 0x3F;
+//    testflag++;
+//    if((testflag%23) == 0){
+//        g_7egDa[11]  &= 0xf2;
+//    }
+//    else if((testflag%33)==0){
+//        g_7egDa[11]  &= 0x5f;
+//    }
+//    else if((testflag%43) == 0) {
+//        g_7egDa[10]  &= 0x5f;
+//        testflag = 0x01;
+//    }
+//    g_7egDa[12] = g_7egDa[13] = g_7egDa[14] = g_7egDa[15] = 0;
     check_gun_status_to_save_record();
     analysis_7seg_code(g_7egDa);
 

+ 1 - 1
Project/XspBoardPro.uvprojx

@@ -83,7 +83,7 @@
             <RunUserProg1>1</RunUserProg1>
             <RunUserProg2>1</RunUserProg2>
             <UserProg1Name>fromelf --bin !L --output app.bin</UserProg1Name>
-            <UserProg2Name>wbjw_bin.exe -a 08018000 -d 0904 -f 3 -v 02C -r .\app.bin</UserProg2Name>
+            <UserProg2Name>wbjw_bin.exe -a 08018000 -d 0904 -f 3 -v 12D -r .\app.bin</UserProg2Name>
             <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
             <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
             <nStopA1X>0</nStopA1X>