📄 menuprocess.lst
字号:
261 ***********************************/
262 Byte display_Msg_byLCD(Byte* pBuffer, Byte bufLen, Byte nLcd)
263 {
264 1 Byte tmpBuf[65];
265 1 Byte firstByte, lastByte;
266 1 if ((NULL != pBuffer) && (nLcd > 0))
267 1 {
268 2 memset(tmpBuf, 0, 65);
269 2 if (bufLen > 0)
270 2 {
271 3 firstByte = 64*(nLcd-1);
272 3 if (nLcd == 4)
273 3 lastByte = 0xff;
274 3 else
275 3 lastByte = 64*nLcd;
276 3 if (firstByte >= bufLen)
277 3 return (nLcd-1);
278 3 else
279 3 {
280 4 if (lastByte > bufLen)
281 4 lastByte = bufLen;
282 4 memcpy(tmpBuf, pBuffer+firstByte, lastByte-firstByte);
283 4 lcd_clear_srceen();
284 4 display_attribute( 0,0,0 );
285 4 display_string(tmpBuf);
286 4 return (nLcd);
287 4 }
288 3 }
289 2 else
290 2 return 0;
291 2 }
292 1 else
293 1 return 0;
294 1 }
295
296 /*通用菜单显示函数*/
297 void comm_menu( char *str1, char *str2, char *str3, char *str4 )
298 {
299 1 lcd_clear_srceen();
300 1
C51 COMPILER V7.09 MENUPROCESS 09/17/2008 16:38:53 PAGE 6
301 1 if (NULL != str1)
302 1 {
303 2 display_attribute( 0,0,0 );
304 2 display_string( str1 );
305 2 }
306 1 if (NULL != str2)
307 1 {
308 2 display_attribute( 0,1,0 );
309 2 display_string( str2 );
310 2 }
311 1 if (NULL != str3)
312 1 {
313 2 display_attribute( 0,2,0 );
314 2 display_string( str3 );
315 2 }
316 1 if (NULL != str4)
317 1 {
318 2 display_attribute( 0,3,0 );
319 2 display_string( str4 );
320 2 }
321 1 }
322
323 /*******************************以下函数为主界面需要调用的函数********/
324 /*显示本站,下站,首站。flash判断是否刷新标志,以下相同。该内容从*get_busInfo()中获取。*/
325 unsigned char menuMainStaAttr = 0;
326 unsigned char gMenuSpeed, gMenuSpeed2= 0;
327 void display_stationAttr(char flash)
328 {
329 1 Byte attr, tmpvalue;
330 1 char tmpbuf[4];
331 1 /* tmpvalue = get_menu_speed();
332 1 if ((flash == FLASH_SCREEN) || (gMenuSpeed != tmpvalue))
333 1 {
334 1
335 1 memset(tmpbuf, 0, 4);
336 1 gMenuSpeed = tmpvalue;
337 1 tmpbuf[0] = gMenuSpeed/10+'0';
338 1 tmpbuf[1] = gMenuSpeed%10+'0';
339 1 tmpbuf[2] = ':';
340 1 display_attribute( 11,1,0 );
341 1 display_string(tmpbuf);
342 1 }*/
343 1 tmpvalue = get_menucurspeed();
*** WARNING C206 IN LINE 343 OF MENU\MENUPROCESS.C: 'get_menucurspeed': missing function-prototype
344 1 if ((flash == FLASH_SCREEN) || (gMenuSpeed2 != tmpvalue))
345 1 {
346 2
347 2 memset(tmpbuf, 0, 4);
348 2 gMenuSpeed2= tmpvalue;
349 2 tmpbuf[0] = gMenuSpeed2/10+'0';
350 2 tmpbuf[1] = gMenuSpeed2%10+'0';
351 2 // sprintf(tmpbuf, "%2bd", get_menucurspeed());
352 2 display_attribute( 14,1,0 );
353 2 display_string(tmpbuf);
354 2 }
355 1 get_station_attr(&attr);
356 1 if ((flash == FLASH_SCREEN) || (attr != menuMainStaAttr))
357 1 {
358 2 menuMainStaAttr = attr;
359 2 switch (menuMainStaAttr)
360 2 {
361 3 case FIRST_STATION:
C51 COMPILER V7.09 MENUPROCESS 09/17/2008 16:38:53 PAGE 7
362 3 display_attribute( 2,1,0 );
363 3 display_string(drivingMsg[YX_SZ]);
364 3 break;
365 3
366 3 case CURRENT_STATION:
367 3 display_attribute( 2,1,0 );
368 3 display_string(drivingMsg[YX_BZ]);
369 3 break;
370 3
371 3 case NEXT_STATION:
372 3 display_attribute( 2,1,0 );
373 3 display_string(drivingMsg[YX_XZ]);
374 3 break;
375 3
376 3 default:
377 3 break;
378 3 }
379 2 }
380 1 }
381
382 /*显示站点序号和站名,该内容从*get_busInfo()中获取*/
383 unsigned char menuMainStaNum = 0;//主界面站点序号
384 void display_stationNumNam(char flash)
385 {
386 1 Byte num;
387 1 Byte *nam;
388 1 unsigned char numStr[5],row,len,i,str_row,str[17];
389 1
390 1 get_cur_displayStation(&num);
391 1 if ((flash == FLASH_SCREEN)||(num != menuMainStaNum))
392 1 {
393 2 menuMainStaNum = num;/*显示站点序号*/
394 2 nam = get_station_name();
395 2 if (num > 64) /*判断上下行*/
396 2 num = num - 64;
397 2 display_attribute( 7,1,0 );
398 2 numStr[0] = '(';
399 2 //转换成ASCII码
400 2 numStr[1] = num / 10 + '0'; /*十位数*/
401 2 numStr[2] = num % 10 + '0'; /*个位数*/
402 2 numStr[3] = ')';
403 2 numStr[4] = 0;
404 2 display_string( numStr );
405 2 /*显示站名*/
406 2 display_attribute( 0,2,0 );
407 2 display_string(startupMsg[KJ_NULL]);/*清除该行上次显示的站名*/
408 2 len = strlen(nam);
409 2 if (len > 16)
410 2 {
411 3 for (i = 0;i < 16;i ++) /*超过8个汉字则保留前8个汉字。*/
412 3 {
413 4 str[i] = *nam;
414 4 nam ++;
415 4 }
416 3 str[16] = '\0';
417 3 display_attribute( 0,2,0 );
418 3 display_string(str);
419 3 }
420 2 else /*将站名显示在偶数列*/
421 2 {
422 3 row = (16 - len)/2;
423 3 str_row = odd_to_even(row);
C51 COMPILER V7.09 MENUPROCESS 09/17/2008 16:38:53 PAGE 8
424 3 display_attribute( str_row,2,0 );
425 3 display_string(nam);
426 3 }
427 2 }
428 1 }
429
430 /*显示线路模式,从get_busInfo()中获取*/
431 unsigned char menuMainLineMode = 0;
432 void display_lineMode(char flash)
433 {
434 1 Byte mode;
435 1 unsigned char modeStr[2];
436 1
437 1 get_cur_mode(&mode);
438 1 if ((menuMainLineMode != mode) || (flash == FLASH_SCREEN))
439 1 {
440 2 menuMainLineMode = mode;
441 2 display_attribute( 6,3,0 );
442 2 display_string(drivingMsg[YX_mode]);
443 2 modeStr[0] = menuMainLineMode + '0';
444 2 modeStr[1] = 0;
445 2 display_attribute( 7,3,0 );
446 2 display_string(modeStr);
447 2 }
448 1 }
449
450 /*显示线路,从get_busInfo()中获取*/
451 unsigned char data menuMainLineNum = 0;
452 void display_line(char flash)
453 {
454 1 Byte lnNm;
455 1 unsigned char name[7];
456 1
457 1 get_line_num(&lnNm);
458 1 if((menuMainLineNum != lnNm) || (flash == FLASH_SCREEN))
459 1 {
460 2 menuMainLineNum = lnNm;
461 2 get_line_name(name, 6);
462 2 name[6] = 0;
463 2 display_attribute( 0,3,0 );
464 2 display_string(name);
465 2 }
466 1 }
467
468 /*显示"↑↓"箭头*/
469 void display_arrow(char fx)
470 {
471 1 unsigned char a[] = {24,0}; /*显示"↑"箭头,24是"↑"的ASCII码值。*/
472 1 unsigned char b[] = {25,0}; /*显示"↓"箭头,25是"↓"的ASCII码值。*/
473 1
474 1 if (fx == BUS_UPWARD)
475 1 {
476 2 display_attribute( 9,3,0 );
477 2 display_string(a);
478 2 }
479 1 else
480 1 {
481 2 display_attribute( 9,3,0 );
482 2 display_string(b);
483 2 }
484 1 }
485
C51 COMPILER V7.09 MENUPROCESS 09/17/2008 16:38:53 PAGE 9
486 /*显示方向,该内容从*get_busInfo()中获取*/
487 unsigned char menuMianDriveDir = 0;
488 void display_drivDirection(char flash)
489 {
490 1 Byte diretion;
491 1 get_cur_direction(&diretion);
492 1 if ((flash == FLASH_SCREEN)||(diretion != menuMianDriveDir))
493 1 {
494 2 menuMianDriveDir = diretion;
495 2 switch (menuMianDriveDir)
496 2 {
497 3 case BUS_UPWARD:
498 3 display_arrow(BUS_UPWARD);
499 3 break;
500 3
501 3 case BUS_BACKWARD:
502 3 display_arrow(BUS_BACKWARD);
503 3 break;
504 3
505 3 default:
506 3 break;
507 3 }
508 2
509 2 }
510 1 }
511
512 /*显示运营状态,该内容从RUN_MODE get_bus_runmode()中获取*/
513 unsigned char menuMainRunmode = 0;
514 void display_runmode(char flash)
515 {
516 1 RUN_MODE mode;
517 1 get_cur_runmode(&mode);
518 1 if ((flash == FLASH_SCREEN) || (mode != menuMainRunmode))
519 1 {
520 2 menuMainRunmode = mode;
521 2 display_attribute( 10,3,0 );
522 2 if (mode == RUN_NORMAL)
523 2 display_string(drivingMsg[11]);
524 2 else
525 2 display_string(drivingMsg[12]);
526 2 }
527 1 }
528
529 /*显示时间,该内容从*get_curtime()中获取*/
530 Byte menuMainHour=0, menuMainMinute=0;
531 void display_time(char flash)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -