Отправка данных о счетчике енкодера 1902181804

This commit is contained in:
Иван Мокротоваров 2019-02-18 18:05:25 +03:00
parent 5904a3045a
commit 66aca25662
4 changed files with 20 additions and 1 deletions

View File

@ -12,8 +12,10 @@ unsigned long calibrate_count[ENCWORKER];
char z[ENCWORKER];
bool inited = false;
int center;
unsigned long count;
void encoder_init(){
count = 0;
config.STORE_ENCODER = false;
for (int i = 0; i< SENSORS;i++){
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));
}
t("enc_end");
if (works[portVector[port]].State)
send_encoder_tick(port,count);
return works[portVector[port]].State;
}
else{
@ -99,8 +103,11 @@ bool getEncEnabled(unsigned char port,bool value){
}
}
void on_io_int(unsigned char linestate){
t("enc_int_start");
count ++;
string workers = vector[linestate-1];
if(calibrate_mode>0){
for (int i=0;i<len(config.EncoderCfg.workedPorts);i++){

View File

@ -9,7 +9,7 @@
#message "link global not defined"
#endif
#define VERSION "2.0b_1902121725"
#define VERSION "2.0b_1902181804"
#define MAX_FIFO_SIZE 20
#define BRAKER_COUNT 3
@ -125,3 +125,4 @@ extern BrakerProcess brakers[BRAKER_COUNT];

10
net.tc
View File

@ -124,6 +124,16 @@ void send_sensor(int number, bool state){
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){
int n = sock.num;

1
net.th
View File

@ -7,4 +7,5 @@ void net_diag_handle(string message);
void net_config_handle(string message);
void net_sensor_handle(string message);
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);