diff --git a/src/main.cpp b/src/main.cpp index acfdf77..b158dd5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,7 +29,7 @@ Servo myservo; CRGB leds[NUM_LEDS]; Motocontrol motocontrol; - +void led_show(uint8_t cr, uint8_t cg, uint8_t cb); void sendinfo(); Ticker tksendinfo(sendinfo, 500); // 发送状态 @@ -53,7 +53,7 @@ void btn_presssatonce(); int get_pullweight(); void Task1(void *pvParameters); -void led_show(CRGB ledcolor); +//void led_show(CRGB ledcolor); // void Task1code( void *pvParameters ); void showledidel(); int pullweight = 0; //检测重量-克 @@ -88,8 +88,8 @@ unsigned long _tm_waitinit; /*项目对象*/ //char* ssid = "szdot"; //wifi帐号 //char* password = "Ttaj@#*.com"; //wifi密码 -char* ssid = (char*)"fxmf_sc01"; //wifi帐号 -char* password = (char*)"12345678"; //wifi密码 +char* ssid = (char*)"flicube";//"fxmf_sc01"; //wifi帐号 +char* password = (char*)"fxmf0622";//"12345678"; //wifi密码 char* mqttServer = (char*)"szdot.top"; //mqtt地址 int mqttPort = 1883; //mqtt端口 char* mqttName = (char*)"admin"; //mqtt帐号 @@ -178,11 +178,13 @@ void setup() initstatus = IS_WaitStart; _tm_waitinit = millis(); _needweightalign = true; - + + led_show(255,255,255);// 连接wifi中 + /////////////////////////////////MQTT_语音_MAVLINK 部分 /*初始化*/ Serial1.begin(115200, SERIAL_8N1, SERIAL_REPORT_RX, SERIAL_REPORT_TX); //声音模块引串口脚映射 - // fc.playText("正在连接服WIFI"); + fc.playText("正在连接网络"); fc.connectWifi(); //连接wifi // fc.playText("正在连接服务器"); fc.connectMqtt(topicSub, topicSubCount); //连接mqtt @@ -279,7 +281,8 @@ void checkinited() { motocontrol.weightalign(true); initstatus = IS_OK; - } + printf("WeightAlign ok: %d \n", pullweight); + } else { // 没成功继续校准 @@ -485,6 +488,7 @@ void ctbtn_pressend() void downbtn_click() { Serial.println("downbtn_click"); + if (motocontrol.getcontrolstatus().motostatus != MotoStatus::MS_Stop) { motocontrol.stop(); @@ -493,6 +497,8 @@ void downbtn_click() { motocontrol.setspeed(SPEED_BTN_SLOW); motocontrol.moto_run(MotoStatus::MS_Down); + fc.playText("放线"); + } } // 放线按钮--双击 @@ -548,12 +554,14 @@ void downbtn_pressend() void upbtn_click() { Serial.println("upbtn_click"); + if (motocontrol.getcontrolstatus().motostatus != MotoStatus::MS_Stop) { motocontrol.stop(); } else { + fc.playText("收线"); motocontrol.setspeed(SPEED_BTN_SLOW); motocontrol.moto_run(MotoStatus::MS_Up); }