|
1 | | -from mpos import Activity, pct_of_display_width |
| 1 | +from mpos import Activity, pct_of_display_width, get_display_width, get_display_height, get_dpi |
2 | 2 |
|
3 | 3 | import mpos.info |
4 | 4 | import sys |
@@ -90,32 +90,22 @@ def onCreate(self): |
90 | 90 | try: |
91 | 91 | self._add_label(screen, f"{lv.SYMBOL.SETTINGS} ESP32 Hardware", is_header=True) |
92 | 92 | import esp32 |
93 | | - self._add_label(screen, f"Flash size: {esp32.flash_size()} bytes") |
94 | | - try: |
95 | | - psram_size = esp32.psram_size() |
96 | | - self._add_label(screen, f"PSRAM size: {psram_size} bytes") |
97 | | - except: |
98 | | - pass |
99 | | - try: |
100 | | - idf_version = esp32.idf_version() |
101 | | - self._add_label(screen, f"IDF version: {idf_version}") |
102 | | - except: |
103 | | - pass |
| 93 | + self._add_label(screen, f"Temperature: {esp32.mcu_temperature()} °C") |
104 | 94 | except Exception as e: |
105 | 95 | print(f"Could not get ESP32 hardware info: {e}") |
106 | 96 |
|
107 | | - # Partition info (ESP32 only) |
108 | | - try: |
109 | | - self._add_label(screen, f"{lv.SYMBOL.SD_CARD} Partition Info", is_header=True) |
110 | | - from esp32 import Partition |
111 | | - current = Partition(Partition.RUNNING) |
112 | | - self._add_label(screen, f"Partition.RUNNING: {current}") |
113 | | - next_partition = current.get_next_update() |
114 | | - self._add_label(screen, f"Next update partition: {next_partition}") |
115 | | - except Exception as e: |
116 | | - error = f"Could not find partition info because: {e}\nIt's normal to get this error on desktop." |
117 | | - print(error) |
118 | | - self._add_label(screen, error) |
| 97 | + # Partition info (ESP32 only) |
| 98 | + try: |
| 99 | + self._add_label(screen, f"{lv.SYMBOL.SD_CARD} Partition Info", is_header=True) |
| 100 | + from esp32 import Partition |
| 101 | + current = Partition(Partition.RUNNING) |
| 102 | + self._add_label(screen, f"Partition.RUNNING: {current}") |
| 103 | + next_partition = current.get_next_update() |
| 104 | + self._add_label(screen, f"Next update partition: {next_partition}") |
| 105 | + except Exception as e: |
| 106 | + error = f"Could not find partition info because: {e}\nIt's normal to get this error on desktop." |
| 107 | + print(error) |
| 108 | + self._add_label(screen, error) |
119 | 109 |
|
120 | 110 | # Machine info |
121 | 111 | try: |
@@ -154,16 +144,11 @@ def onCreate(self): |
154 | 144 | # Display info |
155 | 145 | try: |
156 | 146 | self._add_label(screen, f"{lv.SYMBOL.IMAGE} Display", is_header=True) |
157 | | - disp = lv.disp_get_default() |
158 | | - if disp: |
159 | | - hor_res = disp.get_hor_res() |
160 | | - ver_res = disp.get_ver_res() |
161 | | - self._add_label(screen, f"Resolution: {hor_res}x{ver_res}") |
162 | | - try: |
163 | | - dpi = disp.get_dpi() |
164 | | - self._add_label(screen, f"DPI: {dpi}") |
165 | | - except: |
166 | | - pass |
| 147 | + hor_res = get_display_width() |
| 148 | + ver_res = get_display_height() |
| 149 | + self._add_label(screen, f"Resolution: {hor_res}x{ver_res}") |
| 150 | + dpi = get_dpi() |
| 151 | + self._add_label(screen, f"Dots Per Inch (dpi): {dpi}") |
167 | 152 | except Exception as e: |
168 | 153 | print(f"Could not get display info: {e}") |
169 | 154 |
|
|
0 commit comments