Commits

clach04  committed b5e11b4

refactor, re-plugging in LCD now causes all items to be displayed immediately (e.g. disk space)

  • Participants
  • Parent commits 06ea0f6

Comments (0)

Files changed (1)

         # default
         include_secs = True
 
-    def connect_and_reset():
-        """Connect to LCD (wait if not available).
-        Reset to the needed config"""
-        while 1:
-            try:
-                l.info('attempting to open usb lcd')
-                d = LCDSysInfo()
-                break
-            except IOError:
-                pass
-            l.info('usb lcd not available, trying again in %d secs' % retry_delay_time)
-            time.sleep(retry_delay_time)
-        
-        d.clear_lines(TextLines.ALL, bg)
-        # ensure the "usb connected" icon is not shown
-        # by calling dim_when_idle(), this is documented
-        # in C# code but not the Python code
-        #d.dim_when_idle(False)
-        d.dim_when_idle(True)
-        d.set_brightness(brightness)
-        d.save_brightness(127, 255)
-        d.set_text_background_colour(bg)
-        
-        # Show initial power on image.
-        # this ensure the "usb connected" icon is not shown
-        #image_idx = large_image_indexes[0]
-        #d.display_icon(0, image_idx)
-        
-        # for now clear the screen to single color/colour
-        d.clear_lines(TextLines.ALL, bg)
-        return d
-
     def display_datetime_icon():
         """Quick and dirty icon text painter.
         NOTE requires large icons to be pre-loaded."""
             func()
 
     s = MySchedule()
-    s.add(0, paint_everything)
+    
+    def connect_and_reset():
+        """Connect to LCD (wait if not available).
+        Reset to the needed config"""
+        while 1:
+            try:
+                l.info('attempting to open usb lcd')
+                d = LCDSysInfo()
+                break
+            except IOError:
+                pass
+            l.info('usb lcd not available, trying again in %d secs' % retry_delay_time)
+            time.sleep(retry_delay_time)
+        
+        d.clear_lines(TextLines.ALL, bg)
+        # ensure the "usb connected" icon is not shown
+        # by calling dim_when_idle(), this is documented
+        # in C# code but not the Python code
+        #d.dim_when_idle(False)
+        d.dim_when_idle(True)
+        d.set_brightness(brightness)
+        d.save_brightness(127, 255)
+        d.set_text_background_colour(bg)
+        
+        # Show initial power on image.
+        # this ensure the "usb connected" icon is not shown
+        #image_idx = large_image_indexes[0]
+        #d.display_icon(0, image_idx)
+        
+        # for now clear the screen to single color/colour
+        d.clear_lines(TextLines.ALL, bg)
+        s.add(0, paint_everything)
+        return d
+
     d = PluggableLCDSysInfo(connect_and_reset)
     ignore_missing_sensors = conf.get('temperature.ignore_missing_sensors', True)
     debug_temps = conf.get('temperature.debug_temps', False)