fix(MCU课设): 修正上一个bug

This commit is contained in:
iridiumR 2022-06-07 14:35:34 +08:00
parent 4a01b42afe
commit c1e8bcc7cf
2 changed files with 13 additions and 3 deletions

View file

@ -15,7 +15,7 @@
#include "eeprom.h"
#include "delay.h"
extern unsigned int bestScore[10];
unsigned int bestScore[10]={0};
/*----------------------------
Disable ISP/IAP/EEPROM function
@ -90,7 +90,17 @@ void IapEraseSector(WORD addr)
void addBest(unsigned int s)
{
bestScore[2]=s;
int i,j;
for(i=0;i<10;i++)
if(bestScore[i]<s)
{
for(j=9;j>i;j--)
bestScore[j]=bestScore[j-1];
bestScore[i]=s;
return;
}
}
void saveBest()

View file

@ -24,7 +24,7 @@ Menu* LAST = NULL; //
enum OPR opr = idle;
static unsigned char local[2] = {0};
unsigned int score;
unsigned int bestScore[10];
extern unsigned int bestScore[10];
extern enum GS blockGameStatus;