From: jiangzhikang <2291459494@qq.com> Date: Thu, 11 Dec 2025 09:34:57 +0000 (+0800) Subject: Power-on to read the last stored data X-Git-Url: http://kyz.pub/gitweb/?a=commitdiff_plain;h=c2c7a36c359818c8b13df1951d41952cf0165cab;p=yn%2Fcdbs.git Power-on to read the last stored data --- diff --git "a/20240801\345\256\214\346\225\264\347\211\210/\346\211\263\346\211\213\344\270\213\344\275\215\346\234\272\350\275\257\344\273\266/cpbs-202103-20240423/APP/datastore.c" "b/20240801\345\256\214\346\225\264\347\211\210/\346\211\263\346\211\213\344\270\213\344\275\215\346\234\272\350\275\257\344\273\266/cpbs-202103-20240423/APP/datastore.c" index c38e9af..15756f9 100644 --- "a/20240801\345\256\214\346\225\264\347\211\210/\346\211\263\346\211\213\344\270\213\344\275\215\346\234\272\350\275\257\344\273\266/cpbs-202103-20240423/APP/datastore.c" +++ "b/20240801\345\256\214\346\225\264\347\211\210/\346\211\263\346\211\213\344\270\213\344\275\215\346\234\272\350\275\257\344\273\266/cpbs-202103-20240423/APP/datastore.c" @@ -152,9 +152,9 @@ void Data_Record_Storage(u32 Count) RecordData.TargetValue = 0; //Ä¿±êŤ¾Ø RecordData.ActualValue = 0; //ʵ¼ÊŤ¾Ø if(SetData.Speed_Gear == 0){ - RecordData.TargetAngle = SetData.AngleValue; //Ä¿±êŤ¾Ø + RecordData.TargetAngle = SetData.AngleValue; //Ä¿±ê½Ç¶È }else if(SetData.Speed_Gear == 1){ - RecordData.TargetAngle = (SetData.AngleValue/2); //Ä¿±êŤ¾Ø + RecordData.TargetAngle = (SetData.AngleValue/2); //Ä¿±ê½Ç¶È } // RecordData.TargetAngle = SetData.AngleValue; //Ä¿±ê½Ç¶È RecordData.ActualAngle = ((Storage_NumAngle * COEFFICIENT) / TmsKeyData.MechanicalGearRatio[0]); //ʵ¼Ê½Ç¶È @@ -169,11 +169,12 @@ void Data_Record_Storage(u32 Count) }else if(SetData.Speed_Gear == 1){ RecordData.TargetValue = (GearData[SetData.GearLevel].GearParameter2); //Ä¿±êŤ¾Ø } - RecordData.ActualValue = (u32)((TwistingForce * ACTUALTORQUE)); //ʵ¼ÊŤ¾Ø + RecordData.ActualValue = (u32)((TwistingForce * ACTUALTORQUE)); //ʵ¼ÊŤ¾Ø RecordData.GearNum = (SetData.GearLevel+1); //µµÎ»µÈ¼¶ RecordData.Mode = 3; //Ñ¡¶¨Ä£Ê½ RecordData.WorkPattern = SetData.Speed_Gear; //¹¤×÷·½Ê½ I(0) II(1) - if((RecordData.ActualValue>=RecordData.TargetValue *0.95) && (RecordData.ActualValue<(RecordData.TargetValue *1.05))){ + if((RecordData.ActualValue >= (RecordData.TargetValue *0.95)) && + (RecordData.ActualValue < (RecordData.TargetValue *1.05))){ RecordData.FastenResult =1; //Å¡½ô½á¹û δš½ô(0) Å¡½ô(1) }else RecordData.FastenResult =0; //Å¡½ô½á¹û δš½ô(0) Å¡½ô(1) break; @@ -189,10 +190,10 @@ void Data_Record_Storage(u32 Count) } RecordData.ActualValue = (u32)((TwistingForce * ACTUALTORQUE)); //ʵ¼ÊŤ¾Ø // printf("Mode 7---RecordData.ActualValue: %d \r\n", RecordData.ActualValue); - if(SetData.Speed_Gear == 0){ - RecordData.TargetAngle = SetData.AngleValue; //Ä¿±êŤ¾Ø - }else if(SetData.Speed_Gear == 1){ - RecordData.TargetAngle = (SetData.AngleValue/2); //Ä¿±êŤ¾Ø + if(SetData.Speed_Gear == 0) { + RecordData.TargetAngle = SetData.AngleValue; //Ä¿±ê½Ç¶È + } else if(SetData.Speed_Gear == 1) { + RecordData.TargetAngle = (SetData.AngleValue/2); //Ä¿±ê½Ç¶È } // RecordData.TargetAngle = SetData.AngleValue; //Ä¿±ê½Ç¶È RecordData.ActualAngle = ((Storage_NumAngle * COEFFICIENT) / TmsKeyData.MechanicalGearRatio[0]); //ʵ¼Ê½Ç¶È @@ -372,6 +373,12 @@ void displayInRangeValues() TmsKeyData.FactoryCalcTorque = 100; TmsKeyData.SpannerTypener = 1; displayInRangeValues(); + if(SetData.StorageNumber > 0) { + W25QXX_Read((u8*)&RecordData,W25X_ADDR_RECORDEDDATA + (SetData.StorageNumber - 1)*sizeof(RecordData_t),sizeof(RecordData_t)); + printf("¶ÁÈ¡×îºóÒ»Ìõ´æ´¢Êý¾Ý³É¹¦£¬¼Ç¼±àºÅ£º%d\r\n", RecordData.DataCount); + } else { + printf("ûÓд洢µÄ¼Ç¼Êý¾Ý\r\n"); + } if(TmsKeyData.GearLevelLen > 200)TmsKeyData.GearLevelLen = 7; for(i = 0;i < TmsKeyData.GearLevelLen/2;i++) {