|
5 | 5 | # Display an LVGL (.bin) font on a CircuitPython board and |
6 | 6 | # 640x480 DVI display. Unknown characters will be "." |
7 | 7 | # |
| 8 | +# pylint: disable=broad-except, bare-except |
| 9 | + |
| 10 | +import gc |
8 | 11 | import displayio |
9 | 12 | import supervisor |
10 | 13 | from adafruit_bitmap_font import bitmap_font |
11 | 14 | from adafruit_display_text import label |
12 | | -import gc |
13 | 15 | from adafruit_fruitjam.peripherals import request_display_config |
14 | 16 |
|
15 | 17 | # Use the easy library call to set the resolution |
|
25 | 27 | # Font loading with error handling and diagnostics |
26 | 28 | font_file = "fonts/CP437_16h.bin" |
27 | 29 | try: |
28 | | - font = bitmap_font.load_font(font_file) |
| 30 | + font = bitmap_font.load_font(font_file) # pylint: disable=redefined-outer-name |
29 | 31 | print(f"Font loaded: {font_file}") |
30 | 32 | print(f"Memory after font load: {gc.mem_free()}") |
31 | 33 |
|
|
73 | 75 | current_y = char_height |
74 | 76 | current_line_start = 0 |
75 | 77 |
|
76 | | -def create_char_label(font, char, x, y): |
| 78 | +def create_char_label(font, chr, x, y): |
77 | 79 | """Helper function to create character labels with error handling""" |
78 | 80 | try: |
79 | | - return label.Label(font, text=char, color=0xFFFFFF, x=x, y=y) |
| 81 | + return label.Label(font, text=chr, color=0xFFFFFF, x=x, y=y) |
80 | 82 | except Exception as e: |
81 | | - print(f"Error creating label for '{char}': {e}") |
| 83 | + print(f"Error creating label for '{chr}': {e}") |
82 | 84 | return None |
83 | 85 |
|
84 | 86 | # Add first line number |
@@ -147,7 +149,8 @@ def create_char_label(font, char, x, y): |
147 | 149 |
|
148 | 150 | # Progress indicator for debugging |
149 | 151 | if char_code % 32 == 0: |
150 | | - print(f"Processed up to character {char_code}, memory: {gc.mem_free()}") |
| 152 | + print(f"Processed up to character {char_code}, memory: {gc.mem_free()}") / |
| 153 | + # pylint: disable=f-string-without-interpolation |
151 | 154 |
|
152 | 155 | print(f"\nCompleted character display:") |
153 | 156 | print(f"Found {displayed_count - skipped_count} characters with glyphs") |
|
0 commit comments