Rev 1189 | Rev 1191 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1189 | Rev 1190 | ||
|---|---|---|---|
| Line 11... | Line 11... | ||
| 11 | /* We inherit from Service with this call, it must always be next |
11 | /* We inherit from Service with this call, it must always be next |
| 12 | after the constructor */ |
12 | after the constructor */ |
| 13 | extend(Display, Service); |
13 | extend(Display, Service); |
| 14 | 14 | ||
| 15 | /* Declaration of instance variables, for static variables remove prototype */ |
15 | /* Declaration of instance variables, for static variables remove prototype */ |
| 16 | /* The currently displayed menuitem */ |
- | |
| 17 | Display.prototype.currentMenuItem = null; |
- | |
| 18 | - | ||
| 19 | Display.prototype.statusMenuItem = null; |
- | |
| 20 | Display.prototype.bookMenuItem = null; |
- | |
| 21 | 16 | ||
| 22 | /* format: |
17 | /* format: dat objects, just use the time */ |
| 23 | Display.prototype.bookFromTime = null; |
18 | Display.prototype.bookFromTime = null; |
| 24 | Display.prototype.bookToTime = null; |
19 | Display.prototype.bookToTime = null; |
| 25 | 20 | ||
| 26 | /* the shortname for this exchangeobject */ |
21 | /* the shortname for this exchangeobject */ |
| 27 | Display.prototype.shortName = null; |
22 | Display.prototype.shortName = null; |
| Line 34... | Line 29... | ||
| 34 | 29 | ||
| 35 | Display.prototype.myLCDService = null; |
30 | Display.prototype.myLCDService = null; |
| 36 | Display.prototype.myRotaryService = null; |
31 | Display.prototype.myRotaryService = null; |
| 37 | Display.prototype.mySoftPwmService = null; |
32 | Display.prototype.mySoftPwmService = null; |
| 38 | Display.prototype.myInterval = null; |
33 | Display.prototype.myInterval = null; |
| 39 | 34 | ||
| - | 35 | /* */ |
|
| 40 | Display.prototype.exchangeCalendar = null; |
36 | Display.prototype.exchangeCalendar = null; |
| - | 37 | /* */ |
|
| 41 | Display.prototype.exchangeCalendarFirstMenuItem = null; |
38 | Display.prototype.exchangeCalendarFirstMenuItem = null; |
| 42 | Display.prototype.exchangeCalendarLastMenuItem = null; |
39 | Display.prototype.exchangeCalendarLastMenuItem = null; |
| - | 40 | Display.prototype.statusMenuItem = null; |
|
| - | 41 | Display.prototype.bookMenuItem = null; |
|
| - | 42 | ||
| - | 43 | /* The currently displayed menuitem */ |
|
| - | 44 | Display.prototype.currentMenuItem = null; |
|
| 43 | 45 | ||
| 44 | 46 | ||
| 45 | /* This function must always be declared, this is where all the startup code |
47 | /* This function must always be declared, this is where all the startup code |
| 46 | should be placed. Gets called with arguments like what ids to use etc. */ |
48 | should be placed. Gets called with arguments like what ids to use etc. */ |
| 47 | Display.prototype.initialize = function(initialArguments) |
49 | Display.prototype.initialize = function(initialArguments) |
| Line 53... | Line 55... | ||
| 53 | var self = this; |
55 | var self = this; |
| 54 | 56 | ||
| 55 | if (!this.myInitialArguments["HD44789"]) |
57 | if (!this.myInitialArguments["HD44789"]) |
| 56 | { |
58 | { |
| 57 | log(this.myName + ":" + this.myId + "> Failed to initialize, HD44789-config missing from config.\n"); |
59 | log(this.myName + ":" + this.myId + "> Failed to initialize, HD44789-config missing from config.\n"); |
| 58 | return; |
60 | return; |
| 59 | } |
61 | } |
| 60 | 62 | ||
| 61 | if (!this.myInitialArguments["Rotary"]) |
63 | if (!this.myInitialArguments["Rotary"]) |
| 62 | { |
64 | { |
| 63 | log(this.myName + ":" + this.myId + "> Failed to initialize, Rotary-config missing from config.\n"); |
65 | log(this.myName + ":" + this.myId + "> Failed to initialize, Rotary-config missing from config.\n"); |
| 64 | return; |
66 | return; |
| 65 | } |
67 | } |
| 66 | 68 | ||
| 67 | if (!this.myInitialArguments["softPWM"]) |
69 | if (!this.myInitialArguments["softPWM"]) |
| 68 | { |
70 | { |
| 69 | log(this.myName + ":" + this.myId + "> Failed to initialize, softPWM-config missing from config.\n"); |
71 | log(this.myName + ":" + this.myId + "> Failed to initialize, softPWM-config missing from config.\n"); |
| 70 | return; |
72 | return; |
| 71 | } |
73 | } |
| Line 74... | Line 76... | ||
| 74 | { |
76 | { |
| 75 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
77 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
| 76 | return; |
78 | return; |
| 77 | } |
79 | } |
| 78 | this.niceName = this.myInitialArguments["Name"]; |
80 | this.niceName = this.myInitialArguments["Name"]; |
| 79 | 81 | ||
| 80 | if (!this.myInitialArguments["ShortName"]) |
82 | if (!this.myInitialArguments["ShortName"]) |
| 81 | { |
83 | { |
| 82 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
84 | log(this.myName + ":" + this.myId + "> Failed to initialize, Name-config missing from config.\n"); |
| 83 | return; |
85 | return; |
| 84 | } |
86 | } |
| Line 86... | Line 88... | ||
| 86 | 88 | ||
| 87 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
89 | /* Get the LCD service that we want from the ServiceManager, it takes type, service name, service id */ |
| 88 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
90 | this.myLCDService = ServiceManager.getService("Can", "HD44789", this.myInitialArguments["HD44789"]["Id"]); |
| 89 | /* Add a callback for when the service goes online */ |
91 | /* Add a callback for when the service goes online */ |
| 90 | this.myLCDService.registerEventCallback("online", function(args) { self.lcdOnline(); }); |
92 | this.myLCDService.registerEventCallback("online", function(args) { self.lcdOnline(); }); |
| 91 | /* If the service is already online we should call the handler here */ |
93 | /* If the service is already online we should call the handler here */ |
| 92 | this.lcdOnline(); |
94 | this.lcdOnline(); |
| 93 | /* Add a callback for when the service goes offline */ |
95 | /* Add a callback for when the service goes offline */ |
| 94 | this.myLCDService.registerEventCallback("offline", function(args) { self.lcdOffline(); }); |
96 | this.myLCDService.registerEventCallback("offline", function(args) { self.lcdOffline(); }); |
| 95 | 97 | ||
| 96 | /* Get the Rotary service that we want from the ServiceManager, it takes type, service name, service id */ |
98 | /* Get the Rotary service that we want from the ServiceManager, it takes type, service name, service id */ |
| Line 110... | Line 112... | ||
| 110 | this.mySoftPwmService.registerEventCallback("online", function(args) { self.softPwmOnline(); }); |
112 | this.mySoftPwmService.registerEventCallback("online", function(args) { self.softPwmOnline(); }); |
| 111 | /* If the service is already online we should call the handler here */ |
113 | /* If the service is already online we should call the handler here */ |
| 112 | this.softPwmOnline(); |
114 | this.softPwmOnline(); |
| 113 | 115 | ||
| 114 | this.exchangeCalendar = new ExchangeCalendar(function(shortname, data) { self.exchangeCalendarLookupCallback(shortname, data); }); |
116 | this.exchangeCalendar = new ExchangeCalendar(function(shortname, data) { self.exchangeCalendarLookupCallback(shortname, data); }); |
| 115 | - | ||
| 116 | this.bookFromTime = new Date(); |
- | |
| 117 | this.bookFromTime.setHours(8); |
- | |
| 118 | this.bookFromTime.setMinutes(0); |
- | |
| 119 | this.bookToTime = new Date(); |
- | |
| 120 | this.bookToTime.setHours(8); |
- | |
| 121 | this.bookToTime.setMinutes(30); |
- | |
| 122 | - | ||
| 123 | 117 | ||
| 124 | /* create the first menu item */ |
118 | /* create the first menu item */ |
| 125 | this.statusMenuItem = new MenuItem(this); |
119 | this.statusMenuItem = new MenuItem(this); |
| 126 | this.statusMenuItem.displayData[0] = |
120 | this.statusMenuItem.displayData[0] = this.lcdCenterText(this.niceName); |
| 127 | this.statusMenuItem.doUpdate = this.updateStatusMenuItem; |
121 | this.statusMenuItem.doUpdate = this.updateStatusMenuItem; |
| 128 | this.currentMenuItem = this.statusMenuItem; |
122 | this.currentMenuItem = this.statusMenuItem; |
| 129 | 123 | ||
| 130 | /* create the menuitem where you can choose to enter the booking sub-menu */ |
124 | /* create the menuitem where you can choose to enter the booking sub-menu */ |
| 131 | this.bookMenuItem = new MenuItem(this); |
125 | this.bookMenuItem = new MenuItem(this); |
| 132 | this.bookMenuItem.displayData[0] = " |
126 | this.bookMenuItem.displayData[0] = this.lcdCenterText("Book room"; |
| 133 | this.bookMenuItem.displayData[1] = " |
127 | this.bookMenuItem.displayData[1] = this.lcdCenterText(""); |
| 134 | this.bookMenuItem.doUpdate = this.updateBookMenuItem; |
128 | this.bookMenuItem.doUpdate = this.updateBookMenuItem; |
| 135 | 129 | ||
| 136 | /* connect the items as a linked list */ |
130 | /* connect the items as a linked list */ |
| 137 | this.statusMenuItem.setNextItem(this.bookMenuItem); |
131 | this.statusMenuItem.setNextItem(this.bookMenuItem); |
| 138 | this.statusMenuItem.setPrevItem(this.bookMenuItem); |
132 | this.statusMenuItem.setPrevItem(this.bookMenuItem); |
| Line 147... | Line 141... | ||
| 147 | this.bookMenuItem.doRight = this.changeToNext; |
141 | this.bookMenuItem.doRight = this.changeToNext; |
| 148 | this.bookMenuItem.doLeft = this.changeToPrev; |
142 | this.bookMenuItem.doLeft = this.changeToPrev; |
| 149 | 143 | ||
| 150 | /* create the menuitem where you can choose the to-time */ |
144 | /* create the menuitem where you can choose the to-time */ |
| 151 | var menuChooseTo = new MenuItem(this); |
145 | var menuChooseTo = new MenuItem(this); |
| 152 | menuChooseTo.displayData[1] = " |
146 | menuChooseTo.displayData[1] = this.lcdCenterText("Ok Cancel"); |
| 153 | menuChooseTo.doUpdate = this.chooseBookTimeTo; |
147 | menuChooseTo.doUpdate = this.chooseBookTimeTo; |
| 154 | 148 | ||
| 155 | this.bookMenuItem.doPress = this. |
149 | this.bookMenuItem.doPress = this.startBooking; |
| 156 | this.bookMenuItem.setDescItem(menuChooseTo); |
150 | this.bookMenuItem.setDescItem(menuChooseTo); |
| 157 | 151 | ||
| 158 | /* create the menuitem where you can choose to book the room with OK */ |
152 | /* create the menuitem where you can choose to book the room with OK */ |
| 159 | var menuChooseOk = new MenuItem(this); |
153 | var menuChooseOk = new MenuItem(this); |
| 160 | menuChooseOk.displayData[1] = " |
154 | menuChooseOk.displayData[1] = this.lcdCenterText("<Ok> Cancel"); |
| 161 | menuChooseOk.doUpdate = this.setBookTime; |
155 | menuChooseOk.doUpdate = this.setBookTime; |
| 162 | 156 | ||
| 163 | /* create the menuitem where you can choose to cancel the booking */ |
157 | /* create the menuitem where you can choose to cancel the booking */ |
| 164 | var menuChooseCancel = new MenuItem(this); |
158 | var menuChooseCancel = new MenuItem(this); |
| 165 | menuChooseCancel.displayData[1] = " |
159 | menuChooseCancel.displayData[1] = this.lcdCenterText("Ok <Cancel>"); |
| 166 | menuChooseCancel.doUpdate = this.setBookTime; |
160 | menuChooseCancel.doUpdate = this.setBookTime; |
| 167 | 161 | ||
| 168 | /* create the menuitem where you can choose the from-time */ |
162 | /* create the menuitem where you can choose the from-time */ |
| 169 | var menuChooseFrom = new MenuItem(this); |
163 | var menuChooseFrom = new MenuItem(this); |
| 170 | menuChooseFrom.displayData[1] = " |
164 | menuChooseFrom.displayData[1] = this.lcdCenterText("Ok Cancel"); |
| 171 | menuChooseFrom.doUpdate = this.chooseBookTimeFrom; |
165 | menuChooseFrom.doUpdate = this.chooseBookTimeFrom; |
| 172 | 166 | ||
| 173 | /* connect the items as a linked list */ |
167 | /* connect the items as a linked list */ |
| 174 | menuChooseTo.setNextItem(menuChooseOk); |
168 | menuChooseTo.setNextItem(menuChooseOk); |
| 175 | menuChooseTo.setPrevItem(menuChooseFrom); |
169 | menuChooseTo.setPrevItem(menuChooseFrom); |
| Line 203... | Line 197... | ||
| 203 | menuChooseFrom.doPress = this.changeToDesc; |
197 | menuChooseFrom.doPress = this.changeToDesc; |
| 204 | 198 | ||
| 205 | /* create the menuitem where you can modify the to-time */ |
199 | /* create the menuitem where you can modify the to-time */ |
| 206 | var menuSetTo = new MenuItem(this); |
200 | var menuSetTo = new MenuItem(this); |
| 207 | menuSetTo.doUpdate = this.setBookTimeTo; |
201 | menuSetTo.doUpdate = this.setBookTimeTo; |
| 208 | menuSetTo.displayData[0] = " |
202 | menuSetTo.displayData[0] = this.lcdCenterText("Set end time"); |
| 209 | menuSetTo.doRight = this.incBookTimeTo; |
203 | menuSetTo.doRight = this.incBookTimeTo; |
| 210 | menuSetTo.doLeft = this.decBookTimeTo; |
204 | menuSetTo.doLeft = this.decBookTimeTo; |
| 211 | menuSetTo.doPress = this.changeToDesc; |
205 | menuSetTo.doPress = this.changeToDesc; |
| 212 | menuSetTo.setDescItem(menuChooseTo); |
206 | menuSetTo.setDescItem(menuChooseTo); |
| 213 | menuChooseTo.setDescItem(menuSetTo); |
207 | menuChooseTo.setDescItem(menuSetTo); |
| 214 | 208 | ||
| 215 | /* create the menuitem where you can modify the from-time */ |
209 | /* create the menuitem where you can modify the from-time */ |
| 216 | var menuSetFrom = new MenuItem(this); |
210 | var menuSetFrom = new MenuItem(this); |
| 217 | menuSetFrom.doUpdate = this.setBookTimeFrom; |
211 | menuSetFrom.doUpdate = this.setBookTimeFrom; |
| 218 | menuSetFrom.displayData[0] = " |
212 | menuSetFrom.displayData[0] = this.lcdCenterText("Set start time"); |
| 219 | menuSetFrom.doRight = this.incBookTimeFrom; |
213 | menuSetFrom.doRight = this.incBookTimeFrom; |
| 220 | menuSetFrom.doLeft = this.decBookTimeFrom; |
214 | menuSetFrom.doLeft = this.decBookTimeFrom; |
| 221 | menuSetFrom.doPress = this.changeToDesc; |
215 | menuSetFrom.doPress = this.changeToDesc; |
| 222 | menuSetFrom.setDescItem(menuChooseFrom); |
216 | menuSetFrom.setDescItem(menuChooseFrom); |
| 223 | menuChooseFrom.setDescItem(menuSetFrom); |
217 | menuChooseFrom.setDescItem(menuSetFrom); |
| 224 | 218 | ||
| 225 | } |
219 | } |
| 226 | 220 | ||
| - | 221 | Display.prototype.startBooking = function() |
|
| - | 222 | { |
|
| - | 223 | this.parentDisplay.bookFromTime = new Date(); |
|
| - | 224 | this.parentDisplay.bookToTime = new Date(); |
|
| - | 225 | //this.bookFromTime.setHours(8); |
|
| - | 226 | //this.bookToTime.setHours(8); |
|
| - | 227 | if (this.parentDisplay.bookFromTime.getMinutes() < 30) |
|
| - | 228 | { |
|
| - | 229 | this.parentDisplay.bookFromTime.setMinutes(0); |
|
| - | 230 | this.parentDisplay.bookToTime.setMinutes(30); |
|
| - | 231 | } |
|
| - | 232 | else |
|
| - | 233 | { |
|
| - | 234 | this.parentDisplay.bookFromTime.setMinutes(30); |
|
| - | 235 | this.parentDisplay.bookToTime.setHours(this.parentDisplay.bookToTime.getHours()+1); |
|
| - | 236 | this.parentDisplay.bookToTime.setMinutes(0); |
|
| - | 237 | } |
|
| - | 238 | ||
| - | 239 | this.parentDisplay.currentMenuItem = this.parentDisplay.currentMenuItem.descItem; |
|
| - | 240 | } |
|
| - | 241 | ||
| 227 | Display.prototype.changeToDesc = function() |
242 | Display.prototype.changeToDesc = function() |
| 228 | { |
243 | { |
| 229 | if (this.descItem) |
244 | if (this.descItem) |
| 230 | { |
245 | { |
| 231 | this.parentDisplay.currentMenuItem = this.descItem; |
246 | this.parentDisplay.currentMenuItem = this.descItem; |
| 232 | } |
247 | } |
| 233 | } |
248 | } |
| 234 | 249 | ||
| Line 323... | Line 338... | ||
| 323 | } |
338 | } |
| 324 | 339 | ||
| 325 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
340 | Display.prototype.exchangeCalendarLookupCallback = function(shortname, data) |
| 326 | { |
341 | { |
| 327 | log("callback: "+shortname+" \n"); |
342 | log("callback: "+shortname+" \n"); |
| 328 | if (shortname == this.shortName) |
343 | if (shortname == this.shortName) |
| 329 | { |
344 | { |
| 330 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
345 | //FIXME check if data contains error tag and error message, print to log and keep previous data? |
| 331 | this.exchangeData = data; |
346 | this.exchangeData = data; |
| 332 | 347 | ||
| 333 | this.createCalendarMenu(); |
348 | this.createCalendarMenu(); |
| 334 | } |
349 | } |
| 335 | } |
350 | } |
| 336 | 351 | ||
| 337 | Display.prototype.createCalendarMenu = function() |
352 | Display.prototype.createCalendarMenu = function() |
| 338 | { |
353 | { |
| 339 | log("createCalendar \n"); |
354 | log("createCalendar \n"); |
| 340 | if (this.exchangeData) |
355 | if (this.exchangeData) |
| 341 | { |
356 | { |
| Line 344... | Line 359... | ||
| 344 | for (var i = 0; i < this.exchangeData.meetings.length; i++) |
359 | for (var i = 0; i < this.exchangeData.meetings.length; i++) |
| 345 | { |
360 | { |
| 346 | log("looping \n"); |
361 | log("looping \n"); |
| 347 | /* create the menuitem for a calendar meeting */ |
362 | /* create the menuitem for a calendar meeting */ |
| 348 | var menu = new MenuItem(this); |
363 | var menu = new MenuItem(this); |
| 349 | menu.displayData[0] = this. |
364 | menu.displayData[0] = this.lcdCenterText(this.exchangeData.meetings[i].organizer); |
| 350 | menu.displayData[1] = |
365 | menu.displayData[1] = this.lcdCenterText(this.exchangeData.meetings[i].start.replace(":",".") + " - " |
| 351 | + this.exchangeData.meetings[i].end.replace(":",".") |
366 | + this.exchangeData.meetings[i].end.replace(":",".")); |
| 352 | menu.doRight = this.changeToNext; |
367 | menu.doRight = this.changeToNext; |
| 353 | menu.doLeft = this.changeToPrev; |
368 | menu.doLeft = this.changeToPrev; |
| 354 | 369 | ||
| 355 | if (i == 0) |
370 | if (i == 0) |
| 356 | { |
371 | { |
| Line 358... | Line 373... | ||
| 358 | } |
373 | } |
| 359 | else |
374 | else |
| 360 | { |
375 | { |
| 361 | menu.setPrevItem(lastMenuItem); |
376 | menu.setPrevItem(lastMenuItem); |
| 362 | lastMenuItem.setNextItem(menu); |
377 | lastMenuItem.setNextItem(menu); |
| 363 | } |
378 | } |
| 364 | 379 | ||
| 365 | lastMenuItem = menu; |
380 | lastMenuItem = menu; |
| 366 | } |
381 | } |
| 367 | this.exchangeCalendarLastMenuItem = lastMenuItem; |
382 | this.exchangeCalendarLastMenuItem = lastMenuItem; |
| 368 | this.exchangeCalendarLastMenuItem.setNextItem(this.bookMenuItem); |
383 | this.exchangeCalendarLastMenuItem.setNextItem(this.bookMenuItem); |
| 369 | this.exchangeCalendarFirstMenuItem.setPrevItem(this.statusMenuItem); |
384 | this.exchangeCalendarFirstMenuItem.setPrevItem(this.statusMenuItem); |
| 370 | } |
385 | } |
| 371 | } |
386 | } |
| 372 | 387 | ||
| 373 | Display.prototype.softPwmOnline = function() |
388 | Display.prototype.softPwmOnline = function() |
| 374 | { |
389 | { |
| 375 | } |
390 | } |
| 376 | 391 | ||
| 377 | Display.prototype.rotaryOnline = function() |
392 | Display.prototype.rotaryOnline = function() |
| 378 | { |
393 | { |
| 379 | } |
394 | } |
| 380 | 395 | ||
| 381 | Display.prototype.rotaryPosUpdate = function(SwitchId) |
396 | Display.prototype.rotaryPosUpdate = function(SwitchId) |
| 382 | { |
397 | { |
| 383 | for (var i = 0; i < this.myRotaryService.getSteps(SwitchId); i++) |
398 | for (var i = 0; i < this.myRotaryService.getSteps(SwitchId); i++) |
| 384 | { |
399 | { |
| 385 | if (this.myRotaryService.getDirection(SwitchId) == "Clockwise") |
400 | if (this.myRotaryService.getDirection(SwitchId) == "Clockwise") |
| 386 | { |
401 | { |
| 387 | if (this.currentMenuItem.doRight) |
402 | if (this.currentMenuItem.doRight) |
| Line 390... | Line 405... | ||
| 390 | } |
405 | } |
| 391 | } |
406 | } |
| 392 | else |
407 | else |
| 393 | { |
408 | { |
| 394 | if (this.currentMenuItem.doLeft) |
409 | if (this.currentMenuItem.doLeft) |
| 395 | { |
410 | { |
| 396 | this.currentMenuItem.doLeft(); |
411 | this.currentMenuItem.doLeft(); |
| 397 | } |
412 | } |
| 398 | } |
413 | } |
| 399 | } |
414 | } |
| 400 | 415 | ||
| 401 | this.updateDisplay(); |
416 | this.updateDisplay(); |
| 402 | } |
417 | } |
| 403 | 418 | ||
| 404 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
419 | Display.prototype.rotaryBtnUpdate = function(SwitchId) |
| 405 | { |
420 | { |
| 406 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
421 | if (this.myRotaryService.getButtonStatus(SwitchId) == "Released") |
| 407 | { |
422 | { |
| 408 | if (this.currentMenuItem.doPress) |
423 | if (this.currentMenuItem.doPress) |
| 409 | { |
424 | { |
| 410 | this.currentMenuItem.doPress(); |
425 | this.currentMenuItem.doPress(); |
| 411 | } |
426 | } |
| 412 | } |
427 | } |
| Line 428... | Line 443... | ||
| 428 | for (var i = 0; i < this.currentMenuItem.displayData.length; i++) |
443 | for (var i = 0; i < this.currentMenuItem.displayData.length; i++) |
| 429 | { |
444 | { |
| 430 | this.myLCDService.printText(0, i, this.currentMenuItem.displayData[i]); |
445 | this.myLCDService.printText(0, i, this.currentMenuItem.displayData[i]); |
| 431 | } |
446 | } |
| 432 | 447 | ||
| - | 448 | } |
|
| - | 449 | ||
| - | 450 | Display.prototype.lcdCenterText = function(text) |
|
| - | 451 | { |
|
| - | 452 | returnText = text; |
|
| - | 453 | var displayWidth = this.myLCDService.getWidth(); |
|
| - | 454 | /* pad on both sides with spaces to displayWidth */ |
|
| - | 455 | returnText = text.pad(displayWidth, " ", 2); |
|
| - | 456 | ||
| - | 457 | /*if (displayWidth > text.length) |
|
| - | 458 | { |
|
| - | 459 | paddingLen = displayWidth - text.length; |
|
| - | 460 | paddingLen = Math.round((paddingLen/2-0.5)); |
|
| - | 461 | returnText = text |
|
| - | 462 | }*/ |
|
| - | 463 | ||
| - | 464 | return returnText; |
|
| 433 | } |
465 | } |
| 434 | 466 | ||
| 435 | Display.prototype.lcdOffline = function() |
467 | Display.prototype.lcdOffline = function() |
| 436 | { |
468 | { |
| 437 | /* If we have no interval timer running do nothing */ |
469 | /* If we have no interval timer running do nothing */ |