diff --git a/src/FoodDeliveryBase.cpp b/src/FoodDeliveryBase.cpp index 0a1ef66..4ccf792 100644 --- a/src/FoodDeliveryBase.cpp +++ b/src/FoodDeliveryBase.cpp @@ -180,7 +180,7 @@ void FoodCube::connectMqtt(String topicSub) log("MQTT Server Connect Failed. Client State:"); logln(mqttClient->state()); _tm_mqttconnect = millis(); - + playText("服务器断开尝试重新连接"); // delay(3000); } } @@ -306,6 +306,7 @@ void FoodCube::playText(String str, bool flying) { command[index++] = (int)vstr[i]; } + logln("playText"); /* log("sendplay:"); for (int i = 0; i < sizeof(command); i++) { @@ -694,7 +695,7 @@ void FoodCube::mav_channels_override(uint16_t chan[]) mavlink_message_t msg; // mavlink协议信息(msg) uint8_t buf[MAVLINK_MAX_PACKET_LEN]; // 发送的缓存 // 控制油门 - mavlink_msg_rc_channels_override_pack(MAVLINK_SYSTEM_ID, MAVLINK_COMPONENT_ID, &msg, 1, 1, chan[0], chan[1], chan[2], chan[3], 0xffff, 0xffff, 0xffff, 0xffff); + mavlink_msg_rc_channels_override_pack(0xFF, 0xBE, &msg, 1, 1, chan[0], chan[1], chan[2], chan[3], 0xffff, 0xffff, 0xffff, 0xffff); int len = mavlink_msg_to_send_buffer(buf, &msg); // 通过串口发送 SWrite(buf, len, mavlinkSerial); diff --git a/src/commser.cpp b/src/commser.cpp index f576d90..e1cefd9 100644 --- a/src/commser.cpp +++ b/src/commser.cpp @@ -20,9 +20,9 @@ static const char *MOUDLENAME = "COMMSER"; // char* password = "63587839ab"; //wifi密码 char *ssid = "flicube"; // wifi帐号 char *password = "fxmf0622"; // wifi密码 -// char *ssid = "fxmf_sc01"; // 4g wifi帐号 +// char *ssid = "fxmf_sc02"; // 4g wifi帐号 // char *password = "12345678"; // 4g wifi密码 -char *mqttServer = "szdot.top"; // mqtt地址 +char *mqttServer = "wxsky.com"; // mqtt地址 int mqttPort = 1883; // mqtt端口 char *mqttName = "admin"; // mqtt帐号 char *mqttPassword = "123456"; // mqtt密码 @@ -416,6 +416,16 @@ void mavlink_receiveCallback(uint8_t c) // printf("mav_id:%d\n",msg.msgid); switch (msg.msgid) { + // case MAVLINK_MSG_ID_RC_CHANNELS: // #65 遥控通道数据 + // { + // Serial.println(msg.msgid); + // mavlink_rc_channels_t rc_channels; + // mavlink_msg_rc_channels_decode(&msg, &rc_channels); + + // uint16_t throttle_value = rc_channels.chan3_raw; // ch3_raw 是油门通道的原始输 + // Serial.println(throttle_value); + // } + // break; case MAVLINK_MSG_ID_HOME_POSITION: // #242 返航点位置 { char buf[120]; diff --git a/src/config.h b/src/config.h index 49fc16b..6065c65 100644 --- a/src/config.h +++ b/src/config.h @@ -4,7 +4,7 @@ /// // #define VERSION "0.90" // 软件版本 -#define VERSION_HW 1 // 硬件版本1:第一块硬件 2:目前版本 +#define VERSION_HW 2 // 硬件版本1:第一块硬件 2:目前版本 // 硬件接口定义//////////////////////////// // 按钮 #define BTN_UP 23 // 收线开关 接线:BTN_UP---GND diff --git a/src/main.cpp b/src/main.cpp index e738cdf..3dc6712 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -401,11 +401,7 @@ void loop() // sercomm.getcommand(); // 得到控制命令 button_checktop.tick(); // 按钮 button_down.tick(); // 按钮 - fc.logln("hello"); - fc.logln("hello"); - fc.logln("hello"); - fc.logln("hello"); - button_up.tick(); // 按钮 + button_up.tick(); // 按钮 button_test.tick(); motocontrol.setweight(pullweight); // 告诉电机拉的重量 motocontrol.update(); // 电机控制 @@ -433,9 +429,8 @@ void loop() } } } - check_tare(); // 检查看是否需要校准称重 - // 检测执行初始化工作 - checkinited(); + check_tare(); // 检查看是否需要校准称重 + checkinited(); // 检测执行初始化工作 delay(1); } // 在核心0上执行耗时长的低优先级的 @@ -648,16 +643,6 @@ void up_action(float motospeed) // 放线按钮--单击 void downbtn_click() { - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); - fc.logln("downbtn_click"); ESP_LOGD(MOUDLENAME, "Down_click"); _checkweightcal = true; // 检测是否需要校准称重传感器--在下放停止时检测 _checkweighttimes = 0; diff --git a/src/motocontrol.h b/src/motocontrol.h index d79ca51..4dc1dc7 100644 --- a/src/motocontrol.h +++ b/src/motocontrol.h @@ -5,8 +5,8 @@ #include #define ROPE_MAXLENGTH 700 // 最多能放700cm---实际绳子应该比这个长750之类的 -// #define WHEEL_DIAMETER 3.8 // 轮子直径cm 3公斤载重飞机 大轮 -#define WHEEL_DIAMETER 2.3 // 轮子直径cm 10公斤载重飞机 小轮 +// #define WHEEL_DIAMETER 3.8 // 轮子直径cm +#define WHEEL_DIAMETER 2.3 // 轮子直径cm 小轮子直径 #define WHEEL_PERIMETER (WHEEL_DIAMETER * 3.1416) // 轮子周长 #define ROPE_MAXCOUNT (ROPE_MAXLENGTH / WHEEL_PERIMETER) // 最大圈数