()
| 610 | } |
| 611 | |
| 612 | // Map installed driver names to display size keys for the dropdown |
| 613 | function epdTypeToSizeKey(epd_type) { |
| 614 | if (!epd_type || epd_type === 'auto') return 'auto'; |
| 615 | if (epd_type.startsWith('epd2in13')) return '2in13'; |
| 616 | if (epd_type.startsWith('epd2in7')) return '2in7'; |
| 617 | if (epd_type.startsWith('epd2in9')) return '2in9'; |
| 618 | if (epd_type.startsWith('epd3in7')) return '3in7'; |
| 619 | if (epd_type.startsWith('epd4in26')) return '4in26'; |
| 620 | if (epd_type === 'ili9486' || epd_type === 'ili9488') return '3in5_tft'; |
| 621 | if (epd_type === 'gc9a01') return '1in28_tft'; |
| 622 | if (epd_type === 'st7735s') return '1in44_lcd'; |
| 623 | if (epd_type === 'whisplay') return '1in69_tft'; |
| 624 | if (epd_type === 'ssd1306') return '0in96_oled'; |
| 625 | if (epd_type === 'lcd1602') return 'lcd1602'; |
| 626 | return epd_type; // fallback: return as-is |
| 627 | } |
| 628 | |
| 629 | const displaySelectOptions = { |
| 630 | epd_type: [ |
| 631 | { value: 'auto', label: 'Auto-detect' }, |
| 632 | { value: '2in13', label: '2.13" e-Paper (122x250)' }, |
| 633 | { value: '2in7', label: '2.7" e-Paper (176x264)' }, |
| 634 | { value: '2in9', label: '2.9" e-Paper (128x296)' }, |
| 635 | { value: '3in7', label: '3.7" e-Paper (280x480)' }, |
| 636 | { value: '4in26', label: '4.26" e-Paper (800x480)' }, |
| 637 | { value: '3in5_tft', label: '3.5" SPI TFT — ILI9486/ILI9488 (320x480)' }, |
| 638 | { value: '1in28_tft', label: '1.28" GC9A01 Round TFT (240x240)' }, |
| 639 | { value: '1in44_lcd', label: '1.44" ST7735S LCD HAT + joystick (128x128)' }, |
| 640 | { value: '1in69_tft', label: '1.69" Whisplay ST7789 TFT (240x280)' }, |
| 641 | { value: '0in96_oled', label: '0.96" SSD1306 OLED (128x64)' }, |
| 642 | { value: 'lcd1602', label: '16×2 LCD1602 Character LCD (I2C)' }, |
| 643 | { value: 'max7219_8panel', label: 'MAX7219 8-panel LED Matrix (64×8)' }, |
| 644 | { value: 'max7219_4panel', label: 'MAX7219 4-panel LED Matrix (32×8)' } |
| 645 | ], |
| 646 | screen_reversed: [ |
| 647 | { value: '0', label: 'Normal (0°)' }, |
| 648 | { value: '90', label: 'Rotate 90°' }, |
| 649 | { value: '180', label: 'Rotate 180°' }, |
| 650 | { value: '270', label: 'Rotate 270°' } |
| 651 | ] |
| 652 | }; |
| 653 | |
| 654 | function getConfigDescription(key) { |
| 655 | if (configMetadata[key] && configMetadata[key].description) { |
| 656 | return configMetadata[key].description; |
| 657 | } |
| 658 | return "No additional information available for this setting."; |
| 659 | } |
| 660 | |
| 661 | function escapeHtml(text) { |
| 662 | const div = document.createElement('div'); |
| 663 | div.textContent = text; |
| 664 | return div.innerHTML; |
| 665 | } |
| 666 | |
| 667 | // Escapes a value for safe embedding inside a single-quoted JS string |
| 668 | // that lives inside an HTML attribute (e.g. onclick="fn('VALUE')"). |
| 669 | // escapeHtml alone does not escape single quotes. |
no test coverage detected