|
|
@@ -85,11 +85,13 @@ static int8_t check_segCode(uint8_t segcode,uint8_t *error)
|
|
|
static int8_t check_segCode_first(uint8_t segcode[], Usrc7SegDa *seg, uint8_t *error)
|
|
|
{
|
|
|
int8_t da = 0x00;
|
|
|
- uint8_t i = 0;
|
|
|
+ uint8_t i = 0,bpl = 0x00;
|
|
|
uint16_t sum = 0;
|
|
|
static uint8_t flag = 0;
|
|
|
|
|
|
g_xspCollDa.bcorrect = 0;
|
|
|
+
|
|
|
+ bpl = 0x00;
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
switch (segcode[i]) {
|
|
|
case 0x3E: case 0x3B: case 0x37: case 0x1F: *error = 1;
|
|
|
@@ -133,6 +135,7 @@ static int8_t check_segCode_first(uint8_t segcode[], Usrc7SegDa *seg, uint8_t *e
|
|
|
case 0x72: case 0x38: case 0xF2: case 0xB8: // 去掉P和L的情况
|
|
|
*error = 1;
|
|
|
da = -1;
|
|
|
+ bpl = 0x01;
|
|
|
break;
|
|
|
case 0x00: // 处理没有显示的数据
|
|
|
seg->val[i] = segcode[i];
|
|
|
@@ -146,11 +149,15 @@ static int8_t check_segCode_first(uint8_t segcode[], Usrc7SegDa *seg, uint8_t *e
|
|
|
//printf("%02x,",segcode[i]);
|
|
|
}
|
|
|
//printf("\n");
|
|
|
+
|
|
|
+ if(bpl == 0x01) goto ERROR_END;
|
|
|
+
|
|
|
if(da == 0x00){ // 考虑去掉P和L的情况
|
|
|
if (sum == 0) da = -1;
|
|
|
else da = 1;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
if(*error == 0x00) return da;
|
|
|
ERROR_END:
|
|
|
for(i=0;i<16;i++){
|
|
|
@@ -547,6 +554,7 @@ void save_record_to_flash(uint8_t recordMode)
|
|
|
// printf("~~~~~~~~~~~~~~addtime = %d, oil = %d\n",addTime, g_xspCollDa.curDisp.oil);
|
|
|
// }
|
|
|
|
|
|
+ g_xspCollDa.lastbSaveRecord = 0;
|
|
|
if((recordMode == 0x01) &&(g_xspCollDa.bcheckDa == 0) ){//
|
|
|
|
|
|
if((g_xspCollDa.curDisp.amount == 888888) || (g_xspCollDa.curDisp.oil == 888888)) return;
|
|
|
@@ -772,6 +780,7 @@ void analysis_7seg_code(uint8_t _7egDa[])
|
|
|
printf("显示屏显示为0.00, 加油开始.......\n");
|
|
|
if(g_xspCollDa.bSaveRecode == 0x01) {// 判断是否需要存储记录
|
|
|
save_record_to_flash(0x00);
|
|
|
+ printf("xsp change 00 save\n");
|
|
|
g_xspCollDa.bSaveRecode = 0x00;
|
|
|
}
|
|
|
memset(&g_xspCollDa.lastDisp, 0, sizeof(dispData));
|
|
|
@@ -800,6 +809,7 @@ void analysis_7seg_code(uint8_t _7egDa[])
|
|
|
|
|
|
ret = get_data_from_7segCode(src7Da, &temp);
|
|
|
if(ret == 0) goto ERROR_END;
|
|
|
+ if(((temp.oil == 0x00) && (temp.amount!= 0x00))||((temp.oil!=0)&&(temp.amount==0))) return;
|
|
|
tampTime = Get_SysTick()-g_xspCollDa.lastcomTick;
|
|
|
g_xspCollDa.lastcomTick = Get_SysTick();
|
|
|
if ((g_xspCollDa.curstatus == STATUS_START) ) {
|
|
|
@@ -822,9 +832,10 @@ void analysis_7seg_code(uint8_t _7egDa[])
|
|
|
else {
|
|
|
if((temp.amount==0x00)&&(temp.oil==0x00)){
|
|
|
//printf("ccccccccccccccccccc\n");
|
|
|
- if(g_xspCollDa.bSaveRecode == 0x01) {// 判断是否需要存储记录
|
|
|
+ if(g_xspCollDa.lastbSaveRecord == 0x01) {// 判断是否需要存储记录
|
|
|
save_record_to_flash(0x00);
|
|
|
- g_xspCollDa.bSaveRecode = 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));
|
|
|
@@ -920,9 +931,10 @@ void analysis_7seg_code(uint8_t _7egDa[])
|
|
|
}
|
|
|
else g_xspCollDa.startToprog = 0;
|
|
|
if(g_xspCollDa.startToprog > 5){
|
|
|
- if(g_xspCollDa.bSaveRecode==0x01){
|
|
|
+ if(g_xspCollDa.lastbSaveRecord==0x01){
|
|
|
save_record_to_flash(0x00);
|
|
|
- g_xspCollDa.bSaveRecode = 0x00;
|
|
|
+ printf("xsp change 02 save\n");
|
|
|
+ g_xspCollDa.lastbSaveRecord = 0x00;
|
|
|
}
|
|
|
memcpy(&g_xspCollDa.lastDisp,&temp,sizeof(dispData));
|
|
|
g_xspCollDa.lastTick1 = g_xspCollDa.lastTick;
|
|
|
@@ -951,6 +963,7 @@ void analysis_7seg_code(uint8_t _7egDa[])
|
|
|
memcpy(&g_xspCollDa.lastDisp, &temp, sizeof(dispData));
|
|
|
g_xspCollDa.curstatus = STATUS_STOP; // 加油停止
|
|
|
g_xspCollDa.bstart00 = 0;
|
|
|
+ g_xspCollDa.lastbSaveRecord = g_xspCollDa.bSaveRecode;
|
|
|
}
|
|
|
if (g_xspCollDa.curstatus == STATUS_STOP) printf("加油中止,");
|
|
|
else if (g_xspCollDa.curstatus == STATUS_END) printf("加油结束,");
|