Rev 1246 | Rev 1248 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1246 | Rev 1247 | ||
|---|---|---|---|
| Line 433... | Line 433... | ||
| 433 | } |
433 | } |
| 434 | } |
434 | } |
| 435 | 435 | ||
| 436 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
436 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
| 437 | { |
437 | { |
| 438 | //log("callback: "+shortname+" \n"); |
- | |
| 439 | if (shortname == this.shortName) |
438 | if (shortname == this.shortName) |
| 440 | { |
439 | { |
| 441 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
440 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
| 442 | if (data.error) |
441 | if (data.error) |
| 443 | { |
442 | { |
| Line 635... | Line 634... | ||
| 635 | this.myInterval.start(); |
634 | this.myInterval.start(); |
| 636 | 635 | ||
| 637 | this.timerUpdate(); |
636 | this.timerUpdate(); |
| 638 | } |
637 | } |
| 639 | } |
638 | } |
| 640 | - | ||
| 641 | Display.prototype.setLEDtoCalendar = function() |
639 | Display.prototype.setLEDtoCalendar = function() |
| 642 | { |
640 | { |
| 643 | if (this.exchangeData) |
641 | if (this.exchangeData) |
| 644 | { |
642 | { |
| 645 | var now = new Date(); |
643 | var now = new Date(); |
| 646 | //for (var i = 0; i < this.exchangeData.meetings.length; i++) |
644 | //for (var i = 0; i < this.exchangeData.meetings.length; i++) |
| 647 | if (this.exchangeData.meetings.length > 0) |
645 | if (this.exchangeData.meetings.length > 0) |
| 648 | { |
646 | { |
| 649 | /* check if current time is before start of first meeting |
647 | /* check if current time is before start of first meeting |
| 650 | first meeting is always the next meeting or current meeting */ |
648 | first meeting is always the next meeting or current meeting */ |
| 651 |
|
649 | //var startDate = new Date.parse(this.exchangeData.meetings[0].start); |
| 652 |
|
650 | var startTimeSplit = this.exchangeData.meetings[0].start.split(":"); |
| - | 651 | if (now.getHours() < startTimeSplit[0] || now.getHours() == startTimeSplit[0] && now.getMinutes() < startTimeSplit[1]) |
|
| 653 | { |
652 | { |
| 654 | this.setLEDgreen(); |
653 | this.setLEDgreen(); |
| 655 | } |
654 | } |
| 656 | else |
655 | else |
| 657 | { |
656 | { |
| 658 | this.setLEDred(); |
657 | this.setLEDred(); |
| 659 | } |
658 | } |
| 660 | - | ||
| 661 | //var endDate = new Date(this.exchangeData.meetings[i].end); |
- | |
| 662 | //now.getHours() |
- | |
| 663 | //this.exchangeData.meetings[i].start |
- | |
| 664 | //this.exchangeData.meetings[i].end |
- | |
| 665 | //var startTimeSplit = this.exchangeData.meetings[i].start.split(":"); |
- | |
| 666 | //var endTimeSplit = this.exchangeData.meetings[i].end.split(":"); |
- | |
| 667 | } |
659 | } |
| 668 | else |
660 | else |
| 669 | { |
661 | { |
| 670 | this.setLEDgreen(); |
662 | this.setLEDgreen(); |
| - | 663 | } |
|
| 671 | } |
664 | } |
| 672 | } |
665 | } |
| 673 | 666 | ||
| 674 | Display.prototype.setLEDred = function() |
667 | Display.prototype.setLEDred = function() |
| 675 | { |
668 | { |
| Line 681... | Line 674... | ||
| 681 | this.setLED(0, 255, 0); |
674 | this.setLED(0, 255, 0); |
| 682 | } |
675 | } |
| 683 | 676 | ||
| 684 | Display.prototype.setLED = function(red, green, blue) |
677 | Display.prototype.setLED = function(red, green, blue) |
| 685 | { |
678 | { |
| - | 679 | log("trying to set leds to red " +red+" green "+green+" blue "+blue+"\n"); |
|
| 686 | if (this.mySoftPwmService.isOnline()) |
680 | if (this.mySoftPwmService.isOnline()) |
| 687 | { |
681 | { |
| 688 | this.mySoftPwmService.setPWMValue(255-(red&0xff), 1); |
682 | this.mySoftPwmService.setPWMValue(255-(red&0xff), 1); |
| 689 | this.mySoftPwmService.setPWMValue(255-(green&0xff), 2); |
683 | this.mySoftPwmService.setPWMValue(255-(green&0xff), 2); |
| 690 | this.mySoftPwmService.setPWMValue(255-(blue&0xff), 0); |
684 | this.mySoftPwmService.setPWMValue(255-(blue&0xff), 0); |
| 691 | } |
685 | } |
| 692 | } |
686 | } |
| 693 | 687 | ||
| 694 | Display.prototype.sendTimeStamp = function() |
688 | Display.prototype.sendTimeStamp = function() |
| 695 | { |
689 | { |
| 696 | var canMessage = new CanNMTMessage("nmt", "Time"); |
690 | var canMessage = new CanNMTMessage("nmt", "Time"); |
| 697 | canMessage.send(); |
691 | canMessage.send(); |
| Line 700... | Line 694... | ||
| 700 | Display.prototype.timerUpdate = function() |
694 | Display.prototype.timerUpdate = function() |
| 701 | { |
695 | { |
| 702 | /* If LCD service is not online do nothing */ |
696 | /* If LCD service is not online do nothing */ |
| 703 | if (this.myLCDService.isOnline()) |
697 | if (this.myLCDService.isOnline()) |
| 704 | { |
698 | { |
| 705 | //this.setLEDgreen(); |
- | |
| 706 | this.screenSaverCnt++; |
699 | this.screenSaverCnt++; |
| 707 | this.mainScreenCnt++; |
700 | this.mainScreenCnt++; |
| 708 | this.exchangeUpdateCnt++; |
701 | this.exchangeUpdateCnt++; |
| 709 | 702 | ||
| 710 | if (this.mainScreenCnt > mainScreenTimeout/5) |
703 | if (this.mainScreenCnt > mainScreenTimeout/5) |
| 711 | { |
704 | { |
| 712 | //this.setLEDred(); |
- | |
| 713 | /* Go to main screen (time) */ |
705 | /* Go to main screen (time) */ |
| 714 | this.currentMenuItem = this.statusMenuItem; |
706 | this.currentMenuItem = this.statusMenuItem; |
| 715 | 707 | ||
| 716 | /* update the info on display */ |
708 | /* update the info on display */ |
| 717 | this.updateDisplay(); |
709 | this.updateDisplay(); |
| 718 | 710 | ||
| 719 | this.mainScreenCnt = 0; |
711 | this.mainScreenCnt = 0; |
| 720 | } |
712 | } |
| 721 | 713 | ||
| 722 | if (this.screenSaverCnt > screenSaverTimeout/5) |
714 | if (this.screenSaverCnt > screenSaverTimeout/5) |
| 723 | { |
715 | { |
| 724 | 716 | ||
| 725 | this.screenSaverCnt = 0; |
717 | this.screenSaverCnt = 0; |
| 726 | } |
718 | } |
| 727 | 719 | ||
| 728 | if (this.exchangeUpdateCnt > exchangeUpdateTimeout/5) |
720 | if (this.exchangeUpdateCnt > exchangeUpdateTimeout/5) |
| 729 | { |
721 | { |
| 730 | /* update the info on display */ |
722 | /* update the info on display */ |
| 731 | this.updateDisplay(); |
723 | this.updateDisplay(); |
| 732 | 724 | ||
| 733 | /* do an exchange lookup */ |
725 | /* do an exchange lookup */ |
| 734 |
|
726 | this.exchangeCalendar.lookup(this.shortName); |
| 735 | 727 | ||
| 736 | this.exchangeUpdateCnt = 0; |
728 | this.exchangeUpdateCnt = 0; |
| 737 | } |
729 | } |
| 738 | - | ||
| 739 | } |
730 | } |
| 740 | - | ||
| 741 | /*if (this.mySoftPwmService.isOnline()) |
- | |
| 742 | { |
- | |
| 743 | this.mySoftPwmService.setPWMValue(0, 0); |
- | |
| 744 | this.mySoftPwmService.setPWMValue(11, 1); |
- | |
| 745 | this.mySoftPwmService.setPWMValue(11, 2); |
- | |
| 746 | }*/ |
- | |
| 747 | } |
731 | } |
| 748 | 732 | ||