王铭轩 仓库
Fork of SBY_sw4stm32_nucleo_f103rb by
Diff: SBY/main.cpp
- Revision:
- 3:55a34662204f
- Parent:
- 2:a779f481c401
--- a/SBY/main.cpp Thu Aug 02 13:02:11 2018 +0000 +++ b/SBY/main.cpp Fri Aug 03 06:22:21 2018 +0000 @@ -98,12 +98,13 @@ else if (strcmp(actuator_name, "dat") == 0) { int the_command = atoi(control_value); - if(the_command==7) - { - received=1; - ser2usb.printf("received 7\r\n"); - client.publish_value("report", "received."); - } + received=1; + ser2usb.printf("received \r\n"); + x[y]=the_command; + y++; + ser2usb.printf("get %s|%d\r\n",control_value,y); + client.publish_value("report", "received."); + /* else { //received=1; @@ -112,6 +113,7 @@ y++; ser2usb.printf("get %s|%d\r\n",control_value,y); } + */ } /* ser2usb.printf("Received CMD %s %s\r\n", actuator_name, control_value); @@ -156,17 +158,19 @@ ser2usb.printf("ready?\r\n"); } - if(!start&&ready) + if(!start&&ready&&!received) { ser2usb.printf("send start.\r\n"); client.publish_value("report", "wait data."); } if(start) { + ser2usb.printf("starting\r\n"); for(int i=0;x[i];i++) { - state = int(x[i]); + state = x[i]; //state = y; + ser2usb.printf("starting %d\r\n",state); switch(state) { case 1: @@ -204,7 +208,7 @@ start=0; done=0; } - + wait(0.01); } }