正在显示
15 个修改的文件
包含
182 行增加
和
99 行删除
| @@ -2,6 +2,10 @@ | @@ -2,6 +2,10 @@ | ||
| 2 | #include "JZ_TempControl.h" | 2 | #include "JZ_TempControl.h" |
| 3 | #include "JZ_lamp.h" | 3 | #include "JZ_lamp.h" |
| 4 | #include "JZ_widget.h" | 4 | #include "JZ_widget.h" |
| 5 | +#include "JZ_speaker.h" | ||
| 6 | +#include "wiringPi.h" | ||
| 7 | +#include <unistd.h> | ||
| 8 | +#include <stdio.h> | ||
| 5 | /* Private constants ---------------------------------------------------------*/ | 9 | /* Private constants ---------------------------------------------------------*/ |
| 6 | 10 | ||
| 7 | /* Private types -------------------------------------------------------------*/ | 11 | /* Private types -------------------------------------------------------------*/ |
| @@ -9,11 +13,11 @@ | @@ -9,11 +13,11 @@ | ||
| 9 | /* Private values -------------------------------------------------------------*/ | 13 | /* Private values -------------------------------------------------------------*/ |
| 10 | TempControlData *tempData;//存放温度、亮度数据 | 14 | TempControlData *tempData;//存放温度、亮度数据 |
| 11 | int InitialLumen;//最初亮度 | 15 | int InitialLumen;//最初亮度 |
| 12 | -int tempControlFlag = TEMP_NOTTRIGGER;//判断当前温度是否执行过温控 | 16 | +int tempControlFlag = TEMP_TRIGGER;//判断当前温度是否执行过温控 |
| 13 | int light_mode = LIGHT_OFF; //探照灯模式 | 17 | int light_mode = LIGHT_OFF; //探照灯模式 |
| 14 | int tempMax = 70;//限制温度 | 18 | int tempMax = 70;//限制温度 |
| 15 | int Initialflag = DEFAULT_STATUS; | 19 | int Initialflag = DEFAULT_STATUS; |
| 16 | - | 20 | +static int delayThreadFlag = 0; |
| 17 | /* Private functions declaration ---------------------------------------------*/ | 21 | /* Private functions declaration ---------------------------------------------*/ |
| 18 | 22 | ||
| 19 | /* Exported functions definition ---------------------------------------------*/ | 23 | /* Exported functions definition ---------------------------------------------*/ |
| @@ -37,12 +41,12 @@ static void* TempControl_Task(void *arg) | @@ -37,12 +41,12 @@ static void* TempControl_Task(void *arg) | ||
| 37 | if(OutTime > 0) | 41 | if(OutTime > 0) |
| 38 | { | 42 | { |
| 39 | //tempControlFlag = TEMP_TRIGGER; | 43 | //tempControlFlag = TEMP_TRIGGER; |
| 40 | - printf("触发调控,输入温度%d,输入亮度%d,设置亮度%d,调控时间%d\n",tempData->InputTemp,tempData->InputLumen,InitialLumen,OutTime); | ||
| 41 | - usleep(OutTime*1000); | 44 | + printf("触发调控,输入温度%d,输入亮度%d,输出亮度%d,设置亮度%d,调控时间%d\n",tempData->InputTemp,tempData->InputLumen,tempData->OutLumen,InitialLumen,OutTime); |
| 45 | + delay(OutTime); | ||
| 42 | } | 46 | } |
| 43 | else | 47 | else |
| 44 | { | 48 | { |
| 45 | - usleep(1*1000); | 49 | + delay(1); |
| 46 | } | 50 | } |
| 47 | OutTime = 0; | 51 | OutTime = 0; |
| 48 | 52 | ||
| @@ -60,7 +64,9 @@ static void* TempControl_Task(void *arg) | @@ -60,7 +64,9 @@ static void* TempControl_Task(void *arg) | ||
| 60 | int Jz_TempControlTaskCreate(void) | 64 | int Jz_TempControlTaskCreate(void) |
| 61 | { | 65 | { |
| 62 | //需确保拿到亮度数据后再开启任务 | 66 | //需确保拿到亮度数据后再开启任务 |
| 63 | - usleep(1000*1000); | 67 | + |
| 68 | + delay(1000); | ||
| 69 | + printf("Jz_TempControlTaskCreate\n"); | ||
| 64 | pthread_t pthread; | 70 | pthread_t pthread; |
| 65 | pthread_attr_t pthread_attr; | 71 | pthread_attr_t pthread_attr; |
| 66 | 72 | ||
| @@ -304,15 +310,19 @@ static void *TempControl_TempChangeTask(void *arg) | @@ -304,15 +310,19 @@ static void *TempControl_TempChangeTask(void *arg) | ||
| 304 | Jz_LampLumenControl(Lumen,Lumen); | 310 | Jz_LampLumenControl(Lumen,Lumen); |
| 305 | 311 | ||
| 306 | } | 312 | } |
| 307 | - if(Lumen != lastLumen)//亮度改变 | 313 | + if(tempControlFlag == TEMP_NOTTRIGGER)//改变亮度后一定时间不触发温控 |
| 308 | { | 314 | { |
| 309 | - lastLumen = Lumen; | ||
| 310 | - | ||
| 311 | - if(tempControlFlag == TEMP_NOTTRIGGER)//触发了温控 | 315 | + if(delayThreadFlag == 0) |
| 312 | { | 316 | { |
| 313 | - tempControlFlag = TEMP_TRIGGER; | 317 | + delayThreadFlag = 1; |
| 318 | + JZ_DelayThreadCreate(100); | ||
| 319 | + } | ||
| 314 | continue; | 320 | continue; |
| 315 | } | 321 | } |
| 322 | + if(Lumen != lastLumen)//亮度改变 | ||
| 323 | + { | ||
| 324 | + lastLumen = Lumen; | ||
| 325 | + | ||
| 316 | if(Lumen != 0) | 326 | if(Lumen != 0) |
| 317 | { | 327 | { |
| 318 | //重设亮度 | 328 | //重设亮度 |
| @@ -322,6 +332,25 @@ static void *TempControl_TempChangeTask(void *arg) | @@ -322,6 +332,25 @@ static void *TempControl_TempChangeTask(void *arg) | ||
| 322 | } | 332 | } |
| 323 | 333 | ||
| 324 | } | 334 | } |
| 325 | - usleep(200*1000); | 335 | + delay(200); |
| 326 | } | 336 | } |
| 327 | } | 337 | } |
| 338 | + | ||
| 339 | +/************************************ | ||
| 340 | +*延时恢复温控 | ||
| 341 | +*函数名: JZ_TempControlFlag | ||
| 342 | +*函数参数: | ||
| 343 | + | ||
| 344 | +*返回值: | ||
| 345 | +*函数作者:wzy | ||
| 346 | +*************************************/ | ||
| 347 | +void *JZ_TempControlFlag(void *arg) | ||
| 348 | +{ | ||
| 349 | + int delayTime = *(int *)arg; | ||
| 350 | + //延时执行 | ||
| 351 | + usleep(delayTime*1000); | ||
| 352 | + tempControlFlag = TEMP_TRIGGER; //温控标志位 | ||
| 353 | + delayThreadFlag = 0; | ||
| 354 | + | ||
| 355 | + printf("延时恢复温控\n"); | ||
| 356 | +} |
| @@ -37,13 +37,14 @@ typedef enum { | @@ -37,13 +37,14 @@ typedef enum { | ||
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | /* Exported functions --------------------------------------------------------*/ | 39 | /* Exported functions --------------------------------------------------------*/ |
| 40 | -int Jz_TempControlTaskCreate(void); | 40 | +int Jz_TempControlTaskCreate(void);//温度控制任务创建 |
| 41 | int Jz_LampTempControl(float InputTemp, int InputLumen,int *InitialLumen,int *OutTime,int *OutLumen); | 41 | int Jz_LampTempControl(float InputTemp, int InputLumen,int *InitialLumen,int *OutTime,int *OutLumen); |
| 42 | static int Jz_LampGetTempControlTime(float value); | 42 | static int Jz_LampGetTempControlTime(float value); |
| 43 | void JZ_LightSetInitialLumen(int value); | 43 | void JZ_LightSetInitialLumen(int value); |
| 44 | void JZ_TempStructInit(void); | 44 | void JZ_TempStructInit(void); |
| 45 | static void JZ_TempChangeJudgment(int lastTemp,int curTemp,int *ControlFlag); | 45 | static void JZ_TempChangeJudgment(int lastTemp,int curTemp,int *ControlFlag); |
| 46 | static void *TempControl_TempChangeTask(void *arg); | 46 | static void *TempControl_TempChangeTask(void *arg); |
| 47 | +void *JZ_TempControlFlag(void *arg); | ||
| 47 | #ifdef __cplusplus | 48 | #ifdef __cplusplus |
| 48 | } | 49 | } |
| 49 | #endif | 50 | #endif |
| @@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
| 10 | /* Private types -------------------------------------------------------------*/ | 10 | /* Private types -------------------------------------------------------------*/ |
| 11 | 11 | ||
| 12 | /* Private values -------------------------------------------------------------*/ | 12 | /* Private values -------------------------------------------------------------*/ |
| 13 | -extern int lampAngle;//无人机云台角度 | 13 | +int lampAngle = 0;//无人机云台角度 |
| 14 | int gimbalLinkageState = GIMBALLINKAGE_OFF;//云台联动初始状态为开启 | 14 | int gimbalLinkageState = GIMBALLINKAGE_OFF;//云台联动初始状态为开启 |
| 15 | pthread_mutex_t gimbalMutex; //无人机云台角度互斥锁 | 15 | pthread_mutex_t gimbalMutex; //无人机云台角度互斥锁 |
| 16 | Lamp_Temp *lampTemp; //左右灯温度 | 16 | Lamp_Temp *lampTemp; //左右灯温度 |
| @@ -188,6 +188,7 @@ int uart_send(uint8_t *dataBuf,int dataLen) | @@ -188,6 +188,7 @@ int uart_send(uint8_t *dataBuf,int dataLen) | ||
| 188 | // 创建线程 | 188 | // 创建线程 |
| 189 | int result = pthread_create(&thread, &task_attr, send_task,(void *)ser); | 189 | int result = pthread_create(&thread, &task_attr, send_task,(void *)ser); |
| 190 | if (result != 0) { | 190 | if (result != 0) { |
| 191 | + | ||
| 191 | printf("线程创建失败\n"); | 192 | printf("线程创建失败\n"); |
| 192 | return -1; | 193 | return -1; |
| 193 | } | 194 | } |
| 1 | /* Includes ------------------------------------------------------------------*/ | 1 | /* Includes ------------------------------------------------------------------*/ |
| 2 | #include "JZ_speaker.h" | 2 | #include "JZ_speaker.h" |
| 3 | #include "JZ_lamp.h" | 3 | #include "JZ_lamp.h" |
| 4 | -#include "music.h" | 4 | +//#include "music.h" |
| 5 | #include "JZ_TempControl.h" | 5 | #include "JZ_TempControl.h" |
| 6 | #include <unistd.h> | 6 | #include <unistd.h> |
| 7 | +#include <stdio.h> | ||
| 7 | /* Private constants ---------------------------------------------------------*/ | 8 | /* Private constants ---------------------------------------------------------*/ |
| 8 | 9 | ||
| 9 | /* Private types -------------------------------------------------------------*/ | 10 | /* Private types -------------------------------------------------------------*/ |
| 10 | 11 | ||
| 11 | /* Private values -------------------------------------------------------------*/ | 12 | /* Private values -------------------------------------------------------------*/ |
| 12 | -extern int tts_add; | ||
| 13 | -extern int tts_tone; | ||
| 14 | -extern int tts_speed; | 13 | +// extern int tts_add; |
| 14 | +// extern int tts_tone; | ||
| 15 | +// extern int tts_speed; | ||
| 15 | extern int readyflag;//喊话器准备就绪标志 | 16 | extern int readyflag;//喊话器准备就绪标志 |
| 16 | extern int tempControlFlag; | 17 | extern int tempControlFlag; |
| 17 | extern TempControlData *tempData;//温度控制数据 | 18 | extern TempControlData *tempData;//温度控制数据 |
| @@ -28,23 +29,23 @@ extern TempControlData *tempData;//温度控制数据 | @@ -28,23 +29,23 @@ extern TempControlData *tempData;//温度控制数据 | ||
| 28 | *************************************/ | 29 | *************************************/ |
| 29 | void JZ_SpeechSpeedControlFeature(uint8_t speed) | 30 | void JZ_SpeechSpeedControlFeature(uint8_t speed) |
| 30 | { | 31 | { |
| 31 | - switch(speed){ | ||
| 32 | - case 0: | ||
| 33 | - tts_speed=25; | ||
| 34 | - break; | ||
| 35 | - case 1: | ||
| 36 | - tts_speed=50; | ||
| 37 | - break; | ||
| 38 | - case 2: | ||
| 39 | - tts_speed=75; | ||
| 40 | - break; | ||
| 41 | - case 3: | ||
| 42 | - tts_speed=100; | ||
| 43 | - break; | ||
| 44 | - default: | ||
| 45 | - tts_speed=50; | ||
| 46 | - break; | ||
| 47 | - } | 32 | + // switch(speed){ |
| 33 | + // case 0: | ||
| 34 | + // tts_speed=25; | ||
| 35 | + // break; | ||
| 36 | + // case 1: | ||
| 37 | + // tts_speed=50; | ||
| 38 | + // break; | ||
| 39 | + // case 2: | ||
| 40 | + // tts_speed=75; | ||
| 41 | + // break; | ||
| 42 | + // case 3: | ||
| 43 | + // tts_speed=100; | ||
| 44 | + // break; | ||
| 45 | + // default: | ||
| 46 | + // tts_speed=50; | ||
| 47 | + // break; | ||
| 48 | + // } | ||
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | /************************************ | 51 | /************************************ |
| @@ -67,41 +68,41 @@ void JZ_SpeechSpeedControlFeature(uint8_t speed) | @@ -67,41 +68,41 @@ void JZ_SpeechSpeedControlFeature(uint8_t speed) | ||
| 67 | *************************************/ | 68 | *************************************/ |
| 68 | void JZ_TtsToneColorFeature(uint8_t tone) | 69 | void JZ_TtsToneColorFeature(uint8_t tone) |
| 69 | { | 70 | { |
| 70 | - switch(tone){ | ||
| 71 | - case 0: | ||
| 72 | - tts_tone=1; | ||
| 73 | - break; | ||
| 74 | - case 1: | ||
| 75 | - tts_tone=2; | ||
| 76 | - break; | ||
| 77 | - case 2: | ||
| 78 | - tts_tone=11; | ||
| 79 | - break; | ||
| 80 | - case 3: | ||
| 81 | - tts_tone=12; | ||
| 82 | - break; | ||
| 83 | - case 4: | ||
| 84 | - tts_tone=31; | ||
| 85 | - break; | ||
| 86 | - case 5: | ||
| 87 | - tts_tone=32; | ||
| 88 | - break; | ||
| 89 | - case 6: | ||
| 90 | - tts_tone=33; | ||
| 91 | - break; | ||
| 92 | - case 7: | ||
| 93 | - tts_tone=34; | ||
| 94 | - break; | ||
| 95 | - case 8: | ||
| 96 | - tts_tone=35; | ||
| 97 | - break; | ||
| 98 | - case 9: | ||
| 99 | - tts_tone=36; | ||
| 100 | - break; | ||
| 101 | - default: | ||
| 102 | - tts_tone=1; | ||
| 103 | - break; | ||
| 104 | - } | 71 | + // switch(tone){ |
| 72 | + // case 0: | ||
| 73 | + // tts_tone=1; | ||
| 74 | + // break; | ||
| 75 | + // case 1: | ||
| 76 | + // tts_tone=2; | ||
| 77 | + // break; | ||
| 78 | + // case 2: | ||
| 79 | + // tts_tone=11; | ||
| 80 | + // break; | ||
| 81 | + // case 3: | ||
| 82 | + // tts_tone=12; | ||
| 83 | + // break; | ||
| 84 | + // case 4: | ||
| 85 | + // tts_tone=31; | ||
| 86 | + // break; | ||
| 87 | + // case 5: | ||
| 88 | + // tts_tone=32; | ||
| 89 | + // break; | ||
| 90 | + // case 6: | ||
| 91 | + // tts_tone=33; | ||
| 92 | + // break; | ||
| 93 | + // case 7: | ||
| 94 | + // tts_tone=34; | ||
| 95 | + // break; | ||
| 96 | + // case 8: | ||
| 97 | + // tts_tone=35; | ||
| 98 | + // break; | ||
| 99 | + // case 9: | ||
| 100 | + // tts_tone=36; | ||
| 101 | + // break; | ||
| 102 | + // default: | ||
| 103 | + // tts_tone=1; | ||
| 104 | + // break; | ||
| 105 | + // } | ||
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /************************************ | 108 | /************************************ |
| @@ -115,19 +116,19 @@ void JZ_TtsToneColorFeature(uint8_t tone) | @@ -115,19 +116,19 @@ void JZ_TtsToneColorFeature(uint8_t tone) | ||
| 115 | *************************************/ | 116 | *************************************/ |
| 116 | int JZ_TtsPlayFeature(int len,char* data) | 117 | int JZ_TtsPlayFeature(int len,char* data) |
| 117 | { | 118 | { |
| 118 | - if(readyflag == 0) | ||
| 119 | - { | ||
| 120 | - return -1; | ||
| 121 | - } | ||
| 122 | - while (GetRecordStatus() == 1 || GetTtsStatus() == 1) | ||
| 123 | - { | ||
| 124 | - usleep(100*1000); | ||
| 125 | - } | ||
| 126 | - usleep(600*1000); | ||
| 127 | - if(GetSpeakerMode() == 2) | ||
| 128 | - { | ||
| 129 | - TTS(tts_tone,100,tts_speed,len,data); | ||
| 130 | - } | 119 | + // if(readyflag == 0) |
| 120 | + // { | ||
| 121 | + // return -1; | ||
| 122 | + // } | ||
| 123 | + // while (GetRecordStatus() == 1 || GetTtsStatus() == 1) | ||
| 124 | + // { | ||
| 125 | + // usleep(100*1000); | ||
| 126 | + // } | ||
| 127 | + // usleep(600*1000); | ||
| 128 | + // if(GetSpeakerMode() == 2) | ||
| 129 | + // { | ||
| 130 | + // TTS(tts_tone,100,tts_speed,len,data); | ||
| 131 | + // } | ||
| 131 | 132 | ||
| 132 | } | 133 | } |
| 133 | 134 | ||
| @@ -157,6 +158,7 @@ void JZ_LampLumenControlFeature(uint8_t value1,uint8_t value2) | @@ -157,6 +158,7 @@ void JZ_LampLumenControlFeature(uint8_t value1,uint8_t value2) | ||
| 157 | JZ_LightSetInitialLumen(value);//改变设置的亮度初值 | 158 | JZ_LightSetInitialLumen(value);//改变设置的亮度初值 |
| 158 | tempControlFlag = TEMP_NOTTRIGGER;//防止温度跳回去 | 159 | tempControlFlag = TEMP_NOTTRIGGER;//防止温度跳回去 |
| 159 | Jz_LampLumenControl(value1,value2);//控制探照灯亮度 | 160 | Jz_LampLumenControl(value1,value2);//控制探照灯亮度 |
| 161 | + | ||
| 160 | } | 162 | } |
| 161 | 163 | ||
| 162 | /************************************ | 164 | /************************************ |
| @@ -174,4 +176,57 @@ void Jz_LampGimbalControlFeature(int value) | @@ -174,4 +176,57 @@ void Jz_LampGimbalControlFeature(int value) | ||
| 174 | int angle = -value; | 176 | int angle = -value; |
| 175 | Jz_Lamp_Gimbal_Control(angle); | 177 | Jz_Lamp_Gimbal_Control(angle); |
| 176 | } | 178 | } |
| 179 | + else | ||
| 180 | + { | ||
| 181 | + Jz_Lamp_Gimbal_Control(0);//U3S云台角度为0~90 | ||
| 182 | + } | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +/************************************ | ||
| 186 | +*提取 . 之前的字符串 | ||
| 187 | +*函数名:JZ_GetBeforeChar | ||
| 188 | +*函数参数: | ||
| 189 | + @dest: 被截取的字符串 | ||
| 190 | + @src: 截取后的字符串 | ||
| 191 | +*返回值: | ||
| 192 | +*函数作者:wzy | ||
| 193 | +*************************************/ | ||
| 194 | +void JZ_GetBeforeChar(const char *dest,char *src) | ||
| 195 | +{ | ||
| 196 | + size_t len; | ||
| 197 | + len = strrchr(dest, '.') - dest;//计算文件名长度 | ||
| 198 | + memcpy(src, "\0", 256); | ||
| 199 | + strncpy(src, dest, len);//取文件名 | ||
| 200 | + src[len] = '\0'; | ||
| 201 | + | ||
| 202 | +} | ||
| 203 | + | ||
| 204 | +/************************************ | ||
| 205 | +*延时执行任务线程创建 | ||
| 206 | +*函数名: JZ_DelayThreadCreate | ||
| 207 | +*函数参数: | ||
| 208 | + @delayTime: 延时时间 | ||
| 209 | + @function: 延时执行的任务 | ||
| 210 | +*返回值: | ||
| 211 | +*函数作者:wzy | ||
| 212 | +*************************************/ | ||
| 213 | +void JZ_DelayThreadCreate(int delayTime) | ||
| 214 | +{ | ||
| 215 | + pthread_t thread; | ||
| 216 | + pthread_attr_t task_attr; | ||
| 217 | + pthread_attr_init(&task_attr); //初始化线程属性 | ||
| 218 | + pthread_attr_setdetachstate(&task_attr, PTHREAD_CREATE_DETACHED); //设置线程分离属性 | ||
| 219 | + | ||
| 220 | + pthread_t tid; | ||
| 221 | + int ret; | ||
| 222 | + if(delayTime > 0) | ||
| 223 | + { | ||
| 224 | + | ||
| 225 | + //创建线程,延时执行 | ||
| 226 | + ret = pthread_create(&tid,&task_attr,JZ_TempControlFlag,(void *)&delayTime); | ||
| 227 | + if (ret != 0) | ||
| 228 | + { | ||
| 229 | + printf("线程创建失败\n"); | ||
| 230 | + } | ||
| 231 | + } | ||
| 177 | } | 232 | } |
| @@ -17,6 +17,8 @@ int JZ_TtsPlayFeature(int len,char* data);//文本播放功能 | @@ -17,6 +17,8 @@ int JZ_TtsPlayFeature(int len,char* data);//文本播放功能 | ||
| 17 | void JZ_TtsToneColorFeature(uint8_t tone);//文本喊话音色控制功能 | 17 | void JZ_TtsToneColorFeature(uint8_t tone);//文本喊话音色控制功能 |
| 18 | void JZ_LampLumenControlFeature(uint8_t value1,uint8_t value2);//亮度控制功能 | 18 | void JZ_LampLumenControlFeature(uint8_t value1,uint8_t value2);//亮度控制功能 |
| 19 | void Jz_LampGimbalControlFeature(int value); | 19 | void Jz_LampGimbalControlFeature(int value); |
| 20 | +void JZ_GetBeforeChar(const char *dest,char *src);//提取 . 之前的字符串 | ||
| 21 | +void JZ_DelayThreadCreate(int delayTime);//延时执行线程创建 | ||
| 20 | #ifdef __cplusplus | 22 | #ifdef __cplusplus |
| 21 | } | 23 | } |
| 22 | #endif | 24 | #endif |
| @@ -19,7 +19,6 @@ | @@ -19,7 +19,6 @@ | ||
| 19 | #include "uav_low_speed_data_channel.h" | 19 | #include "uav_low_speed_data_channel.h" |
| 20 | #include "uav_data_type.h" | 20 | #include "uav_data_type.h" |
| 21 | 21 | ||
| 22 | - | ||
| 23 | #include "JZ_lamp.h" | 22 | #include "JZ_lamp.h" |
| 24 | #include "JZ_TempControl.h" | 23 | #include "JZ_TempControl.h" |
| 25 | #include "JZ_widget.h" | 24 | #include "JZ_widget.h" |
| @@ -85,10 +84,7 @@ extern int tts_tone; | @@ -85,10 +84,7 @@ extern int tts_tone; | ||
| 85 | extern int tts_speed; | 84 | extern int tts_speed; |
| 86 | 85 | ||
| 87 | extern int set_volume_value;//设置音量值 | 86 | extern int set_volume_value;//设置音量值 |
| 88 | -extern int aplay_flag;//默认是0 | ||
| 89 | extern int WidgetPlayFlag; | 87 | extern int WidgetPlayFlag; |
| 90 | -extern int TTS_delay; | ||
| 91 | -extern int ReadTimeSpeak_Mode; | ||
| 92 | 88 | ||
| 93 | int now_play=0;//当前播放状态 播放为1 停止为0 | 89 | int now_play=0;//当前播放状态 播放为1 停止为0 |
| 94 | int reset_play=0;//重置播放标志,用于重头开始播放歌曲,默认使用。 | 90 | int reset_play=0;//重置播放标志,用于重头开始播放歌曲,默认使用。 |
| @@ -108,10 +104,10 @@ static bool s_isDecodeFinished = true; | @@ -108,10 +104,10 @@ static bool s_isDecodeFinished = true; | ||
| 108 | static uint16_t s_decodeBitrate = 16000; | 104 | static uint16_t s_decodeBitrate = 16000; |
| 109 | /*-------------------------------------------------------*/ | 105 | /*-------------------------------------------------------*/ |
| 110 | pthread_mutex_t s_speakerMutex;//扬声器互斥锁 | 106 | pthread_mutex_t s_speakerMutex;//扬声器互斥锁 |
| 111 | -int lampAngle = 0;//无人机云台角度 | 107 | +extern int lampAngle;//无人机云台角度 |
| 112 | 108 | ||
| 113 | 109 | ||
| 114 | -char record_file_name[128];//录音文件名 | 110 | +char record_file_name[256];//录音文件名 |
| 115 | int playback_delay = 2;//循环播放延迟时间 | 111 | int playback_delay = 2;//循环播放延迟时间 |
| 116 | int playStatusQueryFlag;//播放状态查询标志 | 112 | int playStatusQueryFlag;//播放状态查询标志 |
| 117 | int readyflag = 0;//喊话器准备就绪标志 | 113 | int readyflag = 0;//喊话器准备就绪标志 |
| @@ -282,8 +278,6 @@ static T_UAVReturnCode StopPlay(void) | @@ -282,8 +278,6 @@ static T_UAVReturnCode StopPlay(void) | ||
| 282 | 278 | ||
| 283 | static T_UAVReturnCode SetVolume(uint8_t volume) | 279 | static T_UAVReturnCode SetVolume(uint8_t volume) |
| 284 | { | 280 | { |
| 285 | - LOG_INFO("Set 文本 volume: {}", volume*81/100*255/100); | ||
| 286 | - | ||
| 287 | 281 | ||
| 288 | s_speakerState.volume = volume; | 282 | s_speakerState.volume = volume; |
| 289 | set_volume(volume); | 283 | set_volume(volume); |
| @@ -360,7 +354,7 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | @@ -360,7 +354,7 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | ||
| 360 | case 2://关灯 | 354 | case 2://关灯 |
| 361 | Jz_Lamp_Off(); | 355 | Jz_Lamp_Off(); |
| 362 | usleep(200*1000); | 356 | usleep(200*1000); |
| 363 | - Jz_Lamp_Off(); | 357 | + JZ_LampLumenControlFeature(0,0); |
| 364 | break; | 358 | break; |
| 365 | case 3://亮度调节 | 359 | case 3://亮度调节 |
| 366 | JZ_LampLumenControlFeature(speakerControl->value,speakerControl->value); | 360 | JZ_LampLumenControlFeature(speakerControl->value,speakerControl->value); |
| @@ -401,7 +395,7 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | @@ -401,7 +395,7 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | ||
| 401 | { | 395 | { |
| 402 | switch (speakerControl->action) { | 396 | switch (speakerControl->action) { |
| 403 | case 4://音频文件上传开启 | 397 | case 4://音频文件上传开启 |
| 404 | - char opus_file_name[128]; | 398 | + char opus_file_name[256]; |
| 405 | size_t len; | 399 | size_t len; |
| 406 | 400 | ||
| 407 | stop_music(); | 401 | stop_music(); |
| @@ -409,10 +403,11 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | @@ -409,10 +403,11 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | ||
| 409 | set_paly_state(3); | 403 | set_paly_state(3); |
| 410 | s_isDecodeFinished = false;//解码标志位 | 404 | s_isDecodeFinished = false;//解码标志位 |
| 411 | //将不带格式的名字取出来 | 405 | //将不带格式的名字取出来 |
| 412 | - len = strrchr(speakerControl->strValue, '.') - speakerControl->strValue;//计算文件名长度 | ||
| 413 | - memcpy(record_file_name, "\0", 128); | ||
| 414 | - strncpy(record_file_name, speakerControl->strValue, len);//取文件名 | ||
| 415 | - record_file_name[len] = '\0'; | 406 | + // len = strrchr(speakerControl->strValue, '.') - speakerControl->strValue;//计算文件名长度 |
| 407 | + // memcpy(record_file_name, "\0", 256); | ||
| 408 | + // strncpy(record_file_name, speakerControl->strValue, len);//取文件名 | ||
| 409 | + // record_file_name[len] = '\0'; | ||
| 410 | + JZ_GetBeforeChar(speakerControl->strValue,record_file_name); | ||
| 416 | sprintf(opus_file_name, "record/%s.opus", record_file_name); | 411 | sprintf(opus_file_name, "record/%s.opus", record_file_name); |
| 417 | //打开opus文件 | 412 | //打开opus文件 |
| 418 | s_audioFile = fopen(opus_file_name, "wb"); | 413 | s_audioFile = fopen(opus_file_name, "wb"); |
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
不能预览此文件类型
| @@ -69,6 +69,7 @@ if [ -f /root/sdcard/${Update_PsdkPack} ]; then | @@ -69,6 +69,7 @@ if [ -f /root/sdcard/${Update_PsdkPack} ]; then | ||
| 69 | if find /root/sdcard/ -type f -name "*.bin" | grep -q .; then | 69 | if find /root/sdcard/ -type f -name "*.bin" | grep -q .; then |
| 70 | # 如果存在 .bin 文件 | 70 | # 如果存在 .bin 文件 |
| 71 | ./defeat # 播报升级失败 | 71 | ./defeat # 播报升级失败 |
| 72 | + | ||
| 72 | else | 73 | else |
| 73 | # 如果不存在 .bin 文件 | 74 | # 如果不存在 .bin 文件 |
| 74 | rm -rf $Update_judgment_file | 75 | rm -rf $Update_judgment_file |
| 1 | #! /bin/bash | 1 | #! /bin/bash |
| 2 | echo "updata.sh" | 2 | echo "updata.sh" |
| 3 | 3 | ||
| 4 | -Update_PsdkPack="JZ*" | 4 | +Update_PsdkPack="JZ_U3S_V*" |
| 5 | Update_Package="Package" | 5 | Update_Package="Package" |
| 6 | HardwareIdentification="HardwareIdeNum" #硬件码文件 | 6 | HardwareIdentification="HardwareIdeNum" #硬件码文件 |
| 7 | TarPackage_second=UpgradePackage.tar.gz #二次解压包的名字 | 7 | TarPackage_second=UpgradePackage.tar.gz #二次解压包的名字 |
| 8 | MD5saveFile=UpdateMD5num #md5文件内部的md5值文件 | 8 | MD5saveFile=UpdateMD5num #md5文件内部的md5值文件 |
| 9 | 9 | ||
| 10 | - | ||
| 11 | #得到二次解压包和md5校验文件 | 10 | #得到二次解压包和md5校验文件 |
| 12 | 11 | ||
| 13 | # 校验mp5 失败直接删除 | 12 | # 校验mp5 失败直接删除 |
-
请 注册 或 登录 后发表评论