Support every datasheet command and map text to the CG-ROM fonts
- Brightness, blink, screen on/off, annunciators, cursor control, display modes, user-defined characters, code table, international charset, peripheral select, self-test, raw writes and reinit - UTF-8 text is encoded with the selected code table (tables generated from Python codecs by tools/gen_charmaps.py), falling back to accent-stripping - Settings survive reinit and the self-test - Example gains brightness select and display switch, and uses the git source on mangavalk.com Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3fcd15ad86
commit
95686a3608
8 files changed
+1322
-148
No files matched your search
@@ -21,7 +21,7 @@ esphome:
|
||||
id: vfd
|
||||
- samsung_vfd.print:
|
||||
id: vfd
|
||||
text: "Hello World!"
|
||||
text: "Hello World! ~" # "~" is the heart defined below
|
||||
centered: true
|
||||
- delay: 3s
|
||||
# Bring back the last text Home Assistant set for the top line.
|
||||
@@ -31,7 +31,10 @@ esphome:
|
||||
text: !lambda "return id(vfd_line1).state;"
|
||||
|
||||
external_components:
|
||||
- source: github://REPO_OWNER/REPO_NAME@main
|
||||
- source:
|
||||
type: git
|
||||
url: https://mangavalk.com/mangavalk/esphome-samsung-vfd
|
||||
ref: main
|
||||
components: [samsung_vfd]
|
||||
refresh: 1d
|
||||
# While developing the component, use the checkout instead:
|
||||
@@ -78,12 +81,14 @@ time:
|
||||
- 0.pool.ntp.org
|
||||
- 1.pool.ntp.org
|
||||
|
||||
# Must match the display's jumpers; all open (factory default) = 9600, no parity.
|
||||
uart:
|
||||
id: uart_vfd
|
||||
tx_pin:
|
||||
number: GPIO17
|
||||
inverted: false # true when wired directly, without a MAX3232
|
||||
baud_rate: 9600
|
||||
parity: NONE
|
||||
# The display is output-only for us; no rx_pin needed.
|
||||
|
||||
samsung_vfd:
|
||||
@@ -91,8 +96,20 @@ samsung_vfd:
|
||||
uart_id: uart_vfd
|
||||
cols: 20
|
||||
rows: 2
|
||||
# Lines are padded to 20 chars and the display wraps to line 2 by itself.
|
||||
send_newlines: false
|
||||
brightness: 100%
|
||||
code_table: PC437 # glyphs for é, ü, °, ½, box drawing ... (match jumpers 6-8)
|
||||
international_charset: USA
|
||||
# Up to 4 custom glyphs, replacing a printable ASCII character you don't use.
|
||||
user_characters:
|
||||
- code: "~"
|
||||
pattern:
|
||||
- ".#.#."
|
||||
- "#####"
|
||||
- "#####"
|
||||
- "#####"
|
||||
- ".###."
|
||||
- "..#.."
|
||||
- "....."
|
||||
|
||||
# Bottom line shows the SNTP clock every second, except while a status banner is up.
|
||||
interval:
|
||||
@@ -171,3 +188,31 @@ text:
|
||||
- script.execute:
|
||||
id: show_status
|
||||
msg: !lambda "return x;"
|
||||
|
||||
# Brightness (4 levels) and power from Home Assistant.
|
||||
select:
|
||||
- platform: template
|
||||
name: "VFD brightness"
|
||||
icon: mdi:brightness-6
|
||||
optimistic: true
|
||||
restore_value: true
|
||||
options: ["40%", "60%", "80%", "100%"]
|
||||
initial_option: "100%"
|
||||
on_value:
|
||||
then:
|
||||
- samsung_vfd.set_brightness:
|
||||
id: vfd
|
||||
brightness: !lambda "return (i + 2) * 0.2f;"
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: "VFD display"
|
||||
icon: mdi:monitor
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
turn_on_action:
|
||||
- samsung_vfd.turn_on:
|
||||
id: vfd
|
||||
turn_off_action:
|
||||
- samsung_vfd.turn_off:
|
||||
id: vfd
|
||||
Reference in new issue
Block a user