Просмотр исходного кода

T555_V03029
1、修复学习任务录音提交菜单与学习任务快捷键冲突问题
2、添加关机键功能:主界面短按切换背光状态,非主界面短按返回主界面

wangjianlin 3 лет назад
Родитель
Сommit
e957a67be5
7 измененных файлов с 157 добавлено и 16 удалено
  1. BIN
      Released/T555_V03029.rar
  2. 5 1
      Released/releasenote.txt
  3. 58 10
      app/app.c
  4. 1 1
      app/board.c
  5. 87 3
      app/learn/learnTask.c
  6. 1 1
      app/ohpoc.h
  7. 5 0
      app/uiBlock.c

BIN
Released/T555_V03029.rar


+ 5 - 1
Released/releasenote.txt

@@ -127,4 +127,8 @@ V03028
 1、修复学习任务已录音但未提交,返回后再点重听可能死机问题
 2、对讲组改为授课组
 3、修复音量为0时,对讲还能听到滴声
-4、修复TM模式下不能关机问题
+4、修复TM模式下不能关机问题
+
+V03029
+1、修复学习任务录音提交菜单与学习任务快捷键冲突问题
+2、添加关机键功能:主界面短按切换背光状态,非主界面短按返回主界面

+ 58 - 10
app/app.c

