diff --git a/src/FoodDeliveryBase.h b/src/FoodDeliveryBase.h index cb6e057..7aa966b 100644 --- a/src/FoodDeliveryBase.h +++ b/src/FoodDeliveryBase.h @@ -21,6 +21,8 @@ public: int8_t writeSeq = -1; //飞控反馈 需写入航点序列号 int8_t futureSeq = 0; //记录将来要写入 航点序列号 int8_t missionArkType = -1; //航点写入是否成功 + /*航点任务 送餐信息喊话*/ + String questVoiceStr; /*前端模拟遥控的油门通道*/ uint16_t channels[4] = { 1500, 1500, 1500, 1500 }; /*初始化*/ diff --git a/src/main.cpp b/src/main.cpp index bab146f..2ad7b7b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -422,6 +422,9 @@ void Task1(void *pvParameters) //显示重量 //printf("pullweight: %d \n", pullweight); + /*保持mqtt心跳*/ + // fc.mqttLoop(topicSub, topicSubCount); + vTaskDelay(10); } } @@ -965,6 +968,14 @@ void writeRoute(String topicStr) { double x = obj["tasks"][fc.writeSeq]["x"]; double y = obj["tasks"][fc.writeSeq]["y"]; double z = obj["tasks"][fc.writeSeq]["z"]; + String str = obj["tasks"][fc.writeSeq]["sound"]; + if ((str!=NULL)&&(str != "")) + { + fc.questVoiceStr = str; + // printf("writevoice str: %s \n", fc.questVoiceStr); + // if (fc.writeSeq==0) + // fhc.playText(fc.questVoiceStr); + } fc.logln((char*)"frame--"); fc.logln(frame); //写入航点 @@ -1256,7 +1267,12 @@ void mavlink_receiveCallback(uint8_t c) { if (rngalt_cm==0) break; if (hss==HS_Locked) - Hook_autodown(rngalt_cm); + { + Hook_autodown(rngalt_cm); + //报3次 + if (fc.questVoiceStr!="") + fc.playText(fc.questVoiceStr+"。"+fc.questVoiceStr+"。"+fc.questVoiceStr); + } else if (hss==HS_Stop) Hook_resume();