wifi改为连接公司

连接wifi时用白色led提醒,
收放加入语音
This commit is contained in:
pxzleo 2023-06-25 19:00:43 +08:00
parent c2356769bd
commit c10314cbd1

View File

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