╤сюЁър 1901301532
This commit is contained in:
parent
126ea01dd6
commit
39d899aca1
|
|
@ -1,13 +1,13 @@
|
||||||
[project]
|
[project]
|
||||||
watch=works[i].Count, portVector, works[i].WorkPort, len(port), pinState, z, works[i], EncoderCfg.reinitInterval, works
|
watch=works[i].Count, portVector, works[i].WorkPort, len(port), pinState, z, works[i], EncoderCfg.reinitInterval, works
|
||||||
[file1]
|
[file1]
|
||||||
line=85
|
line=0
|
||||||
cursor=2097
|
cursor=263
|
||||||
opened=yes
|
opened=active
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file2]
|
[file2]
|
||||||
line=44
|
line=62
|
||||||
cursor=1179
|
cursor=1455
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file3]
|
[file3]
|
||||||
|
|
@ -26,14 +26,14 @@ cursor=161
|
||||||
opened=no
|
opened=no
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file6]
|
[file6]
|
||||||
line=5
|
line=0
|
||||||
cursor=1461
|
cursor=190
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file7]
|
[file7]
|
||||||
line=18
|
line=100
|
||||||
cursor=916
|
cursor=2644
|
||||||
opened=no
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file8]
|
[file8]
|
||||||
line=0
|
line=0
|
||||||
|
|
@ -45,7 +45,7 @@ line=0
|
||||||
cursor=0
|
cursor=0
|
||||||
opened=no
|
opened=no
|
||||||
[file10]
|
[file10]
|
||||||
line=76
|
line=22
|
||||||
cursor=5043
|
cursor=5043
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
|
|
@ -86,7 +86,7 @@ opened=no
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file18]
|
[file18]
|
||||||
line=0
|
line=0
|
||||||
cursor=55
|
cursor=334
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file19]
|
[file19]
|
||||||
|
|
@ -95,9 +95,9 @@ cursor=93
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file20]
|
[file20]
|
||||||
line=156
|
line=0
|
||||||
cursor=3777
|
cursor=2782
|
||||||
opened=active
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file21]
|
[file21]
|
||||||
line=0
|
line=0
|
||||||
|
|
@ -105,7 +105,7 @@ cursor=0
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
[file22]
|
[file22]
|
||||||
line=18
|
line=0
|
||||||
cursor=0
|
cursor=0
|
||||||
opened=yes
|
opened=yes
|
||||||
breakpoints=
|
breakpoints=
|
||||||
|
|
|
||||||
35
command.tc
35
command.tc
|
|
@ -6,6 +6,8 @@
|
||||||
#include "encoder.th"
|
#include "encoder.th"
|
||||||
|
|
||||||
static string cmdbuffer = "";
|
static string cmdbuffer = "";
|
||||||
|
string pars[10];
|
||||||
|
int par_num;
|
||||||
void on_sock_inband() // обработка поступивших команд
|
void on_sock_inband() // обработка поступивших команд
|
||||||
{
|
{
|
||||||
cmdbuffer += sock.getinband();
|
cmdbuffer += sock.getinband();
|
||||||
|
|
@ -36,6 +38,10 @@ void on_sock_inband() // обработка поступивших команд
|
||||||
cmd_replay(cmd_setencoder(params));
|
cmd_replay(cmd_setencoder(params));
|
||||||
}else if (cmd == "enc_calibrate_start"){
|
}else if (cmd == "enc_calibrate_start"){
|
||||||
cmd_replay(cmd_enc_calibre(params));
|
cmd_replay(cmd_enc_calibre(params));
|
||||||
|
}else if (cmd == "debug_sensors"){
|
||||||
|
cmd_replay(cmd_debug_sensors(params));
|
||||||
|
}else if (cmd == "debug_showtime"){
|
||||||
|
cmd_replay(cmd_debug_showtime(params));
|
||||||
}else if (cmd == "enc_calibrate_end"){
|
}else if (cmd == "enc_calibrate_end"){
|
||||||
cmd_replay(cmd_enc_calibre("0"));
|
cmd_replay(cmd_enc_calibre("0"));
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -46,6 +52,17 @@ void on_sock_inband() // обработка поступивших команд
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string cmd_debug_sensors(string params){
|
||||||
|
getParams(params);
|
||||||
|
config.debug.SensorsLook = val(pars[0])>0;
|
||||||
|
return "Debug sensors SET="+config.debug.SensorsLook? "TRUE":"FALSE";
|
||||||
|
}
|
||||||
|
string cmd_debug_showtime(string params){
|
||||||
|
getParams(params);
|
||||||
|
config.debug.ShowTime = val(pars[0])>0;
|
||||||
|
return "Debug show time SET="+config.debug.ShowTime? "TRUE":"FALSE";
|
||||||
|
}
|
||||||
|
|
||||||
void cmd_replay(string message){
|
void cmd_replay(string message){
|
||||||
sock.setsendinband(chr(sock.escchar)+" "+message+chr(sock.endchar)+chr(13)+chr(10));
|
sock.setsendinband(chr(sock.escchar)+" "+message+chr(sock.endchar)+chr(13)+chr(10));
|
||||||
}
|
}
|
||||||
|
|
@ -169,3 +186,21 @@ string cmd_setbraker(string params)
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getParams(string params){
|
||||||
|
|
||||||
|
//d("params: "+params);
|
||||||
|
unsigned char n, p, num ;
|
||||||
|
unsigned long t;
|
||||||
|
string vals = "";
|
||||||
|
par_num = 0;
|
||||||
|
n = 1;
|
||||||
|
p = instr(1,params,",",1);
|
||||||
|
while (p>0){
|
||||||
|
pars[par_num] = mid(params,n,n-p);
|
||||||
|
n = p+1;
|
||||||
|
par_num++;
|
||||||
|
p = instr(n,params,",",1);
|
||||||
|
}
|
||||||
|
pars[par_num] = mid(params,n,len(params)-n+1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -6,3 +6,6 @@ string cmd_ip(string params);
|
||||||
string cmd_setbraker(string params);
|
string cmd_setbraker(string params);
|
||||||
string cmd_setencoder(string params);
|
string cmd_setencoder(string params);
|
||||||
string cmd_enc_calibre(string params);
|
string cmd_enc_calibre(string params);
|
||||||
|
string cmd_debug_sensors(string params);
|
||||||
|
string cmd_debug_showtime(string params);
|
||||||
|
void getParams(string params);
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,12 @@ typedef struct EncoderProcess{
|
||||||
unsigned long Point;
|
unsigned long Point;
|
||||||
unsigned char WorkPort;
|
unsigned char WorkPort;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct DebugConf{
|
||||||
|
bool SensorsLook;
|
||||||
|
bool ShowTime;
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct Configuration{
|
typedef struct Configuration{
|
||||||
string IP;
|
string IP;
|
||||||
STORELOCATION STORE_LOCATON;
|
STORELOCATION STORE_LOCATON;
|
||||||
|
|
@ -84,6 +90,7 @@ typedef struct Configuration{
|
||||||
BrakerConfig BRAKERS[BRAKER_COUNT];
|
BrakerConfig BRAKERS[BRAKER_COUNT];
|
||||||
BounceConfig BOUNCE[SENSORS];
|
BounceConfig BOUNCE[SENSORS];
|
||||||
EncoderConfig EncoderCfg;
|
EncoderConfig EncoderCfg;
|
||||||
|
DebugConf debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
//#include "config_work.th"
|
//#include "config_work.th"
|
||||||
|
|
|
||||||
2
main.tc
2
main.tc
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
void d(string mess){
|
void d(string mess){
|
||||||
|
if (config.debug.ShowTime)
|
||||||
|
mess = lstr(sys.timercountms)+":\t"+mess;
|
||||||
sys.debugprint(mess+chr(13));
|
sys.debugprint(mess+chr(13));
|
||||||
int c = sock.num;
|
int c = sock.num;
|
||||||
sock.num = 2;
|
sock.num = 2;
|
||||||
|
|
|
||||||
2
net.tc
2
net.tc
|
|
@ -117,6 +117,8 @@ void net_sensor_handle(string message){
|
||||||
void send_sensor(int number, bool state){
|
void send_sensor(int number, bool state){
|
||||||
sock.num = 0;
|
sock.num = 0;
|
||||||
if (sock.statesimple == PL_SSTS_EST){
|
if (sock.statesimple == PL_SSTS_EST){
|
||||||
|
if (config.debug.SensorsLook)
|
||||||
|
d("Send sensor "+str(number)+" : "+(state?"1":"0"));
|
||||||
sock.setdata(str(number)+(state?"1":"0")+chr(13)+chr(10));
|
sock.setdata(str(number)+(state?"1":"0")+chr(13)+chr(10));
|
||||||
sock.send();
|
sock.send();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue