📄 modify.c
字号:
#include <reg51.h>
#define uchar unsigned char
#define uint unsigned int
#define proportion1 0.01
#define proportion2 100
extern scale;
extern idata key2;
extern void dispes(uchar position1,uchar position2,uchar chanum,uchar* p);
extern void dispes_f(uchar position1,uchar position2,uchar chanum,uchar* p);
extern idata buf[30];
void modify_float3(float x,void (*p)(),int a,int b,int c)
{ int key3=0;
key3=key2;
switch(key3/256)
{case 5:
if(scale==0)
x-=0.1;
else if(scale==1)
x-=1;
else
x-=10;
buf[a]=x*0.01;
buf[b]=x-buf[a]*100;
buf[c]=(x-buf[a]*100-buf[b])*100;
(*p)();
break;
case 4:
if(scale==0)
x+=0.1;
else if(scale==1)
x+=1;
else
x+=10;
buf[a]=x*0.01;
buf[b]=x-buf[a]*100;
buf[c]=(x-buf[a]*100-buf[b])*100;
(*p)();
break;
}
}
void modify_float2(float x,void (*p)(),int a,int b)
{ int key3=0;
key3=key2;
switch(key3/256)
{case 5:
if(scale==0)
x-=0.1;
else if(scale==1)
x-=1;
else
x-=10;
buf[a]=x;
buf[b]=(x-buf[a])*100;
(*p)();
break;
case 4:
if(scale==0)
x+=0.1;
else if(scale==1)
x+=1;
else
x+=10;
buf[a]=x;
buf[b]=(x-buf[a])*100;
(*p)();
break; }
}
void modify_int2(int x,void (*p)(),int a,int b)
{ int key3=0;
key3=key2;
switch(key3/256)
{case 5:
if(scale==0)
x-=1;
else if(scale==1)
x-=10;
else
x-=100;
buf[a]=x*0.01;
buf[b]=x-buf[a]*100;
(*p)();
break;
case 4:
if(scale==0)
x+=1;
else if(scale==1)
x+=10;
else
x+=100;
buf[a]=x*0.01;
buf[b]=x-buf[a]*100;
(*p)();
break; }
}
void modify_int1(int x,void (*p)(),int a)
{ int key3=0;
key3=key2;
switch(key3/256)
{case 5:
if(scale==0)
x-=1;
else if(scale==1)
x-=10;
else
x-=100;
buf[a]=x;
(*p)();
break;
case 4:
if(scale==0)
x+=1;
else if(scale==1)
x+=10;
else
x+=100;
buf[a]=x;
(*p)();
break; }
}
void modify_group(int x,void (*p)())
{int key3=0;
key3=key2;
switch(key3/256)
{case 5:buf[x]=1;
(*p)();
break;
case 4: buf[x]=2;
(*p)();
break; }
}
void on_off(int a,int lin)
{ if(a==1)
{ dispes(10,lin,2,"ON");
}
else
{ dispes(10,lin,3,"OFF");}
}
void on_off_f(int a,int lin)
{ if(a==1)
{ dispes_f(10,lin,2,"ON");
}
else
{ dispes_f(10,lin,3,"OFF");}
}
void on_off_state(int a,int lin)
{ if(a==1)
dispes(19,lin,2,"ON");
else
dispes(19,lin,3,"OFF");
}
void on_off_state_general(int a,int lin)
{ if(a==1)
dispes(25,lin,2,"ON");
else
dispes(25,lin,3,"OFF");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -