A27R版本修改

This commit is contained in:
2025-05-17 14:22:08 +08:00
parent 0fd28aa974
commit 3b3c63f1f3
388 changed files with 319982 additions and 30872 deletions

View File

@ -245,4 +245,16 @@
<string name="4.连接成功后系统此界面会自动弹出对应界面就可以开始使用CarPlay功能了。">
<language name="en_US">4.After successful connection, the system will automatically pop up the corresponding interface, and you can start using the CarPlay function.</language>
<language name="zh_CN">4.连接成功后系统此界面会自动弹出对应界面就可以开始使用CarPlay功能了。</language>
</string>
<string name="状态:">
<language name="zh_CN">状态:</language>
<language name="en_US">State:</language>
</string>
<string name="密码:">
<language name="zh_CN">密码:</language>
<language name="en_US">Password:</language>
</string>
<string name="升级准备中...">
<language name="zh_CN">升级准备中...</language>
<language name="en_US">Upgrade preparation in progress ...</language>
</string>

View File

@ -461,6 +461,14 @@
<normal font_name="moto_font" font_size="130" text_color="#FFFFFF"/>
<disable text_color="#44444466"/>
</style>
<style name="tips_label">
<normal font_name="default" font_size="28" text_color="#FFFFFF"/>
<disable text_color="#44444466"/>
</style>
<style name="wifi_label">
<normal font_size="30" text_align_h="left" text_color="#FFFFFF"/>
<disable text_color="#44444466"/>
</style>
</label>
<line_number>
<style name="default" text_align_h="center">

View File

@ -34,13 +34,14 @@
</view>
<view name="view2" h="100" style:normal:border="none" style:normal:border_width="2" style:normal:border_color="#FFFFFF" opacity="255" style:normal:bg_color="#000000" style:normal:bg_image="" x="0" y="380" w="800" enable="true" visible="true">
<view name="icon_view" x="10" y="4" w="780" h="77">
<image name="func_bt_icon" x="514" y="5" w="35" h="43" draw_type="default" image="bt" visible="true"/>
<image name="func_bt_icon" x="500" y="2" w="35" h="43" draw_type="default" image="bt" visible="true"/>
<image name="tcs_icon" x="69" y="6" w="37" h="41" draw_type="default" image="tcs" visible="true"/>
<image name="warn_abs_icon" x="151" y="2" w="48" h="43" draw_type="default" image="abs" visible="true"/>
<image name="warn_engine_icon" x="594" y="4" w="50" h="43" draw_type="default" image="engine" visible="true"/>
<image name="warn_engine_icon" x="580" y="1" w="50" h="43" draw_type="default" image="engine" visible="true"/>
<image name="left" x="0" y="0" w="59" h="43" draw_type="default" image="turn_left_icon" visible="true"/>
<image name="right" x="726" y="-2" w="54" h="43" draw_type="default" image="turn_right_icon" visible="true"/>
<image name="light" x="249" y="6" w="48" h="35" draw_type="default" image="ahb" visible="true"/>
<image name="warn_fan_icon" x="667" y="2" w="40" h="35" draw_type="default" image="fan"/>
</view>
<label name="dh_veer_velocity" h="60" x="0" y="40" w="110" style:normal:text_color="#FFFFFF" style:normal:font_size="60" style:normal:font_name="Serpentine_MediumOblique" style:normal:text_align_h="center" style:normal:text_align_v="top"/>
<label name="dh_grade" h="96" style:normal:text_color="#FFFFFF" style:normal:font_size="80" style:normal:font_name="Serpentine_MediumOblique" x="365" y="4" w="68" style:normal:text_align_v="bottom" text="-"/>

View File

@ -1,5 +1,20 @@
<window name="prompt" style="demo_bg_blk">
<progress_bar name="plan_bar" x="c" y="m" w="200" h="20" show_text="true" style:normal:font_name="moto_font" style:normal:text_color="#000000" value="0"/>
<label name="point_text" x="c" y="190" w="160" h="30" style:normal:text_color="#FFFFFF" style:normal:font_name="moto_font" text="升级准备中..."/>
<image name="prompt_image" x="0" y="460" w="800" h="20" draw_type="default" style="default"/>
<window name="prompt" style="default" style:normal:bg_color="#000000">
<progress_bar name="plan_bar" x="c" y="m" w="200" h="20" show_text="true" style:normal:font_name="A27_SYHT_CT" style:normal:text_color="#000000" value="0"/>
<label name="point_text" x="c" y="190" w="160" h="30" style="tips_label" tr_text="升级准备中..."/>
<view name="wifi_view" x="300" y="270" w="490" h="210">
<label name="label1" x="0" y="0" w="490" h="30" style="wifi_label" text="WLAN:">
<label name="AP" x="100" y="0" w="355" h="30" style="wifi_label"/>
</label>
<label name="label2" x="0" y="40" w="100%" h="30" style="wifi_label" tr_text="密码:">
<label name="PWD" x="100" y="0" w="355" h="30" style="wifi_label"/>
</label>
<label name="label3" x="0" y="80" w="100%" h="30" style="wifi_label" tr_text="状态:">
<label name="state" x="80" y="0" w="355" h="30" style="wifi_label" text="未连接"/>
</label>
<label name="label" x="0" y="110" w="490" h="100" style="wifi_label" line_wrap="true" word_wrap="true" tr_text="当前设备支持wifi升级可扫码进行连接/搜索输入密码案进行连接"/>
</view>
<view name="countdown_view" x="0" y="0" w="480" h="107">
<label name="countdown" x="10" y="10" w="70" h="79" style="wifi_label" style:normal:font_size="60" style:normal:text_color="#FFFFFF" text="60"/>
<label name="label4" x="80" y="10" w="382" h="89" style="wifi_label" line_wrap="true" word_wrap="true" tr_text="wifi未连接自动退出倒计时"/>
</view>
</window>

