正在显示
11 个修改的文件
包含
69 行增加
和
76 行删除
| 1 | /* Includes ------------------------------------------------------------------*/ | 1 | /* Includes ------------------------------------------------------------------*/ |
| 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" | ||
| 5 | #include "JZ_speaker.h" | 4 | #include "JZ_speaker.h" |
| 6 | #include "wiringPi.h" | 5 | #include "wiringPi.h" |
| 7 | #include <unistd.h> | 6 | #include <unistd.h> |
| @@ -2,9 +2,8 @@ | @@ -2,9 +2,8 @@ | ||
| 2 | 2 | ||
| 3 | #include "JZ_lamp.h" | 3 | #include "JZ_lamp.h" |
| 4 | #include "JZ_uart.h" | 4 | #include "JZ_uart.h" |
| 5 | -#include "JZ_widget.h" | ||
| 6 | #include "JZ_TempControl.h" | 5 | #include "JZ_TempControl.h" |
| 7 | - | 6 | +#include "JZ_speaker.h" |
| 8 | /* Private constants ---------------------------------------------------------*/ | 7 | /* Private constants ---------------------------------------------------------*/ |
| 9 | 8 | ||
| 10 | /* Private types -------------------------------------------------------------*/ | 9 | /* Private types -------------------------------------------------------------*/ |
JZ_Module/lamp/JZ_widget.c
已删除
100644 → 0
| 1 | -/* Includes----------------------------------------------------*/ | ||
| 2 | -#include "JZ_widget.h" | ||
| 3 | -#include "version_choose.h" | ||
| 4 | -#include <stdarg.h> | ||
| 5 | - | ||
| 6 | -//道通没有自定义控件 | ||
| 7 | -#if SPECIAL_VERSION == SPECIAL_GDU | ||
| 8 | - #include "test_widget.h" | ||
| 9 | - #include "gdu_logger.h" | ||
| 10 | -#endif | ||
| 11 | -/* Private constants-------------------------------------------*/ | ||
| 12 | - | ||
| 13 | -/* Private types-----------------------------------------------*/ | ||
| 14 | - | ||
| 15 | -/* Private values----------------------------------------------*/ | ||
| 16 | - | ||
| 17 | -/* Private functions declaration ---------------------------------------------*/ | ||
| 18 | - | ||
| 19 | -/* Exported functions definition ---------------------------------------------*/ | ||
| 20 | -void Jz_set_widget_value(int index,int value) | ||
| 21 | -{ | ||
| 22 | - //如不是道通,则设置控件的值 | ||
| 23 | - #if SPECIAL_VERSION != SPECIAL_UAV | ||
| 24 | - set_widget_value(index,value); | ||
| 25 | - #endif | ||
| 26 | - | ||
| 27 | -} | ||
| 28 | - | ||
| 29 | -void JZ_LOG_INFO(const char *format, ...) | ||
| 30 | -{ | ||
| 31 | - #if SPECIAL_VERSION == SPECIAL_GDU | ||
| 32 | - va_list args; | ||
| 33 | - va_start(args, format); | ||
| 34 | - USER_LOG_INFO(format, args); // 传递参数给 USER_LOG_INFO | ||
| 35 | - va_end(args); | ||
| 36 | - #endif | ||
| 37 | -} |
JZ_Module/lamp/JZ_widget.h
已删除
100644 → 0
| 1 | - | ||
| 2 | -/* Define to prevent recursive inclusion -------------------------------------*/ | ||
| 3 | -#ifndef _JZ_WIDGET_H | ||
| 4 | -#define _JZ_WIDGET_H | ||
| 5 | -/* Includes ------------------------------------------------------------------*/ | ||
| 6 | -#ifdef __cplusplus | ||
| 7 | -extern "C" { | ||
| 8 | -#endif | ||
| 9 | - | ||
| 10 | - | ||
| 11 | -/* Exported constants --------------------------------------------------------*/ | ||
| 12 | - | ||
| 13 | -/* Exported types ------------------------------------------------------------*/ | ||
| 14 | - | ||
| 15 | -/* Exported functions --------------------------------------------------------*/ | ||
| 16 | -void Jz_set_widget_value(int index,int value); | ||
| 17 | -void JZ_LOG_INFO(const char *format, ...); | ||
| 18 | - | ||
| 19 | -#ifdef __cplusplus | ||
| 20 | -} | ||
| 21 | -#endif | ||
| 22 | - | ||
| 23 | -#endif //_JZ_WIDGET_H | ||
| 24 | - |
| @@ -5,6 +5,13 @@ | @@ -5,6 +5,13 @@ | ||
| 5 | #include "JZ_TempControl.h" | 5 | #include "JZ_TempControl.h" |
| 6 | #include <unistd.h> | 6 | #include <unistd.h> |
| 7 | #include <stdio.h> | 7 | #include <stdio.h> |
| 8 | +#include "version_choose.h" | ||
| 9 | +#include <stdarg.h> | ||
| 10 | +#include <time.h> | ||
| 11 | +#if SPECIAL_VERSION == SPECIAL_GDU | ||
| 12 | + #include "test_widget.h" | ||
| 13 | + #include "gdu_logger.h" | ||
| 14 | +#endif | ||
| 8 | /* Private constants ---------------------------------------------------------*/ | 15 | /* Private constants ---------------------------------------------------------*/ |
| 9 | 16 | ||
| 10 | /* Private types -------------------------------------------------------------*/ | 17 | /* Private types -------------------------------------------------------------*/ |
| @@ -230,3 +237,56 @@ void JZ_DelayThreadCreate(int delayTime) | @@ -230,3 +237,56 @@ void JZ_DelayThreadCreate(int delayTime) | ||
| 230 | } | 237 | } |
| 231 | } | 238 | } |
| 232 | } | 239 | } |
| 240 | + | ||
| 241 | +/************************************ | ||
| 242 | +*设置UI控件值 | ||
| 243 | +*函数名: Jz_set_widget_value | ||
| 244 | +*函数参数: | ||
| 245 | + @index: 控件编号 | ||
| 246 | + @value: 控件值 | ||
| 247 | +*返回值: | ||
| 248 | +*函数作者:wzy | ||
| 249 | +*************************************/ | ||
| 250 | +void Jz_set_widget_value(int index,int value) | ||
| 251 | +{ | ||
| 252 | + //如不是道通,则设置控件的值 | ||
| 253 | + #if SPECIAL_VERSION != SPECIAL_UAV | ||
| 254 | + set_widget_value(index,value); | ||
| 255 | + #endif | ||
| 256 | + | ||
| 257 | +} | ||
| 258 | + | ||
| 259 | +/************************************ | ||
| 260 | +*输出信息 | ||
| 261 | +*函数名: JZ_LOG_INFO | ||
| 262 | +*函数参数: | ||
| 263 | + | ||
| 264 | +*返回值: | ||
| 265 | +*函数作者:wzy | ||
| 266 | +*************************************/ | ||
| 267 | +void JZ_LOG_INFO(const char *format, ...) | ||
| 268 | +{ | ||
| 269 | + #if SPECIAL_VERSION == SPECIAL_GDU | ||
| 270 | + va_list args; | ||
| 271 | + va_start(args, format); | ||
| 272 | + USER_LOG_INFO(format, args); // 传递参数给 USER_LOG_INFO | ||
| 273 | + va_end(args); | ||
| 274 | + #else | ||
| 275 | + FILE *file = fopen("/root/sdcard/debuglog.txt", "a"); // "a" 模式表示追加内容到文件末尾 | ||
| 276 | + if (file == NULL) { | ||
| 277 | + perror("无法打开日志文件"); | ||
| 278 | + return; | ||
| 279 | + } | ||
| 280 | + // 获取当前时间 | ||
| 281 | + time_t now; | ||
| 282 | + time(&now); | ||
| 283 | + struct tm *local = localtime(&now); | ||
| 284 | + // 写入时间戳和消息到文件 | ||
| 285 | + fprintf(file, "[%04d-%02d-%02d %02d:%02d:%02d] %s\n", | ||
| 286 | + local->tm_year + 1900, local->tm_mon + 1, local->tm_mday, | ||
| 287 | + local->tm_hour, local->tm_min, local->tm_sec, format); | ||
| 288 | + | ||
| 289 | + // 关闭文件 | ||
| 290 | + fclose(file); | ||
| 291 | + #endif | ||
| 292 | +} |
| @@ -19,6 +19,8 @@ void JZ_LampLumenControlFeature(uint8_t value1,uint8_t value2);//亮度控制功 | @@ -19,6 +19,8 @@ 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);//提取 . 之前的字符串 | 20 | void JZ_GetBeforeChar(const char *dest,char *src);//提取 . 之前的字符串 |
| 21 | void JZ_DelayThreadCreate(int delayTime);//延时执行线程创建 | 21 | void JZ_DelayThreadCreate(int delayTime);//延时执行线程创建 |
| 22 | +void Jz_set_widget_value(int index,int value); | ||
| 23 | +void JZ_LOG_INFO(const char *format, ...); | ||
| 22 | #ifdef __cplusplus | 24 | #ifdef __cplusplus |
| 23 | } | 25 | } |
| 24 | #endif | 26 | #endif |
| @@ -21,7 +21,6 @@ | @@ -21,7 +21,6 @@ | ||
| 21 | 21 | ||
| 22 | #include "JZ_lamp.h" | 22 | #include "JZ_lamp.h" |
| 23 | #include "JZ_TempControl.h" | 23 | #include "JZ_TempControl.h" |
| 24 | -#include "JZ_widget.h" | ||
| 25 | #include "JZ_uart.h" | 24 | #include "JZ_uart.h" |
| 26 | #include "JZ_speaker.h" | 25 | #include "JZ_speaker.h" |
| 27 | #include "ircut.h" | 26 | #include "ircut.h" |
| @@ -406,10 +405,6 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | @@ -406,10 +405,6 @@ static T_UAVReturnCode SpeakerControl(T_UavWidgetSpeakerControl *speakerControl) | ||
| 406 | set_paly_state(3); | 405 | set_paly_state(3); |
| 407 | s_isDecodeFinished = false;//解码标志位 | 406 | s_isDecodeFinished = false;//解码标志位 |
| 408 | //将不带格式的名字取出来 | 407 | //将不带格式的名字取出来 |
| 409 | - // len = strrchr(speakerControl->strValue, '.') - speakerControl->strValue;//计算文件名长度 | ||
| 410 | - // memcpy(record_file_name, "\0", 256); | ||
| 411 | - // strncpy(record_file_name, speakerControl->strValue, len);//取文件名 | ||
| 412 | - // record_file_name[len] = '\0'; | ||
| 413 | JZ_GetBeforeChar(speakerControl->strValue,record_file_name); | 408 | JZ_GetBeforeChar(speakerControl->strValue,record_file_name); |
| 414 | sprintf(opus_file_name, "record/%s.opus", record_file_name); | 409 | sprintf(opus_file_name, "record/%s.opus", record_file_name); |
| 415 | //打开opus文件 | 410 | //打开opus文件 |
| @@ -498,7 +493,7 @@ static T_UAVReturnCode SpeakerQuery(T_UavWidgetSpeakerQuery *speakerQuery,T_UavW | @@ -498,7 +493,7 @@ static T_UAVReturnCode SpeakerQuery(T_UavWidgetSpeakerQuery *speakerQuery,T_UavW | ||
| 498 | { | 493 | { |
| 499 | switch(speakerQuery->query) | 494 | switch(speakerQuery->query) |
| 500 | { | 495 | { |
| 501 | - case 1: | 496 | + case 1://播放状态 |
| 502 | if(play_mode == 1)//开启了循环 | 497 | if(play_mode == 1)//开启了循环 |
| 503 | { | 498 | { |
| 504 | if(playStatusQueryFlag == 1)//上次播放未完成,关闭播放 | 499 | if(playStatusQueryFlag == 1)//上次播放未完成,关闭播放 |
| @@ -9,12 +9,12 @@ sync; | @@ -9,12 +9,12 @@ sync; | ||
| 9 | 9 | ||
| 10 | # 检查文件是否存在 | 10 | # 检查文件是否存在 |
| 11 | if [ -f "$file_path" ]; then | 11 | if [ -f "$file_path" ]; then |
| 12 | - # 读取文件的第一行 | ||
| 13 | - value=$(head -n 1 "$file_path") | ||
| 14 | - if [ -z "$value" ]; then #判断文件是否为空,文件为空意味着log导致了sd卡文件系统变为只读 | ||
| 15 | #重新挂载sd卡 | 12 | #重新挂载sd卡 |
| 16 | umount /dev/mmcblk0p3 | 13 | umount /dev/mmcblk0p3 |
| 17 | mount -t vfat -o iocharset=utf8 /dev/mmcblk0p3 /root/sdcard | 14 | mount -t vfat -o iocharset=utf8 /dev/mmcblk0p3 /root/sdcard |
| 15 | + # 读取文件的第一行 | ||
| 16 | + value=$(head -n 1 "$file_path") | ||
| 17 | + if [ -z "$value" ]; then #判断文件是否为空,文件为空意味着log导致了sd卡文件系统变为只读 | ||
| 18 | 18 | ||
| 19 | echo "删除log文件" | 19 | echo "删除log文件" |
| 20 | rm -rf /root/sdcard/Logs/JZ*.log | 20 | rm -rf /root/sdcard/Logs/JZ*.log |
| @@ -10,11 +10,10 @@ | @@ -10,11 +10,10 @@ | ||
| 10 | #include "string.h" | 10 | #include "string.h" |
| 11 | #include <pthread.h> | 11 | #include <pthread.h> |
| 12 | #include <opus.h> | 12 | #include <opus.h> |
| 13 | -#include "JZ_widget.h" | 13 | +#include "JZ_speaker.h" |
| 14 | #include "wiringPi.h" | 14 | #include "wiringPi.h" |
| 15 | -#include "uav_widget.h" | ||
| 16 | #include <math.h> | 15 | #include <math.h> |
| 17 | - | 16 | +#include <stdbool.h> |
| 18 | int music_sum=0;//歌曲总数 | 17 | int music_sum=0;//歌曲总数 |
| 19 | int music_num=0;//当前播放的歌曲编号 | 18 | int music_num=0;//当前播放的歌曲编号 |
| 20 | char musiclist[128][128];//最多存取128首歌曲 | 19 | char musiclist[128][128];//最多存取128首歌曲 |
-
请 注册 或 登录 后发表评论