@@ -82,17 +82,45 @@ static void uiProcess(unsigned int exeInterval){
 	uiResponse(exeInterval);
 }
 static void pwrKeyDetect(unsigned int exeInterval){
-	static int kcnt=0;
+	static char pressed=0;
+	static int kcnt=0,cnt=0;
 	if(sutApp.pwrKeyStatus==0){//按下了
-		kcnt++;
 		appSleepCtl(ASLEEP_PWRKEY, 1);
-		if(kcnt==(2500/exeInterval)){
-			if(sutApp.activePwrShut==0){
-				sutApp.activePwrShut=1;
-				uISetNextStatus(UIS_MENU_SHUT_UI);
+		if(pressed==0){
+			kcnt=1;
+			pressed=1;
+			cnt=0;
+		}
+		if(++cnt>=(1000/exeInterval)){
+			cnt=0;
+			if(++kcnt>=3){
+				backLightReset();
+				if(sutApp.activePwrShut==0){
+					sutApp.activePwrShut=1;
+					uISetNextStatus(UIS_MENU_SHUT_UI);
+				}
 			}
 		}
 	}else{//放开了
+		if(kcnt==1){//短按
+			keyToneStart();
+			switch(sutUIstatus.Status){
+				case UIS_STANDBY:switchBackLight();break;//切换背光
+				case UIS_MENU_TASK_SEL:taskSelBackToStandby(false);break;
+				case UIS_MENU_TASK_QUERY:taskBackToStandby();break;
+				case UIS_MENU_RANK_SEL:rankSelBackToStandby();break;
+				case UIS_MENU_RANK_DETAIL:rankBackToStandby();break;
+				case UIS_MENU_CLASS_SEL:
+				case UIS_MENU_STUDENT_SEL:
+					GUBackToStandby();break;
+				case UIS_MENU_LOCATION_CLASS:classBackToStandby();break;
+				case UIS_MENU_LOCATION_NOTICE:noticeBackToStandby();break;
+				case UIS_MENU_LOCATION_NOTICE_DETAIL:noticeDetailBackToStandby();break;
+				case UIS_MENU_SHUT_UI:break;
+				default:uISetNextStatus(UIS_STANDBY);break;
+			}
+		}
+		pressed=0;
 		kcnt=0;
 		if(sutApp.activePwrShut==0) appSleepCtl(ASLEEP_PWRKEY, 0);
 	}
@@ -668,7 +696,19 @@ void mKeyHandler(unsigned char keyCtl){
 				pttHandler(0,0);
 				break;
 			case MKEY_VALUE_P1:showKeyMsg("P1",keyCtl);
-				if(lockCnt==1) quickUiSwitch(UIS_MENU_TASK_SEL);
+				if(lockCnt==1){
+					switch(sutUIstatus.Status){
+						case UIS_MENU_TASK_SEL:
+						case UIS_MENU_RANK_SEL:
+						case UIS_MENU_TASK_QUERY:
+						case UIS_MENU_RANK_DETAIL:
+						case UIS_MENU_LOCATION_CLASS:
+						case UIS_MENU_LOCATION_NOTICE:
+						case UIS_MENU_LOCATION_NOTICE_DETAIL:
+							break;
+						default:quickUiSwitch(UIS_MENU_TASK_SEL);
+					}
+				}
 				lockCnt=0;
 				break;
 			case MKEY_VALUE_P2:showKeyMsg("P2",keyCtl);
@@ -837,15 +877,16 @@ void tryWakeupApp(void){
 	}                                                                                                                       
 }
 
+bool backlightstatus=true;
 /*背光时间到,熄灭*/
 void backLightCb(void *param){
 	if(sutApp.gtMode!=0){
-		CTL_LCD_BL(1);
+		CTL_LCD_BL(1);backlightstatus=true;
 		return;
 	}
 	if(sutPocStatus.firstLogin==0) return;//未登录过,不灭屏
 	if(newPara.lcdParaList[newPara.lcdParaDefaultIndex]==0) return;//常亮
-	CTL_LCD_BL(0);
+	CTL_LCD_BL(0);backlightstatus=false;
 	appSleepCtl(ASLEEP_LCD, 0);//可以休眠
 }
 /*点亮背光*/
@@ -853,9 +894,16 @@ void backLightReset(void){
 	unsigned short tmp;
 	appSleepCtl(ASLEEP_LCD, 1);//不让休眠
 	tmp=newPara.lcdParaList[newPara.lcdParaDefaultIndex];
-	CTL_LCD_BL(1);
+	CTL_LCD_BL(1);backlightstatus=true;
 	startBackLightTimer(tmp*1000);
 }
+void switchBackLight(void){
+	if(backlightstatus==true){
+		if(newPara.lcdParaList[newPara.lcdParaDefaultIndex]==0) return;//常亮
+		CTL_LCD_BL(0);backlightstatus=false;
+		appSleepCtl(ASLEEP_LCD, 0);//可以休眠
+	}else backLightReset();
+}
 void sysPwrLock(void){
 	sutApp.pwrLock=1;
 }

+ 1 - 1
app/board.c

@@ -10,7 +10,7 @@ static void lcdsInit(void);
 static void _openkeypad(nwy_key_t key, nwy_keyState_t evt)
 {
 	if(key==12){
-		backLightReset();
+		if(sutUIstatus.Status!=UIS_STANDBY) backLightReset();//主界面后面会处理点亮操作
 		tryWakeupApp();
 		if(evt == key_state_press){
 			sutApp.pwrKeyStatus=0;

+ 87 - 3
app/learn/learnTask.c

@@ -492,10 +492,13 @@ void LearnTaskSelResponse(void){
 		}else if(MKEY_VALUE_ESC==key) learnUpdateStatus(LEARN_RELEASE_DB);
 	}
 }
+//为了给电源键直接返回主界面,此两变量设置全局
+static char *simpleList=NULL;
+static char *simpleListTmp=NULL;
 static void LearnTaskProcess(void){
 	unsigned char ret;
-	static char *simpleList=NULL;
-	static char *simpleListTmp=NULL;
+//	static char *simpleList=NULL;
+//	static char *simpleListTmp=NULL;
 	static cJSON* json=NULL,*item;
 	cJSON* element,*subEle;
 	static cJSON* jsonTmp=NULL,*itemTmp;
@@ -827,7 +830,24 @@ static void LearnTaskProcess(void){
 			break;
 	}
 }
-
+/*学习任务选择菜单时按了电源键返回主菜单*/
+void taskSelBackToStandby(bool status){
+	int i;
+	if(LEARN_WAIT_RESPONSE==getLearnStatus() || status==true){
+		MSG_INFO(1, "Release DB For pwr to standby");
+		releaseBuf(&simpleList);
+		releaseBuf(&simpleListTmp);
+		releaseBuf(&sutJson.bufList);
+		releaseJson(&sutJson.jsonList);
+		for(i=0;i<PAGE_SIZE;i++){
+			releaseBuf(&sutJson.bufTask[i]);
+			releaseJson(&sutJson.jsonTask[i]);
+		}
+		sdUnmount();
+		uISetNextStatus(UIS_STANDBY);
+		needUpdate=1;
+	}
+}
 ////////////////////////http 获取文件数据处理///////////////////////
 //#define USE_TEST_TASK  //使用自己定义的任务
 static void cJSONSaveTaskFile(const char *jsonMsg);
@@ -1108,6 +1128,34 @@ static void learnRecordDoneProcess(void);
 static void learnDetailBackToTaskListMenu(void){
 	uISetNextStatus(UIS_MENU_TASK_SEL);//返回上层菜单
 }
+
+/*学习任务直接返回待机界面操作*/
+void taskBackToStandby(void){
+	bool needtoreleased=false;
+	bool needtofreeed=false;
+	switch(learnRecordStatus){
+		case LEARN_REC_IDLE:
+		case LEARN_REC_DONE:
+		case LEARN_UPLOAD_CONFIRM:
+			needtofreeed=true;
+			needtoreleased=true;
+			break;
+		case LEARN_REC_PLY:
+			learnStopPlaying();
+			needtofreeed=true;
+			needtoreleased=true;
+			break;
+		case LEARN_REC_BUSY:
+			learnRecordFree();
+			learnStopRecord();
+			needtofreeed=true;
+			needtoreleased=true;
+			break;
+		default:break;//其它状态不能动
+	}
+	if(true==needtofreeed) learnRecordBufRelease();
+	if(true==needtoreleased) taskSelBackToStandby(true);
+}
 /*任务查看*/
 void uiShowLearnTaskDetail(char update){
 	unsigned char ret;
@@ -1537,6 +1585,15 @@ void LearnRankDetailSelResponse(void){
 	}
 }
 
+void rankSelBackToStandby(void){
+	sdUnmount();
+	uISetNextStatus(UIS_STANDBY);
+}
+void rankBackToStandby(void){
+	learnRankReleaseDB();
+	rankSelBackToStandby();
+}
+
 typedef struct{
 	int week;
 	char time[15];
@@ -1676,6 +1733,12 @@ void LearnClassDetailResponse(void){
 		}
 	}
 }
+void classBackToStandby(void){
+	if(classShowReady==false) return;
+	learnClassReleaseDB();
+	sdUnmount();
+	uISetNextStatus(UIS_STANDBY);
+}
 
 typedef struct{
 	int id;
@@ -1810,6 +1873,16 @@ void LearnNoticeResponse(void){
 		}
 	}
 }
+
+void noticeBackToStandby(void){
+	if(noticeShowReady==false) return;
+	noticeShowReady=false;
+	learnNoticeReleaseDB();
+	learnClassReleaseDB();
+	sdUnmount();
+	uISetNextStatus(UIS_STANDBY);
+}
+
 bool noticeDetailReady=false;
 /*消息通知详情*/
 void uiShowLearnNoticeDetailShow(char update){
@@ -1873,6 +1946,17 @@ void LearnNoticeDetailResponse(void){
 	}
 }
 
+void noticeDetailBackToStandby(void){
+	if(noticeDetailReady==false) return;
+	noticeShowReady=false;
+	noticeDetailReady=false;
+	learnNoticeReleaseDB();
+	learnClassReleaseDB();
+	sdUnmount();
+	uISetNextStatus(UIS_STANDBY);
+}
+
+
 #define OBJECT_AVG_NAME 	"avg"
 #define OBJECT_SCORE_NAME 	"score"
 #define OBJECT_RANKING_NAME "ranking"

+ 1 - 1
app/ohpoc.h

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

+ 5 - 0
app/uiBlock.c

@@ -589,6 +589,11 @@ void uiShowGUSel(char StatusUpdate,unsigned int exeInterval,char type){
 	
 	UserAssistAdd();
 }
+
+void GUBackToStandby(void){
+	if(isUiSwitchReady()==false) return;
+	uISetNextStatus(UIS_STANDBY);
+}
 void GroupSelResponse(){
 	unsigned int key;
 	char buf[50];