1 Star 0 Fork 0

jsshinechow/JW

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
data.c 17.15 KB
一键复制 编辑 原始数据 按行查看 历史
jsshinechow 提交于 2018-11-23 13:36 . 机务软甲
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
#include "string.h"
extern GATE_AMPMAX stGateAmpMax;
int WaveSave(int mode) //mode > 0 为长按键,直接进入记录菜单
//返回值-1未做,0开或停自动存,1人工存,2屏拷3进入数据处理
{
return 1;
}
int DataMenu(int mode) //mode > 0 为长按键,直接进入记录菜单
{ //返回值-1未做,0开或停自动存,1人工存,2屏拷3进入数据处理
return 1;
}
int DataProcedure() //数据处理
{
return 1;
}
int DataSave() //返回1表示已存,0未存
{
return 1;
}
int DataStore(int file_no)
{ //存储波形及数据
int file_total;
int offset,fat_offset,file_offset;
// int data_len;
int Channel = MGetChannel();
int nCurrentUser = GetCurrentUser();
file_total = DataDelete(-1); //参数为负或正常删除返回剩余数据总数,参数过大返回-1
offset = C_OFF_FILEINFO + C_SIZE_INT;
fat_offset = C_OFF_FAT + C_LEN_FAT * file_total;
MCopyProtectedMemory((void*)fat_offset, (void*)offset, C_LEN_FAT, PM_COPY_MOVE); //以上为文件头
MCopyProtectedMemory(&fat, (void*)fat_offset, C_LEN_FAT, PM_COPY_READ);
file_offset = C_OFF_FILE + fat.posi;
///Write_Number(100,30,file_offset,10,0,0);///
offset = C_OFF_SYSTEM + C_LEN_SYSPARA * nCurrentUser;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_SYSPARA, PM_COPY_MOVE);//系统参数
//Write_Number(10,40,file_offset,10,0,0);
//Write_Number(100,40,offset,4,0,0);
file_offset += C_LEN_SYSPARA;
///offset = C_OFF_CHANNEL + C_LEN_CHNPARA * MGetChannel();
offset = C_OFF_CHANNEL + C_LEN_CHNPARA * C_CHMAX * nCurrentUser + C_LEN_CHNPARA * Channel;
//MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_CHNPARA, PM_COPY_MOVE);//通道参数
MCopyProtectedMemory((void*)file_offset, (void*)offset, C_LEN_CHSTATUS, PM_COPY_MOVE);
//Write_Number(10,50,file_offset,10,0,0);
//Write_Number(6100,50,offset,4,0,0);
offset += C_LEN_CHSTATUS;
file_offset += C_LEN_CHSTATUS;
MCopyProtectedMemory((void*)file_offset, (void*)offset, C_LEN_CHPARA, PM_COPY_MOVE);
//Write_Number(10,60,file_offset,10,0,0);
//Write_Number(6100,60,offset,4,0,0);
offset += C_LEN_CHPARA;
file_offset += C_LEN_CHPARA;
MCopyProtectedMemory((void*)file_offset, (void*)offset, C_LEN_GATEPARA, PM_COPY_MOVE);
//Write_Number(10,70,file_offset,10,0,0);
//Write_Number(100,70,offset,4,0,0);
offset += C_LEN_GATEPARA;
file_offset += C_LEN_GATEPARA;
MCopyProtectedMemory((void*)file_offset, (void*)offset, C_LEN_GATEPARA, PM_COPY_MOVE);
//Write_Number(10,80,file_offset,10,0,0);
//Write_Number(100,80,offset,4,0,0);
offset += C_LEN_GATEPARA;
file_offset += C_LEN_GATEPARA;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_DAC, PM_COPY_MOVE);
//Write_Number(10,90,file_offset,10,0,0);
//Write_Number(100,90,offset,4,0,0);
offset += C_LEN_DAC;
file_offset += C_LEN_DAC;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_WELD, PM_COPY_MOVE); //焊缝
file_offset += C_LEN_WELD;
offset = C_OFF_PEAK;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_PEAK, PM_COPY_MOVE);//门参数
//Write_Number(10,100,file_offset,10,0,0);
//Write_Number(100,100,offset,4,0,0);
file_offset += C_LEN_PEAK;
offset = C_OFF_SAMP;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, 1*C_LEN_SAMP, PM_COPY_MOVE); //波形参数
//Write_Number(10,110,file_offset,10,0,0);
//Write_Number(100,110,offset,4,0,0);
file_offset += C_LEN_SAMP;
offset = C_OFF_FREQ;
MCopyProtectedMemory( (void*)file_offset, (void*)offset, 1*C_LEN_SAMP, PM_COPY_MOVE); //频谱
//Write_Number(10,120,file_offset,10,0,0);
//Write_Number(100,120,offset,4,0,0);
//MAnyKeyReturn();
//file_offset += 1*C_LEN_SAMP;
//offset = C_OFF_DAC;
//MCopyProtectedMemory( (void*)file_offset, (void*)offset, C_LEN_DAC, PM_COPY_MOVE); //DAC参数
//MCopyProtectedMemory( (void*)file_offset, &Dac, C_LEN_DAC, PM_COPY_WRITE); //DAC参数
return 1;
}
void DispEchoPara2(void)
{
int para1,para2,para3,para4;
// int xpos,ypos,row_height = 24;
int mode1,mode2;
mode1 = MGetBGateMode();
mode2 = MGetEquivalentMode(); //mode1=0B门失波1进波,mode2<0波高.>0dB数
if( MGetStdMode() == C_STD_AWS_NUM - 1)//AWS
{
mode1 = 0;
mode2 = -1;
}
para1 = ChannelPara.wavepara[0] ; //距离
para2 = ChannelPara.wavepara[1] ; //距离
para3 = ChannelPara.wavepara[2] ; //距离
para4 = ChannelPara.wavepara[3] ; //距离
if(mode1 == 0)
{
if( mode2 > 0)
{ //将波高转换dB值
switch (mode2)
{
case 1:
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
break;
case 10:
break;
case 11://显示孔径
para4 += MGetLineGain(2);
if( MGetUnitType() > 0 )
{
Write_Number(23*8,C_COORVPOSI - 10,(int)( 10*powf( 10,( para4 + 120 ) / 400.0)*100/25.4 + 0.5), 4,3,0);
}
else
{
Write_Number(23*8,C_COORVPOSI - 10,(int)( 10*powf( 10,( para4 + 120 ) / 400.0) + 0.5), 3,1,0);
}
// Write_Number(23*8,C_COORVPOSI - 10,(int)( 10*powf( 10,( para4 + 120 ) / 400.0) + 0.5), 3,1,0);
para4 -= MGetLineGain(2);
break;
}
}
}
WritePeakInfo(mode1,mode2,para1,para2,para3,para4);
if( MGetStdMode() == C_STD_AWS_NUM - 1)//AWS
{
int x = 28+2;
int ypos;
ypos = C_COORVPOSI+2;
EMenuOut(x,ypos,"d=",2,1,8);
if( MGetUnitType() > 0)para3 = (int)((para1 - 1000)*2+500)/1000;
else para3 = (int)((para1 - 254)*2+127)/254;
para1 = para4;
//Write_Number(10,50,para1,8,0,1);
if( para1 < 1)para1 = 1;
para1 = (int)( 200 * ( log10(para1) - log10(600) ) );
//Write_Number(100,50,para1,8,0,1);
para1 = (MGetBaseGain() + MGetCompGain() - para1+5)/10;
//Write_Number(200,50,para1,8,0,1);
para2 = (MGetBaseGain()+5)/10;
x += 8*2;
Write_Number(x,ypos,para1,2,0,0);
x+= 8*2;
EMenuOut(x,ypos,"-",1,1,8);
x += 8*1;
Write_Number(x,ypos,para2,2,0,0);
x+= 8*2;
EMenuOut(x,ypos,"-",1,1,8);
x += 8*1;
Write_Number(x,ypos,para3,2,0,0);
x+= 8*2;
EMenuOut(x,ypos,"=",1,1,8);
x += 8*1;
Write_Number(x,ypos,para1-para2-para3,3,0,1);
}
if( MGetDepth() != 0)
{
Write_Number(23*8,19,MGetDepth(),5,1,1);
}
//Write_Number(10,30,10,4,0,0);
return;
}
int DataRestore(int file_no)
{ //存储波形及数据
int offset,fat_offset,file_offset;
// int data_len;
// u_char* sampbuff;
// int dataposi;
fat_offset = C_OFF_FAT + C_LEN_FAT * file_no ;
offset = C_OFF_FILEINFO + C_SIZE_INT;
MCopyProtectedMemory( (void*)offset, (void*)fat_offset, C_LEN_FAT, PM_COPY_MOVE); //以上为文件头
short prnmode = MGetPrinterMode();
file_offset = ( ( C_OFF_FILE + GetDataPosi(file_no) + 1)/2)*2;
///Write_Number(100,30,file_offset,10,0,0);///
MCopyProtectedMemory( &SystemStatus, (void*)file_offset,C_LEN_SYSPARA, PM_COPY_READ);//系统参数
MSetPrinterMode(prnmode,C_SETMODE_SETSAVE);
file_offset += C_LEN_SYSPARA;
MCopyProtectedMemory(&ChannelStatus, (void*)file_offset, C_LEN_CHSTATUS, PM_COPY_READ);
file_offset += C_LEN_CHSTATUS;
MCopyProtectedMemory(&ChannelPara, (void*)file_offset, C_LEN_CHPARA, PM_COPY_READ);
file_offset += C_LEN_CHPARA;
MCopyProtectedMemory(&AGatePara, (void*)file_offset, C_LEN_GATEPARA, PM_COPY_READ);
file_offset += C_LEN_GATEPARA;
MCopyProtectedMemory(&BGatePara, (void*)file_offset, C_LEN_GATEPARA, PM_COPY_READ);
file_offset += C_LEN_GATEPARA;
offset = C_OFF_DAC;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, C_LEN_DAC, PM_COPY_MOVE); //DAC参数
//Write_Number(10,90,file_offset,10,0,0);
//Write_Number(100,90,offset,4,0,0);
file_offset += C_LEN_DAC;
MCopyProtectedMemory(&stWeldPara, (void*)file_offset, C_LEN_WELD, PM_COPY_READ);
file_offset += C_LEN_WELD;
offset = C_OFF_PEAK;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, C_LEN_PEAK, PM_COPY_MOVE);//门参数
//Write_Number(10,100,file_offset,10,0,0);
//Write_Number(100,100,offset,4,0,0);
file_offset += C_LEN_PEAK;
offset = C_OFF_SAMP;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, 1*C_LEN_SAMP, PM_COPY_MOVE) ; //波形参数
/*/Write_Number(10,110,file_offset,10,0,0);
//Write_Number(100,110,offset,4,0,0);
// MAnyKeyReturn();
u_char echobuffer[C_LEN_SAMP];
MCopyProtectedMemory( echobuffer, (void*)file_offset, C_LEN_SAMP, PM_COPY_READ); //波形参数
// MChannelRenovate();
// DrawWave(echobuffer,0,C_LEN_SAMP); //画波形
//Write_Number(0,0,1,4,0,0);
// MAnyKeyReturn();
Write_Number(10,120,file_offset,10,0,0);
Write_Number(100,120,offset,4,0,0);
Write_Number(150,120,C_LEN_SAMP,4,0,0);
MCopyProtectedMemory( echobuffer, (void*)offset, C_LEN_SAMP, PM_COPY_READ); //波形参数
Write_Number(0,0,2,4,0,0);
MChannelRenovate();
Write_Number(0,0,3,4,0,0);
DrawWave(echobuffer,0,C_LEN_SAMP); //画波形
Write_Number(0,0,4,4,0,0);
MAnyKeyReturn();
//*/
file_offset += C_LEN_SAMP;
offset = C_OFF_FREQ;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, 1*C_LEN_SAMP, PM_COPY_MOVE); //频谱
//Write_Number(10,120,file_offset,10,0,0);
//Write_Number(100,120,offset,4,0,0);
//Write_Number(150,120,C_LEN_SAMP,4,0,0);
//file_offset += 1*C_LEN_SAMP;
//offset = C_OFF_DAC;
//MCopyProtectedMemory( (void*)offset, (void*)file_offset, C_LEN_DAC, PM_COPY_MOVE); //DAC参数
// MAnyKeyReturn();
MSetAcquisition(0);
return 1;
}
int DataDisplay(int file_no) //显示存储得数据
{
int offset;//,file_offset,fat_offset;
u_char echobuffer[C_LEN_SAMP];
int file_total = DataDelete(-1); //参数为负或正常删除返回剩余数据总数,参数过大返回-1
DataRestore(file_no);
stCurveAmend.Angle = MGetAngle(0);
stCurveAmend.Diameter = MGetDiameter();
stCurveAmend.Thick = MGetThick();
MSetCurveAmend(&stCurveAmend);
if( stCurveAmend.Thick < 20)MSetFunctionMode(0,C_CURVER_AMEND);
/*
//offset = C_OFF_PEAK;
//MCopyProtectedMemory(&GatePeak, (void*)offset, C_LEN_PEAK, PM_COPY_READ);//门参数
file_offset = ( ( C_OFF_FILE + GetDataPosi(file_no) + 1)/2)*2;
file_offset += C_LEN_SYSPARA;
file_offset += C_LEN_CHSTATUS;
file_offset += C_LEN_CHPARA;
file_offset += C_LEN_GATEPARA;
file_offset += C_LEN_GATEPARA;
file_offset += C_LEN_DAC;
file_offset += C_LEN_PEAK;
//*/
offset = C_OFF_SAMP;
MCopyProtectedMemory(echobuffer, (void*)offset, C_LEN_SAMP-1, PM_COPY_READ); //波形参数
offset = C_OFF_DAC;
MCopyProtectedMemory( &Dac, (void*)offset, C_LEN_DAC, PM_COPY_READ);
CalcuDac();
MEraseWindow(0, 0, 20*C_ECHAR_HDOT, C_COORVPOSI - 1) ;//请屏幕左上角区域
MChannelRenovate();
DrawWave(echobuffer,0,C_LEN_SAMP-1); //画波形
DisplayPrompt(15);
DispEchoPara2();
Write_Ascii( 400,30,file_no+0x30);
Write_Number(0,9,file_no+1,4,0,0);
Write_Ascii(GetNumberLen(file_no+1)*C_ECHAR_HDOT,9,'/');
Write_Number((GetNumberLen(file_no+1) + 1)*C_ECHAR_HDOT,9,file_total,4,0,0);
// fat_offset = C_OFF_FAT + C_LEN_FAT * file_no ;
// MCopyProtectedMemory(&fat, (void*)fat_offset, C_LEN_FAT, PM_COPY_READ);
offset = C_OFF_FILEINFO + C_SIZE_INT;
MCopyProtectedMemory(&fat, (void*)offset, C_LEN_FAT, PM_COPY_READ);
WriteFileDate(0, 0, fat.date);
CEMenuOut2(11*C_ECHAR_HDOT,0,fat.name + 1,fat.name[0],1,16);
DrawDac(0); //新画DAC
return 1;
}
int GetDataPosi(int file_no) //得到第 x 个数据存储位置
{
int offset = C_OFF_FILEINFO ;
int file_total;
u_int retvalue;
MCopyProtectedMemory( &file_total, (void*)offset, C_SIZE_INT, PM_COPY_READ);
if(file_no < 0 || file_no >= file_total) retvalue = -1;
else
{
retvalue = ( (C_LEN_FILE * file_no+1)/2)*2;
}
return retvalue;
}
int DataDelete(int file_no) //删除一个数据,参数为负或正常删除返回剩余数据总数,参数过大返回-1
{
int fat_offset,file_offset ;
int offset ;
int file_total;
offset = C_OFF_FILEINFO ;
MCopyProtectedMemory( &file_total, (void*)offset, C_SIZE_INT, PM_COPY_READ);
if(file_total < 0)
{
file_total = 0;
MCopyProtectedMemory( (void*)offset, &file_total, C_SIZE_INT, PM_COPY_WRITE);
}
if(file_no < 0 )return file_total; //参数为负返回数据总数
if(file_no >= file_total)return -1;
file_total--;
MCopyProtectedMemory( (void*)offset, &file_total, C_SIZE_INT, PM_COPY_WRITE);
fat_offset = C_OFF_FAT + C_LEN_FAT * file_no; //文件头位置
file_offset = C_OFF_FILE + GetDataPosi(file_no); //文件体位置
for( file_no++ ; file_no <= file_total && file_no < C_FILE_NUMBER; file_no++ )
{
offset = fat_offset;
fat_offset += C_LEN_FAT;
MCopyProtectedMemory( (void*)offset, (void*)fat_offset, C_LEN_FAT, PM_COPY_MOVE);
offset = file_offset;
file_offset += C_LEN_FILE;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, C_LEN_FILE, PM_COPY_MOVE);
}
return file_total;
}
int FileDelete(int file_no,unsigned int off_total, unsigned off_fat,int len_fat, unsigned int off_file, int len_file) //删除一个数据,参数为负或正常删除返回剩余数据总数,参数过大返回-1
{
int fat_offset,file_offset ;
int offset ;
int file_total;
MCopyProtectedMemory( &file_total, (void*)off_total, C_SIZE_INT, PM_COPY_READ);
if(file_total < 0)
{
file_total = 0;
/// MCopyProtectedMemory( (void*)offset, &file_total, C_SIZE_INT, PM_COPY_WRITE);
MCopyProtectedMemory( (void*)off_total, &file_total, C_SIZE_INT, PM_COPY_WRITE);
}
if(file_no < 0 )return file_total; //参数为负返回数据总数
if(file_no >= file_total)return -1;
file_total--;
MCopyProtectedMemory( (void*)off_total, &file_total, C_SIZE_INT, PM_COPY_WRITE);
fat_offset = off_fat + len_fat * file_no; //文件头位置
file_offset = off_file + len_file * file_no; //文件体位置
for( file_no++ ; file_no <= file_total; file_no++ )
{
offset = fat_offset;
fat_offset += len_fat;
MCopyProtectedMemory( (void*)offset, (void*)fat_offset, C_LEN_FAT, PM_COPY_MOVE);
offset = file_offset;
file_offset += len_file;
MCopyProtectedMemory( (void*)offset, (void*)file_offset, C_LEN_FILE, PM_COPY_MOVE);
}
return file_total;
}
int SavePretreatment(void) //存储预处理
{
return 1;
}
int AutoSave(int mode)
{ //if mode < 0 return 已自动存个数,else mode >0 自动存return 1存了一个,return 0 时间未到
//return -1 表示是不在自动存
int preAutosaveTime;
int elapsedtime = GetElapsedTime()/1000; //开机时长,单位s
int autosavenum = 0;
int offset;
int file_total;
int i;
int retvalue = 0;
//Write_Number(10,40,elapsedtime,8,0,-1);
if( MGetSaveMode()==0 || MGetSaveStatus()==0 || MGetAcquisitionEnable() != 1)return -1; //return -1 表示是不在自动存
offset = C_OFF_STORE + 34; //已自动存数据个数
MCopyProtectedMemory( &autosavenum, (void*)offset, C_SIZE_INT, PM_COPY_READ);
if(mode < 0)return autosavenum; //if mode < 0 return 已自动存个数,
offset = C_OFF_STORE + 30; //前次自动存储时的开机时间sec
MCopyProtectedMemory( &preAutosaveTime, (void*)offset, sizeof(preAutosaveTime), PM_COPY_READ);
Write_Number(26 * 8 ,4 ,autosavenum,5,0,0);
elapsedtime = GetElapsedTime();
//Write_Number(10,50,elapsedtime,8,0,-1);
//Write_Number(10,60,preAutosaveTime,8,0,-1);
i = preAutosaveTime + 100*MGetSaveTime();
//Write_Number(10,60,preAutosaveTime,10,0,0);///
//Write_Number(10,70,i,10,0,0);///
//Write_Number(10,80,elapsedtime,10,0,0);///
//Write_Number(10,90,autosavenum,10,0,0);///
//Write_Number(100,40,MGetSaveTime(),8,0,-1);
//Write_Number(100,50,i,8,0,-1);
//MGetKeyCode(40);
if( elapsedtime >= i )//&& elapsedtime <= i+2000 )
{
// u_short pzText[9];
u_short month,date;
file_total = DataDelete(-1);
if( file_total >= C_FILE_NUMBER )
{
MSetSaveMode(0,C_SETMODE_SETSAVE);//关闭连续记录
MSetSaveStatus( 0,C_SETMODE_SETSAVE);
return -1;
}
MCopyProtectedMemory( (void*)offset, &elapsedtime, sizeof(elapsedtime), PM_COPY_WRITE);
autosavenum++;
offset = C_OFF_STORE + 34; //前次自动存储时的开机时间sec
MCopyProtectedMemory( (void*)offset, &autosavenum, C_SIZE_INT, PM_COPY_WRITE);
fat.posi = C_LEN_FILE * file_total;
///Write_Number(100,50,file_total,10,0,0);///
///Write_Number(100,60,fat.posi,10,0,0);///
month= fat.date = MGetSystemTime(-1);//年×65536+月×256+日,MGetCurrentDate();
date = month%256;
month = month/256;
month = month%256;
//上面已经转为HEX
/// month = Bcd2Hex(month & 0x1f );
/// date = Bcd2Hex(date & 0x3f ); /* 日期 BCD码转换成十六进制 */
fat.name[0] = 8;
fat.name[1] = month/10 + 48;
fat.name[2] = month%10 + 48;
fat.name[3] = date/10 + 48;
fat.name[4] = date%10 + 48;
fat.name[5] = autosavenum / 1000 + 48;
fat.name[6] = ( autosavenum / 100 )% 10 + 48;
fat.name[7] = ( autosavenum / 10 )% 10 + 48;
fat.name[8] = ( autosavenum / 1 )% 10 + 48;
offset = C_OFF_FILEINFO + C_SIZE_INT;
MCopyProtectedMemory( (void*)offset, &fat, C_LEN_FAT, PM_COPY_WRITE); //以上为文件头
SavePretreatment(); //存储预处理
if(DataStore(file_total) != 1) return 0;
offset = C_OFF_FILEINFO;
file_total++;
MCopyProtectedMemory( (void*)offset, &file_total, C_SIZE_INT, PM_COPY_WRITE);
///Write_Number(10,30,file_total,4,0,0);////
///CEMenuOut2(10,40,fat.name + 1,fat.name[0],1,16);///
retvalue = 1;
}
return retvalue;
}
int AutoSavePlay(int file_no,int file_total) //从当前数据开始播放连续存储的波形
{
return 1;
}
int SeekDate(int file_total)
{
int fat_offset;
int file_no = 0;
TIME_CLOCK TimeClock;
u_int date;
int retvalue = file_total;
Write_Space(0,9,10,0);
InputDate(0,9,&TimeClock);
date = date2int(&TimeClock);
while(file_no < file_total)
{
fat_offset = C_OFF_FAT + C_LEN_FAT * file_no ;
MCopyProtectedMemory(&fat, (void*)fat_offset, C_LEN_FAT, PM_COPY_READ);
if(fat.date == date)
{ retvalue = file_no;
break;
}
file_no++;
}
return retvalue;
}
int SeekName(int file_total)
{
int fat_offset;
int file_no = 0;
int retvalue = file_total;
u_short name[9];
int i;
MEraseWindow(0, 0, 10*C_ECHAR_HDOT, 17) ;
if(MInputChar(0, 0, 1, name,16,8) != C_TRUE) return 0;
while(file_no < file_total)
{
fat_offset = C_OFF_FAT + C_LEN_FAT * file_no ;
MCopyProtectedMemory(&fat, (void*)fat_offset, C_LEN_FAT, PM_COPY_READ);
for(i=0; i<9; i++)
if(fat.name[i] != name[i])
break;
if(i == 9)
{ retvalue = file_no;
break;
}
file_no++;
}
return retvalue;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jsshinechow/JW.git
[email protected]:jsshinechow/JW.git
jsshinechow
JW
JW
master

搜索帮助