Отправка данных о счетчике енкодера 1902181804
This commit is contained in:
parent
5904a3045a
commit
66aca25662
|
|
@ -12,8 +12,10 @@ unsigned long calibrate_count[ENCWORKER];
|
||||||
char z[ENCWORKER];
|
char z[ENCWORKER];
|
||||||
bool inited = false;
|
bool inited = false;
|
||||||
int center;
|
int center;
|
||||||
|
unsigned long count;
|
||||||
|
|
||||||
void encoder_init(){
|
void encoder_init(){
|
||||||
|
count = 0;
|
||||||
config.STORE_ENCODER = false;
|
config.STORE_ENCODER = false;
|
||||||
for (int i = 0; i< SENSORS;i++){
|
for (int i = 0; i< SENSORS;i++){
|
||||||
portVector[i]=-1;
|
portVector[i]=-1;
|
||||||
|
|
@ -88,6 +90,8 @@ bool getEncEnabled(unsigned char port,bool value){
|
||||||
if (config.debug.EncoderDebug>2) d(str(port)+" не попал о окно "+str(works[portVector[port]].Count));
|
if (config.debug.EncoderDebug>2) d(str(port)+" не попал о окно "+str(works[portVector[port]].Count));
|
||||||
}
|
}
|
||||||
t("enc_end");
|
t("enc_end");
|
||||||
|
if (works[portVector[port]].State)
|
||||||
|
send_encoder_tick(port,count);
|
||||||
return works[portVector[port]].State;
|
return works[portVector[port]].State;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
@ -99,8 +103,11 @@ bool getEncEnabled(unsigned char port,bool value){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void on_io_int(unsigned char linestate){
|
void on_io_int(unsigned char linestate){
|
||||||
t("enc_int_start");
|
t("enc_int_start");
|
||||||
|
count ++;
|
||||||
string workers = vector[linestate-1];
|
string workers = vector[linestate-1];
|
||||||
if(calibrate_mode>0){
|
if(calibrate_mode>0){
|
||||||
for (int i=0;i<len(config.EncoderCfg.workedPorts);i++){
|
for (int i=0;i<len(config.EncoderCfg.workedPorts);i++){
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
#message "link global not defined"
|
#message "link global not defined"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define VERSION "2.0b_1902121725"
|
#define VERSION "2.0b_1902181804"
|
||||||
#define MAX_FIFO_SIZE 20
|
#define MAX_FIFO_SIZE 20
|
||||||
#define BRAKER_COUNT 3
|
#define BRAKER_COUNT 3
|
||||||
|
|
||||||
|
|
@ -125,3 +125,4 @@ extern BrakerProcess brakers[BRAKER_COUNT];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
10
net.tc
10
net.tc
|
|
@ -124,6 +124,16 @@ void send_sensor(int number, bool state){
|
||||||
sock.send();
|
sock.send();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void send_encoder_tick(int number, unsigned long count){
|
||||||
|
sock.num = 0;
|
||||||
|
if (sock.statesimple == PL_SSTS_EST){
|
||||||
|
if (config.debug.SensorsLook)
|
||||||
|
d("Send sensor tick "+str(number)+" : "+stri(count));
|
||||||
|
sock.setdata("enc="+str(number)+":"+(lstri(count))+chr(13)+chr(10));
|
||||||
|
sock.send();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void net_send_data(int sock_num,string data){
|
void net_send_data(int sock_num,string data){
|
||||||
int n = sock.num;
|
int n = sock.num;
|
||||||
|
|
|
||||||
1
net.th
1
net.th
|
|
@ -7,4 +7,5 @@ void net_diag_handle(string message);
|
||||||
void net_config_handle(string message);
|
void net_config_handle(string message);
|
||||||
void net_sensor_handle(string message);
|
void net_sensor_handle(string message);
|
||||||
void send_sensor(int number, bool state);
|
void send_sensor(int number, bool state);
|
||||||
|
void send_encoder_tick(int number, unsigned long count);
|
||||||
void net_send_data(int sock_num,string data);
|
void net_send_data(int sock_num,string data);
|
||||||
Loading…
Reference in New Issue