Pārlūkot izejas kodu

T555_V03025
1、POC更新到V03014
2、添加电源键关机检测
3、添加耳机按PTT亮屏控制
4、修复待机界面CSQ刷新不为5秒一次问题
5、修复fota升级界面可能出现乱码字体问题
6、修复fota升级按确定可能出现长滴音问题
7、学习菜单内容支持上下翻动
8、修复学习任务(5个时)上移至顶出现"无数据问题"
9、修复学习任务完成与未完成图标显示不正确问题

wangjianlin 3 gadi atpakaļ
vecāks
revīzija
8d661b8ed4

+ 1 - 0
CMakeLists.txt

@@ -170,6 +170,7 @@ set(app_files ${app_dir}/ohpocapp.c
     ${app_dir}/Interface/ListBoxSMS.c
 	${app_dir}/Interface/NumEdit.c
 	${app_dir}/Interface/ManageMessage.c
+	${app_dir}/Interface/newMessage.c
     ${app_dir}/md5/mymd5.c
 	${learn_dir}/learnHttp.c
 	${learn_dir}/learnTask.c

BIN
Released/T555_V03025.rar


+ 13 - 1
Released/releasenote.txt

@@ -93,4 +93,16 @@ V03023
 
 V03024
 1、POC更新到03011
-2、修复因休眠可能导致POC的pt卡死问题
+2、修复因休眠可能导致POC的pt卡死问题
+
+V03025
+1、POC更新到V03014
+2、添加电源键关机检测
+3、添加耳机按PTT亮屏控制
+4、修复待机界面CSQ刷新不为5秒一次问题
+5、修复fota升级界面可能出现乱码字体问题
+6、修复fota升级按确定可能出现长滴音问题
+7、学习菜单内容支持上下翻动
+8、修复学习任务(5个时)上移至顶出现"无数据问题"
+9、修复学习任务完成与未完成图标显示不正确问题
+10、添加掉线亮屏动作

+ 190 - 0
app/Interface/newMessage.c

@@ -0,0 +1,190 @@
+
+#include "newMessage.h"
+#include "log.h"
+#define MAX_PAGES 20  //最多显示20页
+#define START_SHOW_Y (UI_CONTENT_SHOW_Y+3)  //开始显示的Y坐标
+#define END_SHOW_Y   (UI_BOTTOM_LINE_Y)     //显示结束的Y坐标
+#define START_SHOW_X 3
+#define MAX_ROW_NUM 5  //每页最多显示多少行
+typedef struct{
+	unsigned short SY;//开始显示的Y坐标
+	unsigned char font;//显示字体
+	unsigned char xlen;//根据font配置固定的单字x长度->显示中文时占的宽度
+	unsigned char ylen;//根据font配置固定的单字y高度
+	unsigned char validIndexNum;//有效页数目
+	unsigned short indexTable[MAX_PAGES];//一页最多显示5行,每行最多30字节,一页最多150字节
+	unsigned char showIndex;//当前显示表的索引
+	char *info;//显示的缓存
+}SUT_NEW_MESSAGE;
+
+SUT_NEW_MESSAGE sutNewMessage={
+	.info=NULL,
+};
+#define MAX_INFO_NUM 3
+char newMessageInit(FONT_MODEENUM fontMode,char *info1, char *info2, char *info3){
+	int i,len=0;
+	char *infos[MAX_INFO_NUM]={info1,info2,info3};
+	char spacesBuf[2]={0x0a,0x00};
+	unsigned char unNullNum=0;
+	char strcatAlready;
+	sutNewMessage.SY=START_SHOW_Y;				
+	sutNewMessage.font=fontMode;
+	if(fontMode==FONT_MODE_12X12){
+		sutNewMessage.ylen=12;
+		sutNewMessage.xlen=13;
+	}else{
+		sutNewMessage.ylen=16;
+		sutNewMessage.xlen=16;
+	}
+	//申请下显示的缓存
+	for(i=0;i<MAX_INFO_NUM;i++){
+		if(infos[i] != NULL){
+			len += strlen(infos[i]);
+			unNullNum++;
+		}
+	}
+
+	char *p=NULL;
+	if(sutNewMessage.info!=NULL){
+		free(sutNewMessage.info);
+		sutNewMessage.info=NULL;
+	}
+	if(len>0 && unNullNum){
+		len+=(unNullNum-1)+1;//申请多三个字节(unNullNum个0x0a和多一个空字节位置)
+		p=(char *)malloc(sizeof(char)*len);
+		if(p==NULL) return 1;
+		sutNewMessage.info=p;
+		sutNewMessage.info[0]=0;
+		strcatAlready=0;
+		for(i=0;i<MAX_INFO_NUM;i++){
+			if(infos[i] != NULL){
+				if(strcatAlready==0){
+					strcatAlready=1;
+					strcat(sutNewMessage.info, infos[i]);
+				}else{
+					strcat(sutNewMessage.info, spacesBuf);
+					strcat(sutNewMessage.info, infos[i]);
+				}
+			}
+		}
+	}else sutNewMessage.info=NULL;
+	newMessageShow(SHOW_INIT);
+	return 0;
+}
+
+void newMessageShow(SHOW_ENUM direction)
+{
+	//英文/12中文显示, 动态计算每行显示,尽可能每行显示多内容 遇到0x0a则换行显示
+	short leftDot;
+	char *ptr=sutNewMessage.info,ch;
+	unsigned char validWidthDot=GLCD_WIDTH-START_SHOW_X;//每行可显示的点数目
+	unsigned char num=0;
+	unsigned short showIndex,fillindex;
+	char showBuf[30];//一直最多显示30个字符,1个中文占两个字符
+	char nextLine=0;
+	unsigned char page=0;
+	unsigned char yHeight=sutNewMessage.ylen+4;//每行字上下间隔5
+	SHOW_ENUM thisDir=direction;
+	if(sutNewMessage.info[0]=='\0') return;
+	if(thisDir==SHOW_INIT){//计算出分段索引表
+		sutNewMessage.indexTable[num++]=0;
+		//然后一直往下做预显示得到分面索引表
+		leftDot=validWidthDot;
+		showIndex=0;
+		while(*ptr !=0){
+			ch=*ptr;
+			if(ch > 0x9f){//中文
+				if(leftDot>=sutNewMessage.xlen){//还可以显示
+					showIndex += 2;//移动源串索引
+					ptr += 2;//移动源串地址
+					leftDot -= sutNewMessage.xlen;//减去剩下可显示点数
+				}else{//不足够显示了
+					nextLine=1;
+				}
+			}else if(ch==0x0a){//换行符
+				showIndex ++;
+				ptr ++;
+				nextLine=1;
+			}else{//非中文
+				if(leftDot>=8){//还可以显示
+					showIndex ++;
+					ptr ++;
+					leftDot -= 8;
+				}else{//不足够显示了
+					nextLine=1;
+				}
+			}
+			if(nextLine!=0){
+				page++;
+				nextLine=0;
+				leftDot=validWidthDot;
+				if(((sutNewMessage.SY+(page+1)*yHeight) >= END_SHOW_Y) ||  //Y 已不够显示了(有可能还不够显示MAX_ROW_NUM行)
+				   (page>=MAX_ROW_NUM)){//显示完一页了
+					if(num < MAX_PAGES){
+						page=0;
+						sutNewMessage.indexTable[num++]=showIndex;
+					}
+				}
+			}
+		}
+		sutNewMessage.validIndexNum=num;
+		thisDir=SHOW_DOWN;
+		sutNewMessage.showIndex=0;
+	}else if(thisDir==SHOW_DOWN){
+		if(sutNewMessage.validIndexNum<=1) return;//只有一页的就不用再重显示了
+		if(++sutNewMessage.showIndex>=sutNewMessage.validIndexNum) sutNewMessage.showIndex=0;
+	}else if(thisDir==SHOW_UP){
+		if(sutNewMessage.validIndexNum<=1) return;//只有一页的就不用再重显示了
+		if(sutNewMessage.showIndex==0) sutNewMessage.showIndex=sutNewMessage.validIndexNum-1;
+		else sutNewMessage.showIndex--;
+	}else if(thisDir==SHOW_HEAD){//显示开头
+		sutNewMessage.showIndex=0;
+	}
+	guiClearRect(0,sutNewMessage.SY,GLCD_WIDTH-1,END_SHOW_Y-1,guiGetBackColor());
+	//下面按实际显示
+	leftDot=validWidthDot;
+	showIndex=sutNewMessage.indexTable[sutNewMessage.showIndex];//获取源串显示开始索引
+	page=0;
+	fillindex=0;
+	nextLine=0;
+	ptr=sutNewMessage.info+showIndex;
+	while(*ptr !=0){
+		ch=*ptr;
+		if(ch > 0x9f){//中文
+			if(leftDot>=sutNewMessage.xlen){//还可以显示
+				memcpy(showBuf+fillindex, ptr, 2);
+				fillindex += 2;//移动源串索引
+				ptr += 2;//移动源串地址
+				leftDot -= sutNewMessage.xlen;//减去剩下可显示点数
+			}else{//不足够显示了
+				nextLine=1;
+			}
+		}else if(ch==0x0a){//换行符
+				ptr ++;
+				nextLine=1;
+		}else{//非中文
+			if(leftDot>=8){//还可以显示
+				showBuf[fillindex++] = ch;
+				ptr ++;
+				leftDot -= 8;
+			}else{//不足够显示了
+				nextLine=1;
+			}
+		}
+		if(nextLine!=0){
+			nextLine=0;
+			if(fillindex<sizeof(showBuf)) showBuf[fillindex]=0;
+			fillindex=0;
+			guiShowStr(START_SHOW_X, sutNewMessage.SY+page++*yHeight, showBuf, sutNewMessage.font, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
+			leftDot=validWidthDot;
+			if(((sutNewMessage.SY+(page+1)*yHeight) >= END_SHOW_Y) ||  //Y 已不够显示了(有可能还不够显示MAX_ROW_NUM行)
+			   (page>=MAX_ROW_NUM)){//显示完一页了
+				return;
+			}
+		}
+	}
+	if(fillindex>0){
+		if(fillindex<sizeof(showBuf)) showBuf[fillindex]=0;
+		guiShowStr(START_SHOW_X, sutNewMessage.SY+page++*yHeight, showBuf, sutNewMessage.font, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
+	}
+}

+ 20 - 0
app/Interface/newMessage.h

@@ -0,0 +1,20 @@
+
+#ifndef __NEW_MESSAGE_H_
+#define __NEW_MESSAGE_H_
+#include "stdint.h"
+#include "gui.h"
+#include "uiEntry.h"
+
+#ifndef NULL
+	#define NULL 0
+#endif
+
+typedef enum{
+	SHOW_INIT,
+	SHOW_HEAD,
+	SHOW_DOWN,
+	SHOW_UP
+}SHOW_ENUM;
+char newMessageInit(FONT_MODEENUM fontMode,char *info1, char *info2, char *info3);
+void newMessageShow(SHOW_ENUM direction);
+#endif

+ 14 - 4
app/app.c

@@ -82,9 +82,19 @@ static void uiProcess(unsigned int exeInterval){
 	uiResponse(exeInterval);
 }
 /*触发关机操作*/
-static void pwrShutPro(void){
+static void pwrShutPro(unsigned int exeInterval){
 	static char shutFlag=0;
-
+	static int kcnt=0;
+	if(sutApp.pwrKeyStatus==0){//按下了
+		kcnt++;
+		appSleepCtl(ASLEEP_PWRKEY, 1);
+		if(kcnt==(2500/exeInterval)){
+			appSleepCtl(ASLEEP_PWR, 1);
+		}
+	}else{//放开了
+		kcnt=0;
+		appSleepCtl(ASLEEP_PWRKEY, 0);
+	}
 	if(getAppObjStatus(ASLEEP_PWR) == 0) return;
 	CTL_LCD_BL(1);
 	msgAtSend("AT+POC=050000\r\n");
@@ -119,7 +129,6 @@ void lcdReConfig(void){
 	if(sutApp.lcdReconfigCnt<=3) sutApp.lcdReconfigCnt++;
 	if(sutApp.lcdReconfigCnt==3) recoverLightColor();
 }
-
 static void paProCtl(void);
 /*主要应用程序入口*/
 void appRun(void){
@@ -203,7 +212,7 @@ void appRun(void){
 			MSG_WARN(1, "APP WAKEUP");
 		}
 		//检测是否关机,这里要放在唤醒后操作
-		pwrShutPro();
+		pwrShutPro(APP_SUB_DIV_TIME);
 	}
 }
 
@@ -374,6 +383,7 @@ void keyHandler(unsigned short key,unsigned char status){//
 		appSleepCtl(ASLEEP_KEY, 0);
 	}else{//key press
 		appSleepCtl(ASLEEP_KEY, 1);
+		backLightReset();
 		if(sutApp.keyLock!=0){
 			sutApp.lockShow=1;
 			return;

+ 3 - 0
app/app.h

@@ -19,6 +19,7 @@ typedef enum{
 	ASLEEP_GGROUP,//用于获取群组列表时不要休眠
 	ASLEEP_GUSER,//用于获取成员列表时不要休眠
 	ASLEEP_LEARN,//用于学习录音/播放时不要休眠使用
+	ASLEEP_PWRKEY,
 }ASLEEP_ENUM;
 #define VOICE_ITEM_NUM 3
 #pragma pack(push)
@@ -56,6 +57,7 @@ typedef struct{
 	unsigned char skipTTS:1;//不同时候禁止播放TTS
 	unsigned char earStatus:1;
 	unsigned char authReady:1;
+	unsigned char pwrKeyStatus:1;//开关机键状态
 	unsigned int appSleepStatus;//APP是否可以休眠
 	ACCOUNT_DEF account;
 	int g_iCSQ;
@@ -67,6 +69,7 @@ typedef struct{
 	unsigned char pcant;
 	unsigned char lcdReconfigCnt;
 	VOICE_DEF voiceInfo;
+	unsigned char fotaStatus;
 }APP_DEF;
 
 #pragma pack(pop)

+ 20 - 0
app/board.c

@@ -1,11 +1,31 @@
 
 #include "includes.h"
+#include "nwy_keypad.h"
 bool usb_log_status=false;
 static void gpiosInit(void);
 static void spiFlashInit(void);
 static void lcdsInit(void);
 
+/////////////////////////pin33关闭其关机功能,然后配置成IO检测
+static void _openkeypad(nwy_key_t key, nwy_keyState_t evt)
+{
+	if(key==12){
+		backLightReset();
+		tryWakeupApp();
+		if(evt == key_state_press){
+			sutApp.pwrKeyStatus=0;
+		}else{
+			sutApp.pwrKeyStatus=1;
+		}
+	}
+}
+static void pin33Init(void){
+	nwy_powerkey_poweroff_ctrl(0);//关闭PIN_33脚关机功能
+	reg_nwy_key_cb(_openkeypad);
+}
+//////////////////////////////////////////////////////////////////////
 void boardInit(void){
+	pin33Init();
 	logPortInit();//实际工程时按需打开
 	gpiosInit();
 	lcdsInit();

+ 1 - 0
app/includes.h

@@ -29,6 +29,7 @@
 #include "ManageMessage.h"
 #include "gpsCtl.h"
 #include "setSystemPara.h"
+#include "newMessage.h"
 
 #include "cJSON.h"
 #include "learnHttp.h"

+ 1 - 1
app/learn/learnHttp.c

@@ -98,7 +98,7 @@ static void learnEntry(void *param){
 	appSleepCtl(ASLEEP_LEARN, 1);
 	boolean http_https=false;//http
 	nwy_osiEvent_t event = {};
-	MSG_INFO(1,"learn thread start:url=%s",httpinfo.url);
+	//MSG_INFO(1,"learn thread start:url=%s",httpinfo.url);
 	
 	int result = nwy_http_setup(channel, httpinfo.url, httpinfo.port, nwy_http_result_cb);
 	if(0!=result){

+ 68 - 57
app/learn/learnTask.c

@@ -350,7 +350,7 @@ typedef struct{//
 	cJSON* jsonTask[PAGE_SIZE];//用于读取每个任务详情
 	char *bufTask[PAGE_SIZE];//用于读取每个任务文件使用的内存  
 	char showTable[PAGE_SIZE][SHOW_TABLE_MAX_BYTES];//用于菜单显示时使用
-	int finishedFlag[PAGE_SIZE];//完成状态
+	char finishedFlag[PAGE_SIZE];//完成状态
 }LEARN_SHOW_DEF;
 LEARN_SHOW_DEF sutJson={false};
 static void sutJsonInit(void){
@@ -379,8 +379,10 @@ static unsigned char learnGetNextPageInfo(LEARN_SHOW_DEF *learn){
 	}else if(learn->direction==2 && learn->lastDirection==1 && num<=PAGE_SIZE){//上次是向下,现在是向上
 		index -= learn->validNum;
 		if(index>0 && index<5) index=0;
-		else if(index<=0) index=num-num%PAGE_SIZE;
-		else index -= PAGE_SIZE;
+		else if(index<=0){
+			if(num==PAGE_SIZE) index=0;//如果与本页显示数目匹配,直接设置成0
+			else index=num-num%PAGE_SIZE;
+		}else index -= PAGE_SIZE;
 	}else if(learn->direction==0){
 		learn->direction=1;
 	}
@@ -453,11 +455,10 @@ static unsigned char learnGetNextPageInfo(LEARN_SHOW_DEF *learn){
 		learn->lastDirection=learn->direction;
 		return 0;
 }
-static void learnUIShowIndexAndTotal(void){
+
+static void learnUIShowIndexAndTotal(unsigned int index, unsigned int total){
 	char info[20];
-	int i,total,index;
-	total=sutJson.totalNum;
-	index=sutJson.selIndex+sutListBox.handle+1;
+	int i;
 	snprintf(info, sizeof(info), "%d/%d", index, total);
 	i=guiGetStrXLen(info,FONT_MODE_12X12);
 	guiClearRect(GLCD_WIDTH-8*8, UI_STATUS_ITEM_Y, GLCD_WIDTH-1, UI_STATUS_ITEM_Y+UI_STATUS_ITEM_HEIGH-1, guiGetForeColor());
@@ -482,7 +483,7 @@ void LearnTaskSelResponse(void){
 				uISetNextStatus(UIS_MENU_TASK_QUERY);
 				//里面的菜单如果不返回本菜单,直接退出此任务操作,需要释放资源LEARN_RELEASE_DB
 			}else if(MKEY_VALUE_UP || MKEY_VALUE_DOWN){
-				learnUIShowIndexAndTotal();
+				learnUIShowIndexAndTotal(sutJson.selIndex+sutListBox.handle+1,sutJson.totalNum);
 			}
 		}else if(MKEY_VALUE_ESC==key) learnUpdateStatus(LEARN_RELEASE_DB);
 	}
@@ -784,15 +785,15 @@ static void LearnTaskProcess(void){
 			else learnUpdateStatus(LEARN_SHOW_MENU);
 			break;
 		case LEARN_SHOW_MENU://显示
+			MSG_INFO(1, "Task valid num:%d", sutJson.validNum);
 			guiClearRect(0,(GLCD_HEIGHT/2)-20,GLCD_WIDTH-1,(GLCD_HEIGHT/2)+20,guiGetBackColor());//清除消息框
 			if(sutJson.validNum==0){
 				guiShowMessageBox("无数据");
 			}else{
 				for(i=0;i<sutJson.validNum;i++) menuTable[i]=&sutJson.showTable[i];
-				sutJson.showTable[sutJson.validNum][0]=0;
 				menuTable[sutJson.validNum]=learnIcon[2];
 				ListBoxInit(&sutListBox, menuTable,0,learnIcon, sutJson.finishedFlag);
-				learnUIShowIndexAndTotal();
+				learnUIShowIndexAndTotal(sutJson.selIndex+sutListBox.handle+1,sutJson.totalNum);
 			}
 			learnUpdateStatus(LEARN_WAIT_RESPONSE);
 			break;
@@ -1022,10 +1023,8 @@ static void learnSaveTaskFile(const char *fname, const char *msg){
 	MSG_INFO(1, "Save task %s", fname);
 }
 
-bool showFirstFlag;
 unsigned char haveNextPage;
 unsigned char taskIndex;
-unsigned short showIndex;//内容显示的索引
 char tidString[20];//保存正在查看的任务的tid串
 char *learnGetTid(void){return tidString;}
 /*
@@ -1049,45 +1048,30 @@ static void calWordNum(char *msg){
 	charaNum=num;
 	MSG_INFO(1, "Chara Num:%d", num);
 }
-void readTaskAndShow(void){
+void readTaskToShow(void){
+	char isDetailValid=0;
 	char info[50];
-	int y=UI_LOGIN_SHOW_Y;
 	static cJSON* eleScore ,* eleContent;
-	unsigned short len;
-	char *ptr;
-	
-	guiClearRect(0,y, GLCD_WIDTH-1, UI_BOTTOM_LINE_Y-1, guiGetBackColor());
-	if(showFirstFlag==true){
-		showFirstFlag=false;
-		showIndex=0;
-		//读取当前任务的uid保存起来先
-		tidString[0]=0;
-		eleScore=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_TID);
-		if(NULL != eleScore) snprintf(tidString, sizeof(tidString), "%s", eleScore->valuestring);
-		eleScore=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_SCORE);
-		eleContent=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_CONTENT);
-	}
-	if(showIndex==0){
-		//显示分数
-		if(NULL==eleScore){//没有找到分数字段,显示'--'
-			snprintf(info, sizeof(info), "分数:--");
-		}else if(eleScore->valuestring==NULL){
-			snprintf(info, sizeof(info), "分数:--");
-		}else snprintf(info, sizeof(info), "分数:%s", eleScore->valuestring);
-		guiShowStr(1, y+1, info, FONT_MODE_16X16,REVERSED_NO, COLOR_BLACK, guiGetBackColor());
-		y += 18;
+	//读取当前任务的uid保存起来先
+	tidString[0]=0;
+	eleScore=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_TID);
+	if(NULL != eleScore) snprintf(tidString, sizeof(tidString), "%s", eleScore->valuestring);
+	eleScore=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_SCORE);
+	eleContent=cJSON_GetObjectItem(sutJson.jsonTask[taskIndex], OBJECT_CONTENT);
+	//制造分数串
+	if(NULL==eleScore){//没有找到分数字段,显示'--'
+		snprintf(info, sizeof(info), "分数:--");
+	}else if(eleScore->valuestring==NULL){
+		snprintf(info, sizeof(info), "分数:--");
+	}else snprintf(info, sizeof(info), "分数:%s", eleScore->valuestring);
+	//内容
+	if(NULL!=eleContent && eleContent->valuestring!=NULL){
+		isDetailValid=1;
+		calWordNum(eleContent->valuestring);//计算单词个数
+	}
+	if(0!=newMessageInit(FONT_MODE_12X12, info, eleContent->valuestring, NULL)){
+		MSG_WARN(1, "learn task show get error");
 	}
-	
-	//显示内容
-	if(NULL==eleContent) return;
-	if(eleContent->valuestring==NULL) return;
-	//计算单词个数
-	calWordNum(eleContent->valuestring);
-	ptr=eleContent->valuestring;
-	MessageEditInit(&sutMEdit, 1, y , ptr, FONT_MODE_16X16);
-	len=MessageEditShow(&sutMEdit,ptr+showIndex);
-	if(len !=0) showIndex+=len;
-	else showIndex=0;
 }
 
 unsigned char recoderVolume=0;
@@ -1126,10 +1110,9 @@ void uiShowLearnTaskDetail(char update){
 		guiClearAll(guiGetBackColor());
 		guiShowCaption(0,"任务详情",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
 		uiMenuShowBottomLine();
-		showFirstFlag=true;
 		taskIndex=sutListBox.handle;
 		learnRecSetStatus(LEARN_REC_IDLE);
-		readTaskAndShow();
+		readTaskToShow();
 		learnShowStartScreen();
 		learnTick=0;
 	}
@@ -1187,7 +1170,7 @@ void uiShowLearnTaskDetail(char update){
 				//返回任务详情内容页面,录音临时信息及资源回收
 				learnRecordBufRelease();
 				learnShowStartScreen();
-				readTaskAndShow();
+				newMessageShow(SHOW_HEAD);
 				learnRecSetStatus(LEARN_REC_IDLE);
 			}
 			break;
@@ -1236,7 +1219,7 @@ void uiShowLearnTaskDetailResponse(void){
 			case LEARN_REC_DONE://刚录音完成,选择放弃而返回到任务详情
 				learnRecordBufRelease();
 				learnShowStartScreen();
-				readTaskAndShow();
+				newMessageShow(SHOW_HEAD);
 				learnRecSetStatus(LEARN_REC_IDLE);
 				break;
 			case LEARN_REC_PLY://停止正在播放的操作
@@ -1301,7 +1284,14 @@ void uiShowLearnTaskDetailResponse(void){
 		switch(learnRecordStatus){
 			case LEARN_REC_IDLE:
 			case LEARN_REC_BUSY:
-				readTaskAndShow();//显示任务其它内容
+				newMessageShow(SHOW_DOWN);
+				break;
+		}
+	}else if(MKEY_VALUE_UP==key){
+		switch(learnRecordStatus){
+			case LEARN_REC_IDLE:
+			case LEARN_REC_BUSY:
+				newMessageShow(SHOW_UP);
 				break;
 		}
 	}else if(MKEY_VALUE_P1==key){
@@ -1553,6 +1543,7 @@ static void classInfoDetailShow(unsigned char direction){
 		MSG_WARN(1, "class no data");
 		return;
 	}
+#if 0
 	char info[50];
 	int x=1,y=UI_CONTENT_SHOW_Y;
 	//显示week
@@ -1566,6 +1557,15 @@ static void classInfoDetailShow(unsigned char direction){
 	//显示subject
 	snprintf(info, sizeof(info), "subject:%s", classes.classResult[tIndex]->subject);
 	guiShowStr(x, y, info, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
+#else
+	char info1[50],info2[100];
+	//显示索引和总数
+	learnUIShowIndexAndTotal(tIndex+1,classes.item);
+	//显示内容
+	snprintf(info1, sizeof(info1), "week:%d%ctime:%s", classes.classResult[tIndex]->week,0x0a,classes.classResult[tIndex]->time);
+	snprintf(info2, sizeof(info2), "subject:%s", classes.classResult[tIndex]->subject);
+	newMessageInit(FONT_MODE_16X16,info1, info2, NULL);
+#endif
 }
 static void getClassShowMessage(void);
 /*课程表*/
@@ -1574,7 +1574,7 @@ void uiShowLearnClassDetail(char update){
 	static bool needGetUinfo=false;
 	if(update){
 		guiClearAll(guiGetBackColor());
-		guiShowCaption(0,"课程表",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
+		guiShowCaption(30,"课程表",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
 		uiMenuShowBottomLine();
 		uiMenuShowBottomIndacitor(NULL, "返回");
 		if(sutApp.pocPpp==0){
@@ -1676,6 +1676,7 @@ static void noticeInfoDetailShow(unsigned char direction){
 		MSG_WARN(1, "notice no data");
 		return;
 	}
+#if 0
 	char info[50];
 	int x=1,y=UI_CONTENT_SHOW_Y;
 	//显示title
@@ -1685,6 +1686,10 @@ static void noticeInfoDetailShow(unsigned char direction){
 	//显示time
 	snprintf(info, sizeof(info), "time:%s", notices.noticeResult[noticetIndex]->time);
 	guiShowStr(x, y, info, FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
+#else
+	learnUIShowIndexAndTotal(noticetIndex+1,notices.item);
+	newMessageInit(FONT_MODE_16X16, notices.noticeResult[noticetIndex]->time,notices.noticeResult[noticetIndex]->title, NULL);
+#endif
 }
 static void getNoticeShowMessage(void);
 /*消息通知*/
@@ -1693,7 +1698,7 @@ void uiShowLearnNoticeDetail(char update){
 	static bool needGetUinfo=false;
 	if(update){
 		guiClearAll(guiGetBackColor());
-		guiShowCaption(0,"消息通知",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
+		guiShowCaption(30,"消息通知",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
 		uiMenuShowBottomLine();
 		uiMenuShowBottomIndacitor("阅读", "返回");
 		if(sutApp.pocPpp==0){
@@ -1774,7 +1779,7 @@ void uiShowLearnNoticeDetailShow(char update){
 
 	if(update){
 		guiClearAll(guiGetBackColor());
-		guiShowCaption(0,notices.noticeResult[noticetIndex]->title,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
+		guiShowCaption(0,notices.noticeResult[noticetIndex]->time,UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
 		uiMenuShowBottomLine();
 		uiMenuShowBottomIndacitor(NULL, "返回");
 		if(sutApp.pocPpp==0){
@@ -1825,7 +1830,7 @@ void LearnNoticeDetailResponse(void){
 				uISetNextStatus(UIS_MENU_LOCATION_NOTICE);
 				break;
 			case MKEY_VALUE_DOWN:noticeInfoDetailShowContent(1);break;
-			//case MKEY_VALUE_UP:noticeInfoDetailShowContent(2);break;
+			case MKEY_VALUE_UP:noticeInfoDetailShowContent(2);break;
 		}
 	}
 }
@@ -2251,6 +2256,7 @@ static void getNoticeShowMessage(void){
 char *noticeDetailContent=NULL;
 //char *testShowData="这是一条测试信息,长度为100,然后呢就一直显示吧,我也不知道能显示多少,所以只能临时搞一段文字来显示看看效果如何了,然后再给100000000000元作者吧,作为酬劳,我也不知道是否足够呢。";
 void noticeInfoDetailShowContent(char direction){
+#if 0
 	int x=1,y=UI_CONTENT_SHOW_Y;
 	char *ptr=noticeDetailContent;
 	static int showlen,showIndex,len;
@@ -2263,6 +2269,11 @@ void noticeInfoDetailShowContent(char direction){
 	len=MessageEditShow(&sutMEdit,ptr+showIndex);
 	if(len !=0) showIndex+=len;
 	else showIndex=0;
+#else
+	if(direction==0) newMessageInit(FONT_MODE_16X16, noticeDetailContent, NULL, NULL);
+	else if(direction==1) newMessageShow(SHOW_DOWN);
+	else if(direction==2) newMessageShow(SHOW_UP);
+#endif
 }
 void cJSONTakeContent(char *msg, int len){
 	//msg={"id":"7","content":"通知测试2"}

+ 1 - 1
app/ohpoc.h

@@ -7,7 +7,7 @@
 #define OHPOC_APP_NAME "T555"
 //#define OHPOC_APP_NAME "RTL-TEST"
 
-#define OHPOC_VERSION "03024"  //外部OCPU 应用维护
+#define OHPOC_VERSION "03025"  //外部OCPU 应用维护
 #define OHPOC_MODLE	"N58" //作为OPEN时,此值用于FOTA升级标识使用
 #define OHPOC_CUST OHPOC_APP_NAME //作为OPEN时,此值用于FOTA升级标识使用
 

+ 8 - 17
app/poc.c

@@ -15,7 +15,7 @@ void pocProCtl(int dly){
 
 	if(++cnt<(5*1000/dly)) return;
 	cnt=0;
-	if(getAppObjStatus(ASLEEP_POC)==0) return;//POC休眠时,不发指令
+	if(getAppObjStatus(ASLEEP_LCD)==0) return;//POC休眠时,不发指令
 
 	if(sutApp.pocParaDone==0) msgAtSend("AT+POC=020000\r\n");//用于检测并设置POC参数
 	
@@ -232,6 +232,7 @@ static void pro82Msg(char *msg){
 	type=atoi(buf);
 	switch(type){
 		case 0:
+			if(sutPocStatus.logined) backLightReset();
 			sutPocStatus.logined=0;
 			if(0==memcmp(msg+10, "CEDECDF8C2E7C1ACBDD3",20)) sutPocStatus.PocLineOffReason=1;
 			else if(0==memcmp(msg+10, "CEDEB7A8C1ACBDD3",16)) sutPocStatus.PocLineOffReason=2;
@@ -571,26 +572,16 @@ static void proPwrMode(char *msg){
 msg=1,xxxx
 */
 static void proFotaMsg(char *msg){
-	char buf[50];
 	if(msg[1]==','){
-		if(msg[2]=='0' && msg[3]==0){
-			fotaMsgShow("无更新版本");
-			fotaStepSet(4);
-		}else{
+		if(msg[2]=='0' && msg[3]==0) sutApp.fotaStatus=1;
+		else{
 			strcpy(sutApp.fotaVersion, msg+2);
-			snprintf(buf, sizeof(buf), "是否更新到:%s",sutApp.fotaVersion);
-			fotaMsgShow(buf);
-			fotaStepSet(1);
+			sutApp.fotaStatus=2;
 		}
 	}else if(msg[1]==0){
-		if(msg[0]=='0'){
-			fotaMsgShow("升级失败");
-			fotaStepSet(4);
-		}else if(msg[0]=='1') fotaMsgShow("正在下载");
-		else if(msg[0]=='2'){
-			fotaMsgShow("下载成功");
-			fotaStepSet(3);
-		}
+		if(msg[0]=='0') sutApp.fotaStatus=3;
+		else if(msg[0]=='1') sutApp.fotaStatus=4;
+		else if(msg[0]=='2') sutApp.fotaStatus=5;
 	}
 }
 

+ 79 - 5
app/uiBlock.c

@@ -734,6 +734,9 @@ void uiShowMenuSysSetup(char flash){
 		"7,终端信息",
 		"8,SD卡检测",
 		"9,留音记录",
+#ifdef MENU_TEST
+		"10,测试",
+#endif
 		""
 	};
 	if(flash){
@@ -779,8 +782,17 @@ void sysTemSetResponse(void){
 			case 8://留音记录设置
 				uISetNextStatus(UIS_MENU_SYS_VOICE);
 				break;
+#ifdef MENU_TEST				
+			case 9://测试
+				uISetNextStatus(UIS_MENU_SYS_TEST);
+				break;
+		}
+		if(sutMenuSysSetup.handle<=9)
+#else
 		}
-		if(sutMenuSysSetup.handle<=8) uiPushStack(sutMenuSysSetup.handle);
+		if(sutMenuSysSetup.handle<=8)
+#endif
+		uiPushStack(sutMenuSysSetup.handle);
 	}else if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_MAIN);
 }
 /*****************************系统设置部分结束*********************************/
@@ -1413,9 +1425,6 @@ void uiShowServerSelResponse(void){
 /*****************************版本设置开始**********************************/
 unsigned char fotaStep;
 unsigned int fotaTick;
-void fotaStepSet(unsigned char newStep){
-	fotaStep=newStep;
-}
 void fotaMsgShow(char *msg){
 	int len=guiGetStrXLen((char *)msg,FONT_MODE_16X16);
 	guiClearRect(0, 60, GLCD_WIDTH-1, 60+16,guiGetBackColor());
@@ -1429,12 +1438,14 @@ void fotaMsgShow2(char *msg1, char *msg2){
 	guiShowStr((GLCD_WIDTH-len)/2,45+16+2, msg2,FONT_MODE_16X16, REVERSED_NO, COLOR_BLACK, guiGetBackColor());
 }
 void uiShowVersionSel(char StatusUpdate){
+	char buf[50];
 	if(StatusUpdate){
 		sutApp.fotaVersion[0]=0;
 		guiClearAll(guiGetBackColor());
 		guiShowCaption(0,"版本更新",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
 		msgAtSend("AT+FOTA?\r\n");
 		fotaStep=0;
+		sutApp.fotaStatus=0;
 		fotaMsgShow("正在检测版本");
 		uiMenuShowBottomLine();
 		uiMenuShowBottomIndacitor("确定", "返回");
@@ -1442,6 +1453,16 @@ void uiShowVersionSel(char StatusUpdate){
 	}
 	switch(fotaStep){
 		case 0:
+			if(sutApp.fotaStatus==1){
+				fotaMsgShow("无更新版本");
+				fotaStep=4;
+				break;
+			}else if(sutApp.fotaStatus==2){
+				snprintf(buf, sizeof(buf), "是否更新到:%s",sutApp.fotaVersion);
+				fotaMsgShow(buf);
+				fotaStep=1;
+				break;
+			}
 			if(uTimerExpired(&fotaTick)){
 				fotaMsgShow("检测超时");
 				fotaStep=4;
@@ -1450,6 +1471,19 @@ void uiShowVersionSel(char StatusUpdate){
 		case 1://等待用户确定
 			break;
 		case 2://用户确定后等待结果
+			if(sutApp.fotaStatus==3){
+				fotaMsgShow("升级失败");
+				fotaStep=4;
+				break;
+			}else if(sutApp.fotaStatus==4){
+				sutApp.fotaStatus=0;//否则会一直刷新本消息
+				fotaMsgShow("正在下载");
+				break;
+			}else if(sutApp.fotaStatus==5){
+				fotaMsgShow("下载成功");
+				fotaStep=3;
+				break;
+			}
 			if(uTimerExpired(&fotaTick)){
 				fotaMsgShow("超时退出");
 				fotaStep=4;
@@ -1483,6 +1517,7 @@ void uiShowVersionSelResponse(void){
 			msgAtSend("AT+FOTA=1\r\n");
 			uTimerStart(&fotaTick, 10000);
 		}else if(fotaStep==6){
+			paControl(false);//防止一直滴音
 			if(nwy_version_update(true)<0){
 				MSG_ERR(1, "nwy_version_update failed");
 				fotaMsgShow("升级异常");
@@ -1560,4 +1595,43 @@ void uiShowPassword(char StatusUpdate){
 void uiShowPasswordResponse(void){
 	unsigned short key=getKeyValue();
 	if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
-}
+}
+
+#ifdef MENU_TEST
+///////////////////////////////////测试
+#define INFO1 "2021/05/17 16:16"
+#define INFO2 "*我们都是中华人民共和国的子民。全球最大的中文搜索引擎、致力于让网民更便捷地获取信息,找到所求。百度超过千亿的中文网页数据库,可以瞬间找到相关的搜索结果,测试一二三四五六七八九十ABCDEFGHIJKLMNOPQRSTUVWXYZtest测试1234567890 abcdefghijklmnopqrstuvwxyz!"
+#define INFO3 "end"
+#include "newMessage.h"
+int tflag=0;
+void uiTest(char StatusUpdate){
+	char ret;
+	if(StatusUpdate){
+		guiClearAll(guiGetBackColor());
+		guiShowCaption(0,"测试",UI_STATUS_ITEM_Y+1,guiGetBackColor(),guiGetForeColor(),FONT_MODE_12X12);
+		uiMenuShowBottomLine();
+		uiMenuShowBottomIndacitor(NULL, "返回");
+		switch(tflag){
+			case 0:ret=newMessageInit(FONT_MODE_12X12, NULL, NULL, INFO3);break;
+			case 1:ret=newMessageInit(FONT_MODE_12X12, NULL, INFO2, NULL);break;
+			case 2:ret=newMessageInit(FONT_MODE_12X12, NULL, INFO2, INFO3);break;
+			case 3:ret=newMessageInit(FONT_MODE_12X12, INFO1, NULL, NULL);break;
+			case 4:ret=newMessageInit(FONT_MODE_12X12, INFO1, NULL, INFO3);break;
+			case 5:ret=newMessageInit(FONT_MODE_12X12, INFO1, INFO2, NULL);break;
+			case 6:ret=newMessageInit(FONT_MODE_12X12, INFO1, INFO2, INFO3);break;
+		}
+		if(0!=ret){
+			guiShowMessageBox("异常");
+			uISetNextStatus(UIS_MENU_SYS_SEL);
+		}else{
+			if(++tflag>6) tflag=0;
+		}
+	}
+}
+void uiTestResponse(void){
+	unsigned short key=getKeyValue();
+	if(MKEY_VALUE_ESC==key) uISetNextStatus(UIS_MENU_SYS_SEL);
+	else if(MKEY_VALUE_DOWN==key) newMessageShow(SHOW_DOWN);
+	else if(MKEY_VALUE_UP==key) newMessageShow(SHOW_UP);
+}
+#endif

+ 10 - 1
app/uiEntry.c

@@ -146,6 +146,11 @@ void uiLoop(unsigned int exeInterval){
 		case UIS_MENU_SYS_PASS:
 			uiShowPassword(StatusUpdate);
 			break;
+#ifdef MENU_TEST
+		case UIS_MENU_SYS_TEST:
+			uiTest(StatusUpdate);
+			break;
+#endif
 			
 		/****************1.1.1(学习任务)任务查看*/
 		case UIS_MENU_TASK_QUERY:
@@ -299,7 +304,11 @@ void uiResponse(unsigned int exeInterval){
 		case UIS_MENU_SYS_PASS:
 			uiShowPasswordResponse();
 			break;
-			
+#ifdef MENU_TEST			
+		case UIS_MENU_SYS_TEST:
+			uiTestResponse();
+			break;
+#endif			
 		/****************1.1.1(学习任务)任务查看*/
 		case UIS_MENU_TASK_QUERY:
 			uiShowLearnTaskDetailResponse();

+ 3 - 0
app/uiEntry.h

@@ -45,6 +45,9 @@ typedef enum{
 	UIS_MENU_LOCATION_CLASS,//¿Î³Ì±í
 	UIS_MENU_LOCATION_NOTICE,//ÏûϢ֪ͨ
 	UIS_MENU_LOCATION_NOTICE_DETAIL,//֪ͨÏêÇé
+#ifdef MENU_TEST	
+	UIS_MENU_SYS_TEST
+#endif
 }UIS_ENUM;
 
 #pragma pack(push)

BIN
lib/libohpoc.a