File diff suppressed because one or more lines are too long

View File

@ -11,7 +11,7 @@
"awtk": ">=2210"
},
"assets": {
"activedTheme": "default",
"activedTheme": "dark",
"outputDir": "res",
"loadFrom": "any",
"const": "resource_data",

View File

@ -4,7 +4,7 @@
#include "assets/__assets_dark.inc"
#ifndef APP_THEME
#define APP_THEME "default"
#define APP_THEME "dark"
#endif /*APP_THEME*/
bool_t assets_has_theme(const char* name) {

View File

@ -32,18 +32,18 @@ void TXCMD_Other_Set(unsigned char time_buffer[],uint8_t len){
#endif
static uint8_t send_flag = 0;
extern uint8_t uart3_flag;
// static uint8_t send_flag = 0;
// extern uint8_t uart3_flag;
extern uint8_t flash_flag;
//发送询问时间+版本号查询
void Send_software_version(void){
DEBUG_PRINT("Send_software_version.\r\n");
if(uart3_flag){
uart3_flag = 0;
printf("uart3>>open.\r\n");
UART3_Type_regression();
// urtflag = 2;
}
// if(uart3_flag){
// uart3_flag = 0;
// printf("uart3>>open.\r\n");
// UART3_Type_regression();
// // urtflag = 2;
// }
time_software_request[4] = Get_sys_softwar_host();
time_software_request[5] = Get_sys_softwar_order();
@ -56,17 +56,21 @@ void Send_software_version(void){
TXCMD_Other_Set(time_software_request,9);
send_flag++;
if(send_flag>=3 && flash_flag){
send_flag = 0;
uart3_flag = 1;
}
// send_flag++;
// if(send_flag>=3 && flash_flag){
// send_flag = 0;
// // uart3_flag = 1;
// }
}
//发送胎压信息
void Send_tire_pressure_information(void){
#if UI_VIEW_TIRE_PRESSURE
if((mac_address_normal(custom_data.front_pressure.mac_address, 6) == 0) && (mac_address_normal(custom_data.rear_pressure.mac_address, 6) == 0))
return;
unsigned char trie_reset[19] = {0xAA,0x10,0x05,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uint8_t i=0;
if(mac_address_normal(custom_data.front_pressure.mac_address,6)){
@ -92,6 +96,35 @@ void Send_tire_pressure_information(void){
}
//发送胎压信息
void Send_tire_pressure_init_information(void){
#if UI_VIEW_TIRE_PRESSURE
unsigned char trie_reset[19] = {0xAA,0x10,0x05,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
uint8_t i=0;
if(mac_address_normal(custom_data.front_pressure.mac_address,6)){
trie_reset[4] = 0x01;
for(i=0;i<6;i++){
trie_reset[5+i] = custom_data.front_pressure.mac_address[i];
}
}
if(mac_address_normal(custom_data.rear_pressure.mac_address,6)){
trie_reset[11] = 0x01;
for(i=0;i<6;i++){
trie_reset[12+i] = custom_data.rear_pressure.mac_address[i];
}
}
uint8_t count = 0;
for(uint8_t i=0;i<16;i++){
count += trie_reset[2+i];
}
trie_reset[18] = count;
TXCMD_Other_Set(trie_reset,19);
#endif
}
//发送OTA升级判断
void Send_ota_state(uint8_t state){
ota_request[1] = state;
@ -185,7 +218,7 @@ void send_wifi_set_time(int time_buf[]){
dt.second = time_buf[5];
date_time_set(&dt);
uint16_t check_buffer[6];
uint32_t check_buffer[6];
check_buffer[0] = dt.year;
check_buffer[1] = dt.month;
check_buffer[2] = dt.day;
@ -194,7 +227,7 @@ void send_wifi_set_time(int time_buf[]){
check_buffer[5] = dt.second;
sum = fml_time_to_stamp(check_buffer);
sum += 28800;
// sum += 28800;
Send_list_set_time(sum);
}

View File

@ -19,7 +19,7 @@
#define MOTO_ICMX_GB518_A272R 6
#define MOTO_WARE_HOSE MOTO_ICMX_GB518_A272W
#define MOTO_WARE_HOSE MOTO_ICMX_GB518_A272R
#if (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A270T)
@ -75,7 +75,7 @@
#elif (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A272W)
#define SOFT_WARE_HOST 0
#define SOFT_WARE_ORDER 2
#define SOFT_WARE_ORDER 4
#define TP_VERSION OVERSEAS_VERSION_2
@ -115,7 +115,7 @@
#elif (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A272R)
#define SOFT_WARE_HOST 0
#define SOFT_WARE_ORDER 2
#define SOFT_WARE_ORDER 8
#define TP_VERSION OVERSEAS_VERSION_2
@ -237,7 +237,7 @@
#define UI_TORAL6_GRIDS_TEMP_WARNING 116
#define UI_TORAL6_GRIDS_TEMP_WARNING 110
#define UI_TORAL6_GRIDS_TEMP_0 52
#define UI_TORAL6_GRIDS_TEMP_1 70
#define UI_TORAL6_GRIDS_TEMP_2 80
@ -275,7 +275,8 @@
#define JUDGE_BIN_6(data) JUDGE_BIT(data, 6)
#define JUDGE_BIN_7(data) JUDGE_BIT(data, 7)
//当前模式
#define DEMO_UI_SELF_START 50//开始自检标志
#define DEMO_UI_SELF_START 50//动画完毕,准备开始自检标志
#define DEMO_UI_SELF_START_OK 60//准备完毕开始自检
#define DEMO_UI_SELF_CHECKING 75//自检中标志
#define DEMO_UI_SELF_FINISH 100//正常模式
#define DEMO_UI_SELF_UPGRADE_BEGINS 150//升级模式
@ -294,6 +295,9 @@
#define OUTPUT_COLOR(data) str_to_num(data)
#define CALL_NAME_MAX 120
#define PHONE_MAX 30
#define ANIMATION_END_TIME 91
#define SELF_INSPECTION_END_TIME ANIMATION_END_TIME+25

View File

@ -356,7 +356,7 @@ uint16_t fml_leap_year(uint16_t year){
return ((year%4 == 0)&&(year%100!=0) ) || (year%400 ==0);
}
uint32_t fml_time_to_stamp(uint16_t time[]){
uint32_t fml_time_to_stamp(uint32_t time[]){
static uint32_t dax = 0;
static uint32_t day_count = 0;
uint16_t leap_year_count = 0;

View File

@ -23,5 +23,5 @@ ret_t long_key_event_handling(uint8_t key);
uint8_t mac_address_normal(char mac[],int size);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫΪ0<CEAA><30>ȫΪFF<46><46><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> MAC <20><>ַ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>1
uint16_t fml_leap_year(uint16_t year);
uint32_t fml_time_to_stamp(uint16_t time[]);
uint32_t fml_time_to_stamp(uint32_t time[]);
uint32_t fml_stamp_to_time(uint32_t timep , uint16_t time[]);

View File

@ -112,6 +112,10 @@ static void tp_init(widget_t *win) {
widget_t *temp_view = widget_lookup(win, "temp_view", TRUE);
widget_set_visible(temp_view,FALSE);
#endif
#if UI_FAN_CLOSE
widget_t *warn_fan_icon = widget_lookup(win, "warn_fan_icon", TRUE);
widget_set_visible(warn_fan_icon,FALSE);
#endif
#if (CARLINK_TP_CP && CARLINK_TP_AA)
@ -258,6 +262,7 @@ static void tp_ui_refresh_icons(widget_t *win) {
#ifndef UI_ENG_CLOSE
static widget_t *warn_engine_icon = NULL;
#endif
static widget_t *warn_fan_icon = NULL;
if (!tp_inited) {
func_bt_icon = widget_lookup(win, "func_bt_icon", TRUE);
@ -271,6 +276,7 @@ static void tp_ui_refresh_icons(widget_t *win) {
#ifndef UI_ENG_CLOSE
warn_engine_icon = widget_lookup(win, "warn_engine_icon", TRUE); // abs
#endif
warn_fan_icon = widget_lookup(win, "warn_fan_icon", TRUE);
}
Universal_widget_display(func_bt_icon, Get_sys_bt_connect_state());
Universal_widget_display(light, Get_sys_lamplight());
@ -284,6 +290,9 @@ static void tp_ui_refresh_icons(widget_t *win) {
#ifndef UI_ENG_CLOSE
Universal_widget_display(warn_engine_icon, Get_sys_warning_engine());
#endif
#if !UI_FAN_CLOSE
Universal_widget_display(warn_fan_icon, Get_sys_warning_fan());
#endif
}
/**
@ -297,6 +306,11 @@ static void tp_ui_refresh_rmp(widget_t *win, uint16_t value) {
if (!tp_inited) {
dh_veer_velocity = widget_lookup(win, "dh_veer_velocity", TRUE);
}
if (value >= 12000)
{
value = 12000;
}
char tmpStr[20] = {0};
static int16_t _value = 0;
double rpm = 0;
@ -532,7 +546,7 @@ static ret_t on_new_key_down(void *ctx, event_t *e) {
#if (MOTO_WARE_HOSE == MOTO_ICMX_A591F)
return_demo();
#else
if(Get_sys_wifi_state())//连接上不允许切换
if(Get_sys_wifi_state() && Get_sys_bt_connect_state())//连接上不允许切换
return RET_OK;
widget_t *qr_view = widget_lookup(win, "qr_view", TRUE);
widget_t *Tab = widget_lookup(win, "Tab", TRUE); // 选择器

View File

@ -106,7 +106,7 @@ static ret_t on_set_time_key_down(void* ctx, event_t* e) {
dt.second = 0;
date_time_set(&dt);
uint16_t check_buffer[6];
uint32_t check_buffer[6];
check_buffer[0] = dt.year;
//check_buffer[0] = 2024;
check_buffer[1] = dt.month;

View File

@ -4,6 +4,9 @@
#include "../common/user_data.h"
#include "../common/data_port.h"
#define LOADING_STATE_NORMAL 0
#define LOADING_STATE_FRONT 1
#define LOADING_STATE_REAR 1
#define DETECTION_TIME 50
uint8_t front_loading_state = 0 ;
@ -208,7 +211,7 @@ void refresh_front_tire_oressure(widget_t* win){
//前胎压范围130-250kpa 取130 250 转psi范围为188-362
if(ago_pressure.blow_by_state || ago_pressure.voltage_state || ago_pressure.temp_state || ago_pressure.lose_flag){
widget_use_style(widget,"F_error");
}else if(ago_pressure.temp<70 && (ago_pressure.psi>=TIRE_PRESSURE_FRONT_LOWER && ago_pressure.psi<=TIRE_PRESSURE_FRONT_UPPER)){
}else if(ago_pressure.psi>=TIRE_PRESSURE_FRONT_LOWER && ago_pressure.psi<=TIRE_PRESSURE_FRONT_UPPER){
widget_use_style(widget,"F_normal");
}else{
widget_use_style(widget,"F_error");
@ -218,13 +221,15 @@ void refresh_front_tire_oressure(widget_t* win){
if(ago_pressure.temp==0)
widget_set_text_utf8(front_temp,"0");
else{
if(ago_pressure.temp>127)
tk_snprintf(tmpStr, sizeof(tmpStr), "-%d",(ago_pressure.temp-128));
else
if(ago_pressure.temp>127){
uint8_t temp_value = (ago_pressure.temp-128);
tk_snprintf(tmpStr, sizeof(tmpStr), "-%d",temp_value);
}else{
tk_snprintf(tmpStr, sizeof(tmpStr), "%d",ago_pressure.temp);
}
widget_set_text_utf8(front_temp,tmpStr);
if(ago_pressure.temp>=70){
if(ago_pressure.temp_state){
widget_set_style_str(front_temp, "normal.text_color", "red");
widget_set_style_str(front_tempuint, "normal.text_color", "red");
}else{
@ -333,7 +338,7 @@ void refresh_rear_tire_oressure(widget_t* win){
//后胎压范围150-280kpa 取150 280 转psi范围为217-406
if(after_pressure.blow_by_state || after_pressure.voltage_state || after_pressure.temp_state || after_pressure.lose_flag){
widget_use_style(widget,"R_error");
}else if(after_pressure.temp<70 && (after_pressure.psi>=TIRE_PRESSURE_REAR_LOWER && after_pressure.psi<=TIRE_PRESSURE_REAR_UPPER)){
}else if(after_pressure.psi>=TIRE_PRESSURE_REAR_LOWER && after_pressure.psi<=TIRE_PRESSURE_REAR_UPPER){
widget_use_style(widget,"R_normal");
}else{
widget_use_style(widget,"R_error");
@ -343,12 +348,13 @@ void refresh_rear_tire_oressure(widget_t* win){
if(after_pressure.temp==0)
widget_set_text_utf8(rear_temp,"0");
else{
if(after_pressure.temp>127)
tk_snprintf(tmpStr, sizeof(tmpStr), "-%d",(after_pressure.temp-128));
else
if(after_pressure.temp>127){
uint8_t temp_value = (after_pressure.temp-128);
tk_snprintf(tmpStr, sizeof(tmpStr), "-%d",temp_value);
}else
tk_snprintf(tmpStr, sizeof(tmpStr), "%d",after_pressure.temp);
widget_set_text_utf8(rear_temp,tmpStr);
if(after_pressure.temp>=70){
if(after_pressure.temp_state){
widget_set_style_str(rear_temp, "normal.text_color", "red");
widget_set_style_str(rear_tempuint, "normal.text_color", "red");
}else{
@ -430,7 +436,7 @@ void front_tire_detection(widget_t* win){
if(mac_address_normal(ago_pressure.mac_address,6) == 0){
front_time--;
front_loading_state = 1;
front_loading_state = LOADING_STATE_FRONT;
if(front_time==0){
if (tk_str_eq(language, "en")) {//英文
widget_set_text_utf8(Front,"Sensor loss");
@ -465,7 +471,7 @@ void rear_tire_detection(widget_t* win){
if(mac_address_normal(after_pressure.mac_address,6) == 0){
front_time--;
rear_loading_state = 1;
rear_loading_state = LOADING_STATE_REAR;
if(front_time==0){
if (tk_str_eq(language, "en")) {//英文
widget_set_text_utf8(Rear,"Sensor loss");
@ -583,45 +589,11 @@ static ret_t tire_data_refresh(const timer_info_t* timer){ //demo Progress bar C
refresh_rear_tire_oressure(win);
//胎压界面长按事件标志
if(tire_pressure_loading==1){//异常可以学习
Pressure_t ago_pressure = Get_sys_front_pressure();
if(ago_pressure.blow_by_state || ago_pressure.voltage_state || ago_pressure.temp_state || ago_pressure.lose_flag){//异常
if(ago_pressure.blow_by_state)
printf("blow_by_state -------------error .\r\n");
if(ago_pressure.voltage_state)
printf("voltage_state -------------error .\r\n");
if(ago_pressure.lose_flag)
printf("lose_flag -------------error .\r\n");
front_tire_pressure_loading();
tire_pressure_loading=3;
}else if(ago_pressure.temp<70 && (ago_pressure.psi>=TIRE_PRESSURE_FRONT_LOWER && ago_pressure.psi<=TIRE_PRESSURE_FRONT_UPPER)){//正常禁止学习
tire_pressure_loading=0;
}else{//异常
printf("data error ------------. ago_pressure.temp =%d ago_pressure.psi =%d \r\n",ago_pressure.temp,ago_pressure.psi);
front_tire_pressure_loading();
tire_pressure_loading=3;
}
// front_tire_pressure_loading();
// tire_pressure_loading=3;
front_tire_pressure_loading();
tire_pressure_loading=3;
}else if(tire_pressure_loading==2){
Pressure_t after_pressure = Get_sys_rear_pressure();
if(after_pressure.blow_by_state || after_pressure.voltage_state || after_pressure.temp_state || after_pressure.lose_flag){//异常
if(after_pressure.blow_by_state)
printf("blow_by_state -------------error .\r\n");
if(after_pressure.voltage_state)
printf("voltage_state -------------error .\r\n");
if(after_pressure.lose_flag)
printf("lose_flag -------------error .\r\n");
rear_tire_pressure_loading();
tire_pressure_loading=3;
}else if(after_pressure.temp<70 && (after_pressure.psi>=TIRE_PRESSURE_REAR_LOWER && after_pressure.psi<=TIRE_PRESSURE_REAR_UPPER)){//正常禁止学习
tire_pressure_loading=0;
}else{//异常
printf("data error ------------. after_pressure.temp =%d after_pressure.psi =%d \r\n",after_pressure.temp,after_pressure.psi);
rear_tire_pressure_loading();
tire_pressure_loading=3;
}
// rear_tire_pressure_loading();
// tire_pressure_loading=3;
rear_tire_pressure_loading();
tire_pressure_loading=3;
}
break;
case 1:

View File

@ -380,6 +380,11 @@ static void ui_refresh_call(widget_t *win, uint8_t value)
}
char tmpStr[20] = {0};
if(value){
widget_set_visible(mile_view,FALSE);
}else{
widget_set_visible(mile_view,TRUE);
}
// 通话部分
switch (value)
@ -783,6 +788,7 @@ static ret_t on_ui_demo1_destroy(void* ctx, event_t* e) {
/**
* 初始化窗口的子控件
*/
extern ret_t on_key_set_data(void* ctx, event_t* e);
static ret_t visit_init_child(void* ctx, const void* iter) {
widget_t* win = WIDGET(ctx);
widget_t* widget = WIDGET(iter);
@ -792,8 +798,10 @@ static ret_t visit_init_child(void* ctx, const void* iter) {
if (name != NULL && *name != '\0') {
if (tk_str_eq(name, "ui_demo1")) {
widget_on(widget, EVT_DESTROY, on_ui_demo1_destroy, win);
widget_on(widget, EVT_KEY_DOWN, on_key_set_list, win);
widget_on(widget, EVT_KEY_DOWN, on_key_set_data, win);
}
widget_on(widget, EVT_KEY_DOWN, on_key_set_list, win);
}
return RET_OK;

View File

@ -63,6 +63,9 @@ extern uint8_t tire_pressure_flag;//再main函数中
extern uint8_t bt2_switch_time;
static uint8_t light_storage = 0;
uint8_t flash_save_flag = 0;
uint8_t save_flag = 0;
extern void SaveDataToFlash(SfudData_t user_data);
extern void Send_defect_code(void);
extern void BT2_Switch(int type);
@ -73,7 +76,7 @@ char UI_uuid[32] = "";
char strQrText[100] = "";
char key_value = 0;
uint8_t uart3_flag = 0;
// uint8_t uart3_flag = 0;
extern void UART3_Modification_Type(void);
extern void UART3_Type_regression(void);
// extern uint8_t urtflag;
@ -165,7 +168,10 @@ extern uint32_t tire_front_time;
extern uint32_t tire_rear_time;
extern uint8_t tire_pressure_flag;//再main函数中
extern uint8_t bt2_state_now_flag;
extern uint8_t bt_reset_flag;
extern uint8_t wifi_time_flag;
uint8_t bw_121_time = 0;
// extern uint8_t bt_connect_flag;
void UI_init(void){
printf("UI_init ...........................................\r\n");
@ -232,11 +238,11 @@ void UI_init(void){
// #else
// sleep_ms(10);
// #endif
#if (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A270T)
console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
#else
console_send_atcmd("AT+NAME=A59_MOTO_Phone,1\r\n", strlen("AT+NAME=A59_MOTO_Phone,1\r\n"));//修改蓝牙名
#endif
// #if (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A270T)
// console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
// #else
// console_send_atcmd("AT+NAME=A59_MOTO_Phone,1\r\n", strlen("AT+NAME=A59_MOTO_Phone,1\r\n"));//修改蓝牙名
// #endif
// #ifdef AMT630HV100
// vTaskDelay(10);
// #else
@ -341,13 +347,13 @@ static ret_t on_timer(const idle_info_t* idle){
Return_demo_win();//如果目标是非主demo界面or投屏界面 则返回主demo界面
}
if(uart3_flag == 1){
//uart_init();
//将通讯串口配置为gpio端口
UART3_Modification_Type();
printf("uart3>>close.\r\n");
uart3_flag = 2;
}
// if(uart3_flag == 1){
// //uart_init();
// //将通讯串口配置为gpio端口
// UART3_Modification_Type();
// printf("uart3>>close.\r\n");
// uart3_flag = 2;
// }
if(Get_sys_upgrade_Flag()==2){//退出升级标志
DEBUG_PRINT("exit >> prompt .\r\n");
@ -377,18 +383,37 @@ static ret_t on_timer(const idle_info_t* idle){
if(bw_121_time)//蓝牙按钮时间控制
bw_121_time--;
// if(bt_connect_flag){
// select_bt_conntect();
// bt_connect_flag = 0;
// }
if(wifi_time_flag)
wifi_time_flag--;
//串口检测蓝牙通讯
if(uart_state && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
uart_state--;
if(!uart_state){
printf("uart3 >gpio.\r\n");
UART3_Modification_Type();//将通讯串口配置为gpio端口
// //串口检测蓝牙通讯
// if(uart_state && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
// uart_state--;
// if(!uart_state){
// printf("uart3 >gpio.\r\n");
// UART3_Modification_Type();//将通讯串口配置为gpio端口
// }
// }else{
// uart_state = 5;
// printf("uart3 > regression.\r\n");
// UART3_Type_regression();//串口恢复正常
// }
if(bt_reset_flag){
if(bt_reset_flag==2){
Send_software_version();
#if UI_VIEW_TIRE_PRESSURE
}else{
Send_tire_pressure_init_information();
#endif
}
}else{
uart_state = 5;
printf("uart3 > regression.\r\n");
UART3_Type_regression();//串口恢复正常
bt_reset_flag--;
}
//串口检测蓝牙心跳 + 接收发送
@ -407,7 +432,9 @@ static ret_t on_timer(const idle_info_t* idle){
refresh500ms_flag = refresh500ms_flag?0:1;
refresh500ms_idletick = xTaskGetTickCount();
}
#else
refresh500ms_flag = 1;
printf("refresh500ms_flag = %d.\r\n",refresh500ms_flag);
#endif
}
@ -415,6 +442,264 @@ static ret_t on_timer(const idle_info_t* idle){
return RET_OK;
}
static void ui_system_timer(void){
static uint16_t time_num =0;
uint32_t light_num=0;
uint16_t light=0;
uint8_t power_state =0;
uint8_t light_count = 0;
static uint8_t light_time = 0;
power_state = Get_sys_power_on_self_test();
if(light_time>=4){
pwm_backlight_changes_slowly();//光感控制亮度
light_time = 0;
}
light_time++;
if(power_state == 100){
// #ifndef AMT630HV100
// Simulating_data_changes();
// #endif
widget_t* win = window_manager();
widget_t* child = window_manager_get_top_main_window(win);
if(child != NULL && strcmp(child->name,"set_list")==0){
list_win_init(child);
// }else if(child != NULL && strcmp(child->name,"ui_demo1")==0){
// new_refreshes(child);
// //灯光刷新
// light_refresh(child);
// //通话界面刷新
// call_refresh(child);
}
//光感数据计算
if(light_storage != data_storage){
light_storage = data_storage;
for(uint8_t i=0;i<SAVE_DATA_SIZE;i++){
if(light_buffer[i] != 0){
light += light_buffer[i];
light_count++;
}
}
light_num = (int)(light/light_count);
Set_sys_light_perception_value(light_num);
if(Get_sys_light_perception_value()>=50){//光感大于70 白天 白色背景
Set_sys_display_theme(1);
}else if(Get_sys_light_perception_value()<=20){
Set_sys_display_theme(0);
}
}
//回到主菜单
if(Get_sys_return_demo() ==2){
time_num = 1;
Set_sys_return_demo(1);
}else if(Get_sys_return_demo() ==1){
if(time_num %600 ==0 || Get_sys_velocity() != 0 || Get_sys_call_state()){//10s左右 || 有速度的情况下直接退回主界面 || 有通话
time_num = 0;
printf("time ok return demo . %d \r\n",Get_sys_return_demo());
Return_demo_win();
}
time_num++;
}else if(Get_sys_return_demo() ==3){
Return_demo_win();//如果目标是非主demo界面or投屏界面 则返回主demo界面
}
// if(uart3_flag == 1){
// //uart_init();
// //将通讯串口配置为gpio端口
// UART3_Modification_Type();
// printf("uart3>>close.\r\n");
// uart3_flag = 2;
// }
if(Get_sys_upgrade_Flag()==2){//退出升级标志
DEBUG_PRINT("exit >> prompt .\r\n");
navigator_replace("ui_demo1");
Set_sys_upgrade_Flag(0);
Set_sys_plan(0);//1.修复升级一定进度失败后 再次进入升级 进度条未清零问题
Set_sys_pace(0);
}
#ifdef AMT630HV100
//1s一刷
if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ){
if(ttrb_mesg()){ //查询时间 首次开机需要去询问时间
Send_software_version();
#if UI_VIEW_TIRE_PRESSURE
}else if(!tire_pressure_mesg()){ //发送胎压信息
Send_tire_pressure_information();
#endif
}else if(!ttrb_time_mesg()){ //发送时间 当用户通过UI设置时间后需要检测是否发送时间
Send_bt_time();
#ifndef DATA_CAN
}else if(!odo_reset_mesg()){ //发送清零命令 当用户长按时清零
Send_trip_reset();
#endif
}else if(fault_code_mesg()){ //发送故障码 为1是需要发送故障码
Send_defect_code();
}
if(bw_121_time)//蓝牙按钮时间控制
bw_121_time--;
// if(bt_connect_flag){
// select_bt_conntect();
// bt_connect_flag = 0;
// }
// //串口检测蓝牙通讯
// if(uart_state && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
// uart_state--;
// if(!uart_state){
// printf("uart3 >gpio.\r\n");
// UART3_Modification_Type();//将通讯串口配置为gpio端口
// }
// }else{
// uart_state = 5;
// printf("uart3 > regression.\r\n");
// UART3_Type_regression();//串口恢复正常
// }
if(bt_reset_flag){
if(bt_reset_flag==2){
Send_software_version();
#if UI_VIEW_TIRE_PRESSURE
}else{
Send_tire_pressure_init_information();
#endif
}
bt_reset_flag--;
}
//串口检测蓝牙心跳 + 接收发送
if(bt_communication_heartbeat && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
bt_communication_heartbeat--;
if(!bt_communication_heartbeat){//需要去重新初始化一次串口
uart_flag = 1;
bt_communication_heartbeat = 10;
}
}
idletick = xTaskGetTickCount();
}
if(xTaskGetTickCount() - refresh500ms_idletick > 500){
refresh500ms_flag = refresh500ms_flag?0:1;
refresh500ms_idletick = xTaskGetTickCount();
}
#else
refresh500ms_flag = 1;
#endif
}
}
static ret_t ui_timer_refresh(const timer_info_t* timer){ //demo Progress bar Color change
// widget_t *win = WIDGET(timer->ctx); // home_page
// static uint32_t count = 0;
// count++;
// printf("count = %d.\r\n",count);
if(animo_time < 510){
#ifndef AMT630HV100
date_time_t dt;
date_time_init(&dt);
#endif
animo_time++;
if(Get_sys_power_on_self_test()<DEMO_UI_SELF_START){
#ifndef AMT630HV100
Set_sys_power_on_self_test(DEMO_UI_SELF_START);
#endif
#ifdef ANIMO_CLOSE
if(animo_time>110){
BrightnessPowerOnSetting();
pwm_enable(2);
pwm_enable(3);
extern void anim_close_lcd_open(void);
anim_close_lcd_open();
}
if(animo_time>=130)
Set_sys_power_on_self_test(DEMO_UI_SELF_START);
#endif
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_START){
if(!power_on_flag)
power_on_flag = 1;
Send_tire_pressure_init_information();//胎压
Set_sys_power_on_self_test(DEMO_UI_SELF_START_OK);
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_START_OK){
if(animo_time>=35){
printf("animo_time = %d.\r\n",animo_time);
#ifdef AMT630HV100
idletick = xTaskGetTickCount();
#else
time_second = dt.second;
printf("time_second = %d .",time_second);
printf("start demo animo .\n");
#endif
Set_sys_power_on_self_test(DEMO_UI_SELF_CHECKING);//设置为自检中
Power_On_Self_Test();
}
#ifdef AMT630HV100
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_CHECKING){
if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 2.5){
UI_init();
// Set_sys_power_on_self_test(100);//设置为自检中
}
}
#else
}else if(time_second<57){
if((dt.second-time_second)>2){
printf("animo_time <57 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else if(time_second==57){
if(dt.second==0){
printf("animo_time ==57 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else if(time_second==58){
if(dt.second==1){
printf("animo_time ==58 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else{
if(dt.second==2){
printf("animo_time ==59 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}
#endif
}
if(Get_sys_power_on_self_test() != DEMO_UI_SELF_UPGRADE_BEGINS){
ui_system_timer();
}else if(Get_sys_upgrade_Flag()==1){
DEBUG_PRINT("start >> prompt .\r\n");
navigator_replace("prompt");
Set_sys_upgrade_Flag(3);
DEBUG_PRINT("screen >> prompt ok .\r\n");
}
//立即保存flash
if(save_flag){
SaveDataToFlash(custom_data.user_data);
save_flag = 0;
}
return RET_REPEAT;
}
extern uint8_t power_on_flag;
void* test_timer_queue(void *args){
@ -480,12 +765,13 @@ void* test_timer_queue(void *args){
if(!power_on_flag)
power_on_flag = 1;
Send_tire_pressure_init_information();//胎压
Set_sys_power_on_self_test(DEMO_UI_SELF_CHECKING);//设置为自检中
console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
// console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
#ifdef AMT630HV100
vTaskDelay(1000);
#else
sleep_ms(200);
sleep_ms(100);
#endif
Power_On_Self_Test();
@ -494,11 +780,11 @@ void* test_timer_queue(void *args){
#ifdef AMT630HV100
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_CHECKING){
if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 3){
#ifdef AMT630HV100
vTaskDelay(100);
#else
sleep_ms(100);
#endif
// #ifdef AMT630HV100
// vTaskDelay(100);
// #else
// sleep_ms(100);
// #endif
UI_init();
}
}
@ -540,6 +826,12 @@ void* test_timer_queue(void *args){
#else
sleep_ms(20);
#endif
//立即保存flash
if(save_flag){
SaveDataToFlash(custom_data.user_data);
save_flag = 0;
}
//printf(".\r\n");
}
@ -585,10 +877,12 @@ ret_t application_init(void) {
// Set_sys_light_perception_value(30);
Set_sys_light(30);
//UI刷新线程
tk_thread_t *thread = NULL;
thread =tk_thread_create(test_timer_queue,NULL);
tk_thread_start(thread);
// //UI刷新线程
// tk_thread_t *thread = NULL;
// thread =tk_thread_create(test_timer_queue,NULL);
// tk_thread_start(thread);
widget_add_timer(window_manager(), ui_timer_refresh, 20);//进度条颜色刷新
char country[3];
char language[3];

View File

@ -99,7 +99,7 @@ int random(void)
#ifndef HAS_STD_MALLOC
#ifndef AWTK_HEAP_SIZE
#define AWTK_HEAP_SIZE (8 * 1024 * 1024)
#define AWTK_HEAP_SIZE (10 * 1024 * 1024)
#endif
static uint32_t s_heap_mem[AWTK_HEAP_SIZE/4];
#endif /*HAS_STD_MALLOC*/