Code review from 袁清梦
* refs/changes/834/head: (10 commits squashed)
- 黑曜律动表盘资源汇总
- Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/
64191456b9581d62e8f81ac0/FD230 into sdk602patch0626
- Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/
64191456b9581d62e8f81ac0/FD230 into sdk602patch0626
- Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/
64191456b9581d62e8f81ac0/FD230 into sdk602patch0626
- Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/
64191456b9581d62e8f81ac0/FD230 into sdk602patch0626
- Merge branch 'sdk602patch0626' of https://codeup.aliyun.com/
64191456b9581d62e8f81ac0/FD230 into sdk602patch0626
- 更新表盘制作脚本以及说明文档
- 更新黑耀表盘资源文件
- 修改时间分钟个位获取的错误
- 优化睡眠数据计算。优化数据显示
Signed-off-by: Caisking <3449750381@qq.com>
Reviewed-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
Merged-by: snickersun@163.com <accounts_62b90f7fcf51ade33b6f628e@mail.teambition.com>
link: https://codeup.aliyun.com/64191456b9581d62e8f81ac0/FD230/change/834
+/***
+ * @Date: 2024-08-08 15:02:35
+ * @LastEditors: Caisking 3449750381@qq.com
+ * @LastEditTime: 2024-08-30 17:12:56
+ * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialModelMinUnits.cpp
+ */
/***
* @Date: 2024-08-08 15:02:35
* @LastEditors: Caisking 3449750381@qq.com
struct timeval tv;
gettimeofday(&tv, NULL); // 获取当前时间
localtime_r(&tv.tv_sec, &tblock_);
- min_units = tblock_.tm_hour % 10; // 小时十位
+ min_units = tblock_.tm_min % 10; // 小时十位
out = static_cast<float>(min_units);
// 刷新UI数据
void SleepView::SleepDataRefresh()
{
- int sleep_hour = SleepModel::GetInstance().get_sleep_hour();
- int sleep_min = SleepModel::GetInstance().get_sleep_min();
+ // 获取睡眠数据
+ SleepModel &sleepModel = SleepModel::GetInstance();
+ int sleep_hour = sleepModel.get_sleep_hour();
+ int sleep_min = sleepModel.get_sleep_min();
+ int total_sleep = sleepModel.get_sleep_total();
+ int sleep_goal = sleepModel.get_sleep_goal();
+
WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SleepDataRefresh %d %d", sleep_hour, sleep_min);
+
// 补零操作
std::string hour_str = (sleep_hour < 10) ? "0" + std::to_string(sleep_hour) : std::to_string(sleep_hour);
std::string min_str = (sleep_min < 10) ? "0" + std::to_string(sleep_min) : std::to_string(sleep_min);
time_hour->SetText(hour_str.c_str());
time_minute->SetText(min_str.c_str());
}
- float value = (static_cast<float>(SleepModel::GetInstance().get_sleep_total()) / static_cast<float>(SleepModel::GetInstance().get_sleep_goal())) * 100.0f;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "value %d!", value);
+
+ // 计算进度百分比,确保目标睡眠时间不为零
+ float value = 0.0f;
+ if (sleep_goal > 0)
+ {
+ value = (static_cast<float>(total_sleep) / (sleep_goal / 60)) * 100.0f;
+ }
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Progress value: %.2f%%", value);
circleProgress_->SetValue(value);
circleProgress_->SetCapType(CAP_ROUND);
}
// 更新目标时间
- int totaltime = SleepModel::GetInstance().get_sleep_goal();
if (goaltime != nullptr)
{
- UpdateLabel(goaltime, totaltime, STR_SLEEPMGOAL);
+ UpdateLabel(goaltime, sleep_goal, STR_SLEEPMGOAL);
}
+ // 刷新视图
RootView::GetInstance()->Invalidate();
}
-#!/bin/bash
-###
- # @Date: 2024-06-07 09:44:50
+#!/bin/bash
+###
+# @Date: 2024-06-07 09:44:50
# @LastEditors: Caisking 3449750381@qq.com
- # @LastEditTime: 2024-07-18 16:59:20
+ # @LastEditTime: 2024-08-30 15:00:54
# @FilePath: /FD230/tools/dial_converter_tool/make_tools/gen_dial_bin.sh
-###
-
-# 返回上一级目录
-cd ..
-
-# 检查并创建 out 和 dial_lzma 目录
-mkdir -p out dial_lzma
-
-# 获取 instance 目录下的所有子目录列表
-subdirs=(instance/*/)
-for subdir in "${subdirs[@]}"; do
- # 提取子目录名称
- dial=$(basename "$subdir")
-
- # 查找子目录中的 XML 文件并提取文件名
- xml_file=$(find "$subdir" -maxdepth 1 -type f -name "*.xml" -printf "%f\n" | head -n 1)
- if [ -z "$xml_file" ]; then
- echo "Error: XML file not found in $subdir"
- continue
- fi
-
- # 计算文件数量和大小
- dialfilecount=$(find "$subdir" -maxdepth 1 -type f | wc -l)
- dialfilesize=$(du -sh "$subdir" | awk '{print $1}')
-
- # 输出统计信息
- echo "Processing $dial [$dialfilecount files, $dialfilesize size]"
-
- # 调用 main.py 处理子目录中的文件
- if ! python main.py -dir "$subdir" -output out/; then
- echo "Error processing directory $dial"
- continue
- fi
-
- # 压缩 .bin 文件到 .lzma 文件
- bin_file="out/${xml_file%.xml}.bin"
- lzma_file="dial_lzma/$dial/${xml_file%.xml}.lzma"
-
- # 创建必要的目录
- mkdir -p "$(dirname "$lzma_file")"
-
- # 使用 lzma_tool 压缩文件
- if ! ../../code/sdk/tools/bin/lzma_tool/lzma_tool -d12 -lc0 -lp0 e "$bin_file" "$lzma_file"; then
- echo " lzma_tool directory $dial error"
- else
- echo " lzma_tool directory $dial ok"
- fi
+###
+
+# 返回上一级目录
+cd ..
+
+# 检查并创建 out 和 dial_lzma 目录
+mkdir -p out dial_lzma
+
+# 检查是否传入参数
+if [ "$#" -gt 1 ]; then
+ echo "Usage: $0 [dial_folder]"
+ exit 1
+fi
+
+# 如果有参数,则处理指定的目录;否则处理所有子目录
+if [ "$#" -eq 1 ]; then
+ subdirs=("instance/$1/")
+ if [ ! -d "instance/$1" ]; then
+ echo "Error: Specified directory 'instance/$1' does not exist."
+ exit 1
+ fi
+else
+ subdirs=(instance/*/)
+fi
+
+for subdir in "${subdirs[@]}"; do
+ # 提取子目录名称
+ dial=$(basename "$subdir")
+
+ # 查找子目录中的 XML 文件并提取文件名
+ xml_file=$(find "$subdir" -maxdepth 1 -type f -name "*.xml" -printf "%f\n" | head -n 1)
+ if [ -z "$xml_file" ]; then
+ echo "Error: XML file not found in $subdir"
+ continue
+ fi
+
+ # 计算文件数量和大小
+ dialfilecount=$(find "$subdir" -maxdepth 1 -type f | wc -l)
+ dialfilesize=$(du -sh "$subdir" | awk '{print $1}')
+
+ # 输出统计信息
+ echo "Processing $dial [$dialfilecount files, $dialfilesize size]"
+
+ # 调用 main.py 处理子目录中的文件
+ if ! python main.py -dir "$subdir" -output out/; then
+ echo "Error processing directory $dial"
+ continue
+ fi
+
+ # 压缩 .bin 文件到 .lzma 文件
+ bin_file="out/${xml_file%.xml}.bin"
+ lzma_file="dial_lzma/$dial/${xml_file%.xml}.lzma"
+
+ # 创建必要的目录
+ mkdir -p "$(dirname "$lzma_file")"
+
+ # 使用 lzma_tool 压缩文件
+ if ! ../../code/sdk/tools/bin/lzma_tool/lzma_tool -d12 -lc0 -lp0 e "$bin_file" "$lzma_file"; then
+ echo " lzma_tool directory $dial error"
+ else
+ echo " lzma_tool directory $dial ok"
+ fi
done
\ No newline at end of file
--- /dev/null
+## 在liunx环境运行表盘脚本\r
+\r
+# 1.下载对应模块\r
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple Pillow\r
+\r
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python\r
+\r
+pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib\r
+\r
+## 2.对表盘工具进行赋权限\r
+\r
+chmod +x gen_dial_bin.sh\r
+./gen_dial_bin.sh\r
+\r
+## 3.制作运行单个表盘\r
+python ./main.py -dir ./instance/1028/ -output ./out/\r
+\r
+#使用lzma_tool工具需要赋权限\r
+ chmod +x ../lzma_tool/lzma_tool\r
+\r
+ ### 更新版本 0830\r
+- 制作单个表盘以及lzma文件 **./gen_dial_bin.sh + 表盘文件夹路径**\r
+\r
+ ```\r
+ 示例 ./gen_dial_bin.sh ../instance/114/\r
+ ```\r
+\r
+- 制作所有的表盘以及lzma文件\r
+\r
+ ```\r
+ ./gen_dial_bin.sh\r
+ ```\r
+\r
+ \r
+\r
+++ /dev/null
-\r
-在liunx环境运行表盘脚本\r
-\r
-#下载对应模块\r
-pip install -i https://pypi.tuna.tsinghua.edu.cn/simple Pillow\r
-\r
-pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python\r
-\r
-pip install -i https://pypi.tuna.tsinghua.edu.cn/simple matplotlib\r
-\r
-chmod +x make_dial.sh\r
-./make_dial.sh\r
-\r
-#制作运行单个表盘\r
-python ./main.py -dir ./instance/1028/ -output ./out/\r
-\r
-#使用lzma_tool工具需要赋权限\r
- chmod +x ../lzma_tool/lzma_tool
\ No newline at end of file