Module_LcmControl.c 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352
  1. #include <stdio.h> /*標準輸入輸出定義*/
  2. #include <stdlib.h> /*標準函數庫定義*/
  3. #include <stdint.h>
  4. #include <string.h>
  5. #include <unistd.h>
  6. #include <termios.h>
  7. #include <fcntl.h>
  8. #include <time.h>
  9. #include <sys/ioctl.h>
  10. #include <sys/timeb.h>
  11. #include "Module_LcmControl.h"
  12. #include "../Log/log.h"
  13. #include "../ShareMemory/shmMem.h"
  14. #include "../Define/define.h"
  15. #include "../Config.h"
  16. #include "../SelectGun/SelectGun.h"
  17. #define uSEC_VAL (1000000)
  18. //------------------------------------------------------------------------------
  19. //struct SysConfigAndInfo *ShmSysConfigAndInfo;
  20. //struct StatusCodeData *ShmStatusCodeData;
  21. static struct SysConfigData *pSysConfig = NULL;
  22. static struct SysInfoData *pSysInfo = NULL;
  23. static struct WARNING_CODE_INFO *pSysWarning = NULL;
  24. static struct FanModuleData *ShmFanModuleData;
  25. static struct PrimaryMcuData *ShmPrimaryMcuData;
  26. static SelectGunInfo *ShmSelectGunInfo = NULL;
  27. static struct ChargingInfoData *pDcChargingInfo = NULL;
  28. static DcCommonInfo *ShmDcCommonData = NULL;
  29. short _currentPage = _LCM_NONE;
  30. uint8_t _totalCount;
  31. uint8_t _showInformIndex = 0;
  32. float ChargeMaxPower_0 = 0;
  33. float ChargeMaxPower_1 = 0;
  34. int _port;
  35. //char* pPortName = "/dev/ttyO2";
  36. char *pPortName = "/dev/ttyS3";
  37. char *moduleName = "DMT80480T070_09WT";
  38. bool is_show = false;
  39. uint8_t _everyPageRollChange;
  40. //==========================================
  41. // Open and Close RS232 and R/W
  42. //==========================================
  43. unsigned long GetClockTimeoutValue(struct timespec _start_time)
  44. {
  45. struct timespec ts_end;
  46. unsigned long ret = 0;
  47. clock_gettime(CLOCK_MONOTONIC, &ts_end);
  48. ret = ((unsigned long)(ts_end.tv_sec - _start_time.tv_sec) * 1000000) + ((unsigned long)((ts_end.tv_nsec / 1000) - (_start_time.tv_nsec/ 1000)));
  49. return ret;
  50. }
  51. int CreateCommunicationLcmPort()
  52. {
  53. int fd;
  54. struct termios tios;
  55. fd = open(pPortName, O_RDWR);
  56. if (fd <= 0) {
  57. log_error("open /dev/ttyS3 NG ");
  58. return -1;
  59. }
  60. ioctl(fd, TCGETS, &tios);
  61. tios.c_cflag = B115200 | CS8 | CLOCAL | CREAD;
  62. tios.c_lflag = 0;
  63. tios.c_iflag = 0;
  64. tios.c_oflag = 0;
  65. tios.c_cc[VMIN] = 0;
  66. tios.c_cc[VTIME] = (uint8_t) 5;
  67. tios.c_lflag = 0;
  68. tcflush(fd, TCIFLUSH);
  69. ioctl(fd, TCSETS, &tios);
  70. return fd;
  71. }
  72. void CloseCommunicationLcmPort()
  73. {
  74. close(_port);
  75. }
  76. void WriteCmdToLcm(uint8_t *cmd, uint8_t cmdLen)
  77. {
  78. int len = write(_port, cmd, cmdLen);
  79. if (len < sizeof(cmd)) {
  80. log_error("Write cmd to LCM Failure. ");
  81. }
  82. }
  83. void ReadMsgFromLcm(uint8_t *msg, uint8_t readLen)
  84. {
  85. read(_port, msg, readLen);
  86. if (*msg == CMD_TITLE_1 && *(msg + 1) == CMD_TITLE_2) {
  87. if (*(msg + 3) == CMD_WRITE) {
  88. switch (*(msg + 4)) {
  89. case CMD_REGISTER: {
  90. // 頁面
  91. strcpy((char *)pSysInfo->LcmHwRev, moduleName);
  92. _currentPage = *(msg + 7);
  93. }
  94. break;
  95. }
  96. } else if (*(msg + 3) == CMD_MULTI_READ) {
  97. // switch ((unsigned short) (*(msg + 4) << 8) + (unsigned short) *(msg + 5))
  98. // {
  99. // case BUTTON_GUN_INDEX:
  100. // {
  101. // // 當前選的槍號
  102. // _curGunIndex = (*(msg + 8));
  103. // }
  104. // break;
  105. // }
  106. }
  107. }
  108. }
  109. void GetHrFormTimeString(char* time,char* hr)
  110. {
  111. //char tm[] = "2021-12-06 17:29:08:084";
  112. int _temp_hr;
  113. for(int i = 0 ; i < 2 ; i++) {
  114. hr[i] = time[i+11];
  115. }
  116. if ((atoi(hr) + 8) > 23) {
  117. _temp_hr = atoi(hr) + 8 - 24;
  118. sprintf(hr, "%02d", _temp_hr);
  119. } else if( atoi(hr) == NULL ) {
  120. strcmp(hr,"");
  121. }
  122. }
  123. void GetMinFormTimeString(char* time,char* min)
  124. {
  125. //char tm[] = "2021-12-06 17:29:08:084";
  126. for(int i = 0 ; i < 2 ; i++) {
  127. min[i] = time[i+14];
  128. }
  129. if( atoi(min) == NULL || atoi(min) > 60) {
  130. strcmp(min,"");
  131. }
  132. }
  133. //================================================
  134. // Function
  135. //================================================
  136. void ChangeToOtherPage(short newPage)
  137. {
  138. uint8_t cmd[7];
  139. memset(cmd, 0x00, sizeof(cmd));
  140. cmd[0] = CMD_TITLE_1;
  141. cmd[1] = CMD_TITLE_2;
  142. cmd[2] = 0x02 + sizeof(newPage);
  143. cmd[3] = CMD_READ;
  144. cmd[4] = CMD_REGISTER;
  145. cmd[5] = newPage >> 8;
  146. cmd[6] = newPage & 0x00FF;
  147. WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
  148. usleep(100000);
  149. }
  150. void ChangeBackLight(bool islight)
  151. {
  152. uint8_t value = 0x01;
  153. if (islight) {
  154. value = 0x20;
  155. }
  156. uint8_t cmd[7];
  157. memset(cmd, 0x00, sizeof(cmd));
  158. cmd[0] = CMD_TITLE_1;
  159. cmd[1] = CMD_TITLE_2;
  160. cmd[2] = 0x03;
  161. cmd[3] = CMD_READ;
  162. cmd[4] = CMD_BACKLIGHT;
  163. cmd[5] = value;
  164. WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
  165. usleep(100000);
  166. }
  167. void GetCurrentPage()
  168. {
  169. uint8_t cmd[6];
  170. memset(cmd, 0x00, sizeof(cmd));
  171. uint8_t msg[8];
  172. memset(msg, 0x00, sizeof(msg));
  173. cmd[0] = CMD_TITLE_1;
  174. cmd[1] = CMD_TITLE_2;
  175. cmd[2] = 0x03; // 底下總長度
  176. cmd[3] = CMD_WRITE;
  177. cmd[4] = CMD_REGISTER;
  178. cmd[5] = 0x02;
  179. WriteCmdToLcm(cmd, ARRAY_SIZE(cmd));
  180. usleep(5000);
  181. ReadMsgFromLcm(msg, ARRAY_SIZE(msg));
  182. }
  183. void DisplayValueToLcm(short address, uint8_t *data, uint8_t len)
  184. {
  185. uint8_t cmd[256];
  186. memset(cmd, 0x00, sizeof(cmd));
  187. cmd[0] = CMD_TITLE_1;
  188. cmd[1] = CMD_TITLE_2;
  189. cmd[2] = 0x03 + len;
  190. cmd[3] = CMD_MULTI_WRITE;
  191. cmd[4] = address >> 8;
  192. cmd[5] = address & 0x00FF;
  193. for (uint8_t count = 0; count < len; count++) {
  194. cmd[6 + count] = *(data + count);
  195. }
  196. WriteCmdToLcm(cmd, cmd[2] + 3);
  197. }
  198. void ChangeDisplay2Value(short address, short value)
  199. {
  200. uint8_t data[2];
  201. data[0] = value >> 8;
  202. data[1] = value & 0x00FF;
  203. //log_info("Addr:0x%x, value:%d",address,value);
  204. DisplayValueToLcm(address, data, sizeof(data));
  205. }
  206. //================================================
  207. // Warning process
  208. //================================================
  209. void string2ByteArray(uint8_t *input, uint8_t *output)
  210. {
  211. int loop;
  212. int i;
  213. loop = 0;
  214. i = 0;
  215. while (input[loop] != '\0') {
  216. output[i++] = input[loop++];
  217. }
  218. output[loop] = '\0';
  219. }
  220. void RefreshProgressAnimation(uint8_t progress_index)
  221. {
  222. if(_everyPageRollChange % 2) {
  223. progress_index+=1;
  224. }
  225. ChangeDisplay2Value(_ProgressBar_LEVEL,progress_index);
  226. _everyPageRollChange++;
  227. }
  228. //================================================
  229. // Change current page
  230. //================================================
  231. void ChangeCurPage()
  232. {
  233. //log_info("cur = %d ,system = %d, lcm = %d ",_currentPage, pSysInfo->SystemPage, pSysInfo->PageIndex);
  234. struct ChargingInfoData *pDcChargingInfo_0 = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
  235. struct ChargingInfoData *pDcChargingInfo_1 = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
  236. switch (pSysInfo->SystemPage) {
  237. case _LCM_VIEW:
  238. if (pDcChargingInfo_0->SystemStatus == S_IDLE && pDcChargingInfo_1->SystemStatus == S_IDLE ) {
  239. pSysInfo->PageIndex = __VIEW_ALL_IDLE_;
  240. } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus != S_CHARGING) {
  241. pSysInfo->PageIndex = __VIEW_LEFT_CHARGE_;
  242. } else if(pDcChargingInfo_0->SystemStatus != S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
  243. pSysInfo->PageIndex = __VIEW_RIGHT_CHARGE_;
  244. } else if(pDcChargingInfo_0->SystemStatus == S_CHARGING && pDcChargingInfo_1->SystemStatus == S_CHARGING) {
  245. pSysInfo->PageIndex = __VIEW_ALL_CHARGE_;
  246. }
  247. break;
  248. case _LCM_START_SCAN:
  249. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  250. pSysInfo->PageIndex = __START_SCAN_LEFT;
  251. else
  252. pSysInfo->PageIndex = __START_SCAN_RIGHT;
  253. break;
  254. case _LCM_START_AUTHORIZING:
  255. pSysInfo->PageIndex = __START_AUTHORIZE_;
  256. break;
  257. case _LCM_START_AUTHORIZE_FAIL:
  258. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  259. pSysInfo->PageIndex = __START_AUTHORIZE_FAIL_LEFT;
  260. else
  261. pSysInfo->PageIndex = __START_AUTHORIZE_FAIL_RIGHT;
  262. break;
  263. case _LCM_WAIT_PLUGIN:
  264. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  265. pSysInfo->PageIndex = __WAIT_PLUGIN_;
  266. else
  267. pSysInfo->PageIndex = __WAIT_PLUGIN_RIGHT;
  268. break;
  269. case _LCM_PRECHARGE:
  270. pSysInfo->PageIndex =__PRE_CHARGE_;
  271. break;
  272. case _LCM_LINK_ERROR:
  273. if(pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  274. pSysInfo->PageIndex = __LINKING_ERROR_LEFT;
  275. else
  276. pSysInfo->PageIndex = __LINKING_ERROR_RIGHT;
  277. break;
  278. case _LCM_DETAIL_VIEW:
  279. pSysInfo->PageIndex =__DETAIL_VIEW_;
  280. break;
  281. case _LCM_STOP_RFID:
  282. pSysInfo->PageIndex =__STOP_SCAN_RFID_;
  283. break;
  284. case _LCM_STOP_APP:
  285. pSysInfo->PageIndex =__STOP_SCAN_APP_;
  286. break;
  287. case _LCM_STOP_RFID_FAIL:
  288. pSysInfo->PageIndex =__STOP_RFID_FAIL_;
  289. break;
  290. case _LCM_STOPPING:
  291. pSysInfo->PageIndex =__STOP_AUTHORIZE_;
  292. break;
  293. case _LCM_WAIT_PLUGOUT:
  294. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  295. pSysInfo->PageIndex = __WAIT_PLUGOUT_LEFT;
  296. else
  297. pSysInfo->PageIndex = __WAIT_PLUGOUT_RIGHT;
  298. break;
  299. case _LCM_SUMMARY:
  300. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  301. pSysInfo->PageIndex = __SUMMARY_LEFT;
  302. else
  303. pSysInfo->PageIndex = __SUMMARY_RIGHT;
  304. break;
  305. case _LCM_MAINTAIN:
  306. pSysInfo->PageIndex =__MAINTAIN_PAGE_;
  307. break;
  308. case _LCM_ERROR:
  309. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM)
  310. pSysInfo->PageIndex = __ERROR_PAGE_LEFT;
  311. else
  312. pSysInfo->PageIndex = __ERROR_PAGE_RIGHT;
  313. break;
  314. case _LCM_EMERGENCY:
  315. pSysInfo->PageIndex =__EMERGENCY_BUTTON_;
  316. break;
  317. case _LCM_CONFIRM_STOP:
  318. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  319. pSysInfo->PageIndex = __CONFIRM_STOP_LEFT;
  320. } else
  321. pSysInfo->PageIndex = __CONFIRM_STOP_RIGHT;
  322. break;
  323. case _LCM_COMMUNICATION:
  324. pSysInfo->PageIndex = __COMMUNICATION_PROCESS;
  325. break;
  326. case _LCM_CHARGING_DETECT:
  327. pSysInfo->PageIndex = __GFD_PROCESS;
  328. break;
  329. case _LCM_PREPARECHARE:
  330. pSysInfo->PageIndex = __PRECHARGE_PROCESS;
  331. break;
  332. }
  333. if (_currentPage != pSysInfo->PageIndex) {
  334. _currentPage = pSysInfo->PageIndex;
  335. ChangeToOtherPage(pSysInfo->PageIndex);
  336. }
  337. }
  338. /*
  339. * View Page
  340. *
  341. */
  342. void ShowViewChargingSoc(uint8_t gunIndex,int soc)
  343. {
  344. uint8_t digits = soc % 10;
  345. uint8_t tens = (soc / 10) %10;
  346. uint8_t hundreds = soc / 100;
  347. if (gunIndex == LEFT_GUN_NUM) {
  348. ChangeDisplay2Value(_LeftGun_Soc_Digits,(short)_ICON_Red_Num_0+digits);
  349. ChangeDisplay2Value(_LeftGun_Soc_Tens,(short)_ICON_Red_Num_0+tens);
  350. if (hundreds == 0 ) {
  351. ChangeDisplay2Value(_LeftGun_Soc_Hundreds,(short)_ICON_Empty);
  352. if (tens == 0 )
  353. ChangeDisplay2Value(_LeftGun_Soc_Tens,(short)_ICON_Empty);
  354. }
  355. else
  356. ChangeDisplay2Value(_LeftGun_Soc_Hundreds,(short)_ICON_Red_Num_1);
  357. } else {
  358. //log_info("%d %d %d",hundreds,tens,digits);
  359. ChangeDisplay2Value(_RightGun_Soc_Digits,(short)_ICON_Red_Num_0+digits);
  360. ChangeDisplay2Value(_RightGun_Soc_Tens,(short)_ICON_Red_Num_0+tens);
  361. if (hundreds == 0 ) {
  362. ChangeDisplay2Value(_RightGun_Soc_Hundreds,(short)_ICON_Empty);
  363. if (tens == 0)
  364. ChangeDisplay2Value(_RightGun_Soc_Tens,(short)_ICON_Empty);
  365. }
  366. else
  367. ChangeDisplay2Value(_RightGun_Soc_Hundreds,(short)_ICON_Red_Num_1);
  368. }
  369. }
  370. void ShowViewChargingTime(uint8_t gunIndex,int time)
  371. {
  372. uint8_t value[10] = {0};
  373. int min,sec;
  374. min = time/60;
  375. sec = time % 60;
  376. sprintf((char *)value,"%d:%02d",min,sec);
  377. if (gunIndex == LEFT_GUN_NUM) {
  378. DisplayValueToLcm(_LeftGun_info_time, (uint8_t *)value, sizeof(value));
  379. } else
  380. DisplayValueToLcm(_RightGun_info_time, (uint8_t *)value, sizeof(value));
  381. }
  382. void ShowViewChargingEngery(uint8_t gunIndex, float energy)
  383. {
  384. uint8_t value[10] = { 0 };
  385. if(energy < 100)
  386. sprintf((char*)value, "%.1f", energy);
  387. else
  388. sprintf((char*)value, "%d", (int)energy);
  389. //log_info("gun[%d] energy:%.1f", gunIndex, energy);
  390. if (gunIndex == LEFT_GUN_NUM) {
  391. DisplayValueToLcm(_LeftGun_info_cap, (uint8_t*)value, sizeof(value));
  392. }
  393. else
  394. DisplayValueToLcm(_RightGun_info_cap, (uint8_t*)value, sizeof(value));
  395. }
  396. void ShowViewCharingMoney(uint8_t gunIndex,float money)
  397. {
  398. uint8_t value[10] = {0};
  399. sprintf((char *)value,"%d",(int)money);
  400. //log_info("gun[%d] money:%.1f", gunIndex, money);
  401. if (gunIndex == LEFT_GUN_NUM) {
  402. DisplayValueToLcm(_LeftGun_info_money, (uint8_t *)value, sizeof(value));
  403. } else
  404. DisplayValueToLcm(_RightGun_info_money, (uint8_t *)value, sizeof(value));
  405. }
  406. void ShowViewChargingPower(uint8_t gunIndex,float power)
  407. {
  408. uint8_t value[10] = {0};
  409. float _data = power * 10;
  410. sprintf((char *)value,"%.1f",power);
  411. //log_info("gun[%d] power:%.1f",gunIndex,power);
  412. if (power >= 0 && power <= POWER_MAX_KW) {
  413. if (gunIndex == LEFT_GUN_NUM) {
  414. ChangeDisplay2Value(_LeftGun_info_power_number, _data);
  415. //DisplayValueToLcm(_LeftGun_info_power_number, (uint8_t *)value, sizeof(value));
  416. } else {
  417. //DisplayValueToLcm(_RightGun_info_power_number, (uint8_t*)value, sizeof(value));
  418. ChangeDisplay2Value(_RightGun_info_power_number, _data);
  419. }
  420. }
  421. }
  422. void ShowConnectId()
  423. {
  424. if (ShmDcCommonData->ConnectorId[0] <= 2) {
  425. ChangeDisplay2Value(_LeftGun_ConnectorId, _ICON_CONNECTOR_1);
  426. ChangeDisplay2Value(_RightGun_ConnectorId, _ICON_CONNECTOR_1);
  427. } else {
  428. ChangeDisplay2Value(_LeftGun_ConnectorId, _ICON_CONNECTOR_2);
  429. ChangeDisplay2Value(_RightGun_ConnectorId, _ICON_CONNECTOR_2);
  430. }
  431. }
  432. void ShowViewLeftGunInfo()
  433. {
  434. char value[5];
  435. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
  436. if (pDcChargingInfo->SystemStatus == S_IDLE ) {
  437. switch (pDcChargingInfo->CCSGunType) {
  438. case _TYPE_CCS1_Liquid:
  439. case _TYPE_CCS1_Natural:
  440. ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS1_GUN_U);
  441. ChangeDisplay2Value(_LeftGun_type_pic_L,_ICON_CCS1_GUN_L);
  442. ChangeDisplay2Value(_LeftGun_type_name,_ICON_CCS1_Name);
  443. if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid) {
  444. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_High_Speed);
  445. } else {
  446. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_Speed);
  447. }
  448. break;
  449. case _TYPE_CCS2_Liquid:
  450. case _TYPE_CCS2_Natural:
  451. ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS2_GUN_U);
  452. ChangeDisplay2Value(_LeftGun_type_pic_L,_ICON_CCS2_GUN_L);
  453. ChangeDisplay2Value(_LeftGun_type_name,_ICON_CCS2_Name);
  454. if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid) {
  455. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_High_Speed);
  456. } else {
  457. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_Speed);
  458. }
  459. break;
  460. default:
  461. log_error("CCS Gun Type Error! Not Show in LCM!!");
  462. }
  463. memset(value, 0x00, sizeof(value));
  464. sprintf((char *)value,"1 A");
  465. DisplayValueToLcm(_LeftGun_location, (uint8_t *)value, sizeof(value));
  466. } else if (pDcChargingInfo->SystemStatus == S_CHARGING ) {
  467. ShowViewChargingSoc(LEFT_GUN_NUM,pDcChargingInfo->EvBatterySoc);
  468. ShowViewChargingTime(LEFT_GUN_NUM,pDcChargingInfo->PresentChargedDuration);
  469. ShowViewCharingMoney(LEFT_GUN_NUM,pDcChargingInfo->ChargingFee);
  470. ShowViewChargingPower(LEFT_GUN_NUM,pDcChargingInfo->PresentChargingPower);
  471. ShowViewChargingEngery(LEFT_GUN_NUM, pDcChargingInfo->PresentChargedEnergy);
  472. switch (pDcChargingInfo->CCSGunType) {
  473. case _TYPE_CCS1_Liquid:
  474. case _TYPE_CCS1_Natural:
  475. ChangeDisplay2Value(_LeftGun_type_name, _ICON_CCS1_Name);
  476. break;
  477. case _TYPE_CCS2_Liquid:
  478. case _TYPE_CCS2_Natural:
  479. ChangeDisplay2Value(_LeftGun_type_name, _ICON_CCS2_Name);
  480. break;
  481. }
  482. }
  483. }
  484. void ShowViewRightGunInfo()
  485. {
  486. char value[5];
  487. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
  488. if (pDcChargingInfo->SystemStatus == S_IDLE ) {
  489. switch (pDcChargingInfo->CCSGunType) {
  490. case _TYPE_CCS1_Liquid:
  491. case _TYPE_CCS1_Natural:
  492. ChangeDisplay2Value(_RightGun_type_pic_U,_ICON_CCS1_GUN_U);
  493. ChangeDisplay2Value(_RightGun_type_pic_L,_ICON_CCS1_GUN_L);
  494. ChangeDisplay2Value(_RightGun_type_name,_ICON_CCS1_Name);
  495. if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid) {
  496. ChangeDisplay2Value(_RightGun_type_speed,_ICON_High_Speed);
  497. } else {
  498. ChangeDisplay2Value(_RightGun_type_speed,_ICON_Speed);
  499. }
  500. break;
  501. case _TYPE_CCS2_Liquid:
  502. case _TYPE_CCS2_Natural:
  503. ChangeDisplay2Value(_RightGun_type_pic_U,_ICON_CCS2_GUN_U);
  504. ChangeDisplay2Value(_RightGun_type_pic_L,_ICON_CCS2_GUN_L);
  505. ChangeDisplay2Value(_RightGun_type_name,_ICON_CCS2_Name);
  506. if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid) {
  507. ChangeDisplay2Value(_RightGun_type_speed,_ICON_High_Speed);
  508. } else {
  509. ChangeDisplay2Value(_RightGun_type_speed,_ICON_Speed);
  510. }
  511. break;
  512. default:
  513. log_error("CCS Gun Type Error! Not Show in LCM!!");
  514. }
  515. memset(value, 0x00, sizeof(value));
  516. sprintf((char *)value,"1 B");
  517. DisplayValueToLcm(_RightGun_location, (uint8_t *)value, sizeof(value));
  518. } else if (pDcChargingInfo->SystemStatus == S_CHARGING ) {
  519. ShowViewChargingSoc(RIGHT_GUN_NUM,pDcChargingInfo->EvBatterySoc);
  520. ShowViewChargingTime(RIGHT_GUN_NUM,pDcChargingInfo->PresentChargedDuration);
  521. ShowViewCharingMoney(RIGHT_GUN_NUM,pDcChargingInfo->ChargingFee);
  522. ShowViewChargingPower(RIGHT_GUN_NUM,pDcChargingInfo->PresentChargingPower);
  523. ShowViewChargingEngery(RIGHT_GUN_NUM, pDcChargingInfo->PresentChargedEnergy);
  524. switch (pDcChargingInfo->CCSGunType) {
  525. case _TYPE_CCS1_Liquid:
  526. case _TYPE_CCS1_Natural:
  527. ChangeDisplay2Value(_RightGun_type_name, _ICON_CCS1_Name);
  528. break;
  529. case _TYPE_CCS2_Liquid:
  530. case _TYPE_CCS2_Natural:
  531. ChangeDisplay2Value(_RightGun_type_name, _ICON_CCS2_Name);
  532. break;
  533. }
  534. }
  535. }
  536. void SetViewPage()
  537. {
  538. // Set Background pic.
  539. if (pSysConfig->TotalConnectorCount == 1) {
  540. } else if (pSysConfig->TotalConnectorCount == 2) {
  541. ShowConnectId();
  542. ShowViewLeftGunInfo();
  543. ShowViewRightGunInfo();
  544. }
  545. }
  546. void ShowSelectGunIcon()
  547. {
  548. uint8_t value[5] = {0};
  549. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  550. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  551. if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
  552. pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
  553. ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_CCS1_Symbol);
  554. } else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
  555. pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
  556. ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_CCS2_Symbol);
  557. }
  558. ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_Empty);
  559. sprintf((char *)value,"%s",LEFT_GUN_LOCAL_NAME);
  560. DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
  561. memset(value, 0x00, sizeof(value));
  562. DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
  563. } else if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  564. if (pDcChargingInfo->CCSGunType == _TYPE_CCS1_Liquid ||
  565. pDcChargingInfo->CCSGunType == _TYPE_CCS1_Natural) {
  566. ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_CCS1_Symbol);
  567. } else if (pDcChargingInfo->CCSGunType == _TYPE_CCS2_Liquid ||
  568. pDcChargingInfo->CCSGunType == _TYPE_CCS2_Natural) {
  569. ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_CCS2_Symbol);
  570. }
  571. ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_Empty);
  572. sprintf((char *)value,"%s",RIGHT_GUN_LOCAL_NAME);
  573. DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
  574. memset(value, 0x00, sizeof(value));
  575. DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
  576. }
  577. }
  578. /*
  579. * Detail View Page
  580. */
  581. void SetDetailViewPage()
  582. {
  583. uint8_t data;
  584. float float_data;
  585. uint8_t value[10] = {0};
  586. ShowSelectGunIcon();
  587. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  588. if (pDcChargingInfo->SystemStatus != S_CHARGING) {
  589. SetViewPage();
  590. return;
  591. }
  592. log_info("PowerConsumption:%.1f",pDcChargingInfo->PowerConsumption);
  593. uint8_t digits = pDcChargingInfo->EvBatterySoc % 10;
  594. uint8_t tens = (pDcChargingInfo->EvBatterySoc / 10) %10;
  595. uint8_t hundreds = pDcChargingInfo->EvBatterySoc / 100;
  596. // Show Numbers.
  597. ChangeDisplay2Value(_Percent_Number_Digits,_ICON_White_Num_0+digits);
  598. ChangeDisplay2Value(_Percent_Number_Tens,_ICON_White_Num_0+tens);
  599. if (hundreds == 0 ) {
  600. ChangeDisplay2Value(_Percent_Number_Hundreds,_ICON_Empty);
  601. if (tens == 0)
  602. ChangeDisplay2Value(_Percent_Number_Tens,_ICON_Empty);
  603. } else {
  604. ChangeDisplay2Value(_Percent_Number_Hundreds,_ICON_White_Num_1);
  605. }
  606. // Show Progress Bar
  607. if (hundreds) {
  608. ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_100);
  609. }
  610. else {
  611. // 0 ~ 19 % show in progress bar 10%
  612. if (pDcChargingInfo->EvBatterySoc < 10) {
  613. if (_everyPageRollChange % 3 == 0)
  614. ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_10);
  615. else if (_everyPageRollChange % 3 == 1)
  616. ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_12);
  617. else
  618. ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_14);
  619. }
  620. else {
  621. ChangeDisplay2Value(_ProgressBar_LEVEL, _ICON_BTY_10 + (tens * 10) + (_everyPageRollChange % 5) * 2);
  622. }
  623. /*
  624. if (tens == 1)
  625. tens = 0;
  626. if (_everyPageRollChange%2 == 0)
  627. ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+tens*2);
  628. else
  629. ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+tens*2+1);
  630. */
  631. _everyPageRollChange++;
  632. }
  633. // Show Power
  634. if (pDcChargingInfo->PresentChargingPower >= 0 &&
  635. pDcChargingInfo->PresentChargingPower <= POWER_MAX_KW) {
  636. float_data = pDcChargingInfo->PresentChargingPower;
  637. } else {
  638. float_data = 0;
  639. }
  640. sprintf((char *)value,"%.1f",float_data);
  641. DisplayValueToLcm(_Detail_Power_Num,value, sizeof(value));
  642. // Show Time
  643. data = (pDcChargingInfo->PresentChargedDuration)/60;
  644. sprintf((char *)value,"%d",data);
  645. DisplayValueToLcm(_Detail_Time_Num,value, sizeof(value));
  646. // Show Energy
  647. if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
  648. pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
  649. float_data = pDcChargingInfo->PresentChargedEnergy;
  650. } else
  651. float_data = 0;
  652. sprintf((char *)value,"%.1f",float_data);
  653. log_info("Energy:%s",value);
  654. DisplayValueToLcm(_Detail_Cap_Num,value, sizeof(value));
  655. // Show Money
  656. //data = pDcChargingInfo->ChargingFee;
  657. sprintf((char *)value,"%.1f",pDcChargingInfo->ChargingFee);
  658. DisplayValueToLcm(_Detail_Money_Num,value, sizeof(value));
  659. }
  660. void ShowCountDownTimer()
  661. {
  662. int min,sec;
  663. uint8_t value[10] = {0};
  664. int tm = 120 - (GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL);
  665. // GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL
  666. min = tm/60;
  667. sec = tm%60;
  668. sprintf((char *)value,"%02d:%02d",min,sec);
  669. if (pSysInfo->SystemPage == _LCM_SUMMARY) {
  670. sprintf((char*)value, "");
  671. DisplayValueToLcm(_Count_Down_Time, (uint8_t*)value, sizeof(value));
  672. }
  673. else
  674. DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
  675. }
  676. unsigned long GetTimeoutValue(struct timeval _sour_time)
  677. {
  678. struct timeval _end_time;
  679. gettimeofday(&_end_time, NULL);
  680. return 1000000 * (_end_time.tv_sec - _sour_time.tv_sec) + _end_time.tv_usec - _sour_time.tv_usec;
  681. }
  682. void ShowGunCountDownTimer()
  683. {
  684. int min,sec;
  685. uint8_t value[10] = {0};
  686. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  687. int tm = 30 - (GetTimeoutValue(pDcChargingInfo->TimeoutTimer) / uSEC_VAL);
  688. // GetClockTimeoutValue(pSysInfo->SystemTimeoutTimer) / uSEC_VAL
  689. min = tm/60;
  690. sec = tm%60;
  691. sprintf((char *)value,"%02d:%02d",min,sec);
  692. DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
  693. }
  694. void ClearQrCode()
  695. {
  696. char cmd[200];
  697. memset(cmd, 0, 200);
  698. DisplayValueToLcm(_QR_CODE_AUTHORIZE, cmd, 200);
  699. }
  700. void ChangeQrCode()
  701. {
  702. char cmd[250];
  703. pDcChargingInfo = (struct ChargingInfoData*)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  704. // https://nhoatcc.lineapid.tw/web/tologin?sn=ABC123&cid=2
  705. memset(cmd, '\0', 256);
  706. int len = sprintf(cmd, "https://nhoatcc.lineapid.tw/web/tologin?sn=%s&cid=%d", pSysConfig->SystemId, ShmDcCommonData->ConnectorId[pSysInfo->CurGunSelected]);
  707. DisplayValueToLcm(_QR_CODE_AUTHORIZE, cmd, len + 1);
  708. }
  709. void ShowProgressBar()
  710. {
  711. /*
  712. for(int i = 0 ; i <= 19 ; i++) {
  713. ChangeDisplay2Value(_ProgressBar_LEVEL,_ICON_ProgressBar_10+i);
  714. usleep(100000);
  715. }*/
  716. }
  717. void ShowSummaryPage()
  718. {
  719. float data;
  720. uint8_t value[10] = {0};
  721. char start_hr[3],start_min[3],end_hr[3],end_min[3];
  722. int t_hr;
  723. pDcChargingInfo = (struct ChargingInfoData *)GetDcChargingInfoData(pSysInfo->CurGunSelected);
  724. // Show Money
  725. data = pDcChargingInfo->ChargingFee;
  726. sprintf((char *)value,"%.1f",data);
  727. int discount,settlement = 0;
  728. //DisplayValueToLcm(_Summary_total_money, (uint8_t *)value, sizeof(value));
  729. //DisplayValueToLcm(_Summary_cal_Total_money, (uint8_t *)value, sizeof(value));
  730. ChangeDisplay2Value(_Summary_total_money, (int)pDcChargingInfo->ChargingFee);
  731. ChangeDisplay2Value(_Summary_cal_Total_money, (int)pDcChargingInfo->ChargingFee);
  732. /*
  733. log_info("start time:%s",pDcChargingInfo->StartDateTime);
  734. log_info("stop time:%s",pDcChargingInfo->StopDateTime);*/
  735. GetHrFormTimeString(pDcChargingInfo->StartDateTime,start_hr);
  736. GetMinFormTimeString(pDcChargingInfo->StartDateTime,start_min);
  737. GetHrFormTimeString(pDcChargingInfo->StopDateTime,end_hr);
  738. GetMinFormTimeString(pDcChargingInfo->StopDateTime,end_min);
  739. t_hr = atoi(start_hr) + (ShmDcCommonData->TzOffset / 60);
  740. if (t_hr >= 24)
  741. t_hr -= 24;
  742. ChangeDisplay2Value(_Summary_Start_time_hr, t_hr);
  743. ChangeDisplay2Value(_Summary_Start_time_min, atoi(start_min));
  744. t_hr = atoi(end_hr) + (ShmDcCommonData->TzOffset / 60);
  745. if (t_hr >= 24)
  746. t_hr -= 24;
  747. ChangeDisplay2Value(_Summary_end_time_hr, t_hr);
  748. ChangeDisplay2Value(_Summary_end_time_min, atoi(end_min));
  749. /*
  750. DisplayValueToLcm(_Summary_Start_time_hr, (uint8_t *)start_hr, sizeof(start_hr));
  751. DisplayValueToLcm(_Summary_Start_time_min, (uint8_t *)start_min, sizeof(start_min));
  752. DisplayValueToLcm(_Summary_end_time_hr, (uint8_t *)end_hr, sizeof(end_hr));
  753. DisplayValueToLcm(_Summary_end_time_min, (uint8_t *)end_min, sizeof(end_min));
  754. */
  755. uint8_t _min = (pDcChargingInfo->PresentChargedDuration)/60;
  756. uint8_t _sec = (pDcChargingInfo->PresentChargedDuration) % 60;
  757. /*
  758. sprintf((char *)value,"%d",min);
  759. DisplayValueToLcm(_Summary_duration_time, (uint8_t *)value, sizeof(value));
  760. */
  761. ChangeDisplay2Value(_Summary_duration_min, (int)_min);
  762. ChangeDisplay2Value(_Summary_duration_sec, (int)_sec);
  763. if (pDcChargingInfo->PresentChargedEnergy >= 0.1 &&
  764. pDcChargingInfo->PresentChargedEnergy <= ENERGY_MAX_KWH) {
  765. data = pDcChargingInfo->PresentChargedEnergy*10;
  766. } else
  767. data = 0;
  768. //sprintf((char *)value,"%.1f",data);
  769. ChangeDisplay2Value(_Summary_cap, data);
  770. //DisplayValueToLcm(_Summary_cap, (uint8_t *)value, sizeof(value));
  771. discount = ShmSelectGunInfo->PricesInfo[pSysInfo->CurGunSelected].Discount;
  772. sprintf((char *)value,"%.1f", discount);
  773. DisplayValueToLcm(_Summary_cal_discount, (uint8_t *)value, sizeof(value));
  774. settlement = pDcChargingInfo->ChargingFee - discount;
  775. sprintf((char *)value,"%.1f",settlement);
  776. DisplayValueToLcm(_Summary_cal_Settlement, (char *)value, sizeof(value));
  777. /*
  778. if(pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  779. sprintf((char *)value,"%.1f",ChargeMaxPower_0);
  780. } else if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  781. sprintf((char *)value,"%.1f",ChargeMaxPower_1);
  782. }
  783. DisplayValueToLcm(_Summary_max_power, (uint8_t *)value, sizeof(value));
  784. */
  785. if (pSysInfo->CurGunSelected == LEFT_GUN_NUM) {
  786. ChangeDisplay2Value(_Summary_max_power, (int)ChargeMaxPower_0);
  787. }
  788. else if (pSysInfo->CurGunSelected == RIGHT_GUN_NUM) {
  789. ChangeDisplay2Value(_Summary_max_power, (int)ChargeMaxPower_1);
  790. }
  791. if (pDcChargingInfo->PowerConsumption >= 0.1 ) {
  792. data = pDcChargingInfo->PowerConsumption / pDcChargingInfo->PresentChargedDuration;
  793. } else
  794. data = 0;
  795. //sprintf((char *)value,"%.1f",data);
  796. ChangeDisplay2Value(_Summary_average_power, (int)data);
  797. //DisplayValueToLcm(_Summary_average_power, (uint8_t *)value, sizeof(value));
  798. }
  799. void ProcessPageInfo()
  800. {
  801. if (pSysWarning->Level == WARN_LV_ER) {
  802. pSysInfo->SystemPage = _LCM_MAINTAIN;
  803. if (ShmPrimaryMcuData->InputDet.bits.EmergencyButton)
  804. pSysInfo->SystemPage = _LCM_EMERGENCY;
  805. return;;
  806. }
  807. switch (pSysInfo->SystemPage) {
  808. case _LCM_VIEW:
  809. // Confirm Charging Gun Number.
  810. SetViewPage();
  811. break;
  812. case _LCM_DETAIL_VIEW:
  813. ShowGunCountDownTimer();
  814. SetDetailViewPage();
  815. break;
  816. case _LCM_START_SCAN:
  817. ChangeQrCode();
  818. case _LCM_STOP_RFID:
  819. case _LCM_STOP_APP:
  820. ShowSelectGunIcon();
  821. ShowCountDownTimer();
  822. break;
  823. case _LCM_START_AUTHORIZING:
  824. case _LCM_PRECHARGE:
  825. case _LCM_STOPPING:
  826. //ShowProgressBar();
  827. ChangeDisplay2Value(_Animation_Running, 1);
  828. break;
  829. case _LCM_START_AUTHORIZE_FAIL:
  830. case _LCM_STOP_RFID_FAIL:
  831. case _LCM_LINK_ERROR:
  832. ShowCountDownTimer();
  833. break;
  834. case _LCM_SUMMARY:
  835. ShowCountDownTimer();
  836. ShowSummaryPage();
  837. break;
  838. case _LCM_ERROR:
  839. break;
  840. case _LCM_MAINTAIN:
  841. break;
  842. case _LCM_WAIT_PLUGIN:
  843. case _LCM_WAIT_PLUGOUT:
  844. ShowSelectGunIcon();
  845. break;
  846. case _LCM_EMERGENCY:
  847. break;
  848. case _LCM_COMMUNICATION:
  849. ChangeDisplay2Value(_Animation_Communcation, 1);
  850. break;
  851. case _LCM_CHARGING_DETECT:
  852. ChangeDisplay2Value(_Animation_GFD, 1);
  853. break;
  854. case _LCM_PREPARECHARE:
  855. ChangeDisplay2Value(_Animation_Precharge, 1);
  856. break;
  857. }
  858. }
  859. void DemoFunction()
  860. {
  861. int i;
  862. uint8_t value[10];
  863. struct timeb SeqEndTime;
  864. struct tm *tm;
  865. switch (pSysInfo->PageIndex) {
  866. case __VIEW_ALL_IDLE_:
  867. memset(value, 0x00, sizeof(value));
  868. sprintf((char *)value,"1 A");
  869. DisplayValueToLcm(_LeftGun_location, (uint8_t *)value, sizeof(value));
  870. sprintf((char *)value,"1 B");
  871. DisplayValueToLcm(_RightGun_location, (uint8_t *)value, sizeof(value));
  872. sleep(1);
  873. ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS2_GUN_U);
  874. ChangeDisplay2Value(_LeftGun_type_pic_L,_ICON_CCS2_GUN_L);
  875. ChangeDisplay2Value(_LeftGun_type_name,_ICON_CCS2_Name);
  876. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_High_Speed);
  877. ChangeDisplay2Value(_RightGun_type_pic_U,_ICON_CCS2_GUN_U);
  878. ChangeDisplay2Value(_RightGun_type_pic_L,_ICON_CCS2_GUN_L);
  879. ChangeDisplay2Value(_RightGun_type_name,_ICON_CCS2_Name);
  880. ChangeDisplay2Value(_RightGun_type_speed,_ICON_High_Speed);
  881. sleep(1);
  882. ChangeDisplay2Value(_LeftGun_type_pic_U,_ICON_CCS1_GUN_U);
  883. ChangeDisplay2Value(_LeftGun_type_pic_L,_ICON_CCS1_GUN_L);
  884. ChangeDisplay2Value(_LeftGun_type_name,_ICON_CCS1_Name);
  885. ChangeDisplay2Value(_LeftGun_type_speed,_ICON_Speed);
  886. ChangeDisplay2Value(_RightGun_type_pic_U,_ICON_CCS1_GUN_U);
  887. ChangeDisplay2Value(_RightGun_type_pic_L,_ICON_CCS1_GUN_L);
  888. ChangeDisplay2Value(_RightGun_type_name,_ICON_CCS1_Name);
  889. ChangeDisplay2Value(_RightGun_type_speed,_ICON_Speed);
  890. break;
  891. case __VIEW_LEFT_CHARGE_:
  892. for(i=0;i<=100;i++) {
  893. ShowViewChargingSoc(LEFT_GUN_NUM,i);
  894. ShowViewChargingTime(LEFT_GUN_NUM,i);
  895. ShowViewCharingMoney(LEFT_GUN_NUM,i);
  896. ShowViewChargingPower(LEFT_GUN_NUM,i);
  897. ShowViewChargingEngery(LEFT_GUN_NUM,i);
  898. usleep(100000);
  899. }
  900. break;
  901. case __VIEW_RIGHT_CHARGE_:
  902. for(i=0;i<=100;i++) {
  903. ShowViewChargingSoc(RIGHT_GUN_NUM,i);
  904. ShowViewChargingTime(RIGHT_GUN_NUM,i);
  905. ShowViewCharingMoney(RIGHT_GUN_NUM,i);
  906. ShowViewChargingPower(RIGHT_GUN_NUM,i);
  907. ShowViewChargingEngery(RIGHT_GUN_NUM, i);
  908. usleep(100000);
  909. }
  910. break;
  911. case __VIEW_ALL_CHARGE_:
  912. for(i=0;i<=100;i++) {
  913. ShowViewChargingSoc(LEFT_GUN_NUM,i);
  914. ShowViewChargingTime(LEFT_GUN_NUM,i*60);
  915. ShowViewCharingMoney(LEFT_GUN_NUM,i);
  916. ShowViewChargingPower(LEFT_GUN_NUM,i);
  917. ShowViewChargingEngery(LEFT_GUN_NUM, i/10);
  918. ShowViewChargingSoc(RIGHT_GUN_NUM,i);
  919. ShowViewChargingTime(RIGHT_GUN_NUM,i);
  920. ShowViewCharingMoney(RIGHT_GUN_NUM,i);
  921. ShowViewChargingPower(RIGHT_GUN_NUM,i);
  922. ShowViewChargingEngery(RIGHT_GUN_NUM, i/10);
  923. usleep(100000);
  924. }
  925. break;
  926. case 7:
  927. case 9:
  928. case 23:
  929. case 24:
  930. break;
  931. case 11:
  932. for(i = 0 ; i <= 100 ; i++) {
  933. // RefreshProgressAnimation(_ICON_ProgressBar_10+((i/10)*2));
  934. uint8_t digits = i % 10;
  935. uint8_t tens = (i / 10) %10;
  936. uint8_t hundreds = i / 100;
  937. ChangeDisplay2Value(_Percent_Number_Digits,(short)_ICON_White_Num_0+digits);
  938. ChangeDisplay2Value(_Percent_Number_Tens,(short)_ICON_White_Num_0+tens);
  939. if (hundreds == 0 )
  940. ChangeDisplay2Value(_Percent_Number_Hundreds,(short)_ICON_Empty);
  941. else
  942. ChangeDisplay2Value(_Percent_Number_Hundreds,(short)_ICON_White_Num_1);
  943. sprintf((char *)value,"%03d",i);
  944. DisplayValueToLcm(_Detail_Power_Num, (uint8_t *)value, sizeof(value));
  945. DisplayValueToLcm(_Detail_Time_Num, (uint8_t *)value, sizeof(value));
  946. DisplayValueToLcm(_Detail_Cap_Num, (uint8_t *)value, sizeof(value));
  947. DisplayValueToLcm(_Detail_Money_Num, (uint8_t *)value, sizeof(value));
  948. if (i%2 == 0 ) {
  949. ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_CCS1_Symbol);
  950. ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_Empty);
  951. memset(value, 0x00, sizeof(value));
  952. DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
  953. sprintf((char *)value,"1 A");
  954. DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
  955. } else {
  956. ChangeDisplay2Value(_Confirm_Gun_Left_symbol,_ICON_Empty);
  957. ChangeDisplay2Value(_Confirm_Gun_Right_symbol,_ICON_CCS2_Symbol);
  958. memset(value, 0x00, sizeof(value));
  959. DisplayValueToLcm(_Confirm_Gun_Left_name, (uint8_t *)value, sizeof(value));
  960. sprintf((char *)value,"1 B");
  961. DisplayValueToLcm(_Confirm_Gun_Right_name, (uint8_t *)value, sizeof(value));
  962. }
  963. usleep(100000);
  964. }
  965. break;
  966. case 12:
  967. case 13:
  968. case 15:
  969. case 17:
  970. case 28:
  971. ftime(&SeqEndTime);
  972. SeqEndTime.time = time(NULL);
  973. tm = localtime(&SeqEndTime.time);
  974. memset(value, 0x00, sizeof(value));
  975. sprintf((char *)value,"%02d:%02d",tm->tm_hour,tm->tm_min);
  976. DisplayValueToLcm(_Count_Down_Time, (uint8_t *)value, sizeof(value));
  977. if (pSysInfo->PageIndex == 17 || pSysInfo->PageIndex == 28) {
  978. for (i = 0; i <= 100; i++) {
  979. ChangeDisplay2Value(_Summary_total_money, i);
  980. ChangeDisplay2Value(_Summary_cal_Total_money, i);
  981. ChangeDisplay2Value(_Summary_Start_time_hr, i/60);
  982. ChangeDisplay2Value(_Summary_Start_time_min, i%60);
  983. ChangeDisplay2Value(_Summary_end_time_hr, i/60);
  984. ChangeDisplay2Value(_Summary_end_time_min, i%60);
  985. ChangeDisplay2Value(_Summary_duration_min, i);
  986. ChangeDisplay2Value(_Summary_duration_sec, i%60);
  987. ChangeDisplay2Value(_Summary_cap, i);
  988. ChangeDisplay2Value(_Summary_cal_discount,i);
  989. ChangeDisplay2Value(_Summary_cal_Settlement,i);
  990. ChangeDisplay2Value(_Summary_max_power, i);
  991. ChangeDisplay2Value(_Summary_average_power, i);
  992. usleep(100000);
  993. }
  994. }
  995. break;
  996. case __START_AUTHORIZE_:
  997. case __PRE_CHARGE_:
  998. case __STOP_AUTHORIZE_:
  999. for( i = 0 ; i <= 20 ; i++) {
  1000. //RefreshProgressAnimation(_ICON_ProgressBar_10);
  1001. usleep(100000);
  1002. }
  1003. for( i = 0 ; i <= 20 ; i++) {
  1004. //RefreshProgressAnimation(_ICON_ProgressBar_20);
  1005. usleep(100000);
  1006. }
  1007. break;
  1008. case 8:
  1009. case 16:
  1010. case 27:
  1011. case 18:
  1012. case 19:
  1013. case 20:
  1014. case 29:
  1015. case 30:
  1016. break;
  1017. case 21:
  1018. ShowCabientVersion();
  1019. break;
  1020. case 22:
  1021. ShowDispenserVersion();
  1022. break;
  1023. case 25:
  1024. case 26:
  1025. break;
  1026. case 5:
  1027. pSysInfo->CurGunSelected = 0;
  1028. ChangeQrCode();
  1029. break;
  1030. case 31:
  1031. pSysInfo->CurGunSelected = 1;
  1032. ChangeQrCode();
  1033. break;
  1034. }
  1035. }
  1036. void ShowCabientVersionDefaultText()
  1037. {
  1038. char value[16];
  1039. memset(value, 0x00, sizeof(value));
  1040. sprintf((char *)value,"%s","Cabient:");
  1041. DisplayValueToLcm(_Version_Cabient_Name_Text, (uint8_t *)value, sizeof(value));
  1042. sprintf((char *)value,"%s","BootLoader:");
  1043. DisplayValueToLcm(_Version_Cabient_BootLoader_Text, (uint8_t *)value, sizeof(value));
  1044. sprintf((char *)value,"%s","Kernel Fw:");
  1045. DisplayValueToLcm(_Version_Cabient_Kernel_Text, (uint8_t *)value, sizeof(value));
  1046. sprintf((char *)value,"%s","CSU Fw:");
  1047. DisplayValueToLcm(_Version_Cabient_CSU_Text, (uint8_t *)value, sizeof(value));
  1048. sprintf((char *)value,"%s","Priamry Fw:");
  1049. DisplayValueToLcm(_Version_Cabient_Priamry_Text, (uint8_t *)value, sizeof(value));
  1050. sprintf((char *)value,"%s","Relay(0) Fw:");
  1051. DisplayValueToLcm(_Version_Cabient_Relay0_Text, (uint8_t *)value, sizeof(value));
  1052. sprintf((char *)value,"%s","Relay(1) Fw:");
  1053. DisplayValueToLcm(_Version_Cabient_Relay1_Text, (uint8_t *)value, sizeof(value));
  1054. sprintf((char *)value,"%s","Fan Fw:");
  1055. DisplayValueToLcm(_Version_Cabient_Fan_Text, (uint8_t *)value, sizeof(value));
  1056. sprintf((char *)value,"%s","IP Addr:");
  1057. DisplayValueToLcm(_Version_Cabient_IPAddr_Text, (uint8_t *)value, sizeof(value));
  1058. if (ShmDcCommonData->PSU_Number > 0 && ShmDcCommonData->PSU_Number <= 12) {
  1059. sprintf((char *)value,"%s","Primary");
  1060. DisplayValueToLcm(_Version_Cabient_Primary_Text, (uint8_t *)value, sizeof(value));
  1061. sprintf((char *)value,"%s","Secondary");
  1062. DisplayValueToLcm(_Version_Cabient_Secondary_Text, (uint8_t *)value, sizeof(value));
  1063. for(uint8_t i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
  1064. sprintf((char *)value,"PSU(%d):",i+1);
  1065. DisplayValueToLcm(_Version_Cabient_PSU1_Text+i*0x10, (uint8_t *)value, sizeof(value));
  1066. }
  1067. }
  1068. }
  1069. void ShowDispenserVersionDefautlText()
  1070. {
  1071. char value[16];
  1072. memset(value, 0x00, sizeof(value));
  1073. sprintf((char *)value,"%s","Dispenser:");
  1074. DisplayValueToLcm(_Version_Dispenser_Name_Text, (uint8_t *)value, sizeof(value));
  1075. sprintf((char *)value,"%s","BootLoader:");
  1076. DisplayValueToLcm(_Version_Dispenser_BootLoader_Text, (uint8_t *)value, sizeof(value));
  1077. sprintf((char *)value,"%s","Kernel Fw:");
  1078. DisplayValueToLcm(_Version_Dispenser_Kernel_Text, (uint8_t *)value, sizeof(value));
  1079. sprintf((char *)value,"%s","CSU Fw:");
  1080. DisplayValueToLcm(_Version_Dispenser_CSU_Text, (uint8_t *)value, sizeof(value));
  1081. sprintf((char *)value,"%s","Relay Fw:");
  1082. DisplayValueToLcm(_Version_Dispenser_Relay_Text, (uint8_t *)value, sizeof(value));
  1083. sprintf((char *)value,"%s","Fan Fw:");
  1084. DisplayValueToLcm(_Version_Dispenser_Fan_Text, (uint8_t *)value, sizeof(value));
  1085. sprintf((char *)value,"%s","Prim Fw:");
  1086. DisplayValueToLcm(_Version_Dispenser_Priamry_Text, (uint8_t *)value, sizeof(value));
  1087. sprintf((char *)value,"%s","LCM Hw:");
  1088. DisplayValueToLcm(_Version_Dispenser_LCM_Text, (uint8_t *)value, sizeof(value));
  1089. sprintf((char *)value,"%s","LED Fw:");
  1090. DisplayValueToLcm(_Version_Dispenser_LED_Text, (uint8_t *)value, sizeof(value));
  1091. sprintf((char *)value,"%s","Connector(0):");
  1092. DisplayValueToLcm(_Version_Dispenser_Connector0_Text, (uint8_t *)value, sizeof(value));
  1093. sprintf((char *)value,"%s","Connector(1):");
  1094. DisplayValueToLcm(_Version_Dispenser_Connector1_Text, (uint8_t *)value, sizeof(value));
  1095. sprintf((char *)value,"%s","IP Addr:");
  1096. DisplayValueToLcm(_Version_Dispenser_IPAddr_Text, (uint8_t *)value, sizeof(value));
  1097. }
  1098. void ShowCabientVersion()
  1099. {
  1100. char value[16];
  1101. memset(value, 0x00, sizeof(value));
  1102. sprintf((char *)value,"%s",ShmDcCommonData->CabinetModelName);
  1103. DisplayValueToLcm(_Version_Cabient_Model_value, (uint8_t *)value, sizeof(value));
  1104. sprintf((char *)value,"%s",ShmDcCommonData->CabinetBoolLoaderVersion);
  1105. DisplayValueToLcm(_Version_Cabient_BootLoader_value, (uint8_t *)value, sizeof(value));
  1106. sprintf((char *)value,"%s",ShmDcCommonData->CabinetKernelVersion);
  1107. DisplayValueToLcm(_Version_Cabient_Kernel_value, (uint8_t *)value, sizeof(value));
  1108. sprintf((char *)value,"%s",ShmDcCommonData->CabinetRFSystemVersion);
  1109. DisplayValueToLcm(_Version_Cabient_CSU_value, (uint8_t *)value, sizeof(value));
  1110. sprintf((char *)value,"%s",ShmDcCommonData->CabinetPrimaryVersion);
  1111. DisplayValueToLcm(_Version_Cabient_Priamry_value, (uint8_t *)value, sizeof(value));
  1112. sprintf((char *)value,"%s",ShmDcCommonData->CabinetRelay0Version);
  1113. DisplayValueToLcm(_Version_Cabient_Relay0_value, (uint8_t *)value, sizeof(value));
  1114. sprintf((char *)value,"%s",ShmDcCommonData->CabinetRelay1Version);
  1115. DisplayValueToLcm(_Version_Cabient_Relay1_value, (uint8_t *)value, sizeof(value));
  1116. sprintf((char *)value,"%s",ShmDcCommonData->CabinetFanVersion);
  1117. DisplayValueToLcm(_Version_Cabient_Fan_value, (uint8_t *)value, sizeof(value));
  1118. sprintf((char *)value,"%s",ShmDcCommonData->CabinetIPAddr);
  1119. DisplayValueToLcm(_Version_Cabient_IPAddr_value, (uint8_t *)value, sizeof(value));
  1120. if (ShmDcCommonData->PSU_Number > 0 && ShmDcCommonData->PSU_Number < 12) {
  1121. for(uint8_t i = 0 ; i < ShmDcCommonData->PSU_Number ; i++) {
  1122. if (i>=6) {
  1123. sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[(i-6)].DCVersion);
  1124. DisplayValueToLcm(_Version_Cabient_PSU_Prim7_value+(i-6)*0x10, (uint8_t *)value, sizeof(value));
  1125. sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[(i-6)].FPCVersion);
  1126. DisplayValueToLcm(_Version_Cabient_PSU_Sec7_value+(i-6)*0x10, (uint8_t *)value, sizeof(value));
  1127. continue;
  1128. }
  1129. sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[i].DCVersion);
  1130. DisplayValueToLcm(_Version_Cabient_PSU_Prim1_value+i*0x10, (uint8_t *)value, sizeof(value));
  1131. sprintf((char *)value,"%s",ShmDcCommonData->PsuVer[i].FPCVersion);
  1132. DisplayValueToLcm(_Version_Cabient_PSU_Sec1_value+i*0x10, (uint8_t *)value, sizeof(value));
  1133. }
  1134. }
  1135. }
  1136. void ShowDispenserVersion()
  1137. {
  1138. char value[32];
  1139. memset(value, 0x00, sizeof(value));
  1140. sprintf((char *)value,"%s",pSysConfig->ModelName);
  1141. DisplayValueToLcm(_Version_Dispenser_Model_value, (uint8_t *)value, sizeof(value));
  1142. sprintf((char *)value,"%s",pSysInfo->CsuBootLoadFwRev);
  1143. DisplayValueToLcm(_Version_Dispenser_BootLoader_value, (uint8_t *)value, sizeof(value));
  1144. sprintf((char *)value,"%s",pSysInfo->CsuKernelFwRev);
  1145. DisplayValueToLcm(_Version_Dispenser_Kernel_value, (uint8_t *)value, sizeof(value));
  1146. sprintf((char *)value,"%s",pSysInfo->CsuRootFsFwRev);
  1147. DisplayValueToLcm(_Version_Dispenser_CSU_value, (uint8_t *)value, sizeof(value));
  1148. sprintf((char *)value,"%s",pSysInfo->RelayModuleFwRev);
  1149. DisplayValueToLcm(_Version_Dispenser_Relay_value, (uint8_t *)value, sizeof(value));
  1150. sprintf((char *)value,"%s",pSysInfo->FanModuleFwRev);
  1151. DisplayValueToLcm(_Version_Dispenser_Fan_value, (uint8_t *)value, sizeof(value));
  1152. sprintf((char *)value,"%s",pSysInfo->CsuPrimFwRev);
  1153. DisplayValueToLcm(_Version_Dispenser_Priamry_value, (uint8_t *)value, sizeof(value));
  1154. sprintf((char *)value,"%s",pSysInfo->LcmHwRev);
  1155. DisplayValueToLcm(_Version_Dispenser_LCM_value, (uint8_t *)value, sizeof(value));
  1156. sprintf((char *)value,"%s",pSysInfo->LedModuleFwRev);
  1157. DisplayValueToLcm(_Version_Dispenser_LED_value, (uint8_t *)value, sizeof(value));
  1158. sprintf((char *)value,"%s",pSysInfo->Connector1FwRev);
  1159. DisplayValueToLcm(_Version_Dispenser_Connector0_value, (uint8_t *)value, sizeof(value));
  1160. sprintf((char *)value,"%s",pSysInfo->Connector2FwRev);
  1161. DisplayValueToLcm(_Version_Dispenser_Connector1_value, (uint8_t *)value, sizeof(value));
  1162. sprintf((char *)value,"%s",pSysConfig->Eth0Interface.EthIpAddress);
  1163. DisplayValueToLcm(_Version_Dispenser_IPAddr_value, (uint8_t *)value, sizeof(value));
  1164. }
  1165. void InformationShow()
  1166. {
  1167. is_show = true;
  1168. if (_showInformIndex == 0 ) {
  1169. pSysInfo->PageIndex = __SHOW_CABIENT_VERSION;
  1170. } else {
  1171. pSysInfo->PageIndex = __SHOW_DISPENSER_VERASION;
  1172. ShowDispenserVersion();
  1173. }
  1174. }
  1175. int main(void)
  1176. {
  1177. bool defaulttext = false;
  1178. if (CreateAllCsuShareMemory() == FAIL) {
  1179. log_error("create share memory error");
  1180. return FAIL;
  1181. }
  1182. MappingGunChargingInfo("LCM Control Task");
  1183. pSysConfig = (struct SysConfigData *)GetShmSysConfigData();
  1184. pSysInfo = (struct SysInfoData *)GetShmSysInfoData();
  1185. pSysWarning = (struct WARNING_CODE_INFO *)GetShmSysWarningInfo();
  1186. ShmFanModuleData = (struct FanModuleData *)GetShmFanModuleData();;
  1187. ShmPrimaryMcuData = (struct PrimaryMcuData *)GetShmPrimaryMcuData();
  1188. ShmSelectGunInfo = (SelectGunInfo *)GetShmSelectGunInfo();
  1189. ShmDcCommonData = (DcCommonInfo *)GetShmDcCommonData();
  1190. struct StatusCodeData *ShmStatusCodeData = (struct StatusCodeData *)GetShmStatusCodeData();;
  1191. struct ChargingInfoData *pDcChargingInfo_0 = (struct ChargingInfoData *)GetDcChargingInfoData(LEFT_GUN_NUM);
  1192. struct ChargingInfoData *pDcChargingInfo_1 = (struct ChargingInfoData *)GetDcChargingInfoData(RIGHT_GUN_NUM);
  1193. _port = CreateCommunicationLcmPort();
  1194. ChangeBackLight(true);
  1195. _totalCount = pSysConfig->TotalConnectorCount;
  1196. _everyPageRollChange = 0;
  1197. //Initialization();
  1198. //printf("_LCM_COMPLETE ");
  1199. //ChangeToOtherPage(_LCM_COMPLETE);
  1200. //return 0;
  1201. uint8_t index = 1;
  1202. ShmDcCommonData->PSU_Number = 12;
  1203. while (_port != -1) {
  1204. if (strcmp((char *)pSysInfo->LcmHwRev, moduleName) != 0x00) {
  1205. GetCurrentPage();
  1206. sleep(1);
  1207. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = true;
  1208. } else {
  1209. // Show Default Text
  1210. if (!defaulttext) {
  1211. ShowCabientVersionDefaultText();
  1212. ShowDispenserVersionDefautlText();
  1213. defaulttext = true;
  1214. }
  1215. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = false;
  1216. if(pSysConfig->TotalConnectorCount>=2) {
  1217. if (pDcChargingInfo_0->SystemStatus == S_IDLE) {
  1218. ChargeMaxPower_0 = 0;
  1219. } else if (pDcChargingInfo_0->SystemStatus == S_CHARGING) {
  1220. if (pDcChargingInfo_0->PresentChargingPower > ChargeMaxPower_0 &&
  1221. pDcChargingInfo_0->PresentChargingPower >= 0 &&
  1222. pDcChargingInfo_0->PresentChargingPower <= POWER_MAX_KW)
  1223. ChargeMaxPower_0 = pDcChargingInfo_0->PresentChargingPower;
  1224. }
  1225. if (pDcChargingInfo_1->SystemStatus == S_IDLE) {
  1226. ChargeMaxPower_1 = 0;
  1227. } else if (pDcChargingInfo_1->SystemStatus == S_CHARGING) {
  1228. if (pDcChargingInfo_1->PresentChargingPower > ChargeMaxPower_1 &&
  1229. pDcChargingInfo_1->PresentChargingPower >= 0 &&
  1230. pDcChargingInfo_1->PresentChargingPower <= POWER_MAX_KW)
  1231. ChargeMaxPower_1 = pDcChargingInfo_1->PresentChargingPower;
  1232. }
  1233. }
  1234. // 頁面資訊處理
  1235. ProcessPageInfo();
  1236. // 換頁處理
  1237. //GetCurrentPage(); //DS60-120 add
  1238. /*
  1239. if (pSysConfig->ShowInformation == YES && pSysInfo->SystemPage == _LCM_VIEW) {
  1240. InformationShow();
  1241. ChangeToOtherPage(pSysInfo->PageIndex);
  1242. usleep(100000);
  1243. continue;
  1244. } else {
  1245. if (is_show)
  1246. _showInformIndex >= 1 ? _showInformIndex = 0 : _showInformIndex++;
  1247. is_show = false;
  1248. }*/
  1249. GetCurrentPage(); //DS60-120 add
  1250. ChangeCurPage();
  1251. /*
  1252. pSysInfo->PageIndex = _LCM_WAIT_PLUGIN;
  1253. GetCurrentPage();
  1254. ChangeToOtherPage(_LCM_WAIT_PLUGIN);
  1255. GetCurrentPage();
  1256. DemoFunction();
  1257. index >= 34 ? index = 1 : index++;
  1258. */
  1259. //usleep(100000);
  1260. usleep(1000000);
  1261. }
  1262. } //while
  1263. ShmStatusCodeData->AlarmCode.AlarmEvents.bits.LcmModuleCommFail = true;
  1264. log_info("Close LCM Uart Port");
  1265. CloseCommunicationLcmPort();
  1266. return FAIL;
  1267. }